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

Last change on this file since 36267 was 36267, checked in by malcolmh, 7 months ago

update

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