Changeset 26423 in osm
- Timestamp:
- 2011-07-31T17:26:07+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src
- Files:
-
- 255 added
- 165 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r26173 r26423 49 49 node = null; 50 50 mark = null; 51 panelMain.clearSelections();52 51 manager.showVisualMessage(Messages.getString("SelectNode")); 53 52 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r26297 r26423 78 78 panelPort.setVisible(true); 79 79 panelPort.perchButton.setVisible(true); 80 panelPort.stakeButton.setVisible(true); 80 81 } else { 81 82 portButton.setBorderPainted(false); … … 100 101 panelPort.setVisible(true); 101 102 panelPort.perchButton.setVisible(false); 103 panelPort.stakeButton.setVisible(false); 104 if (dlg.mark.getShape() == Shp.PERCH || dlg.mark.getShape() == Shp.STAKE) { 105 dlg.mark.setShape(Shp.UNKNOWN); 106 panelPort.clearSelections(); 107 } 102 108 } else { 103 109 prefPortButton.setBorderPainted(false); … … 142 148 panelStbd.setVisible(true); 143 149 panelStbd.perchButton.setVisible(true); 150 panelStbd.stakeButton.setVisible(true); 144 151 } else { 145 152 stbdButton.setBorderPainted(false); … … 164 171 panelStbd.setVisible(true); 165 172 panelStbd.perchButton.setVisible(false); 173 panelStbd.stakeButton.setVisible(false); 174 if (dlg.mark.getShape() == Shp.PERCH || dlg.mark.getShape() == Shp.STAKE) { 175 dlg.mark.setShape(Shp.UNKNOWN); 176 panelStbd.clearSelections(); 177 } 166 178 } else { 167 179 prefStbdButton.setBorderPainted(false); … … 189 201 panelSaw.setVisible(false); 190 202 } 191 if (dlg.mark != null)192 dlg.mark.paintSign();193 203 } 194 204 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r26268 r26423 86 86 isolButton.setBorderPainted(false); 87 87 } 88 if (dlg.mark != null)89 dlg.mark.paintSign();90 88 } 91 89 }; … … 117 115 button.setBorderPainted(false); 118 116 } 119 if (dlg.mark != null)120 dlg.mark.paintSign();121 117 } 122 118 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLights.java
r26173 r26423 40 40 button.setBorderPainted(false); 41 41 } 42 if (dlg.mark != null)43 dlg.mark.paintSign();44 42 } 45 43 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java
r26297 r26423 87 87 panelSector.setVisible(false); 88 88 } 89 dlg.mark.paintSign();90 89 } 91 90 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r26297 r26423 58 58 public JRadioButton towerButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TowerButton.png"))); 59 59 public JRadioButton perchButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PerchPButton.png"))); 60 public JRadioButton stakeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/StakeButton.png"))); 60 61 public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class); 61 62 public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class); … … 71 72 button.setBorderPainted(false); 72 73 } 73 if (dlg.mark != null) 74 dlg.mark.paintSign(); 74 dlg.mark.paintSign(); 75 75 } 76 76 }; … … 85 85 this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYLAT), null); 86 86 this.add(getShapeButton(canButton, 0, 64, 34, 32, "Can", Shp.CAN, Obj.BOYLAT), null); 87 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj. LITFLT), null);88 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj. LITFLT), null);87 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYLAT), null); 88 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.FLTLAT), null); 89 89 this.add(getShapeButton(beaconButton, 35, 0, 34, 32, "Beacon", Shp.BEACON, Obj.BCNLAT), null); 90 90 this.add(getShapeButton(towerButton, 35, 32, 34, 32, "Tower", Shp.TOWER, Obj.BCNLAT), null); 91 91 this.add(getShapeButton(perchButton, 35, 64, 34, 32, "Perch", Shp.PERCH, Obj.BCNLAT), null); 92 this.add(getShapeButton(stakeButton, 35, 96, 34, 32, "Stake", Shp.STAKE, Obj.BCNLAT), null); 92 93 } 93 94 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSaw.java
r26173 r26423 25 25 public JRadioButton sparButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/SparButton.png"))); 26 26 public JRadioButton sphereButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/SphereButton.png"))); 27 public JRadioButton barrelButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BarrelButton.png")));28 27 public JRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/FloatButton.png"))); 28 public JRadioButton beaconButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BeaconButton.png"))); 29 29 public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class); 30 30 public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class); … … 40 40 button.setBorderPainted(false); 41 41 } 42 if (dlg.mark != null) 43 dlg.mark.paintSign(); 42 dlg.mark.paintSign(); 44 43 } 45 44 }; … … 51 50 this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYSAW), null); 52 51 this.add(getShapeButton(sphereButton, 0, 64, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYSAW), null); 53 this.add(getShapeButton( barrelButton, 0, 96, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSAW), null);54 this.add(getShapeButton( floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT), null);52 this.add(getShapeButton(floatButton, 0, 96, 34, 32, "Float", Shp.FLOAT, Obj.FLTSAW), null); 53 this.add(getShapeButton(beaconButton, 0, 128, 34, 32, "Beacon", Shp.BEACON, Obj.FLTSAW), null); 55 54 } 56 55 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java
r26173 r26423 47 47 button.setBorderPainted(false); 48 48 } 49 if (dlg.mark != null)50 dlg.mark.paintSign();51 49 } 52 50 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r26298 r26423 58 58 public JRadioButton towerButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TowerButton.png"))); 59 59 public JRadioButton perchButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PerchSButton.png"))); 60 public JRadioButton stakeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/StakeButton.png"))); 60 61 public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class); 61 62 public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class); … … 67 68 dlg.mark.setShape(shp); 68 69 dlg.mark.setObject(objects.get(shp)); 69 switch (shp) {70 case UNKNOWN:71 dlg.panelMain.shapeIcon.setIcon(null);72 case PILLAR:73 // *************74 dlg.panelMain.topButton.setEnabled(true);75 dlg.panelMain.fogButton.setEnabled(true);76 dlg.panelMain.radButton.setEnabled(true);77 dlg.panelMain.litButton.setEnabled(true);78 // *************79 switch (dlg.mark.getRegion()) {80 case A:81 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_green.png")));82 break;83 case B:84 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_red.png")));85 break;86 case C:87 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_green_white_green_white.png")));88 break;89 }90 break;91 case SPAR:92 switch (dlg.mark.getRegion()) {93 case A:94 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_green.png")));95 break;96 case B:97 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_red.png")));98 break;99 case C:100 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_green_white_green_white.png")));101 break;102 }103 break;104 }105 70 button.setBorderPainted(true); 106 71 } else 107 72 button.setBorderPainted(false); 108 73 } 109 if (dlg.mark != null) 110 dlg.mark.paintSign(); 74 dlg.mark.paintSign(); 111 75 } 112 76 }; … … 121 85 this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYLAT), null); 122 86 this.add(getShapeButton(coneButton, 0, 64, 34, 32, "Cone", Shp.CONE, Obj.BOYLAT), null); 123 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj. LITFLT), null);124 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj. LITFLT), null);87 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYLAT), null); 88 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.FLTLAT), null); 125 89 this.add(getShapeButton(beaconButton, 35, 0, 34, 32, "Beacon", Shp.BEACON, Obj.BCNLAT), null); 126 90 this.add(getShapeButton(towerButton, 35, 32, 34, 32, "Tower", Shp.TOWER, Obj.BCNLAT), null); 127 91 this.add(getShapeButton(perchButton, 35, 64, 34, 32, "Perch", Shp.PERCH, Obj.BCNLAT), null); 92 this.add(getShapeButton(stakeButton, 35, 96, 34, 32, "Stake", Shp.STAKE, Obj.BCNLAT), null); 128 93 } 129 94 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r26297 r26423 25 25 dlg = dia; 26 26 } 27 27 28 28 public enum Reg { 29 29 A, B, C … … 51 51 52 52 public enum Obj { 53 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, LITMAJ, LITMIN, LITFLT, LITVES, LNDMRK, MORFAC, SIGSTA 53 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP, LITMAJ, LITMIN, LITFLT, LITVES, LNDMRK, MORFAC, SIGSTA 54 54 } 55 55 … … 67 67 ObjMAP.put(Obj.BOYSAW, "buoy_safe_water"); 68 68 ObjMAP.put(Obj.BOYSPP, "buoy_special_purpose"); 69 ObjMAP.put(Obj.FLTCAR, "light_float"); 70 ObjMAP.put(Obj.FLTLAT, "light_float"); 71 ObjMAP.put(Obj.FLTSAW, "light_float"); 72 ObjMAP.put(Obj.FLTSPP, "light_float"); 69 73 ObjMAP.put(Obj.LITMAJ, "light_major"); 70 74 ObjMAP.put(Obj.LITMIN, "light_minor"); … … 235 239 case DAYMARK: 236 240 return dayColour; 237 //case LIGHT:238 //return light.getLightColour();241 // case LIGHT: 242 // return light.getLightColour(); 239 243 } 240 244 return Col.UNKNOWN; … … 255 259 dayColour = col; 256 260 break; 257 //case LIGHT:258 //light.setLightColour(col);259 //break;261 // case LIGHT: 262 // light.setLightColour(col); 263 // break; 260 264 } 261 265 } … … 413 417 414 418 public Light light = new Light(dlg); 415 419 416 420 private boolean paintlock = false; 417 421 418 422 public void parseMark(Node node) { 419 region = Main.pref.get("tomsplugin.IALA").equals("A") ? Reg.A : Reg.B; 420 paintlock = true; 423 region = Main.pref.get("smedplugin.IALA").equals("C") ? Reg.C : (Main.pref.get("smedplugin.IALA").equals("B") ? Reg.B : Reg.A); 421 424 dlg.panelMain.clearSelections(); 422 425 dlg.manager.showVisualMessage(""); … … 435 438 436 439 if (typeStr.equals("light_float") || typeStr.equals("") || keys.containsKey("seamark:light_float:colour") 437 440 || keys.containsKey("seamark:light_float:colour_pattern")) { 438 441 if (keys.containsKey("seamark:light_float:colour_pattern")) { 439 442 setObject(Obj.LITFLT); … … 445 448 setObject(Obj.BOYLAT); 446 449 } else if (colStr.equals("black;yellow") || colStr.equals("black;yellow;black") || colStr.equals("yellow;black") 447 450 || colStr.equals("yellow;black;yellow")) { 448 451 setObject(Obj.BOYCAR); 449 452 } else if (colStr.equals("black;red;black")) { … … 459 462 if (typeStr.equals("")) { 460 463 if (keys.containsKey("seamark:buoy_lateral:category") || keys.containsKey("seamark:buoy_lateral:shape") 461 464 || keys.containsKey("seamark:buoy_lateral:colour")) { 462 465 setObject(Obj.BOYLAT); 463 466 typeStr = "buoy_lateral"; 464 467 } else if (keys.containsKey("seamark:beacon_lateral:category") || keys.containsKey("seamark:beacon_lateral:shape") 465 468 || keys.containsKey("seamark:beacon_lateral:colour")) { 466 469 setObject(Obj.BCNLAT); 467 470 typeStr = "beacon_lateral"; 468 471 } else if (keys.containsKey("seamark:buoy_cardinal:category") || keys.containsKey("seamark:buoy_cardinal:shape") 469 472 || keys.containsKey("seamark:buoy_cardinal:colour")) { 470 473 setObject(Obj.BOYCAR); 471 474 typeStr = "buoy_cardinal"; 472 475 } else if (keys.containsKey("seamark:beacon_cardinal:category") || keys.containsKey("seamark:beacon_cardinal:shape") 473 476 || keys.containsKey("seamark:beacon_cardinal:colour")) { 474 477 setObject(Obj.BCNCAR); 475 478 typeStr = "beacon_cardinal"; 476 479 } else if (keys.containsKey("seamark:buoy_isolated_danger:category") 477 480 || keys.containsKey("seamark:buoy_isolated_danger:shape") || keys.containsKey("seamark:buoy_isolated_danger:colour")) { 478 481 setObject(Obj.BOYISD); 479 482 typeStr = "buoy_isolated_danger"; 480 483 } else if (keys.containsKey("seamark:beacon_isolated_danger:category") 481 482 484 || keys.containsKey("seamark:beacon_isolated_danger:shape") 485 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { 483 486 setObject(Obj.BCNISD); 484 487 typeStr = "beacon_isolated_danger"; 485 488 } else if (keys.containsKey("seamark:buoy_safe_water:category") || keys.containsKey("seamark:buoy_safe_water:shape") 486 489 || keys.containsKey("seamark:buoy_safe_water:colour")) { 487 490 setObject(Obj.BOYSAW); 488 491 typeStr = "buoy_safe_water"; 489 492 } else if (keys.containsKey("seamark:beacon_safe_water:category") || keys.containsKey("seamark:beacon_safe_water:shape") 490 493 || keys.containsKey("seamark:beacon_safe_water:colour")) { 491 494 setObject(Obj.BCNSAW); 492 495 typeStr = "beacon_safe_water"; 493 496 } else if (keys.containsKey("seamark:buoy_special_purpose:category") 494 497 || keys.containsKey("seamark:buoy_special_purpose:shape") || keys.containsKey("seamark:buoy_special_purpose:colour")) { 495 498 setObject(Obj.BOYSPP); 496 499 typeStr = "buoy_special_purpose"; 497 500 } else if (keys.containsKey("seamark:beacon_special_purpose:category") 498 499 501 || keys.containsKey("seamark:beacon_special_purpose:shape") 502 || keys.containsKey("seamark:beacon_special_purpose:colour")) { 500 503 setObject(Obj.BCNSPP); 501 504 typeStr = "beacon_special_purpose"; … … 512 515 colStr = keys.get("seamark:" + typeStr + ":colour"); 513 516 for (Col col : ColMAP.keySet()) 514 if (ColMAP.get(col).equals(colStr)) setColour(Ent.BODY, col); 517 if (ColMAP.get(col).equals(colStr)) 518 setColour(Ent.BODY, col); 515 519 516 520 if (keys.containsKey("seamark:" + typeStr + ":name")) { … … 634 638 else if (typeStr.equals("light_float")) 635 639 str = "float"; 636 else str = ""; 640 else 641 str = ""; 637 642 if ((str.isEmpty() && (EntMAP.get(getObject()) == Ent.BEACON)) || str.equals("stake")) 638 643 str = "beacon"; … … 677 682 str = keys.get("seamark:topmark:shape"); 678 683 } 679 /* 680 for (Map.Entry<String, String> entry : keys.entrySet()) { 681 String key = entry.getKey(); 682 String value = entry.getValue().trim(); 683 if (key.contains("seamark:light:")) { 684 light.setFired(true); 685 int index = 0; 686 key = key.substring(14); 687 if (key.matches("^\\d:.*")) { 688 index = key.charAt(0) - '0'; 689 key = key.substring(2); 690 } else if (key.matches("^\\d$")) { 691 index = key.charAt(0) - '0'; 692 String values[] = value.split(":"); 693 if (values[0].equals("red")) 694 lightColour[index] = Col.RED; 695 else if (values[0].equals("green")) 696 lightColour[index] = Col.GREEN; 697 else if (values[0].equals("white")) 698 lightColour[index] = Col.WHITE; 699 if (values.length > 1) 700 Bearing1[index] = values[1]; 701 if (values.length > 2) 702 Bearing2[index] = values[2]; 703 } else { 704 index = 0; 705 } 706 if (index != 0) 707 setSectored(true); 708 if (key.equals("colour")) { 709 if (value.equals("red")) 710 lightColour[index] = Col.RED; 711 else if (value.equals("green")) 712 lightColour[index] = Col.GREEN; 713 else if (value.equals("white")) 714 lightColour[index] = Col.WHITE; 715 } else if (key.equals("character")) { 716 LightChar[index] = value; 717 } else if (key.equals("group")) { 718 LightGroup[index] = value; 719 } else if (key.equals("period")) { 720 LightPeriod[index] = value; 721 } else if (key.equals("height")) { 722 Height[index] = value; 723 } else if (key.equals("range")) { 724 Range[index] = value; 725 } 726 } 727 } 728 */ 684 /* 685 * for (Map.Entry<String, String> entry : keys.entrySet()) { String key = 686 * entry.getKey(); String value = entry.getValue().trim(); if 687 * (key.contains("seamark:light:")) { light.setFired(true); int index = 0; 688 * key = key.substring(14); if (key.matches("^\\d:.*")) { index = 689 * key.charAt(0) - '0'; key = key.substring(2); } else if 690 * (key.matches("^\\d$")) { index = key.charAt(0) - '0'; String values[] = 691 * value.split(":"); if (values[0].equals("red")) lightColour[index] = 692 * Col.RED; else if (values[0].equals("green")) lightColour[index] = 693 * Col.GREEN; else if (values[0].equals("white")) lightColour[index] = 694 * Col.WHITE; if (values.length > 1) Bearing1[index] = values[1]; if 695 * (values.length > 2) Bearing2[index] = values[2]; } else { index = 0; } if 696 * (index != 0) setSectored(true); if (key.equals("colour")) { if 697 * (value.equals("red")) lightColour[index] = Col.RED; else if 698 * (value.equals("green")) lightColour[index] = Col.GREEN; else if 699 * (value.equals("white")) lightColour[index] = Col.WHITE; } else if 700 * (key.equals("character")) { LightChar[index] = value; } else if 701 * (key.equals("group")) { LightGroup[index] = value; } else if 702 * (key.equals("period")) { LightPeriod[index] = value; } else if 703 * (key.equals("height")) { Height[index] = value; } else if 704 * (key.equals("range")) { Range[index] = value; } } } 705 */ 729 706 if (keys.containsKey("seamark:fog_signal") || keys.containsKey("seamark:fog_signal:category") 730 707 || keys.containsKey("seamark:fog_signal:group") || keys.containsKey("seamark:fog_signal:period")) { 731 708 setFog(true); 732 709 if (keys.containsKey("seamark:fog_signal:category")) { … … 756 733 757 734 if (keys.containsKey("seamark:radar_transponder") || keys.containsKey("seamark:radar_transponder:category") 758 735 || keys.containsKey("seamark:radar_transponder:group")) { 759 736 setRacon(true); 760 737 if (keys.containsKey("seamark:radar_transponder:category")) { … … 773 750 } else if (keys.containsKey("seamark:radar_reflector")) 774 751 setRadar(true); 775 paintlock = false;776 paintSign();777 752 } 778 753 … … 782 757 return; 783 758 759 dlg.panelMain.shapeIcon.setIcon(null); 760 dlg.panelMain.lightIcon.setIcon(null); 761 dlg.panelMain.topIcon.setIcon(null); 762 dlg.panelMain.radarIcon.setIcon(null); 763 dlg.panelMain.fogIcon.setIcon(null); 764 784 765 String imgStr = "/images/"; 785 String shpStr = ShpMAP.get(shape); 786 if (shpStr == null) 787 dlg.panelMain.shapeIcon.setIcon(null); 788 else { 789 imgStr += shpStr; 790 if (shpStr.equals("perch")) { 791 imgStr += (getCategory() == Cat.LAT_PORT ? "_port" : "_stbd"); 766 switch (dlg.mark.getObject()) { 767 case BCNCAR: 768 case BOYCAR: 769 case FLTCAR: 770 switch (dlg.mark.getShape()) { 771 case TOWER: 772 imgStr += "Cardinal_Tower_"; 773 break; 774 case PILLAR: 775 imgStr += "Cardinal_Pillar_"; 776 break; 777 case SPAR: 778 imgStr += "Cardinal_Spar_"; 779 break; 780 case CAN: 781 imgStr += "Cardinal_Can_"; 782 break; 783 case CONE: 784 imgStr += "Cardinal_Cone_"; 785 break; 786 case SPHERE: 787 imgStr += "Cardinal_Sphere_"; 788 break; 789 case FLOAT: 790 imgStr += "Cardinal_Float_"; 791 break; 792 case BEACON: 793 imgStr += "Cardinal_Beacon_"; 794 break; 795 default: 796 if (dlg.mark.getObject() == Obj.BCNCAR) 797 imgStr += "Cardinal_Beacon_"; 798 else 799 imgStr += "Cardinal_Pillar_"; 800 } 801 switch (dlg.mark.getCategory()) { 802 case CARD_NORTH: 803 imgStr += "North.png"; 804 break; 805 case CARD_SOUTH: 806 imgStr += "South.png"; 807 break; 808 case CARD_EAST: 809 imgStr += "East.png"; 810 break; 811 case CARD_WEST: 812 imgStr += "West.png"; 813 break; 814 } 815 break; 816 case BCNLAT: 817 case BOYLAT: 818 case FLTLAT: 819 switch (dlg.mark.getShape()) { 820 case TOWER: 821 imgStr += "Lateral_Tower_"; 822 break; 823 case PILLAR: 824 imgStr += "Lateral_Pillar_"; 825 break; 826 case SPAR: 827 imgStr += "Lateral_Spar_"; 828 break; 829 case CAN: 830 imgStr += "Lateral_Can_"; 831 break; 832 case CONE: 833 imgStr += "Lateral_Cone_"; 834 break; 835 case SPHERE: 836 imgStr += "Lateral_Sphere_"; 837 break; 838 case FLOAT: 839 imgStr += "Lateral_Float_"; 840 break; 841 case BEACON: 842 imgStr += "Lateral_Beacon_"; 843 break; 844 case STAKE: 845 imgStr += "Lateral_Stake_"; 846 break; 847 case PERCH: 848 imgStr += "Lateral_Perch_"; 849 break; 850 default: 851 if (dlg.mark.getObject() == Obj.BCNLAT) 852 imgStr += "Lateral_Beacon_"; 853 else 854 imgStr += "Lateral_Pillar_"; 855 } 856 switch (dlg.mark.getCategory()) { 857 case LAT_PORT: 858 if (getShape() == Shp.PERCH) { 859 imgStr += "Port.png"; 860 break; 861 } 862 switch (getRegion()) { 863 case A: 864 imgStr += "Red.png"; 865 break; 866 case B: 867 imgStr += "Green.png"; 868 break; 869 case C: 870 imgStr += "Red_White_Red_White.png"; 871 break; 872 } 873 break; 874 case LAT_STBD: 875 if (getShape() == Shp.PERCH) { 876 imgStr += "Starboard.png"; 877 break; 878 } 879 switch (getRegion()) { 880 case A: 881 imgStr += "Green.png"; 882 break; 883 case B: 884 imgStr += "Red.png"; 885 break; 886 case C: 887 imgStr += "Green_White_Green_White.png"; 888 break; 889 } 890 break; 891 case LAT_PREF_PORT: 892 if (getShape() == Shp.STAKE || getShape() == Shp.PERCH) { 893 imgStr = "/images/"; 894 break; 895 } 896 switch (getRegion()) { 897 case A: 898 imgStr += "Red_Green_Red.png"; 899 break; 900 case B: 901 imgStr += "Green_Red_Green.png"; 902 break; 903 case C: 904 imgStr = imgStr.replaceFirst("Lateral", "Special_Purpose"); 905 imgStr += "Red_Green_Red_Green.png"; 906 break; 907 } 908 break; 909 case LAT_PREF_STBD: 910 if (getShape() == Shp.STAKE || getShape() == Shp.PERCH) { 911 imgStr = "/images/"; 912 break; 913 } 914 switch (getRegion()) { 915 case A: 916 imgStr += "Green_Red_Green.png"; 917 break; 918 case B: 919 imgStr += "Red_Green_Red.png"; 920 break; 921 case C: 922 imgStr = imgStr.replaceFirst("Lateral", "Special_Purpose"); 923 imgStr += "Red_Green_Red_Green.png"; 924 break; 925 } 926 break; 927 } 928 break; 929 case BCNSAW: 930 case BOYSAW: 931 case FLTSAW: 932 switch (dlg.mark.getShape()) { 933 case PILLAR: 934 imgStr += "Safe_Water_Pillar.png"; 935 break; 936 case SPAR: 937 imgStr += "Safe_Water_Spar.png"; 938 break; 939 case SPHERE: 940 imgStr += "Safe_Water_Sphere.png"; 941 break; 942 case FLOAT: 943 imgStr += "Safe_Water_Float.png"; 944 break; 945 case BEACON: 946 imgStr += "Safe_Water_Beacon.png"; 947 break; 948 default: 949 if (dlg.mark.getObject() == Obj.BCNSAW) 950 imgStr += "Safe_Water_Beacon.png"; 951 else 952 imgStr += "Safe_Water_Pillar.png"; 953 } 954 break; 955 } 956 if (!imgStr.equals("/images/")) { 957 if (getClass().getResource(imgStr) == null) { 958 System.out.println("Missing image: " + imgStr); 959 return; 792 960 } else { 793 String colStr = ColMAP.get(bodyColour);794 if (colStr != null)795 imgStr += ("_" + colStr);796 }797 imgStr += ".png";798 if (getClass().getResource(imgStr) == null)799 System.out.println("Body:" + imgStr);800 else801 961 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 802 } 803 804 if (topShape == Top.NONE) 805 dlg.panelMain.topIcon.setIcon(null); 806 else { 807 imgStr = "/images/top_"; 808 switch (getShape()) { 809 case CAN: 810 case CONE: 811 case SPHERE: 812 case BARREL: 813 imgStr += "il_"; 814 break; 815 case PILLAR: 816 case SPAR: 817 imgStr += "ih_"; 818 break; 819 case FLOAT: 820 case SUPER: 821 imgStr += "vl_"; 822 break; 823 case BEACON: 824 case TOWER: 825 imgStr += "vh_"; 826 break; 827 default: 828 imgStr = null; 829 dlg.panelMain.topIcon.setIcon(null); 830 break; 831 } 832 if (imgStr != null) { 833 imgStr += (TopMAP.get(topShape) + "_"); 834 String colStr = ColMAP.get(topColour); 835 if (colStr != null) 836 imgStr += colStr; 837 imgStr += ".png"; 838 if (getClass().getResource(imgStr) == null) 839 System.out.println("Top:" + imgStr); 840 else 841 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 842 } 843 } 844 /* 845 * if (hasRadar()) { dlg.panelMain.radarIcon.setIcon(new 846 * ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png"))); } 847 * else if (hasRacon()) { dlg.panelMain.radarIcon.setIcon(new 848 * ImageIcon(getClass().getResource("/images/Radar_Station.png"))); // if 849 * (getRaType() != 0) { // String c = (String) 850 * dlg.cbM01Racon.getSelectedItem(); // if ((getRaType() == RATYPE_RACON) && 851 * !getRaconGroup().isEmpty()) // c += ("(" + getRaconGroup() + ")"); // 852 * dlg.lM01RadarMarkeys.setText(c); // } } 853 * 854 * if (hasFog()) { dlg.panelMain.fogIcon.setIcon(new 855 * ImageIcon(getClass().getResource("/images/Fog_Signal.png"))); // if 856 * (getFogSound() != 0) { // String c = (String) 857 * dlg.cbM01Fog.getSelectedItem(); // if (!getFogGroup().isEmpty()) // c += 858 * ("(" + getFogGroup() + ")"); // if (!getFogPeriod().isEmpty()) // c += 859 * (" " + getFogPeriod() + "s"); // dlg.lM01FogMarkeys.setText(c); // } } 860 * 861 * if (isFired()) { String lp, c; String tmp = null; int i1; 862 * 863 * Col col = getColour(Ent.LIGHT); if (col == Col.WHITE) { 864 * dlg.panelMain.lightIcon.setIcon(new 865 * ImageIcon(getClass().getResource("/images/Light_White_120.png"))); } else 866 * if (col == Col.RED) { dlg.panelMain.lightIcon.setIcon(new 867 * ImageIcon(getClass().getResource("/images/Light_Red_120.png"))); } else 868 * if (col == Col.GREEN) { dlg.panelMain.lightIcon.setIcon(new 869 * ImageIcon(getClass().getResource("/images/Light_Green_120.png"))); } else 870 * { dlg.panelMain.lightIcon.setIcon(new 871 * ImageIcon(getClass().getResource("/images/Light_Magenta_120.png"))); } 872 * 873 * c = getLightChar(); if (c.contains("+")) { i1 = c.indexOf("+"); tmp = 874 * c.substring(i1, c.length()); c = c.substring(0, i1); if 875 * (!getLightGroup().isEmpty()) { c = c + "(" + getLightGroup() + ")"; } if 876 * (tmp != null) c = c + tmp; } else if (!getLightGroup().isEmpty()) c = c + 877 * "(" + getLightGroup() + ")"; c = c + " " + getLightColour(); lp = 878 * getLightPeriod(); if (!lp.isEmpty()) c = c + " " + lp + "s"; } 879 */ 962 } 963 } 880 964 } 881 965 882 966 public void saveSign(Node node) { 883 967 884 Main.pref.put(" tomsplugin.IALA", getRegion() == Reg.A ? "A" : "B");885 886 //for (String str : node.getKeys().keySet()) {887 //if (str.contains("seamark"))888 //if (!str.equals("seamark")) {889 //Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));890 //}891 //}892 968 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A")); 969 970 // for (String str : node.getKeys().keySet()) { 971 // if (str.contains("seamark")) 972 // if (!str.equals("seamark")) { 973 // Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 974 // } 975 // } 976 893 977 if (!name.isEmpty()) 894 978 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", name)); … … 941 1025 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:daymark:colour", str)); 942 1026 } 943 /* 944 Col colour; 945 if (isFired()) { 946 if ((colour = lightColour[0]) != Col.UNKNOWN) 947 if (colour == Col.RED) { 948 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "red")); 949 } else if (colour.equals("G")) { 950 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "green")); 951 } else if (colour.equals("W")) { 952 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "white")); 953 } 954 if (!LightPeriod[0].isEmpty()) 955 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0])); 956 if (!LightChar[0].isEmpty()) 957 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:character", LightChar[0])); 958 if (!LightGroup[0].isEmpty()) 959 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:group", LightGroup[0])); 960 if (!Height[0].isEmpty()) 961 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:height", Height[0])); 962 if (!Range[0].isEmpty()) 963 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:range", Range[0])); 964 for (int i = 1; i < 10; i++) { 965 if ((colour = lightColour[i]) != Col.UNKNOWN) 966 // if (colour.equals("R")) { 967 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red")); 968 // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 969 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "red:" + Bearing1[i] + ":" 970 // + Bearing2[i] + ":" + Radius[i])); 971 // } else if (colour.equals("G")) { 972 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "green")); 973 // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 974 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] + ":" 975 // + Bearing2[i] + ":" + Radius[i])); 976 // } else if (colour.equals("W")) { 977 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white")); 978 // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 979 // Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "white:" + Bearing1[i] + ":" 980 // + Bearing2[i] + ":" + Radius[i])); 981 // } 982 if (LightPeriod[i] != null) 983 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":period", LightPeriod[i])); 984 if (LightChar[i] != null) 985 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":character", LightChar[i])); 986 if (LightGroup[i] != null) 987 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":group", LightGroup[i])); 988 if (Height[i] != null) 989 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":height", Height[i])); 990 if (Range[i] != null) 991 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":range", Range[i])); 992 if (Bearing1[i] != null) 993 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_start", Bearing1[i])); 994 if (Bearing2[i] != null) 995 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_end", Bearing2[i])); 996 } 997 }*/ 1027 /* 1028 * Col colour; if (isFired()) { if ((colour = lightColour[0]) != 1029 * Col.UNKNOWN) if (colour == Col.RED) { Main.main.undoRedo.add(new 1030 * ChangePropertyCommand(node, "seamark:light:colour", "red")); } else if 1031 * (colour.equals("G")) { Main.main.undoRedo.add(new 1032 * ChangePropertyCommand(node, "seamark:light:colour", "green")); } else if 1033 * (colour.equals("W")) { Main.main.undoRedo.add(new 1034 * ChangePropertyCommand(node, "seamark:light:colour", "white")); } if 1035 * (!LightPeriod[0].isEmpty()) Main.main.undoRedo.add(new 1036 * ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0])); if 1037 * (!LightChar[0].isEmpty()) Main.main.undoRedo.add(new 1038 * ChangePropertyCommand(node, "seamark:light:character", LightChar[0])); if 1039 * (!LightGroup[0].isEmpty()) Main.main.undoRedo.add(new 1040 * ChangePropertyCommand(node, "seamark:light:group", LightGroup[0])); if 1041 * (!Height[0].isEmpty()) Main.main.undoRedo.add(new 1042 * ChangePropertyCommand(node, "seamark:light:height", Height[0])); if 1043 * (!Range[0].isEmpty()) Main.main.undoRedo.add(new 1044 * ChangePropertyCommand(node, "seamark:light:range", Range[0])); for (int i 1045 * = 1; i < 10; i++) { if ((colour = lightColour[i]) != Col.UNKNOWN) // if 1046 * (colour.equals("R")) { // Main.main.undoRedo.add(new 1047 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red")); // 1048 * if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != 1049 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node, 1050 * "seamark:light:" + i, "red:" + Bearing1[i] + ":" // + Bearing2[i] + ":" + 1051 * Radius[i])); // } else if (colour.equals("G")) { // 1052 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1053 * i + ":colour", "green")); // if ((Bearing1[i] != null) && (Bearing2[i] != 1054 * null) && (Radius[i] != null)) // Main.main.undoRedo.add(new 1055 * ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] 1056 * + ":" // + Bearing2[i] + ":" + Radius[i])); // } else if 1057 * (colour.equals("W")) { // Main.main.undoRedo.add(new 1058 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white")); 1059 * // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != 1060 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node, 1061 * "seamark:light:" + i, "white:" + Bearing1[i] + ":" // + Bearing2[i] + ":" 1062 * + Radius[i])); // } if (LightPeriod[i] != null) 1063 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1064 * i + ":period", LightPeriod[i])); if (LightChar[i] != null) 1065 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1066 * i + ":character", LightChar[i])); if (LightGroup[i] != null) 1067 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1068 * i + ":group", LightGroup[i])); if (Height[i] != null) 1069 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1070 * i + ":height", Height[i])); if (Range[i] != null) 1071 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1072 * i + ":range", Range[i])); if (Bearing1[i] != null) 1073 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1074 * i + ":sector_start", Bearing1[i])); if (Bearing2[i] != null) 1075 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 1076 * i + ":sector_end", Bearing2[i])); } } 1077 */ 998 1078 if (hasRadar()) { 999 1079 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes"));
Note:
See TracChangeset
for help on using the changeset viewer.