source: osm/applications/editors/josm/plugins/seachart/src/symbols/Landmarks.java@ 33949

Last change on this file since 33949 was 32907, checked in by donvip, 8 years ago

checkstyle

File size: 14.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package symbols;
3
4import java.awt.BasicStroke;
5import java.awt.geom.Arc2D;
6import java.awt.geom.Ellipse2D;
7import java.awt.geom.Line2D;
8import java.awt.geom.Path2D;
9import java.awt.geom.Rectangle2D;
10import java.util.EnumMap;
11
12import s57.S57val.CatLMK;
13import s57.S57val.FncFNC;
14import symbols.Symbols.Form;
15import symbols.Symbols.Instr;
16import symbols.Symbols.Symbol;
17
18/**
19 * @author Malcolm Herring
20 */
21public final class Landmarks {
22 private Landmarks() {
23 // Hide default constructor for utilities classes
24 }
25
26 // CHECKSTYLE.OFF: LineLength
27 private static final Symbol Base = new Symbol();
28 static {
29 Base.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
30 Base.add(new Instr(Form.ELPS, new Ellipse2D.Double(-10, -10, 20, 20)));
31 Base.add(new Instr(Form.LINE, new Line2D.Double(-35, 0, -10, 0)));
32 Base.add(new Instr(Form.LINE, new Line2D.Double(10, 0, 35, 0)));
33 }
34
35 public static final Symbol Chimney = new Symbol();
36 static {
37 Chimney.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
38 Chimney.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
39 Path2D.Double p = new Path2D.Double(); p.moveTo(-25.0, 0.0); p.lineTo(-10.0, -120.0); p.lineTo(10.0, -120.0); p.lineTo(25.0, 0.0);
40 p.moveTo(-10.0, -128.0); p.curveTo(-13.0, -147.0, 15.0, -159.0, 20.0, -148.0);
41 p.moveTo(16.0, -152.3); p.curveTo(58.0, -194.0, 98.0, -87.0, 16.0, -132.0);
42 p.moveTo(11.0, -128.0); p.curveTo(13.4, -132.0, 20.0, -132.0, 20.0, -136.0);
43 Chimney.add(new Instr(Form.PLIN, p));
44 }
45
46 public static final Symbol Church = new Symbol();
47 static {
48 Path2D.Double p = new Path2D.Double(); p.moveTo(10.0, -10.0); p.lineTo(37.0, -10.0); p.quadTo(48.0, -10.0, 48.0, -21.0); p.lineTo(50.0, -21.0); p.lineTo(50.0, 21.0);
49 p.lineTo(48.0, 21.0); p.quadTo(48.0, 10.0, 37.0, 10.0); p.lineTo(10.0, 10.0); p.lineTo(10.0, 37.0); p.quadTo(10.0, 48.0, 21.0, 48.0); p.lineTo(21.0, 50.0);
50 p.lineTo(-21.0, 50.0); p.lineTo(-21.0, 48.0); p.quadTo(-10.0, 48.0, -10.0, 37.0); p.lineTo(-10.0, 10.0); p.lineTo(-37.0, 10.0); p.quadTo(-48.0, 10.0, -48.0, 21.0);
51 p.lineTo(-50.0, 21.0); p.lineTo(-50.0, -21.0); p.lineTo(-48.0, -21.0); p.quadTo(-48.0, -10.0, -37.0, -10.0); p.lineTo(-10.0, -10.0); p.lineTo(-10.0, -37.0);
52 p.quadTo(-10.0, -48.0, -21.0, -48.0); p.lineTo(-21.0, -50.0); p.lineTo(21.0, -50.0); p.lineTo(21.0, -48.0); p.quadTo(10.0, -48.0, 10.0, -37.0); p.closePath();
53 Church.add(new Instr(Form.PGON, p));
54 }
55
56 public static final Symbol ChurchTower = new Symbol();
57 static {
58 ChurchTower.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
59 ChurchTower.add(new Instr(Form.RECT, new Rectangle2D.Double(-36, -36, 72, 72)));
60 ChurchTower.add(new Instr(Form.ELPS, new Ellipse2D.Double(-2, -2, 4, 4)));
61 }
62
63 public static final Symbol Cross = new Symbol();
64 static {
65 Cross.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
66 Cross.add(new Instr(Form.STRK, new BasicStroke(6, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
67 Cross.add(new Instr(Form.LINE, new Line2D.Double(0, -10, 0, -150)));
68 Cross.add(new Instr(Form.LINE, new Line2D.Double(-30, -115, 30, -115)));
69 }
70
71 public static final Symbol DishAerial = new Symbol();
72 static {
73 DishAerial.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
74 DishAerial.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)));
75 Path2D.Double p = new Path2D.Double(); p.moveTo(-7.8, -6.0); p.lineTo(0.0, -62.0); p.lineTo(7.8, -6.0); p.moveTo(18.0, -109.0); p.lineTo(25.0, -113.0);
76 p.moveTo(-9.5, -157.0); p.curveTo(-60.7, -125.5, -16.5, -33.9, 44.9, -61.7); p.closePath();
77 DishAerial.add(new Instr(Form.PLIN, p));
78 }
79
80 public static final Symbol Dome = new Symbol();
81 static {
82 Dome.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
83 Dome.add(new Instr(Form.ELPS, new Ellipse2D.Double(-36, -36, 72, 72)));
84 Dome.add(new Instr(Form.RSHP, new Ellipse2D.Double(-4, -4, 8, 8)));
85 }
86
87 public static final Symbol Flagstaff = new Symbol();
88 static {
89 Flagstaff.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
90 Flagstaff.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
91 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0, -10.0); p.lineTo(0.0, -150.0); p.moveTo(0.0, -140.0); p.lineTo(40.0, -140.0); p.lineTo(40.0, -100.0); p.lineTo(0.0, -100.0);
92 Flagstaff.add(new Instr(Form.PLIN, p));
93 }
94
95 public static final Symbol FlareStack = new Symbol();
96 static {
97 FlareStack.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
98 FlareStack.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
99 Path2D.Double p = new Path2D.Double(); p.moveTo(-7.8, -6.0); p.lineTo(-7.8, -100.0); p.lineTo(7.8, -100.0); p.lineTo(7.8, -6.0);
100 FlareStack.add(new Instr(Form.PLIN, p));
101 FlareStack.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)));
102 p = new Path2D.Double(); p.moveTo(21.6, -169.6); p.curveTo(-22.0, -132.4, -27.4, -103.5, 3.0, -100.0); p.curveTo(39.0, -118.0, -4.0, -141.0, 21.6, -169.6);
103 FlareStack.add(new Instr(Form.PLIN, p));
104 }
105
106 public static final Symbol LandTower = new Symbol();
107 static {
108 LandTower.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
109 LandTower.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
110 LandTower.add(new Instr(Form.LINE, new Line2D.Double(-25, 0, -15, -120)));
111 LandTower.add(new Instr(Form.LINE, new Line2D.Double(25, 0, 15, -120)));
112 LandTower.add(new Instr(Form.RECT, new Rectangle2D.Double(-15, -150, 30, 30)));
113 }
114
115 public static final Symbol Mast = new Symbol();
116 static {
117 Mast.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
118 Mast.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)));
119 Path2D.Double p = new Path2D.Double(); p.moveTo(-25.0, 0.0); p.lineTo(0.0, -150.0); p.lineTo(25.0, 0.0);
120 Mast.add(new Instr(Form.PLIN, p));
121 }
122
123 public static final Symbol Monument = new Symbol();
124 static {
125 Monument.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
126 Monument.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
127 Monument.add(new Instr(Form.LINE, new Line2D.Double(-25, 0, -15, -105)));
128 Monument.add(new Instr(Form.LINE, new Line2D.Double(25, 0, 15, -105)));
129 Monument.add(new Instr(Form.EARC, new Arc2D.Double(-25.0, -150.0, 50.0, 50.0, 233.0, -285.0, Arc2D.OPEN)));
130 }
131
132 public static final Symbol Platform = new Symbol();
133 static {
134 Platform.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
135 Platform.add(new Instr(Form.RECT, new Rectangle2D.Double(-48, -48, 96, 96)));
136 Platform.add(new Instr(Form.RSHP, new Ellipse2D.Double(-4, -4, 8, 8)));
137 }
138
139 public static final Symbol RadioTV = new Symbol();
140 static {
141 RadioTV.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)));
142 RadioTV.add(new Instr(Form.EARC, new Arc2D.Double(-30.0, -180.0, 60.0, 60.0, 45.0, -90.0, Arc2D.OPEN)));
143 RadioTV.add(new Instr(Form.EARC, new Arc2D.Double(-45.0, -195.0, 90.0, 90.0, 45.0, -90.0, Arc2D.OPEN)));
144 RadioTV.add(new Instr(Form.EARC, new Arc2D.Double(-30.0, -180.0, 60.0, 60.0, 225.0, -90.0, Arc2D.OPEN)));
145 RadioTV.add(new Instr(Form.EARC, new Arc2D.Double(-45.0, -195.0, 90.0, 90.0, 225.0, -90.0, Arc2D.OPEN)));
146 }
147
148 public static final Symbol Spire = new Symbol();
149 static {
150 Spire.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
151 Spire.add(new Instr(Form.ELPS, new Ellipse2D.Double(-25, -25, 50, 50)));
152 Spire.add(new Instr(Form.RSHP, new Ellipse2D.Double(-4, -4, 8, 8)));
153 }
154
155 public static final Symbol Minaret = new Symbol();
156 static {
157 Minaret.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Spire, 1.0, 0, 0, null, null)));
158 Minaret.add(new Instr(Form.STRK, new BasicStroke(6, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
159 Minaret.add(new Instr(Form.LINE, new Line2D.Double(0, -25, 0, -50)));
160 Minaret.add(new Instr(Form.STRK, new BasicStroke(6, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
161 Minaret.add(new Instr(Form.EARC, new Arc2D.Double(-40.0, -110.0, 80.0, 60.0, 180.0, 180.0, Arc2D.OPEN)));
162 }
163
164 public static final Symbol Temple = new Symbol();
165 static {
166 Temple.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
167 Temple.add(new Instr(Form.RECT, new Rectangle2D.Double(-25, -15, 50, 30)));
168 Temple.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
169 Temple.add(new Instr(Form.LINE, new Line2D.Double(-35, -21, 35, 21)));
170 Temple.add(new Instr(Form.LINE, new Line2D.Double(-35, 21, 35, -21)));
171 }
172
173 public static final Symbol WaterTower = new Symbol();
174 static {
175 WaterTower.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
176 WaterTower.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
177 WaterTower.add(new Instr(Form.LINE, new Line2D.Double(-25, 0, -15, -120)));
178 WaterTower.add(new Instr(Form.LINE, new Line2D.Double(25, 0, 15, -120)));
179 WaterTower.add(new Instr(Form.RECT, new Rectangle2D.Double(-25, -150, 50, 30)));
180 }
181
182 public static final Symbol WindMotor = new Symbol();
183 static {
184 WindMotor.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
185 WindMotor.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
186 WindMotor.add(new Instr(Form.LINE, new Line2D.Double(0, -10, 0, -90)));
187 WindMotor.add(new Instr(Form.LINE, new Line2D.Double(0, -90, 30, -90)));
188 WindMotor.add(new Instr(Form.LINE, new Line2D.Double(0, -90, -14, -116.6)));
189 WindMotor.add(new Instr(Form.LINE, new Line2D.Double(0, -90, -14.3, -66.7)));
190 }
191
192 public static final Symbol Windmill = new Symbol();
193 static {
194 Windmill.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
195 Windmill.add(new Instr(Form.ELPS, new Ellipse2D.Double(-12, -12, 24, 24)));
196 Windmill.add(new Instr(Form.LINE, new Line2D.Double(-30, -42, 30, 10)));
197 Windmill.add(new Instr(Form.LINE, new Line2D.Double(-30, 10, 30, -42)));
198 }
199
200 public static final Symbol Windsock = new Symbol();
201 static {
202 Windsock.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Landmarks.Base, 1.0, 0, 0, null, null)));
203 Windsock.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
204 Windsock.add(new Instr(Form.LINE, new Line2D.Double(0, -10, 0, -100)));
205 Windsock.add(new Instr(Form.STRK, new BasicStroke(8, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
206 Windsock.add(new Instr(Form.LINE, new Line2D.Double(0, -100, 0, -150)));
207 Windsock.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)));
208 Path2D.Double p = new Path2D.Double(); p.moveTo(0.0, -100.0); p.lineTo(10.0, -100.0); p.lineTo(10.0, -150.0); p.lineTo(0.0, -150.0);
209 p.moveTo(10.0, -150.0); p.lineTo(50.0, -145.0); p.lineTo(120.0, -70.0); p.quadTo(120.0, -55.0, 105.0, -55.0);
210 p.lineTo(55, -95); p.lineTo(40, -102); p.lineTo(10, -100); p.moveTo(40, -102); p.lineTo(50, -120); p.moveTo(55, -95); p.lineTo(75, -97);
211 Windsock.add(new Instr(Form.PLIN, p));
212 }
213
214 public static final EnumMap<CatLMK, Symbol> Shapes = new EnumMap<>(CatLMK.class);
215 static {
216 Shapes.put(CatLMK.LMK_CARN, Beacons.Cairn); Shapes.put(CatLMK.LMK_CHMY, Landmarks.Chimney);
217 Shapes.put(CatLMK.LMK_DISH, Landmarks.DishAerial); Shapes.put(CatLMK.LMK_FLAG, Landmarks.Flagstaff); Shapes.put(CatLMK.LMK_FLAR, Landmarks.FlareStack);
218 Shapes.put(CatLMK.LMK_MAST, Landmarks.Mast); Shapes.put(CatLMK.LMK_WNDS, Landmarks.Windsock); Shapes.put(CatLMK.LMK_MNMT, Landmarks.Monument);
219 Shapes.put(CatLMK.LMK_CLMN, Landmarks.Monument); Shapes.put(CatLMK.LMK_MEML, Landmarks.Monument); Shapes.put(CatLMK.LMK_OBLK, Landmarks.Monument);
220 Shapes.put(CatLMK.LMK_STAT, Landmarks.Monument); Shapes.put(CatLMK.LMK_CROS, Landmarks.Cross); Shapes.put(CatLMK.LMK_DOME, Landmarks.Dome);
221 Shapes.put(CatLMK.LMK_RADR, Landmarks.Mast); Shapes.put(CatLMK.LMK_TOWR, Landmarks.LandTower); Shapes.put(CatLMK.LMK_WNDM, Landmarks.Windmill);
222 Shapes.put(CatLMK.LMK_WNDG, Landmarks.WindMotor); Shapes.put(CatLMK.LMK_SPIR, Landmarks.Spire); Shapes.put(CatLMK.LMK_BLDR, Beacons.Cairn);
223 }
224
225 public static final EnumMap<FncFNC, Symbol> Funcs = new EnumMap<>(FncFNC.class);
226 static {
227 Funcs.put(FncFNC.FNC_CHCH, Landmarks.Church); Funcs.put(FncFNC.FNC_CHPL, Landmarks.Church); Funcs.put(FncFNC.FNC_TMPL, Landmarks.Temple);
228 Funcs.put(FncFNC.FNC_PGDA, Landmarks.Temple); Funcs.put(FncFNC.FNC_SHSH, Landmarks.Temple); Funcs.put(FncFNC.FNC_BTMP, Landmarks.Temple);
229 Funcs.put(FncFNC.FNC_MOSQ, Landmarks.Minaret); Funcs.put(FncFNC.FNC_MRBT, Landmarks.Spire); Funcs.put(FncFNC.FNC_COMM, Landmarks.RadioTV);
230 Funcs.put(FncFNC.FNC_TV, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADO, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_RADR, Landmarks.RadioTV);
231 Funcs.put(FncFNC.FNC_LGHT, Beacons.LightMajor); Funcs.put(FncFNC.FNC_MCWV, Landmarks.RadioTV); Funcs.put(FncFNC.FNC_HBRM, Harbours.HarbourMaster);
232 Funcs.put(FncFNC.FNC_CSTM, Harbours.Customs); Funcs.put(FncFNC.FNC_HLTH, Harbours.Hospital); Funcs.put(FncFNC.FNC_HOSP, Harbours.Hospital);
233 }
234}
Note: See TracBrowser for help on using the repository browser.