Changeset 26547 in osm
- Timestamp:
- 2011-08-18T16:13:31+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r26297 r26547 30 30 public JTextField nameBox = null; 31 31 private JButton saveButton = null; 32 private ActionListener alSave = null; 32 33 public ButtonGroup typeButtons = null; 33 34 public JRadioButton chanButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/ChanButton.png"))); … … 240 241 saveButton.setText(tr("Save")); 241 242 this.add(saveButton, null); 243 alSave = new ActionListener() { 244 public void actionPerformed(java.awt.event.ActionEvent e) { 245 if (dlg.mark != null) { 246 dlg.mark.saveSign(dlg.node); 247 } 248 } 249 }; 250 saveButton.addActionListener(alSave); 242 251 } 243 252 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r26546 r26547 118 118 119 119 public enum Grp { 120 LAT, CAR, SAW, ISD, SPP, FLT, LIT, SIS120 NUL, LAT, CAR, SAW, ISD, SPP, FLT, LIT, SIS 121 121 } 122 122 123 123 public static final EnumMap<Obj, Grp> GrpMAP = new EnumMap<Obj, Grp>(Obj.class); 124 124 static { 125 GrpMAP.put(Obj.UNKNOWN, Grp.NUL); 125 126 GrpMAP.put(Obj.BCNCAR, Grp.CAR); 126 127 GrpMAP.put(Obj.BCNISD, Grp.ISD); … … 181 182 ShpMAP.put(Shp.CAN, "can"); 182 183 ShpMAP.put(Shp.CONE, "conical"); 183 ShpMAP.put(Shp.SPHERE, "spheri al");184 ShpMAP.put(Shp.SPHERE, "spherical"); 184 185 ShpMAP.put(Shp.BARREL, "barrel"); 185 186 ShpMAP.put(Shp.FLOAT, "float"); … … 197 198 } 198 199 199 public void setShape(Shp s tyl) {200 shape = s tyl;200 public void setShape(Shp shp) { 201 shape = shp; 201 202 } 202 203 … … 230 231 case BEACON: 231 232 case FLOAT: 232 return bodyColour.get(i); 233 if (i < bodyColour.size()) 234 return bodyColour.get(i); 235 break; 233 236 case TOPMARK: 234 return topColour.get(i); 237 if (i < topColour.size()) 238 return topColour.get(i); 239 break; 235 240 case DAYMARK: 236 return dayColour.get(i); 241 if (i < dayColour.size()) 242 return dayColour.get(i); 243 break; 237 244 case LIGHT: 238 return lightColour.get(i); 245 if (i < lightColour.size()) 246 return lightColour.get(i); 247 break; 239 248 } 240 249 return Col.UNKNOWN; … … 593 602 } 594 603 } 595 } 604 } if (getShape() == Shp.UNKNOWN) { 605 if (EntMAP.get(getObject()) == Ent.BEACON) 606 setShape(Shp.BEACON); 607 if (EntMAP.get(getObject()) == Ent.FLOAT) 608 setShape(Shp.FLOAT); 609 } 610 596 611 597 612 for (Obj obj : ObjMAP.keySet()) { … … 622 637 623 638 switch (GrpMAP.get(dlg.mark.getObject())) { 639 case NUL: 640 dlg.panelMain.clearSelections(); 641 break; 624 642 case LAT: 625 643 dlg.panelMain.chanButton.doClick(); … … 653 671 dlg.panelMain.lightsButton.doClick(); 654 672 break; 673 case FLT: 674 switch (getColour(Ent.FLOAT, 0)) { 675 case RED: 676 dlg.panelMain.chanButton.doClick(); 677 if (getColour(Ent.FLOAT, 1) == Col.WHITE) 678 dlg.panelMain.panelChan.safeWaterButton.doClick(); 679 else if (getColour(Ent.FLOAT, 1) == Col.GREEN) 680 if (getRegion().equals("B")) 681 dlg.panelMain.panelChan.prefStbdButton.doClick(); 682 else 683 dlg.panelMain.panelChan.prefPortButton.doClick(); 684 if (getRegion().equals("B")) 685 dlg.panelMain.panelChan.stbdButton.doClick(); 686 else 687 dlg.panelMain.panelChan.portButton.doClick(); 688 break; 689 case GREEN: 690 dlg.panelMain.chanButton.doClick(); 691 if (getColour(Ent.FLOAT, 1) == Col.RED) 692 if (getRegion().equals("B")) 693 dlg.panelMain.panelChan.prefPortButton.doClick(); 694 else 695 dlg.panelMain.panelChan.prefStbdButton.doClick(); 696 if (getRegion().equals("B")) 697 dlg.panelMain.panelChan.portButton.doClick(); 698 else 699 dlg.panelMain.panelChan.stbdButton.doClick(); 700 break; 701 case BLACK: 702 dlg.panelMain.hazButton.doClick(); 703 break; 704 case YELLOW: 705 if (getColour(Ent.FLOAT, 1) == Col.BLACK) 706 dlg.panelMain.hazButton.doClick(); 707 else 708 dlg.panelMain.specButton.doClick(); 709 break; 710 } 711 break; 655 712 } 656 713 … … 669 726 670 727 String imgStr = "/images/"; 671 switch ( dlg.mark.getShape()) {728 switch (getShape()) { 672 729 case TOWER: 673 730 imgStr += "Tower"; … … 689 746 break; 690 747 case FLOAT: 691 imgStr += "Float _Minor";748 imgStr += "Float"; 692 749 break; 693 750 case BEACON: … … 699 756 case STAKE: 700 757 imgStr += "Stake"; 701 break;702 case PERCH:703 imgStr += "Perch";704 758 break; 705 759 default: … … 738 792 imgStr += "_Black"; 739 793 break; 794 } 795 } 796 if (getShape() == Shp.PERCH) { 797 if (getCategory() == Cat.LAT_PORT) { 798 imgStr = "/images/Perch_Port"; 799 } else { 800 imgStr = "/images/Perch_Starboard"; 740 801 } 741 802 } … … 755 816 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A")); 756 817 757 // for (String str : node.getKeys().keySet()) { 758 // if (str.contains("seamark")) 759 // if (!str.equals("seamark")) { 760 // Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 761 // } 762 // } 818 for (String str : node.getKeys().keySet()) { 819 if (str.matches("^seamark:")) 820 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 821 } 763 822 764 823 if (!name.isEmpty()) … … 788 847 */} 789 848 790 String str = TopMAP.get(topShape);849 /* String str = TopMAP.get(topShape); 791 850 if (str != null) { 792 851 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", str)); … … 856 915 * i + ":sector_end", Bearing2[i])); } } 857 916 */ 858 if (hasRadar()) {917 /* if (hasRadar()) { 859 918 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes")); 860 919 } … … 907 966 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:period", getFogPeriod())); 908 967 } 909 }968 */ } 910 969 911 970 }
Note:
See TracChangeset
for help on using the changeset viewer.