source: osm/applications/editors/josm/plugins/seachart/src/render/Rules.java@ 35687

Last change on this file since 35687 was 35685, checked in by malcolmh, 4 years ago

null exception fix + misc updates

File size: 61.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package render;
3
4import java.awt.Color;
5import java.awt.Font;
6import java.awt.geom.AffineTransform;
7import java.text.DecimalFormat;
8import java.util.ArrayList;
9import java.util.ConcurrentModificationException;
10import java.util.EnumMap;
11import java.util.HashMap;
12
13import render.ChartContext.RuleSet;
14import render.Renderer.LabelStyle;
15import s57.S57att.Att;
16import s57.S57map.AttMap;
17import s57.S57map.Feature;
18import s57.S57map.ObjTab;
19import s57.S57map.Pflag;
20import s57.S57map.Rflag;
21import s57.S57obj.Obj;
22import s57.S57val;
23import s57.S57val.AddMRK;
24import s57.S57val.AttVal;
25import s57.S57val.BcnSHP;
26import s57.S57val.BnkWTW;
27import s57.S57val.BoySHP;
28import s57.S57val.CatACH;
29import s57.S57val.CatCBL;
30import s57.S57val.CatCRN;
31import s57.S57val.CatDIS;
32import s57.S57val.CatHAF;
33import s57.S57val.CatLAM;
34import s57.S57val.CatLIT;
35import s57.S57val.CatLMK;
36import s57.S57val.CatMOR;
37import s57.S57val.CatNMK;
38import s57.S57val.CatOBS;
39import s57.S57val.CatOFP;
40import s57.S57val.CatOPA;
41import s57.S57val.CatPIL;
42import s57.S57val.CatPIP;
43import s57.S57val.CatREA;
44import s57.S57val.CatROD;
45import s57.S57val.CatROS;
46import s57.S57val.CatSCF;
47import s57.S57val.CatSEA;
48import s57.S57val.CatSIL;
49import s57.S57val.CatSIT;
50import s57.S57val.CatSIW;
51import s57.S57val.CatSLC;
52import s57.S57val.CatWED;
53import s57.S57val.CatWRK;
54import s57.S57val.ColCOL;
55import s57.S57val.ColPAT;
56import s57.S57val.FncFNC;
57import s57.S57val.MarSYS;
58import s57.S57val.StsSTS;
59import s57.S57val.TecSOU;
60import s57.S57val.TopSHP;
61import s57.S57val.TrfTRF;
62import s57.S57val.UniHLU;
63import s57.S57val.WatLEV;
64import s57.S57val.CatVAN;
65import symbols.Areas;
66import symbols.Beacons;
67import symbols.Buoys;
68import symbols.Facilities;
69import symbols.Harbours;
70import symbols.Landmarks;
71import symbols.Notices;
72import symbols.Symbols;
73import symbols.Symbols.Delta;
74import symbols.Symbols.Handle;
75import symbols.Symbols.LineStyle;
76import symbols.Symbols.Patt;
77import symbols.Symbols.Scheme;
78import symbols.Symbols.Symbol;
79import symbols.Topmarks;
80
81/**
82 * @author Malcolm Herring
83 */
84public class Rules {
85
86 static final DecimalFormat df = new DecimalFormat("#.#");
87
88 static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<>(ColCOL.class);
89 static {
90 bodyColours.put(ColCOL.COL_UNK, new Color(0, true));
91 bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff));
92 bodyColours.put(ColCOL.COL_BLK, new Color(0x000000));
93 bodyColours.put(ColCOL.COL_RED, new Color(0xd40000));
94 bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400));
95 bodyColours.put(ColCOL.COL_BLU, Color.blue);
96 bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400));
97 bodyColours.put(ColCOL.COL_GRY, Color.gray);
98 bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513));
99 bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
100 bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
101 bodyColours.put(ColCOL.COL_ORG, Color.orange);
102 bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0));
103 bodyColours.put(ColCOL.COL_PNK, Color.pink);
104 }
105
106 static final EnumMap<ColCOL, String> colourLetters = new EnumMap<>(ColCOL.class);
107 static {
108 colourLetters.put(ColCOL.COL_UNK, "");
109 colourLetters.put(ColCOL.COL_WHT, "W");
110 colourLetters.put(ColCOL.COL_BLK, "B");
111 colourLetters.put(ColCOL.COL_RED, "R");
112 colourLetters.put(ColCOL.COL_GRN, "G");
113 colourLetters.put(ColCOL.COL_BLU, "Bu");
114 colourLetters.put(ColCOL.COL_YEL, "Y");
115 colourLetters.put(ColCOL.COL_GRY, "Gr");
116 colourLetters.put(ColCOL.COL_BRN, "Bn");
117 colourLetters.put(ColCOL.COL_AMB, "Am");
118 colourLetters.put(ColCOL.COL_VIO, "Vi");
119 colourLetters.put(ColCOL.COL_ORG, "Or");
120 colourLetters.put(ColCOL.COL_MAG, "Mg");
121 colourLetters.put(ColCOL.COL_PNK, "Pk");
122 }
123
124 static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<>(ColPAT.class);
125 static {
126 pattMap.put(ColPAT.PAT_UNKN, Patt.Z);
127 pattMap.put(ColPAT.PAT_HORI, Patt.H);
128 pattMap.put(ColPAT.PAT_VERT, Patt.V);
129 pattMap.put(ColPAT.PAT_DIAG, Patt.D);
130 pattMap.put(ColPAT.PAT_BRDR, Patt.B);
131 pattMap.put(ColPAT.PAT_SQUR, Patt.S);
132 pattMap.put(ColPAT.PAT_CROS, Patt.C);
133 pattMap.put(ColPAT.PAT_SALT, Patt.X);
134 pattMap.put(ColPAT.PAT_STRP, Patt.H);
135 }
136
137 static String getName() {
138 AttVal<?> name = feature.atts.get(Att.OBJNAM);
139 if (name == null) {
140 AttMap atts = feature.objs.get(feature.type).get(0);
141 if (atts != null) {
142 name = atts.get(Att.OBJNAM);
143 }
144 }
145 return (name != null) ? ((String) name.val).replace("&quot;", "\"") : null;
146 }
147
148 public static void addName(int z, Font font) {
149 addName(z, font, Color.black, new Delta(Handle.CC, new AffineTransform()));
150 }
151
152 public static void addName(int z, Font font, Color colour) {
153 addName(z, font, colour, new Delta(Handle.CC, new AffineTransform()));
154 }
155
156 public static void addName(int z, Font font, Delta delta) {
157 addName(z, font, Color.black, delta);
158 }
159
160 public static void addName(int z, Font font, Color colour, Delta delta) {
161 if (Renderer.zoom >= z) {
162 String name = getName();
163 if (name != null) {
164 Renderer.labelText(name, font, colour, delta);
165 }
166 }
167 }
168
169 static AttMap getAtts(Obj obj, int idx) {
170 HashMap<Integer, AttMap> objs = feature.objs.get(obj);
171 if (objs == null)
172 return null;
173 else
174 return objs.get(idx);
175 }
176
177 public static Object getAttVal(Obj obj, Att att) {
178 AttMap atts;
179 HashMap<Integer, AttMap> objs;
180 AttVal<?> item;
181 if ((objs = feature.objs.get(obj)) != null)
182 atts = objs.get(0);
183 else
184 return null;
185 if ((item = atts.get(att)) == null)
186 return null;
187 else
188 return item.val;
189 }
190
191 public static String getAttStr(Obj obj, Att att) {
192 String str = (String) getAttVal(obj, att);
193 if (str != null) {
194 return str;
195 }
196 return "";
197 }
198
199 @SuppressWarnings("unchecked")
200 public static Enum<?> getAttEnum(Obj obj, Att att) {
201 ArrayList<?> list = (ArrayList<?>) getAttVal(obj, att);
202 if (list != null) {
203 return ((ArrayList<Enum<?>>) list).get(0);
204 }
205 return S57val.unknAtt(att);
206 }
207
208 @SuppressWarnings("unchecked")
209 public static ArrayList<?> getAttList(Obj obj, Att att) {
210 ArrayList<Enum<?>> list = (ArrayList<Enum<?>>) getAttVal(obj, att);
211 if (list != null) {
212 return list;
213 }
214 list = new ArrayList<>();
215 list.add(S57val.unknAtt(att));
216 return list;
217 }
218
219 @SuppressWarnings("unchecked")
220 static Scheme getScheme(Obj obj) {
221 ArrayList<Color> colours = new ArrayList<>();
222 for (ColCOL col : (ArrayList<ColCOL>) getAttList(obj, Att.COLOUR)) {
223 colours.add(bodyColours.get(col));
224 }
225 ArrayList<Patt> patterns = new ArrayList<>();
226 for (ColPAT pat : (ArrayList<ColPAT>) getAttList(obj, Att.COLPAT)) {
227 patterns.add(pattMap.get(pat));
228 }
229 return new Scheme(patterns, colours);
230 }
231
232 static boolean hasAttribute(Obj obj, Att att) {
233 AttMap atts;
234 if ((atts = getAtts(obj, 0)) != null) {
235 AttVal<?> item = atts.get(att);
236 return item != null;
237 }
238 return false;
239 }
240
241 static boolean testAttribute(Obj obj, Att att, Object val) {
242 AttMap atts;
243 if ((atts = getAtts(obj, 0)) != null) {
244 AttVal<?> item = atts.get(att);
245 if (item != null) {
246 switch (item.conv) {
247 case S:
248 case A:
249 return ((String) item.val).equals(val);
250 case E:
251 case L:
252 return ((ArrayList<?>) item.val).contains(val);
253 case F:
254 case I:
255 return item.val == val;
256 }
257 }
258 }
259 return false;
260 }
261
262 static boolean hasObject(Obj obj) {
263 return (feature.objs.containsKey(obj));
264 }
265
266 public static Feature feature;
267 static ArrayList<Feature> objects;
268
269 static boolean testObject(Obj obj) {
270 return ((objects = Renderer.map.features.get(obj)) != null);
271 }
272
273 static boolean testFeature(Feature f) {
274 return ((feature = f).reln == Rflag.MASTER);
275 }
276
277 public static boolean rules() {
278 try {
279 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) {
280 if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas();
281 if (testObject(Obj.SOUNDG)) for (Feature f : objects) if (testFeature(f)) depths();
282 if (testObject(Obj.DEPCNT)) for (Feature f : objects) if (testFeature(f)) depths();
283 if (testObject(Obj.TESARE)) for (Feature f : objects) if (testFeature(f)) areas();
284 if (testObject(Obj.BUAARE)) for (Feature f : objects) if (testFeature(f)) areas();
285 if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) areas();
286 if (testObject(Obj.HRBBSN)) for (Feature f : objects) if (testFeature(f)) areas();
287 if (testObject(Obj.LOKBSN)) for (Feature f : objects) if (testFeature(f)) areas();
288 if (testObject(Obj.LKBSPT)) for (Feature f : objects) if (testFeature(f)) areas();
289 if (testObject(Obj.LAKARE)) for (Feature f : objects) if (testFeature(f)) areas();
290 if (testObject(Obj.RIVERS)) for (Feature f : objects) if (testFeature(f)) waterways();
291 if (testObject(Obj.CANALS)) for (Feature f : objects) if (testFeature(f)) waterways();
292 if (testObject(Obj.DEPARE)) for (Feature f : objects) if (testFeature(f)) areas();
293 if (testObject(Obj.COALNE)) for (Feature f : objects) if (testFeature(f)) areas();
294 if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways();
295 if (testObject(Obj.RAILWY)) for (Feature f : objects) if (testFeature(f)) highways();
296 }
297 if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline();
298 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) {
299 if (testObject(Obj.PIPSOL)) for (Feature f : objects) if (testFeature(f)) pipelines();
300 if (testObject(Obj.CBLSUB)) for (Feature f : objects) if (testFeature(f)) cables();
301 if (testObject(Obj.PIPOHD)) for (Feature f : objects) if (testFeature(f)) pipelines();
302 if (testObject(Obj.CBLOHD)) for (Feature f : objects) if (testFeature(f)) cables();
303 if (testObject(Obj.TSEZNE)) for (Feature f : objects) if (testFeature(f)) separation();
304 if (testObject(Obj.TSSCRS)) for (Feature f : objects) if (testFeature(f)) separation();
305 if (testObject(Obj.TSSRON)) for (Feature f : objects) if (testFeature(f)) separation();
306 if (testObject(Obj.TSELNE)) for (Feature f : objects) if (testFeature(f)) separation();
307 if (testObject(Obj.TSSLPT)) for (Feature f : objects) if (testFeature(f)) separation();
308 if (testObject(Obj.TSSBND)) for (Feature f : objects) if (testFeature(f)) separation();
309 if (testObject(Obj.ISTZNE)) for (Feature f : objects) if (testFeature(f)) separation();
310 if (testObject(Obj.SNDWAV)) for (Feature f : objects) if (testFeature(f)) areas();
311 if (testObject(Obj.WEDKLP)) for (Feature f : objects) if (testFeature(f)) areas();
312 if (testObject(Obj.OSPARE)) for (Feature f : objects) if (testFeature(f)) areas();
313 if (testObject(Obj.FAIRWY)) for (Feature f : objects) if (testFeature(f)) areas();
314 if (testObject(Obj.DRGARE)) for (Feature f : objects) if (testFeature(f)) areas();
315 if (testObject(Obj.RESARE)) for (Feature f : objects) if (testFeature(f)) areas();
316 if (testObject(Obj.PRCARE)) for (Feature f : objects) if (testFeature(f)) areas();
317 if (testObject(Obj.SPLARE)) for (Feature f : objects) if (testFeature(f)) areas();
318 if (testObject(Obj.SEAARE)) for (Feature f : objects) if (testFeature(f)) areas();
319 if (testObject(Obj.CBLARE)) for (Feature f : objects) if (testFeature(f)) areas();
320 if (testObject(Obj.PIPARE)) for (Feature f : objects) if (testFeature(f)) areas();
321 if (testObject(Obj.DMPGRD)) for (Feature f : objects) if (testFeature(f)) areas();
322 if (testObject(Obj.OBSTRN)) for (Feature f : objects) if (testFeature(f)) obstructions();
323 if (testObject(Obj.UWTROC)) for (Feature f : objects) if (testFeature(f)) obstructions();
324 if (testObject(Obj.MARCUL)) for (Feature f : objects) if (testFeature(f)) areas();
325 if (testObject(Obj.RECTRC)) for (Feature f : objects) if (testFeature(f)) transits();
326 if (testObject(Obj.NAVLNE)) for (Feature f : objects) if (testFeature(f)) transits();
327 if (testObject(Obj.HRBFAC)) for (Feature f : objects) if (testFeature(f)) harbours();
328 if (testObject(Obj.ACHARE)) for (Feature f : objects) if (testFeature(f)) harbours();
329 if (testObject(Obj.ACHBRT)) for (Feature f : objects) if (testFeature(f)) harbours();
330 if (testObject(Obj.BERTHS)) for (Feature f : objects) if (testFeature(f)) harbours();
331 if (testObject(Obj.DISMAR)) for (Feature f : objects) if (testFeature(f)) distances();
332 if (testObject(Obj.HULKES)) for (Feature f : objects) if (testFeature(f)) ports();
333 if (testObject(Obj.CRANES)) for (Feature f : objects) if (testFeature(f)) ports();
334 if (testObject(Obj.LNDMRK)) for (Feature f : objects) if (testFeature(f)) landmarks();
335 if (testObject(Obj.SILTNK)) for (Feature f : objects) if (testFeature(f)) landmarks();
336 if (testObject(Obj.BUISGL)) for (Feature f : objects) if (testFeature(f)) harbours();
337 if (testObject(Obj.MORFAC)) for (Feature f : objects) if (testFeature(f)) moorings();
338 if (testObject(Obj.NOTMRK)) for (Feature f : objects) if (testFeature(f)) notices();
339 if (testObject(Obj.SMCFAC)) for (Feature f : objects) if (testFeature(f)) marinas();
340 if (testObject(Obj.BRIDGE)) for (Feature f : objects) if (testFeature(f)) bridges();
341 if (testObject(Obj.PILPNT)) for (Feature f : objects) if (testFeature(f)) points();
342 if (testObject(Obj.TOPMAR)) for (Feature f : objects) if (testFeature(f)) points();
343 if (testObject(Obj.DAYMAR)) for (Feature f : objects) if (testFeature(f)) points();
344 if (testObject(Obj.FOGSIG)) for (Feature f : objects) if (testFeature(f)) points();
345 if (testObject(Obj.RDOCAL)) for (Feature f : objects) if (testFeature(f)) callpoint();
346 if (testObject(Obj.LITMIN)) for (Feature f : objects) if (testFeature(f)) lights();
347 if (testObject(Obj.LITMAJ)) for (Feature f : objects) if (testFeature(f)) lights();
348 if (testObject(Obj.LIGHTS)) for (Feature f : objects) if (testFeature(f)) lights();
349 if (testObject(Obj.SISTAT)) for (Feature f : objects) if (testFeature(f)) stations();
350 if (testObject(Obj.SISTAW)) for (Feature f : objects) if (testFeature(f)) stations();
351 if (testObject(Obj.CGUSTA)) for (Feature f : objects) if (testFeature(f)) stations();
352 if (testObject(Obj.RDOSTA)) for (Feature f : objects) if (testFeature(f)) stations();
353 if (testObject(Obj.RADRFL)) for (Feature f : objects) if (testFeature(f)) stations();
354 if (testObject(Obj.RADSTA)) for (Feature f : objects) if (testFeature(f)) stations();
355 if (testObject(Obj.RTPBCN)) for (Feature f : objects) if (testFeature(f)) stations();
356 if (testObject(Obj.RSCSTA)) for (Feature f : objects) if (testFeature(f)) stations();
357 if (testObject(Obj.PILBOP)) for (Feature f : objects) if (testFeature(f)) stations();
358 if (testObject(Obj.WTWGAG)) for (Feature f : objects) if (testFeature(f)) gauges();
359 if (testObject(Obj.OFSPLF)) for (Feature f : objects) if (testFeature(f)) platforms();
360 if (testObject(Obj.WRECKS)) for (Feature f : objects) if (testFeature(f)) wrecks();
361 if (testObject(Obj.LITVES)) for (Feature f : objects) if (testFeature(f)) floats();
362 if (testObject(Obj.LITFLT)) for (Feature f : objects) if (testFeature(f)) floats();
363 if (testObject(Obj.BOYINB)) for (Feature f : objects) if (testFeature(f)) floats();
364 if (testObject(Obj.BOYLAT)) for (Feature f : objects) if (testFeature(f)) buoys();
365 if (testObject(Obj.BOYCAR)) for (Feature f : objects) if (testFeature(f)) buoys();
366 if (testObject(Obj.BOYISD)) for (Feature f : objects) if (testFeature(f)) buoys();
367 if (testObject(Obj.BOYSAW)) for (Feature f : objects) if (testFeature(f)) buoys();
368 if (testObject(Obj.BOYSPP)) for (Feature f : objects) if (testFeature(f)) buoys();
369 if (testObject(Obj.BCNLAT)) for (Feature f : objects) if (testFeature(f)) beacons();
370 if (testObject(Obj.BCNCAR)) for (Feature f : objects) if (testFeature(f)) beacons();
371 if (testObject(Obj.BCNISD)) for (Feature f : objects) if (testFeature(f)) beacons();
372 if (testObject(Obj.BCNSAW)) for (Feature f : objects) if (testFeature(f)) beacons();
373 if (testObject(Obj.BCNSPP)) for (Feature f : objects) if (testFeature(f)) beacons();
374 if (testObject(Obj.VAATON)) for (Feature f : objects) if (testFeature(f)) virtual();
375 }
376 } catch (ConcurrentModificationException e) {
377 return false;
378 } catch (Exception e) {
379 e.printStackTrace();
380 return true;
381 }
382 return true;
383 }
384
385 private static void areas() {
386 String name = getName();
387 switch (feature.type) {
388 case TESARE:
389 Renderer.lineSymbols(Areas.LimitDash, 0.0, Areas.LimitCC, null, 30, Symbols.Mline);
390 break;
391 case BUAARE:
392 Renderer.lineVector(new LineStyle(new Color(0x20000000, true)));
393 break;
394 case COALNE:
395 if (Renderer.zoom >= 12)
396 Renderer.lineVector(new LineStyle(Color.black, 10));
397 break;
398 case DEPARE:
399 Double depmax = (Double) getAttVal(Obj.DEPARE, Att.DRVAL2);
400 if (depmax != null) {
401 if (depmax <= 0.0) {
402 Renderer.lineVector(new LineStyle(Symbols.Gdries));
403 } else if (depmax <= 2.0) {
404 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x2090ff)));
405 } else if (depmax <= 5.0) {
406 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x40a0ff)));
407 } else if (depmax <= 10.0) {
408 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x60b0ff)));
409 } else if (depmax <= 15.0) {
410 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0x80c0ff)));
411 } else if (depmax <= 20.0) {
412 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xa0d0ff)));
413 } else if (depmax <= 50.0) {
414 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xc0e0ff)));
415 } else {
416 Renderer.lineVector(new LineStyle(Color.blue, 2, new Color(0xe0f0ff)));
417 }
418 }
419 break;
420 case LAKARE:
421 if ((Renderer.zoom >= 12) || (feature.geom.area > 10.0))
422 Renderer.lineVector(new LineStyle(Symbols.Bwater));
423 break;
424 case DRGARE:
425 if (Renderer.zoom < 16)
426 Renderer.lineVector(new LineStyle(Color.black, 8, new float[] { 25, 25 }, new Color(0x40ffffff, true)));
427 else
428 Renderer.lineVector(new LineStyle(Color.black, 8, new float[] { 25, 25 }));
429 addName(12, new Font("Arial", Font.PLAIN, 100), new Delta(Handle.CC, new AffineTransform()));
430 break;
431 case FAIRWY:
432 if (Renderer.zoom >= 12) {
433 if (feature.geom.area > 1.0) {
434 if (Renderer.zoom < 16)
435 Renderer.lineVector(new LineStyle(new Color(0x20ffffff, true)));
436 else
437 Renderer.lineVector(new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }));
438 } else {
439 if (Renderer.zoom >= 14)
440 Renderer.lineVector(new LineStyle(new Color(0x20ffffff, true)));
441 }
442 }
443 break;
444 case LKBSPT:
445 case LOKBSN:
446 case HRBBSN:
447 if (Renderer.zoom >= 12) {
448 Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Bwater));
449 } else {
450 Renderer.lineVector(new LineStyle(Symbols.Bwater));
451 }
452 break;
453 case HRBFAC:
454 if (feature.objs.get(Obj.HRBBSN) != null) {
455 if (Renderer.zoom >= 12) {
456 Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Bwater));
457 } else {
458 Renderer.lineVector(new LineStyle(Symbols.Bwater));
459 }
460 }
461 break;
462 case LNDARE:
463 Renderer.lineVector(new LineStyle(Symbols.Yland));
464 break;
465 case MARCUL:
466 if (Renderer.zoom >= 12) {
467 if (Renderer.zoom >= 14) {
468 Renderer.symbol(Areas.MarineFarm);
469 }
470 if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) {
471 Renderer.lineVector(new LineStyle(Color.black, 4, new float[] { 10, 10 }));
472 }
473 }
474 break;
475 case OSPARE:
476 if (testAttribute(feature.type, Att.CATOPA, CatOPA.OPA_WIND)) {
477 Renderer.symbol(Areas.WindFarm);
478 Renderer.lineVector(new LineStyle(Color.black, 12, new float[] { 40, 40 }));
479 addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 120)));
480 }
481 break;
482 case RESARE:
483 case MIPARE:
484 case DMPGRD:
485 if (Renderer.zoom >= 12) {
486 Renderer.lineSymbols(Areas.Restricted, 1.0, null, null, 0, Symbols.Mline);
487 if (testAttribute(feature.type, Att.CATREA, CatREA.REA_NWAK)) {
488 Renderer.symbol(Areas.NoWake);
489 }
490 }
491 break;
492 case PRCARE:
493 if (Renderer.zoom >= 12) {
494 Renderer.lineVector(new LineStyle(Symbols.Mline, 10, new float[] { 40, 40 }));
495 }
496 break;
497 case SEAARE:
498 switch ((CatSEA) getAttEnum(feature.type, Att.CATSEA)) {
499 case SEA_RECH:
500 if ((Renderer.zoom >= 15) && (name != null))
501 if (feature.geom.prim == Pflag.LINE) {
502 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 60), Color.black, -40);
503 } else {
504 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 0)));
505 }
506 break;
507 case SEA_BAY:
508 if ((Renderer.zoom >= 15) && (name != null))
509 if (feature.geom.prim == Pflag.LINE) {
510 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 60), Color.black, -40);
511 } else {
512 Renderer.labelText(name, new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 0)));
513 }
514 break;
515 case SEA_SHOL:
516 if (Renderer.zoom >= 14) {
517 if (feature.geom.prim == Pflag.AREA) {
518 Renderer.lineVector(new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 }));
519 if (name != null) {
520 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
521 Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 20)));
522 }
523 } else if (feature.geom.prim == Pflag.LINE) {
524 if (name != null) {
525 Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, -40);
526 Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 20);
527 }
528 } else {
529 if (name != null) {
530 Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
531 Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 20)));
532 }
533 }
534 }
535 break;
536 case SEA_GAT:
537 case SEA_NRRW:
538 addName(12, new Font("Arial", Font.PLAIN, 100));
539 break;
540 default:
541 break;
542 }
543 break;
544 case SNDWAV:
545 if (Renderer.zoom >= 12)
546 Renderer.fillPattern(Areas.Sandwaves);
547 break;
548 case WEDKLP:
549 if (Renderer.zoom >= 12) {
550 switch ((CatWED) getAttEnum(feature.type, Att.CATWED)) {
551 case WED_KELP:
552 if (feature.geom.prim == Pflag.AREA) {
553 Renderer.fillPattern(Areas.KelpA);
554 } else {
555 Renderer.symbol(Areas.KelpS);
556 }
557 break;
558 default:
559 break;
560 }
561 }
562 break;
563 case SPLARE:
564 if (Renderer.zoom >= 12) {
565 Renderer.symbol(Areas.Plane, new Scheme(Symbols.Msymb));
566 Renderer.lineSymbols(Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Symbols.Mline);
567 addName(15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
568 }
569 break;
570 case CBLARE:
571 if (Renderer.zoom >= 12) {
572 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.Cable, null, 4, Symbols.Mline);
573 }
574 break;
575 case PIPARE:
576 if (Renderer.zoom >= 12) {
577 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.Pipeline, null, 4, Symbols.Mline);
578 break;
579 }
580 default:
581 break;
582 }
583 }
584
585 @SuppressWarnings("unchecked")
586 private static void beacons() {
587 if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))
588 || ((Renderer.zoom >= 11) && ((feature.type == Obj.BCNSAW) || hasObject(Obj.RTPBCN)))) {
589 if (testAttribute(feature.type, Att.STATUS, StsSTS.STS_ILLD)) {
590 Renderer.symbol(Beacons.Floodlight);
591 }
592 BcnSHP shape = (BcnSHP) getAttEnum(feature.type, Att.BCNSHP);
593 if (shape == BcnSHP.BCN_UNKN)
594 shape = BcnSHP.BCN_PILE;
595 if ((shape == BcnSHP.BCN_WTHY) && (feature.type == Obj.BCNLAT)) {
596 switch ((CatLAM) getAttEnum(feature.type, Att.CATLAM)) {
597 case LAM_PORT:
598 Renderer.symbol(Beacons.WithyPort);
599 break;
600 case LAM_STBD:
601 Renderer.symbol(Beacons.WithyStarboard);
602 break;
603 default:
604 Renderer.symbol(Beacons.Stake, getScheme(feature.type));
605 }
606 } else if (shape == BcnSHP.BCN_PRCH && feature.type == Obj.BCNLAT && !feature.objs.containsKey(Obj.TOPMAR)) {
607 switch ((CatLAM) getAttEnum(feature.type, Att.CATLAM)) {
608 case LAM_PORT:
609 Renderer.symbol(Beacons.PerchPort);
610 break;
611 case LAM_STBD:
612 Renderer.symbol(Beacons.PerchStarboard);
613 break;
614 default:
615 Renderer.symbol(Beacons.Stake, getScheme(feature.type));
616 }
617 } else {
618 Renderer.symbol(Beacons.Shapes.get(shape), getScheme(feature.type));
619 if (feature.objs.containsKey(Obj.TOPMAR)) {
620 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
621 if (testAttribute(Obj.TOPMAR, Att.STATUS, StsSTS.STS_ILLD)) {
622 Renderer.symbol(Beacons.Floodlight);
623 }
624 if (topmap.containsKey(Att.TOPSHP)) {
625 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.TOPMAR), Topmarks.BeaconDelta);
626 }
627 } else if (feature.objs.containsKey(Obj.DAYMAR)) {
628 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
629 if (topmap.containsKey(Att.TOPSHP)) {
630 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.DAYMAR), Topmarks.BeaconDelta);
631 }
632 }
633 }
634 if (hasObject(Obj.NOTMRK))
635 notices();
636 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
637 Signals.addSignals();
638 }
639 }
640
641 @SuppressWarnings("unchecked")
642 private static void buoys() {
643 if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR))) || ((Renderer.zoom >= 11) && ((feature.type == Obj.BOYSAW) || hasObject(Obj.RTPBCN)))) {
644 BoySHP shape = (BoySHP) getAttEnum(feature.type, Att.BOYSHP);
645 if (shape == BoySHP.BOY_UNKN)
646 shape = BoySHP.BOY_PILR;
647 Renderer.symbol(Buoys.Shapes.get(shape), getScheme(feature.type));
648 if (feature.objs.containsKey(Obj.TOPMAR)) {
649 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
650 if (topmap.containsKey(Att.TOPSHP)) {
651 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
652 }
653 } else if (feature.objs.containsKey(Obj.DAYMAR)) {
654 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
655 if (topmap.containsKey(Att.TOPSHP)) {
656 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape));
657 }
658 }
659 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
660 Signals.addSignals();
661 }
662 }
663
664 private static void bridges() {
665 if (Renderer.zoom >= 16) {
666 double verclr, verccl, vercop, horclr;
667 AttMap atts = feature.objs.get(Obj.BRIDGE).get(0);
668 String vstr = "";
669 String hstr = "";
670 if (atts != null) {
671 if (atts.containsKey(Att.HORCLR)) {
672 horclr = (Double) atts.get(Att.HORCLR).val;
673 hstr = String.valueOf(horclr);
674 }
675 if (atts.containsKey(Att.VERCLR)) {
676 verclr = (Double) atts.get(Att.VERCLR).val;
677 } else {
678 verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
679 }
680 verccl = atts.containsKey(Att.VERCCL) ? (Double) atts.get(Att.VERCCL).val : 0;
681 vercop = atts.containsKey(Att.VERCOP) ? (Double) atts.get(Att.VERCOP).val : 0;
682 if (verclr > 0) {
683 vstr += String.valueOf(verclr);
684 } else if (verccl > 0) {
685 if (vercop == 0) {
686 vstr += String.valueOf(verccl) + "/-";
687 } else {
688 vstr += String.valueOf(verccl) + "/" + String.valueOf(vercop);
689 }
690 }
691 if (hstr.isEmpty() && !vstr.isEmpty()) {
692 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
693 } else if (!hstr.isEmpty() && !vstr.isEmpty()) {
694 Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC));
695 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC));
696 } else if (!hstr.isEmpty() && vstr.isEmpty()) {
697 Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC));
698 }
699 }
700 Signals.addSignals();
701 }
702 }
703
704 private static void cables() {
705 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
706 if (feature.type == Obj.CBLSUB) {
707 Renderer.lineSymbols(Areas.Cable, 0.0, null, null, 0, Symbols.Mline);
708 } else if (feature.type == Obj.CBLOHD) {
709 AttMap atts = feature.objs.get(Obj.CBLOHD).get(0);
710 if (atts != null && atts.containsKey(Att.CATCBL) && atts.get(Att.CATCBL).val == CatCBL.CBL_POWR) {
711 Renderer.lineSymbols(Areas.CableDash, 0, Areas.CableDot, Areas.CableFlash, 2, Color.black);
712 } else {
713 Renderer.lineSymbols(Areas.CableDash, 0, Areas.CableDot, null, 2, Color.black);
714 }
715 if (atts != null) {
716 if (atts.containsKey(Att.VERCLR)) {
717 Renderer.labelText(String.valueOf(atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
718 } else if (atts.containsKey(Att.VERCSA)) {
719 Renderer.labelText(String.valueOf(atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
720 }
721 }
722 }
723 }
724 }
725
726 private static void callpoint() {
727 if (Renderer.zoom >= 14) {
728 Symbol symb = Harbours.CallPoint2;
729 TrfTRF trf = (TrfTRF) getAttEnum(feature.type, Att.TRAFIC);
730 if (trf != TrfTRF.TRF_TWOW) {
731 symb = Harbours.CallPoint1;
732 }
733 Double orient = 0.0;
734 if ((orient = (Double) getAttVal(feature.type, Att.ORIENT)) == null) {
735 orient = 0.0;
736 }
737 Renderer.symbol(symb, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(orient))));
738 String chn;
739 if (!(chn = getAttStr(feature.type, Att.COMCHA)).isEmpty()) {
740 Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 50)));
741 }
742 }
743 }
744
745 private static void depths() {
746 switch (feature.type) {
747 case SOUNDG:
748 if (testAttribute(Obj.SOUNDG, Att.TECSOU, TecSOU.SOU_COMP) && hasAttribute(Obj.SOUNDG, Att.VALSOU)) {
749 double depth = (double) getAttVal(Obj.SOUNDG, Att.VALSOU);
750 Color col = new Color(0x00ffffff, true);
751 if (depth > 0.0) col = new Color(0x2090ff);
752 if (depth > 2.0) col = new Color(0x40a0ff);
753 if (depth > 5.0) col = new Color(0x60b0ff);
754 if (depth > 10.0) col = new Color(0x80c0ff);
755 if (depth > 15.0) col = new Color(0xa0d0ff);
756 if (depth > 20.0) col = new Color(0xc0e0ff);
757 if (depth > 50.0) col = new Color(0xe0f0ff);
758 Renderer.rasterPixel(Math.toRadians(1.0/60.0/16.0), col);
759 } else if ((Renderer.zoom >= 14) && hasAttribute(Obj.SOUNDG, Att.VALSOU)) {
760 double depth = (double) getAttVal(Obj.SOUNDG, Att.VALSOU);
761 String dstr = df.format(depth);
762 String[] tok = dstr.split("[-.]");
763 String ul = "";
764 String id = tok[0];
765 String dd = "";
766 if (tok[0].equals("")) {
767 for (int i = 0; i < tok[1].length(); i++) {
768 ul += "_";
769 }
770 id = tok[1];
771 dd = (tok.length == 3) ? tok[2] : "";
772 } else {
773 dd = (tok.length == 2) ? tok[1] : "";
774 }
775 Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 15)));
776 Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 0)));
777 Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(15, 10)));
778 }
779 break;
780 case DEPCNT:
781 Renderer.lineVector(new LineStyle(Color.blue, 2));
782 break;
783 default:
784 break;
785 }
786 }
787
788 private static void distances() {
789 if (Renderer.zoom >= 14) {
790 if (!testAttribute(Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) {
791 Renderer.symbol(Harbours.DistanceI);
792 } else {
793 Renderer.symbol(Harbours.DistanceU);
794 }
795 if (Renderer.zoom >= 15) {
796 AttMap atts = getAtts(Obj.DISMAR, 0);
797 if (atts != null && atts.containsKey(Att.WTWDIS)) {
798 Double dist = (Double) atts.get(Att.WTWDIS).val;
799 String str = "";
800 if (atts.containsKey(Att.HUNITS)) {
801 switch ((UniHLU) getAttEnum(Obj.DISMAR, Att.HUNITS)) {
802 case HLU_METR:
803 str += "m ";
804 break;
805 case HLU_FEET:
806 str += "ft ";
807 break;
808 case HLU_HMTR:
809 str += "hm ";
810 break;
811 case HLU_KMTR:
812 str += "km ";
813 break;
814 case HLU_SMIL:
815 str += "M ";
816 break;
817 case HLU_NMIL:
818 str += "NM ";
819 break;
820 default:
821 break;
822 }
823 }
824 str += String.format("%3.1f", dist);
825 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45)));
826 }
827 }
828 }
829 }
830
831 @SuppressWarnings("unchecked")
832 private static void floats() {
833 if ((Renderer.zoom >= 12) || ((Renderer.zoom >= 11) && ((feature.type == Obj.LITVES) || (feature.type == Obj.BOYINB) || hasObject(Obj.RTPBCN)))) {
834 switch (feature.type) {
835 case LITVES:
836 Renderer.symbol(Buoys.Super, getScheme(feature.type));
837 break;
838 case LITFLT:
839 Renderer.symbol(Buoys.Float, getScheme(feature.type));
840 break;
841 case BOYINB:
842 Renderer.symbol(Buoys.Super, getScheme(feature.type));
843 break;
844 default:
845 break;
846 }
847 if (feature.objs.containsKey(Obj.TOPMAR)) {
848 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
849 if (topmap.containsKey(Att.TOPSHP)) {
850 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
851 }
852 } else if (feature.objs.containsKey(Obj.DAYMAR)) {
853 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
854 if (topmap.containsKey(Att.TOPSHP)) {
855 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.DAYMAR), Topmarks.FloatDelta);
856 }
857 }
858 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
859 Signals.addSignals();
860 }
861 }
862
863 private static void gauges() {
864 if (Renderer.zoom >= 14) {
865 Renderer.symbol(Harbours.TideGauge);
866 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
867 Signals.addSignals();
868 }
869 }
870
871 @SuppressWarnings("unchecked")
872 private static void harbours() {
873 String name = getName();
874 switch (feature.type) {
875 case ACHBRT:
876 if (Renderer.zoom >= 14) {
877 Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb));
878 if (Renderer.zoom >= 15) {
879 Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC));
880 }
881 }
882 if (getAttVal(Obj.ACHBRT, Att.RADIUS) != null) {
883 double radius;
884 if ((radius = (Double) getAttVal(Obj.ACHBRT, Att.RADIUS)) != 0) {
885 UniHLU units = (UniHLU) getAttEnum(Obj.ACHBRT, Att.HUNITS);
886 if (units == UniHLU.HLU_UNKN) {
887 units = UniHLU.HLU_METR;
888 }
889 Renderer.lineCircle(new LineStyle(Symbols.Mline, 4, new float[] { 10, 10 }, null), radius, units);
890 }
891 }
892 break;
893 case ACHARE:
894 if (Renderer.zoom >= 12) {
895 ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH);
896 if (feature.geom.prim != Pflag.AREA) {
897 Renderer.symbol(Harbours.Anchorage, new Scheme(Color.black));
898 } else {
899 if (cats.contains(CatACH.ACH_SMCM)) {
900 Renderer.symbol(Buoys.Shapes.get(BoySHP.BOY_SPHR), new Scheme(Symbols.Msymb));
901 Renderer.symbol(Topmarks.TopMooring, Topmarks.BuoyDeltas.get(BoySHP.BOY_SPHR));
902 } else {
903 Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline));
904 }
905 Renderer.lineSymbols(Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Symbols.Mline);
906 }
907 addName(15, new Font("Arial", Font.BOLD, 60), Symbols.Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
908 ArrayList<StsSTS> sts = (ArrayList<StsSTS>) getAttList(Obj.ACHARE, Att.STATUS);
909 if (Renderer.zoom >= 15 && sts.contains(StsSTS.STS_RESV)) {
910 Renderer.labelText("Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
911 }
912 int dy = (cats.size() - 1) * -30;
913 for (CatACH cat : cats) {
914 switch (cat) {
915 case ACH_DEEP:
916 Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
917 dy += 60;
918 break;
919 case ACH_TANK:
920 Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
921 dy += 60;
922 break;
923 case ACH_H24P:
924 Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
925 dy += 60;
926 break;
927 case ACH_EXPL:
928 Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
929 dy += 60;
930 break;
931 case ACH_QUAR:
932 Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
933 dy += 60;
934 break;
935 case ACH_SEAP:
936 Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
937 dy += 60;
938 break;
939 case ACH_SMCF:
940 case ACH_SMCM:
941 Renderer.labelText("Small", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
942 Renderer.labelText("Craft", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(60, dy)));
943 dy += 60;
944 break;
945 default:
946 }
947 }
948 }
949 break;
950 case BERTHS:
951 if (Renderer.zoom >= 14) {
952 Renderer.lineVector(new LineStyle(Symbols.Mline, 6, new float[] { 20, 20 }));
953 Renderer.labelText(name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white);
954 }
955 break;
956 case BUISGL:
957 if (Renderer.zoom >= 15) {
958 Renderer.lineVector(new LineStyle(Color.black, 8, new Color(0xffc0c0c0, true)));
959 if (testAttribute(Obj.BUISGL, Att.FUNCTN, FncFNC.FNC_LOOK)) {
960 Renderer.labelText("Lookout", new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 50)));
961 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, -50)));
962 }
963 if (Renderer.zoom >= 16) {
964 if (testAttribute(Obj.BUISGL, Att.STATUS, StsSTS.STS_ILLD)) {
965 Renderer.symbol(Beacons.Floodlight);
966 }
967 ArrayList<Symbol> symbols = new ArrayList<>();
968 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(Obj.BUISGL, Att.FUNCTN);
969 for (FncFNC fnc : fncs) {
970 symbols.add(Landmarks.Funcs.get(fnc));
971 }
972 if (feature.objs.containsKey(Obj.SMCFAC)) {
973 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
974 for (CatSCF scf : scfs) {
975 symbols.add(Facilities.Cats.get(scf));
976 }
977 }
978 Renderer.cluster(symbols);
979 Signals.addSignals();
980 }
981 }
982 break;
983 case HRBFAC:
984 if (Renderer.zoom >= 12) {
985 ArrayList<CatHAF> cathaf = (ArrayList<CatHAF>) getAttList(Obj.HRBFAC, Att.CATHAF);
986 if (cathaf.size() == 1) {
987 switch (cathaf.get(0)) {
988 case HAF_MRNA:
989 Renderer.symbol(Harbours.Marina);
990 break;
991 case HAF_MANF:
992 Renderer.symbol(Harbours.MarinaNF);
993 break;
994 case HAF_FISH:
995 Renderer.symbol(Harbours.Fishing);
996 break;
997 default:
998 Renderer.symbol(Harbours.Harbour);
999 break;
1000 }
1001 } else {
1002 Renderer.symbol(Harbours.Harbour);
1003 }
1004 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, -80)));
1005 }
1006 break;
1007 default:
1008 break;
1009 }
1010 }
1011
1012 @SuppressWarnings("unchecked")
1013 private static void highways() {
1014 switch (feature.type) {
1015 case ROADWY:
1016 ArrayList<CatROD> cat = (ArrayList<CatROD>) getAttList(Obj.ROADWY, Att.CATROD);
1017 if (cat.size() > 0) {
1018 switch (cat.get(0)) {
1019 case ROD_MWAY:
1020 Renderer.lineVector(new LineStyle(Color.black, 20));
1021 break;
1022 case ROD_MAJR:
1023 Renderer.lineVector(new LineStyle(Color.black, 15));
1024 break;
1025 case ROD_MINR:
1026 Renderer.lineVector(new LineStyle(Color.black, 10));
1027 break;
1028 default:
1029 Renderer.lineVector(new LineStyle(Color.black, 5));
1030 }
1031 } else {
1032 Renderer.lineVector(new LineStyle(Color.black, 5));
1033 }
1034 break;
1035 case RAILWY:
1036 Renderer.lineVector(new LineStyle(Color.gray, 10));
1037 Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 30, 30 }));
1038 break;
1039 default:
1040 }
1041 }
1042
1043 @SuppressWarnings("unchecked")
1044 private static void landmarks() {
1045 if (!hasAttribute(Obj.LNDMRK, Att.CATLMK) && (!hasAttribute(Obj.LNDMRK, Att.FUNCTN) || testAttribute(Obj.LNDMRK, Att.FUNCTN, FncFNC.FNC_LGHT)) && hasObject(Obj.LIGHTS)) {
1046 lights();
1047 } else if (Renderer.zoom >= 12) {
1048 switch (feature.type) {
1049 case LNDMRK:
1050 if (testAttribute(Obj.LNDMRK, Att.STATUS, StsSTS.STS_ILLD)) {
1051 Renderer.symbol(Beacons.Floodlight);
1052 }
1053 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttList(feature.type, Att.CATLMK);
1054 Symbol catSym = Landmarks.Shapes.get(cats.get(0));
1055 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature.type, Att.FUNCTN);
1056 Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
1057 if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
1058 catSym = Landmarks.ChurchTower;
1059 if (cats.get(0) == CatLMK.LMK_RADR)
1060 fncSym = Landmarks.RadioTV;
1061 Renderer.symbol(catSym);
1062 Renderer.symbol(fncSym);
1063 break;
1064 case SILTNK:
1065 if (testAttribute(feature.type, Att.CATSIL, CatSIL.SIL_WTRT))
1066 Renderer.symbol(Landmarks.WaterTower);
1067 break;
1068 default:
1069 break;
1070 }
1071 if (Renderer.zoom >= 15) {
1072 Renderer.colLetters(getAttList(feature.type, Att.COLOUR));
1073 }
1074 Signals.addSignals();
1075 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
1076 }
1077 }
1078
1079 @SuppressWarnings("unchecked")
1080 private static void lights() {
1081 boolean ok = false;
1082 switch (feature.type) {
1083 case LITMAJ:
1084 case LNDMRK:
1085 Renderer.symbol(Beacons.LightMajor);
1086 if (Renderer.zoom >= 12) {
1087 ok = true;
1088 } else {
1089 Signals.lights();
1090 }
1091 break;
1092 case LITMIN:
1093 case LIGHTS:
1094 case PILPNT:
1095 if (Renderer.zoom >= 14) {
1096 if (testAttribute(Obj.LIGHTS, Att.CATLIT, CatLIT.LIT_FLDL)) {
1097 Renderer.symbol(Beacons.Floodlight, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(90))));
1098 Renderer.symbol(Harbours.SignalStation);
1099 } else {
1100 Renderer.symbol(Beacons.LightMinor);
1101 }
1102 ok = true;
1103 }
1104 break;
1105 default:
1106 break;
1107 }
1108 if (ok) {
1109 if (feature.objs.containsKey(Obj.TOPMAR)) {
1110 if (testAttribute(Obj.TOPMAR, Att.STATUS, StsSTS.STS_ILLD)) {
1111 Renderer.symbol(Beacons.Floodlight);
1112 }
1113 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
1114 if (topmap.containsKey(Att.TOPSHP)) {
1115 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.TOPMAR), Topmarks.LightDelta);
1116 }
1117 } else if (feature.objs.containsKey(Obj.DAYMAR)) {
1118 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
1119 if (topmap.containsKey(Att.TOPSHP)) {
1120 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.DAYMAR), Topmarks.LightDelta);
1121 }
1122 }
1123 Signals.addSignals();
1124 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(0, -50)));
1125 }
1126 }
1127
1128 @SuppressWarnings("unchecked")
1129 private static void marinas() {
1130 if (Renderer.zoom >= 16) {
1131 ArrayList<Symbol> symbols = new ArrayList<>();
1132 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
1133 for (CatSCF scf : scfs) {
1134 Symbol sym = Facilities.Cats.get(scf);
1135 if (sym != null) symbols.add(sym);
1136 }
1137 Renderer.cluster(symbols);
1138 }
1139 }
1140
1141 private static void moorings() {
1142 if (Renderer.zoom >= 14) {
1143 switch ((CatMOR) getAttEnum(feature.type, Att.CATMOR)) {
1144 case MOR_DLPN:
1145 if (feature.geom.prim == Pflag.AREA) {
1146 Renderer.lineVector(new LineStyle(Color.black, 4, Symbols.Yland));
1147 } else {
1148 Renderer.symbol(Harbours.Dolphin);
1149 }
1150 Signals.addSignals();
1151 break;
1152 case MOR_DDPN:
1153 Renderer.symbol(Harbours.DeviationDolphin);
1154 Signals.addSignals();
1155 break;
1156 case MOR_BLRD:
1157 case MOR_POST:
1158 Renderer.symbol(Harbours.Bollard);
1159 break;
1160 case MOR_BUOY:
1161 if (Renderer.zoom >= 16) {
1162 BoySHP shape = (BoySHP) getAttEnum(feature.type, Att.BOYSHP);
1163 if (shape == BoySHP.BOY_UNKN) {
1164 shape = BoySHP.BOY_SPHR;
1165 }
1166 Renderer.symbol(Buoys.Shapes.get(shape), (1.0 / (1.0 + (0.25 * (18 - Renderer.zoom)))), getScheme(feature.type));
1167 Renderer.symbol(Topmarks.TopMooring, (1.0 / (1.0 + (0.25 * (18 - Renderer.zoom)))), Topmarks.BuoyDeltas.get(shape));
1168 Signals.addSignals();
1169 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
1170 }
1171 break;
1172 default:
1173 break;
1174 }
1175 }
1176 }
1177
1178 @SuppressWarnings("unchecked")
1179 private static void notices() {
1180 if (Renderer.zoom >= 14) {
1181 double dx = 0.0, dy = 0.0;
1182 switch (feature.type) {
1183 case BCNCAR:
1184 case BCNISD:
1185 case BCNLAT:
1186 case BCNSAW:
1187 case BCNSPP:
1188 if (testAttribute(Obj.TOPMAR, Att.TOPSHP, TopSHP.TOP_BORD) || testAttribute(Obj.DAYMAR, Att.TOPSHP, TopSHP.TOP_BORD)) {
1189 dy = -100.0;
1190 } else {
1191 dy = -45.0;
1192 }
1193 break;
1194 case NOTMRK:
1195 dy = 0.0;
1196 break;
1197 default:
1198 return;
1199 }
1200 MarSYS sys = MarSYS.SYS_CEVN;
1201 BnkWTW bnk = BnkWTW.BWW_UNKN;
1202 AttVal<?> att = feature.atts.get(Att.MARSYS);
1203 if (att != null)
1204 sys = (MarSYS) att.val;
1205 att = feature.atts.get(Att.BNKWTW);
1206 if (att != null)
1207 bnk = (BnkWTW) att.val;
1208 ObjTab objs = feature.objs.get(Obj.NOTMRK);
1209 int n = objs.size();
1210 if (n > 5) {
1211 Renderer.symbol(Notices.Notice, new Delta(Handle.CC, AffineTransform.getTranslateInstance(dx, dy)));
1212 } else {
1213 int i = 0;
1214 for (AttMap atts : objs.values()) {
1215 if (atts.get(Att.MARSYS) != null)
1216 sys = ((ArrayList<MarSYS>) atts.get(Att.MARSYS).val).get(0);
1217 if (atts.get(Att.BNKWTW) != null)
1218 bnk = ((ArrayList<BnkWTW>) atts.get(Att.BNKWTW).val).get(0);
1219 CatNMK cat = CatNMK.NMK_UNKN;
1220 if (atts.get(Att.CATNMK) != null)
1221 cat = ((ArrayList<CatNMK>) atts.get(Att.CATNMK).val).get(0);
1222 Symbol sym = Notices.getNotice(cat, sys, bnk);
1223 Scheme sch = Notices.getScheme(sys, bnk);
1224 ArrayList<AddMRK> add = new ArrayList<>();
1225 if (atts.get(Att.ADDMRK) != null)
1226 add = (ArrayList<AddMRK>) atts.get(Att.ADDMRK).val;
1227 Handle h = Handle.CC;
1228 double ax = 0.0;
1229 double ay = 0.0;
1230 switch (i) {
1231 case 0:
1232 if (n != 1)
1233 h = null;
1234 break;
1235 case 1:
1236 if (n <= 3) {
1237 h = Handle.RC;
1238 ax = -30;
1239 ay = dy;
1240 } else {
1241 h = Handle.BR;
1242 }
1243 break;
1244 case 2:
1245 if (n <= 3)
1246 h = Handle.LC;
1247 else
1248 h = Handle.BL;
1249 break;
1250 case 3:
1251 if (n == 4)
1252 h = Handle.TC;
1253 else
1254 h = Handle.TR;
1255 break;
1256 case 4:
1257 h = Handle.TL;
1258 break;
1259 }
1260 if (h != null) {
1261 Renderer.symbol(sym, sch, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
1262 if (!add.isEmpty())
1263 Renderer.symbol(Notices.NoticeBoard, new Delta(Handle.BC, AffineTransform.getTranslateInstance(ax, ay - 30)));
1264 }
1265 i++;
1266 }
1267 }
1268 }
1269 }
1270
1271 private static void obstructions() {
1272 if ((Renderer.zoom >= 12) && (feature.type == Obj.OBSTRN)) {
1273 if (getAttEnum(feature.type, Att.CATOBS) == CatOBS.OBS_BOOM) {
1274 Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 20, 20 }, null));
1275 if (Renderer.zoom >= 15) {
1276 Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 40), Color.black, -20);
1277 }
1278 }
1279 if (getAttEnum(feature.type, Att.CATOBS) == CatOBS.OBS_FLGD) {
1280 Renderer.symbol(Areas.Foul, new Scheme(Color.black));
1281 if (feature.geom.prim == Pflag.AREA) {
1282 Renderer.lineSymbols(Areas.Dash, 1.0, Areas.LineFoul, null, 10, Color.black);
1283 }
1284 }
1285 }
1286 if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) {
1287 switch ((WatLEV) getAttEnum(feature.type, Att.WATLEV)) {
1288 case LEV_CVRS:
1289 Renderer.symbol(Areas.RockC);
1290 break;
1291 case LEV_AWSH:
1292 Renderer.symbol(Areas.RockA);
1293 break;
1294 default:
1295 Renderer.symbol(Areas.Rock);
1296 break;
1297 }
1298 }
1299 }
1300
1301 private static void pipelines() {
1302 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
1303 if (feature.type == Obj.PIPSOL) {
1304 switch ((CatPIP) getAttEnum(feature.type, Att.CATPIP)) {
1305 case PIP_ITAK:
1306 case PIP_OFAL:
1307 case PIP_SEWR:
1308 Renderer.lineSymbols(Areas.Pipeline, 0.33, null, null, 0, Color.black);
1309 break;
1310 default:
1311 Renderer.lineSymbols(Areas.Pipeline, 0.33, null, null, 0, Symbols.Msymb);
1312 }
1313 } else if (feature.type == Obj.PIPOHD) {
1314 Renderer.lineVector(new LineStyle(Color.black, 8));
1315 AttMap atts = feature.atts;
1316 double verclr = 0;
1317 if (atts != null) {
1318 if (atts.containsKey(Att.VERCLR)) {
1319 verclr = (Double) atts.get(Att.VERCLR).val;
1320 } else {
1321 verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
1322 }
1323 if (verclr > 0) {
1324 Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
1325 }
1326 }
1327 }
1328 }
1329 }
1330
1331 @SuppressWarnings("unchecked")
1332 private static void platforms() {
1333 ArrayList<CatOFP> cats = (ArrayList<CatOFP>) getAttList(Obj.OFSPLF, Att.CATOFP);
1334 if (cats.get(0) == CatOFP.OFP_FPSO)
1335 Renderer.symbol(Buoys.Storage);
1336 else
1337 Renderer.symbol(Landmarks.Platform);
1338 if (testAttribute(feature.type, Att.STATUS, StsSTS.STS_ILLD)) {
1339 Renderer.symbol(Beacons.Floodlight);
1340 }
1341 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
1342 Signals.addSignals();
1343 }
1344
1345 @SuppressWarnings("unchecked")
1346 private static void points() {
1347 boolean ok = false;
1348 switch (feature.type) {
1349 case FOGSIG:
1350 if (Renderer.zoom >= 12) {
1351 if (feature.objs.containsKey(Obj.LIGHTS))
1352 lights();
1353 else
1354 Renderer.symbol(Harbours.Post);
1355 ok = true;
1356 }
1357 break;
1358 default:
1359 if (Renderer.zoom >= 14) {
1360 if (testAttribute(feature.type, Att.STATUS, StsSTS.STS_ILLD)) {
1361 Renderer.symbol(Beacons.Floodlight);
1362 }
1363 if (feature.objs.containsKey(Obj.LIGHTS))
1364 lights();
1365 else
1366 Renderer.symbol(Harbours.Post);
1367 ok = true;
1368 }
1369 break;
1370 }
1371 if (ok) {
1372 if (feature.objs.containsKey(Obj.TOPMAR)) {
1373 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
1374 if (topmap.containsKey(Att.TOPSHP)) {
1375 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.TOPMAR), null);
1376 }
1377 } else if (feature.objs.containsKey(Obj.DAYMAR)) {
1378 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
1379 if (topmap.containsKey(Att.TOPSHP)) {
1380 Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) topmap.get(Att.TOPSHP).val).get(0)), getScheme(Obj.DAYMAR), null);
1381 }
1382 }
1383 Signals.addSignals();
1384 }
1385 }
1386
1387 private static void ports() {
1388 if (Renderer.zoom >= 14) {
1389 if (feature.type == Obj.CRANES) {
1390 if ((CatCRN) getAttEnum(feature.type, Att.CATCRN) == CatCRN.CRN_CONT)
1391 Renderer.symbol(Harbours.ContainerCrane);
1392 else
1393 Renderer.symbol(Harbours.PortCrane);
1394 } else if (feature.type == Obj.HULKES) {
1395 Renderer.lineVector(new LineStyle(Color.black, 4, null, new Color(0xffe000)));
1396 addName(15, new Font("Arial", Font.BOLD, 40));
1397 }
1398 }
1399 }
1400
1401 private static void separation() {
1402 switch (feature.type) {
1403 case TSEZNE:
1404 case TSSCRS:
1405 case TSSRON:
1406 if (Renderer.zoom <= 15)
1407 Renderer.lineVector(new LineStyle(Symbols.Mtss));
1408 else
1409 Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, null, null));
1410 addName(10, new Font("Arial", Font.BOLD, 150), Symbols.Mline);
1411 break;
1412 case TSELNE:
1413 Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, null, null));
1414 break;
1415 case TSSLPT:
1416 Renderer.lineSymbols(Areas.LaneArrow, 0.5, null, null, 0, Symbols.Mtss);
1417 break;
1418 case TSSBND:
1419 Renderer.lineVector(new LineStyle(Symbols.Mtss, 20, new float[] { 40, 40 }, null));
1420 break;
1421 case ISTZNE:
1422 Renderer.lineSymbols(Areas.Restricted, 1.0, null, null, 0, Symbols.Mtss);
1423 break;
1424 default:
1425 break;
1426 }
1427 }
1428
1429 @SuppressWarnings("unchecked")
1430 private static void shoreline() {
1431 CatSLC cat = (CatSLC) getAttEnum(feature.type, Att.CATSLC);
1432 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) {
1433 if ((cat != CatSLC.SLC_SWAY) && (cat != CatSLC.SLC_TWAL)) {
1434 if (Renderer.zoom >= 12) {
1435 Renderer.lineVector(new LineStyle(Color.black, 10, Symbols.Yland));
1436 } else {
1437 Renderer.lineVector(new LineStyle(Symbols.Yland));
1438 }
1439 }
1440 }
1441 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) {
1442 if (Renderer.zoom >= 12) {
1443 switch (cat) {
1444 case SLC_TWAL:
1445 WatLEV lev = (WatLEV) getAttEnum(feature.type, Att.WATLEV);
1446 if (lev == WatLEV.LEV_CVRS) {
1447 Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
1448 if (Renderer.zoom >= 15)
1449 Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 40), Color.black, 80);
1450 } else {
1451 Renderer.lineVector(new LineStyle(Color.black, 10, null, null));
1452 }
1453 if (Renderer.zoom >= 15)
1454 Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 40), Color.black, -30);
1455 break;
1456 case SLC_SWAY:
1457 Renderer.lineVector(new LineStyle(Color.black, 2, null, new Color(0xffe000)));
1458 if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
1459 ArrayList<Symbol> symbols = new ArrayList<>();
1460 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(Obj.SMCFAC, Att.CATSCF);
1461 for (CatSCF scf : scfs) {
1462 symbols.add(Facilities.Cats.get(scf));
1463 }
1464 Renderer.cluster(symbols);
1465 }
1466 break;
1467 default:
1468 break;
1469 }
1470 }
1471 }
1472 }
1473
1474 @SuppressWarnings("unchecked")
1475 private static void stations() {
1476 if (Renderer.zoom >= 14) {
1477 String str = "";
1478 switch (feature.type) {
1479 case SISTAT:
1480 Renderer.symbol(Harbours.SignalStation);
1481 str = "SS";
1482 ArrayList<CatSIT> tcats = (ArrayList<CatSIT>) getAttList(Obj.SISTAT, Att.CATSIT);
1483 switch (tcats.get(0)) {
1484 case SIT_IPT:
1485 str += "(INT)";
1486 break;
1487 case SIT_PRTE:
1488 str += "(Traffic)";
1489 break;
1490 case SIT_PRTC:
1491 str += "(Port Control)";
1492 break;
1493 case SIT_LOCK:
1494 str += "(Lock)";
1495 break;
1496 case SIT_BRDG:
1497 str += "(Bridge)";
1498 break;
1499 default:
1500 break;
1501 }
1502 break;
1503 case SISTAW:
1504 Renderer.symbol(Harbours.SignalStation);
1505 str = "SS";
1506 str = "SS";
1507 ArrayList<CatSIW> wcats = (ArrayList<CatSIW>) getAttList(Obj.SISTAW, Att.CATSIW);
1508 switch (wcats.get(0)) {
1509 case SIW_STRM:
1510 str += "(Storm)";
1511 break;
1512 case SIW_WTHR:
1513 str += "(Weather)";
1514 break;
1515 case SIW_ICE:
1516 str += "(Ice)";
1517 break;
1518 case SIW_TIDG:
1519 str = "Tide gauge";
1520 break;
1521 case SIW_TIDS:
1522 str = "Tide scale";
1523 break;
1524 case SIW_TIDE:
1525 str += "(Tide)";
1526 break;
1527 case SIW_TSTR:
1528 str += "(Stream)";
1529 break;
1530 case SIW_DNGR:
1531 str += "(Danger)";
1532 break;
1533 case SIW_MILY:
1534 str += "(Firing)";
1535 break;
1536 case SIW_TIME:
1537 str += "(Time)";
1538 break;
1539 default:
1540 break;
1541 }
1542 break;
1543 case RDOSTA:
1544 case RTPBCN:
1545 Renderer.symbol(Harbours.SignalStation);
1546 Renderer.symbol(Beacons.RadarStation);
1547 break;
1548 case RADRFL:
1549 Renderer.symbol(Topmarks.RadarReflector);
1550 break;
1551 case RADSTA:
1552 Renderer.symbol(Harbours.SignalStation);
1553 Renderer.symbol(Beacons.RadarStation);
1554 break;
1555 case PILBOP:
1556 Renderer.symbol(Harbours.Pilot);
1557 addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
1558 CatPIL cat = (CatPIL) getAttEnum(feature.type, Att.CATPIL);
1559 if (cat == CatPIL.PIL_HELI) {
1560 Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
1561 }
1562 break;
1563 case CGUSTA:
1564 Renderer.symbol(Harbours.SignalStation);
1565 str = "CG";
1566 if (feature.objs.containsKey(Obj.RSCSTA))
1567 Renderer.symbol(Harbours.Rescue, new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0)));
1568 break;
1569 case RSCSTA:
1570 Renderer.symbol(Harbours.Rescue);
1571 break;
1572 default:
1573 break;
1574 }
1575 if ((Renderer.zoom >= 15) && !str.isEmpty()) {
1576 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, -50)));
1577 }
1578 Signals.addSignals();
1579 }
1580 }
1581
1582 private static void transits() {
1583 if (Renderer.zoom >= 14) {
1584 if (feature.type == Obj.RECTRC)
1585 Renderer.lineVector(new LineStyle(Color.black, 5, null, null));
1586 else if (feature.type == Obj.NAVLNE)
1587 Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 25, 25 }, null));
1588 }
1589 if (Renderer.zoom >= 15) {
1590 String str = "";
1591 String name = getName();
1592 if (name != null)
1593 str += name + " ";
1594 Double ort;
1595 if ((ort = (Double) getAttVal(feature.type, Att.ORIENT)) != null) {
1596 str += df.format(ort) + "º";
1597 if (!str.isEmpty())
1598 Renderer.lineText(str, new Font("Arial", Font.PLAIN, 40), Color.black, -20);
1599 }
1600 }
1601 }
1602
1603 @SuppressWarnings("unchecked")
1604 private static void virtual() {
1605 if (Renderer.zoom >= 12) {
1606 Renderer.symbol(Harbours.SignalStation, new Scheme(Symbols.Msymb));
1607 Renderer.symbol(Beacons.RadarStation, new Scheme(Symbols.Msymb));
1608 ArrayList<CatVAN> cats = (ArrayList<CatVAN>) getAttList(Obj.VAATON, Att.CATVAN);
1609 for (CatVAN van : cats) {
1610 switch (van) {
1611 case VAN_NCAR:
1612 Renderer.symbol(Topmarks.TopNorth, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1613 break;
1614 case VAN_SCAR:
1615 Renderer.symbol(Topmarks.TopSouth, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1616 break;
1617 case VAN_ECAR:
1618 Renderer.symbol(Topmarks.TopEast, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1619 break;
1620 case VAN_WCAR:
1621 Renderer.symbol(Topmarks.TopWest, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1622 break;
1623 case VAN_PLAT:
1624 case VAN_PCHS:
1625 Renderer.symbol(Topmarks.TopCan, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1626 break;
1627 case VAN_SLAT:
1628 case VAN_PCHP:
1629 Renderer.symbol(Topmarks.TopCone, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1630 break;
1631 case VAN_IDGR:
1632 Renderer.symbol(Topmarks.TopIsol, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1633 break;
1634 case VAN_SAFW:
1635 Renderer.symbol(Topmarks.TopSphere, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1636 break;
1637 case VAN_SPPM:
1638 Renderer.symbol(Topmarks.TopX, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1639 break;
1640 case VAN_WREK:
1641 Renderer.symbol(Topmarks.TopCross, new Scheme(Symbols.Msymb), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
1642 break;
1643 default:
1644 break;
1645 }
1646 }
1647 }
1648 addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(50, 0)));
1649 if (Renderer.zoom >= 15) {
1650 Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
1651 }
1652 }
1653
1654 private static void waterways() {
1655 Renderer.lineVector(new LineStyle(Symbols.Bwater, 20, (feature.geom.prim == Pflag.AREA) ? Symbols.Bwater : null));
1656 }
1657
1658 private static void wrecks() {
1659 if (Renderer.zoom >= 14) {
1660 switch ((CatWRK) getAttEnum(feature.type, Att.CATWRK)) {
1661 case WRK_DNGR:
1662 case WRK_MSTS:
1663 Renderer.symbol(Areas.WreckD);
1664 break;
1665 case WRK_HULS:
1666 Renderer.symbol(Areas.WreckS);
1667 break;
1668 default:
1669 Renderer.symbol(Areas.WreckND);
1670 }
1671 }
1672 }
1673}
Note: See TracBrowser for help on using the repository browser.