Changeset 24778 in osm for applications/editors/josm/plugins/smed/plugs/oseam
- Timestamp:
- 2010-12-16T19:47:50+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 1 added
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/OSeaM.java
r24658 r24778 8 8 import javax.swing.ImageIcon; 9 9 import javax.swing.JComponent; 10 11 import org.openstreetmap.josm.data.osm.DataSet; 10 12 11 13 import smed.plug.ifc.SmedPluggable; … … 22 24 public boolean start() { 23 25 // TODO Auto-generated method stub 26 System.out.println("start"); 24 27 return false; 25 28 } … … 27 30 @Override 28 31 public boolean stop() { 29 // TODO Auto-generated method stub 32 DataSet.removeSelectionListener(oseam.SmpListener); 33 System.out.println("stop"); 30 34 return false; 31 35 } … … 33 37 @Override 34 38 public boolean hasFocus() { 39 System.out.println("hasFocus"); 40 DataSet.addSelectionListener(oseam.SmpListener); 35 41 return false; 36 42 } … … 38 44 @Override 39 45 public boolean lostFocus() { 40 // TODO Auto-generated method stub 46 DataSet.removeSelectionListener(oseam.SmpListener); 47 System.out.println("lostFocus"); 41 48 return false; 42 49 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24737 r24778 45 45 import oseam.Messages; 46 46 import oseam.OSeaM; 47 import oseam.seamarks.SeaMark; 47 48 48 49 public class OSeaMAction { 49 50 50 private JPanel oseamPanel = null; 51 52 private JLabel shapeIcon = null; 53 private JLabel lightIcon = null; 54 private JLabel topIcon = null; 55 private JLabel reflIcon = null; 56 private JLabel radarIcon = null; 57 private JLabel fogIcon = null; 58 private JLabel nameLabel = null; 59 private JTextField nameBox = null; 60 private JButton saveButton = null; 61 private ButtonGroup typeButtons = null; 62 private JRadioButton chanButton = null; 63 private JRadioButton hazButton = null; 64 private JRadioButton specButton = null; 65 private JRadioButton lightsButton = null; 66 private ButtonGroup miscButtons = null; 67 private JRadioButton topButton = null; 68 private JRadioButton fogButton = null; 69 private JRadioButton radarButton = null; 70 private JRadioButton litButton = null; 71 private PanelChan panelChan = null; 72 private PanelHaz panelHaz = null; 73 private PanelSpec panelSpec = null; 74 private PanelLights panelLights = null; 75 private PanelTop panelTop = null; 76 private PanelFog panelFog = null; 77 private PanelRadar panelRadar = null; 78 private PanelLit panelLit = null; 51 private OSeaMAction dia = null; 52 private PanelMain panelMain = null; 53 54 private SeaMark mark = null; 55 private Collection<? extends OsmPrimitive> Selection = null; 56 private OsmPrimitive SelNode = null; 57 58 public SelectionChangedListener SmpListener = new SelectionChangedListener() { 59 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 60 Node node; 61 Selection = newSelection; 62 63 System.out.println("SmpListener"); 64 for (OsmPrimitive osm : Selection) { 65 if (osm instanceof Node) { 66 node = (Node) osm; 67 if (Selection.size() == 1) 68 if (node.compareTo(SelNode) != 0) { 69 SelNode = node; 70 System.out.println(node); 71 // parseSeaMark(); 72 // mark.paintSign(); 73 } 74 } 75 } 76 Selection = null; 77 } 78 }; 79 79 80 80 public OSeaMAction() { 81 81 82 dia = this; 82 83 String str = Main.pref.get("mappaint.style.sources"); 83 84 if (!str.contains("dev.openseamap.org")) { … … 90 91 if (str.equals("#000000") || str.isEmpty()) 91 92 Main.pref.put("color.background", "#606060"); 92 93 panelChan = new PanelChan(); 94 panelChan.setBounds(new Rectangle(65, 0, 335, 160)); 95 panelChan.setVisible(false); 96 panelHaz = new PanelHaz(); 97 panelHaz.setBounds(new Rectangle(65, 0, 335, 160)); 98 panelHaz.setVisible(false); 99 panelSpec = new PanelSpec(); 100 panelSpec.setBounds(new Rectangle(65, 0, 335, 160)); 101 panelSpec.setVisible(false); 102 panelLights = new PanelLights(); 103 panelLights.setBounds(new Rectangle(65, 0, 335, 160)); 104 panelLights.setVisible(false); 105 panelTop = new PanelTop(); 106 panelTop.setBounds(new Rectangle(40, 165, 220, 160)); 107 panelTop.setVisible(false); 108 panelFog = new PanelFog(); 109 panelFog.setBounds(new Rectangle(40, 165, 220, 160)); 110 panelFog.setVisible(false); 111 panelRadar = new PanelRadar(); 112 panelRadar.setBounds(new Rectangle(40, 165, 220, 160)); 113 panelRadar.setVisible(false); 114 panelLit = new PanelLit(); 115 panelLit.setBounds(new Rectangle(40, 165, 220, 160)); 116 panelLit.setVisible(false); 93 System.out.println("newOSeaMAction"); 117 94 } 118 95 119 96 public JPanel getOSeaMPanel() { 120 if (oseamPanel == null) { 121 oseamPanel = new JPanel(); 122 oseamPanel.setLayout(null); 123 oseamPanel.setSize(new Dimension(400, 360)); 124 125 shapeIcon = new JLabel(new ImageIcon(getClass().getResource( 126 "/images/Cardinal_Pillar_South.png"))); 127 shapeIcon.setBounds(new Rectangle(265, 170, 130, 185)); 128 oseamPanel.add(shapeIcon, null); 129 lightIcon = new JLabel(new ImageIcon(getClass().getResource( 130 "/images/Light_White_120.png"))); 131 lightIcon.setBounds(new Rectangle(265, 170, 125, 185)); 132 oseamPanel.add(lightIcon, null); 133 topIcon = new JLabel(); 134 topIcon.setBounds(new Rectangle(265, 170, 125, 185)); 135 oseamPanel.add(topIcon, null); 136 reflIcon = new JLabel(new ImageIcon(getClass().getResource( 137 "/images/Radar_Reflector_355.png"))); 138 reflIcon.setBounds(new Rectangle(265, 170, 125, 185)); 139 oseamPanel.add(reflIcon, null); 140 radarIcon = new JLabel(new ImageIcon(getClass().getResource( 141 "/images/Radar_Station.png"))); 142 radarIcon.setBounds(new Rectangle(265, 170, 130, 185)); 143 oseamPanel.add(radarIcon, null); 144 fogIcon = new JLabel(new ImageIcon(getClass().getResource( 145 "/images/Fog_Signal.png"))); 146 fogIcon.setBounds(new Rectangle(265, 170, 125, 185)); 147 oseamPanel.add(fogIcon, null); 148 149 oseamPanel.add(getChanButton(), null); 150 oseamPanel.add(getHazButton(), null); 151 oseamPanel.add(getSpecButton(), null); 152 oseamPanel.add(getLightsButton(), null); 153 oseamPanel.add(panelChan, null); 154 oseamPanel.add(panelHaz, null); 155 oseamPanel.add(panelSpec, null); 156 oseamPanel.add(panelLights, null); 157 oseamPanel.add(panelTop, null); 158 oseamPanel.add(panelFog, null); 159 oseamPanel.add(panelRadar, null); 160 oseamPanel.add(panelLit, null); 161 typeButtons = new ButtonGroup(); 162 typeButtons.add(chanButton); 163 typeButtons.add(hazButton); 164 typeButtons.add(specButton); 165 typeButtons.add(lightsButton); 166 ActionListener alType = new ActionListener() { 167 public void actionPerformed(java.awt.event.ActionEvent e) { 168 if (chanButton.isSelected()) { 169 chanButton.setBorderPainted(true); 170 panelChan.setVisible(true); 171 } else { 172 chanButton.setBorderPainted(false); 173 panelChan.setVisible(false); 174 } 175 if (hazButton.isSelected()) { 176 hazButton.setBorderPainted(true); 177 panelHaz.setVisible(true); 178 } else { 179 hazButton.setBorderPainted(false); 180 panelHaz.setVisible(false); 181 } 182 if (specButton.isSelected()) { 183 specButton.setBorderPainted(true); 184 panelSpec.setVisible(true); 185 } else { 186 specButton.setBorderPainted(false); 187 panelSpec.setVisible(false); 188 } 189 if (lightsButton.isSelected()) { 190 lightsButton.setBorderPainted(true); 191 panelLights.setVisible(true); 192 } else { 193 lightsButton.setBorderPainted(false); 194 panelLights.setVisible(false); 195 } 196 } 197 }; 198 chanButton.addActionListener(alType); 199 hazButton.addActionListener(alType); 200 specButton.addActionListener(alType); 201 lightsButton.addActionListener(alType); 202 203 oseamPanel.add(getTopButton(), null); 204 oseamPanel.add(getFogButton(), null); 205 oseamPanel.add(getRadarButton(), null); 206 oseamPanel.add(getLitButton(), null); 207 miscButtons = new ButtonGroup(); 208 miscButtons.add(topButton); 209 miscButtons.add(fogButton); 210 miscButtons.add(radarButton); 211 miscButtons.add(litButton); 212 ActionListener alMisc = new ActionListener() { 213 public void actionPerformed(java.awt.event.ActionEvent e) { 214 if (topButton.isSelected()) { 215 topButton.setBorderPainted(true); 216 panelTop.setVisible(true); 217 } else { 218 topButton.setBorderPainted(false); 219 panelTop.setVisible(false); 220 } 221 if (fogButton.isSelected()) { 222 fogButton.setBorderPainted(true); 223 panelFog.setVisible(true); 224 } else { 225 fogButton.setBorderPainted(false); 226 panelFog.setVisible(false); 227 } 228 if (radarButton.isSelected()) { 229 radarButton.setBorderPainted(true); 230 panelRadar.setVisible(true); 231 } else { 232 radarButton.setBorderPainted(false); 233 panelRadar.setVisible(false); 234 } 235 if (litButton.isSelected()) { 236 litButton.setBorderPainted(true); 237 panelLit.setVisible(true); 238 } else { 239 litButton.setBorderPainted(false); 240 panelLit.setVisible(false); 241 } 242 } 243 }; 244 topButton.addActionListener(alMisc); 245 fogButton.addActionListener(alMisc); 246 radarButton.addActionListener(alMisc); 247 litButton.addActionListener(alMisc); 248 249 nameLabel = new JLabel(); 250 nameLabel.setBounds(new Rectangle(5, 329, 60, 20)); 251 nameLabel.setText(tr("Name:")); 252 oseamPanel.add(nameLabel, null); 253 nameBox = new JTextField(); 254 nameBox.setBounds(new Rectangle(60, 330, 200, 20)); 255 oseamPanel.add(nameBox, null); 256 saveButton = new JButton(); 257 saveButton.setBounds(new Rectangle(285, 330, 100, 20)); 258 saveButton.setText(tr("Save")); 259 oseamPanel.add(saveButton, null); 260 } 261 return oseamPanel; 97 if (panelMain == null) { 98 panelMain = new PanelMain(); 99 panelMain.setLayout(null); 100 panelMain.setSize(new Dimension(400, 360)); 101 } 102 return panelMain; 262 103 } 263 264 private JRadioButton getChanButton() { 265 if (chanButton == null) { 266 chanButton = new JRadioButton(new ImageIcon(getClass().getResource( 267 "/images/ChanButton.png"))); 268 chanButton.setBounds(new Rectangle(0, 0, 62, 40)); 269 chanButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 270 chanButton.setToolTipText(Messages.getString("ChanTip")); 271 } 272 return chanButton; 104 /* 105 private void parseSeaMark() { 106 107 int nodes = 0; 108 Node node = null; 109 Collection<Node> selection = null; 110 Map<String, String> keys; 111 DataSet ds; 112 113 ds = Main.main.getCurrentDataSet(); 114 115 if (ds == null) { 116 mark = new MarkUkn(this, Messages.getString("SmpDialogAction.26")); 117 mark.setNode(null); 118 return; 119 } 120 121 selection = ds.getSelectedNodes(); 122 nodes = selection.size(); 123 124 if (nodes == 0) { 125 mark = new MarkUkn(this, Messages.getString("SmpDialogAction.27")); 126 mark.setNode(null); 127 return; 128 } 129 130 if (nodes > 1) { 131 mark = new MarkUkn(this, Messages.getString("SmpDialogAction.28")); 132 mark.setNode(null); 133 return; 134 } 135 136 Iterator<Node> it = selection.iterator(); 137 node = it.next(); 138 139 cM01IconVisible.setEnabled(true); 140 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 141 "/images/Auge.png"))); //$NON-NLS-1$ 142 143 cbM01TypeOfMark.setEnabled(true); 144 145 String type = ""; 146 String str = ""; 147 148 keys = node.getKeys(); 149 150 if (keys.containsKey("seamark:type")) 151 type = keys.get("seamark:type"); 152 153 if (type.equals("buoy_lateral") || type.equals("beacon_lateral")) { 154 mark = new MarkLat(this, node); 155 return; 156 157 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal")) { 158 mark = new MarkCard(this, node); 159 return; 160 161 } else if (type.equals("buoy_safe_water") || type.equals("beacon_safe_water")) { 162 mark = new MarkSaw(this, node); 163 return; 164 165 } else if (type.equals("buoy_special_purpose") || type.equals("beacon_special_purpose")) { 166 mark = new MarkSpec(this, node); 167 return; 168 169 } else if (type.equals("buoy_isolated_danger") || type.equals("beacon_isolated_danger")) { 170 mark = new MarkIsol(this, node); 171 return; 172 173 } else if (type.equals("landmark") || type.equals("light_vessel") 174 || type.equals("light_major") || type.equals("light_minor")) { 175 mark = new MarkNota(this, node); 176 return; 177 178 } else if (type.equals("light_float")) { 179 if (keys.containsKey("seamark:light_float:colour")) { 180 str = keys.get("seamark:light_float:colour"); 181 if (str.equals("red") || str.equals("green") 182 || str.equals("red;green;red") || str.equals("green;red;green")) { 183 mark = new MarkLat(this, node); 184 return; 185 } else if (str.equals("black;yellow") 186 || str.equals("black;yellow;black") || str.equals("yellow;black") 187 || str.equals("yellow;black;yellow")) { 188 mark = new MarkCard(this, node); 189 return; 190 } else if (str.equals("black;red;black")) { 191 mark = new MarkIsol(this, node); 192 return; 193 } else if (str.equals("red;white")) { 194 mark = new MarkSaw(this, node); 195 return; 196 } else if (str.equals("yellow")) { 197 mark = new MarkSpec(this, node); 198 return; 199 } 200 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { 201 str = keys.get("seamark:light_float:topmark:shape"); 202 if (str.equals("cylinder") || str.equals("cone, point up")) { 203 mark = new MarkLat(this, node); 204 return; 205 } 206 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { 207 str = keys.get("seamark:light_float:topmark:colour"); 208 if (str.equals("red") || str.equals("green")) { 209 mark = new MarkLat(this, node); 210 return; 211 } 212 } 213 } 214 215 if (keys.containsKey("buoy_lateral:category") || keys.containsKey("beacon_lateral:category")) { 216 mark = new MarkLat(this, node); 217 return; 218 } else if (keys.containsKey("buoy_cardinal:category") || keys.containsKey("beacon_cardinal:category")) { 219 mark = new MarkCard(this, node); 220 return; 221 } else if (keys.containsKey("buoy_isolated_danger:category") || keys.containsKey("beacon_isolated_danger:category")) { 222 mark = new MarkIsol(this, node); 223 return; 224 } else if (keys.containsKey("buoy_safe_water:category") || keys.containsKey("beacon_safe_water:category")) { 225 mark = new MarkSaw(this, node); 226 return; 227 } else if (keys.containsKey("buoy_special_purpose:category") || keys.containsKey("beacon_special_purpose:category")) { 228 mark = new MarkSpec(this, node); 229 return; 230 } 231 232 if (keys.containsKey("buoy_lateral:shape") || keys.containsKey("beacon_lateral:shape")) { 233 mark = new MarkLat(this, node); 234 return; 235 } else if (keys.containsKey("buoy_cardinal:shape") || keys.containsKey("beacon_cardinal:shape")) { 236 mark = new MarkCard(this, node); 237 return; 238 } else if (keys.containsKey("buoy_isolated_danger:shape") || keys.containsKey("beacon_isolated_danger:shape")) { 239 mark = new MarkIsol(this, node); 240 return; 241 } else if (keys.containsKey("buoy_safe_water:shape") || keys.containsKey("beacon_safe_water:shape")) { 242 mark = new MarkSaw(this, node); 243 return; 244 } else if (keys.containsKey("buoy_special_purpose:shape") || keys.containsKey("beacon_special_purpose:shape")) { 245 mark = new MarkSpec(this, node); 246 return; 247 } 248 249 if (keys.containsKey("buoy_lateral:colour") || keys.containsKey("beacon_lateral:colour")) { 250 mark = new MarkLat(this, node); 251 return; 252 } else if (keys.containsKey("buoy_cardinal:colour") || keys.containsKey("beacon_cardinal:colour")) { 253 mark = new MarkCard(this, node); 254 return; 255 } else if (keys.containsKey("buoy_isolated_danger:colour") || keys.containsKey("beacon_isolated_danger:colour")) { 256 mark = new MarkIsol(this, node); 257 return; 258 } else if (keys.containsKey("buoy_safe_water:colour") || keys.containsKey("beacon_safe_water:colour")) { 259 mark = new MarkSaw(this, node); 260 return; 261 } else if (keys.containsKey("buoy_special_purpose:colour") || keys.containsKey("beacon_special_purpose:colour")) { 262 mark = new MarkSpec(this, node); 263 return; 264 } 265 266 mark = new MarkUkn(this, Messages.getString("SmpDialogAction.91")); 267 mark.setNode(node); 268 mark.paintSign(); 269 return; 273 270 } 274 275 private JRadioButton getHazButton() { 276 if (hazButton == null) { 277 hazButton = new JRadioButton(new ImageIcon(getClass().getResource( 278 "/images/HazButton.png"))); 279 hazButton.setBounds(new Rectangle(0, 40, 62, 40)); 280 hazButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 281 hazButton.setToolTipText(Messages.getString("HazTip")); 282 } 283 return hazButton; 284 } 285 286 private JRadioButton getSpecButton() { 287 if (specButton == null) { 288 specButton = new JRadioButton(new ImageIcon(getClass().getResource( 289 "/images/SpecButton.png"))); 290 specButton.setBounds(new Rectangle(0, 80, 62, 40)); 291 specButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 292 specButton.setToolTipText(Messages.getString("SpecTip")); 293 } 294 return specButton; 295 } 296 297 private JRadioButton getLightsButton() { 298 if (lightsButton == null) { 299 lightsButton = new JRadioButton(new ImageIcon(getClass().getResource( 300 "/images/LightsButton.png"))); 301 lightsButton.setBounds(new Rectangle(0, 120, 62, 40)); 302 lightsButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 303 lightsButton.setToolTipText(Messages.getString("LightsTip")); 304 } 305 return lightsButton; 306 } 307 308 private JRadioButton getTopButton() { 309 if (topButton == null) { 310 topButton = new JRadioButton(new ImageIcon(getClass().getResource( 311 "/images/TopButton.png"))); 312 topButton.setBounds(new Rectangle(0, 165, 34, 32)); 313 topButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 314 topButton.setToolTipText(Messages.getString("TopmarksTip")); 315 } 316 return topButton; 317 } 318 319 private JRadioButton getFogButton() { 320 if (fogButton == null) { 321 fogButton = new JRadioButton(new ImageIcon(getClass().getResource( 322 "/images/FogButton.png"))); 323 fogButton.setBounds(new Rectangle(0, 205, 34, 32)); 324 fogButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 325 fogButton.setToolTipText(Messages.getString("FogSignalsTip")); 326 } 327 return fogButton; 328 } 329 330 private JRadioButton getRadarButton() { 331 if (radarButton == null) { 332 radarButton = new JRadioButton(new ImageIcon(getClass() 333 .getResource("/images/RadarButton.png"))); 334 radarButton.setBounds(new Rectangle(0, 245, 34, 32)); 335 radarButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 336 radarButton.setToolTipText(Messages.getString("RadarTip")); 337 } 338 return radarButton; 339 } 340 341 private JRadioButton getLitButton() { 342 if (litButton == null) { 343 litButton = new JRadioButton(new ImageIcon(getClass().getResource( 344 "/images/LitButton.png"))); 345 litButton.setBounds(new Rectangle(0, 285, 34, 32)); 346 litButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 347 litButton.setToolTipText(Messages.getString("LitTip")); 348 } 349 return litButton; 350 } 351 271 */ 352 272 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r24755 r24778 1 package oseam. dialogs;1 package oseam.panels; 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; … … 46 46 import oseam.OSeaM; 47 47 48 public class OSeaMAction { 49 50 private JPanel oseamPanel = null; 48 public class PanelMain extends JPanel { 51 49 52 50 private JLabel shapeIcon = null; … … 78 76 private PanelLit panelLit = null; 79 77 80 public OSeaMAction() { 81 82 String str = Main.pref.get("mappaint.style.sources"); 83 if (!str.contains("dev.openseamap.org")) { 84 if (!str.isEmpty()) 85 str += new String(new char[] { 0x1e }); 86 Main.pref.put("mappaint.style.sources", str 87 + "http://dev.openseamap.org/josm/seamark_styles.xml"); 88 } 89 str = Main.pref.get("color.background"); 90 if (str.equals("#000000") || str.isEmpty()) 91 Main.pref.put("color.background", "#606060"); 78 public PanelMain() { 92 79 93 80 panelChan = new PanelChan(); … … 115 102 panelLit.setBounds(new Rectangle(40, 165, 220, 160)); 116 103 panelLit.setVisible(false); 117 } 118 119 public JPanel getOSeaMPanel() { 120 if (oseamPanel == null) { 121 oseamPanel = new JPanel(); 122 oseamPanel.setLayout(null); 123 oseamPanel.setSize(new Dimension(400, 360)); 124 125 shapeIcon = new JLabel(new ImageIcon(getClass().getResource( 126 "/images/Cardinal_Pillar_South.png"))); 127 shapeIcon.setBounds(new Rectangle(265, 170, 130, 185)); 128 oseamPanel.add(shapeIcon, null); 129 lightIcon = new JLabel(new ImageIcon(getClass().getResource( 130 "/images/Light_White_120.png"))); 131 lightIcon.setBounds(new Rectangle(265, 170, 125, 185)); 132 oseamPanel.add(lightIcon, null); 133 topIcon = new JLabel(); 134 topIcon.setBounds(new Rectangle(265, 170, 125, 185)); 135 oseamPanel.add(topIcon, null); 136 reflIcon = new JLabel(new ImageIcon(getClass().getResource( 137 "/images/Radar_Reflector_355.png"))); 138 reflIcon.setBounds(new Rectangle(265, 170, 125, 185)); 139 oseamPanel.add(reflIcon, null); 140 radarIcon = new JLabel(new ImageIcon(getClass().getResource( 141 "/images/Radar_Station.png"))); 142 radarIcon.setBounds(new Rectangle(265, 170, 130, 185)); 143 oseamPanel.add(radarIcon, null); 144 fogIcon = new JLabel(new ImageIcon(getClass().getResource( 145 "/images/Fog_Signal.png"))); 146 fogIcon.setBounds(new Rectangle(265, 170, 125, 185)); 147 oseamPanel.add(fogIcon, null); 148 149 oseamPanel.add(getChanButton(), null); 150 oseamPanel.add(getHazButton(), null); 151 oseamPanel.add(getSpecButton(), null); 152 oseamPanel.add(getLightsButton(), null); 153 oseamPanel.add(panelChan, null); 154 oseamPanel.add(panelHaz, null); 155 oseamPanel.add(panelSpec, null); 156 oseamPanel.add(panelLights, null); 157 oseamPanel.add(panelTop, null); 158 oseamPanel.add(panelFog, null); 159 oseamPanel.add(panelRadar, null); 160 oseamPanel.add(panelLit, null); 161 typeButtons = new ButtonGroup(); 162 typeButtons.add(chanButton); 163 typeButtons.add(hazButton); 164 typeButtons.add(specButton); 165 typeButtons.add(lightsButton); 166 ActionListener alType = new ActionListener() { 167 public void actionPerformed(java.awt.event.ActionEvent e) { 168 if (chanButton.isSelected()) { 169 chanButton.setBorderPainted(true); 170 panelChan.setVisible(true); 171 } else { 172 chanButton.setBorderPainted(false); 173 panelChan.setVisible(false); 174 } 175 if (hazButton.isSelected()) { 176 hazButton.setBorderPainted(true); 177 panelHaz.setVisible(true); 178 } else { 179 hazButton.setBorderPainted(false); 180 panelHaz.setVisible(false); 181 } 182 if (specButton.isSelected()) { 183 specButton.setBorderPainted(true); 184 panelSpec.setVisible(true); 185 } else { 186 specButton.setBorderPainted(false); 187 panelSpec.setVisible(false); 188 } 189 if (lightsButton.isSelected()) { 190 lightsButton.setBorderPainted(true); 191 panelLights.setVisible(true); 192 } else { 193 lightsButton.setBorderPainted(false); 194 panelLights.setVisible(false); 195 } 196 } 197 }; 198 chanButton.addActionListener(alType); 199 hazButton.addActionListener(alType); 200 specButton.addActionListener(alType); 201 lightsButton.addActionListener(alType); 202 203 oseamPanel.add(getTopButton(), null); 204 oseamPanel.add(getFogButton(), null); 205 oseamPanel.add(getRadarButton(), null); 206 oseamPanel.add(getLitButton(), null); 207 miscButtons = new ButtonGroup(); 208 miscButtons.add(topButton); 209 miscButtons.add(fogButton); 210 miscButtons.add(radarButton); 211 miscButtons.add(litButton); 212 ActionListener alMisc = new ActionListener() { 213 public void actionPerformed(java.awt.event.ActionEvent e) { 214 if (topButton.isSelected()) { 215 topButton.setBorderPainted(true); 216 panelTop.setVisible(true); 217 } else { 218 topButton.setBorderPainted(false); 219 panelTop.setVisible(false); 220 } 221 if (fogButton.isSelected()) { 222 fogButton.setBorderPainted(true); 223 panelFog.setVisible(true); 224 } else { 225 fogButton.setBorderPainted(false); 226 panelFog.setVisible(false); 227 } 228 if (radarButton.isSelected()) { 229 radarButton.setBorderPainted(true); 230 panelRadar.setVisible(true); 231 } else { 232 radarButton.setBorderPainted(false); 233 panelRadar.setVisible(false); 234 } 235 if (litButton.isSelected()) { 236 litButton.setBorderPainted(true); 237 panelLit.setVisible(true); 238 } else { 239 litButton.setBorderPainted(false); 240 panelLit.setVisible(false); 241 } 242 } 243 }; 244 topButton.addActionListener(alMisc); 245 fogButton.addActionListener(alMisc); 246 radarButton.addActionListener(alMisc); 247 litButton.addActionListener(alMisc); 248 249 nameLabel = new JLabel(); 250 nameLabel.setBounds(new Rectangle(5, 329, 60, 20)); 251 nameLabel.setText(tr("Name:")); 252 oseamPanel.add(nameLabel, null); 253 nameBox = new JTextField(); 254 nameBox.setBounds(new Rectangle(60, 330, 200, 20)); 255 oseamPanel.add(nameBox, null); 256 saveButton = new JButton(); 257 saveButton.setBounds(new Rectangle(285, 330, 100, 20)); 258 saveButton.setText(tr("Save")); 259 oseamPanel.add(saveButton, null); 260 } 261 return oseamPanel; 104 105 shapeIcon = new JLabel(new ImageIcon(getClass().getResource( 106 "/images/Cardinal_Pillar_South.png"))); 107 shapeIcon.setBounds(new Rectangle(265, 170, 130, 185)); 108 this.add(shapeIcon, null); 109 lightIcon = new JLabel(new ImageIcon(getClass().getResource( 110 "/images/Light_White_120.png"))); 111 lightIcon.setBounds(new Rectangle(265, 170, 125, 185)); 112 this.add(lightIcon, null); 113 topIcon = new JLabel(); 114 topIcon.setBounds(new Rectangle(265, 170, 125, 185)); 115 this.add(topIcon, null); 116 reflIcon = new JLabel(new ImageIcon(getClass().getResource( 117 "/images/Radar_Reflector_355.png"))); 118 reflIcon.setBounds(new Rectangle(265, 170, 125, 185)); 119 this.add(reflIcon, null); 120 radarIcon = new JLabel(new ImageIcon(getClass().getResource( 121 "/images/Radar_Station.png"))); 122 radarIcon.setBounds(new Rectangle(265, 170, 130, 185)); 123 this.add(radarIcon, null); 124 fogIcon = new JLabel(new ImageIcon(getClass().getResource( 125 "/images/Fog_Signal.png"))); 126 fogIcon.setBounds(new Rectangle(265, 170, 125, 185)); 127 this.add(fogIcon, null); 128 129 this.add(getChanButton(), null); 130 this.add(getHazButton(), null); 131 this.add(getSpecButton(), null); 132 this.add(getLightsButton(), null); 133 this.add(panelChan, null); 134 this.add(panelHaz, null); 135 this.add(panelSpec, null); 136 this.add(panelLights, null); 137 this.add(panelTop, null); 138 this.add(panelFog, null); 139 this.add(panelRadar, null); 140 this.add(panelLit, null); 141 typeButtons = new ButtonGroup(); 142 typeButtons.add(chanButton); 143 typeButtons.add(hazButton); 144 typeButtons.add(specButton); 145 typeButtons.add(lightsButton); 146 ActionListener alType = new ActionListener() { 147 public void actionPerformed(java.awt.event.ActionEvent e) { 148 if (chanButton.isSelected()) { 149 chanButton.setBorderPainted(true); 150 panelChan.setVisible(true); 151 } else { 152 chanButton.setBorderPainted(false); 153 panelChan.setVisible(false); 154 } 155 if (hazButton.isSelected()) { 156 hazButton.setBorderPainted(true); 157 panelHaz.setVisible(true); 158 } else { 159 hazButton.setBorderPainted(false); 160 panelHaz.setVisible(false); 161 } 162 if (specButton.isSelected()) { 163 specButton.setBorderPainted(true); 164 panelSpec.setVisible(true); 165 } else { 166 specButton.setBorderPainted(false); 167 panelSpec.setVisible(false); 168 } 169 if (lightsButton.isSelected()) { 170 lightsButton.setBorderPainted(true); 171 panelLights.setVisible(true); 172 } else { 173 lightsButton.setBorderPainted(false); 174 panelLights.setVisible(false); 175 } 176 } 177 }; 178 chanButton.addActionListener(alType); 179 hazButton.addActionListener(alType); 180 specButton.addActionListener(alType); 181 lightsButton.addActionListener(alType); 182 183 this.add(getTopButton(), null); 184 this.add(getFogButton(), null); 185 this.add(getRadarButton(), null); 186 this.add(getLitButton(), null); 187 miscButtons = new ButtonGroup(); 188 miscButtons.add(topButton); 189 miscButtons.add(fogButton); 190 miscButtons.add(radarButton); 191 miscButtons.add(litButton); 192 ActionListener alMisc = new ActionListener() { 193 public void actionPerformed(java.awt.event.ActionEvent e) { 194 if (topButton.isSelected()) { 195 topButton.setBorderPainted(true); 196 panelTop.setVisible(true); 197 } else { 198 topButton.setBorderPainted(false); 199 panelTop.setVisible(false); 200 } 201 if (fogButton.isSelected()) { 202 fogButton.setBorderPainted(true); 203 panelFog.setVisible(true); 204 } else { 205 fogButton.setBorderPainted(false); 206 panelFog.setVisible(false); 207 } 208 if (radarButton.isSelected()) { 209 radarButton.setBorderPainted(true); 210 panelRadar.setVisible(true); 211 } else { 212 radarButton.setBorderPainted(false); 213 panelRadar.setVisible(false); 214 } 215 if (litButton.isSelected()) { 216 litButton.setBorderPainted(true); 217 panelLit.setVisible(true); 218 } else { 219 litButton.setBorderPainted(false); 220 panelLit.setVisible(false); 221 } 222 } 223 }; 224 topButton.addActionListener(alMisc); 225 fogButton.addActionListener(alMisc); 226 radarButton.addActionListener(alMisc); 227 litButton.addActionListener(alMisc); 228 229 nameLabel = new JLabel(); 230 nameLabel.setBounds(new Rectangle(5, 329, 60, 20)); 231 nameLabel.setText(tr("Name:")); 232 this.add(nameLabel, null); 233 nameBox = new JTextField(); 234 nameBox.setBounds(new Rectangle(60, 330, 200, 20)); 235 this.add(nameBox, null); 236 saveButton = new JButton(); 237 saveButton.setBounds(new Rectangle(285, 330, 100, 20)); 238 saveButton.setText(tr("Save")); 239 this.add(saveButton, null); 262 240 } 263 241 … … 267 245 "/images/ChanButton.png"))); 268 246 chanButton.setBounds(new Rectangle(0, 0, 62, 40)); 269 chanButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 247 chanButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 248 2)); 270 249 chanButton.setToolTipText(Messages.getString("ChanTip")); 271 250 } … … 278 257 "/images/HazButton.png"))); 279 258 hazButton.setBounds(new Rectangle(0, 40, 62, 40)); 280 hazButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 259 hazButton.setBorder(BorderFactory 260 .createLineBorder(Color.magenta, 2)); 281 261 hazButton.setToolTipText(Messages.getString("HazTip")); 282 262 } … … 289 269 "/images/SpecButton.png"))); 290 270 specButton.setBounds(new Rectangle(0, 80, 62, 40)); 291 specButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 271 specButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 272 2)); 292 273 specButton.setToolTipText(Messages.getString("SpecTip")); 293 274 } … … 297 278 private JRadioButton getLightsButton() { 298 279 if (lightsButton == null) { 299 lightsButton = new JRadioButton(new ImageIcon(getClass() .getResource(300 "/images/LightsButton.png"))); 280 lightsButton = new JRadioButton(new ImageIcon(getClass() 281 .getResource("/images/LightsButton.png"))); 301 282 lightsButton.setBounds(new Rectangle(0, 120, 62, 40)); 302 lightsButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 283 lightsButton.setBorder(BorderFactory.createLineBorder( 284 Color.magenta, 2)); 303 285 lightsButton.setToolTipText(Messages.getString("LightsTip")); 304 286 } … … 311 293 "/images/TopButton.png"))); 312 294 topButton.setBounds(new Rectangle(0, 165, 34, 32)); 313 topButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 295 topButton.setBorder(BorderFactory 296 .createLineBorder(Color.magenta, 2)); 314 297 topButton.setToolTipText(Messages.getString("TopmarksTip")); 315 298 } … … 322 305 "/images/FogButton.png"))); 323 306 fogButton.setBounds(new Rectangle(0, 205, 34, 32)); 324 fogButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 307 fogButton.setBorder(BorderFactory 308 .createLineBorder(Color.magenta, 2)); 325 309 fogButton.setToolTipText(Messages.getString("FogSignalsTip")); 326 310 } … … 333 317 .getResource("/images/RadarButton.png"))); 334 318 radarButton.setBounds(new Rectangle(0, 245, 34, 32)); 335 radarButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 319 radarButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 320 2)); 336 321 radarButton.setToolTipText(Messages.getString("RadarTip")); 337 322 } … … 344 329 "/images/LitButton.png"))); 345 330 litButton.setBounds(new Rectangle(0, 285, 34, 32)); 346 litButton.setBorder(BorderFactory.createLineBorder(Color.magenta, 2)); 331 litButton.setBorder(BorderFactory 332 .createLineBorder(Color.magenta, 2)); 347 333 litButton.setToolTipText(Messages.getString("LitTip")); 348 334 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24762 r24778 1 //License: GPL. For details, see LICENSE file. 2 // Copyright (c) 2009 / 2010 by Werner Koenig & Malcolm Herring 3 4 package toms.seamarks; 1 package oseam.seamarks; 5 2 6 3 import java.util.Iterator; … … 9 6 import org.openstreetmap.josm.command.ChangePropertyCommand; 10 7 import org.openstreetmap.josm.data.osm.Node; 11 12 // Kommentar zur Ausprobe svn13 8 14 9 abstract public class SeaMark { … … 145 140 */ 146 141 147 /** 148 * private Variablen 149 */ 142 public abstract void setLightColour(); 150 143 151 144 public abstract void paintSign();
Note:
See TracChangeset
for help on using the changeset viewer.