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

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

save

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