source: osm/applications/editors/josm/plugins/seachart/src/symbols/Beacons.java@ 35685

Last change on this file since 35685 was 35479, checked in by malcolmh, 5 years ago

[Seachart] Publish new release

File size: 15.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package symbols;
3
4import java.awt.BasicStroke;
5import java.awt.Color;
6import java.awt.geom.Arc2D;
7import java.awt.geom.Ellipse2D;
8import java.awt.geom.GeneralPath;
9import java.awt.geom.Line2D;
10import java.awt.geom.Path2D;
11import java.awt.geom.Rectangle2D;
12import java.util.EnumMap;
13
14import s57.S57val.BcnSHP;
15import symbols.Symbols.Form;
16import symbols.Symbols.Instr;
17import symbols.Symbols.Symbol;
18
19/**
20 * @author Malcolm Herring
21 */
22public final class Beacons {
23 private Beacons() {
24 // Hide default constructor for utilities classes
25 }
26
27 // CHECKSTYLE.OFF: LineLength
28 public static final Symbol Beacon = new Symbol();
29 static {
30 Symbol colours = new Symbol();
31 Path2D.Double p = new Path2D.Double(); p.moveTo(-6.0, -8.5); p.lineTo(-6.0, -70.0); p.lineTo(6.0, -70.0); p.lineTo(6.0, -8.5); p.curveTo(6.0, -10.0, -6.0, -10.0, -6.0, -8.5); p.closePath();
32 colours.add(new Instr(Form.P1, p));
33 p = new Path2D.Double(); p.moveTo(-6.0, -8.5); p.lineTo(-6.0, -40.0); p.lineTo(6.0, -40.0); p.lineTo(6.0, -8.5); p.curveTo(6.0, -10.0, -6.0, -10.0, -6.0, -8.5); p.closePath();
34 colours.add(new Instr(Form.H2, p));
35 p = new Path2D.Double(); p.moveTo(-6.0, -30.0); p.lineTo(-6.0, -50.0); p.lineTo(6.0, -50.0); p.lineTo(6.0, -30.0); p.closePath();
36 colours.add(new Instr(Form.H3, p));
37 p = new Path2D.Double(); p.moveTo(-6.0, -40.0); p.lineTo(-6.0, -55.0); p.lineTo(6.0, -55.0); p.lineTo(6.0, -40.0); p.closePath();
38 colours.add(new Instr(Form.H4, p));
39 p = new Path2D.Double(); p.moveTo(-6.0, -25.0); p.lineTo(-6.0, -40.0); p.lineTo(6.0, -40.0); p.lineTo(6.0, -25.0); p.closePath();
40 colours.add(new Instr(Form.H5, p));
41 p = new Path2D.Double(); p.moveTo(0.0, -70.0); p.lineTo(6.0, -70.0); p.lineTo(6.0, -8.5); p.quadTo(3.0, -9.3, 0.0, -10.0); p.closePath();
42 colours.add(new Instr(Form.V2, p));
43 Beacon.add(new Instr(Form.COLR, colours));
44 Beacon.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
45 Beacon.add(new Instr(Form.FILL, Color.black));
46 Beacon.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
47 Beacon.add(new Instr(Form.LINE, new Line2D.Double(-20, 0, -10, 0)));
48 Beacon.add(new Instr(Form.LINE, new Line2D.Double(10, 0, 20, 0)));
49 p = new Path2D.Double(); p.moveTo(-6.0, -8.5); p.lineTo(-6.0, -70.0); p.lineTo(6.0, -70.0); p.lineTo(6.0, -8.5);
50 Beacon.add(new Instr(Form.PLIN, p));
51 }
52
53 public static final Symbol Cairn = new Symbol();
54 static {
55 Cairn.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
56 Cairn.add(new Instr(Form.FILL, Color.black));
57 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
58 Cairn.add(new Instr(Form.LINE, new Line2D.Double(-40, 0, -10, 0)));
59 Cairn.add(new Instr(Form.LINE, new Line2D.Double(10, 0, 40, 0)));
60 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(3, -40, 40, 40)));
61 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-43, -40, 40, 40)));
62 Cairn.add(new Instr(Form.ELPS, new Ellipse2D.Double(-18, -70, 36, 36)));
63 }
64
65 public static final Symbol Floodlight = new Symbol();
66 static {
67 Floodlight.add(new Instr(Form.BBOX, new Rectangle2D.Double(-50, -50, 100, 100)));
68 Floodlight.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)));
69 Floodlight.add(new Instr(Form.FILL, new Color(0xffff00)));
70 Path2D.Double p = new Path2D.Double(); p.moveTo(0, 0); p.lineTo(-34, -15); p.quadTo(-35, -31, -20, -31); p.lineTo(0, 0);
71 p.moveTo(-20, -31); p.quadTo(-13, -44, 0, -36); p.lineTo(0, 0);
72 p.moveTo(0, -36); p.quadTo(13, -44, 20, -31); p.lineTo(0, 0);
73 p.moveTo(20, -31); p.quadTo(35, -31, 34, -15); p.lineTo(0, 0);
74 Floodlight.add(new Instr(Form.PLIN, p));
75 }
76
77 public static final Symbol FogSignal = new Symbol();
78 static {
79 FogSignal.add(new Instr(Form.STRK, new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
80 FogSignal.add(new Instr(Form.FILL, Color.black));
81 FogSignal.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
82 FogSignal.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
83 FogSignal.add(new Instr(Form.FILL, new Color(0xd400d4)));
84 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-120.0, -120.0, 240.0, 240.0, 190.0, 50.0, Arc2D.OPEN)));
85 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-92.5, -92.5, 185.0, 185.0, 190.0, 50.0, Arc2D.OPEN)));
86 FogSignal.add(new Instr(Form.EARC, new Arc2D.Double(-65.0, -65.0, 130.0, 130.0, 190.0, 50.0, Arc2D.OPEN)));
87 }
88
89 public static final Symbol Lattice = new Symbol();
90 static {
91 Symbol colours = new Symbol();
92 Path2D.Double p = new Path2D.Double(); p.moveTo(-20.0, 0.0); p.lineTo(-15.0, -70.0); p.lineTo(15.0, -70.0); p.lineTo(20.0, 0.0); p.lineTo(10.0, 0.0); p.curveTo(10.0, -13.3, -10.0, -13.3, -10.0, 0.0); p.closePath();
93 colours.add(new Instr(Form.P1, p));
94 p = new Path2D.Double(); p.moveTo(-20.0, 0.0); p.lineTo(-17.5, -35.0); p.lineTo(17.5, -35.0); p.lineTo(20.0, 0.0); p.lineTo(10.0, 0.0); p.curveTo(10.0, -13.3, -10.0, -13.3, -10.0, 0.0); p.closePath();
95 colours.add(new Instr(Form.H2, p));
96 p = new Path2D.Double(); p.moveTo(-18.3, -23.3); p.lineTo(-16.7, -46.7); p.lineTo(16.7, -46.7); p.lineTo(18.3, -23.3); p.closePath();
97 colours.add(new Instr(Form.H3, p));
98 p = new Path2D.Double(); p.moveTo(-17.5, -35.0); p.lineTo(-16.25, -52.5); p.lineTo(16.25, -52.5); p.lineTo(17.5, -35.0); p.closePath();
99 colours.add(new Instr(Form.H4, p));
100 p = new Path2D.Double(); p.moveTo(-18.75, -17.5); p.lineTo(-17.5, -35.0); p.lineTo(17.5, -35.0); p.lineTo(18.75, -17.5); p.closePath();
101 colours.add(new Instr(Form.H5, p));
102 p = new Path2D.Double(); p.moveTo(0.0, -70.0); p.lineTo(15.0, -70.0); p.lineTo(20.0, 0.0); p.lineTo(10.0, 0.0); p.quadTo(10.0, -10.0, 0.0, -10.0); p.closePath();
103 colours.add(new Instr(Form.V2, p));
104 Lattice.add(new Instr(Form.COLR, colours));
105 Lattice.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
106 Lattice.add(new Instr(Form.FILL, Color.black));
107 Lattice.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
108 Lattice.add(new Instr(Form.LINE, new Line2D.Double(-30, 0, -10, 0)));
109 Lattice.add(new Instr(Form.LINE, new Line2D.Double(10, 0, 30, 0)));
110 p = new Path2D.Double(); p.moveTo(-20.0, 0.0); p.lineTo(-15.0, -70.0); p.lineTo(15.0, -70.0); p.lineTo(20.0, 0.0);
111 p.moveTo(-19.0, -7.0); p.lineTo(17.5, -33.0); p.moveTo(19.0, -7.0); p.lineTo(-17.5, -33.0);
112 p.moveTo(-15.0, -65.0); p.lineTo(18.0, -40.0); p.moveTo(15.0, -65.0); p.lineTo(-18.0, -40.0);
113 Lattice.add(new Instr(Form.PLIN, p));
114 }
115
116 public static final Symbol LightFlare = new Symbol();
117 static {
118 LightFlare.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20, -100, 40, 100)));
119 LightFlare.add(new Instr(Form.RSHP, new Ellipse2D.Double(-3, -3, 6, 6)));
120 Path2D.Double p = new Path2D.Double();
121 p.moveTo(0.0, -25.0); p.lineTo(15.0, -95.0); p.curveTo(20.0, -123.0, -20.0, -123.0, -15.0, -95.0);
122 p.closePath();
123 LightFlare.add(new Instr(Form.PGON, p));
124 }
125
126 public static final Symbol LightMajor = new Symbol();
127 static {
128 LightMajor.add(new Instr(Form.FILL, Color.black));
129 Path2D.Double p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_NON_ZERO);
130 p.moveTo(0.0, -7.0); p.curveTo(-9.3, -6.5, -9.3, 6.5, 0.0, 7.0); p.curveTo(9.3, 6.5, 9.3, -6.5, 0.0, -7.0); p.closePath();
131 p.moveTo(0.0, -35.5); p.lineTo(8.0, -11.2); p.lineTo(33.5, -11.2); p.lineTo(12.8, 4.0);
132 p.lineTo(20.5, 28.5); p.lineTo(0.0, 13.0); p.lineTo(-20.5, 28.5); p.lineTo(-12.8, 4.0); p.lineTo(-33.5, -11.2); p.lineTo(-8.0, -11.2); p.closePath();
133 LightMajor.add(new Instr(Form.PGON, p));
134 }
135
136 public static final Symbol LightMinor = new Symbol();
137 static {
138 LightMinor.add(new Instr(Form.FILL, Color.black));
139 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0, -26.5); p.lineTo(6.0, -8.4); p.lineTo(25.1, -8.4); p.lineTo(9.6, 3.0);
140 p.lineTo(15.4, 21.4); p.lineTo(0.0, 9.8); p.lineTo(-15.4, 21.4); p.lineTo(-9.6, 3.0); p.lineTo(-25.1, -8.4); p.lineTo(-6.0, -8.4); p.closePath();
141 LightMinor.add(new Instr(Form.PGON, p));
142 }
143
144 public static final Symbol PerchPort = new Symbol();
145 static {
146 PerchPort.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
147 PerchPort.add(new Instr(Form.FILL, Color.black));
148 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(-10, 0, 10, 0)));
149 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -40)));
150 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(25, -70, 0, -40)));
151 PerchPort.add(new Instr(Form.LINE, new Line2D.Double(-25, -70, 0, -40)));
152 }
153
154 public static final Symbol PerchStarboard = new Symbol();
155 static {
156 PerchStarboard.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
157 PerchStarboard.add(new Instr(Form.FILL, Color.black));
158 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(-10, 0, 10, 0)));
159 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -70)));
160 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(25, -40, 0, -68.7)));
161 PerchStarboard.add(new Instr(Form.LINE, new Line2D.Double(-25, -40, 0, -68.7)));
162 }
163
164 public static final Symbol RadarStation = new Symbol();
165 static {
166 RadarStation.add(new Instr(Form.STRK, new BasicStroke(2.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
167 RadarStation.add(new Instr(Form.FILL, new Color(0xd400d4)));
168 RadarStation.add(new Instr(Form.ELPS, new Ellipse2D.Double(-150, -150, 300, 300)));
169 }
170
171 public static final Symbol Stake = new Symbol();
172 static {
173 Stake.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
174 Stake.add(new Instr(Form.FILL, Color.black));
175 Stake.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -70)));
176 Symbol colours = new Symbol();
177 Path2D.Double p = new Path2D.Double(); p.moveTo(-2.0, 0.0); p.lineTo(-2.0, -70.0); p.lineTo(2.0, -70.0); p.lineTo(2.0, 0.0); p.closePath();
178 colours.add(new Instr(Form.P1, p));
179 p = new Path2D.Double(); p.moveTo(-2.0, 0.0); p.lineTo(-2.0, -35.0); p.lineTo(2.0, -35.0); p.lineTo(2.0, 0.0); p.closePath();
180 colours.add(new Instr(Form.H2, p));
181 p = new Path2D.Double(); p.moveTo(-2.0, -23.3); p.lineTo(-2.0, -46.7); p.lineTo(2.0, -46.7); p.lineTo(2.0, -23.3); p.closePath();
182 colours.add(new Instr(Form.H3, p));
183 p = new Path2D.Double(); p.moveTo(-2.0, -35.0); p.lineTo(-2.0, -52.5); p.lineTo(2.0, -52.5); p.lineTo(2.0, -35.0); p.closePath();
184 colours.add(new Instr(Form.H4, p));
185 p = new Path2D.Double(); p.moveTo(-2.0, -17.5); p.lineTo(-2.0, -35.0); p.lineTo(2.0, -35.0); p.lineTo(2.0, -17.5); p.closePath();
186 colours.add(new Instr(Form.H5, p));
187 Stake.add(new Instr(Form.COLR, colours));
188 Stake.add(new Instr(Form.FILL, Color.black));
189 Stake.add(new Instr(Form.LINE, new Line2D.Double(-10, 0, 10, 0)));
190 }
191
192 public static final Symbol Tower = new Symbol();
193 static {
194 Symbol colours = new Symbol();
195 Path2D.Double p = new Path2D.Double(); p.moveTo(-25.0, 0.0); p.lineTo(-20.0, -70.0); p.lineTo(20.0, -70.0); p.lineTo(25.0, 0.0); p.lineTo(10.0, 0.0); p.curveTo(10.0, -13.3, -10.0, -13.3, -10.0, 0.0); p.closePath();
196 colours.add(new Instr(Form.P1, p));
197 p = new Path2D.Double(); p.moveTo(-25.0, 0.0); p.lineTo(-22.5, -35.0); p.lineTo(22.5, -35.0); p.lineTo(25.0, 0.0); p.lineTo(10.0, 0.0); p.curveTo(10.0, -13.3, -10.0, -13.3, -10.0, 0.0); p.closePath();
198 colours.add(new Instr(Form.H2, p));
199 p = new Path2D.Double(); p.moveTo(-23.3, -23.3); p.lineTo(-21.7, -46.7); p.lineTo(21.7, -46.7); p.lineTo(23.3, -23.3); p.closePath();
200 colours.add(new Instr(Form.H3, p));
201 p = new Path2D.Double(); p.moveTo(-22.5, -35.0); p.lineTo(-21.0, -52.5); p.lineTo(21.0, -52.5); p.lineTo(22.5, -35.0); p.closePath();
202 colours.add(new Instr(Form.H4, p));
203 p = new Path2D.Double(); p.moveTo(-23.6, -17.5); p.lineTo(-22.5, -35.0); p.lineTo(22.5, -35.0); p.lineTo(23.6, -17.5); p.closePath();
204 colours.add(new Instr(Form.H5, p));
205 p = new Path2D.Double(); p.moveTo(0.0, -70.0); p.lineTo(20.0, -70.0); p.lineTo(25.0, 0.0); p.lineTo(10.0, 0.0); p.quadTo(10.0, -10.0, 0.0, -10.0); p.closePath();
206 colours.add(new Instr(Form.V2, p));
207 p = new Path2D.Double(); p.moveTo(-10, 0.0); p.lineTo(-6.7, -70.0); p.lineTo(6.7, -70.0); p.lineTo(10.0, 0.0); p.curveTo(10.0, -13.3, -10.0, -13.3, -10.0, 0.0); p.closePath();
208 colours.add(new Instr(Form.V3, p));
209 Tower.add(new Instr(Form.COLR, colours));
210 Tower.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
211 Tower.add(new Instr(Form.FILL, Color.black));
212 Tower.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
213 Tower.add(new Instr(Form.LINE, new Line2D.Double(-35, 0, -10, 0)));
214 Tower.add(new Instr(Form.LINE, new Line2D.Double(10, 0, 35, 0)));
215 p = new Path2D.Double(); p.moveTo(-25.0, 0.0); p.lineTo(-20.0, -70.0); p.lineTo(20.0, -70.0); p.lineTo(25.0, 0.0);
216 Tower.add(new Instr(Form.PLIN, p));
217 }
218
219 public static final Symbol WithyPort = new Symbol();
220 static {
221 WithyPort.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
222 WithyPort.add(new Instr(Form.FILL, Color.black));
223 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-10, 0, 10, 0)));
224 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -70)));
225 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(20, -60, 0, -50)));
226 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-20, -60, 0, -50)));
227 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(30, -35, 0, -21)));
228 WithyPort.add(new Instr(Form.LINE, new Line2D.Double(-30, -35, 0, -21)));
229 }
230
231 public static final Symbol WithyStarboard = new Symbol();
232 static {
233 WithyStarboard.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
234 WithyStarboard.add(new Instr(Form.FILL, Color.black));
235 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-10, 0, 10, 0)));
236 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(0, 0, 0, -70)));
237 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(20, -50, 0, -60)));
238 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-20, -50, 0, -60)));
239 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(30, -21, 0, -35)));
240 WithyStarboard.add(new Instr(Form.LINE, new Line2D.Double(-30, -21, 0, -35)));
241 }
242
243 public static final EnumMap<BcnSHP, Symbol> Shapes = new EnumMap<>(BcnSHP.class);
244 static {
245 Shapes.put(BcnSHP.BCN_UNKN, Beacons.Beacon); Shapes.put(BcnSHP.BCN_STAK, Beacons.Stake); Shapes.put(BcnSHP.BCN_TOWR, Beacons.Tower);
246 Shapes.put(BcnSHP.BCN_LATT, Beacons.Lattice); Shapes.put(BcnSHP.BCN_PILE, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POLE, Beacons.Stake);
247 Shapes.put(BcnSHP.BCN_CARN, Beacons.Cairn); Shapes.put(BcnSHP.BCN_BUOY, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POST, Beacons.Stake);
248 Shapes.put(BcnSHP.BCN_PRCH, Beacons.Stake);
249 }
250}
Note: See TracBrowser for help on using the repository browser.