source: osm/applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java@ 27058

Last change on this file since 27058 was 27058, checked in by malcolmh, 13 years ago

save

File size: 61.3 KB
Line 
1package oseam.seamarks;
2
3import java.awt.*;
4import javax.swing.*;
5import java.util.*;
6
7import org.openstreetmap.josm.Main;
8import org.openstreetmap.josm.data.osm.Node;
9import org.openstreetmap.josm.command.ChangePropertyCommand;
10
11import oseam.dialogs.OSeaMAction;
12
13public class SeaMark {
14
15 public OSeaMAction dlg = null;
16
17 public SeaMark(OSeaMAction dia) {
18 dlg = dia;
19 }
20
21 public enum Reg {
22 A, B, C, R, X
23 }
24
25 public static final EnumMap<Reg, String> RegSTR = new EnumMap<Reg, String>(Reg.class);
26 static {
27 RegSTR.put(Reg.A, "iala-a");
28 RegSTR.put(Reg.B, "iala-b");
29 RegSTR.put(Reg.C, "cevni");
30 RegSTR.put(Reg.R, "riwr");
31 RegSTR.put(Reg.X, "other");
32 }
33
34 private Reg region = Reg.A;
35
36 public Reg getRegion() {
37 return region;
38 }
39
40 public void setRegion(Reg reg) {
41 region = reg;
42 }
43
44 private String name = "";
45
46 public String getName() {
47 return name;
48 }
49
50 public void setName(String str) {
51 name = str.trim();
52 }
53
54 public enum Obj {
55 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP,
56 FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP, LITMAJ, LITMIN, LITFLT, LITVES,
57 LITHSE, LNDMRK, MORFAC, SISTAW, SISTAT
58 }
59
60 public static final EnumMap<Obj, String> ObjSTR = new EnumMap<Obj, String>(Obj.class);
61 static {
62 ObjSTR.put(Obj.BCNCAR, "beacon_cardinal");
63 ObjSTR.put(Obj.BCNISD, "beacon_isolated_danger");
64 ObjSTR.put(Obj.BCNLAT, "beacon_lateral");
65 ObjSTR.put(Obj.BCNSAW, "beacon_safe_water");
66 ObjSTR.put(Obj.BCNSPP, "beacon_special_purpose");
67 ObjSTR.put(Obj.BOYCAR, "buoy_cardinal");
68 ObjSTR.put(Obj.BOYISD, "buoy_isolated_danger");
69 ObjSTR.put(Obj.BOYLAT, "buoy_lateral");
70 ObjSTR.put(Obj.BOYSAW, "buoy_safe_water");
71 ObjSTR.put(Obj.BOYSPP, "buoy_special_purpose");
72 ObjSTR.put(Obj.FLTCAR, "light_float");
73 ObjSTR.put(Obj.FLTLAT, "light_float");
74 ObjSTR.put(Obj.FLTSAW, "light_float");
75 ObjSTR.put(Obj.FLTISD, "light_float");
76 ObjSTR.put(Obj.FLTSPP, "light_float");
77 ObjSTR.put(Obj.LITMAJ, "light_major");
78 ObjSTR.put(Obj.LITMIN, "light_minor");
79 ObjSTR.put(Obj.LITFLT, "light_float");
80 ObjSTR.put(Obj.LITVES, "light_vessel");
81 ObjSTR.put(Obj.LNDMRK, "landmark");
82 ObjSTR.put(Obj.LITHSE, "landmark");
83 ObjSTR.put(Obj.MORFAC, "mooring");
84 ObjSTR.put(Obj.SISTAW, "signal_station_warning");
85 ObjSTR.put(Obj.SISTAT, "signal_station_traffic");
86 }
87
88 private Obj object = Obj.UNKNOWN;
89
90 public Obj getObject() {
91 return object;
92 }
93
94 public void setObject(Obj obj) {
95 object = obj;
96 }
97
98 public enum Ent {
99 BODY, BUOY, BEACON, FLOAT, TOPMARK, LIGHT, MOORING, STATION
100 }
101
102 public static final EnumMap<Obj, Ent> EntMAP = new EnumMap<Obj, Ent>(Obj.class);
103 static {
104 EntMAP.put(Obj.BCNCAR, Ent.BEACON);
105 EntMAP.put(Obj.BCNISD, Ent.BEACON);
106 EntMAP.put(Obj.BCNLAT, Ent.BEACON);
107 EntMAP.put(Obj.BCNSAW, Ent.BEACON);
108 EntMAP.put(Obj.BCNSPP, Ent.BEACON);
109 EntMAP.put(Obj.BOYCAR, Ent.BUOY);
110 EntMAP.put(Obj.BOYISD, Ent.BUOY);
111 EntMAP.put(Obj.BOYLAT, Ent.BUOY);
112 EntMAP.put(Obj.BOYSAW, Ent.BUOY);
113 EntMAP.put(Obj.BOYSPP, Ent.BUOY);
114 EntMAP.put(Obj.LITMAJ, Ent.LIGHT);
115 EntMAP.put(Obj.LITMIN, Ent.LIGHT);
116 EntMAP.put(Obj.LITFLT, Ent.FLOAT);
117 EntMAP.put(Obj.FLTCAR, Ent.FLOAT);
118 EntMAP.put(Obj.FLTLAT, Ent.FLOAT);
119 EntMAP.put(Obj.FLTSAW, Ent.FLOAT);
120 EntMAP.put(Obj.FLTISD, Ent.FLOAT);
121 EntMAP.put(Obj.FLTSPP, Ent.FLOAT);
122 EntMAP.put(Obj.LITVES, Ent.FLOAT);
123 EntMAP.put(Obj.LITHSE, Ent.LIGHT);
124 EntMAP.put(Obj.LNDMRK, Ent.LIGHT);
125 EntMAP.put(Obj.MORFAC, Ent.MOORING);
126 EntMAP.put(Obj.SISTAW, Ent.STATION);
127 EntMAP.put(Obj.SISTAT, Ent.STATION);
128 }
129
130 public enum Grp {
131 NUL, LAT, CAR, SAW, ISD, SPP, LIT, SIS
132 }
133
134 public static final EnumMap<Obj, Grp> GrpMAP = new EnumMap<Obj, Grp>(Obj.class);
135 static {
136 GrpMAP.put(Obj.UNKNOWN, Grp.NUL);
137 GrpMAP.put(Obj.BCNCAR, Grp.CAR);
138 GrpMAP.put(Obj.BCNISD, Grp.ISD);
139 GrpMAP.put(Obj.BCNLAT, Grp.LAT);
140 GrpMAP.put(Obj.BCNSAW, Grp.SAW);
141 GrpMAP.put(Obj.BCNSPP, Grp.SPP);
142 GrpMAP.put(Obj.BOYCAR, Grp.CAR);
143 GrpMAP.put(Obj.BOYISD, Grp.ISD);
144 GrpMAP.put(Obj.BOYLAT, Grp.LAT);
145 GrpMAP.put(Obj.BOYSAW, Grp.SAW);
146 GrpMAP.put(Obj.BOYSPP, Grp.SPP);
147 GrpMAP.put(Obj.FLTCAR, Grp.CAR);
148 GrpMAP.put(Obj.FLTLAT, Grp.LAT);
149 GrpMAP.put(Obj.FLTSAW, Grp.SAW);
150 GrpMAP.put(Obj.FLTISD, Grp.ISD);
151 GrpMAP.put(Obj.FLTSPP, Grp.SPP);
152 GrpMAP.put(Obj.LITFLT, Grp.LIT);
153 GrpMAP.put(Obj.LITMAJ, Grp.LIT);
154 GrpMAP.put(Obj.LITMIN, Grp.LIT);
155 GrpMAP.put(Obj.LITVES, Grp.LIT);
156 GrpMAP.put(Obj.LITHSE, Grp.LIT);
157 GrpMAP.put(Obj.LNDMRK, Grp.LIT);
158 GrpMAP.put(Obj.MORFAC, Grp.SPP);
159 GrpMAP.put(Obj.SISTAW, Grp.SIS);
160 GrpMAP.put(Obj.SISTAT, Grp.SIS);
161 }
162
163 public enum Cat {
164 NONE, LAM_PORT, LAM_STBD, LAM_PPORT, LAM_PSTBD, CAM_NORTH, CAM_EAST, CAM_SOUTH, CAM_WEST,
165 ACH_URST, ACH_DEEP, ACH_TANK, ACH_EXPL, ACH_QUAR, ACH_SPLN, ACH_SCAN, ACH_SCMO, ACH_T24H, ACH_TLIM,
166 SPM_UNKN, SPM_WARN, SPM_CHBF, SPM_YCHT, SPM_CABL, SPM_OFAL, SPM_ODAS, SPM_RECN, SPM_MOOR, SPM_LNBY,
167 SPM_LDNG, SPM_NOTC, SPM_TSS, SPM_FOUL, SPM_DIVE, SPM_FRRY,
168 SPM_ANCH, MOR_DLPN, MOR_DDPN, MOR_BLRD, MOR_WALL, MOR_POST, MOR_CHWR, MOR_BUOY,
169 SIS_PTCL, SIS_PTED, SIS_IPT, SIS_BRTH, SIS_DOCK, SIS_LOCK, SIS_FBAR, SIS_BRDG, SIS_DRDG, SIS_TRFC,
170 SIS_DNGR, SIS_OBST, SIS_CABL, SIS_MILY, SIS_DSTR, SIS_WTHR, SIS_STRM, SIS_ICE, SIS_TIME, SIS_TIDE,
171 SIS_TSTM, SIS_TGAG, SIS_TSCL, SIS_DIVE, SIS_LGAG, LIT_DIRF, LIT_LEDG,
172 LMK_CHMY, LMK_CARN, LMK_DSHA, LMK_FLGS, LMK_FLRS, LMK_MNMT, LMK_RADM, LMK_TOWR, LMK_WNDM, LMK_WTRT
173 }
174
175 public static final EnumMap<Cat, String> CatSTR = new EnumMap<Cat, String>(Cat.class);
176 static {
177 CatSTR.put(Cat.LAM_PORT, "port");
178 CatSTR.put(Cat.LAM_STBD, "starboard");
179 CatSTR.put(Cat.LAM_PPORT, "preferred_channel_port");
180 CatSTR.put(Cat.LAM_PSTBD, "preferred_channel_starboard");
181 CatSTR.put(Cat.CAM_NORTH, "north");
182 CatSTR.put(Cat.CAM_EAST, "east");
183 CatSTR.put(Cat.CAM_SOUTH, "south");
184 CatSTR.put(Cat.CAM_WEST, "west");
185 CatSTR.put(Cat.SPM_UNKN, "unknown_purpose");
186 CatSTR.put(Cat.SPM_WARN, "warning");
187 CatSTR.put(Cat.SPM_CHBF, "channel_separation");
188 CatSTR.put(Cat.SPM_YCHT, "yachting");
189 CatSTR.put(Cat.SPM_CABL, "cable");
190 CatSTR.put(Cat.SPM_OFAL, "outfall");
191 CatSTR.put(Cat.SPM_ODAS, "odas");
192 CatSTR.put(Cat.SPM_RECN, "recreational");
193 CatSTR.put(Cat.SPM_MOOR, "mooring");
194 CatSTR.put(Cat.SPM_LNBY, "lanby");
195 CatSTR.put(Cat.SPM_LDNG, "leading");
196 CatSTR.put(Cat.SPM_NOTC, "notice");
197 CatSTR.put(Cat.SPM_TSS, "tss");
198 CatSTR.put(Cat.SPM_FOUL, "foul");
199 CatSTR.put(Cat.SPM_DIVE, "diving");
200 CatSTR.put(Cat.SPM_FRRY, "ferry");
201 CatSTR.put(Cat.SPM_ANCH, "anchorage");
202 CatSTR.put(Cat.MOR_DLPN, "dolphin");
203 CatSTR.put(Cat.MOR_DDPN, "deviation_dolphin");
204 CatSTR.put(Cat.MOR_BLRD, "bollard");
205 CatSTR.put(Cat.MOR_WALL, "wall");
206 CatSTR.put(Cat.MOR_POST, "post");
207 CatSTR.put(Cat.MOR_CHWR, "chain");
208 CatSTR.put(Cat.MOR_BUOY, "buoy");
209 CatSTR.put(Cat.SIS_PTCL, "control");
210 CatSTR.put(Cat.SIS_PTED, "entry");
211 CatSTR.put(Cat.SIS_IPT, "IPT");
212 CatSTR.put(Cat.SIS_BRTH, "berthing");
213 CatSTR.put(Cat.SIS_DOCK, "dock");
214 CatSTR.put(Cat.SIS_LOCK, "lock");
215 CatSTR.put(Cat.SIS_FBAR, "barrage");
216 CatSTR.put(Cat.SIS_BRDG, "bridge");
217 CatSTR.put(Cat.SIS_DRDG, "dredging");
218 CatSTR.put(Cat.SIS_TRFC, "traffic");
219 CatSTR.put(Cat.SIS_DNGR, "danger");
220 CatSTR.put(Cat.SIS_OBST, "obstruction");
221 CatSTR.put(Cat.SIS_CABL, "cable");
222 CatSTR.put(Cat.SIS_MILY, "military");
223 CatSTR.put(Cat.SIS_DSTR, "distress");
224 CatSTR.put(Cat.SIS_WTHR, "weather");
225 CatSTR.put(Cat.SIS_STRM, "storm");
226 CatSTR.put(Cat.SIS_ICE, "ice");
227 CatSTR.put(Cat.SIS_TIME, "time");
228 CatSTR.put(Cat.SIS_TIDE, "tide");
229 CatSTR.put(Cat.SIS_TSTM, "stream");
230 CatSTR.put(Cat.SIS_TGAG, "gauge");
231 CatSTR.put(Cat.SIS_TSCL, "scale");
232 CatSTR.put(Cat.SIS_DIVE, "diving");
233 CatSTR.put(Cat.SIS_LGAG, "level");
234 CatSTR.put(Cat.LMK_CHMY, "chimney");
235 CatSTR.put(Cat.LMK_CARN, "cairn");
236 CatSTR.put(Cat.LMK_DSHA, "dish_aerial");
237 CatSTR.put(Cat.LMK_FLGS, "flagstaff");
238 CatSTR.put(Cat.LMK_FLRS, "flare_stack");
239 CatSTR.put(Cat.LMK_MNMT, "monument");
240 CatSTR.put(Cat.LMK_RADM, "radio_mast");
241 CatSTR.put(Cat.LMK_TOWR, "tower");
242 CatSTR.put(Cat.LMK_WNDM, "wind_motor");
243 CatSTR.put(Cat.LMK_WTRT, "water_tower");
244 }
245
246 private Cat category = Cat.NONE;
247
248 public Cat getCategory() {
249 return category;
250 }
251
252 public void setCategory(Cat cat) {
253 category = cat;
254 }
255
256 public enum Shp {
257 UNKNOWN, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER,
258 BUOYANT, CAIRN, PILE, LATTICE, TOWER, STAKE, POLE, POST, PERCH, BUOY, BEACON
259 }
260
261 public static final EnumMap<Shp, String> ShpSTR = new EnumMap<Shp, String>(Shp.class);
262 static {
263 ShpSTR.put(Shp.PILLAR, "pillar");
264 ShpSTR.put(Shp.SPAR, "spar");
265 ShpSTR.put(Shp.CAN, "can");
266 ShpSTR.put(Shp.CONE, "conical");
267 ShpSTR.put(Shp.SPHERE, "spherical");
268 ShpSTR.put(Shp.BARREL, "barrel");
269 ShpSTR.put(Shp.FLOAT, "float");
270 ShpSTR.put(Shp.SUPER, "super-buoy");
271 ShpSTR.put(Shp.BUOYANT, "buoyant");
272 ShpSTR.put(Shp.CAIRN, "cairn");
273 ShpSTR.put(Shp.PILE, "pile");
274 ShpSTR.put(Shp.LATTICE, "lattice");
275 ShpSTR.put(Shp.TOWER, "tower");
276 ShpSTR.put(Shp.STAKE, "stake");
277 ShpSTR.put(Shp.PERCH, "perch");
278 }
279
280 private Shp shape = Shp.UNKNOWN;
281
282 public Shp getShape() {
283 return shape;
284 }
285
286 public void setShape(Shp shp) {
287 shape = shp;
288 }
289
290 public enum Col {
291 UNKNOWN, BLANK, WHITE, RED, ORANGE, AMBER, YELLOW, GREEN, BLUE, VIOLET, BLACK, GREY, BROWN, MAGENTA, PINK
292 }
293
294 public static final EnumMap<Col, Color> ColMAP = new EnumMap<Col, Color>(Col.class);
295 static {
296 ColMAP.put(Col.UNKNOWN, new Color(0xc0c0c0));
297 ColMAP.put(Col.WHITE, Color.WHITE);
298 ColMAP.put(Col.RED, Color.RED);
299 ColMAP.put(Col.ORANGE, Color.ORANGE);
300 ColMAP.put(Col.AMBER, new Color(0xfbf00f));
301 ColMAP.put(Col.YELLOW, Color.YELLOW);
302 ColMAP.put(Col.GREEN, Color.GREEN);
303 ColMAP.put(Col.BLUE, Color.BLUE);
304 ColMAP.put(Col.VIOLET, new Color(0x8f00ff));
305 ColMAP.put(Col.BLACK, Color.BLACK);
306 ColMAP.put(Col.GREY, Color.GRAY);
307 ColMAP.put(Col.BROWN, new Color(0xa45a58));
308 ColMAP.put(Col.MAGENTA, Color.MAGENTA);
309 ColMAP.put(Col.PINK, Color.PINK);
310 }
311
312 public static final EnumMap<Col, String> ColSTR = new EnumMap<Col, String>(Col.class);
313 static {
314 ColSTR.put(Col.WHITE, "white");
315 ColSTR.put(Col.RED, "red");
316 ColSTR.put(Col.ORANGE, "orange");
317 ColSTR.put(Col.AMBER, "amber");
318 ColSTR.put(Col.YELLOW, "yellow");
319 ColSTR.put(Col.GREEN, "green");
320 ColSTR.put(Col.BLUE, "blue");
321 ColSTR.put(Col.VIOLET, "violet");
322 ColSTR.put(Col.BLACK, "black");
323 ColSTR.put(Col.GREY, "grey");
324 ColSTR.put(Col.BROWN, "brown");
325 ColSTR.put(Col.MAGENTA, "magenta");
326 ColSTR.put(Col.PINK, "pink");
327 }
328
329 public Col getColour(Ent ent, int idx) {
330 if (ent == Ent.BODY)
331 return getObjColour(idx);
332 else
333 return getTopColour(idx);
334 }
335
336 public void setColour(Ent ent, Col col) {
337 if (ent == Ent.BODY)
338 setObjColour(col);
339 else
340 setTopColour(col);
341 }
342
343 public void setColour(Ent ent, int idx, Col col) {
344 if (ent == Ent.BODY)
345 setObjColour(idx, col);
346 else
347 setTopColour(idx, col);
348 }
349
350 public void addColour(Ent ent, int idx, Col col) {
351 if (ent == Ent.BODY)
352 addObjColour(idx, col);
353 else
354 addTopColour(idx, col);
355 }
356
357 public void subColour(Ent ent, int idx) {
358 if (ent == Ent.BODY)
359 subObjColour(idx);
360 else
361 subTopColour(idx);
362 }
363
364 private ArrayList<Col> bodyColour = new ArrayList<Col>();
365
366 public Col getObjColour(int i) {
367 if (i < bodyColour.size())
368 return bodyColour.get(i);
369 else
370 return Col.UNKNOWN;
371 }
372
373 public void setObjColour(Col col) {
374 bodyColour.clear();
375 bodyColour.add(col);
376 }
377
378 public void setObjColour(int i, Col col) {
379 if (bodyColour.size() > i)
380 bodyColour.set(i, col);
381 }
382
383 public void addObjColour(int i, Col col) {
384 if (bodyColour.size() >= i)
385 bodyColour.add(i, col);
386 }
387
388 public void addObjColour(Col col) {
389 bodyColour.add(col);
390 }
391
392 public void subObjColour(int i) {
393 if (bodyColour.size() > i)
394 bodyColour.remove(i);
395 }
396
397 private ArrayList<Col> topmarkColour = new ArrayList<Col>();
398
399 public Col getTopColour(int i) {
400 if (i < topmarkColour.size())
401 return topmarkColour.get(i);
402 else
403 return Col.UNKNOWN;
404 }
405
406 public void setTopColour(Col col) {
407 topmarkColour.clear();
408 topmarkColour.add(col);
409 }
410
411 public void setTopColour(int i, Col col) {
412 if (topmarkColour.size() > i)
413 topmarkColour.set(i, col);
414 }
415
416 public void addTopColour(int i, Col col) {
417 if (topmarkColour.size() >= i)
418 topmarkColour.add(i, col);
419 }
420
421 public void addTopColour(Col col) {
422 topmarkColour.add(col);
423 }
424
425 public void subTopColour(int i) {
426 if (topmarkColour.size() > i)
427 topmarkColour.remove(i);
428 }
429
430 public enum Chr {
431 UNKNOWN, FIXED, FLASH, LFLASH, QUICK, VQUICK, UQUICK, ISOPHASED, OCCULTING,
432 MORSE, ALTERNATING, IQUICK, IVQUICK, IUQUICK
433 }
434
435 public static final Map<EnumSet<Chr>, String> ChrMAP = new HashMap<EnumSet<Chr>, String>();
436 static {
437 ChrMAP.put(EnumSet.of(Chr.UNKNOWN), "");
438 ChrMAP.put(EnumSet.of(Chr.FIXED), "F");
439 ChrMAP.put(EnumSet.of(Chr.FLASH), "Fl");
440 ChrMAP.put(EnumSet.of(Chr.LFLASH), "LFl");
441 ChrMAP.put(EnumSet.of(Chr.QUICK), "Q");
442 ChrMAP.put(EnumSet.of(Chr.VQUICK), "VQ");
443 ChrMAP.put(EnumSet.of(Chr.UQUICK), "UQ");
444 ChrMAP.put(EnumSet.of(Chr.IQUICK), "IQ");
445 ChrMAP.put(EnumSet.of(Chr.IVQUICK), "IVQ");
446 ChrMAP.put(EnumSet.of(Chr.IUQUICK), "IUQ");
447 ChrMAP.put(EnumSet.of(Chr.ISOPHASED), "Iso");
448 ChrMAP.put(EnumSet.of(Chr.OCCULTING), "Oc");
449 ChrMAP.put(EnumSet.of(Chr.MORSE), "Mo");
450 ChrMAP.put(EnumSet.of(Chr.ALTERNATING), "Al");
451 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FIXED), "Al.F");
452 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FLASH), "Al.Fl");
453 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.FIXED, Chr.FLASH), "F.Al.Fl");
454 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.LFLASH), "Al.LFl");
455 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.ISOPHASED), "Al.Iso");
456 ChrMAP.put(EnumSet.of(Chr.ALTERNATING, Chr.OCCULTING), "Al.Oc");
457 ChrMAP.put(EnumSet.of(Chr.FIXED, Chr.FLASH), "FFl");
458 ChrMAP.put(EnumSet.of(Chr.FIXED, Chr.LFLASH), "FLFl");
459 ChrMAP.put(EnumSet.of(Chr.OCCULTING, Chr.FLASH), "OcFl");
460 ChrMAP.put(EnumSet.of(Chr.FLASH, Chr.LFLASH), "FlLFl");
461 ChrMAP.put(EnumSet.of(Chr.QUICK, Chr.LFLASH), "Q+LFl");
462 ChrMAP.put(EnumSet.of(Chr.VQUICK, Chr.LFLASH), "VQ+LFl");
463 ChrMAP.put(EnumSet.of(Chr.UQUICK, Chr.LFLASH), "UQ+LFl");
464 }
465
466 public enum Vis {
467 UNKNOWN, HIGH, LOW, FAINT, INTEN, UNINTEN, REST, OBS, PARTOBS
468 }
469
470 public static final EnumMap<Vis, String> VisSTR = new EnumMap<Vis, String>(Vis.class);
471 static {
472 VisSTR.put(Vis.UNKNOWN, "");
473 VisSTR.put(Vis.HIGH, "high");
474 VisSTR.put(Vis.LOW, "low");
475 VisSTR.put(Vis.FAINT, "faint");
476 VisSTR.put(Vis.INTEN, "intensified");
477 VisSTR.put(Vis.UNINTEN, "unintensified");
478 VisSTR.put(Vis.REST, "restricted");
479 VisSTR.put(Vis.OBS, "obscured");
480 VisSTR.put(Vis.PARTOBS, "part_obscured");
481 }
482
483 public enum Lit {
484 UNKNOWN, VERT, HORIZ, DIR, UPPER, LOWER, LEAD, REAR, FRONT,
485 AERO, AIROBS, FOGDET, FLOOD, STRIP, SUBS, SPOT, MOIRE, EMERG, BEAR
486 }
487
488 public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>(Lit.class);
489 static {
490 LitSTR.put(Lit.UNKNOWN, "");
491 LitSTR.put(Lit.VERT, "vertical");
492 LitSTR.put(Lit.HORIZ, "horizontal");
493 LitSTR.put(Lit.DIR, "directional");
494 LitSTR.put(Lit.UPPER, "upper");
495 LitSTR.put(Lit.LOWER, "lower");
496 LitSTR.put(Lit.LEAD, "leading");
497 LitSTR.put(Lit.REAR, "rear");
498 LitSTR.put(Lit.FRONT, "front");
499 LitSTR.put(Lit.AERO, "aero");
500 LitSTR.put(Lit.AIROBS, "air_obstruction");
501 LitSTR.put(Lit.FOGDET, "fog_detector");
502 LitSTR.put(Lit.FLOOD, "floodlight");
503 LitSTR.put(Lit.STRIP, "striplight");
504 LitSTR.put(Lit.SUBS, "subsidairy");
505 LitSTR.put(Lit.SPOT, "spotlight");
506 LitSTR.put(Lit.MOIRE, "moire");
507 LitSTR.put(Lit.EMERG, "emergency");
508 LitSTR.put(Lit.BEAR, "bearing");
509 }
510
511 public enum Exh { UNKNOWN, H24, DAY, NIGHT, FOG }
512
513 public static final EnumMap<Exh, String> ExhSTR = new EnumMap<Exh, String>(Exh.class);
514 static {
515 ExhSTR.put(Exh.UNKNOWN, "");
516 ExhSTR.put(Exh.H24, "24h");
517 ExhSTR.put(Exh.DAY, "day");
518 ExhSTR.put(Exh.NIGHT, "night");
519 ExhSTR.put(Exh.FOG, "fog");
520 }
521
522 public enum Att { COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT, MLT }
523
524 public Object[] sector = {Col.UNKNOWN, "", "", "", "", Lit.UNKNOWN, "", "", "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, "", "" };
525
526 private ArrayList<Object[]> sectors = new ArrayList<Object[]>();
527
528 public int getSectorCount() {
529 return sectors.size();
530 }
531
532 public Object getLightAtt(Att att, int i) {
533 return getLightAtt(att.ordinal(), i);
534 }
535 public Object getLightAtt(int att, int i) {
536 if (i < sectors.size())
537 return sectors.get(i)[att];
538 else
539 return null;
540 }
541
542 public void setLightAtt(Att att, int i, Object obj) {
543 setLightAtt(att.ordinal(), i, obj);
544 }
545
546 public void setLightAtt(int att, int i, Object obj) {
547 if (sectors.size() == i)
548 addLight(i);
549 if (sectors.size() > i)
550 sectors.get(i)[att] = obj;
551 }
552
553 public void addLight(int i) {
554 if (sectors.size() >= i) {
555 if (sectors.size() == 0)
556 sectors.add(sector.clone());
557 else
558 sectors.add(i, sectors.get(0).clone());
559 }
560 }
561
562 public void addLight() {
563 if (sectors.size() == 0)
564 sectors.add(sector.clone());
565 else
566 sectors.add(sectors.get(0).clone());
567 }
568
569 public void delLight(int i) {
570 if (sectors.size() > i)
571 sectors.remove(i);
572 }
573
574 public enum Pat {
575 NONE, HORIZ, VERT, DIAG, SQUARE, BORDER
576 }
577
578 public static final EnumMap<Pat, String> PatSTR = new EnumMap<Pat, String>(Pat.class);
579 static {
580 PatSTR.put(Pat.HORIZ, "horizontal");
581 PatSTR.put(Pat.VERT, "vertical");
582 PatSTR.put(Pat.DIAG, "diagonal");
583 PatSTR.put(Pat.SQUARE, "squared");
584 PatSTR.put(Pat.BORDER, "border");
585 }
586
587 public Pat getPattern(Ent ent) {
588 if (ent == Ent.BODY)
589 return getObjPattern();
590 else
591 return getTopPattern();
592 }
593
594 public void setPattern(Ent ent, Pat pat) {
595 if (ent == Ent.BODY)
596 setObjPattern(pat);
597 else
598 setTopPattern(pat);
599 }
600
601 private Pat bodyPattern = Pat.NONE;
602
603 public Pat getObjPattern() {
604 return bodyPattern;
605 }
606
607 public void setObjPattern(Pat pat) {
608 bodyPattern = pat;
609 }
610
611 private Pat topPattern = Pat.NONE;
612
613 public Pat getTopPattern() {
614 return topPattern;
615 }
616
617 public void setTopPattern(Pat pat) {
618 topPattern = pat;
619 }
620
621 public enum Top {
622 NONE, CAN, CONE, SPHERE, X_SHAPE, NORTH, SOUTH, EAST, WEST, SPHERES2, BOARD, DIAMOND, CIRCLE, TRIANGLE, TRIANGLE_INV, SQUARE
623 }
624
625 public static final EnumMap<Top, String> TopSTR = new EnumMap<Top, String>(Top.class);
626 static {
627 TopSTR.put(Top.CAN, "cylinder");
628 TopSTR.put(Top.CONE, "cone, point up");
629 TopSTR.put(Top.SPHERE, "sphere");
630 TopSTR.put(Top.X_SHAPE, "x-shape");
631 TopSTR.put(Top.NORTH, "2 cones up");
632 TopSTR.put(Top.SOUTH, "2 cones down");
633 TopSTR.put(Top.EAST, "2 cones base together");
634 TopSTR.put(Top.WEST, "2 cones point together");
635 TopSTR.put(Top.SPHERES2, "2 spheres");
636 TopSTR.put(Top.BOARD, "board");
637 TopSTR.put(Top.DIAMOND, "diamond");
638 TopSTR.put(Top.CIRCLE, "circle");
639 TopSTR.put(Top.TRIANGLE, "triangle, point up");
640 TopSTR.put(Top.TRIANGLE_INV, "triangle, point down");
641 TopSTR.put(Top.SQUARE, "square");
642 }
643
644 private Top topShape = Top.NONE;
645
646 public Top getTopmark() {
647 return topShape;
648 }
649
650 public void setTopmark(Top top) {
651 topShape = top;
652 }
653
654 public enum Rtb {
655 NONE, REFLECTOR, RACON, RAMARK, LEADING
656 }
657
658 public static final EnumMap<Rtb, String> RtbSTR = new EnumMap<Rtb, String>(Rtb.class);
659 static {
660 RtbSTR.put(Rtb.RACON, "racon");
661 RtbSTR.put(Rtb.RAMARK, "ramark");
662 RtbSTR.put(Rtb.LEADING, "leading");
663 }
664
665 private Rtb RaType = Rtb.NONE;
666
667 public Rtb getRadar() {
668 return RaType;
669 }
670
671 public void setRadar(Rtb type) {
672 RaType = type;
673 }
674
675 private String raconGroup = "";
676
677 public String getRaconGroup() {
678 return raconGroup;
679 }
680
681 public void setRaconGroup(String grp) {
682 raconGroup = grp;
683 }
684
685 private String raconSequence = "";
686
687 public String getRaconSequence() {
688 return raconSequence;
689 }
690
691 public void setRaconSequence(String seq) {
692 raconSequence = seq;
693 }
694
695 private String raconPeriod = "";
696
697 public String getRaconPeriod() {
698 return raconPeriod;
699 }
700
701 public void setRaconPeriod(String per) {
702 raconPeriod = validDecimal(per);
703 }
704
705 private String raconRange = "";
706
707 public String getRaconRange() {
708 return raconRange;
709 }
710
711 public void setRaconRange(String rng) {
712 raconRange = validDecimal(rng);
713 }
714
715 private String raconSector1 = "";
716
717 public String getRaconSector1() {
718 return raconSector1;
719 }
720
721 public void setRaconSector1(String sec) {
722 raconSector1 = validDecimal(sec);
723 }
724
725 private String raconSector2 = "";
726
727 public String getRaconSector2() {
728 return raconSector2;
729 }
730
731 public void setRaconSector2(String sec) {
732 raconSector2 = validDecimal(sec);
733 }
734
735 public enum Fog {
736 NONE, UNKNOWN, HORN, SIREN, DIA, BELL, WHIS, GONG, EXPLOS
737 }
738
739 public static final EnumMap<Fog, String> FogSTR = new EnumMap<Fog, String>(Fog.class);
740 static {
741 FogSTR.put(Fog.UNKNOWN, "yes");
742 FogSTR.put(Fog.HORN, "horn");
743 FogSTR.put(Fog.SIREN, "siren");
744 FogSTR.put(Fog.DIA, "diaphone");
745 FogSTR.put(Fog.BELL, "bell");
746 FogSTR.put(Fog.WHIS, "whistle");
747 FogSTR.put(Fog.GONG, "gong");
748 FogSTR.put(Fog.EXPLOS, "explosion");
749 }
750
751 private Fog fogSound = Fog.NONE;
752
753 public Fog getFogSound() {
754 return fogSound;
755 }
756
757 public void setFogSound(Fog sound) {
758 fogSound = sound;
759 }
760
761 private String fogGroup = "";
762
763 public String getFogGroup() {
764 return fogGroup;
765 }
766
767 public void setFogGroup(String grp) {
768 fogGroup = grp;
769 }
770
771 private String fogSequence = "";
772
773 public String getFogSequence() {
774 return fogSequence;
775 }
776
777 public void setFogSequence(String seq) {
778 fogSequence = seq;
779 }
780
781 private String fogRange = "";
782
783 public String getFogRange() {
784 return fogRange;
785 }
786
787 public void setFogRange(String rng) {
788 fogRange = validDecimal(rng);
789 }
790
791 private String fogPeriod = "";
792
793 public String getFogPeriod() {
794 return fogPeriod;
795 }
796
797 public void setFogPeriod(String per) {
798 fogPeriod = validDecimal(per);
799 }
800
801 public enum Sts {
802 UNKNOWN, PERM, OCC, REC, NIU, INT, RESV, TEMP, PRIV, MAND, DEST, EXT, ILLUM, HIST, PUB, SYNC, WATCH, UNWAT, DOUBT
803 }
804
805 public static final EnumMap<Sts, String> StsSTR = new EnumMap<Sts, String>(Sts.class);
806 static {
807 StsSTR.put(Sts.PERM, "permanent");
808 StsSTR.put(Sts.OCC, "occasional");
809 StsSTR.put(Sts.REC, "recommended");
810 StsSTR.put(Sts.NIU, "not_in_use");
811 StsSTR.put(Sts.INT, "intermittent");
812 StsSTR.put(Sts.RESV, "reserved");
813 StsSTR.put(Sts.TEMP, "tempory");
814 StsSTR.put(Sts.PRIV, "private");
815 StsSTR.put(Sts.MAND, "mandatory");
816 StsSTR.put(Sts.DEST, "destroyed");
817 StsSTR.put(Sts.EXT, "extinguished");
818 StsSTR.put(Sts.ILLUM, "illuminated");
819 StsSTR.put(Sts.HIST, "historic");
820 StsSTR.put(Sts.PUB, "public");
821 StsSTR.put(Sts.SYNC, "synchronized");
822 StsSTR.put(Sts.WATCH, "watched");
823 StsSTR.put(Sts.UNWAT, "unwatched");
824 StsSTR.put(Sts.DOUBT, "existence_doubtful");
825 }
826
827 private Sts status = Sts.UNKNOWN;
828
829 public Sts getStatus() {
830 return status;
831 }
832
833 public void setStatus(Sts sts) {
834 status = sts;
835 }
836
837 public enum Cns {
838 UNKNOWN, BRICK, CONC, BOULD, HSURF, USURF, WOOD, METAL, GRP, PAINT
839 }
840
841 public static final EnumMap<Cns, String> CnsSTR = new EnumMap<Cns, String>(Cns.class);
842 static {
843 CnsSTR.put(Cns.BRICK, "masonry");
844 CnsSTR.put(Cns.CONC, "concreted");
845 CnsSTR.put(Cns.BOULD, "boulders");
846 CnsSTR.put(Cns.HSURF, "hard_surfaced");
847 CnsSTR.put(Cns.USURF, "unsurfaced");
848 CnsSTR.put(Cns.WOOD, "wooden");
849 CnsSTR.put(Cns.METAL, "metal");
850 CnsSTR.put(Cns.GRP, "grp");
851 CnsSTR.put(Cns.PAINT, "painted");
852 }
853
854 private Cns construction = Cns.UNKNOWN;
855
856 public Cns getConstr() {
857 return construction;
858 }
859
860 public void setConstr(Cns cns) {
861 construction = cns;
862 }
863
864 public enum Con {
865 UNKNOWN, CONSP, NCONS, REFL
866 }
867
868 public static final EnumMap<Con, String> ConSTR = new EnumMap<Con, String>(Con.class);
869 static {
870 ConSTR.put(Con.CONSP, "conspicuous");
871 ConSTR.put(Con.NCONS, "not_conspicuous");
872 ConSTR.put(Con.REFL, "reflector");
873 }
874
875 private Con conspicuity = Con.UNKNOWN;
876
877 public Con getConsp() {
878 return conspicuity;
879 }
880
881 public void setConsp(Con con) {
882 conspicuity = con;
883 }
884
885 private Con reflectivity = Con.UNKNOWN;
886
887 public Con getRefl() {
888 return reflectivity;
889 }
890
891 public void setRefl(Con con) {
892 reflectivity = con;
893 }
894
895 public String information = "";
896
897 public String getInfo() {
898 return information;
899 }
900
901 public void setInfo(String str) {
902 information = str.trim();
903 }
904
905 public String source = "";
906
907 public String getSource() {
908 return source;
909 }
910
911 public void setSource(String str) {
912 source = str.trim();
913 }
914
915 public String elevation = "";
916
917 public String getElevation() {
918 return elevation;
919 }
920
921 public void setElevation(String str) {
922 elevation = validDecimal(str);
923 }
924
925 public String height = "";
926
927 public String getHeight() {
928 return height;
929 }
930
931 public void setHeight(String str) {
932 height = validDecimal(str);
933 }
934
935 public String ref = "";
936
937 public String getRef() {
938 return ref;
939 }
940
941 public void setRef(String str) {
942 ref = str;
943 }
944
945 public String lightRef = "";
946
947 public String getLightRef() {
948 return lightRef;
949 }
950
951 public void setLightRef(String str) {
952 lightRef = str;
953 }
954
955 public String fixme = "";
956
957 public String getFixme() {
958 return fixme;
959 }
960
961 public void setFixme(String str) {
962 fixme = str;
963 }
964
965 public boolean testValid() {
966 boolean tmp = false;
967 dlg.manager.showVisualMessage("");
968 switch (getObject()) {
969 case BCNCAR:
970 case BCNLAT:
971 case BOYCAR:
972 case BOYLAT:
973 if ((getCategory() != Cat.NONE) && (getShape() != Shp.UNKNOWN))
974 tmp = true;
975 break;
976 case BCNISD:
977 case BCNSAW:
978 case BCNSPP:
979 case BOYISD:
980 case BOYSAW:
981 case BOYSPP:
982 if (getShape() != Shp.UNKNOWN)
983 tmp = true;
984 break;
985 case FLTCAR:
986 case FLTISD:
987 case FLTLAT:
988 case FLTSAW:
989 case FLTSPP:
990 if (getObjColour(0) != Col.UNKNOWN)
991 tmp = true;
992 break;
993 case LITMAJ:
994 case LITMIN:
995 case LITFLT:
996 case LITVES:
997 case LITHSE:
998 case MORFAC:
999 case SISTAW:
1000 case SISTAT:
1001 tmp = true;
1002 break;
1003 case LNDMRK:
1004 if (getCategory() != Cat.NONE)
1005 tmp = true;
1006 break;
1007 }
1008 if (tmp) {
1009 dlg.panelMain.moreButton.setVisible(true);
1010 dlg.panelMain.saveButton.setEnabled(true);
1011 Ent ent = EntMAP.get(getObject());
1012 dlg.panelMain.topButton.setEnabled((ent == Ent.BUOY) || (ent == Ent.BEACON) || (ent == Ent.FLOAT));
1013 dlg.panelMain.fogButton.setEnabled(true);
1014 dlg.panelMain.radButton.setEnabled(true);
1015 dlg.panelMain.litButton.setEnabled(true);
1016 return true;
1017 } else {
1018 dlg.panelMain.moreButton.setVisible(false);
1019 dlg.panelMain.moreButton.setText("v v v");
1020 dlg.panelMain.topButton.setEnabled(false);
1021 dlg.panelMain.fogButton.setEnabled(false);
1022 dlg.panelMain.radButton.setEnabled(false);
1023 dlg.panelMain.litButton.setEnabled(false);
1024 dlg.manager.showVisualMessage("Seamark not recognised");
1025 return false;
1026 }
1027 }
1028
1029 public void clearSign() {
1030 setObject(Obj.UNKNOWN);
1031 setCategory(Cat.NONE);
1032 setShape(Shp.UNKNOWN);
1033 setColour(Ent.BODY, Col.UNKNOWN);
1034 setPattern(Ent.BODY, Pat.NONE);
1035 setTopmark(Top.NONE);
1036 setColour(Ent.TOPMARK, Col.UNKNOWN);
1037 setPattern(Ent.TOPMARK, Pat.NONE);
1038 dlg.panelMain.moreButton.setVisible(false);
1039 dlg.panelMain.saveButton.setEnabled(false);
1040 dlg.panelMain.topButton.setEnabled(false);
1041 dlg.panelMain.fogButton.setEnabled(false);
1042 dlg.panelMain.radButton.setEnabled(false);
1043 dlg.panelMain.litButton.setEnabled(false);
1044 dlg.panelMain.panelMore.syncPanel();
1045 dlg.panelMain.panelMore.setVisible(false);
1046 paintSign();
1047 }
1048
1049 public String validDecimal(String str) {
1050 str = str.trim().replace(',', '.');
1051 if ((!str.isEmpty()) && (!str.matches("^[+-]??\\d+(\\.\\d+)??$"))) {
1052 dlg.manager.showVisualMessage("Not a valid decimal string");
1053 return "";
1054 } else {
1055 dlg.manager.showVisualMessage("");
1056 return str;
1057 }
1058 }
1059
1060 private boolean paintlock = false;
1061
1062 public void parseMark(Node node) {
1063 paintlock = true;
1064 dlg.manager.showVisualMessage("");
1065 String str = Main.pref.get("smedplugin.IALA");
1066 if (str.equals("C"))
1067 setRegion(Reg.C);
1068 else if (str.equals("B"))
1069 setRegion(Reg.B);
1070 else
1071 setRegion(Reg.A);
1072
1073 Map<String, String> keys = node.getKeys();
1074
1075 str = "";
1076 if (keys.containsKey("seamark:type"))
1077 str = keys.get("seamark:type");
1078
1079 setObject(Obj.UNKNOWN);
1080 for (Obj obj : ObjSTR.keySet()) {
1081 if (ObjSTR.get(obj).equals(str)) {
1082 setObject(obj);
1083 }
1084 }
1085
1086 if (str.equals("")) {
1087 dlg.manager.showVisualMessage("No seamark");
1088 }
1089 if (getObject() == Obj.UNKNOWN) {
1090 dlg.manager.showVisualMessage("Seamark not recognised");
1091 }
1092
1093 setName("");
1094 for (Obj obj : ObjSTR.keySet()) {
1095 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":name")) {
1096 str = keys.get("seamark:" + ObjSTR.get(obj) + ":name");
1097 setName(str);
1098 }
1099 }
1100 if (keys.containsKey("seamark:name")) {
1101 str = keys.get("seamark:name");
1102 setName(str);
1103 }
1104 if (getName().isEmpty()) {
1105 if (keys.containsKey("name")) {
1106 str = keys.get("name");
1107 setName(str);
1108 }
1109 }
1110
1111 for (Obj obj : ObjSTR.keySet()) {
1112 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":category")) {
1113 str = keys.get("seamark:" + ObjSTR.get(obj) + ":category");
1114 setCategory(Cat.NONE);
1115 for (Cat cat : CatSTR.keySet()) {
1116 if (CatSTR.get(cat).equals(str)) {
1117 setCategory(cat);
1118 }
1119 }
1120 }
1121 }
1122
1123 for (Obj obj : ObjSTR.keySet()) {
1124 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":shape")) {
1125 str = keys.get("seamark:" + ObjSTR.get(obj) + ":shape");
1126 setShape(Shp.UNKNOWN);
1127 for (Shp shp : ShpSTR.keySet()) {
1128 if (ShpSTR.get(shp).equals(str)) {
1129 setShape(shp);
1130 }
1131 }
1132 }
1133 }
1134 if (getShape() == Shp.UNKNOWN) {
1135 if (EntMAP.get(getObject()) == Ent.BUOY)
1136 setShape(Shp.BUOY);
1137 if (EntMAP.get(getObject()) == Ent.BEACON)
1138 setShape(Shp.BEACON);
1139 if (EntMAP.get(getObject()) == Ent.FLOAT)
1140 if (getObject() == Obj.LITVES)
1141 setShape(Shp.SUPER);
1142 else
1143 setShape(Shp.FLOAT);
1144 }
1145
1146 for (Obj obj : ObjSTR.keySet()) {
1147 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour")) {
1148 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour");
1149 bodyColour.clear();
1150 for (String item : str.split(";")) {
1151 for (Col col : ColSTR.keySet()) {
1152 if (ColSTR.get(col).equals(item)) {
1153 bodyColour.add(col);
1154 }
1155 }
1156 }
1157 }
1158 }
1159
1160 for (Obj obj : ObjSTR.keySet()) {
1161 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour_pattern")) {
1162 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour_pattern");
1163 setObjPattern(Pat.NONE);
1164 for (Pat pat : PatSTR.keySet()) {
1165 if (PatSTR.get(pat).equals(str)) {
1166 setObjPattern(pat);
1167 }
1168 }
1169 }
1170
1171 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":height")) {
1172 setHeight(keys.get("seamark:" + ObjSTR.get(obj) + ":height"));
1173 }
1174 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":elevation")) {
1175 setElevation(keys.get("seamark:" + ObjSTR.get(obj) + ":elevation"));
1176 }
1177 }
1178
1179 if ((getObject() == Obj.LNDMRK) && (getCategory() == Cat.NONE)) {
1180 setObject(Obj.LITHSE);
1181 }
1182
1183 if (getObject() == Obj.LITFLT) {
1184 switch (getObjColour(0)) {
1185 case RED:
1186 if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.UNKNOWN)) {
1187 setObject(Obj.FLTSAW);
1188 setCategory(Cat.NONE);
1189 } else if (getObjColour(1) == Col.UNKNOWN) {
1190 setObject(Obj.FLTLAT);
1191 if (getRegion() == Reg.B) {
1192 setCategory(Cat.LAM_STBD);
1193 } else {
1194 setCategory(Cat.LAM_PORT);
1195 }
1196 } else if ((getObjColour(1) == Col.GREEN) && (getObjColour(2) == Col.RED)) {
1197 setObject(Obj.FLTLAT);
1198 if (getRegion() == Reg.B) {
1199 setCategory(Cat.LAM_PSTBD);
1200 } else {
1201 setCategory(Cat.LAM_PPORT);
1202 }
1203 } else if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.RED)) {
1204 setObject(Obj.FLTLAT);
1205 setCategory(Cat.LAM_PORT);
1206 } else {
1207 setObject(Obj.FLTSPP);
1208 setCategory(Cat.NONE);
1209 }
1210 break;
1211 case GREEN:
1212 if (getObjColour(1) == Col.UNKNOWN) {
1213 setObject(Obj.FLTLAT);
1214 if (getRegion() == Reg.B) {
1215 setCategory(Cat.LAM_PORT);
1216 } else {
1217 setCategory(Cat.LAM_STBD);
1218 }
1219 } else if ((getObjColour(1) == Col.RED) && (getObjColour(2) == Col.GREEN)) {
1220 setObject(Obj.FLTLAT);
1221 if (getRegion() == Reg.B) {
1222 setCategory(Cat.LAM_PPORT);
1223 } else {
1224 setCategory(Cat.LAM_PSTBD);
1225 }
1226 } else if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.GREEN)) {
1227 setObject(Obj.FLTLAT);
1228 setCategory(Cat.LAM_STBD);
1229 } else {
1230 setObject(Obj.FLTSPP);
1231 setCategory(Cat.NONE);
1232 }
1233 break;
1234 case YELLOW:
1235 if (getObjColour(1) == Col.BLACK) {
1236 setObject(Obj.FLTCAR);
1237 if (getObjColour(2) == Col.YELLOW) {
1238 setCategory(Cat.CAM_WEST);
1239 } else {
1240 setCategory(Cat.CAM_SOUTH);
1241 }
1242 } else {
1243 setObject(Obj.FLTSPP);
1244 setCategory(Cat.NONE);
1245 }
1246 break;
1247 case BLACK:
1248 if (getObjColour(1) == Col.RED) {
1249 setObject(Obj.FLTISD);
1250 setCategory(Cat.NONE);
1251 } else if (getObjColour(1) == Col.YELLOW) {
1252 setObject(Obj.FLTCAR);
1253 if (getObjColour(2) == Col.BLACK) {
1254 setCategory(Cat.CAM_EAST);
1255 } else {
1256 setCategory(Cat.CAM_NORTH);
1257 }
1258 } else {
1259 setObject(Obj.FLTSPP);
1260 setCategory(Cat.NONE);
1261 }
1262 break;
1263 default:
1264 setCategory(Cat.NONE);
1265 }
1266 }
1267
1268 for (Obj obj : ObjSTR.keySet()) {
1269 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":system")) {
1270 str = keys.get("seamark:" + ObjSTR.get(obj) + ":system");
1271 if (str.equals("iala-a"))
1272 setRegion(Reg.A);
1273 else if (str.equals("iala-b"))
1274 setRegion(Reg.B);
1275 else
1276 setRegion(Reg.C);
1277 } else if (GrpMAP.get(object) == Grp.LAT) {
1278 switch (getCategory()) {
1279 case LAM_PORT:
1280 if (getObjColour(0) == Col.RED) {
1281 if (getObjColour(1) == Col.WHITE)
1282 setRegion(Reg.C);
1283 else
1284 setRegion(Reg.A);
1285 }
1286 if (getObjColour(0) == Col.GREEN)
1287 setRegion(Reg.B);
1288 break;
1289 case LAM_PPORT:
1290 if (getObjColour(0) == Col.RED) {
1291 if (getObjColour(3) == Col.GREEN)
1292 setRegion(Reg.C);
1293 else
1294 setRegion(Reg.A);
1295 }
1296 if (getObjColour(0) == Col.GREEN)
1297 setRegion(Reg.B);
1298 break;
1299 case LAM_STBD:
1300 if (getObjColour(0) == Col.GREEN) {
1301 if (getObjColour(1) == Col.WHITE)
1302 setRegion(Reg.C);
1303 else
1304 setRegion(Reg.A);
1305 }
1306 if (getObjColour(0) == Col.RED)
1307 setRegion(Reg.B);
1308 break;
1309 case LAM_PSTBD:
1310 if (getObjColour(0) == Col.GREEN)
1311 setRegion(Reg.A);
1312 if (getObjColour(0) == Col.RED) {
1313 if (getObjColour(3) == Col.GREEN)
1314 setRegion(Reg.C);
1315 else
1316 setRegion(Reg.B);
1317 }
1318 break;
1319 }
1320 }
1321 }
1322
1323 if (keys.containsKey("seamark:topmark:shape")) {
1324 str = keys.get("seamark:topmark:shape");
1325 setTopmark(Top.NONE);
1326 for (Top top : TopSTR.keySet()) {
1327 if (TopSTR.get(top).equals(str)) {
1328 setTopmark(top);
1329 }
1330 }
1331 }
1332 if (keys.containsKey("seamark:topmark:colour")) {
1333 str = keys.get("seamark:topmark:colour");
1334 setTopColour(Col.UNKNOWN);
1335 for (Col col : ColSTR.keySet()) {
1336 if (ColSTR.get(col).equals(str)) {
1337 setTopColour(col);
1338 }
1339 }
1340 }
1341 if (keys.containsKey("seamark:topmark:colour_pattern")) {
1342 str = keys.get("seamark:topmark:colour_pattern");
1343 setTopPattern(Pat.NONE);
1344 for (Pat pat : PatSTR.keySet()) {
1345 if (PatSTR.get(pat).equals(str)) {
1346 setTopPattern(pat);
1347 }
1348 }
1349 }
1350
1351 sectors.clear();
1352 sectors.add(sector.clone());
1353 for (int i = 0; i < 30; i++) {
1354 String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
1355 if (keys.containsKey("seamark:light" + secStr + ":colour")) {
1356 str = keys.get("seamark:light" + secStr + ":colour");
1357 for (Col col : ColSTR.keySet())
1358 if (ColSTR.get(col).equals(str))
1359 setLightAtt(Att.COL, i, col);
1360 }
1361 if (keys.containsKey("seamark:light" + secStr + ":character"))
1362 setLightAtt(Att.CHR, i, keys.get("seamark:light" + secStr + ":character"));
1363 if (keys.containsKey("seamark:light" + secStr + ":group"))
1364 setLightAtt(Att.GRP, i, keys.get("seamark:light" + secStr + ":group"));
1365 if (keys.containsKey("seamark:light" + secStr + ":sequence"))
1366 setLightAtt(Att.SEQ, i, keys.get("seamark:light" + secStr + ":sequence"));
1367 if (keys.containsKey("seamark:light" + secStr + ":period"))
1368 setLightAtt(Att.PER, i, keys.get("seamark:light" + secStr + ":period"));
1369 if (keys.containsKey("seamark:light" + secStr + ":category")) {
1370 str = keys.get("seamark:light" + secStr + ":category");
1371 for (Lit lit : LitSTR.keySet())
1372 if (LitSTR.get(lit).equals(str))
1373 setLightAtt(Att.LIT, i, lit);
1374 }
1375 if (keys.containsKey("seamark:light" + secStr + ":sector_start"))
1376 setLightAtt(Att.BEG, i, keys.get("seamark:light" + secStr + ":sector_start"));
1377 if (keys.containsKey("seamark:light" + secStr + ":sector_end"))
1378 setLightAtt(Att.END, i, keys.get("seamark:light" + secStr + ":sector_end"));
1379 if (keys.containsKey("seamark:light" + secStr + ":radius"))
1380 setLightAtt(Att.RAD, i, keys.get("seamark:light" + secStr + ":radius"));
1381 if (keys.containsKey("seamark:light" + secStr + ":height"))
1382 setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":height"));
1383 if (keys.containsKey("seamark:light" + secStr + ":range"))
1384 setLightAtt(Att.RNG, i, keys.get("seamark:light" + secStr + ":range"));
1385 if (keys.containsKey("seamark:light" + secStr + ":visibility")) {
1386 str = keys.get("seamark:light" + secStr + ":visibility");
1387 for (Vis vis : VisSTR.keySet())
1388 if (VisSTR.get(vis).equals(str))
1389 setLightAtt(Att.VIS, i, vis);
1390 }
1391 if (keys.containsKey("seamark:light" + secStr + ":exhibition")) {
1392 str = keys.get("seamark:light" + secStr + ":exhibition");
1393 for (Exh exh : ExhSTR.keySet())
1394 if (ExhSTR.get(exh).equals(str))
1395 setLightAtt(Att.EXH, i, exh);
1396 }
1397 if (keys.containsKey("seamark:light" + secStr + ":orientation"))
1398 setLightAtt(Att.ORT, i, keys.get("seamark:light" + secStr + ":orientation"));
1399 if (keys.containsKey("seamark:light" + secStr + ":multiple"))
1400 setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":multiple"));
1401 if (sectors.size() == i)
1402 break;
1403 }
1404
1405 if (keys.containsKey("seamark:fog_signal")) {
1406 setFogSound(Fog.UNKNOWN);
1407 }
1408 if (keys.containsKey("seamark:fog_signal:category")) {
1409 str = keys.get("seamark:fog_signal:category");
1410 setFogSound(Fog.NONE);
1411 for (Fog fog : FogSTR.keySet()) {
1412 if (FogSTR.get(fog).equals(str)) {
1413 setFogSound(fog);
1414 }
1415 }
1416 }
1417 if (keys.containsKey("seamark:fog_signal:group")) {
1418 setFogGroup(keys.get("seamark:fog_signal:group"));
1419 }
1420 if (keys.containsKey("seamark:fog_signal:period")) {
1421 setFogPeriod(keys.get("seamark:fog_signal:period"));
1422 }
1423 if (keys.containsKey("seamark:fog_signal:sequence")) {
1424 setFogSequence(keys.get("seamark:fog_signal:sequence"));
1425 }
1426 if (keys.containsKey("seamark:fog_signal:range")) {
1427 setFogRange(keys.get("seamark:fog_signal:range"));
1428 }
1429
1430 if (keys.containsKey("seamark:radar_reflector")) {
1431 setRadar(Rtb.REFLECTOR);
1432 }
1433 if (keys.containsKey("seamark:radar_transponder:category")) {
1434 str = keys.get("seamark:radar_transponder:category");
1435 setRadar(Rtb.NONE);
1436 for (Rtb rtb : RtbSTR.keySet()) {
1437 if (RtbSTR.get(rtb).equals(str)) {
1438 setRadar(rtb);
1439 }
1440 }
1441 }
1442 if (keys.containsKey("seamark:radar_transponder:group")) {
1443 setRaconGroup(keys.get("seamark:radar_transponder:group"));
1444 }
1445 if (keys.containsKey("seamark:radar_transponder:period")) {
1446 setRaconPeriod(keys.get("seamark:radar_transponder:period"));
1447 }
1448 if (keys.containsKey("seamark:radar_transponder:sequence")) {
1449 setRaconSequence(keys.get("seamark:radar_transponder:sequence"));
1450 }
1451 if (keys.containsKey("seamark:radar_transponder:range")) {
1452 setRaconRange(keys.get("seamark:radar_transponder:range"));
1453 }
1454 if (keys.containsKey("seamark:radar_transponder:sector_start")) {
1455 setRaconSector1(keys.get("seamark:radar_transponder:sector_start"));
1456 }
1457 if (keys.containsKey("seamark:radar_transponder:sector_end")) {
1458 setRaconSector2(keys.get("seamark:radar_transponder:sector_end"));
1459 }
1460
1461 if (keys.containsKey("seamark:information")) {
1462 setInfo(keys.get("seamark:information"));
1463 }
1464 if (keys.containsKey("seamark:source")) {
1465 setSource(keys.get("seamark:source"));
1466 }
1467 if (keys.containsKey("seamark:height")) {
1468 setHeight(keys.get("seamark:height"));
1469 }
1470 if (keys.containsKey("seamark:elevation")) {
1471 setElevation(keys.get("seamark:elevation"));
1472 }
1473 if (keys.containsKey("seamark:status")) {
1474 str = keys.get("seamark:status");
1475 setStatus(Sts.UNKNOWN);
1476 for (Sts sts : StsSTR.keySet()) {
1477 if (StsSTR.get(sts).equals(str)) {
1478 setStatus(sts);
1479 }
1480 }
1481 }
1482 if (keys.containsKey("seamark:construction")) {
1483 str = keys.get("seamark:construction");
1484 setConstr(Cns.UNKNOWN);
1485 for (Cns cns : CnsSTR.keySet()) {
1486 if (CnsSTR.get(cns).equals(str)) {
1487 setConstr(cns);
1488 }
1489 }
1490 }
1491 if (keys.containsKey("seamark:conspicuity")) {
1492 str = keys.get("seamark:conspicuity");
1493 setConsp(Con.UNKNOWN);
1494 for (Con con : ConSTR.keySet()) {
1495 if (ConSTR.get(con).equals(str)) {
1496 setConsp(con);
1497 }
1498 }
1499 }
1500 if (keys.containsKey("seamark:reflectivity")) {
1501 str = keys.get("seamark:reflectivity");
1502 setRefl(Con.UNKNOWN);
1503 for (Con con : ConSTR.keySet()) {
1504 if (ConSTR.get(con).equals(str)) {
1505 setRefl(con);
1506 }
1507 }
1508 }
1509
1510 if (keys.containsKey("seamark:ref")) {
1511 setRef(keys.get("seamark:ref"));
1512 }
1513 if (keys.containsKey("seamark:reference")) {
1514 setRef(keys.get("seamark:reference"));
1515 }
1516 if (keys.containsKey("seamark:light:ref")) {
1517 setLightRef(keys.get("seamark:light:ref"));
1518 }
1519 if (keys.containsKey("seamark:light:reference")) {
1520 setLightRef(keys.get("seamark:light:reference"));
1521 }
1522 if (keys.containsKey("seamark:fixme")) {
1523 setFixme(keys.get("seamark:fixme"));
1524 }
1525
1526 dlg.panelMain.syncPanel();
1527
1528 paintlock = false;
1529 paintSign();
1530 }
1531
1532 public void paintSign() {
1533
1534 if (paintlock)
1535 return;
1536
1537 dlg.panelMain.shapeIcon.setIcon(null);
1538 dlg.panelMain.litLabel.setText("");
1539 dlg.panelMain.colLabel.setText("");
1540 dlg.panelMain.radarLabel.setText("");
1541 dlg.panelMain.fogLabel.setText("");
1542 dlg.panelMain.topIcon.setIcon(null);
1543 dlg.panelMain.fogIcon.setIcon(null);
1544 dlg.panelMain.radarIcon.setIcon(null);
1545 dlg.panelMain.lightIcon.setIcon(null);
1546
1547 String colStr;
1548 String lblStr;
1549 String imgStr = "/images/";
1550 if (getShape() != Shp.UNKNOWN) {
1551 switch (getShape()) {
1552 case TOWER:
1553 imgStr += "Tower";
1554 break;
1555 case BUOY:
1556 case PILLAR:
1557 imgStr += "Pillar";
1558 break;
1559 case SPAR:
1560 imgStr += "Spar";
1561 break;
1562 case CAN:
1563 imgStr += "Can";
1564 break;
1565 case CONE:
1566 imgStr += "Cone";
1567 break;
1568 case SPHERE:
1569 imgStr += "Sphere";
1570 break;
1571 case BARREL:
1572 imgStr += "Barrel";
1573 break;
1574 case CAIRN:
1575 imgStr += "Cairn";
1576 break;
1577 case FLOAT:
1578 imgStr += "Float";
1579 break;
1580 case BEACON:
1581 case PILE:
1582 case LATTICE:
1583 case BUOYANT:
1584 imgStr += "Beacon";
1585 break;
1586 case SUPER:
1587 imgStr += "Super";
1588 break;
1589 case STAKE:
1590 case POLE:
1591 case POST:
1592 imgStr += "Stake";
1593 break;
1594 }
1595 colStr = imgStr;
1596 lblStr = "";
1597 for (Col col : bodyColour) {
1598 switch (col) {
1599 case WHITE:
1600 colStr += "_White";
1601 lblStr += "W";
1602 break;
1603 case RED:
1604 colStr += "_Red";
1605 lblStr += "R";
1606 break;
1607 case ORANGE:
1608 colStr += "_Orange";
1609 lblStr += "Or";
1610 break;
1611 case AMBER:
1612 colStr += "_Amber";
1613 lblStr += "Am";
1614 break;
1615 case YELLOW:
1616 colStr += "_Yellow";
1617 lblStr += "Y";
1618 break;
1619 case GREEN:
1620 colStr += "_Green";
1621 lblStr += "G";
1622 break;
1623 case BLUE:
1624 colStr += "_Blue";
1625 lblStr += "Bu";
1626 break;
1627 case VIOLET:
1628 colStr += "_Violet";
1629 lblStr += "Vi";
1630 break;
1631 case BLACK:
1632 colStr += "_Black";
1633 lblStr += "B";
1634 break;
1635 case GREY:
1636 colStr += "_Grey";
1637 lblStr += "Gr";
1638 break;
1639 case BROWN:
1640 colStr += "_Brown";
1641 lblStr += "Br";
1642 break;
1643 case MAGENTA:
1644 colStr += "_Magenta";
1645 lblStr += "Mg";
1646 break;
1647 case PINK:
1648 colStr += "_Pink";
1649 lblStr += "Pk";
1650 break;
1651 }
1652 }
1653 if (getShape() == Shp.PERCH) {
1654 if (getCategory() == Cat.LAM_PORT) {
1655 colStr = "/images/Perch_Port";
1656 } else {
1657 colStr = "/images/Perch_Starboard";
1658 }
1659 }
1660 if (!imgStr.equals("/images/")) {
1661 colStr += ".png";
1662 if (getClass().getResource(colStr) == null) {
1663 System.out.println("Missing image: " + colStr);
1664 imgStr += ".png";
1665 if (getClass().getResource(imgStr) == null) {
1666 System.out.println("Missing image: " + imgStr);
1667 } else {
1668 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));
1669 dlg.panelMain.colLabel.setText(lblStr);
1670 }
1671 } else {
1672 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(colStr)));
1673 }
1674 } else {
1675 dlg.panelMain.shapeIcon.setIcon(null);
1676 }
1677 } else if (getObject() != Obj.UNKNOWN) {
1678 switch (getObject()) {
1679 case LNDMRK:
1680 switch (getCategory()) {
1681 case LMK_CHMY:
1682 imgStr += "Chimney";
1683 break;
1684 case LMK_CARN:
1685 imgStr += "Cairn";
1686 break;
1687 case LMK_DSHA:
1688 imgStr += "DishAerial";
1689 break;
1690 case LMK_FLGS:
1691 imgStr += "Flagstaff";
1692 break;
1693 case LMK_FLRS:
1694 imgStr += "FlareStack";
1695 break;
1696 case LMK_MNMT:
1697 imgStr += "Monument";
1698 break;
1699 case LMK_RADM:
1700 imgStr += "RadioMast";
1701 break;
1702 case LMK_TOWR:
1703 imgStr += "LandTower";
1704 break;
1705 case LMK_WNDM:
1706 imgStr += "Wind_Motor";
1707 break;
1708 case LMK_WTRT:
1709 imgStr += "WaterTower";
1710 break;
1711 }
1712 break;
1713 case LITHSE:
1714 imgStr += "Light_House";
1715 break;
1716 case LITMAJ:
1717 imgStr += "Light_Major";
1718 break;
1719 case LITMIN:
1720 imgStr += "Light_Minor";
1721 break;
1722 case LITFLT:
1723 imgStr += "Float";
1724 break;
1725 case LITVES:
1726 imgStr += "Super";
1727 break;
1728 case SISTAW:
1729 imgStr += "Signal_Station";
1730 break;
1731 case SISTAT:
1732 imgStr += "Signal_Station";
1733 break;
1734 }
1735 if (!imgStr.equals("/images/")) {
1736 imgStr += ".png";
1737 if (getClass().getResource(imgStr) == null) {
1738 System.out.println("Missing image: " + imgStr);
1739 } else {
1740 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));
1741 }
1742 } else {
1743 dlg.panelMain.shapeIcon.setIcon(null);
1744 }
1745 }
1746
1747 if (getTopmark() != Top.NONE) {
1748 imgStr = "/images/Top_";
1749 switch (getTopmark()) {
1750 case CAN:
1751 imgStr += "Can";
1752 break;
1753 case CONE:
1754 imgStr += "Cone";
1755 break;
1756 case SPHERE:
1757 imgStr += "Sphere";
1758 break;
1759 case X_SHAPE:
1760 imgStr += "X";
1761 break;
1762 case NORTH:
1763 imgStr += "North";
1764 break;
1765 case SOUTH:
1766 imgStr += "South";
1767 break;
1768 case EAST:
1769 imgStr += "East";
1770 break;
1771 case WEST:
1772 imgStr += "West";
1773 break;
1774 case SPHERES2:
1775 imgStr += "Isol";
1776 break;
1777 }
1778 colStr = imgStr;
1779 for (Col col : topmarkColour) {
1780 switch (col) {
1781 case WHITE:
1782 colStr += "_White";
1783 break;
1784 case RED:
1785 colStr += "_Red";
1786 break;
1787 case ORANGE:
1788 colStr += "_Orange";
1789 break;
1790 case AMBER:
1791 colStr += "_Amber";
1792 break;
1793 case YELLOW:
1794 colStr += "_Yellow";
1795 break;
1796 case GREEN:
1797 colStr += "_Green";
1798 break;
1799 case BLUE:
1800 colStr += "_Blue";
1801 break;
1802 case VIOLET:
1803 colStr += "_Violet";
1804 break;
1805 case BLACK:
1806 colStr += "_Black";
1807 break;
1808 }
1809 }
1810 switch (getShape()) {
1811 case CAN:
1812 case CONE:
1813 case SPHERE:
1814 case BARREL:
1815 imgStr += "_Buoy_Small";
1816 colStr += "_Buoy_Small";
1817 break;
1818 case PILLAR:
1819 case SPAR:
1820 imgStr += "_Buoy";
1821 colStr += "_Buoy";
1822 break;
1823 case FLOAT:
1824 case SUPER:
1825 imgStr += "_Float";
1826 colStr += "_Float";
1827 break;
1828 case BUOYANT:
1829 case CAIRN:
1830 case PILE:
1831 case LATTICE:
1832 case TOWER:
1833 case STAKE:
1834 case POLE:
1835 case POST:
1836 case BEACON:
1837 imgStr += "_Beacon";
1838 colStr += "_Beacon";
1839 break;
1840 }
1841 colStr += ".png";
1842 if (getClass().getResource(colStr) == null) {
1843 System.out.println("Missing image: " + colStr);
1844 imgStr += ".png";
1845 if (getClass().getResource(imgStr) == null) {
1846 System.out.println("Missing image: " + imgStr);
1847 return;
1848 } else {
1849 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));
1850 }
1851 } else {
1852 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(colStr)));
1853 }
1854 } else {
1855 dlg.panelMain.topIcon.setIcon(null);
1856 }
1857
1858 if (getFogSound() != Fog.NONE) {
1859 dlg.panelMain.fogIcon.setIcon(new ImageIcon(getClass().getResource("/images/Fog_Signal.png")));
1860 String str = "";
1861 if (getFogSound() != Fog.UNKNOWN)
1862 switch (getFogSound()) {
1863 case HORN:
1864 str = "Horn";
1865 break;
1866 case SIREN:
1867 str = "Siren";
1868 break;
1869 case DIA:
1870 str = "Dia";
1871 break;
1872 case BELL:
1873 str = "Bell";
1874 break;
1875 case WHIS:
1876 str = "Whis";
1877 break;
1878 case GONG:
1879 str = "Gong";
1880 break;
1881 case EXPLOS:
1882 str = "Explos";
1883 break;
1884 }
1885 if (!getFogGroup().isEmpty())
1886 str += ("(" + getFogGroup() + ")");
1887 else
1888 str += " ";
1889 if (!getFogPeriod().isEmpty())
1890 str += getFogPeriod() + "s";
1891 dlg.panelMain.fogLabel.setText(str);
1892 }
1893
1894 if (RaType != Rtb.NONE) {
1895 if (getRadar() == Rtb.REFLECTOR) {
1896 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png")));
1897 } else {
1898 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Station.png")));
1899 String str = "";
1900 if (getRadar() == Rtb.RAMARK)
1901 str += "Ramark";
1902 else
1903 str += "Racon";
1904 if (!getRaconGroup().isEmpty())
1905 str += ("(" + getRaconGroup() + ")");
1906 else
1907 str += " ";
1908 if (!getRaconPeriod().isEmpty())
1909 str += getRaconPeriod() + "s";
1910 dlg.panelMain.radarLabel.setText(str);
1911 }
1912 }
1913
1914 if (getLightAtt(Att.COL, 0) != Col.UNKNOWN) {
1915 if (sectors.size() == 1) {
1916 switch ((Col) getLightAtt(Att.COL, 0)) {
1917 case RED:
1918 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Red_120.png")));
1919 break;
1920 case GREEN:
1921 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Green_120.png")));
1922 break;
1923 case WHITE:
1924 case YELLOW:
1925 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_White_120.png")));
1926 break;
1927 default:
1928 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png")));
1929 }
1930 }
1931 String c = (String)getLightAtt(Att.CHR, 0);
1932 String tmp = "";
1933 if (c.contains("+")) {
1934 int i1 = c.indexOf("+");
1935 tmp = c.substring(i1, c.length());
1936 c = c.substring(0, i1);
1937 if (!((String)getLightAtt(Att.GRP, 0)).isEmpty()) {
1938 c += "(" + (String)getLightAtt(Att.GRP, 0) + ")";
1939 }
1940 if (tmp != null)
1941 c += tmp;
1942 } else if (!((String)getLightAtt(Att.GRP, 0)).isEmpty())
1943 c += "(" + (String)getLightAtt(Att.GRP, 0) + ")";
1944 switch ((Col)getLightAtt(Att.COL, 0)) {
1945 case RED:
1946 c += " R";
1947 break;
1948 case GREEN:
1949 c += " G";
1950 break;
1951 case AMBER:
1952 c += " Am";
1953 break;
1954 case ORANGE:
1955 c += " Or";
1956 break;
1957 case BLUE:
1958 c += " Bu";
1959 break;
1960 case VIOLET:
1961 c += " Vi";
1962 break;
1963 }
1964 tmp = (String)getLightAtt(Att.PER, 0);
1965 if (!tmp.isEmpty())
1966 c += " " + tmp + "s";
1967 dlg.panelMain.litLabel.setText(c);
1968 }
1969
1970 paintlock = false;
1971 }
1972
1973 public void saveSign(Node node) {
1974
1975 if (getObject() != Obj.UNKNOWN) {
1976
1977 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A"));
1978
1979 for (String str : node.getKeys().keySet()) {
1980 if (str.trim().matches("^seamark:\\S+"))
1981 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));
1982 }
1983
1984 if (!getName().isEmpty())
1985 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName()));
1986
1987 String objStr = ObjSTR.get(object);
1988 if (objStr != null) {
1989 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr));
1990
1991 if (getShape() != Shp.FLOAT) {
1992 String str = CatSTR.get(getCategory());
1993 if (str != null)
1994 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str));
1995 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON))
1996 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape())));
1997 }
1998
1999 if ((getObjColour(0) != Col.UNKNOWN) && getShape() != Shp.PERCH) {
2000 String str = ColSTR.get(getObjColour(0));
2001 for (int i = 1; bodyColour.size() > i; i++) {
2002 str += (";" + ColSTR.get(getObjColour(i)));
2003 }
2004 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str));
2005 }
2006
2007 if (getObjPattern() != Pat.NONE) {
2008 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatSTR
2009 .get(getObjPattern())));
2010 }
2011
2012 if ((GrpMAP.get(object) == Grp.LAT) && (getShape() != Shp.PERCH) || (getObject() == Obj.FLTLAT)) {
2013 switch (region) {
2014 case A:
2015 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-a"));
2016 break;
2017 case B:
2018 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-b"));
2019 break;
2020 case C:
2021 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "other"));
2022 break;
2023 }
2024 }
2025 if (!getHeight().isEmpty()) {
2026 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + "height", getHeight()));
2027 }
2028 if (!getElevation().isEmpty()) {
2029 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + "elevation", getElevation()));
2030 }
2031 }
2032 if (getTopmark() != Top.NONE) {
2033 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark())));
2034 if (getTopPattern() != Pat.NONE)
2035 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR
2036 .get(getTopPattern())));
2037 if (getTopColour(0) != Col.UNKNOWN) {
2038 String str = ColSTR.get(getTopColour(0));
2039 for (int i = 1; topmarkColour.size() > i; i++) {
2040 str += (";" + ColSTR.get(getTopColour(i)));
2041 }
2042 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour", str));
2043 }
2044 }
2045
2046 for (int i = 0; i < sectors.size(); i++) {
2047 String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
2048 if (sectors.get(i)[0] != Col.UNKNOWN)
2049 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", ColSTR.get(sectors.get(i)[0])));
2050 if (!((String)sectors.get(i)[1]).isEmpty())
2051 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String)sectors.get(i)[1]));
2052 if (!((String)sectors.get(i)[2]).isEmpty())
2053 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String)sectors.get(i)[2]));
2054 if (!((String)sectors.get(i)[3]).isEmpty())
2055 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String)sectors.get(i)[3]));
2056 if (!((String)sectors.get(i)[4]).isEmpty())
2057 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String)sectors.get(i)[4]));
2058 if (sectors.get(i)[5] != Lit.UNKNOWN)
2059 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5])));
2060 if (!((String)sectors.get(i)[6]).isEmpty())
2061 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String)sectors.get(i)[6]));
2062 if (!((String)sectors.get(i)[7]).isEmpty())
2063 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String)sectors.get(i)[7]));
2064 if (!((String)sectors.get(i)[8]).isEmpty())
2065 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String)sectors.get(i)[8]));
2066 if (!((String)sectors.get(i)[9]).isEmpty())
2067 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String)sectors.get(i)[9]));
2068 if (!((String)sectors.get(i)[10]).isEmpty())
2069 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String)sectors.get(i)[10]));
2070 if (sectors.get(i)[11] != Vis.UNKNOWN)
2071 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11])));
2072 if (sectors.get(i)[12] != Exh.UNKNOWN)
2073 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12])));
2074 if (!((String)sectors.get(i)[13]).isEmpty())
2075 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String)sectors.get(i)[13]));
2076 if (!((String)sectors.get(i)[14]).isEmpty())
2077 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String)sectors.get(i)[14]));
2078 }
2079
2080 if (getFogSound() != Fog.NONE) {
2081 if (getFogSound() == Fog.UNKNOWN)
2082 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes"));
2083 else
2084 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", FogSTR.get(getFogSound())));
2085 if (!getFogGroup().isEmpty()) {
2086 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup()));
2087 }
2088 if (!getFogPeriod().isEmpty()) {
2089 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:period", getFogPeriod()));
2090 }
2091 if (!getFogSequence().isEmpty()) {
2092 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:sequence", getFogSequence()));
2093 }
2094 if (!getFogRange().isEmpty()) {
2095 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:range", getFogRange()));
2096 }
2097 }
2098
2099 if (RaType != Rtb.NONE) {
2100 if (getRadar() == Rtb.REFLECTOR) {
2101 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes"));
2102 } else {
2103 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", RtbSTR.get(getRadar())));
2104 if (!getRaconGroup().isEmpty()) {
2105 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:group", getRaconGroup()));
2106 }
2107 if (!getRaconPeriod().isEmpty()) {
2108 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:period", getRaconPeriod()));
2109 }
2110 if (!getRaconSequence().isEmpty()) {
2111 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sequence", getRaconSequence()));
2112 }
2113 if (!getRaconRange().isEmpty()) {
2114 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:range", getRaconRange()));
2115 }
2116 if ((!getRaconSector1().isEmpty()) && (!getRaconSector2().isEmpty())) {
2117 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_start", getRaconSector1()));
2118 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_end", getRaconSector2()));
2119 }
2120 }
2121 }
2122
2123 if (!getInfo().isEmpty()) {
2124 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:information", getInfo()));
2125 }
2126 if (!getSource().isEmpty()) {
2127 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:source", getSource()));
2128 }
2129 if (getStatus() != Sts.UNKNOWN) {
2130 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:status", StsSTR.get(getStatus())));
2131 }
2132 if (getConstr() != Cns.UNKNOWN) {
2133 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:construction", CnsSTR.get(getConstr())));
2134 }
2135 if (getConsp() != Con.UNKNOWN) {
2136 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:conspicuity", ConSTR.get(getConsp())));
2137 }
2138 if (getRefl() != Con.UNKNOWN) {
2139 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reflectivity", ConSTR.get(getRefl())));
2140 }
2141 if (!getRef().isEmpty()) {
2142 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reference", getRef()));
2143 }
2144 if (!getLightRef().isEmpty()) {
2145 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:reference", getLightRef()));
2146 }
2147 if (!getFixme().isEmpty()) {
2148 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fixme", getFixme()));
2149 }
2150 }
2151 }
2152
2153}
Note: See TracBrowser for help on using the repository browser.