Changeset 24830 in osm for applications/editors/josm
- Timestamp:
- 2010-12-21T18:30:26+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24823 r24830 7 7 import java.awt.Dimension; 8 8 import java.util.Collection; 9 import java.util.Iterator;10 9 import java.util.Map; 11 10 … … 35 34 36 35 public SeaMark mark = null; 36 public Node node = null; 37 37 private Collection<? extends OsmPrimitive> Selection = null; 38 private OsmPrimitive SelNode = null;38 private OsmPrimitive lastNode = null; 39 39 40 40 public SelectionChangedListener SmpListener = new SelectionChangedListener() { 41 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 42 Node node = null; 41 public void selectionChanged( 42 Collection<? extends OsmPrimitive> newSelection) { 43 Node nextNode = null; 43 44 Selection = newSelection; 44 45 45 //System.out.println(newSelection);46 // System.out.println(newSelection); 46 47 for (OsmPrimitive osm : Selection) { 47 48 if (osm instanceof Node) { 48 n ode = (Node) osm;49 nextNode = (Node) osm; 49 50 if (Selection.size() == 1) { 50 if (node.compareTo(SelNode) != 0) { 51 SelNode = node; 52 parseSeaMark(); 53 mark.paintSign(); 51 if (nextNode.compareTo(lastNode) != 0) { 52 lastNode = nextNode; 53 parseNode(nextNode); 54 54 } 55 } 55 } else 56 manager.showVisualMessage(Messages.getString("OneNode")); 56 57 } 57 58 } 58 if (n ode == null) {59 if (nextNode == null) { 59 60 panelMain.clearSelections(); 60 SelNode = null; 61 lastNode = null; 62 manager.showVisualMessage(Messages.getString("SelectNode")); 61 63 } 62 64 } … … 88 90 } 89 91 90 private void parseSeaMark() { 91 92 int nodes = 0; 93 Node node = null; 94 Collection<Node> selection = null; 92 private void parseNode(Node newNode) { 93 95 94 Map<String, String> keys; 96 DataSet ds;97 98 ds = Main.main.getCurrentDataSet();99 95 100 96 manager.showVisualMessage(""); 101 if (ds == null) { 102 manager.showVisualMessage(Messages.getString("NoData")); 103 mark = new MarkUkn(this, null); 104 return; 105 } 106 107 selection = ds.getSelectedNodes(); 108 nodes = selection.size(); 109 110 if (nodes == 0) { 111 manager.showVisualMessage(Messages.getString("SelectNode")); 112 mark = new MarkUkn(this, null); 113 return; 114 } 115 116 if (nodes > 1) { 117 manager.showVisualMessage(Messages.getString("OneNode")); 118 mark = new MarkUkn(this, null); 119 return; 120 } 121 97 node = newNode; 122 98 mark = null; 123 124 Iterator<Node> it = selection.iterator();125 node = it.next();126 127 99 String type = ""; 128 100 String str = ""; … … 133 105 type = keys.get("seamark:type"); 134 106 if (type.equals("buoy_lateral") || type.equals("beacon_lateral")) { 135 mark = new MarkLat(this , node);107 mark = new MarkLat(this); 136 108 } else if (type.equals("buoy_cardinal") 137 109 || type.equals("beacon_cardinal")) { 138 mark = new MarkCard(this , node);110 mark = new MarkCard(this); 139 111 } else if (type.equals("buoy_safe_water") 140 112 || type.equals("beacon_safe_water")) { 141 mark = new MarkSaw(this , node);113 mark = new MarkSaw(this); 142 114 } else if (type.equals("buoy_special_purpose") 143 115 || type.equals("beacon_special_purpose")) { 144 mark = new MarkSpec(this , node);116 mark = new MarkSpec(this); 145 117 } else if (type.equals("buoy_isolated_danger") 146 118 || type.equals("beacon_isolated_danger")) { 147 mark = new MarkIsol(this , node);119 mark = new MarkIsol(this); 148 120 } else if (type.equals("landmark") || type.equals("light_vessel") 149 121 || type.equals("light_major") || type.equals("light_minor")) { 150 mark = new MarkLight(this , node);122 mark = new MarkLight(this); 151 123 } else if (type.equals("light_float")) { 152 124 if (keys.containsKey("seamark:light_float:colour")) { … … 155 127 || str.equals("red;green;red") 156 128 || str.equals("green;red;green")) { 157 mark = new MarkLat(this , node);129 mark = new MarkLat(this); 158 130 } else if (str.equals("black;yellow") 159 131 || str.equals("black;yellow;black") 160 132 || str.equals("yellow;black") 161 133 || str.equals("yellow;black;yellow")) { 162 mark = new MarkCard(this , node);134 mark = new MarkCard(this); 163 135 } else if (str.equals("black;red;black")) { 164 mark = new MarkIsol(this , node);136 mark = new MarkIsol(this); 165 137 } else if (str.equals("red;white")) { 166 mark = new MarkSaw(this , node);138 mark = new MarkSaw(this); 167 139 } else if (str.equals("yellow")) { 168 mark = new MarkSpec(this , node);140 mark = new MarkSpec(this); 169 141 } 170 142 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { 171 143 str = keys.get("seamark:light_float:topmark:shape"); 172 144 if (str.equals("cylinder") || str.equals("cone, point up")) { 173 mark = new MarkLat(this , node);145 mark = new MarkLat(this); 174 146 } 175 147 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { 176 148 str = keys.get("seamark:light_float:topmark:colour"); 177 149 if (str.equals("red") || str.equals("green")) { 178 mark = new MarkLat(this , node);150 mark = new MarkLat(this); 179 151 } 180 152 } 181 153 } else if (keys.containsKey("buoy_lateral:category") 182 154 || keys.containsKey("beacon_lateral:category")) { 183 mark = new MarkLat(this , node);155 mark = new MarkLat(this); 184 156 } else if (keys.containsKey("buoy_cardinal:category") 185 157 || keys.containsKey("beacon_cardinal:category")) { 186 mark = new MarkCard(this , node);158 mark = new MarkCard(this); 187 159 } else if (keys.containsKey("buoy_isolated_danger:category") 188 160 || keys.containsKey("beacon_isolated_danger:category")) { 189 mark = new MarkIsol(this , node);161 mark = new MarkIsol(this); 190 162 } else if (keys.containsKey("buoy_safe_water:category") 191 163 || keys.containsKey("beacon_safe_water:category")) { 192 mark = new MarkSaw(this , node);164 mark = new MarkSaw(this); 193 165 } else if (keys.containsKey("buoy_special_purpose:category") 194 166 || keys.containsKey("beacon_special_purpose:category")) { 195 mark = new MarkSpec(this , node);167 mark = new MarkSpec(this); 196 168 } else if (keys.containsKey("buoy_lateral:shape") 197 169 || keys.containsKey("beacon_lateral:shape")) { 198 mark = new MarkLat(this , node);170 mark = new MarkLat(this); 199 171 } else if (keys.containsKey("buoy_cardinal:shape") 200 172 || keys.containsKey("beacon_cardinal:shape")) { 201 mark = new MarkCard(this , node);173 mark = new MarkCard(this); 202 174 } else if (keys.containsKey("buoy_isolated_danger:shape") 203 175 || keys.containsKey("beacon_isolated_danger:shape")) { 204 mark = new MarkIsol(this , node);176 mark = new MarkIsol(this); 205 177 } else if (keys.containsKey("buoy_safe_water:shape") 206 178 || keys.containsKey("beacon_safe_water:shape")) { 207 mark = new MarkSaw(this , node);179 mark = new MarkSaw(this); 208 180 } else if (keys.containsKey("buoy_special_purpose:shape") 209 181 || keys.containsKey("beacon_special_purpose:shape")) { 210 mark = new MarkSpec(this , node);182 mark = new MarkSpec(this); 211 183 } else if (keys.containsKey("buoy_lateral:colour") 212 184 || keys.containsKey("beacon_lateral:colour")) { 213 mark = new MarkLat(this , node);185 mark = new MarkLat(this); 214 186 } else if (keys.containsKey("buoy_cardinal:colour") 215 187 || keys.containsKey("beacon_cardinal:colour")) { 216 mark = new MarkCard(this , node);188 mark = new MarkCard(this); 217 189 } else if (keys.containsKey("buoy_isolated_danger:colour") 218 190 || keys.containsKey("beacon_isolated_danger:colour")) { 219 mark = new MarkIsol(this , node);191 mark = new MarkIsol(this); 220 192 } else if (keys.containsKey("buoy_safe_water:colour") 221 193 || keys.containsKey("beacon_safe_water:colour")) { 222 mark = new MarkSaw(this , node);194 mark = new MarkSaw(this); 223 195 } else if (keys.containsKey("buoy_special_purpose:colour") 224 196 || keys.containsKey("beacon_special_purpose:colour")) { 225 mark = new MarkSpec(this , node);226 } 227 197 mark = new MarkSpec(this); 198 } 199 228 200 if (mark == null) { 229 manager.showVisualMessage( tr("No seamark recognised at this node"));230 mark = new MarkUkn(this , node);201 manager.showVisualMessage(Messages.getString("NoMark")); 202 mark = new MarkUkn(this); 231 203 } else { 232 204 mark.parseMark(); 205 mark.paintSign(); 233 206 } 234 207 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages.properties
r24808 r24830 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data57 56 SelectNode=Please select a node 58 57 OneNode=Please select only one node 58 NoMark=No seamark recognised at this node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_de.properties
r24808 r24830 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data57 56 SelectNode=Please select a node 58 57 OneNode=Please select only one node 58 NoMark=No seamark recognised at this node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_en.properties
r24808 r24830 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data57 56 SelectNode=Please select a node 58 57 OneNode=Please select only one node 58 NoMark=No seamark recognised at this node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r24823 r24830 5 5 6 6 import java.awt.Color; 7 import java.awt.Dimension;8 7 import java.awt.Rectangle; 9 import java.awt.Font;10 8 11 9 import javax.swing.ButtonGroup; 12 10 import javax.swing.ImageIcon; 13 import javax.swing.JLabel;14 import javax.swing.JTextField;15 import javax.swing.JComboBox;16 import javax.swing.JCheckBox;17 11 import javax.swing.JRadioButton; 18 12 19 13 import oseam.Messages; 20 21 import java.awt.Cursor; 14 import oseam.dialogs.OSeaMAction; 15 import oseam.panels.PanelPort; 16 import oseam.panels.PanelStbd; 17 import oseam.panels.PanelPrefPort; 18 import oseam.panels.PanelPrefStbd; 19 import oseam.seamarks.SeaMark; 20 import oseam.seamarks.SeaMark.Cat; 21 import oseam.seamarks.SeaMark.Col; 22 import oseam.seamarks.MarkLat; 23 import oseam.seamarks.MarkSaw; 24 22 25 import java.awt.event.ActionListener; 23 26 24 27 public class PanelChan extends JPanel { 25 28 29 private OSeaMAction dlg; 30 private boolean region; 26 31 private ButtonGroup catButtons = null; 27 32 public JRadioButton portButton = null; … … 37 42 public PanelSafeWater panelSafeWater = null; 38 43 39 public PanelChan() { 40 panelPort = new PanelPort(); 44 public PanelChan(OSeaMAction dia) { 45 dlg = dia; 46 panelPort = new PanelPort(dlg); 41 47 panelPort.setBounds(new Rectangle(55, 0, 225, 160)); 42 48 panelPort.setVisible(false); 43 panelStbd = new PanelStbd( );49 panelStbd = new PanelStbd(dlg); 44 50 panelStbd.setBounds(new Rectangle(55, 0, 225, 160)); 45 51 panelStbd.setVisible(false); 46 panelPrefPort = new PanelPrefPort( );52 panelPrefPort = new PanelPrefPort(dlg); 47 53 panelPrefPort.setBounds(new Rectangle(55, 0, 225, 160)); 48 54 panelPrefPort.setVisible(false); 49 panelPrefStbd = new PanelPrefStbd( );55 panelPrefStbd = new PanelPrefStbd(dlg); 50 56 panelPrefStbd.setBounds(new Rectangle(55, 0, 225, 160)); 51 57 panelPrefStbd.setVisible(false); 52 panelSafeWater = new PanelSafeWater( );58 panelSafeWater = new PanelSafeWater(dlg); 53 59 panelSafeWater.setBounds(new Rectangle(55, 0, 225, 160)); 54 60 panelSafeWater.setVisible(false); … … 73 79 public void actionPerformed(java.awt.event.ActionEvent e) { 74 80 if (portButton.isSelected()) { 81 if (!(dlg.mark instanceof MarkLat)) 82 dlg.mark = new MarkLat(dlg); 83 dlg.mark.setCategory(Cat.PORT_HAND); 84 if (dlg.mark.getRegion() == SeaMark.IALA_A) { 85 dlg.mark.setColour(Col.RED); 86 panelPort.regionAButton.doClick(); 87 } else { 88 dlg.mark.setColour(Col.GREEN); 89 panelPort.regionBButton.doClick(); 90 } 75 91 portButton.setBorderPainted(true); 76 92 panelPort.setVisible(true); … … 80 96 } 81 97 if (stbdButton.isSelected()) { 98 if (!(dlg.mark instanceof MarkLat)) 99 dlg.mark = new MarkLat(dlg); 100 dlg.mark.setCategory(Cat.STARBOARD_HAND); 101 if (dlg.mark.getRegion() == SeaMark.IALA_A) { 102 dlg.mark.setColour(Col.GREEN); 103 panelStbd.regionAButton.doClick(); 104 } else { 105 dlg.mark.setColour(Col.RED); 106 panelStbd.regionBButton.doClick(); 107 } 82 108 stbdButton.setBorderPainted(true); 83 109 panelStbd.setVisible(true); … … 87 113 } 88 114 if (prefPortButton.isSelected()) { 115 if (!(dlg.mark instanceof MarkLat)) 116 dlg.mark = new MarkLat(dlg); 117 dlg.mark.setCategory(Cat.PREF_PORT_HAND); 118 if (dlg.mark.getRegion() == SeaMark.IALA_A) { 119 dlg.mark.setColour(Col.RED_GREEN_RED); 120 panelPrefPort.regionAButton.doClick(); 121 } else { 122 dlg.mark.setColour(Col.GREEN_RED_GREEN); 123 panelPrefPort.regionBButton.doClick(); 124 } 89 125 prefPortButton.setBorderPainted(true); 90 126 panelPrefPort.setVisible(true); … … 94 130 } 95 131 if (prefStbdButton.isSelected()) { 132 if (!(dlg.mark instanceof MarkLat)) 133 dlg.mark = new MarkLat(dlg); 134 dlg.mark.setCategory(Cat.PREF_STARBOARD_HAND); 135 if (dlg.mark.getRegion() == SeaMark.IALA_A) { 136 dlg.mark.setColour(Col.GREEN_RED_GREEN); 137 panelPrefStbd.regionAButton.doClick(); 138 } else { 139 dlg.mark.setColour(Col.RED_GREEN_RED); 140 panelPrefStbd.regionBButton.doClick(); 141 } 96 142 prefStbdButton.setBorderPainted(true); 97 143 panelPrefStbd.setVisible(true); … … 101 147 } 102 148 if (safeWaterButton.isSelected()) { 149 if (!(dlg.mark instanceof MarkSaw)) 150 dlg.mark = new MarkSaw(dlg); 151 dlg.mark.setColour(Col.RED_WHITE); 103 152 safeWaterButton.setBorderPainted(true); 104 153 panelSafeWater.setVisible(true); … … 107 156 panelSafeWater.setVisible(false); 108 157 } 158 if (dlg.mark != null) dlg.mark.paintSign(); 109 159 } 110 160 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java
r24808 r24830 7 7 8 8 import java.awt.Color; 9 import java.awt.Dimension;10 9 import java.awt.Rectangle; 11 import java.awt.Font;12 10 13 11 import javax.swing.ButtonGroup; 14 12 import javax.swing.ImageIcon; 15 import javax.swing.JLabel;16 import javax.swing.JTextField;17 import javax.swing.JComboBox;18 import javax.swing.JCheckBox;19 13 import javax.swing.JRadioButton; 20 14 21 15 import oseam.Messages; 22 23 import java.awt.Cursor; 16 import oseam.dialogs.OSeaMAction; 17 24 18 import java.awt.event.ActionListener; 25 19 26 20 public class PanelCol extends JPanel { 27 21 22 private OSeaMAction dlg; 28 23 private ButtonGroup colourButtons = null; 29 24 public JRadioButton offButton = null; … … 39 34 private ActionListener alColour = null; 40 35 41 public PanelCol( ) {42 super();36 public PanelCol(OSeaMAction dia) { 37 dlg = dia; 43 38 this.setLayout(null); 44 45 39 this.add(getOffButton(), null); 46 40 this.add(getWhiteButton(), null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelFog.java
r24808 r24830 17 17 18 18 import oseam.Messages; 19 import oseam.dialogs.OSeaMAction; 19 20 20 21 import java.awt.Cursor; … … 23 24 public class PanelFog extends JPanel { 24 25 25 public PanelFog() { 26 super(); 26 private OSeaMAction dlg; 27 28 public PanelFog(OSeaMAction dia) { 29 dlg = dia; 27 30 this.setLayout(null); 28 31 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r24808 r24830 13 13 import oseam.Messages; 14 14 import oseam.dialogs.OSeaMAction; 15 import oseam.seamarks.MarkCard; 16 import oseam.seamarks.MarkIsol; 15 17 import oseam.seamarks.SeaMark.Cat; 16 18 import oseam.seamarks.SeaMark.Col; 17 import oseam.seamarks.SeaMark.S tyl;19 import oseam.seamarks.SeaMark.Shp; 18 20 19 21 import java.awt.event.ActionListener; … … 55 57 public void actionPerformed(java.awt.event.ActionEvent e) { 56 58 if (northButton.isSelected()) { 57 northButton.setBorderPainted(true); 59 if (!(dlg.mark instanceof MarkCard)) 60 dlg.mark = new MarkCard(dlg); 58 61 dlg.mark.setCategory(Cat.CARD_NORTH); 59 62 dlg.mark.setColour(Col.BLACK_YELLOW); 60 63 dlg.panelMain.panelTop.northTopButton.doClick(); 61 64 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 65 northButton.setBorderPainted(true); 62 66 } else { 63 67 northButton.setBorderPainted(false); 64 68 } 65 69 if (southButton.isSelected()) { 66 southButton.setBorderPainted(true); 70 if (!(dlg.mark instanceof MarkCard)) 71 dlg.mark = new MarkCard(dlg); 67 72 dlg.mark.setCategory(Cat.CARD_SOUTH); 68 73 dlg.mark.setColour(Col.YELLOW_BLACK); 69 74 dlg.panelMain.panelTop.southTopButton.doClick(); 70 75 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 76 southButton.setBorderPainted(true); 71 77 } else { 72 78 southButton.setBorderPainted(false); 73 79 } 74 80 if (eastButton.isSelected()) { 75 eastButton.setBorderPainted(true); 81 if (!(dlg.mark instanceof MarkCard)) 82 dlg.mark = new MarkCard(dlg); 76 83 dlg.mark.setCategory(Cat.CARD_EAST); 77 84 dlg.mark.setColour(Col.BLACK_YELLOW_BLACK); 78 85 dlg.panelMain.panelTop.eastTopButton.doClick(); 79 86 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 87 eastButton.setBorderPainted(true); 80 88 } else { 81 89 eastButton.setBorderPainted(false); 82 90 } 83 91 if (westButton.isSelected()) { 84 westButton.setBorderPainted(true); 92 if (!(dlg.mark instanceof MarkCard)) 93 dlg.mark = new MarkCard(dlg); 85 94 dlg.mark.setCategory(Cat.CARD_WEST); 86 95 dlg.mark.setColour(Col.YELLOW_BLACK_YELLOW); 87 96 dlg.panelMain.panelTop.westTopButton.doClick(); 88 97 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 98 westButton.setBorderPainted(true); 89 99 } else { 90 100 westButton.setBorderPainted(false); 91 101 } 92 isolButton.setBorderPainted(isolButton.isSelected()); 102 if (isolButton.isSelected()) { 103 if (!(dlg.mark instanceof MarkIsol)) 104 dlg.mark = new MarkIsol(dlg); 105 dlg.mark.setColour(Col.BLACK_RED_BLACK); 106 dlg.panelMain.panelTop.spheres2TopButton.doClick(); 107 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 108 isolButton.setBorderPainted(true); 109 } else { 110 isolButton.setBorderPainted(false); 111 } 112 if (dlg.mark != null) dlg.mark.paintSign(); 93 113 } 94 114 }; … … 114 134 if (pillarButton.isSelected()) { 115 135 pillarButton.setBorderPainted(true); 116 dlg.mark.setShape(S tyl.PILLAR);136 dlg.mark.setShape(Shp.PILLAR); 117 137 } else { 118 138 pillarButton.setBorderPainted(false); … … 120 140 if (sparButton.isSelected()) { 121 141 sparButton.setBorderPainted(true); 122 dlg.mark.setShape(S tyl.SPAR);142 dlg.mark.setShape(Shp.SPAR); 123 143 } else { 124 144 sparButton.setBorderPainted(false); … … 126 146 if (floatButton.isSelected()) { 127 147 floatButton.setBorderPainted(true); 128 dlg.mark.setShape(S tyl.FLOAT);148 dlg.mark.setShape(Shp.FLOAT); 129 149 } else { 130 150 floatButton.setBorderPainted(false); … … 132 152 if (beaconButton.isSelected()) { 133 153 beaconButton.setBorderPainted(true); 134 dlg.mark.setShape(S tyl.BEACON);154 dlg.mark.setShape(Shp.BEACON); 135 155 } else { 136 156 beaconButton.setBorderPainted(false); … … 138 158 if (towerButton.isSelected()) { 139 159 towerButton.setBorderPainted(true); 140 dlg.mark.setShape(S tyl.TOWER);160 dlg.mark.setShape(Shp.TOWER); 141 161 } else { 142 162 towerButton.setBorderPainted(false); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLights.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelLights extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup catButtons = null; 27 29 private JRadioButton houseButton = null; … … 31 33 private JRadioButton floatButton = null; 32 34 33 public PanelLights( ) {34 super();35 public PanelLights(OSeaMAction dia) { 36 dlg = dia; 35 37 this.setLayout(null); 36 38 this.add(getHouseButton(), null); … … 52 54 vesselButton.setBorderPainted(vesselButton.isSelected()); 53 55 floatButton.setBorderPainted(floatButton.isSelected()); 56 if (dlg.mark != null) dlg.mark.paintSign(); 54 57 } 55 58 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java
r24808 r24830 17 17 18 18 import oseam.Messages; 19 import oseam.dialogs.OSeaMAction; 19 20 20 21 import java.awt.Cursor; … … 23 24 public class PanelLit extends JPanel { 24 25 26 private OSeaMAction dlg; 25 27 private PanelCol panelCol = null; 26 28 27 public PanelLit( ) {28 super();29 panelCol = new PanelCol( );29 public PanelLit(OSeaMAction dia) { 30 dlg = dia; 31 panelCol = new PanelCol(dlg); 30 32 panelCol.setBounds(new Rectangle(0, 0, 34, 160)); 31 33 this.setLayout(null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r24823 r24830 18 18 import oseam.Messages; 19 19 import oseam.dialogs.OSeaMAction; 20 import oseam.seamarks.MarkSpec; 21 import oseam.seamarks.MarkLight; 20 22 21 23 public class PanelMain extends JPanel { … … 55 57 56 58 dlg = dia; 57 panelChan = new PanelChan( );59 panelChan = new PanelChan(dlg); 58 60 panelChan.setBounds(new Rectangle(65, 0, 335, 160)); 59 61 panelChan.setVisible(false); 60 panelHaz = new PanelHaz(d ia);62 panelHaz = new PanelHaz(dlg); 61 63 panelHaz.setBounds(new Rectangle(65, 0, 335, 160)); 62 64 panelHaz.setVisible(false); 63 panelSpec = new PanelSpec( );65 panelSpec = new PanelSpec(dlg); 64 66 panelSpec.setBounds(new Rectangle(65, 0, 335, 160)); 65 67 panelSpec.setVisible(false); 66 panelLights = new PanelLights( );68 panelLights = new PanelLights(dlg); 67 69 panelLights.setBounds(new Rectangle(65, 0, 335, 160)); 68 70 panelLights.setVisible(false); 69 panelTop = new PanelTop( );71 panelTop = new PanelTop(dlg); 70 72 panelTop.setBounds(new Rectangle(40, 165, 220, 160)); 71 73 panelTop.setVisible(false); 72 panelFog = new PanelFog( );74 panelFog = new PanelFog(dlg); 73 75 panelFog.setBounds(new Rectangle(40, 165, 220, 160)); 74 76 panelFog.setVisible(false); 75 panelRadar = new PanelRadar( );77 panelRadar = new PanelRadar(dlg); 76 78 panelRadar.setBounds(new Rectangle(40, 165, 220, 160)); 77 79 panelRadar.setVisible(false); 78 panelLit = new PanelLit( );80 panelLit = new PanelLit(dlg); 79 81 panelLit.setBounds(new Rectangle(40, 165, 220, 160)); 80 82 panelLit.setVisible(false); … … 118 120 alType = new ActionListener() { 119 121 public void actionPerformed(java.awt.event.ActionEvent e) { 120 if (dlg.mark == null) 122 if (dlg.mark == null) { 121 123 typeButtons.clearSelection(); 124 return; 125 } 122 126 if (chanButton.isSelected()) { 123 127 chanButton.setBorderPainted(true); … … 135 139 } 136 140 if (specButton.isSelected()) { 141 if (!(dlg.mark instanceof MarkSpec)) 142 dlg.mark = new MarkSpec(dlg); 137 143 specButton.setBorderPainted(true); 138 144 panelSpec.setVisible(true); … … 142 148 } 143 149 if (lightsButton.isSelected()) { 150 if (!(dlg.mark instanceof MarkLight)) 151 dlg.mark = new MarkLight(dlg); 144 152 lightsButton.setBorderPainted(true); 145 153 panelLights.setVisible(true); … … 166 174 alMisc = new ActionListener() { 167 175 public void actionPerformed(java.awt.event.ActionEvent e) { 168 if (dlg.mark == null) 176 if (dlg.mark == null) { 169 177 miscButtons.clearSelection(); 178 return; 179 } 170 180 if (topButton.isSelected()) { 171 181 topButton.setBorderPainted(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelPort extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup regionButtons = null; 27 p rivateJRadioButton regionAButton = null;28 p rivateJRadioButton regionBButton = null;29 public JRadioButton regionAButton = null; 30 public JRadioButton regionBButton = null; 29 31 private ButtonGroup shapeButtons = null; 30 p rivateJRadioButton pillarButton = null;31 p rivateJRadioButton sparButton = null;32 p rivateJRadioButton canButton = null;33 p rivateJRadioButton floatButton = null;34 p rivateJRadioButton beaconButton = null;35 p rivateJRadioButton towerButton = null;36 p rivateJRadioButton perchButton = null;32 public JRadioButton pillarButton = null; 33 public JRadioButton sparButton = null; 34 public JRadioButton canButton = null; 35 public JRadioButton floatButton = null; 36 public JRadioButton beaconButton = null; 37 public JRadioButton towerButton = null; 38 public JRadioButton perchButton = null; 37 39 38 public PanelPort( ) {39 super();40 public PanelPort(OSeaMAction dia) { 41 dlg = dia; 40 42 this.setLayout(null); 41 43 this.add(getRegionAButton(), null); … … 56 58 regionAButton.setBorderPainted(regionAButton.isSelected()); 57 59 regionBButton.setBorderPainted(regionBButton.isSelected()); 60 dlg.mark.paintSign(); 58 61 } 59 62 }; … … 78 81 towerButton.setBorderPainted(towerButton.isSelected()); 79 82 perchButton.setBorderPainted(perchButton.isSelected()); 83 dlg.mark.paintSign(); 80 84 } 81 85 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPrefPort.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelPrefPort extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup regionButtons = null; 27 p rivateJRadioButton regionAButton = null;28 p rivateJRadioButton regionBButton = null;29 public JRadioButton regionAButton = null; 30 public JRadioButton regionBButton = null; 29 31 private ButtonGroup shapeButtons = null; 30 p rivateJRadioButton pillarButton = null;31 p rivateJRadioButton sparButton = null;32 p rivateJRadioButton canButton = null;33 p rivateJRadioButton floatButton = null;34 p rivateJRadioButton beaconButton = null;35 p rivateJRadioButton towerButton = null;32 public JRadioButton pillarButton = null; 33 public JRadioButton sparButton = null; 34 public JRadioButton canButton = null; 35 public JRadioButton floatButton = null; 36 public JRadioButton beaconButton = null; 37 public JRadioButton towerButton = null; 36 38 37 public PanelPrefPort( ) {38 super();39 public PanelPrefPort(OSeaMAction dia) { 40 dlg = dia; 39 41 this.setLayout(null); 40 42 this.add(getRegionAButton(), null); … … 54 56 regionAButton.setBorderPainted(regionAButton.isSelected()); 55 57 regionBButton.setBorderPainted(regionBButton.isSelected()); 58 dlg.mark.paintSign(); 56 59 } 57 60 }; … … 74 77 beaconButton.setBorderPainted(beaconButton.isSelected()); 75 78 towerButton.setBorderPainted(towerButton.isSelected()); 79 dlg.mark.paintSign(); 76 80 } 77 81 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPrefStbd.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelPrefStbd extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup regionButtons = null; 27 p rivateJRadioButton regionAButton = null;28 p rivateJRadioButton regionBButton = null;29 public JRadioButton regionAButton = null; 30 public JRadioButton regionBButton = null; 29 31 private ButtonGroup shapeButtons = null; 30 p rivateJRadioButton pillarButton = null;31 p rivateJRadioButton sparButton = null;32 p rivateJRadioButton coneButton = null;33 p rivateJRadioButton floatButton = null;34 p rivateJRadioButton beaconButton = null;35 p rivateJRadioButton towerButton = null;32 public JRadioButton pillarButton = null; 33 public JRadioButton sparButton = null; 34 public JRadioButton coneButton = null; 35 public JRadioButton floatButton = null; 36 public JRadioButton beaconButton = null; 37 public JRadioButton towerButton = null; 36 38 37 public PanelPrefStbd( ) {38 super();39 public PanelPrefStbd(OSeaMAction dia) { 40 dlg = dia; 39 41 this.setLayout(null); 40 42 this.add(getRegionAButton(), null); … … 54 56 regionAButton.setBorderPainted(regionAButton.isSelected()); 55 57 regionBButton.setBorderPainted(regionBButton.isSelected()); 58 dlg.mark.paintSign(); 56 59 } 57 60 }; … … 74 77 beaconButton.setBorderPainted(beaconButton.isSelected()); 75 78 towerButton.setBorderPainted(towerButton.isSelected()); 79 dlg.mark.paintSign(); 76 80 } 77 81 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelRadar.java
r24808 r24830 17 17 18 18 import oseam.Messages; 19 import oseam.dialogs.OSeaMAction; 19 20 20 21 import java.awt.Cursor; … … 23 24 public class PanelRadar extends JPanel { 24 25 26 private OSeaMAction dlg; 25 27 26 public PanelRadar( ) {27 super();28 public PanelRadar(OSeaMAction dia) { 29 dlg = dia; 28 30 this.setLayout(null); 29 31 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSafeWater.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelSafeWater extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup shapeButtons = null; 27 29 private JRadioButton pillarButton = null; … … 31 33 private JRadioButton floatButton = null; 32 34 33 public PanelSafeWater( ) {34 super();35 public PanelSafeWater(OSeaMAction dia) { 36 dlg = dia; 35 37 this.setLayout(null); 36 38 this.add(getPillarButton(), null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java
r24808 r24830 20 20 21 21 import oseam.Messages; 22 import oseam.dialogs.OSeaMAction; 22 23 23 24 import java.awt.Cursor; … … 26 27 public class PanelSpec extends JPanel { 27 28 29 private OSeaMAction dlg; 28 30 private ButtonGroup shapeButtons = null; 29 31 private JRadioButton pillarButton = null; … … 39 41 private PanelCol panelCol = null; 40 42 41 public PanelSpec( ) {42 super();43 panelCol = new PanelCol( );43 public PanelSpec(OSeaMAction dia) { 44 dlg = dia; 45 panelCol = new PanelCol(dlg); 44 46 panelCol.setBounds(new Rectangle(9, 0, 34, 160)); 47 45 48 this.setLayout(null); 46 47 49 this.add(panelCol, null); 48 50 this.add(getPillarButton(), null); … … 79 81 beaconButton.setBorderPainted(beaconButton.isSelected()); 80 82 towerButton.setBorderPainted(towerButton.isSelected()); 83 if (dlg.mark != null) dlg.mark.paintSign(); 81 84 } 82 85 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r24808 r24830 18 18 19 19 import oseam.Messages; 20 import oseam.dialogs.OSeaMAction; 20 21 21 22 import java.awt.Cursor; … … 24 25 public class PanelStbd extends JPanel { 25 26 27 private OSeaMAction dlg; 26 28 private ButtonGroup regionButtons = null; 27 p rivateJRadioButton regionAButton = null;28 p rivateJRadioButton regionBButton = null;29 public JRadioButton regionAButton = null; 30 public JRadioButton regionBButton = null; 29 31 private ButtonGroup shapeButtons = null; 30 p rivateJRadioButton pillarButton = null;31 p rivateJRadioButton sparButton = null;32 p rivateJRadioButton coneButton = null;33 p rivateJRadioButton floatButton = null;34 p rivateJRadioButton beaconButton = null;35 p rivateJRadioButton towerButton = null;36 p rivateJRadioButton perchButton = null;32 public JRadioButton pillarButton = null; 33 public JRadioButton sparButton = null; 34 public JRadioButton coneButton = null; 35 public JRadioButton floatButton = null; 36 public JRadioButton beaconButton = null; 37 public JRadioButton towerButton = null; 38 public JRadioButton perchButton = null; 37 39 38 public PanelStbd( ) {39 super();40 public PanelStbd(OSeaMAction dia) { 41 dlg = dia; 40 42 this.setLayout(null); 41 43 this.add(getRegionAButton(), null); … … 56 58 regionAButton.setBorderPainted(regionAButton.isSelected()); 57 59 regionBButton.setBorderPainted(regionBButton.isSelected()); 60 dlg.mark.paintSign(); 58 61 } 59 62 }; … … 78 81 towerButton.setBorderPainted(towerButton.isSelected()); 79 82 perchButton.setBorderPainted(perchButton.isSelected()); 83 dlg.mark.paintSign(); 80 84 } 81 85 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelTop.java
r24808 r24830 19 19 20 20 import oseam.Messages; 21 import oseam.dialogs.OSeaMAction; 21 22 22 23 import java.awt.Cursor; … … 25 26 public class PanelTop extends JPanel { 26 27 28 private OSeaMAction dlg; 27 29 public PanelCol panelCol = null; 28 30 private ButtonGroup topButtons = null; … … 45 47 ActionListener alTop = null; 46 48 47 public PanelTop( ) {48 super();49 panelCol = new PanelCol( );49 public PanelTop(OSeaMAction dia) { 50 dlg = dia; 51 panelCol = new PanelCol(dlg); 50 52 panelCol.setBounds(new Rectangle(0, 0, 34, 160)); 51 53 this.setLayout(null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkCard.java
r24824 r24830 6 6 import org.openstreetmap.josm.Main; 7 7 import org.openstreetmap.josm.command.ChangePropertyCommand; 8 import org.openstreetmap.josm.data.osm.Node;9 8 10 9 import oseam.dialogs.OSeaMAction; … … 13 12 public class MarkCard extends SeaMark { 14 13 15 public MarkCard(OSeaMAction dia , Node node) {16 super(dia , node);14 public MarkCard(OSeaMAction dia) { 15 super(dia); 17 16 } 18 17 … … 20 19 String str; 21 20 Map<String, String> keys; 22 keys = getNode().getKeys();21 keys = dlg.node.getKeys(); 23 22 24 23 if (!dlg.panelMain.hazButton.isSelected()) … … 102 101 } 103 102 104 public boolean isValid() {105 return (getCategory() != Cat.UNKNOWN_CAT)106 && (getShape() != Styl.UNKNOWN_SHAPE);107 }108 109 103 public void setLightColour() { 110 104 super.setLightColour("W"); … … 115 109 if (dlg.paintlock) return; super.paintSign(); 116 110 */ 117 if ( isValid()) {111 if ((getCategory() != Cat.UNKNOWN) && (getShape() != Shp.UNKNOWN)) { 118 112 String image = "/images/Cardinal"; 119 113 switch (getShape()) { … … 164 158 165 159 public void saveSign() { 166 Node node = getNode(); 167 if (node == null) 160 if (dlg.node == null) 168 161 return; 169 162 … … 173 166 case PILLAR: 174 167 super.saveSign("buoy_cardinal"); 175 Main.main.undoRedo.add(new ChangePropertyCommand( node,168 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 176 169 "seamark:buoy_cardinal:shape", "pillar")); 177 170 break; 178 171 case SPAR: 179 172 super.saveSign("buoy_cardinal"); 180 Main.main.undoRedo.add(new ChangePropertyCommand( node,173 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 181 174 "seamark:buoy_cardinal:shape", "spar")); 182 175 break; … … 186 179 case TOWER: 187 180 super.saveSign("beacon_cardinal"); 188 Main.main.undoRedo.add(new ChangePropertyCommand( node,181 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 189 182 "seamark:beacon_cardinal:shape", "tower")); 190 183 break; … … 200 193 switch (getCategory()) { 201 194 case CARD_NORTH: 202 Main.main.undoRedo.add(new ChangePropertyCommand( node,195 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 203 196 "seamark:buoy_cardinal:category", "north")); 204 Main.main.undoRedo.add(new ChangePropertyCommand( node,197 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 205 198 "seamark:buoy_cardinal:colour", "black;yellow")); 206 199 shape = "2 cones up"; … … 208 201 209 202 case CARD_EAST: 210 Main.main.undoRedo.add(new ChangePropertyCommand( node,203 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 211 204 "seamark:buoy_cardinal:category", "east")); 212 Main.main.undoRedo.add(new ChangePropertyCommand( node,205 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 213 206 "seamark:buoy_cardinal:colour", "black;yellow;black")); 214 207 shape = "2 cones base together"; … … 216 209 217 210 case CARD_SOUTH: 218 Main.main.undoRedo.add(new ChangePropertyCommand( node,211 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 219 212 "seamark:buoy_cardinal:category", "south")); 220 Main.main.undoRedo.add(new ChangePropertyCommand( node,213 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 221 214 "seamark:buoy_cardinal:colour", "yellow;black")); 222 215 shape = "2 cones down"; … … 224 217 225 218 case CARD_WEST: 226 Main.main.undoRedo.add(new ChangePropertyCommand( node,219 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 227 220 "seamark:buoy_cardinal:category", "west")); 228 Main.main.undoRedo.add(new ChangePropertyCommand( node,221 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 229 222 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); 230 223 shape = "2 cones point together"; 231 224 break; 232 225 } 233 Main.main.undoRedo.add(new ChangePropertyCommand( node,226 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 234 227 "seamark:buoy_cardinal:colour_pattern", 235 228 "horizontal stripes")); … … 240 233 switch (getCategory()) { 241 234 case CARD_NORTH: 242 Main.main.undoRedo.add(new ChangePropertyCommand( node,235 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 243 236 "seamark:beacon_cardinal:category", "north")); 244 Main.main.undoRedo.add(new ChangePropertyCommand( node,237 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 245 238 "seamark:beacon_cardinal:colour", "black;yellow")); 246 239 shape = "2 cones up"; … … 248 241 249 242 case CARD_EAST: 250 Main.main.undoRedo.add(new ChangePropertyCommand( node,243 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 251 244 "seamark:beacon_cardinal:category", "east")); 252 245 Main.main.undoRedo 253 .add(new ChangePropertyCommand( node,246 .add(new ChangePropertyCommand(dlg.node, 254 247 "seamark:beacon_cardinal:colour", 255 248 "black;yellow;black")); … … 258 251 259 252 case CARD_SOUTH: 260 Main.main.undoRedo.add(new ChangePropertyCommand( node,253 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 261 254 "seamark:beacon_cardinal:category", "south")); 262 Main.main.undoRedo.add(new ChangePropertyCommand( node,255 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 263 256 "seamark:beacon_cardinal:colour", "yellow;black")); 264 257 shape = "2 cones down"; … … 266 259 267 260 case CARD_WEST: 268 Main.main.undoRedo.add(new ChangePropertyCommand( node,261 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 269 262 "seamark:beacon_cardinal:category", "west")); 270 263 Main.main.undoRedo 271 .add(new ChangePropertyCommand( node,264 .add(new ChangePropertyCommand(dlg.node, 272 265 "seamark:beacon_cardinal:colour", 273 266 "yellow;black;yellow")); … … 275 268 break; 276 269 } 277 Main.main.undoRedo.add(new ChangePropertyCommand( node,270 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 278 271 "seamark:beacon_cardinal:colour_pattern", 279 272 "horizontal stripes")); … … 283 276 switch (getCategory()) { 284 277 case CARD_NORTH: 285 Main.main.undoRedo.add(new ChangePropertyCommand( node,278 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 286 279 "seamark:light_float:colour", "black;yellow")); 287 280 shape = "2 cones up"; … … 289 282 290 283 case CARD_EAST: 291 Main.main.undoRedo.add(new ChangePropertyCommand( node,284 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 292 285 "seamark:light_float:colour", "black;yellow;black")); 293 286 shape = "2 cones base together"; … … 295 288 296 289 case CARD_SOUTH: 297 Main.main.undoRedo.add(new ChangePropertyCommand( node,290 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 298 291 "seamark:light_float:colour", "yellow;black")); 299 292 shape = "2 cones down"; … … 301 294 302 295 case CARD_WEST: 303 Main.main.undoRedo.add(new ChangePropertyCommand( node,296 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 304 297 "seamark:light_float:colour", "yellow;black;yellow")); 305 298 shape = "2 cones point together"; … … 307 300 } 308 301 Main.main.undoRedo 309 .add(new ChangePropertyCommand( node,302 .add(new ChangePropertyCommand(dlg.node, 310 303 "seamark:light_float:colour_pattern", 311 304 "horizontal stripes")); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkIsol.java
r24824 r24830 7 7 import org.openstreetmap.josm.Main; 8 8 import org.openstreetmap.josm.command.ChangePropertyCommand; 9 import org.openstreetmap.josm.data.osm.Node;10 9 11 10 import oseam.dialogs.OSeaMAction; … … 13 12 14 13 public class MarkIsol extends SeaMark { 15 public MarkIsol(OSeaMAction dia , Node node) {16 super(dia , node);14 public MarkIsol(OSeaMAction dia) { 15 super(dia); 17 16 } 18 17 … … 21 20 String str; 22 21 Map<String, String> keys; 23 keys = getNode().getKeys();22 keys = dlg.node.getKeys(); 24 23 25 24 if (!dlg.panelMain.hazButton.isSelected()) … … 70 69 } 71 70 72 public boolean isValid() {73 return (getCategory() != Cat.UNKNOWN_CAT)74 && (getShape() != Styl.UNKNOWN_SHAPE);75 }76 77 71 public void setLightColour() { 78 72 super.setLightColour("W"); … … 85 79 super.paintSign(); 86 80 */ 87 if ( isValid()) {81 if ((getCategory() != Cat.UNKNOWN) && (getShape() != Shp.UNKNOWN)) { 88 82 89 83 String image = "/images/Cardinal"; … … 118 112 119 113 public void saveSign() { 120 Node node = getNode();121 114 122 if ( node == null) {115 if (dlg.node == null) { 123 116 return; 124 117 } … … 127 120 case PILLAR: 128 121 super.saveSign("buoy_isolated_danger"); 129 Main.main.undoRedo.add(new ChangePropertyCommand( node,122 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 130 123 "seamark:buoy_isolated_danger:shape", "pillar")); 131 124 break; 132 125 case SPAR: 133 126 super.saveSign("buoy_isolated_danger"); 134 Main.main.undoRedo.add(new ChangePropertyCommand( node,127 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 135 128 "seamark:buoy_isolated_danger:shape", "spar")); 136 129 break; … … 140 133 case TOWER: 141 134 super.saveSign("beacon_isolated_danger"); 142 Main.main.undoRedo.add(new ChangePropertyCommand( node,135 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 143 136 "seamark:beacon_isolated_danger:shape", "tower")); 144 137 break; … … 152 145 case PILLAR: 153 146 case SPAR: 154 Main.main.undoRedo.add(new ChangePropertyCommand( node,147 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 155 148 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); 156 Main.main.undoRedo.add(new ChangePropertyCommand( node,149 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 157 150 "seamark:buoy_isolated_danger:colour", "black;red;black")); 158 151 break; 159 152 case BEACON: 160 153 case TOWER: 161 Main.main.undoRedo.add(new ChangePropertyCommand( node,154 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 162 155 "seamark:beacon_isolated_danger:colour_pattern", 163 156 "horizontal stripes")); 164 Main.main.undoRedo.add(new ChangePropertyCommand( node,157 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 165 158 "seamark:beacon_isolated_danger:colour", "black;red;black")); 166 159 break; 167 160 case FLOAT: 168 Main.main.undoRedo.add(new ChangePropertyCommand( node,161 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 169 162 "seamark:light_float:colour_pattern", "horizontal stripes")); 170 Main.main.undoRedo.add(new ChangePropertyCommand( node,163 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 171 164 "seamark:light_float:colour", "black;red;black")); 172 165 break; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkLat.java
r24824 r24830 5 5 import javax.swing.ImageIcon; 6 6 7 import org.openstreetmap.josm.data.osm.Node;8 7 import org.openstreetmap.josm.Main; 9 8 import org.openstreetmap.josm.command.ChangePropertyCommand; 10 9 11 10 import oseam.dialogs.OSeaMAction; 12 import oseam.seamarks.SeaMark.Cat;13 import oseam.seamarks.SeaMark.Styl;14 11 15 12 public class MarkLat extends SeaMark { 16 public MarkLat(OSeaMAction dia , Node node) {17 super(dia , node);13 public MarkLat(OSeaMAction dia) { 14 super(dia); 18 15 } 19 16 … … 22 19 String str; 23 20 Map<String, String> keys; 24 keys = getNode().getKeys();21 keys = dlg.node.getKeys(); 25 22 26 23 if (!dlg.panelMain.chanButton.isSelected()) … … 56 53 col = keys.get("seamark:light_float:colour"); 57 54 58 if (getShape() != S tyl.PERCH) {55 if (getShape() != Shp.PERCH) { 59 56 if (keys.containsKey("seamark:topmark:shape")) { 60 57 top = keys.get("seamark:topmark:shape"); … … 260 257 */ } 261 258 262 public boolean isValid() {263 return (getCategory() != Cat.UNKNOWN_CAT)264 && (getShape() != Styl.UNKNOWN_SHAPE);265 }266 267 259 public void setLightColour() { 268 260 if (getRegion() == IALA_A) { … … 284 276 super.paintSign(); 285 277 */ 286 if ( isValid()) {278 if ((getCategory() != Cat.UNKNOWN) && (getShape() != Shp.UNKNOWN)) { 287 279 boolean region = getRegion(); 288 S tylstyle = getShape();280 Shp style = getShape(); 289 281 290 282 String image = "/images/Lateral"; … … 589 581 590 582 public void saveSign() { 591 Node node = getNode(); 592 593 if (node == null) { 583 584 if (dlg.node == null) { 594 585 return; 595 586 } … … 605 596 case CAN: 606 597 super.saveSign("buoy_lateral"); 607 Main.main.undoRedo.add(new ChangePropertyCommand( node,598 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 608 599 "seamark:buoy_lateral:shape", "can")); 609 600 break; 610 601 case PILLAR: 611 602 super.saveSign("buoy_lateral"); 612 Main.main.undoRedo.add(new ChangePropertyCommand( node,603 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 613 604 "seamark:buoy_lateral:shape", "pillar")); 614 605 break; 615 606 case SPAR: 616 607 super.saveSign("buoy_lateral"); 617 Main.main.undoRedo.add(new ChangePropertyCommand( node,608 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 618 609 "seamark:buoy_lateral:shape", "spar")); 619 610 break; … … 623 614 case TOWER: 624 615 super.saveSign("beacon_lateral"); 625 Main.main.undoRedo.add(new ChangePropertyCommand( node,616 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 626 617 "seamark:beacon_lateral:shape", "tower")); 627 618 break; … … 631 622 case PERCH: 632 623 super.saveSign("beacon_lateral"); 633 Main.main.undoRedo.add(new ChangePropertyCommand( node,624 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 634 625 "seamark:beacon_lateral:shape", "perch")); 635 626 break; … … 640 631 case PILLAR: 641 632 case SPAR: 642 Main.main.undoRedo.add(new ChangePropertyCommand( node,633 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 643 634 "seamark:buoy_lateral:category", "port")); 644 635 if (getRegion() == IALA_A) { 645 Main.main.undoRedo.add(new ChangePropertyCommand( node,636 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 646 637 "seamark:buoy_lateral:colour", "red")); 647 638 colour = "red"; 648 639 } else { 649 Main.main.undoRedo.add(new ChangePropertyCommand( node,640 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 650 641 "seamark:buoy_lateral:colour", "green")); 651 642 colour = "green"; … … 653 644 break; 654 645 case PERCH: 655 Main.main.undoRedo.add(new ChangePropertyCommand( node,646 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 656 647 "seamark:beacon_lateral:category", "port")); 657 648 break; 658 649 case BEACON: 659 650 case TOWER: 660 Main.main.undoRedo.add(new ChangePropertyCommand( node,651 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 661 652 "seamark:beacon_lateral:category", "port")); 662 653 if (getRegion() == IALA_A) { 663 Main.main.undoRedo.add(new ChangePropertyCommand( node,654 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 664 655 "seamark:beacon_lateral:colour", "red")); 665 656 colour = "red"; 666 657 } else { 667 Main.main.undoRedo.add(new ChangePropertyCommand( node,658 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 668 659 "seamark:beacon_lateral:colour", "green")); 669 660 colour = "green"; … … 672 663 case FLOAT: 673 664 if (getRegion() == IALA_A) { 674 Main.main.undoRedo.add(new ChangePropertyCommand( node,665 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 675 666 "seamark:light_float:colour", "red")); 676 667 colour = "red"; 677 668 } else { 678 Main.main.undoRedo.add(new ChangePropertyCommand( node,669 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 679 670 "seamark:light_float:colour", "green")); 680 671 colour = "green"; … … 689 680 case CAN: 690 681 super.saveSign("buoy_lateral"); 691 Main.main.undoRedo.add(new ChangePropertyCommand( node,682 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 692 683 "seamark:buoy_lateral:shape", "can")); 693 684 break; 694 685 case PILLAR: 695 686 super.saveSign("buoy_lateral"); 696 Main.main.undoRedo.add(new ChangePropertyCommand( node,687 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 697 688 "seamark:buoy_lateral:shape", "pillar")); 698 689 break; 699 690 case SPAR: 700 691 super.saveSign("buoy_lateral"); 701 Main.main.undoRedo.add(new ChangePropertyCommand( node,692 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 702 693 "seamark:buoy_lateral:shape", "spar")); 703 694 break; … … 707 698 case TOWER: 708 699 super.saveSign("beacon_lateral"); 709 Main.main.undoRedo.add(new ChangePropertyCommand( node,700 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 710 701 "seamark:beacon_lateral:shape", "tower")); 711 702 break; … … 719 710 case PILLAR: 720 711 case SPAR: 721 Main.main.undoRedo.add(new ChangePropertyCommand( node,712 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 722 713 "seamark:buoy_lateral:category", "preferred_channel_port")); 723 Main.main.undoRedo.add(new ChangePropertyCommand( node,714 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 724 715 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); 725 716 if (getRegion() == IALA_A) { 726 Main.main.undoRedo.add(new ChangePropertyCommand( node,717 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 727 718 "seamark:buoy_lateral:colour", "red;green;red")); 728 719 colour = "red"; 729 720 } else { 730 Main.main.undoRedo.add(new ChangePropertyCommand( node,721 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 731 722 "seamark:buoy_lateral:colour", "green;red;green")); 732 723 colour = "green"; … … 735 726 case BEACON: 736 727 case TOWER: 737 Main.main.undoRedo.add(new ChangePropertyCommand( node,728 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 738 729 "seamark:beacon_lateral:category", "preferred_channel_port")); 739 Main.main.undoRedo.add(new ChangePropertyCommand( node,730 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 740 731 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); 741 732 if (getRegion() == IALA_A) { 742 Main.main.undoRedo.add(new ChangePropertyCommand( node,733 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 743 734 "seamark:beacon_lateral:colour", "red;green;red")); 744 735 colour = "red"; 745 736 } else { 746 Main.main.undoRedo.add(new ChangePropertyCommand( node,737 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 747 738 "seamark:beacon_lateral:colour", "green;red;green")); 748 739 colour = "green"; … … 750 741 break; 751 742 case FLOAT: 752 Main.main.undoRedo.add(new ChangePropertyCommand( node,743 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 753 744 "seamark:light_float:colour_pattern", "horizontal stripes")); 754 745 if (getRegion() == IALA_A) { 755 Main.main.undoRedo.add(new ChangePropertyCommand( node,746 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 756 747 "seamark:light_float:colour", "red;green;red")); 757 748 colour = "red"; 758 749 } else { 759 Main.main.undoRedo.add(new ChangePropertyCommand( node,750 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 760 751 "seamark:light_float:colour", "green;red;green")); 761 752 colour = "green"; … … 770 761 case CONE: 771 762 super.saveSign("buoy_lateral"); 772 Main.main.undoRedo.add(new ChangePropertyCommand( node,763 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 773 764 "seamark:buoy_lateral:shape", "conical")); 774 765 break; 775 766 case PILLAR: 776 767 super.saveSign("buoy_lateral"); 777 Main.main.undoRedo.add(new ChangePropertyCommand( node,768 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 778 769 "seamark:buoy_lateral:shape", "pillar")); 779 770 break; 780 771 case SPAR: 781 772 super.saveSign("buoy_lateral"); 782 Main.main.undoRedo.add(new ChangePropertyCommand( node,773 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 783 774 "seamark:buoy_lateral:shape", "spar")); 784 775 break; 785 776 case BEACON: 786 777 super.saveSign("beacon_lateral"); 787 Main.main.undoRedo.add(new ChangePropertyCommand( node,778 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 788 779 "seamark:beacon_lateral:shape", "stake")); 789 780 break; 790 781 case TOWER: 791 782 super.saveSign("beacon_lateral"); 792 Main.main.undoRedo.add(new ChangePropertyCommand( node,783 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 793 784 "seamark:beacon_lateral:shape", "tower")); 794 785 break; … … 798 789 case PERCH: 799 790 super.saveSign("beacon_lateral"); 800 Main.main.undoRedo.add(new ChangePropertyCommand( node,791 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 801 792 "seamark:beacon_lateral:shape", "perch")); 802 793 break; … … 807 798 case PILLAR: 808 799 case SPAR: 809 Main.main.undoRedo.add(new ChangePropertyCommand( node,800 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 810 801 "seamark:buoy_lateral:category", "starboard")); 811 802 if (getRegion() == IALA_A) { 812 Main.main.undoRedo.add(new ChangePropertyCommand( node,803 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 813 804 "seamark:buoy_lateral:colour", "green")); 814 805 colour = "green"; 815 806 } else { 816 Main.main.undoRedo.add(new ChangePropertyCommand( node,807 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 817 808 "seamark:buoy_lateral:colour", "red")); 818 809 colour = "red"; … … 821 812 case BEACON: 822 813 case TOWER: 823 Main.main.undoRedo.add(new ChangePropertyCommand( node,814 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 824 815 "seamark:beacon_lateral:category", "starboard")); 825 816 if (getRegion() == IALA_A) { 826 Main.main.undoRedo.add(new ChangePropertyCommand( node,817 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 827 818 "seamark:beacon_lateral:colour", "green")); 828 819 colour = "green"; 829 820 } else { 830 Main.main.undoRedo.add(new ChangePropertyCommand( node,821 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 831 822 "seamark:beacon_lateral:colour", "red")); 832 823 colour = "red"; … … 835 826 case FLOAT: 836 827 if (getRegion() == IALA_A) { 837 Main.main.undoRedo.add(new ChangePropertyCommand( node,828 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 838 829 "seamark:light_float:colour", "green")); 839 830 colour = "green"; 840 831 } else { 841 Main.main.undoRedo.add(new ChangePropertyCommand( node,832 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 842 833 "seamark:light_float:colour", "red")); 843 834 colour = "red"; … … 845 836 break; 846 837 case PERCH: 847 Main.main.undoRedo.add(new ChangePropertyCommand( node,838 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 848 839 "seamark:beacon_lateral:category", "starboard")); 849 840 break; … … 856 847 case CONE: 857 848 super.saveSign("buoy_lateral"); 858 Main.main.undoRedo.add(new ChangePropertyCommand( node,849 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 859 850 "seamark:buoy_lateral:shape", "conical")); 860 851 break; 861 852 case PILLAR: 862 853 super.saveSign("buoy_lateral"); 863 Main.main.undoRedo.add(new ChangePropertyCommand( node,854 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 864 855 "seamark:buoy_lateral:shape", "pillar")); 865 856 break; 866 857 case SPAR: 867 858 super.saveSign("buoy_lateral"); 868 Main.main.undoRedo.add(new ChangePropertyCommand( node,859 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 869 860 "seamark:buoy_lateral:shape", "spar")); 870 861 break; 871 862 case BEACON: 872 863 super.saveSign("beacon_lateral"); 873 Main.main.undoRedo.add(new ChangePropertyCommand( node,864 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 874 865 "seamark:beacon_lateral:shape", "stake")); 875 866 break; 876 867 case TOWER: 877 868 super.saveSign("beacon_lateral"); 878 Main.main.undoRedo.add(new ChangePropertyCommand( node,869 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 879 870 "seamark:beacon_lateral:shape", "tower")); 880 871 break; … … 888 879 case PILLAR: 889 880 case SPAR: 890 Main.main.undoRedo.add(new ChangePropertyCommand( node,881 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 891 882 "seamark:buoy_lateral:category", "preferred_channel_starboard")); 892 Main.main.undoRedo.add(new ChangePropertyCommand( node,883 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 893 884 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); 894 885 if (getRegion() == IALA_A) { 895 Main.main.undoRedo.add(new ChangePropertyCommand( node,886 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 896 887 "seamark:buoy_lateral:colour", "green;red;green")); 897 888 colour = "green"; 898 889 } else { 899 Main.main.undoRedo.add(new ChangePropertyCommand( node,890 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 900 891 "seamark:buoy_lateral:colour", "red;green;red")); 901 892 colour = "red"; … … 904 895 case BEACON: 905 896 case TOWER: 906 Main.main.undoRedo.add(new ChangePropertyCommand( node,897 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 907 898 "seamark:beacon_lateral:category", "preferred_channel_starboard")); 908 Main.main.undoRedo.add(new ChangePropertyCommand( node,899 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 909 900 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); 910 901 if (getRegion() == IALA_A) { 911 Main.main.undoRedo.add(new ChangePropertyCommand( node,902 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 912 903 "seamark:beacon_lateral:colour", "green;red;green")); 913 904 colour = "green"; 914 905 } else { 915 Main.main.undoRedo.add(new ChangePropertyCommand( node,906 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 916 907 "seamark:beacon_lateral:colour", "red;green;red")); 917 908 colour = "red"; … … 919 910 break; 920 911 case FLOAT: 921 Main.main.undoRedo.add(new ChangePropertyCommand( node,912 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 922 913 "seamark:light_float:colour_pattern", "horizontal stripes")); 923 914 if (getRegion() == IALA_A) { 924 Main.main.undoRedo.add(new ChangePropertyCommand( node,915 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 925 916 "seamark:light_float:colour", "green;red;green")); 926 917 colour = "green"; 927 918 } else { 928 Main.main.undoRedo.add(new ChangePropertyCommand( node,919 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 929 920 "seamark:light_float:colour", "red;green;red")); 930 921 colour = "red"; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkLight.java
r24824 r24830 5 5 import javax.swing.ImageIcon; 6 6 7 import org.openstreetmap.josm.data.osm.Node;8 9 7 import oseam.dialogs.OSeaMAction; 10 8 import oseam.seamarks.SeaMark; 11 9 12 10 public class MarkLight extends SeaMark { 13 public MarkLight(OSeaMAction dia , Node node) {14 super(dia , node);11 public MarkLight(OSeaMAction dia) { 12 super(dia); 15 13 } 16 14 … … 18 16 19 17 Map<String, String> keys; 20 keys = getNode().getKeys();18 keys = dlg.node.getKeys(); 21 19 22 20 if (!dlg.panelMain.lightsButton.isSelected()) … … 63 61 dlg.cM01Fired.setSelected(true); 64 62 */ } 65 /* 66 public boolean isValid() { 67 return (getBuoyIndex() > 0); 68 } 69 */ 63 70 64 public void paintSign() { 71 65 /* if (dlg.paintlock) … … 73 67 super.paintSign(); 74 68 */ 75 if ( isValid()) {69 if (getCategory() != Cat.UNKNOWN) { 76 70 77 71 switch (getCategory()) { … … 102 96 103 97 public void saveSign() { 104 Node node = getNode(); 105 106 if (node == null) { 98 if (dlg.node == null) { 107 99 return; 108 100 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkSaw.java
r24824 r24830 5 5 import javax.swing.ImageIcon; 6 6 7 import org.openstreetmap.josm.data.osm.Node;8 7 import org.openstreetmap.josm.Main; 9 8 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 13 12 14 13 public class MarkSaw extends SeaMark { 15 public MarkSaw(OSeaMAction dia , Node node) {16 super(dia , node);14 public MarkSaw(OSeaMAction dia) { 15 super(dia); 17 16 } 18 17 … … 21 20 String str; 22 21 Map<String, String> keys; 23 keys = getNode().getKeys();22 keys = dlg.node.getKeys(); 24 23 25 24 if (!dlg.panelMain.chanButton.isSelected()) … … 84 83 * dlg.cbM01Kennung.setSelectedIndex(0); } 85 84 * 86 * public boolean isValid() { return (getBuoyIndex() > 0) &&87 * (getStyleIndex() > 0); }88 *89 85 * public void setLightColour() { super.setLightColour("W"); } 90 86 */ … … 93 89 * if (dlg.paintlock) return; super.paintSign(); 94 90 */ 95 if ( isValid()) {91 if ((getCategory() != Cat.UNKNOWN) && (getShape() != Shp.UNKNOWN)) { 96 92 97 93 String image = "/images/Safe_Water"; … … 150 146 151 147 public void saveSign() { 152 Node node = getNode(); 153 154 if (node == null) { 148 if (dlg.node == null) { 155 149 return; 156 150 } … … 159 153 case PILLAR: 160 154 super.saveSign("buoy_safe_water"); 161 Main.main.undoRedo.add(new ChangePropertyCommand( node,155 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 162 156 "seamark:buoy_safe_water:shape", "pillar")); 163 157 break; 164 158 case SPAR: 165 159 super.saveSign("buoy_safe_water"); 166 Main.main.undoRedo.add(new ChangePropertyCommand( node,160 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 167 161 "seamark:buoy_safe_water:shape", "spar")); 168 162 break; 169 163 case SPHERE: 170 164 super.saveSign("buoy_safe_water"); 171 Main.main.undoRedo.add(new ChangePropertyCommand( node,165 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 172 166 "seamark:buoy_safe_water:shape", "sphere")); 173 167 break; … … 185 179 case SPAR: 186 180 case SPHERE: 187 Main.main.undoRedo.add(new ChangePropertyCommand( node,181 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 188 182 "seamark:buoy_safe_water:colour_pattern", 189 183 "vertical stripes")); 190 Main.main.undoRedo.add(new ChangePropertyCommand( node,184 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 191 185 "seamark:buoy_safe_water:colour", "red;white")); 192 186 break; 193 187 case BEACON: 194 Main.main.undoRedo.add(new ChangePropertyCommand( node,188 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 195 189 "seamark:beacon_safe_water:colour_pattern", 196 190 "vertical stripes")); 197 Main.main.undoRedo.add(new ChangePropertyCommand( node,191 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 198 192 "seamark:beacon_safe_water:colour", "red;white")); 199 193 break; 200 194 case FLOAT: 201 Main.main.undoRedo.add(new ChangePropertyCommand( node,195 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 202 196 "seamark:light_float:colour_pattern", "vertical stripes")); 203 Main.main.undoRedo.add(new ChangePropertyCommand( node,197 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 204 198 "seamark:light_float:colour", "red;white")); 205 199 break; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkSpec.java
r24824 r24830 5 5 import javax.swing.ImageIcon; 6 6 7 import org.openstreetmap.josm.data.osm.Node;8 7 import org.openstreetmap.josm.Main; 9 8 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 11 10 import oseam.dialogs.OSeaMAction; 12 11 import oseam.seamarks.SeaMark; 13 import oseam.seamarks.SeaMark.Cat;14 import oseam.seamarks.SeaMark.Styl;15 12 16 13 public class MarkSpec extends SeaMark { 17 public MarkSpec(OSeaMAction dia , Node node) {18 super(dia , node);14 public MarkSpec(OSeaMAction dia) { 15 super(dia); 19 16 } 20 17 … … 23 20 String str; 24 21 Map<String, String> keys; 25 keys = getNode().getKeys();22 keys = dlg.node.getKeys(); 26 23 27 24 if (!dlg.panelMain.specButton.isSelected()) … … 120 117 */ } 121 118 122 public boolean isValid() {123 return (getCategory() != Cat.UNKNOWN_CAT)124 && (getShape() != Styl.UNKNOWN_SHAPE);125 }126 127 119 public void setLightColour() { 128 120 super.setLightColour("W"); … … 134 126 super.paintSign(); 135 127 */ 136 if ( isValid()) {128 if ((getCategory() != Cat.UNKNOWN) && (getShape() != Shp.UNKNOWN)) { 137 129 138 130 String image = "/images/Special_Purpose"; … … 255 247 256 248 public void saveSign() { 257 Node node = getNode(); 258 259 if (node == null) { 249 if (dlg.node == null) { 260 250 return; 261 251 } … … 264 254 case PILLAR: 265 255 super.saveSign("buoy_special_purpose"); 266 Main.main.undoRedo.add(new ChangePropertyCommand( node,256 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 267 257 "seamark:buoy_special_purpose:shape", "pillar")); 268 Main.main.undoRedo.add(new ChangePropertyCommand( node,258 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 269 259 "seamark:buoy_special_purpose:colour", "yellow")); 270 260 break; 271 261 case SPAR: 272 262 super.saveSign("buoy_special_purpose"); 273 Main.main.undoRedo.add(new ChangePropertyCommand( node,263 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 274 264 "seamark:buoy_special_purpose:shape", "spar")); 275 Main.main.undoRedo.add(new ChangePropertyCommand( node,265 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 276 266 "seamark:buoy_special_purpose:colour", "yellow")); 277 267 break; 278 268 case CAN: 279 269 super.saveSign("buoy_special_purpose"); 280 Main.main.undoRedo.add(new ChangePropertyCommand( node,270 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 281 271 "seamark:buoy_special_purpose:shape", "can")); 282 Main.main.undoRedo.add(new ChangePropertyCommand( node,272 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 283 273 "seamark:buoy_special_purpose:colour", "yellow")); 284 274 break; 285 275 case CONE: 286 276 super.saveSign("buoy_special_purpose"); 287 Main.main.undoRedo.add(new ChangePropertyCommand( node,277 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 288 278 "seamark:buoy_special_purpose:shape", "conical")); 289 Main.main.undoRedo.add(new ChangePropertyCommand( node,279 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 290 280 "seamark:buoy_special_purpose:colour", "yellow")); 291 281 break; 292 282 case SPHERE: 293 283 super.saveSign("buoy_special_purpose"); 294 Main.main.undoRedo.add(new ChangePropertyCommand( node,284 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 295 285 "seamark:buoy_special_purpose:shape", "sphere")); 296 Main.main.undoRedo.add(new ChangePropertyCommand( node,286 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 297 287 "seamark:buoy_special_purpose:colour", "yellow")); 298 288 break; 299 289 case BARREL: 300 290 super.saveSign("buoy_special_purpose"); 301 Main.main.undoRedo.add(new ChangePropertyCommand( node,291 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 302 292 "seamark:buoy_special_purpose:shape", "barrel")); 303 Main.main.undoRedo.add(new ChangePropertyCommand( node,293 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 304 294 "seamark:buoy_special_purpose:colour", "yellow")); 305 295 break; 306 296 case FLOAT: 307 297 super.saveSign("light_float"); 308 Main.main.undoRedo.add(new ChangePropertyCommand( node,298 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 309 299 "seamark:light_float:colour", "yellow")); 310 300 break; 311 301 case BEACON: 312 302 super.saveSign("beacon_special_purpose"); 313 Main.main.undoRedo.add(new ChangePropertyCommand( node,303 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 314 304 "seamark:beacon_special_purpose:colour", "yellow")); 315 305 break; 316 306 case TOWER: 317 307 super.saveSign("beacon_special_purpose"); 318 Main.main.undoRedo.add(new ChangePropertyCommand( node,308 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 319 309 "seamark:beacon_special_purpose:shape", "tower")); 320 Main.main.undoRedo.add(new ChangePropertyCommand( node,310 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 321 311 "seamark:beacon_special_purpose:colour", "yellow")); 322 312 break; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkUkn.java
r24801 r24830 1 1 package oseam.seamarks; 2 3 import org.openstreetmap.josm.data.osm.Node;4 2 5 3 import oseam.dialogs.OSeaMAction; 6 4 7 5 public class MarkUkn extends SeaMark { 8 public MarkUkn(OSeaMAction dia , Node node) {9 super(dia , node);6 public MarkUkn(OSeaMAction dia) { 7 super(dia); 10 8 dlg.panelMain.clearSelections(); 11 9 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24824 r24830 14 14 abstract public class SeaMark { 15 15 16 public enum Type {17 UNKNOWN_TYPE, LATERAL, CARDINAL, SAFE_WATER, ISOLATED_DANGER, SPECIAL_PURPOSE, LIGHT18 }19 20 public enum Cat {21 UNKNOWN_CAT, PORT_HAND, STARBOARD_HAND, PREF_PORT_HAND, PREF_STARBOARD_HAND, CARD_NORTH, CARD_EAST, CARD_SOUTH, CARD_WEST, LIGHT_HOUSE, LIGHT_MAJOR, LIGHT_MINOR, LIGHT_VESSEL22 }23 24 16 public final static boolean IALA_A = false; 25 17 public final static boolean IALA_B = true; 26 18 27 public enum Styl { 28 UNKNOWN_SHAPE, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, BEACON, TOWER, STAKE, PERCH 19 public enum Cat { 20 UNKNOWN, PORT_HAND, STARBOARD_HAND, PREF_PORT_HAND, PREF_STARBOARD_HAND, 21 CARD_NORTH, CARD_EAST, CARD_SOUTH, CARD_WEST, 22 LIGHT_HOUSE, LIGHT_MAJOR, LIGHT_MINOR, LIGHT_VESSEL, LIGHT_FLOAT 23 } 24 25 public enum Shp { 26 UNKNOWN, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, BEACON, TOWER, STAKE, PERCH 29 27 } 30 28 31 29 public enum Col { 32 UNKNOWN_COLOUR, RED, GREEN, RED_GREEN_RED, GREEN_RED_GREEN, RED_WHITE, BLACK_YELLOW, BLACK_YELLOW_BLACK, YELLOW_BLACK, YELLOW_BLACK_YELLOW, BLACK_RED_BLACK, YELLOW 33 } 34 35 public final static int WHITE_LIGHT = 1; 36 public final static int RED_LIGHT = 2; 37 public final static int GREEN_LIGHT = 3; 38 39 /** 40 * Topmark Shapes - correspond to TopMarkIndex 41 */ 42 43 public final static int UNKNOWN_TOPMARK = 0; 44 public final static int TOP_YELLOW_X = 1; 45 public final static int TOP_RED_X = 2; 46 public final static int TOP_YELLOW_CAN = 3; 47 public final static int TOP_YELLOW_CONE = 4; 48 49 /** 50 * Radar Beacons - correspond to Ratyp Index 51 */ 52 53 public final static int UNKNOWN_RATYPE = 0; 54 public final static int RATYPE_RACON = 1; 55 public final static int RATYPE_RAMARK = 2; 56 public final static int RATYPE_LEADING = 3; 57 58 /** 59 * Fog Signals - correspond to FogSound Index 60 */ 61 62 public final static int UNKNOWN_FOG = 0; 63 public final static int FOG_HORN = 1; 64 public final static int FOG_SIREN = 2; 65 public final static int FOG_DIA = 3; 66 public final static int FOG_BELL = 4; 67 public final static int FOG_WHIS = 5; 68 public final static int FOG_GONG = 6; 69 public final static int FOG_EXPLOS = 7; 30 UNKNOWN, WHITE, RED, ORANGE, AMBER, YELLOW, GREEN, BLUE, VIOLET, BLACK, 31 RED_GREEN_RED, GREEN_RED_GREEN, RED_WHITE, BLACK_YELLOW, BLACK_YELLOW_BLACK, YELLOW_BLACK, YELLOW_BLACK_YELLOW, BLACK_RED_BLACK 32 } 33 34 public enum Top { 35 UNKNOWN, X_SHAPE, CAN, CONE 36 } 37 38 public enum Rtb { 39 UNKNOWN, RACON, RAMARK, LEADING 40 } 41 42 public enum Fog { 43 UNKNOWN, HORN, SIREN, DIA, BELL, WHIS, GONG, EXPLOS 44 } 70 45 71 46 /** … … 79 54 } 80 55 81 protected SeaMark(OSeaMAction dia , Node node) {56 protected SeaMark(OSeaMAction dia) { 82 57 dlg = dia; 83 this.node = node; 84 } 85 86 private Node node = null; 87 88 public Node getNode() { 89 return node; 90 } 91 92 public void setNode(Node nod) { 93 node = nod; 58 region = Main.pref.get("tomsplugin.IALA").equals("B"); 94 59 } 95 60 … … 104 69 } 105 70 106 private Col colour = Col.UNKNOWN _COLOUR;71 private Col colour = Col.UNKNOWN; 107 72 108 73 public Col getColour() { … … 114 79 } 115 80 116 private String errMsg = null;117 118 public String getErrMsg() {119 return errMsg;120 }121 122 public void setErrMsg(String msg) {123 errMsg = msg;124 }125 126 81 private String name; 127 82 … … 134 89 } 135 90 136 private Cat category = Cat.UNKNOWN _CAT;91 private Cat category = Cat.UNKNOWN; 137 92 138 93 public Cat getCategory() { … … 144 99 } 145 100 146 private S tyl shape = Styl.UNKNOWN_SHAPE;147 148 public S tylgetShape() {101 private Shp shape = Shp.UNKNOWN; 102 103 public Shp getShape() { 149 104 return shape; 150 105 } 151 106 152 public void setShape(S tylstyl) {107 public void setShape(Shp styl) { 153 108 shape = styl; 154 }155 156 private boolean valid = true;157 158 public boolean isValid() {159 return valid;160 }161 162 public void setValid(boolean val) {163 valid = val;164 109 } 165 110 … … 194 139 } 195 140 196 private int RaType = 0;197 198 public intgetRaType() {141 private Rtb RaType = Rtb.UNKNOWN; 142 143 public Rtb getRaType() { 199 144 return RaType; 200 145 } 201 146 202 public void setRaType( inttype) {147 public void setRaType(Rtb type) { 203 148 RaType = type; 204 149 } … … 214 159 } 215 160 216 private boolean Fog = false;161 private boolean FogSignal = false; 217 162 218 163 public boolean hasFog() { 219 return Fog ;164 return FogSignal; 220 165 } 221 166 222 167 public void setFog(boolean fog) { 223 Fog = fog;224 } 225 226 private int FogSound = 0;227 228 public intgetFogSound() {168 FogSignal = fog; 169 } 170 171 private Fog FogSound = Fog.UNKNOWN; 172 173 public Fog getFogSound() { 229 174 return FogSound; 230 175 } 231 176 232 public void setFogSound( intsound) {177 public void setFogSound(Fog sound) { 233 178 FogSound = sound; 234 179 } … … 434 379 435 380 if (matcher.find()) { 436 setErrMsg(null);381 // setErrMsg(null); 437 382 } else { 438 setErrMsg("Must be a number");383 // setErrMsg("Must be a number"); 439 384 lightPeriod = ""; 440 385 // dlg.tfM01RepeatTime.requestFocus(); … … 529 474 str = k.get("seamark:fog_signal:category"); 530 475 if (str.equals("horn")) 531 setFogSound(F OG_HORN);476 setFogSound(Fog.HORN); 532 477 else if (str.equals("siren")) 533 setFogSound(F OG_SIREN);478 setFogSound(Fog.SIREN); 534 479 else if (str.equals("diaphone")) 535 setFogSound(F OG_DIA);480 setFogSound(Fog.DIA); 536 481 else if (str.equals("bell")) 537 setFogSound(F OG_BELL);482 setFogSound(Fog.BELL); 538 483 else if (str.equals("whis")) 539 setFogSound(F OG_WHIS);484 setFogSound(Fog.WHIS); 540 485 else if (str.equals("gong")) 541 setFogSound(F OG_GONG);486 setFogSound(Fog.GONG); 542 487 else if (str.equals("explosive")) 543 setFogSound(F OG_EXPLOS);488 setFogSound(Fog.EXPLOS); 544 489 else 545 setFogSound( UNKNOWN_FOG);490 setFogSound(Fog.UNKNOWN); 546 491 } 547 492 if (k.containsKey("seamark:fog_signal:group")) … … 562 507 str = k.get("seamark:radar_transponder:category"); 563 508 if (str.equals("racon")) 564 setRaType(R ATYPE_RACON);509 setRaType(Rtb.RACON); 565 510 else if (str.equals("ramark")) 566 setRaType(R ATYPE_RAMARK);511 setRaType(Rtb.RAMARK); 567 512 else if (str.equals("leading")) 568 setRaType(R ATYPE_LEADING);513 setRaType(Rtb.LEADING); 569 514 else 570 setRaType( UNKNOWN_RATYPE);515 setRaType(Rtb.UNKNOWN); 571 516 } 572 517 if (k.containsKey("seamark:radar_transponder:group")) … … 583 528 584 529 public void saveSign(String type) { 585 delSeaMarkKeys( node);530 delSeaMarkKeys(dlg.node); 586 531 587 532 String str = dlg.panelMain.nameBox.getText(); 588 533 if (!str.isEmpty()) 589 Main.main.undoRedo.add(new ChangePropertyCommand( node,534 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, 590 535 "seamark:name", str)); 591 Main.main.undoRedo.add(new ChangePropertyCommand( node, "seamark:type",536 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, "seamark:type", 592 537 type)); 593 538 }
Note:
See TracChangeset
for help on using the changeset viewer.