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

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

checkstyle

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