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

Last change on this file since 24823 was 24823, checked in by malcolmh, 14 years ago

save

File size: 29.3 KB
Line 
1package oseam.seamarks;
2
3import java.util.Map;
4
5import org.openstreetmap.josm.data.osm.Node;
6import org.openstreetmap.josm.Main;
7import org.openstreetmap.josm.command.ChangePropertyCommand;
8
9import oseam.dialogs.OSeaMAction;
10
11public class MarkLat extends SeaMark {
12 public MarkLat(OSeaMAction dia, Node node) {
13 super(dia, node);
14 }
15
16 public void parseMark() {
17
18 String str;
19 Map<String, String> keys;
20 keys = getNode().getKeys();
21
22 if (!dlg.panelMain.chanButton.isSelected())
23 dlg.panelMain.chanButton.doClick();
24
25 if (keys.containsKey("name"))
26 setName(keys.get("name"));
27
28 if (keys.containsKey("seamark:name"))
29 setName(keys.get("seamark:name"));
30
31 if (keys.containsKey("seamark:buoy_lateral:name"))
32 setName(keys.get("seamark:buoy_lateral:name"));
33 else if (keys.containsKey("seamark:beacon_lateral:name"))
34 setName(keys.get("seamark:beacon_lateral:name"));
35 else if (keys.containsKey("seamark:light_float:name"))
36 setName(keys.get("seamark:light_float:name"));
37
38 String cat = "";
39 String col = "";
40 String top = "";
41
42 if (keys.containsKey("seamark:buoy_lateral:category"))
43 cat = keys.get("seamark:buoy_lateral:category");
44 else if (keys.containsKey("seamark:beacon_lateral:category"))
45 cat = keys.get("seamark:beacon_lateral:category");
46
47 if (keys.containsKey("seamark:buoy_lateral:colour"))
48 col = keys.get("seamark:buoy_lateral:colour");
49 else if (keys.containsKey("seamark:beacon_lateral:colour"))
50 col = keys.get("seamark:beacon_lateral:colour");
51 else if (keys.containsKey("seamark:light_float:colour"))
52 col = keys.get("seamark:light_float:colour");
53
54 if (getShape() != Styl.PERCH) {
55 if (keys.containsKey("seamark:topmark:shape")) {
56 top = keys.get("seamark:topmark:shape");
57// setTopMark(true);
58 }
59 if (keys.containsKey("seamark:topmark:colour")) {
60 if (col.isEmpty()) col = keys.get("seamark:topmark:colour");
61// setTopMark(true);
62 }
63 }
64
65 if (col.isEmpty()) {
66 if (keys.containsKey("seamark:light:colour"))
67 col = keys.get("seamark:light:colour");
68 }
69
70 /*
71 if (cat.isEmpty()) {
72 if (col.equals("red")) {
73 setColour(RED);
74 if (top.equals("cylinder")) {
75 setBuoyIndex(PORT_HAND);
76 setRegion(IALA_A);
77 } else if (top.equals("cone, point up")) {
78 setBuoyIndex(STARBOARD_HAND);
79 setRegion(IALA_B);
80 } else {
81 if (getRegion() == IALA_A)
82 setBuoyIndex(PORT_HAND);
83 else
84 setBuoyIndex(STARBOARD_HAND);
85 }
86 } else if (col.equals("green")) {
87 setColour(GREEN);
88 if (top.equals("cone, point up")) {
89 setBuoyIndex(STARBOARD_HAND);
90 setRegion(IALA_A);
91 } else if (top.equals("cylinder")) {
92 setBuoyIndex(PORT_HAND);
93 setRegion(IALA_B);
94 } else {
95 if (getRegion() == IALA_A)
96 setBuoyIndex(STARBOARD_HAND);
97 else
98 setBuoyIndex(PORT_HAND);
99 }
100 } else if (col.equals("red;green;red")) {
101 setColour(RED_GREEN_RED);
102 if (top.equals("cylinder")) {
103 setBuoyIndex(PREF_PORT_HAND);
104 setRegion(IALA_A);
105 } else if (top.equals("cone, point up")) {
106 setBuoyIndex(PREF_STARBOARD_HAND);
107 setRegion(IALA_B);
108 } else {
109 if (getRegion() == IALA_A)
110 setBuoyIndex(PREF_PORT_HAND);
111 else
112 setBuoyIndex(PREF_STARBOARD_HAND);
113 }
114 } else if (col.equals("green;red;green")) {
115 setColour(GREEN_RED_GREEN);
116 if (top.equals("cone, point up")) {
117 setBuoyIndex(PREF_STARBOARD_HAND);
118 setRegion(IALA_A);
119 } else if (top.equals("cylinder")) {
120 setBuoyIndex(PREF_PORT_HAND);
121 setRegion(IALA_B);
122 } else {
123 if (getRegion() == IALA_A)
124 setBuoyIndex(PREF_STARBOARD_HAND);
125 else
126 setBuoyIndex(PREF_PORT_HAND);
127 }
128 }
129 } else if (cat.equals("port")) {
130
131 setBuoyIndex(PORT_HAND);
132
133 if (col.equals("red")) {
134 setRegion(IALA_A);
135 setColour(RED);
136 } else if (col.equals("green")) {
137 setRegion(IALA_B);
138 setColour(GREEN);
139 } else {
140 if (getRegion() == IALA_A)
141 setColour(RED);
142 else
143 setColour(GREEN);
144 }
145 } else if (cat.equals("starboard")) {
146
147 setBuoyIndex(STARBOARD_HAND);
148
149 if (col.equals("green")) {
150 setRegion(IALA_A);
151 setColour(GREEN);
152 } else if (col.equals("red")) {
153 setRegion(IALA_B);
154 setColour(RED);
155 } else {
156 if (getRegion() == IALA_A)
157 setColour(GREEN);
158 else
159 setColour(RED);
160 }
161 } else if (cat.equals("preferred_channel_port")) {
162
163 setBuoyIndex(PREF_PORT_HAND);
164
165 if (col.equals("red;green;red")) {
166 setRegion(IALA_A);
167 setColour(RED_GREEN_RED);
168 } else if (col.equals("green;red;green")) {
169 setRegion(IALA_B);
170 setColour(GREEN_RED_GREEN);
171 } else {
172 if (getRegion() == IALA_A)
173 setColour(RED_GREEN_RED);
174 else
175 setColour(GREEN_RED_GREEN);
176 }
177
178 } else if (cat.equals("preferred_channel_starboard")) {
179
180 setBuoyIndex(PREF_STARBOARD_HAND);
181
182 if (col.equals("green;red;green")) {
183 setRegion(IALA_A);
184 setColour(GREEN_RED_GREEN);
185 } else if (col.equals("red;green;red")) {
186 setRegion(IALA_B);
187 setColour(RED_GREEN_RED);
188 } else {
189 if (getRegion() == IALA_A)
190 setColour(GREEN_RED_GREEN);
191 else
192 setColour(RED_GREEN_RED);
193 }
194 }
195
196 if (keys.containsKey("seamark:buoy_lateral:shape")) {
197 str = keys.get("seamark:buoy_lateral:shape");
198
199 switch (getBuoyIndex()) {
200 case PORT_HAND:
201 if (str.equals("can"))
202 setStyleIndex(LAT_CAN);
203 else if (str.equals("pillar"))
204 setStyleIndex(LAT_PILLAR);
205 else if (str.equals("spar"))
206 setStyleIndex(LAT_SPAR);
207 break;
208
209 case PREF_PORT_HAND:
210 if (str.equals("can"))
211 setStyleIndex(LAT_CAN);
212 else if (str.equals("pillar"))
213 setStyleIndex(LAT_PILLAR);
214 else if (str.equals("spar"))
215 setStyleIndex(LAT_SPAR);
216 break;
217
218 case STARBOARD_HAND:
219 if (str.equals("conical"))
220 setStyleIndex(LAT_CONE);
221 else if (str.equals("pillar"))
222 setStyleIndex(LAT_PILLAR);
223 else if (str.equals("spar"))
224 setStyleIndex(LAT_SPAR);
225 break;
226
227 case PREF_STARBOARD_HAND:
228 if (str.equals("conical"))
229 setStyleIndex(LAT_CONE);
230 else if (str.equals("pillar"))
231 setStyleIndex(LAT_PILLAR);
232 else if (str.equals("spar"))
233 setStyleIndex(LAT_SPAR);
234 break;
235 }
236 } else if (keys.containsKey("seamark:beacon_lateral:shape")) {
237 str = keys.get("seamark:beacon_lateral:shape");
238 if (str.equals("tower"))
239 setStyleIndex(LAT_TOWER);
240 else if (str.equals("perch"))
241 setStyleIndex(LAT_PERCH);
242 else
243 setStyleIndex(LAT_BEACON);
244 } else if (keys.containsKey("seamark:type")
245 && (keys.get("seamark:type").equals("beacon_lateral"))) {
246 setStyleIndex(LAT_BEACON);
247 } else if (keys.containsKey("seamark:type")
248 && (keys.get("seamark:type").equals("light_float"))) {
249 setStyleIndex(LAT_FLOAT);
250 }
251
252 refreshStyles();
253 refreshLights();
254 parseLights(keys);
255 parseFogRadar(keys);
256 setLightColour();
257
258 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex());
259 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());
260 dlg.tfM01Name.setText(getName());
261 dlg.cM01TopMark.setSelected(hasTopMark());
262*/ }
263/*
264 public void refreshStyles() {
265 int type = getBuoyIndex();
266 int style = getStyleIndex();
267
268 dlg.cbM01StyleOfMark.removeAllItems();
269 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213"));
270
271 switch (type) {
272 case PORT_HAND:
273 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02"));
274 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01"));
275 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04"));
276 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05"));
277 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06"));
278 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07"));
279 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10"));
280 break;
281 case STARBOARD_HAND:
282 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03"));
283 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01"));
284 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04"));
285 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05"));
286 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06"));
287 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07"));
288 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10"));
289 break;
290 case PREF_PORT_HAND:
291 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02"));
292 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01"));
293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04"));
294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05"));
295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06"));
296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07"));
297 break;
298 case PREF_STARBOARD_HAND:
299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03"));
300 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01"));
301 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04"));
302 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05"));
303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06"));
304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07"));
305 break;
306 }
307
308 if (style >= dlg.cbM01StyleOfMark.getItemCount())
309 style = 0;
310 setStyleIndex(style);
311 dlg.cbM01StyleOfMark.setSelectedIndex(style);
312 dlg.cbM01StyleOfMark.setVisible(true);
313 dlg.lM01StyleOfMark.setVisible(true);
314 }
315
316 public void refreshLights() {
317 super.refreshLights();
318 }
319
320 public boolean isValid() {
321 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);
322 }
323
324 public void setLightColour() {
325 if (getRegion() == IALA_A) {
326 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)
327 super.setLightColour("R");
328 else
329 super.setLightColour("G");
330 } else {
331 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)
332 super.setLightColour("G");
333 else
334 super.setLightColour("R");
335 }
336 }
337*/
338 public void paintSign() {
339/* if (dlg.paintlock)
340 return;
341 super.paintSign();
342
343 dlg.sM01StatusBar.setText(getErrMsg());
344
345 if (isValid()) {
346 dlg.tfM01Name.setEnabled(true);
347 dlg.tfM01Name.setText(getName());
348
349 boolean region = getRegion();
350 int style = getStyleIndex();
351
352 if (style == LAT_PERCH) {
353 dlg.cM01TopMark.setVisible(false);
354 dlg.cM01TopMark.setSelected(false);
355 dlg.cM01Radar.setVisible(false);
356 dlg.cM01Racon.setVisible(false);
357 dlg.cM01Fog.setVisible(false);
358 dlg.cM01Fired.setVisible(false);
359 dlg.cM01Fired.setSelected(false);
360 } else {
361 dlg.cM01TopMark.setEnabled(true);
362 dlg.cM01TopMark.setVisible(true);
363 dlg.cM01Radar.setVisible(true);
364 dlg.cM01Racon.setVisible(true);
365 dlg.cM01Fog.setVisible(true);
366 dlg.cM01Fired.setVisible(true);
367 dlg.cM01Fired.setEnabled(true);
368 dlg.cM01TopMark.setEnabled(true);
369 }
370 if (!isSectored()) {
371 dlg.cbM01Colour.setVisible(false);
372 dlg.lM01Colour.setVisible(false);
373 }
374 dlg.rbM01Fired1.setVisible(false);
375 dlg.rbM01FiredN.setVisible(false);
376 dlg.lM01Height.setVisible(false);
377 dlg.tfM01Height.setVisible(false);
378 dlg.lM01Range.setVisible(false);
379 dlg.tfM01Range.setVisible(false);
380
381 if (isFired()) {
382 switch (style) {
383 case LAT_BEACON:
384 case LAT_TOWER:
385 case LAT_FLOAT:
386 dlg.lM01Height.setVisible(true);
387 dlg.tfM01Height.setVisible(true);
388 dlg.lM01Range.setVisible(true);
389 dlg.tfM01Range.setVisible(true);
390 break;
391 default:
392 }
393 }
394
395 String image = "/images/Lateral";
396
397 switch (getBuoyIndex()) {
398 case PORT_HAND:
399 if (region == IALA_A)
400 switch (style) {
401 case LAT_CAN:
402 image += "_Can_Red";
403 break;
404 case LAT_PILLAR:
405 image += "_Pillar_Red";
406 break;
407 case LAT_SPAR:
408 image += "_Spar_Red";
409 break;
410 case LAT_BEACON:
411 image += "_Beacon_Red";
412 break;
413 case LAT_TOWER:
414 image += "_Tower_Red";
415 break;
416 case LAT_FLOAT:
417 image += "_Float_Red";
418 break;
419 case LAT_PERCH:
420 image += "_Perch_Port";
421 break;
422 default:
423 }
424 else
425 switch (style) {
426 case LAT_CAN:
427 image += "_Can_Green";
428 break;
429 case LAT_PILLAR:
430 image += "_Pillar_Green";
431 break;
432 case LAT_SPAR:
433 image += "_Spar_Green";
434 break;
435 case LAT_BEACON:
436 image += "_Beacon_Green";
437 break;
438 case LAT_TOWER:
439 image += "_Tower_Green";
440 break;
441 case LAT_FLOAT:
442 image += "_Float_Green";
443 break;
444 case LAT_PERCH:
445 image += "_Perch_Port";
446 break;
447 default:
448 }
449 break;
450
451 case STARBOARD_HAND:
452 if (region == IALA_A)
453 switch (style) {
454 case LAT_CONE:
455 image += "_Cone_Green";
456 break;
457 case LAT_PILLAR:
458 image += "_Pillar_Green";
459 break;
460 case LAT_SPAR:
461 image += "_Spar_Green";
462 break;
463 case LAT_BEACON:
464 image += "_Beacon_Green";
465 break;
466 case LAT_TOWER:
467 image += "_Tower_Green";
468 break;
469 case LAT_FLOAT:
470 image += "_Float_Green";
471 break;
472 case LAT_PERCH:
473 image += "_Perch_Starboard";
474 break;
475 default:
476 }
477 else
478 switch (style) {
479 case LAT_CONE:
480 image += "_Cone_Red";
481 break;
482 case LAT_PILLAR:
483 image += "_Pillar_Red";
484 break;
485 case LAT_SPAR:
486 image += "_Spar_Red";
487 break;
488 case LAT_BEACON:
489 image += "_Beacon_Red";
490 break;
491 case LAT_TOWER:
492 image += "_Tower_Red";
493 break;
494 case LAT_FLOAT:
495 image += "_Float_Red";
496 break;
497 case LAT_PERCH:
498 image += "_Perch_Starboard";
499 break;
500 default:
501 }
502 break;
503
504 case PREF_PORT_HAND:
505 if (region == IALA_A)
506 switch (style) {
507 case LAT_CAN:
508 image += "_Can_Red_Green_Red";
509 break;
510 case LAT_PILLAR:
511 image += "_Pillar_Red_Green_Red";
512 break;
513 case LAT_SPAR:
514 image += "_Spar_Red_Green_Red";
515 break;
516 case LAT_BEACON:
517 image += "_Beacon_Red_Green_Red";
518 break;
519 case LAT_TOWER:
520 image += "_Tower_Red_Green_Red";
521 break;
522 case LAT_FLOAT:
523 image += "_Float_Red_Green_Red";
524 break;
525 default:
526 }
527 else
528 switch (style) {
529 case LAT_CAN:
530 image += "_Can_Green_Red_Green";
531 break;
532 case LAT_PILLAR:
533 image += "_Pillar_Green_Red_Green";
534 break;
535 case LAT_SPAR:
536 image += "_Spar_Green_Red_Green";
537 break;
538 case LAT_BEACON:
539 image += "_Beacon_Green_Red_Green";
540 break;
541 case LAT_TOWER:
542 image += "_Tower_Green_Red_Green";
543 break;
544 case LAT_FLOAT:
545 image += "_Float_Green_Red_Green";
546 break;
547 default:
548 }
549 break;
550
551 case PREF_STARBOARD_HAND:
552 if (region == IALA_A)
553 switch (style) {
554 case LAT_CONE:
555 image += "_Cone_Green_Red_Green";
556 break;
557 case LAT_PILLAR:
558 image += "_Pillar_Green_Red_Green";
559 break;
560 case LAT_SPAR:
561 image += "_Spar_Green_Red_Green";
562 break;
563 case LAT_BEACON:
564 image += "_Beacon_Green_Red_Green";
565 break;
566 case LAT_TOWER:
567 image += "_Tower_Green_Red_Green";
568 break;
569 case LAT_FLOAT:
570 image += "_Float_Green_Red_Green";
571 break;
572 default:
573 }
574 else
575 switch (style) {
576 case LAT_CONE:
577 image += "_Cone_Red_Green_Red";
578 break;
579 case LAT_PILLAR:
580 image += "_Pillar_Red_Green_Red";
581 break;
582 case LAT_SPAR:
583 image += "_Spar_Red_Green_Red";
584 break;
585 case LAT_BEACON:
586 image += "_Beacon_Red_Green_Red";
587 break;
588 case LAT_TOWER:
589 image += "_Tower_Red_Green_Red";
590 break;
591 case LAT_FLOAT:
592 image += "_Float_Red_Green_Red";
593 break;
594 default:
595 }
596 break;
597
598 default:
599 }
600
601 if (!image.equals("/images/Lateral")) {
602
603 image += ".png";
604 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));
605
606 if (hasTopMark()) {
607 image = "";
608 switch (getBuoyIndex()) {
609 case PORT_HAND:
610 case PREF_PORT_HAND:
611 if (region == IALA_A)
612 switch (style) {
613 case LAT_CAN:
614 image = "/images/Top_Can_Red_Buoy_Small.png";
615 break;
616 case LAT_PILLAR:
617 case LAT_SPAR:
618 image = "/images/Top_Can_Red_Buoy.png";
619 break;
620 case LAT_BEACON:
621 case LAT_TOWER:
622 image = "/images/Top_Can_Red_Beacon.png";
623 break;
624 case LAT_FLOAT:
625 image = "/images/Top_Can_Red_Float.png";
626 break;
627 }
628 else
629 switch (style) {
630 case LAT_CAN:
631 image = "/images/Top_Can_Green_Buoy_Small.png";
632 break;
633 case LAT_PILLAR:
634 case LAT_SPAR:
635 image = "/images/Top_Can_Green_Buoy.png";
636 break;
637 case LAT_BEACON:
638 case LAT_TOWER:
639 image = "/images/Top_Can_Green_Beacon.png";
640 break;
641 case LAT_FLOAT:
642 image = "/images/Top_Can_Green_Float.png";
643 break;
644 }
645 break;
646
647 case STARBOARD_HAND:
648 case PREF_STARBOARD_HAND:
649 if (region == IALA_A)
650 switch (style) {
651 case LAT_CONE:
652 image = "/images/Top_Cone_Green_Buoy_Small.png";
653 break;
654 case LAT_PILLAR:
655 case LAT_SPAR:
656 image = "/images/Top_Cone_Green_Buoy.png";
657 break;
658 case LAT_BEACON:
659 case LAT_TOWER:
660 image = "/images/Top_Cone_Green_Beacon.png";
661 break;
662 case LAT_FLOAT:
663 image = "/images/Top_Cone_Green_Float.png";
664 break;
665 }
666 else
667 switch (style) {
668 case LAT_CONE:
669 image = "/images/Top_Cone_Red_Buoy_Small.png";
670 break;
671 case LAT_PILLAR:
672 case LAT_SPAR:
673 image = "/images/Top_Cone_Red_Buoy.png";
674 break;
675 case LAT_BEACON:
676 case LAT_TOWER:
677 image = "/images/Top_Cone_Red_Beacon.png";
678 break;
679 case LAT_FLOAT:
680 image = "/images/Top_Cone_Red_Float.png";
681 break;
682 }
683 break;
684 }
685 if (!image.isEmpty())
686 dlg.lM06Icon.setIcon(new ImageIcon(getClass().getResource(image)));
687 }
688 } else
689 dlg.lM01Icon.setIcon(null);
690 }
691*/ }
692
693 public void saveSign() {
694 Node node = getNode();
695
696 if (node == null) {
697 return;
698 }
699
700 Cat cat = getCategory();
701 String shape = "";
702 String colour = "";
703
704 switch (cat) {
705
706 case PORT_HAND:
707 switch (getShape()) {
708 case CAN:
709 super.saveSign("buoy_lateral");
710 Main.main.undoRedo.add(new ChangePropertyCommand(node,
711 "seamark:buoy_lateral:shape", "can"));
712 break;
713 case PILLAR:
714 super.saveSign("buoy_lateral");
715 Main.main.undoRedo.add(new ChangePropertyCommand(node,
716 "seamark:buoy_lateral:shape", "pillar"));
717 break;
718 case SPAR:
719 super.saveSign("buoy_lateral");
720 Main.main.undoRedo.add(new ChangePropertyCommand(node,
721 "seamark:buoy_lateral:shape", "spar"));
722 break;
723 case BEACON:
724 super.saveSign("beacon_lateral");
725 break;
726 case TOWER:
727 super.saveSign("beacon_lateral");
728 Main.main.undoRedo.add(new ChangePropertyCommand(node,
729 "seamark:beacon_lateral:shape", "tower"));
730 break;
731 case FLOAT:
732 super.saveSign("light_float");
733 break;
734 case PERCH:
735 super.saveSign("beacon_lateral");
736 Main.main.undoRedo.add(new ChangePropertyCommand(node,
737 "seamark:beacon_lateral:shape", "perch"));
738 break;
739 default:
740 }
741 switch (getShape()) {
742 case CAN:
743 case PILLAR:
744 case SPAR:
745 Main.main.undoRedo.add(new ChangePropertyCommand(node,
746 "seamark:buoy_lateral:category", "port"));
747 if (getRegion() == IALA_A) {
748 Main.main.undoRedo.add(new ChangePropertyCommand(node,
749 "seamark:buoy_lateral:colour", "red"));
750 colour = "red";
751 } else {
752 Main.main.undoRedo.add(new ChangePropertyCommand(node,
753 "seamark:buoy_lateral:colour", "green"));
754 colour = "green";
755 }
756 break;
757 case PERCH:
758 Main.main.undoRedo.add(new ChangePropertyCommand(node,
759 "seamark:beacon_lateral:category", "port"));
760 break;
761 case BEACON:
762 case TOWER:
763 Main.main.undoRedo.add(new ChangePropertyCommand(node,
764 "seamark:beacon_lateral:category", "port"));
765 if (getRegion() == IALA_A) {
766 Main.main.undoRedo.add(new ChangePropertyCommand(node,
767 "seamark:beacon_lateral:colour", "red"));
768 colour = "red";
769 } else {
770 Main.main.undoRedo.add(new ChangePropertyCommand(node,
771 "seamark:beacon_lateral:colour", "green"));
772 colour = "green";
773 }
774 break;
775 case FLOAT:
776 if (getRegion() == IALA_A) {
777 Main.main.undoRedo.add(new ChangePropertyCommand(node,
778 "seamark:light_float:colour", "red"));
779 colour = "red";
780 } else {
781 Main.main.undoRedo.add(new ChangePropertyCommand(node,
782 "seamark:light_float:colour", "green"));
783 colour = "green";
784 }
785 break;
786 }
787 shape = "cylinder";
788 break;
789
790 case PREF_PORT_HAND:
791 switch (getShape()) {
792 case CAN:
793 super.saveSign("buoy_lateral");
794 Main.main.undoRedo.add(new ChangePropertyCommand(node,
795 "seamark:buoy_lateral:shape", "can"));
796 break;
797 case PILLAR:
798 super.saveSign("buoy_lateral");
799 Main.main.undoRedo.add(new ChangePropertyCommand(node,
800 "seamark:buoy_lateral:shape", "pillar"));
801 break;
802 case SPAR:
803 super.saveSign("buoy_lateral");
804 Main.main.undoRedo.add(new ChangePropertyCommand(node,
805 "seamark:buoy_lateral:shape", "spar"));
806 break;
807 case BEACON:
808 super.saveSign("beacon_lateral");
809 break;
810 case TOWER:
811 super.saveSign("beacon_lateral");
812 Main.main.undoRedo.add(new ChangePropertyCommand(node,
813 "seamark:beacon_lateral:shape", "tower"));
814 break;
815 case FLOAT:
816 super.saveSign("light_float");
817 break;
818 default:
819 }
820 switch (getShape()) {
821 case CAN:
822 case PILLAR:
823 case SPAR:
824 Main.main.undoRedo.add(new ChangePropertyCommand(node,
825 "seamark:buoy_lateral:category", "preferred_channel_port"));
826 Main.main.undoRedo.add(new ChangePropertyCommand(node,
827 "seamark:buoy_lateral:colour_pattern", "horizontal stripes"));
828 if (getRegion() == IALA_A) {
829 Main.main.undoRedo.add(new ChangePropertyCommand(node,
830 "seamark:buoy_lateral:colour", "red;green;red"));
831 colour = "red";
832 } else {
833 Main.main.undoRedo.add(new ChangePropertyCommand(node,
834 "seamark:buoy_lateral:colour", "green;red;green"));
835 colour = "green";
836 }
837 break;
838 case BEACON:
839 case TOWER:
840 Main.main.undoRedo.add(new ChangePropertyCommand(node,
841 "seamark:beacon_lateral:category", "preferred_channel_port"));
842 Main.main.undoRedo.add(new ChangePropertyCommand(node,
843 "seamark:beacon_lateral:colour_pattern", "horizontal stripes"));
844 if (getRegion() == IALA_A) {
845 Main.main.undoRedo.add(new ChangePropertyCommand(node,
846 "seamark:beacon_lateral:colour", "red;green;red"));
847 colour = "red";
848 } else {
849 Main.main.undoRedo.add(new ChangePropertyCommand(node,
850 "seamark:beacon_lateral:colour", "green;red;green"));
851 colour = "green";
852 }
853 break;
854 case FLOAT:
855 Main.main.undoRedo.add(new ChangePropertyCommand(node,
856 "seamark:light_float:colour_pattern", "horizontal stripes"));
857 if (getRegion() == IALA_A) {
858 Main.main.undoRedo.add(new ChangePropertyCommand(node,
859 "seamark:light_float:colour", "red;green;red"));
860 colour = "red";
861 } else {
862 Main.main.undoRedo.add(new ChangePropertyCommand(node,
863 "seamark:light_float:colour", "green;red;green"));
864 colour = "green";
865 }
866 break;
867 }
868 shape = "cylinder";
869 break;
870
871 case STARBOARD_HAND:
872 switch (getShape()) {
873 case CONE:
874 super.saveSign("buoy_lateral");
875 Main.main.undoRedo.add(new ChangePropertyCommand(node,
876 "seamark:buoy_lateral:shape", "conical"));
877 break;
878 case PILLAR:
879 super.saveSign("buoy_lateral");
880 Main.main.undoRedo.add(new ChangePropertyCommand(node,
881 "seamark:buoy_lateral:shape", "pillar"));
882 break;
883 case SPAR:
884 super.saveSign("buoy_lateral");
885 Main.main.undoRedo.add(new ChangePropertyCommand(node,
886 "seamark:buoy_lateral:shape", "spar"));
887 break;
888 case BEACON:
889 super.saveSign("beacon_lateral");
890 Main.main.undoRedo.add(new ChangePropertyCommand(node,
891 "seamark:beacon_lateral:shape", "stake"));
892 break;
893 case TOWER:
894 super.saveSign("beacon_lateral");
895 Main.main.undoRedo.add(new ChangePropertyCommand(node,
896 "seamark:beacon_lateral:shape", "tower"));
897 break;
898 case FLOAT:
899 super.saveSign("light_float");
900 break;
901 case PERCH:
902 super.saveSign("beacon_lateral");
903 Main.main.undoRedo.add(new ChangePropertyCommand(node,
904 "seamark:beacon_lateral:shape", "perch"));
905 break;
906 default:
907 }
908 switch (getShape()) {
909 case CAN:
910 case PILLAR:
911 case SPAR:
912 Main.main.undoRedo.add(new ChangePropertyCommand(node,
913 "seamark:buoy_lateral:category", "starboard"));
914 if (getRegion() == IALA_A) {
915 Main.main.undoRedo.add(new ChangePropertyCommand(node,
916 "seamark:buoy_lateral:colour", "green"));
917 colour = "green";
918 } else {
919 Main.main.undoRedo.add(new ChangePropertyCommand(node,
920 "seamark:buoy_lateral:colour", "red"));
921 colour = "red";
922 }
923 break;
924 case BEACON:
925 case TOWER:
926 Main.main.undoRedo.add(new ChangePropertyCommand(node,
927 "seamark:beacon_lateral:category", "starboard"));
928 if (getRegion() == IALA_A) {
929 Main.main.undoRedo.add(new ChangePropertyCommand(node,
930 "seamark:beacon_lateral:colour", "green"));
931 colour = "green";
932 } else {
933 Main.main.undoRedo.add(new ChangePropertyCommand(node,
934 "seamark:beacon_lateral:colour", "red"));
935 colour = "red";
936 }
937 break;
938 case FLOAT:
939 if (getRegion() == IALA_A) {
940 Main.main.undoRedo.add(new ChangePropertyCommand(node,
941 "seamark:light_float:colour", "green"));
942 colour = "green";
943 } else {
944 Main.main.undoRedo.add(new ChangePropertyCommand(node,
945 "seamark:light_float:colour", "red"));
946 colour = "red";
947 }
948 break;
949 case PERCH:
950 Main.main.undoRedo.add(new ChangePropertyCommand(node,
951 "seamark:beacon_lateral:category", "starboard"));
952 break;
953 }
954 shape = "cone, point up";
955 break;
956
957 case PREF_STARBOARD_HAND:
958 switch (getShape()) {
959 case CONE:
960 super.saveSign("buoy_lateral");
961 Main.main.undoRedo.add(new ChangePropertyCommand(node,
962 "seamark:buoy_lateral:shape", "conical"));
963 break;
964 case PILLAR:
965 super.saveSign("buoy_lateral");
966 Main.main.undoRedo.add(new ChangePropertyCommand(node,
967 "seamark:buoy_lateral:shape", "pillar"));
968 break;
969 case SPAR:
970 super.saveSign("buoy_lateral");
971 Main.main.undoRedo.add(new ChangePropertyCommand(node,
972 "seamark:buoy_lateral:shape", "spar"));
973 break;
974 case BEACON:
975 super.saveSign("beacon_lateral");
976 Main.main.undoRedo.add(new ChangePropertyCommand(node,
977 "seamark:beacon_lateral:shape", "stake"));
978 break;
979 case TOWER:
980 super.saveSign("beacon_lateral");
981 Main.main.undoRedo.add(new ChangePropertyCommand(node,
982 "seamark:beacon_lateral:shape", "tower"));
983 break;
984 case FLOAT:
985 super.saveSign("light_float");
986 break;
987 default:
988 }
989 switch (getShape()) {
990 case CAN:
991 case PILLAR:
992 case SPAR:
993 Main.main.undoRedo.add(new ChangePropertyCommand(node,
994 "seamark:buoy_lateral:category", "preferred_channel_starboard"));
995 Main.main.undoRedo.add(new ChangePropertyCommand(node,
996 "seamark:buoy_lateral:colour_pattern", "horizontal stripes"));
997 if (getRegion() == IALA_A) {
998 Main.main.undoRedo.add(new ChangePropertyCommand(node,
999 "seamark:buoy_lateral:colour", "green;red;green"));
1000 colour = "green";
1001 } else {
1002 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1003 "seamark:buoy_lateral:colour", "red;green;red"));
1004 colour = "red";
1005 }
1006 break;
1007 case BEACON:
1008 case TOWER:
1009 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1010 "seamark:beacon_lateral:category", "preferred_channel_starboard"));
1011 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1012 "seamark:beacon_lateral:colour_pattern", "horizontal stripes"));
1013 if (getRegion() == IALA_A) {
1014 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1015 "seamark:beacon_lateral:colour", "green;red;green"));
1016 colour = "green";
1017 } else {
1018 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1019 "seamark:beacon_lateral:colour", "red;green;red"));
1020 colour = "red";
1021 }
1022 break;
1023 case FLOAT:
1024 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1025 "seamark:light_float:colour_pattern", "horizontal stripes"));
1026 if (getRegion() == IALA_A) {
1027 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1028 "seamark:light_float:colour", "green;red;green"));
1029 colour = "green";
1030 } else {
1031 Main.main.undoRedo.add(new ChangePropertyCommand(node,
1032 "seamark:light_float:colour", "red;green;red"));
1033 colour = "red";
1034 }
1035 break;
1036 }
1037 shape = "cone, point up";
1038 break;
1039
1040 default:
1041 }
1042 saveTopMarkData(shape, colour);
1043 saveLightData();
1044 saveRadarFogData();
1045
1046 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A");
1047 }
1048}
Note: See TracBrowser for help on using the repository browser.