Changeset 23224 in osm for applications/editors/josm/plugins/toms/src
- Timestamp:
- 2010-09-16T18:42:43+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java
r23223 r23224 62 62 63 63 public class SmpDialogAction extends JosmAction { 64 private static final long serialVersionUID = -2976230949744302905L; 65 66 /** 67 * lokale Variable, private 68 */ 69 private SmpDialogAction dia = null; // Variable für den Handle von 70 // SmpDialogAction 71 private Buoy buoy = null; // Variable für Objekte des Typs "Tonne" // 72 // @jve:decl-index=0: 73 private boolean isOpen = false; // zeigt den Status des Dialogs an 74 private Node onode = null; // gemerkter Knoten 75 private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0: 76 private JMenuItem SmpItem = null; // Info über item in der Werkzeugleiste 77 private String smt = ""; // value vom key "seamark:type" // @jve:decl-index=0: //$NON-NLS-1$ 78 private String smb = ""; // value vom key "seamark" // @jve:decl-index=0: //$NON-NLS-1$ 79 private Collection<? extends OsmPrimitive> Selection = null; // @jve:decl-index=0: 80 private OsmPrimitive SelNode = null; 81 private String Os = ""; // @jve:decl-index=0: //$NON-NLS-1$ 82 private String UserHome = ""; // @jve:decl-index=0: //$NON-NLS-1$ 83 84 // SelectionChangedListner der in die Eventqueue von josm eingehängt wird 85 private SelectionChangedListener SmpListener = new SelectionChangedListener() { 86 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 87 Node node; 88 Selection = newSelection; 89 90 // System.out.println("hello"); 91 for (OsmPrimitive osm : Selection) { 92 if (osm instanceof Node) { 93 node = (Node) osm; 94 if (Selection.size() == 1) 95 // Absicherung gegen Doppelevents 96 if (node.compareTo(SelNode) != 0) { 97 SelNode = node; 98 parseSeaMark(); 99 buoy.paintSign(); 100 } 101 } 102 } 103 104 Selection = null; 105 106 } 107 }; 108 109 /** 110 * lokale Variable der Maske 111 */ 112 private JDialog dM01SeaMap = null; 113 private JPanel pM01SeaMap = null; 114 private JLabel lM01Head = null; 115 private JLabel lM01Region = null; 116 private JLabel lM02Region = null; 117 public ButtonGroup bgM01Region = null; 118 public JRadioButton rbM01RegionA = null; 119 public JRadioButton rbM01RegionB = null; 120 public JLabel lM01Icon = null; // Shape 121 public JLabel lM02Icon = null; // Light 122 public JLabel lM03Icon = null; // Reflector 123 public JLabel lM04Icon = null; // Racon 124 public JLabel lM05Icon = null; // Fog 125 public JLabel lM06Icon = null; // Topmark 126 public JLabel lM01FireMark = null; 127 private JLabel lM01TypeOfMark = null; 128 public JComboBox cbM01TypeOfMark = null; 129 public JLabel lM01CatOfMark = null; 130 public JComboBox cbM01CatOfMark = null; 131 public JLabel lM01StyleOfMark = null; 132 public JComboBox cbM01StyleOfMark = null; 133 private JLabel lM01Name = null; 134 public JTextField tfM01Name = null; 135 private JLabel lM01Props02 = null; 136 public JCheckBox cM01TopMark = null; 137 public JComboBox cbM01TopMark = null; 138 public JCheckBox cM01Radar = null; 139 public JCheckBox cM01Racon = null; 140 public JComboBox cbM01Racon = null; 141 public JTextField tfM01Racon = null; 142 public JLabel lM01Racon = null; 143 public JCheckBox cM01Fog = null; 144 public JComboBox cbM01Fog = null; 145 public JLabel lM01FogGroup = null; 146 public JTextField tfM01FogGroup = null; 147 public JLabel lM01FogPeriod = null; 148 public JTextField tfM01FogPeriod = null; 149 public JCheckBox cM01Fired = null; 150 public ButtonGroup bgM01Fired = null; 151 public JRadioButton rbM01Fired1 = null; 152 public JRadioButton rbM01FiredN = null; 153 public JLabel lM01Kennung = null; 154 public JComboBox cbM01Kennung = null; 155 public JLabel lM01Height = null; 156 public JTextField tfM01Height = null; 157 public JLabel lM01Range = null; 158 public JTextField tfM01Range = null; 159 public JLabel lM01Group = null; 160 public JTextField tfM01Group = null; 161 public JLabel lM01RepeatTime = null; 162 public JTextField tfM01RepeatTime = null; 163 public JLabel lM01Sector = null; 164 public JComboBox cbM01Sector = null; 165 public JLabel lM01Colour = null; 166 public JComboBox cbM01Colour = null; 167 public JLabel lM01Bearing = null; 168 public JTextField tfM01Bearing = null; 169 public JTextField tfM02Bearing = null; 170 public JTextField tfM01Radius = null; 171 public JButton bM01Save = null; 172 public JButton bM01Close = null; 173 public JCheckBox cM01IconVisible = null; 174 public JTextField sM01StatusBar = null; 175 176 public boolean paintlock = false; 177 178 public JMenuItem getSmpItem() { 179 return SmpItem; 180 } 181 182 public void setSmpItem(JMenuItem smpItem) { 183 SmpItem = smpItem; 184 } 185 186 public boolean isOpen() { 187 return isOpen; 188 } 189 190 public void setOpen(boolean isOpen) { 191 this.isOpen = isOpen; 192 } 193 194 public String getOs() { 195 return Os; 196 } 197 198 public void setOs(String os) { 199 Os = os; 200 } 201 202 public String getUserHome() { 203 return UserHome; 204 } 205 206 public void setUserHome(String userHome) { 207 UserHome = userHome; 208 } 209 210 public SmpDialogAction() { 211 super( 212 Messages.getString("SmpDialogAction.4"), "Smp", Messages.getString("SmpDialogAction.0"), Shortcut //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 213 .registerShortcut( 214 "tools:Semarks", //$NON-NLS-1$ 215 tr("Tool: {0}", Messages.getString("SmpDialogAction.9")), KeyEvent.VK_S, //$NON-NLS-1$ //$NON-NLS-2$ 216 Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 217 218 dia = this; 219 String str = Main.pref.get("mappaint.style.sources"); //$NON-NLS-1$ 220 if (!str.contains("dev.openseamap.org")) { //$NON-NLS-1$ 221 if (!str.isEmpty()) //$NON-NLS-1$ 222 str += new String(new char[] { 0x1e }); 223 Main.pref.put("mappaint.style.sources", str //$NON-NLS-1$ 224 + "http://dev.openseamap.org/josm/seamark_styles.xml"); //$NON-NLS-1$ 225 } 226 str = Main.pref.get("color.background"); //$NON-NLS-1$ 227 if (str.equals("#000000") || str.isEmpty()) //$NON-NLS-1$ //$NON-NLS-2$ 228 Main.pref.put("color.background", "#606060"); //$NON-NLS-1$ //$NON-NLS-2$ 229 } 230 231 public void CloseDialog() { 232 onode = null; 233 DataSet.removeSelectionListener(SmpListener); 234 Selection = null; 235 236 if (isOpen) 237 dM01SeaMap.dispose(); 238 isOpen = false; 239 240 } 241 242 public void actionPerformed(ActionEvent e) { 243 244 /* 245 * int option = JOptionPane.showConfirmDialog(Main.parent, 246 * tr("THIS IS EXPERIMENTAL. Save your work and verify before uploading.\n" 247 * + "Are you really sure to continue?"), 248 * tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION, 249 * JOptionPane.WARNING_MESSAGE); 250 * 251 * if (option != JOptionPane.YES_OPTION) { return; } 252 */ 253 254 onode = null; 255 obuoy = null; 256 257 SwingUtilities.invokeLater(new Runnable() { 258 public void run() { 259 JDialog dialog = getDM01SeaMap(); 260 261 if (SmpItem == null) { 262 } 263 dialog.setVisible(true); 264 } 265 }); 266 267 setOpen(true); 268 269 if (SmpItem == null) { 270 return; 271 } 272 SmpItem.setEnabled(false); 273 274 // Ausprobe: Möglichkeit der Benachrichtigung, wenn etwas neu 275 // selektiert wird (ueber SelectionChangedListener) 276 // private Collection<? extends OsmPrimitive> sel; 277 // siehe org.openstreetmap.josm.plugins.osb -> OsbLayer.java 278 // Einhängen des Listeners in die Eventqueue von josm 279 DataSet.addSelectionListener(SmpListener); 280 } 281 282 private void PicRebuild() { 283 284 DataSet ds = Main.main.getCurrentDataSet(); 285 286 if (obuoy == null) { 287 return; 288 } 289 290 Node n = obuoy.getNode(); 291 292 if (n != null) { 293 Command c; 294 295 if (smb != "") { //$NON-NLS-1$ 296 297 c = new ChangePropertyCommand(n, "seamark", smb); //$NON-NLS-1$ 298 c.executeCommand(); 299 ds.fireSelectionChanged(); 300 301 smb = ""; //$NON-NLS-1$ 302 } 303 304 if (smt != "") { //$NON-NLS-1$ 305 306 c = new ChangePropertyCommand(n, "seamark:type", smt); //$NON-NLS-1$ 307 c.executeCommand(); 308 ds.fireSelectionChanged(); 309 310 smt = ""; //$NON-NLS-1$ 311 } 312 } 313 314 obuoy = null; 315 316 } 317 318 private void parseSeaMark() { 319 320 int nodes = 0; 321 Node node = null; 322 Collection<Node> selection = null; 323 Map<String, String> keys; 324 DataSet ds; 325 326 ds = Main.main.getCurrentDataSet(); 327 328 if (ds == null) { 329 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.26")); //$NON-NLS-1$ 330 buoy.setNode(null); 331 return; 332 } 333 334 selection = ds.getSelectedNodes(); 335 nodes = selection.size(); 336 337 if (nodes == 0) { 338 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.27")); //$NON-NLS-1$ 339 buoy.setNode(null); 340 return; 341 } 342 343 if (nodes > 1) { 344 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.28")); //$NON-NLS-1$ 345 buoy.setNode(null); 346 return; 347 } 348 349 Iterator<Node> it = selection.iterator(); 350 node = it.next(); 351 352 if (onode != null) 353 if (node.equals(onode)) 354 return; 355 356 // Knoten wurde gewechselt -> die alten tags (benutzt zum Ausblenden der 357 // Pictogramme) wiederherstellen 358 if (obuoy != null) 359 PicRebuild(); 360 361 onode = node; 362 363 cM01IconVisible.setEnabled(true); 364 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 365 "/images/Auge.png"))); //$NON-NLS-1$ 366 367 cbM01TypeOfMark.setEnabled(true); 368 369 // Soweit das Vorspiel. Ab hier beginnt das Parsen 370 String type = ""; //$NON-NLS-1$ 371 String str = ""; //$NON-NLS-1$ 372 373 keys = node.getKeys(); 374 375 // vorsorglich den Namen holen und verwenden, wenn es ein 376 // Seezeichen ist. Name kann durch die weiteren Tags ueber- 377 // schrieben werden 378 379 if (keys.containsKey("seamark:type")) //$NON-NLS-1$ 380 type = keys.get("seamark:type"); //$NON-NLS-1$ 381 382 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$ 383 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$ 384 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$ 385 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$ 386 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$ 387 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$ 388 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$ 389 buoy = new BuoyLat(this, node); 390 return; 391 392 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$ 393 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$ 394 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$ 395 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$ 396 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$ 397 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$ 398 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 399 buoy = new BuoyCard(this, node); 400 return; 401 402 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$ 403 || type.equals("beacon_safe_water") //$NON-NLS-1$ 404 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$ 405 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$ 406 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$ 407 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$ 408 buoy = new BuoySaw(this, node); 409 return; 410 411 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$ 412 || type.equals("beacon_special_purpose") //$NON-NLS-1$ 413 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$ 414 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$ 415 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 416 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$ 417 buoy = new BuoySpec(this, node); 418 return; 419 420 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$ 421 || type.equals("beacon_isolated_danger") //$NON-NLS-1$ 422 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$ 423 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$ 424 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$ 425 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 426 buoy = new BuoyIsol(this, node); 427 return; 428 429 } else if (type.equals("landmark") || type.equals("light_vessel") //$NON-NLS-1$ 430 || type.equals("light_major") || type.equals("light_minor")) { //$NON-NLS-1$ 431 buoy = new BuoyNota(this, node); 432 return; 433 434 } else if (type.equals("light_float")) { //$NON-NLS-1$ 435 if (keys.containsKey("seamark:light_float:colour")) { //$NON-NLS-1$ 436 str = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 437 if (str.equals("red") || str.equals("green") //$NON-NLS-1$ //$NON-NLS-2$ 438 || str.equals("red;green;red") || str.equals("green;red;green")) { //$NON-NLS-1$ //$NON-NLS-2$ 439 buoy = new BuoyLat(this, node); 440 return; 441 } else if (str.equals("black;yellow") //$NON-NLS-1$ 442 || str.equals("black;yellow;black") || str.equals("yellow;black") //$NON-NLS-1$ //$NON-NLS-2$ 443 || str.equals("yellow;black;yellow")) { //$NON-NLS-1$ 444 buoy = new BuoyCard(this, node); 445 return; 446 } else if (str.equals("black;red;black")) { //$NON-NLS-1$ 447 buoy = new BuoyIsol(this, node); 448 return; 449 } else if (str.equals("red;white")) { //$NON-NLS-1$ 450 buoy = new BuoySaw(this, node); 451 return; 452 } else if (str.equals("yellow")) { //$NON-NLS-1$ 453 buoy = new BuoySpec(this, node); 454 return; 455 } 456 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { //$NON-NLS-1$ 457 str = keys.get("seamark:light_float:topmark:shape"); //$NON-NLS-1$ 458 if (str.equals("cylinder") || str.equals("cone, point up")) { //$NON-NLS-1$ //$NON-NLS-2$ 459 buoy = new BuoyLat(this, node); 460 return; 461 } 462 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { //$NON-NLS-1$ 463 str = keys.get("seamark:light_float:topmark:colour"); //$NON-NLS-1$ 464 if (str.equals("red") || str.equals("green")) { //$NON-NLS-1$ //$NON-NLS-2$ 465 buoy = new BuoyLat(this, node); 466 return; 467 } 468 } 469 } 470 471 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.91")); //$NON-NLS-1$ 472 buoy.setNode(node); 473 return; 474 } 475 476 private JDialog getDM01SeaMap() { 477 478 if (dM01SeaMap == null) { 479 dM01SeaMap = new JDialog(); 480 dM01SeaMap.setSize(new Dimension(400, 400)); 481 dM01SeaMap.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 482 dM01SeaMap.setModal(false); 483 dM01SeaMap.setResizable(false); 484 dM01SeaMap.setContentPane(getPM01SeaMap()); 485 dM01SeaMap.setTitle(Messages.getString("SmpDialogAction.9")); //$NON-NLS-1$ 486 dM01SeaMap.setVisible(false); 487 dM01SeaMap.setAlwaysOnTop(true); 488 dM01SeaMap.addWindowListener(new java.awt.event.WindowAdapter() { 489 public void windowClosing(java.awt.event.WindowEvent e) { 490 491 // Pictogramme wiederherstellen und aufraeumen 492 if (obuoy != null) 493 PicRebuild(); 494 // Deaktivierung des Listeners 495 DataSet.removeSelectionListener(SmpListener); 496 Selection = null; 497 498 SmpItem.setEnabled(true); 499 } 500 501 public void windowActivated(WindowEvent arg0) { 502 parseSeaMark(); 503 buoy.paintSign(); 504 } 505 }); 506 } 507 return dM01SeaMap; 508 } 509 510 private JPanel getPM01SeaMap() { 511 if (pM01SeaMap == null) { 512 513 lM01Icon = new JLabel(); 514 lM01Icon.setBounds(new Rectangle(210, 20, 150, 200)); 515 lM01Icon.setIcon(null); 516 lM01Icon.setText(""); //$NON-NLS-1$ 517 518 lM02Icon = new JLabel(); 519 lM02Icon.setBounds(new Rectangle(210, 20, 150, 200)); 520 lM02Icon.setIcon(null); 521 lM02Icon.setText(""); //$NON-NLS-1$ 522 523 lM03Icon = new JLabel(); 524 lM03Icon.setBounds(new Rectangle(210, -50, 150, 200)); 525 lM03Icon.setIcon(null); 526 lM03Icon.setText(""); //$NON-NLS-1$ 527 528 lM04Icon = new JLabel(); 529 lM04Icon.setBounds(new Rectangle(210, 20, 150, 200)); 530 lM04Icon.setIcon(null); 531 lM04Icon.setText(""); //$NON-NLS-1$ 532 533 lM05Icon = new JLabel(); 534 lM05Icon.setBounds(new Rectangle(210, 20, 150, 200)); 535 lM05Icon.setIcon(null); 536 lM05Icon.setText(""); //$NON-NLS-1$ 537 538 lM06Icon = new JLabel(); 539 lM06Icon.setBounds(new Rectangle(210, 20, 150, 200)); 540 lM06Icon.setIcon(null); 541 lM06Icon.setText(""); //$NON-NLS-1$ 542 543 lM01FireMark = new JLabel(); 544 lM01FireMark.setBounds(new Rectangle(300, 85, 95, 20)); 545 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 546 lM01FireMark.setText(""); //$NON-NLS-1$ 547 548 lM01Head = new JLabel(); 549 lM01Head.setBounds(new Rectangle(5, 3, 316, 16)); 550 lM01Head.setText(Messages.getString("SmpDialogAction.97")); //$NON-NLS-1$ 551 552 lM01Region = new JLabel(); 553 lM01Region.setBounds(new Rectangle(220, 7, 120, 16)); 554 lM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 555 lM01Region.setText(Messages.getString("SmpDialogAction.99")); //$NON-NLS-1$ 556 557 lM02Region = new JLabel(); 558 lM02Region.setBounds(new Rectangle(270, 7, 120, 16)); 559 lM02Region.setFont(new Font("Dialog", Font.BOLD, 12)); //$NON-NLS-1$ 560 lM02Region.setText(Messages.getString("SmpDialogAction.101")); //$NON-NLS-1$ 561 562 lM01TypeOfMark = new JLabel(); 563 lM01TypeOfMark.setBounds(new Rectangle(5, 28, 120, 16)); 564 lM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 565 lM01TypeOfMark.setText(Messages.getString("SmpDialogAction.103")); //$NON-NLS-1$ 566 567 lM01CatOfMark = new JLabel(); 568 lM01CatOfMark.setBounds(new Rectangle(5, 58, 120, 16)); 569 lM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 570 lM01CatOfMark.setText(Messages.getString("SmpDialogAction.1")); //$NON-NLS-1$ 571 572 lM01StyleOfMark = new JLabel(); 573 lM01StyleOfMark.setBounds(new Rectangle(5, 88, 148, 16)); 574 lM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 575 lM01StyleOfMark.setText(Messages.getString("SmpDialogAction.107")); //$NON-NLS-1$ 576 577 lM01Name = new JLabel(); 578 lM01Name.setBounds(new Rectangle(5, 120, 82, 16)); 579 lM01Name.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 580 lM01Name.setText(Messages.getString("SmpDialogAction.109")); //$NON-NLS-1$ 581 582 lM01Props02 = new JLabel(); 583 lM01Props02.setBounds(new Rectangle(5, 150, 172, 16)); 584 lM01Props02.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 585 lM01Props02.setText(Messages.getString("SmpDialogAction.111")); //$NON-NLS-1$ 586 587 lM01Racon = new JLabel(); 588 lM01Racon.setBounds(new Rectangle(335, 195, 65, 20)); 589 lM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 590 lM01Racon.setText(Messages.getString("SmpDialogAction.113")); //$NON-NLS-1$ 591 592 lM01FogGroup = new JLabel(); 593 lM01FogGroup.setBounds(new Rectangle(190, 220, 100, 20)); 594 lM01FogGroup.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 595 lM01FogGroup.setText(Messages.getString("SmpDialogAction.115")); //$NON-NLS-1$ 596 597 lM01FogPeriod = new JLabel(); 598 lM01FogPeriod.setBounds(new Rectangle(300, 220, 100, 20)); 599 lM01FogPeriod.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 600 lM01FogPeriod.setText(Messages.getString("SmpDialogAction.117")); //$NON-NLS-1$ 601 602 lM01Kennung = new JLabel(); 603 lM01Kennung.setBounds(new Rectangle(240, 245, 60, 20)); 604 lM01Kennung.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 605 lM01Kennung.setText(Messages.getString("SmpDialogAction.119")); //$NON-NLS-1$ 606 607 lM01Height = new JLabel(); 608 lM01Height.setBounds(new Rectangle(10, 270, 100, 20)); 609 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 610 lM01Height.setText(Messages.getString("SmpDialogAction.121")); //$NON-NLS-1$ 611 612 lM01Range = new JLabel(); 613 lM01Range.setBounds(new Rectangle(108, 270, 100, 20)); 614 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 615 lM01Range.setText(Messages.getString("SmpDialogAction.123")); //$NON-NLS-1$ 616 617 lM01Group = new JLabel(); 618 lM01Group.setBounds(new Rectangle(204, 270, 100, 20)); 619 lM01Group.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 620 lM01Group.setText(Messages.getString("SmpDialogAction.125")); //$NON-NLS-1$ 621 622 lM01RepeatTime = new JLabel(); 623 lM01RepeatTime.setBounds(new Rectangle(300, 270, 100, 20)); 624 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 625 lM01RepeatTime.setText(Messages.getString("SmpDialogAction.127")); //$NON-NLS-1$ 626 627 lM01Sector = new JLabel(); 628 lM01Sector.setBounds(new Rectangle(10, 295, 180, 20)); 629 lM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 630 lM01Sector.setText(Messages.getString("SmpDialogAction.129")); //$NON-NLS-1$ 631 632 lM01Colour = new JLabel(); 633 lM01Colour.setBounds(new Rectangle(120, 295, 180, 20)); 634 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 635 lM01Colour.setText(Messages.getString("SmpDialogAction.131")); //$NON-NLS-1$ 636 637 lM01Bearing = new JLabel(); 638 lM01Bearing.setBounds(new Rectangle(228, 295, 180, 20)); 639 lM01Bearing.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 640 lM01Bearing.setText(Messages.getString("SmpDialogAction.133")); //$NON-NLS-1$ 641 642 rbM01RegionA = new JRadioButton( 643 Messages.getString("SmpDialogAction.134"), Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 644 .equals("A")); //$NON-NLS-1$ 645 rbM01RegionA.setBounds(new Rectangle(305, 0, 50, 30)); 646 rbM01RegionB = new JRadioButton("-B", Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 647 .equals("B")); //$NON-NLS-1$ 648 rbM01RegionB.setBounds(new Rectangle(352, 0, 50, 30)); 649 bgM01Region = new ButtonGroup(); 650 bgM01Region.add(rbM01RegionA); 651 bgM01Region.add(rbM01RegionB); 652 653 ActionListener alM01Region = new ActionListener() { 654 public void actionPerformed(java.awt.event.ActionEvent e) { 655 if (buoy instanceof BuoyLat) { 656 buoy.setRegion(rbM01RegionB.isSelected()); 657 buoy.setLightColour(); 658 buoy.paintSign(); 659 } 660 } 661 }; 662 rbM01RegionA.addActionListener(alM01Region); 663 rbM01RegionB.addActionListener(alM01Region); 664 665 rbM01Fired1 = new JRadioButton( 666 Messages.getString("SmpDialogAction.140"), true); //$NON-NLS-1$ 667 rbM01Fired1.setBounds(new Rectangle(85, 240, 70, 30)); 668 rbM01FiredN = new JRadioButton( 669 Messages.getString("SmpDialogAction.141"), false); //$NON-NLS-1$ 670 rbM01FiredN.setBounds(new Rectangle(155, 240, 80, 30)); 671 bgM01Fired = new ButtonGroup(); 672 bgM01Fired.add(rbM01Fired1); 673 bgM01Fired.add(rbM01FiredN); 674 675 ActionListener alM01Fired = new ActionListener() { 676 public void actionPerformed(java.awt.event.ActionEvent e) { 677 buoy.setSectored(rbM01FiredN.isSelected()); 678 cbM01Sector.setSelectedIndex(0); 679 buoy.setSectorIndex(0); 680 buoy.paintSign(); 681 } 682 }; 683 rbM01Fired1.addActionListener(alM01Fired); 684 rbM01FiredN.addActionListener(alM01Fired); 685 686 pM01SeaMap = new JPanel(); 687 pM01SeaMap.setLayout(null); 688 pM01SeaMap.add(lM01Head, null); 689 pM01SeaMap.add(rbM01RegionA, null); 690 pM01SeaMap.add(rbM01RegionB, null); 691 pM01SeaMap.add(lM01Region, null); 692 pM01SeaMap.add(lM02Region, null); 693 pM01SeaMap.add(lM01Icon, null); 694 pM01SeaMap.add(lM02Icon, null); 695 pM01SeaMap.add(lM03Icon, null); 696 pM01SeaMap.add(lM04Icon, null); 697 pM01SeaMap.add(lM05Icon, null); 698 pM01SeaMap.add(lM06Icon, null); 699 pM01SeaMap.add(getCbM01TypeOfMark(), null); 700 pM01SeaMap.add(lM01TypeOfMark, null); 701 pM01SeaMap.add(getCbM01CatOfMark(), null); 702 pM01SeaMap.add(lM01CatOfMark, null); 703 pM01SeaMap.add(getCbM01StyleOfMark(), null); 704 pM01SeaMap.add(lM01StyleOfMark, null); 705 pM01SeaMap.add(lM01Name, null); 706 pM01SeaMap.add(getTfM01Name(), null); 707 pM01SeaMap.add(lM01Props02, null); 708 pM01SeaMap.add(getCM01TopMark(), null); 709 pM01SeaMap.add(getCbM01TopMark(), null); 710 pM01SeaMap.add(getCM01Radar(), null); 711 pM01SeaMap.add(getCM01Racon(), null); 712 pM01SeaMap.add(getCbM01Racon(), null); 713 pM01SeaMap.add(getTfM01Racon(), null); 714 pM01SeaMap.add(lM01Racon, null); 715 pM01SeaMap.add(getCM01Fog(), null); 716 pM01SeaMap.add(getCbM01Fog(), null); 717 pM01SeaMap.add(getTfM01FogGroup(), null); 718 pM01SeaMap.add(lM01FogGroup, null); 719 pM01SeaMap.add(getTfM01FogPeriod(), null); 720 pM01SeaMap.add(lM01FogPeriod, null); 721 pM01SeaMap.add(getCM01Fired(), null); 722 pM01SeaMap.add(rbM01Fired1, null); 723 pM01SeaMap.add(rbM01FiredN, null); 724 pM01SeaMap.add(getTfM01RepeatTime(), null); 725 pM01SeaMap.add(lM01RepeatTime, null); 726 pM01SeaMap.add(getCbM01Kennung(), null); 727 pM01SeaMap.add(lM01Kennung, null); 728 pM01SeaMap.add(lM01Group, null); 729 pM01SeaMap.add(getTfM01Group(), null); 730 pM01SeaMap.add(lM01Sector, null); 731 pM01SeaMap.add(getCbM01Sector(), null); 732 pM01SeaMap.add(lM01Colour, null); 733 pM01SeaMap.add(getCbM01Colour(), null); 734 pM01SeaMap.add(lM01Bearing, null); 735 pM01SeaMap.add(getTfM01Bearing(), null); 736 pM01SeaMap.add(getTfM02Bearing(), null); 737 pM01SeaMap.add(getTfM01Radius(), null); 738 pM01SeaMap.add(lM01Height, null); 739 pM01SeaMap.add(getTfM01Height(), null); 740 pM01SeaMap.add(lM01Range, null); 741 pM01SeaMap.add(getTfM01Range(), null); 742 pM01SeaMap.add(lM01FireMark, null); 743 pM01SeaMap.add(getBM01Save(), null); 744 pM01SeaMap.add(getSM01StatusBar(), null); 745 pM01SeaMap.add(getBM01Close(), null); 746 pM01SeaMap.add(getCM01IconVisible(), null); 747 } 748 return pM01SeaMap; 749 } 750 751 private JComboBox getCbM01TypeOfMark() { 752 753 if (cbM01TypeOfMark == null) { 754 755 cbM01TypeOfMark = new JComboBox(); 756 757 // Inhalt der ComboBox 758 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.142")); //$NON-NLS-1$ 759 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.143")); //$NON-NLS-1$ 760 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.144")); //$NON-NLS-1$ 761 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.145")); //$NON-NLS-1$ 762 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.146")); //$NON-NLS-1$ 763 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.147")); //$NON-NLS-1$ 764 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.148")); //$NON-NLS-1$ 765 766 cbM01TypeOfMark.setBounds(new Rectangle(45, 25, 165, 25)); 767 // cbM01TypeOfMark.setEditable(false); 768 cbM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 769 cbM01TypeOfMark.setEnabled(true); 770 771 cbM01TypeOfMark.addActionListener(new ActionListener() { 772 public void actionPerformed(java.awt.event.ActionEvent e) { 773 int type = cbM01TypeOfMark.getSelectedIndex(); 774 775 if (buoy == null) { 776 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 777 return; 778 } 779 780 Node n = buoy.getNode(); 781 if (n == null) 782 return; 783 784 paintlock = true; 785 switch (type) { 786 787 case SeaMark.UNKNOWN_TYPE: 788 if (!(buoy instanceof BuoyUkn)) 789 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 790 buoy.setBuoyIndex(type); 791 break; 792 793 case SeaMark.LATERAL: 794 if (!(buoy instanceof BuoyLat)) { 795 buoy = new BuoyLat(dia, n); 796 buoy.setBuoyIndex(0); 797 } 798 break; 799 800 case SeaMark.CARDINAL: 801 if (!(buoy instanceof BuoyCard)) { 802 buoy = new BuoyCard(dia, n); 803 buoy.setBuoyIndex(0); 804 } 805 break; 806 807 case SeaMark.SAFE_WATER: 808 if (!(buoy instanceof BuoySaw)) { 809 buoy = new BuoySaw(dia, n); 810 } 811 buoy.setBuoyIndex(type); 812 break; 813 814 case SeaMark.ISOLATED_DANGER: 815 if (!(buoy instanceof BuoyIsol)) { 816 buoy = new BuoyIsol(dia, n); 817 } 818 buoy.setBuoyIndex(type); 819 break; 820 821 case SeaMark.SPECIAL_PURPOSE: 822 if (!(buoy instanceof BuoySpec)) { 823 buoy = new BuoySpec(dia, n); 824 } 825 buoy.setBuoyIndex(type); 826 break; 827 828 case SeaMark.LIGHT: 829 if (!(buoy instanceof BuoyNota)) { 830 buoy = new BuoyNota(dia, n); 831 buoy.setBuoyIndex(0); 832 } 833 break; 834 } 835 836 buoy.refreshStyles(); 837 buoy.refreshLights(); 838 buoy.setLightColour(); 839 paintlock = false; 840 buoy.paintSign(); 841 } 842 }); 843 } 844 return cbM01TypeOfMark; 845 } 846 847 private JComboBox getCbM01CatOfMark() { 848 if (cbM01CatOfMark == null) { 849 cbM01CatOfMark = new JComboBox(); 850 cbM01CatOfMark.setBounds(new Rectangle(60, 55, 150, 25)); 851 cbM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 852 cbM01CatOfMark.setEnabled(true); 853 854 cbM01CatOfMark.addActionListener(new ActionListener() { 855 public void actionPerformed(ActionEvent e) { 856 int cat = cbM01CatOfMark.getSelectedIndex(); 857 858 if (buoy == null) { 859 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 860 return; 861 } 862 863 Node n = buoy.getNode(); 864 if (n == null) 865 return; 866 867 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LATERAL) { 868 if (!(buoy instanceof BuoyLat)) 869 buoy = new BuoyLat(dia, n); 870 buoy.setBuoyIndex(cat); 871 } 872 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.CARDINAL) { 873 if (!(buoy instanceof BuoyCard)) 874 buoy = new BuoyCard(dia, n); 875 buoy.setBuoyIndex(cat); 876 } 877 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LIGHT) { 878 if (!(buoy instanceof BuoyNota)) 879 buoy = new BuoyNota(dia, n); 880 buoy.setBuoyIndex(cat); 881 } 882 883 buoy.refreshStyles(); 884 buoy.refreshLights(); 885 buoy.setLightColour(); 886 buoy.paintSign(); 887 } 888 }); 889 } 890 return cbM01CatOfMark; 891 } 892 893 private JComboBox getCbM01StyleOfMark() { 894 if (cbM01StyleOfMark == null) { 895 cbM01StyleOfMark = new JComboBox(); 896 cbM01StyleOfMark.setBounds(new Rectangle(45, 85, 165, 25)); 897 cbM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 898 cbM01StyleOfMark.addActionListener(new ActionListener() { 899 public void actionPerformed(ActionEvent e) { 900 int style = cbM01StyleOfMark.getSelectedIndex(); 901 if (buoy != null && style != buoy.getStyleIndex()) { 902 buoy.setStyleIndex(style); 903 buoy.paintSign(); 904 } 905 } 906 }); 907 } 908 return cbM01StyleOfMark; 909 } 910 911 private JTextField getTfM01Name() { 912 if (tfM01Name == null) { 913 tfM01Name = new JTextField(); 914 tfM01Name.setBounds(new Rectangle(50, 120, 150, 20)); 915 tfM01Name.addFocusListener(new FocusAdapter() { 916 public void focusLost(FocusEvent e) { 917 buoy.setName(tfM01Name.getText()); 918 } 919 }); 920 } 921 return tfM01Name; 922 } 923 924 private JCheckBox getCM01TopMark() { 925 if (cM01TopMark == null) { 926 cM01TopMark = new JCheckBox(); 927 cM01TopMark.setBounds(new Rectangle(10, 170, 100, 20)); 928 cM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 929 cM01TopMark.setText(Messages.getString("SmpDialogAction.166")); //$NON-NLS-1$ 930 cM01TopMark.addItemListener(new ItemListener() { 931 public void itemStateChanged(ItemEvent e) { 932 if (buoy == null) { 933 return; 934 } 935 buoy.setTopMark(cM01TopMark.isSelected()); 936 buoy.paintSign(); 937 } 938 }); 939 } 940 return cM01TopMark; 941 } 942 943 private JComboBox getCbM01TopMark() { 944 if (cbM01TopMark == null) { 945 cbM01TopMark = new JComboBox(); 946 cbM01TopMark.setBounds(new Rectangle(110, 170, 80, 20)); 947 cbM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 948 cbM01TopMark.addActionListener(new ActionListener() { 949 public void actionPerformed(ActionEvent e) { 950 int top = cbM01TopMark.getSelectedIndex(); 951 buoy.paintSign(); 952 } 953 }); 954 } 955 return cbM01TopMark; 956 } 957 958 private JCheckBox getCM01Radar() { 959 if (cM01Radar == null) { 960 cM01Radar = new JCheckBox(); 961 cM01Radar.setBounds(new Rectangle(10, 195, 120, 20)); 962 cM01Radar.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 963 cM01Radar.setText(Messages.getString("SmpDialogAction.169")); //$NON-NLS-1$ 964 cM01Radar.addActionListener(new ActionListener() { 965 public void actionPerformed(ActionEvent e) { 966 if (cM01Radar.isSelected()) { 967 buoy.setRadar(true); 968 buoy.setRacon(false); 969 cM01Racon.setSelected(false); 970 } else { 971 buoy.setRadar(false); 972 } 973 buoy.paintSign(); 974 } 975 }); 976 } 977 return cM01Radar; 978 } 979 980 private JCheckBox getCM01Racon() { 981 if (cM01Racon == null) { 982 cM01Racon = new JCheckBox(); 983 cM01Racon.setBounds(new Rectangle(130, 195, 110, 20)); 984 cM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 985 cM01Racon.setText(Messages.getString("SmpDialogAction.171")); //$NON-NLS-1$ 986 cM01Racon.addActionListener(new ActionListener() { 987 public void actionPerformed(ActionEvent e) { 988 if (cM01Racon.isSelected()) { 989 buoy.setRacon(true); 990 buoy.setRadar(false); 991 cM01Radar.setSelected(false); 992 } else { 993 buoy.setRacon(false); 994 } 995 buoy.paintSign(); 996 } 997 }); 998 } 999 return cM01Racon; 1000 } 1001 1002 private JComboBox getCbM01Racon() { 1003 if (cbM01Racon == null) { 1004 cbM01Racon = new JComboBox(); 1005 cbM01Racon.setBounds(new Rectangle(240, 195, 80, 20)); 1006 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1007 cbM01Racon.removeAllItems(); 1008 cbM01Racon.addItem("Any"); 1009 cbM01Racon.addItem("Racon"); 1010 cbM01Racon.addItem("Ramark"); 1011 cbM01Racon.addItem("Leading"); 1012 cbM01Racon.addActionListener(new ActionListener() { 1013 public void actionPerformed(ActionEvent e) { 1014 int rac = cbM01Racon.getSelectedIndex(); 1015 buoy.setRaType(rac); 1016 buoy.paintSign(); 1017 } 1018 }); 1019 } 1020 return cbM01Racon; 1021 } 1022 1023 private JTextField getTfM01Racon() { 1024 if (tfM01Racon == null) { 1025 tfM01Racon = new JTextField(); 1026 tfM01Racon.setBounds(new Rectangle(345, 195, 30, 20)); 1027 tfM01Racon.addFocusListener(new FocusAdapter() { 1028 public void focusLost(FocusEvent e) { 1029 buoy.setRaconGroup(tfM01Racon.getText().trim()); 1030 } 1031 }); 1032 } 1033 return tfM01Racon; 1034 } 1035 1036 private JCheckBox getCM01Fog() { 1037 if (cM01Fog == null) { 1038 cM01Fog = new JCheckBox(); 1039 cM01Fog.setBounds(new Rectangle(10, 220, 90, 20)); 1040 cM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1041 cM01Fog.setText(Messages.getString("SmpDialogAction.174")); //$NON-NLS-1$ 1042 cM01Fog.addActionListener(new ActionListener() { 1043 public void actionPerformed(ActionEvent e) { 1044 buoy.setFog(cM01Fog.isSelected()); 1045 buoy.paintSign(); 1046 } 1047 }); 1048 } 1049 return cM01Fog; 1050 } 1051 1052 private JComboBox getCbM01Fog() { 1053 if (cbM01Fog == null) { 1054 cbM01Fog = new JComboBox(); 1055 cbM01Fog.setBounds(new Rectangle(100, 220, 70, 20)); 1056 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1057 cbM01Fog.removeAllItems(); 1058 cbM01Fog.addItem("Any"); 1059 cbM01Fog.addItem("Horn"); 1060 cbM01Fog.addItem("Siren"); 1061 cbM01Fog.addItem("Dia"); 1062 cbM01Fog.addItem("Bell"); 1063 cbM01Fog.addItem("Whis"); 1064 cbM01Fog.addItem("Gong"); 1065 cbM01Fog.addItem("Explos"); 1066 cbM01Fog.addActionListener(new ActionListener() { 1067 public void actionPerformed(ActionEvent e) { 1068 if (cbM01Fog.getSelectedIndex() > 0) 1069 buoy.setFogSound(cbM01Fog.getSelectedIndex()); 1070 else 1071 buoy.setFogSound(0); 1072 buoy.paintSign(); 1073 } 1074 }); 1075 } 1076 return cbM01Fog; 1077 } 1078 1079 private JTextField getTfM01FogGroup() { 1080 if (tfM01FogGroup == null) { 1081 tfM01FogGroup = new JTextField(); 1082 tfM01FogGroup.setBounds(new Rectangle(243, 220, 30, 20)); 1083 tfM01FogGroup.addFocusListener(new FocusAdapter() { 1084 public void focusLost(FocusEvent e) { 1085 buoy.setFogGroup(tfM01FogGroup.getText().trim()); 1086 } 1087 }); 1088 } 1089 return tfM01FogGroup; 1090 } 1091 1092 private JTextField getTfM01FogPeriod() { 1093 if (tfM01FogPeriod == null) { 1094 tfM01FogPeriod = new JTextField(); 1095 tfM01FogPeriod.setBounds(new Rectangle(345, 220, 30, 20)); 1096 tfM01FogPeriod.addFocusListener(new FocusAdapter() { 1097 public void focusLost(FocusEvent e) { 1098 buoy.setFogPeriod(tfM01FogPeriod.getText().trim()); 1099 } 1100 }); 1101 } 1102 return tfM01FogPeriod; 1103 } 1104 1105 private JCheckBox getCM01Fired() { 1106 if (cM01Fired == null) { 1107 cM01Fired = new JCheckBox(); 1108 cM01Fired.setBounds(new Rectangle(10, 245, 75, 20)); 1109 cM01Fired.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1110 cM01Fired.setText(Messages.getString("SmpDialogAction.177")); //$NON-NLS-1$ 1111 cM01Fired.addItemListener(new ItemListener() { 1112 public void itemStateChanged(ItemEvent e) { 1113 if (buoy == null) { 1114 return; 1115 } 1116 buoy.setFired(cM01Fired.isSelected()); 1117 buoy.setLightColour(); 1118 buoy.paintSign(); 1119 } 1120 }); 1121 } 1122 1123 return cM01Fired; 1124 } 1125 1126 private JComboBox getCbM01Kennung() { 1127 if (cbM01Kennung == null) { 1128 cbM01Kennung = new JComboBox(); 1129 cbM01Kennung.setBounds(new Rectangle(305, 245, 70, 20)); 1130 cbM01Kennung.addActionListener(new ActionListener() { 1131 public void actionPerformed(ActionEvent e) { 1132 int i1, i2; 1133 String c = ""; //$NON-NLS-1$ //$NON-NLS-2$ 1134 String it = (String) cbM01Kennung.getSelectedItem(); 1135 1136 if (it == null) 1137 return; 1138 if (it.equals(Messages.getString("SmpDialogAction.212"))) //$NON-NLS-1$ 1139 return; 1140 if (buoy == null) 1141 return; 1142 1143 if (it.contains("(")) { 1144 i1 = it.indexOf("("); 1145 i2 = it.indexOf(")"); 1146 c = it.substring(i1+1, i2); 1147 it = it.substring(0, i1) + it.substring(i2+1); 1148 } 1149 if (!c.isEmpty()) 1150 buoy.setLightGroup(c);; 1151 buoy.setLightChar(it); 1152 buoy.paintSign(); 1153 } 1154 }); 1155 } 1156 return cbM01Kennung; 1157 } 1158 1159 private JTextField getTfM01Height() { 1160 if (tfM01Height == null) { 1161 tfM01Height = new JTextField(); 1162 tfM01Height.setBounds(new Rectangle(54, 270, 30, 20)); 1163 tfM01Height.addFocusListener(new FocusAdapter() { 1164 public void focusLost(FocusEvent e) { 1165 buoy.setHeight(tfM01Height.getText().trim()); 1166 } 1167 }); 1168 } 1169 return tfM01Height; 1170 } 1171 1172 private JTextField getTfM01Range() { 1173 if (tfM01Range == null) { 1174 tfM01Range = new JTextField(); 1175 tfM01Range.setBounds(new Rectangle(151, 270, 30, 20)); 1176 tfM01Range.addFocusListener(new FocusAdapter() { 1177 public void focusLost(FocusEvent e) { 1178 buoy.setRange(tfM01Range.getText().trim()); 1179 } 1180 }); 1181 } 1182 return tfM01Range; 1183 } 1184 1185 private JTextField getTfM01Group() { 1186 if (tfM01Group == null) { 1187 tfM01Group = new JTextField(); 1188 tfM01Group.setBounds(new Rectangle(255, 270, 30, 20)); 1189 tfM01Group.addFocusListener(new FocusAdapter() { 1190 public void focusLost(FocusEvent e) { 1191 buoy.setLightGroup(tfM01Group.getText().trim()); 1192 buoy.paintSign(); 1193 } 1194 }); 1195 } 1196 return tfM01Group; 1197 } 1198 1199 private JTextField getTfM01RepeatTime() { 1200 if (tfM01RepeatTime == null) { 1201 tfM01RepeatTime = new JTextField(); 1202 tfM01RepeatTime.setBounds(new Rectangle(345, 270, 30, 20)); 1203 tfM01RepeatTime.addActionListener(new ActionListener() { 1204 public void actionPerformed(ActionEvent e) { 1205 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1206 buoy.paintSign(); 1207 } 1208 }); 1209 1210 tfM01RepeatTime.addFocusListener(new FocusAdapter() { 1211 public void focusLost(FocusEvent e) { 1212 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1213 buoy.paintSign(); 1214 } 1215 }); 1216 } 1217 return tfM01RepeatTime; 1218 } 1219 1220 private JComboBox getCbM01Colour() { 1221 if (cbM01Colour == null) { 1222 cbM01Colour = new JComboBox(); 1223 cbM01Colour.setBounds(new Rectangle(165, 295, 40, 20)); 1224 cbM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1225 cbM01Colour.addItem(""); //$NON-NLS-1$ 1226 cbM01Colour.addItem(Messages.getString("SmpDialogAction.190")); //$NON-NLS-1$ 1227 cbM01Colour.addItem(Messages.getString("SmpDialogAction.191")); //$NON-NLS-1$ 1228 cbM01Colour.addItem(Messages.getString("SmpDialogAction.192")); //$NON-NLS-1$ 1229 cbM01Colour.addActionListener(new ActionListener() { 1230 public void actionPerformed(ActionEvent e) { 1231 buoy.setLightColour((String)cbM01Colour.getSelectedItem()); 1232 buoy.paintSign(); 1233 } 1234 }); 1235 } 1236 return cbM01Colour; 1237 } 1238 1239 private JComboBox getCbM01Sector() { 1240 if (cbM01Sector == null) { 1241 cbM01Sector = new JComboBox(); 1242 cbM01Sector.setBounds(new Rectangle(55, 295, 50, 20)); 1243 cbM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1244 cbM01Sector.addItem(Messages.getString("SmpDialogAction.194")); //$NON-NLS-1$ 1245 cbM01Sector.addItem(Messages.getString("SmpDialogAction.195")); //$NON-NLS-1$ 1246 cbM01Sector.addItem(Messages.getString("SmpDialogAction.196")); //$NON-NLS-1$ 1247 cbM01Sector.addItem(Messages.getString("SmpDialogAction.197")); //$NON-NLS-1$ 1248 cbM01Sector.addItem(Messages.getString("SmpDialogAction.198")); //$NON-NLS-1$ 1249 cbM01Sector.addItem(Messages.getString("SmpDialogAction.199")); //$NON-NLS-1$ 1250 cbM01Sector.addItem(Messages.getString("SmpDialogAction.200")); //$NON-NLS-1$ 1251 cbM01Sector.addItem(Messages.getString("SmpDialogAction.201")); //$NON-NLS-1$ 1252 cbM01Sector.addItem(Messages.getString("SmpDialogAction.202")); //$NON-NLS-1$ 1253 cbM01Sector.addItem(Messages.getString("SmpDialogAction.203")); //$NON-NLS-1$ 1254 cbM01Sector.addActionListener(new ActionListener() { 1255 public void actionPerformed(ActionEvent e) { 1256 buoy.setSectorIndex(cbM01Sector.getSelectedIndex()); 1257 buoy.paintSign(); 1258 } 1259 }); 1260 } 1261 return cbM01Sector; 1262 } 1263 1264 private JTextField getTfM01Bearing() { 1265 if (tfM01Bearing == null) { 1266 tfM01Bearing = new JTextField(); 1267 tfM01Bearing.setBounds(new Rectangle(255, 295, 30, 20)); 1268 tfM01Bearing.addFocusListener(new FocusAdapter() { 1269 public void focusLost(FocusEvent e) { 1270 buoy.setBearing1(tfM01Bearing.getText().trim()); 1271 } 1272 }); 1273 } 1274 return tfM01Bearing; 1275 } 1276 1277 private JTextField getTfM02Bearing() { 1278 if (tfM02Bearing == null) { 1279 tfM02Bearing = new JTextField(); 1280 tfM02Bearing.setBounds(new Rectangle(300, 295, 30, 20)); 1281 tfM02Bearing.addFocusListener(new FocusAdapter() { 1282 public void focusLost(FocusEvent e) { 1283 buoy.setBearing2(tfM02Bearing.getText().trim()); 1284 } 1285 }); 1286 } 1287 return tfM02Bearing; 1288 } 1289 1290 private JTextField getTfM01Radius() { 1291 if (tfM01Radius == null) { 1292 tfM01Radius = new JTextField(); 1293 tfM01Radius.setBounds(new Rectangle(355, 295, 30, 20)); 1294 tfM01Radius.addFocusListener(new FocusAdapter() { 1295 public void focusLost(FocusEvent e) { 1296 buoy.setRadius(tfM01Radius.getText().trim()); 1297 } 1298 }); 1299 } 1300 return tfM01Radius; 1301 } 1302 1303 private JButton getBM01Close() { 1304 if (bM01Close == null) { 1305 bM01Close = new JButton(); 1306 bM01Close.setBounds(new Rectangle(20, 325, 110, 20)); 1307 bM01Close.setText(tr("Close")); 1308 bM01Close.addActionListener(new ActionListener() { 1309 public void actionPerformed(ActionEvent e) { 1310 // aufraeumen 1311 if (obuoy != null) 1312 PicRebuild(); 1313 // Deaktivierung des Listeners 1314 DataSet.removeSelectionListener(SmpListener); 1315 Selection = null; 1316 SmpItem.setEnabled(true); 1317 onode = null; 1318 1319 dM01SeaMap.dispose(); 1320 } 1321 }); 1322 } 1323 1324 return bM01Close; 1325 } 1326 1327 private JButton getBM01Save() { 1328 if (bM01Save == null) { 1329 bM01Save = new JButton(); 1330 bM01Save.setBounds(new Rectangle(150, 325, 110, 20)); 1331 bM01Save.setText(tr("Save")); 1332 bM01Save.setEnabled(false); 1333 1334 bM01Save.addActionListener(new ActionListener() { 1335 public void actionPerformed(ActionEvent e) { 1336 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1337 "/images/Auge.png"))); //$NON-NLS-1$ 1338 cM01IconVisible.setSelected(true); 1339 1340 buoy.saveSign(); 1341 } 1342 }); 1343 } 1344 1345 return bM01Save; 1346 } 1347 1348 private JCheckBox getCM01IconVisible() { 1349 if (cM01IconVisible == null) { 1350 cM01IconVisible = new JCheckBox(); 1351 cM01IconVisible.setBounds(new Rectangle(310, 325, 30, 21)); 1352 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1353 "/images/AugeN.png"))); //$NON-NLS-1$ 1354 cM01IconVisible.setSelected(false); 1355 cM01IconVisible.addActionListener(new ActionListener() { 1356 public void actionPerformed(ActionEvent e) { 1357 Command c; 1358 Node n = null; 1359 DataSet ds = Main.main.getCurrentDataSet(); 1360 1361 if (buoy != null) 1362 n = buoy.getNode(); 1363 1364 if (cM01IconVisible.isSelected()) { 1365 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1366 "/images/AugeN.png"))); //$NON-NLS-1$ 1367 if (n != null) { 1368 // seamark loeschen, wenn notwendig 1369 if (n.getKeys().containsKey("seamark")) { //$NON-NLS-1$ 1370 smb = n.getKeys().get("seamark"); // smb merken //$NON-NLS-1$ 1371 1372 c = new ChangePropertyCommand(n, "seamark", null); //$NON-NLS-1$ 1373 c.executeCommand(); 1374 ds.fireSelectionChanged(); 1375 obuoy = buoy; 1376 } 1377 1378 // seamark:type loeschen, wenn notwendig 1379 if (n.getKeys().containsKey("seamark:type")) { //$NON-NLS-1$ 1380 smt = n.getKeys().get("seamark:type"); // smt merken //$NON-NLS-1$ 1381 1382 c = new ChangePropertyCommand(n, "seamark:type", null); //$NON-NLS-1$ 1383 c.executeCommand(); 1384 ds.fireSelectionChanged(); 1385 obuoy = buoy; 1386 } 1387 1388 } 1389 } else { 1390 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1391 "/images/Auge.png"))); //$NON-NLS-1$ 1392 PicRebuild(); 1393 obuoy = null; 1394 } 1395 buoy.paintSign(); 1396 } 1397 }); 1398 } 1399 return cM01IconVisible; 1400 } 1401 1402 private JTextField getSM01StatusBar() { 1403 if (sM01StatusBar == null) { 1404 sM01StatusBar = new JTextField(); 1405 sM01StatusBar.setBounds(new Rectangle(7, 355, 385, 20)); 1406 sM01StatusBar.setBackground(SystemColor.activeCaptionBorder); 1407 } 1408 return sM01StatusBar; 1409 } 64 private static final long serialVersionUID = -2976230949744302905L; 65 66 /** 67 * lokale Variable, private 68 */ 69 private SmpDialogAction dia = null; // Variable für den Handle von 70 // SmpDialogAction 71 private Buoy buoy = null; // Variable für Objekte des Typs "Tonne" // 72 // @jve:decl-index=0: 73 private boolean isOpen = false; // zeigt den Status des Dialogs an 74 private Node onode = null; // gemerkter Knoten 75 private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0: 76 private JMenuItem SmpItem = null; // Info über item in der Werkzeugleiste 77 private String smt = ""; // value vom key "seamark:type" // @jve:decl-index=0: //$NON-NLS-1$ 78 private String smb = ""; // value vom key "seamark" // @jve:decl-index=0: //$NON-NLS-1$ 79 private Collection<? extends OsmPrimitive> Selection = null; // @jve:decl-index=0: 80 private OsmPrimitive SelNode = null; 81 private String Os = ""; // @jve:decl-index=0: //$NON-NLS-1$ 82 private String UserHome = ""; // @jve:decl-index=0: //$NON-NLS-1$ 83 84 // SelectionChangedListner der in die Eventqueue von josm eingehängt wird 85 private SelectionChangedListener SmpListener = new SelectionChangedListener() { 86 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 87 Node node; 88 Selection = newSelection; 89 90 // System.out.println("hello"); 91 for (OsmPrimitive osm : Selection) { 92 if (osm instanceof Node) { 93 node = (Node) osm; 94 if (Selection.size() == 1) 95 // Absicherung gegen Doppelevents 96 if (node.compareTo(SelNode) != 0) { 97 SelNode = node; 98 parseSeaMark(); 99 buoy.paintSign(); 100 } 101 } 102 } 103 104 Selection = null; 105 106 } 107 }; 108 109 /** 110 * lokale Variable der Maske 111 */ 112 private JDialog dM01SeaMap = null; 113 private JPanel pM01SeaMap = null; 114 private JLabel lM01Head = null; 115 private JLabel lM01Region = null; 116 private JLabel lM02Region = null; 117 public ButtonGroup bgM01Region = null; 118 public JRadioButton rbM01RegionA = null; 119 public JRadioButton rbM01RegionB = null; 120 public JLabel lM01Icon = null; // Shape 121 public JLabel lM02Icon = null; // Light 122 public JLabel lM03Icon = null; // Reflector 123 public JLabel lM04Icon = null; // Racon 124 public JLabel lM05Icon = null; // Fog 125 public JLabel lM06Icon = null; // Topmark 126 public JLabel lM01FireMark = null; 127 private JLabel lM01TypeOfMark = null; 128 public JComboBox cbM01TypeOfMark = null; 129 public JLabel lM01CatOfMark = null; 130 public JComboBox cbM01CatOfMark = null; 131 public JLabel lM01StyleOfMark = null; 132 public JComboBox cbM01StyleOfMark = null; 133 private JLabel lM01Name = null; 134 public JTextField tfM01Name = null; 135 private JLabel lM01Props02 = null; 136 public JCheckBox cM01TopMark = null; 137 public JComboBox cbM01TopMark = null; 138 public JCheckBox cM01Radar = null; 139 public JCheckBox cM01Racon = null; 140 public JComboBox cbM01Racon = null; 141 public JTextField tfM01Racon = null; 142 public JLabel lM01Racon = null; 143 public JCheckBox cM01Fog = null; 144 public JComboBox cbM01Fog = null; 145 public JLabel lM01FogGroup = null; 146 public JTextField tfM01FogGroup = null; 147 public JLabel lM01FogPeriod = null; 148 public JTextField tfM01FogPeriod = null; 149 public JCheckBox cM01Fired = null; 150 public ButtonGroup bgM01Fired = null; 151 public JRadioButton rbM01Fired1 = null; 152 public JRadioButton rbM01FiredN = null; 153 public JLabel lM01Kennung = null; 154 public JComboBox cbM01Kennung = null; 155 public JLabel lM01Height = null; 156 public JTextField tfM01Height = null; 157 public JLabel lM01Range = null; 158 public JTextField tfM01Range = null; 159 public JLabel lM01Group = null; 160 public JTextField tfM01Group = null; 161 public JLabel lM01RepeatTime = null; 162 public JTextField tfM01RepeatTime = null; 163 public JLabel lM01Sector = null; 164 public JComboBox cbM01Sector = null; 165 public JLabel lM01Colour = null; 166 public JComboBox cbM01Colour = null; 167 public JLabel lM01Bearing = null; 168 public JTextField tfM01Bearing = null; 169 public JTextField tfM02Bearing = null; 170 public JTextField tfM01Radius = null; 171 public JButton bM01Save = null; 172 public JButton bM01Close = null; 173 public JCheckBox cM01IconVisible = null; 174 public JTextField sM01StatusBar = null; 175 176 public boolean paintlock = false; 177 178 public JMenuItem getSmpItem() { 179 return SmpItem; 180 } 181 182 public void setSmpItem(JMenuItem smpItem) { 183 SmpItem = smpItem; 184 } 185 186 public boolean isOpen() { 187 return isOpen; 188 } 189 190 public void setOpen(boolean isOpen) { 191 this.isOpen = isOpen; 192 } 193 194 public String getOs() { 195 return Os; 196 } 197 198 public void setOs(String os) { 199 Os = os; 200 } 201 202 public String getUserHome() { 203 return UserHome; 204 } 205 206 public void setUserHome(String userHome) { 207 UserHome = userHome; 208 } 209 210 public SmpDialogAction() { 211 super( 212 Messages.getString("SmpDialogAction.4"), "Smp", Messages.getString("SmpDialogAction.0"), Shortcut //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 213 .registerShortcut( 214 "tools:Semarks", //$NON-NLS-1$ 215 tr("Tool: {0}", Messages.getString("SmpDialogAction.9")), KeyEvent.VK_S, //$NON-NLS-1$ //$NON-NLS-2$ 216 Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 217 218 dia = this; 219 String str = Main.pref.get("mappaint.style.sources"); //$NON-NLS-1$ 220 if (!str.contains("dev.openseamap.org")) { //$NON-NLS-1$ 221 if (!str.isEmpty()) //$NON-NLS-1$ 222 str += new String(new char[] { 0x1e }); 223 Main.pref.put("mappaint.style.sources", str //$NON-NLS-1$ 224 + "http://dev.openseamap.org/josm/seamark_styles.xml"); //$NON-NLS-1$ 225 } 226 str = Main.pref.get("color.background"); //$NON-NLS-1$ 227 if (str.equals("#000000") || str.isEmpty()) //$NON-NLS-1$ //$NON-NLS-2$ 228 Main.pref.put("color.background", "#606060"); //$NON-NLS-1$ //$NON-NLS-2$ 229 } 230 231 public void CloseDialog() { 232 onode = null; 233 DataSet.removeSelectionListener(SmpListener); 234 Selection = null; 235 236 if (isOpen) 237 dM01SeaMap.dispose(); 238 isOpen = false; 239 240 } 241 242 public void actionPerformed(ActionEvent e) { 243 244 /* 245 * int option = JOptionPane.showConfirmDialog(Main.parent, 246 * tr("THIS IS EXPERIMENTAL. Save your work and verify before uploading.\n" 247 * + "Are you really sure to continue?"), 248 * tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION, 249 * JOptionPane.WARNING_MESSAGE); 250 * 251 * if (option != JOptionPane.YES_OPTION) { return; } 252 */ 253 254 onode = null; 255 obuoy = null; 256 257 SwingUtilities.invokeLater(new Runnable() { 258 public void run() { 259 JDialog dialog = getDM01SeaMap(); 260 261 if (SmpItem == null) { 262 } 263 dialog.setVisible(true); 264 } 265 }); 266 267 setOpen(true); 268 269 if (SmpItem == null) { 270 return; 271 } 272 SmpItem.setEnabled(false); 273 274 // Ausprobe: Möglichkeit der Benachrichtigung, wenn etwas neu 275 // selektiert wird (ueber SelectionChangedListener) 276 // private Collection<? extends OsmPrimitive> sel; 277 // siehe org.openstreetmap.josm.plugins.osb -> OsbLayer.java 278 // Einhängen des Listeners in die Eventqueue von josm 279 DataSet.addSelectionListener(SmpListener); 280 } 281 282 private void PicRebuild() { 283 284 DataSet ds = Main.main.getCurrentDataSet(); 285 286 if (obuoy == null) { 287 return; 288 } 289 290 Node n = obuoy.getNode(); 291 292 if (n != null) { 293 Command c; 294 295 if (smb != "") { //$NON-NLS-1$ 296 297 c = new ChangePropertyCommand(n, "seamark", smb); //$NON-NLS-1$ 298 c.executeCommand(); 299 ds.fireSelectionChanged(); 300 301 smb = ""; //$NON-NLS-1$ 302 } 303 304 if (smt != "") { //$NON-NLS-1$ 305 306 c = new ChangePropertyCommand(n, "seamark:type", smt); //$NON-NLS-1$ 307 c.executeCommand(); 308 ds.fireSelectionChanged(); 309 310 smt = ""; //$NON-NLS-1$ 311 } 312 } 313 314 obuoy = null; 315 316 } 317 318 private void parseSeaMark() { 319 320 int nodes = 0; 321 Node node = null; 322 Collection<Node> selection = null; 323 Map<String, String> keys; 324 DataSet ds; 325 326 ds = Main.main.getCurrentDataSet(); 327 328 if (ds == null) { 329 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.26")); //$NON-NLS-1$ 330 buoy.setNode(null); 331 return; 332 } 333 334 selection = ds.getSelectedNodes(); 335 nodes = selection.size(); 336 337 if (nodes == 0) { 338 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.27")); //$NON-NLS-1$ 339 buoy.setNode(null); 340 return; 341 } 342 343 if (nodes > 1) { 344 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.28")); //$NON-NLS-1$ 345 buoy.setNode(null); 346 return; 347 } 348 349 Iterator<Node> it = selection.iterator(); 350 node = it.next(); 351 352 if (onode != null) 353 if (node.equals(onode)) 354 return; 355 356 // Knoten wurde gewechselt -> die alten tags (benutzt zum Ausblenden der 357 // Pictogramme) wiederherstellen 358 if (obuoy != null) 359 PicRebuild(); 360 361 onode = node; 362 363 cM01IconVisible.setEnabled(true); 364 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 365 "/images/Auge.png"))); //$NON-NLS-1$ 366 367 cbM01TypeOfMark.setEnabled(true); 368 369 // Soweit das Vorspiel. Ab hier beginnt das Parsen 370 String type = ""; //$NON-NLS-1$ 371 String str = ""; //$NON-NLS-1$ 372 373 keys = node.getKeys(); 374 375 // vorsorglich den Namen holen und verwenden, wenn es ein 376 // Seezeichen ist. Name kann durch die weiteren Tags ueber- 377 // schrieben werden 378 379 if (keys.containsKey("seamark:type")) //$NON-NLS-1$ 380 type = keys.get("seamark:type"); //$NON-NLS-1$ 381 382 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$ 383 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$ 384 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$ 385 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$ 386 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$ 387 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$ 388 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$ 389 buoy = new BuoyLat(this, node); 390 return; 391 392 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$ 393 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$ 394 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$ 395 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$ 396 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$ 397 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$ 398 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 399 buoy = new BuoyCard(this, node); 400 return; 401 402 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$ 403 || type.equals("beacon_safe_water") //$NON-NLS-1$ 404 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$ 405 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$ 406 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$ 407 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$ 408 buoy = new BuoySaw(this, node); 409 return; 410 411 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$ 412 || type.equals("beacon_special_purpose") //$NON-NLS-1$ 413 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$ 414 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$ 415 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 416 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$ 417 buoy = new BuoySpec(this, node); 418 return; 419 420 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$ 421 || type.equals("beacon_isolated_danger") //$NON-NLS-1$ 422 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$ 423 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$ 424 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$ 425 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 426 buoy = new BuoyIsol(this, node); 427 return; 428 429 } else if (type.equals("landmark") || type.equals("light_vessel") //$NON-NLS-1$ 430 || type.equals("light_major") || type.equals("light_minor")) { //$NON-NLS-1$ 431 buoy = new BuoyNota(this, node); 432 return; 433 434 } else if (type.equals("light_float")) { //$NON-NLS-1$ 435 if (keys.containsKey("seamark:light_float:colour")) { //$NON-NLS-1$ 436 str = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 437 if (str.equals("red") || str.equals("green") //$NON-NLS-1$ //$NON-NLS-2$ 438 || str.equals("red;green;red") || str.equals("green;red;green")) { //$NON-NLS-1$ //$NON-NLS-2$ 439 buoy = new BuoyLat(this, node); 440 return; 441 } else if (str.equals("black;yellow") //$NON-NLS-1$ 442 || str.equals("black;yellow;black") || str.equals("yellow;black") //$NON-NLS-1$ //$NON-NLS-2$ 443 || str.equals("yellow;black;yellow")) { //$NON-NLS-1$ 444 buoy = new BuoyCard(this, node); 445 return; 446 } else if (str.equals("black;red;black")) { //$NON-NLS-1$ 447 buoy = new BuoyIsol(this, node); 448 return; 449 } else if (str.equals("red;white")) { //$NON-NLS-1$ 450 buoy = new BuoySaw(this, node); 451 return; 452 } else if (str.equals("yellow")) { //$NON-NLS-1$ 453 buoy = new BuoySpec(this, node); 454 return; 455 } 456 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { //$NON-NLS-1$ 457 str = keys.get("seamark:light_float:topmark:shape"); //$NON-NLS-1$ 458 if (str.equals("cylinder") || str.equals("cone, point up")) { //$NON-NLS-1$ //$NON-NLS-2$ 459 buoy = new BuoyLat(this, node); 460 return; 461 } 462 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { //$NON-NLS-1$ 463 str = keys.get("seamark:light_float:topmark:colour"); //$NON-NLS-1$ 464 if (str.equals("red") || str.equals("green")) { //$NON-NLS-1$ //$NON-NLS-2$ 465 buoy = new BuoyLat(this, node); 466 return; 467 } 468 } 469 } 470 471 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.91")); //$NON-NLS-1$ 472 buoy.setNode(node); 473 return; 474 } 475 476 private JDialog getDM01SeaMap() { 477 478 if (dM01SeaMap == null) { 479 dM01SeaMap = new JDialog(); 480 dM01SeaMap.setSize(new Dimension(400, 400)); 481 dM01SeaMap.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 482 dM01SeaMap.setModal(false); 483 dM01SeaMap.setResizable(false); 484 dM01SeaMap.setContentPane(getPM01SeaMap()); 485 dM01SeaMap.setTitle(Messages.getString("SmpDialogAction.9")); //$NON-NLS-1$ 486 dM01SeaMap.setVisible(false); 487 dM01SeaMap.setAlwaysOnTop(true); 488 dM01SeaMap.addWindowListener(new java.awt.event.WindowAdapter() { 489 public void windowClosing(java.awt.event.WindowEvent e) { 490 491 // Pictogramme wiederherstellen und aufraeumen 492 if (obuoy != null) 493 PicRebuild(); 494 // Deaktivierung des Listeners 495 DataSet.removeSelectionListener(SmpListener); 496 Selection = null; 497 498 SmpItem.setEnabled(true); 499 } 500 501 public void windowActivated(WindowEvent arg0) { 502 parseSeaMark(); 503 buoy.paintSign(); 504 } 505 }); 506 } 507 return dM01SeaMap; 508 } 509 510 private JPanel getPM01SeaMap() { 511 if (pM01SeaMap == null) { 512 513 lM01Icon = new JLabel(); 514 lM01Icon.setBounds(new Rectangle(210, 20, 150, 200)); 515 lM01Icon.setIcon(null); 516 lM01Icon.setText(""); //$NON-NLS-1$ 517 518 lM02Icon = new JLabel(); 519 lM02Icon.setBounds(new Rectangle(210, 20, 150, 200)); 520 lM02Icon.setIcon(null); 521 lM02Icon.setText(""); //$NON-NLS-1$ 522 523 lM03Icon = new JLabel(); 524 lM03Icon.setBounds(new Rectangle(210, -50, 150, 200)); 525 lM03Icon.setIcon(null); 526 lM03Icon.setText(""); //$NON-NLS-1$ 527 528 lM04Icon = new JLabel(); 529 lM04Icon.setBounds(new Rectangle(210, 20, 150, 200)); 530 lM04Icon.setIcon(null); 531 lM04Icon.setText(""); //$NON-NLS-1$ 532 533 lM05Icon = new JLabel(); 534 lM05Icon.setBounds(new Rectangle(210, 20, 150, 200)); 535 lM05Icon.setIcon(null); 536 lM05Icon.setText(""); //$NON-NLS-1$ 537 538 lM06Icon = new JLabel(); 539 lM06Icon.setBounds(new Rectangle(210, 20, 150, 200)); 540 lM06Icon.setIcon(null); 541 lM06Icon.setText(""); //$NON-NLS-1$ 542 543 lM01FireMark = new JLabel(); 544 lM01FireMark.setBounds(new Rectangle(300, 85, 95, 20)); 545 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 546 lM01FireMark.setText(""); //$NON-NLS-1$ 547 548 lM01Head = new JLabel(); 549 lM01Head.setBounds(new Rectangle(5, 3, 316, 16)); 550 lM01Head.setText(Messages.getString("SmpDialogAction.97")); //$NON-NLS-1$ 551 552 lM01Region = new JLabel(); 553 lM01Region.setBounds(new Rectangle(220, 7, 120, 16)); 554 lM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 555 lM01Region.setText(Messages.getString("SmpDialogAction.99")); //$NON-NLS-1$ 556 557 lM02Region = new JLabel(); 558 lM02Region.setBounds(new Rectangle(270, 7, 120, 16)); 559 lM02Region.setFont(new Font("Dialog", Font.BOLD, 12)); //$NON-NLS-1$ 560 lM02Region.setText(Messages.getString("SmpDialogAction.101")); //$NON-NLS-1$ 561 562 lM01TypeOfMark = new JLabel(); 563 lM01TypeOfMark.setBounds(new Rectangle(5, 28, 120, 16)); 564 lM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 565 lM01TypeOfMark.setText(Messages.getString("SmpDialogAction.103")); //$NON-NLS-1$ 566 567 lM01CatOfMark = new JLabel(); 568 lM01CatOfMark.setBounds(new Rectangle(5, 58, 120, 16)); 569 lM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 570 lM01CatOfMark.setText(Messages.getString("SmpDialogAction.1")); //$NON-NLS-1$ 571 572 lM01StyleOfMark = new JLabel(); 573 lM01StyleOfMark.setBounds(new Rectangle(5, 88, 148, 16)); 574 lM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 575 lM01StyleOfMark.setText(Messages.getString("SmpDialogAction.107")); //$NON-NLS-1$ 576 577 lM01Name = new JLabel(); 578 lM01Name.setBounds(new Rectangle(5, 120, 82, 16)); 579 lM01Name.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 580 lM01Name.setText(Messages.getString("SmpDialogAction.109")); //$NON-NLS-1$ 581 582 lM01Props02 = new JLabel(); 583 lM01Props02.setBounds(new Rectangle(5, 150, 172, 16)); 584 lM01Props02.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 585 lM01Props02.setText(Messages.getString("SmpDialogAction.111")); //$NON-NLS-1$ 586 587 lM01Racon = new JLabel(); 588 lM01Racon.setBounds(new Rectangle(335, 195, 65, 20)); 589 lM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 590 lM01Racon.setText(Messages.getString("SmpDialogAction.113")); //$NON-NLS-1$ 591 592 lM01FogGroup = new JLabel(); 593 lM01FogGroup.setBounds(new Rectangle(190, 220, 100, 20)); 594 lM01FogGroup.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 595 lM01FogGroup.setText(Messages.getString("SmpDialogAction.115")); //$NON-NLS-1$ 596 597 lM01FogPeriod = new JLabel(); 598 lM01FogPeriod.setBounds(new Rectangle(300, 220, 100, 20)); 599 lM01FogPeriod.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 600 lM01FogPeriod.setText(Messages.getString("SmpDialogAction.117")); //$NON-NLS-1$ 601 602 lM01Kennung = new JLabel(); 603 lM01Kennung.setBounds(new Rectangle(240, 245, 60, 20)); 604 lM01Kennung.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 605 lM01Kennung.setText(Messages.getString("SmpDialogAction.119")); //$NON-NLS-1$ 606 607 lM01Height = new JLabel(); 608 lM01Height.setBounds(new Rectangle(10, 270, 100, 20)); 609 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 610 lM01Height.setText(Messages.getString("SmpDialogAction.121")); //$NON-NLS-1$ 611 612 lM01Range = new JLabel(); 613 lM01Range.setBounds(new Rectangle(108, 270, 100, 20)); 614 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 615 lM01Range.setText(Messages.getString("SmpDialogAction.123")); //$NON-NLS-1$ 616 617 lM01Group = new JLabel(); 618 lM01Group.setBounds(new Rectangle(204, 270, 100, 20)); 619 lM01Group.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 620 lM01Group.setText(Messages.getString("SmpDialogAction.125")); //$NON-NLS-1$ 621 622 lM01RepeatTime = new JLabel(); 623 lM01RepeatTime.setBounds(new Rectangle(300, 270, 100, 20)); 624 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 625 lM01RepeatTime.setText(Messages.getString("SmpDialogAction.127")); //$NON-NLS-1$ 626 627 lM01Sector = new JLabel(); 628 lM01Sector.setBounds(new Rectangle(10, 295, 180, 20)); 629 lM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 630 lM01Sector.setText(Messages.getString("SmpDialogAction.129")); //$NON-NLS-1$ 631 632 lM01Colour = new JLabel(); 633 lM01Colour.setBounds(new Rectangle(120, 295, 180, 20)); 634 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 635 lM01Colour.setText(Messages.getString("SmpDialogAction.131")); //$NON-NLS-1$ 636 637 lM01Bearing = new JLabel(); 638 lM01Bearing.setBounds(new Rectangle(228, 295, 180, 20)); 639 lM01Bearing.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 640 lM01Bearing.setText(Messages.getString("SmpDialogAction.133")); //$NON-NLS-1$ 641 642 rbM01RegionA = new JRadioButton( 643 Messages.getString("SmpDialogAction.134"), Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 644 .equals("A")); //$NON-NLS-1$ 645 rbM01RegionA.setBounds(new Rectangle(305, 0, 50, 30)); 646 rbM01RegionB = new JRadioButton("-B", Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 647 .equals("B")); //$NON-NLS-1$ 648 rbM01RegionB.setBounds(new Rectangle(352, 0, 50, 30)); 649 bgM01Region = new ButtonGroup(); 650 bgM01Region.add(rbM01RegionA); 651 bgM01Region.add(rbM01RegionB); 652 653 ActionListener alM01Region = new ActionListener() { 654 public void actionPerformed(java.awt.event.ActionEvent e) { 655 if (buoy instanceof BuoyLat) { 656 buoy.setRegion(rbM01RegionB.isSelected()); 657 buoy.setLightColour(); 658 buoy.paintSign(); 659 } 660 } 661 }; 662 rbM01RegionA.addActionListener(alM01Region); 663 rbM01RegionB.addActionListener(alM01Region); 664 665 rbM01Fired1 = new JRadioButton( 666 Messages.getString("SmpDialogAction.140"), true); //$NON-NLS-1$ 667 rbM01Fired1.setBounds(new Rectangle(85, 240, 70, 30)); 668 rbM01FiredN = new JRadioButton( 669 Messages.getString("SmpDialogAction.141"), false); //$NON-NLS-1$ 670 rbM01FiredN.setBounds(new Rectangle(155, 240, 80, 30)); 671 bgM01Fired = new ButtonGroup(); 672 bgM01Fired.add(rbM01Fired1); 673 bgM01Fired.add(rbM01FiredN); 674 675 ActionListener alM01Fired = new ActionListener() { 676 public void actionPerformed(java.awt.event.ActionEvent e) { 677 buoy.setSectored(rbM01FiredN.isSelected()); 678 cbM01Sector.setSelectedIndex(0); 679 buoy.setSectorIndex(0); 680 buoy.paintSign(); 681 } 682 }; 683 rbM01Fired1.addActionListener(alM01Fired); 684 rbM01FiredN.addActionListener(alM01Fired); 685 686 pM01SeaMap = new JPanel(); 687 pM01SeaMap.setLayout(null); 688 pM01SeaMap.add(lM01Head, null); 689 pM01SeaMap.add(rbM01RegionA, null); 690 pM01SeaMap.add(rbM01RegionB, null); 691 pM01SeaMap.add(lM01Region, null); 692 pM01SeaMap.add(lM02Region, null); 693 pM01SeaMap.add(lM01Icon, null); 694 pM01SeaMap.add(lM02Icon, null); 695 pM01SeaMap.add(lM03Icon, null); 696 pM01SeaMap.add(lM04Icon, null); 697 pM01SeaMap.add(lM05Icon, null); 698 pM01SeaMap.add(lM06Icon, null); 699 pM01SeaMap.add(getCbM01TypeOfMark(), null); 700 pM01SeaMap.add(lM01TypeOfMark, null); 701 pM01SeaMap.add(getCbM01CatOfMark(), null); 702 pM01SeaMap.add(lM01CatOfMark, null); 703 pM01SeaMap.add(getCbM01StyleOfMark(), null); 704 pM01SeaMap.add(lM01StyleOfMark, null); 705 pM01SeaMap.add(lM01Name, null); 706 pM01SeaMap.add(getTfM01Name(), null); 707 pM01SeaMap.add(lM01Props02, null); 708 pM01SeaMap.add(getCM01TopMark(), null); 709 pM01SeaMap.add(getCbM01TopMark(), null); 710 pM01SeaMap.add(getCM01Radar(), null); 711 pM01SeaMap.add(getCM01Racon(), null); 712 pM01SeaMap.add(getCbM01Racon(), null); 713 pM01SeaMap.add(getTfM01Racon(), null); 714 pM01SeaMap.add(lM01Racon, null); 715 pM01SeaMap.add(getCM01Fog(), null); 716 pM01SeaMap.add(getCbM01Fog(), null); 717 pM01SeaMap.add(getTfM01FogGroup(), null); 718 pM01SeaMap.add(lM01FogGroup, null); 719 pM01SeaMap.add(getTfM01FogPeriod(), null); 720 pM01SeaMap.add(lM01FogPeriod, null); 721 pM01SeaMap.add(getCM01Fired(), null); 722 pM01SeaMap.add(rbM01Fired1, null); 723 pM01SeaMap.add(rbM01FiredN, null); 724 pM01SeaMap.add(getTfM01RepeatTime(), null); 725 pM01SeaMap.add(lM01RepeatTime, null); 726 pM01SeaMap.add(getCbM01Kennung(), null); 727 pM01SeaMap.add(lM01Kennung, null); 728 pM01SeaMap.add(lM01Group, null); 729 pM01SeaMap.add(getTfM01Group(), null); 730 pM01SeaMap.add(lM01Sector, null); 731 pM01SeaMap.add(getCbM01Sector(), null); 732 pM01SeaMap.add(lM01Colour, null); 733 pM01SeaMap.add(getCbM01Colour(), null); 734 pM01SeaMap.add(lM01Bearing, null); 735 pM01SeaMap.add(getTfM01Bearing(), null); 736 pM01SeaMap.add(getTfM02Bearing(), null); 737 pM01SeaMap.add(getTfM01Radius(), null); 738 pM01SeaMap.add(lM01Height, null); 739 pM01SeaMap.add(getTfM01Height(), null); 740 pM01SeaMap.add(lM01Range, null); 741 pM01SeaMap.add(getTfM01Range(), null); 742 pM01SeaMap.add(lM01FireMark, null); 743 pM01SeaMap.add(getBM01Save(), null); 744 pM01SeaMap.add(getSM01StatusBar(), null); 745 pM01SeaMap.add(getBM01Close(), null); 746 pM01SeaMap.add(getCM01IconVisible(), null); 747 } 748 return pM01SeaMap; 749 } 750 751 private JComboBox getCbM01TypeOfMark() { 752 753 if (cbM01TypeOfMark == null) { 754 755 cbM01TypeOfMark = new JComboBox(); 756 757 // Inhalt der ComboBox 758 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.142")); //$NON-NLS-1$ 759 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.143")); //$NON-NLS-1$ 760 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.144")); //$NON-NLS-1$ 761 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.145")); //$NON-NLS-1$ 762 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.146")); //$NON-NLS-1$ 763 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.147")); //$NON-NLS-1$ 764 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.148")); //$NON-NLS-1$ 765 766 cbM01TypeOfMark.setBounds(new Rectangle(45, 25, 165, 25)); 767 // cbM01TypeOfMark.setEditable(false); 768 cbM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 769 cbM01TypeOfMark.setEnabled(true); 770 771 cbM01TypeOfMark.addActionListener(new ActionListener() { 772 public void actionPerformed(java.awt.event.ActionEvent e) { 773 int type = cbM01TypeOfMark.getSelectedIndex(); 774 775 if (buoy == null) { 776 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 777 return; 778 } 779 780 Node n = buoy.getNode(); 781 if (n == null) 782 return; 783 784 paintlock = true; 785 switch (type) { 786 787 case SeaMark.UNKNOWN_TYPE: 788 if (!(buoy instanceof BuoyUkn)) 789 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 790 buoy.setBuoyIndex(type); 791 break; 792 793 case SeaMark.LATERAL: 794 if (!(buoy instanceof BuoyLat)) { 795 buoy = new BuoyLat(dia, n); 796 buoy.setBuoyIndex(0); 797 } 798 break; 799 800 case SeaMark.CARDINAL: 801 if (!(buoy instanceof BuoyCard)) { 802 buoy = new BuoyCard(dia, n); 803 buoy.setBuoyIndex(0); 804 } 805 break; 806 807 case SeaMark.SAFE_WATER: 808 if (!(buoy instanceof BuoySaw)) { 809 buoy = new BuoySaw(dia, n); 810 } 811 buoy.setBuoyIndex(type); 812 break; 813 814 case SeaMark.ISOLATED_DANGER: 815 if (!(buoy instanceof BuoyIsol)) { 816 buoy = new BuoyIsol(dia, n); 817 } 818 buoy.setBuoyIndex(type); 819 break; 820 821 case SeaMark.SPECIAL_PURPOSE: 822 if (!(buoy instanceof BuoySpec)) { 823 buoy = new BuoySpec(dia, n); 824 } 825 buoy.setBuoyIndex(type); 826 break; 827 828 case SeaMark.LIGHT: 829 if (!(buoy instanceof BuoyNota)) { 830 buoy = new BuoyNota(dia, n); 831 buoy.setBuoyIndex(0); 832 } 833 break; 834 } 835 836 buoy.refreshStyles(); 837 buoy.refreshLights(); 838 buoy.setLightColour(); 839 paintlock = false; 840 buoy.paintSign(); 841 } 842 }); 843 } 844 return cbM01TypeOfMark; 845 } 846 847 private JComboBox getCbM01CatOfMark() { 848 if (cbM01CatOfMark == null) { 849 cbM01CatOfMark = new JComboBox(); 850 cbM01CatOfMark.setBounds(new Rectangle(60, 55, 150, 25)); 851 cbM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 852 cbM01CatOfMark.setEnabled(true); 853 854 cbM01CatOfMark.addActionListener(new ActionListener() { 855 public void actionPerformed(ActionEvent e) { 856 int cat = cbM01CatOfMark.getSelectedIndex(); 857 858 if (buoy == null) { 859 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 860 return; 861 } 862 863 Node n = buoy.getNode(); 864 if (n == null) 865 return; 866 867 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LATERAL) { 868 if (!(buoy instanceof BuoyLat)) 869 buoy = new BuoyLat(dia, n); 870 buoy.setBuoyIndex(cat); 871 } 872 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.CARDINAL) { 873 if (!(buoy instanceof BuoyCard)) 874 buoy = new BuoyCard(dia, n); 875 buoy.setBuoyIndex(cat); 876 } 877 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LIGHT) { 878 if (!(buoy instanceof BuoyNota)) 879 buoy = new BuoyNota(dia, n); 880 buoy.setBuoyIndex(cat); 881 } 882 883 buoy.refreshStyles(); 884 buoy.refreshLights(); 885 buoy.setLightColour(); 886 buoy.paintSign(); 887 } 888 }); 889 } 890 return cbM01CatOfMark; 891 } 892 893 private JComboBox getCbM01StyleOfMark() { 894 if (cbM01StyleOfMark == null) { 895 cbM01StyleOfMark = new JComboBox(); 896 cbM01StyleOfMark.setBounds(new Rectangle(45, 85, 165, 25)); 897 cbM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 898 cbM01StyleOfMark.addActionListener(new ActionListener() { 899 public void actionPerformed(ActionEvent e) { 900 int style = cbM01StyleOfMark.getSelectedIndex(); 901 if (buoy != null && style != buoy.getStyleIndex()) { 902 buoy.setStyleIndex(style); 903 buoy.paintSign(); 904 } 905 } 906 }); 907 } 908 return cbM01StyleOfMark; 909 } 910 911 private JTextField getTfM01Name() { 912 if (tfM01Name == null) { 913 tfM01Name = new JTextField(); 914 tfM01Name.setBounds(new Rectangle(50, 120, 150, 20)); 915 tfM01Name.addFocusListener(new FocusAdapter() { 916 public void focusLost(FocusEvent e) { 917 buoy.setName(tfM01Name.getText()); 918 } 919 }); 920 } 921 return tfM01Name; 922 } 923 924 private JCheckBox getCM01TopMark() { 925 if (cM01TopMark == null) { 926 cM01TopMark = new JCheckBox(); 927 cM01TopMark.setBounds(new Rectangle(10, 170, 100, 20)); 928 cM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 929 cM01TopMark.setText(Messages.getString("SmpDialogAction.166")); //$NON-NLS-1$ 930 cM01TopMark.addItemListener(new ItemListener() { 931 public void itemStateChanged(ItemEvent e) { 932 if (buoy == null) { 933 return; 934 } 935 buoy.setTopMark(cM01TopMark.isSelected()); 936 buoy.paintSign(); 937 } 938 }); 939 } 940 return cM01TopMark; 941 } 942 943 private JComboBox getCbM01TopMark() { 944 if (cbM01TopMark == null) { 945 cbM01TopMark = new JComboBox(); 946 cbM01TopMark.setBounds(new Rectangle(110, 170, 80, 20)); 947 cbM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 948 cbM01TopMark.addActionListener(new ActionListener() { 949 public void actionPerformed(ActionEvent e) { 950 int top = cbM01TopMark.getSelectedIndex(); 951 buoy.paintSign(); 952 } 953 }); 954 } 955 return cbM01TopMark; 956 } 957 958 private JCheckBox getCM01Radar() { 959 if (cM01Radar == null) { 960 cM01Radar = new JCheckBox(); 961 cM01Radar.setBounds(new Rectangle(10, 195, 120, 20)); 962 cM01Radar.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 963 cM01Radar.setText(Messages.getString("SmpDialogAction.169")); //$NON-NLS-1$ 964 cM01Radar.addActionListener(new ActionListener() { 965 public void actionPerformed(ActionEvent e) { 966 if (cM01Radar.isSelected()) { 967 buoy.setRadar(true); 968 buoy.setRacon(false); 969 cM01Racon.setSelected(false); 970 } else { 971 buoy.setRadar(false); 972 } 973 buoy.paintSign(); 974 } 975 }); 976 } 977 return cM01Radar; 978 } 979 980 private JCheckBox getCM01Racon() { 981 if (cM01Racon == null) { 982 cM01Racon = new JCheckBox(); 983 cM01Racon.setBounds(new Rectangle(130, 195, 110, 20)); 984 cM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 985 cM01Racon.setText(Messages.getString("SmpDialogAction.171")); //$NON-NLS-1$ 986 cM01Racon.addActionListener(new ActionListener() { 987 public void actionPerformed(ActionEvent e) { 988 if (cM01Racon.isSelected()) { 989 buoy.setRacon(true); 990 buoy.setRadar(false); 991 cM01Radar.setSelected(false); 992 } else { 993 buoy.setRacon(false); 994 } 995 buoy.paintSign(); 996 } 997 }); 998 } 999 return cM01Racon; 1000 } 1001 1002 private JComboBox getCbM01Racon() { 1003 if (cbM01Racon == null) { 1004 cbM01Racon = new JComboBox(); 1005 cbM01Racon.setBounds(new Rectangle(240, 195, 80, 20)); 1006 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1007 cbM01Racon.removeAllItems(); 1008 cbM01Racon.addItem("Any"); 1009 cbM01Racon.addItem("Racon"); 1010 cbM01Racon.addItem("Ramark"); 1011 cbM01Racon.addItem("Leading"); 1012 cbM01Racon.addActionListener(new ActionListener() { 1013 public void actionPerformed(ActionEvent e) { 1014 int rac = cbM01Racon.getSelectedIndex(); 1015 buoy.setRaType(rac); 1016 buoy.paintSign(); 1017 } 1018 }); 1019 } 1020 return cbM01Racon; 1021 } 1022 1023 private JTextField getTfM01Racon() { 1024 if (tfM01Racon == null) { 1025 tfM01Racon = new JTextField(); 1026 tfM01Racon.setBounds(new Rectangle(345, 195, 30, 20)); 1027 tfM01Racon.addFocusListener(new FocusAdapter() { 1028 public void focusLost(FocusEvent e) { 1029 buoy.setRaconGroup(tfM01Racon.getText().trim()); 1030 } 1031 }); 1032 } 1033 return tfM01Racon; 1034 } 1035 1036 private JCheckBox getCM01Fog() { 1037 if (cM01Fog == null) { 1038 cM01Fog = new JCheckBox(); 1039 cM01Fog.setBounds(new Rectangle(10, 220, 90, 20)); 1040 cM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1041 cM01Fog.setText(Messages.getString("SmpDialogAction.174")); //$NON-NLS-1$ 1042 cM01Fog.addActionListener(new ActionListener() { 1043 public void actionPerformed(ActionEvent e) { 1044 buoy.setFog(cM01Fog.isSelected()); 1045 buoy.paintSign(); 1046 } 1047 }); 1048 } 1049 return cM01Fog; 1050 } 1051 1052 private JComboBox getCbM01Fog() { 1053 if (cbM01Fog == null) { 1054 cbM01Fog = new JComboBox(); 1055 cbM01Fog.setBounds(new Rectangle(100, 220, 70, 20)); 1056 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1057 cbM01Fog.removeAllItems(); 1058 cbM01Fog.addItem("Any"); 1059 cbM01Fog.addItem("Horn"); 1060 cbM01Fog.addItem("Siren"); 1061 cbM01Fog.addItem("Dia"); 1062 cbM01Fog.addItem("Bell"); 1063 cbM01Fog.addItem("Whis"); 1064 cbM01Fog.addItem("Gong"); 1065 cbM01Fog.addItem("Explos"); 1066 cbM01Fog.addActionListener(new ActionListener() { 1067 public void actionPerformed(ActionEvent e) { 1068 if (cbM01Fog.getSelectedIndex() > 0) 1069 buoy.setFogSound(cbM01Fog.getSelectedIndex()); 1070 else 1071 buoy.setFogSound(0); 1072 buoy.paintSign(); 1073 } 1074 }); 1075 } 1076 return cbM01Fog; 1077 } 1078 1079 private JTextField getTfM01FogGroup() { 1080 if (tfM01FogGroup == null) { 1081 tfM01FogGroup = new JTextField(); 1082 tfM01FogGroup.setBounds(new Rectangle(243, 220, 30, 20)); 1083 tfM01FogGroup.addFocusListener(new FocusAdapter() { 1084 public void focusLost(FocusEvent e) { 1085 buoy.setFogGroup(tfM01FogGroup.getText().trim()); 1086 } 1087 }); 1088 } 1089 return tfM01FogGroup; 1090 } 1091 1092 private JTextField getTfM01FogPeriod() { 1093 if (tfM01FogPeriod == null) { 1094 tfM01FogPeriod = new JTextField(); 1095 tfM01FogPeriod.setBounds(new Rectangle(345, 220, 30, 20)); 1096 tfM01FogPeriod.addFocusListener(new FocusAdapter() { 1097 public void focusLost(FocusEvent e) { 1098 buoy.setFogPeriod(tfM01FogPeriod.getText().trim()); 1099 } 1100 }); 1101 } 1102 return tfM01FogPeriod; 1103 } 1104 1105 private JCheckBox getCM01Fired() { 1106 if (cM01Fired == null) { 1107 cM01Fired = new JCheckBox(); 1108 cM01Fired.setBounds(new Rectangle(10, 245, 75, 20)); 1109 cM01Fired.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1110 cM01Fired.setText(Messages.getString("SmpDialogAction.177")); //$NON-NLS-1$ 1111 cM01Fired.addItemListener(new ItemListener() { 1112 public void itemStateChanged(ItemEvent e) { 1113 if (buoy == null) { 1114 return; 1115 } 1116 buoy.setFired(cM01Fired.isSelected()); 1117 buoy.setLightColour(); 1118 buoy.paintSign(); 1119 } 1120 }); 1121 } 1122 1123 return cM01Fired; 1124 } 1125 1126 private JComboBox getCbM01Kennung() { 1127 if (cbM01Kennung == null) { 1128 cbM01Kennung = new JComboBox(); 1129 cbM01Kennung.setBounds(new Rectangle(305, 245, 70, 20)); 1130 cbM01Kennung.addActionListener(new ActionListener() { 1131 public void actionPerformed(ActionEvent e) { 1132 int i1, i2; 1133 String c = ""; //$NON-NLS-1$ //$NON-NLS-2$ 1134 String it = (String) cbM01Kennung.getSelectedItem(); 1135 1136 if (it == null) 1137 return; 1138 if (it.equals(Messages.getString("SmpDialogAction.212"))) //$NON-NLS-1$ 1139 return; 1140 if (buoy == null) 1141 return; 1142 1143 if (it.contains("(")) { 1144 i1 = it.indexOf("("); 1145 i2 = it.indexOf(")"); 1146 c = it.substring(i1 + 1, i2); 1147 it = it.substring(0, i1) + it.substring(i2 + 1); 1148 } 1149 if (!c.isEmpty()) 1150 buoy.setLightGroup(c); 1151 ; 1152 buoy.setLightChar(it); 1153 buoy.paintSign(); 1154 } 1155 }); 1156 } 1157 return cbM01Kennung; 1158 } 1159 1160 private JTextField getTfM01Height() { 1161 if (tfM01Height == null) { 1162 tfM01Height = new JTextField(); 1163 tfM01Height.setBounds(new Rectangle(54, 270, 30, 20)); 1164 tfM01Height.addFocusListener(new FocusAdapter() { 1165 public void focusLost(FocusEvent e) { 1166 buoy.setHeight(tfM01Height.getText().trim()); 1167 } 1168 }); 1169 } 1170 return tfM01Height; 1171 } 1172 1173 private JTextField getTfM01Range() { 1174 if (tfM01Range == null) { 1175 tfM01Range = new JTextField(); 1176 tfM01Range.setBounds(new Rectangle(151, 270, 30, 20)); 1177 tfM01Range.addFocusListener(new FocusAdapter() { 1178 public void focusLost(FocusEvent e) { 1179 buoy.setRange(tfM01Range.getText().trim()); 1180 } 1181 }); 1182 } 1183 return tfM01Range; 1184 } 1185 1186 private JTextField getTfM01Group() { 1187 if (tfM01Group == null) { 1188 tfM01Group = new JTextField(); 1189 tfM01Group.setBounds(new Rectangle(255, 270, 30, 20)); 1190 tfM01Group.addFocusListener(new FocusAdapter() { 1191 public void focusLost(FocusEvent e) { 1192 buoy.setLightGroup(tfM01Group.getText().trim()); 1193 buoy.paintSign(); 1194 } 1195 }); 1196 } 1197 return tfM01Group; 1198 } 1199 1200 private JTextField getTfM01RepeatTime() { 1201 if (tfM01RepeatTime == null) { 1202 tfM01RepeatTime = new JTextField(); 1203 tfM01RepeatTime.setBounds(new Rectangle(345, 270, 30, 20)); 1204 tfM01RepeatTime.addActionListener(new ActionListener() { 1205 public void actionPerformed(ActionEvent e) { 1206 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1207 buoy.paintSign(); 1208 } 1209 }); 1210 1211 tfM01RepeatTime.addFocusListener(new FocusAdapter() { 1212 public void focusLost(FocusEvent e) { 1213 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1214 buoy.paintSign(); 1215 } 1216 }); 1217 } 1218 return tfM01RepeatTime; 1219 } 1220 1221 private JComboBox getCbM01Colour() { 1222 if (cbM01Colour == null) { 1223 cbM01Colour = new JComboBox(); 1224 cbM01Colour.setBounds(new Rectangle(165, 295, 40, 20)); 1225 cbM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1226 cbM01Colour.addItem(""); //$NON-NLS-1$ 1227 cbM01Colour.addItem(Messages.getString("SmpDialogAction.190")); //$NON-NLS-1$ 1228 cbM01Colour.addItem(Messages.getString("SmpDialogAction.191")); //$NON-NLS-1$ 1229 cbM01Colour.addItem(Messages.getString("SmpDialogAction.192")); //$NON-NLS-1$ 1230 cbM01Colour.addActionListener(new ActionListener() { 1231 public void actionPerformed(ActionEvent e) { 1232 buoy.setLightColour((String) cbM01Colour.getSelectedItem()); 1233 buoy.paintSign(); 1234 } 1235 }); 1236 } 1237 return cbM01Colour; 1238 } 1239 1240 private JComboBox getCbM01Sector() { 1241 if (cbM01Sector == null) { 1242 cbM01Sector = new JComboBox(); 1243 cbM01Sector.setBounds(new Rectangle(55, 295, 50, 20)); 1244 cbM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1245 cbM01Sector.addItem(Messages.getString("SmpDialogAction.194")); //$NON-NLS-1$ 1246 cbM01Sector.addItem(Messages.getString("SmpDialogAction.195")); //$NON-NLS-1$ 1247 cbM01Sector.addItem(Messages.getString("SmpDialogAction.196")); //$NON-NLS-1$ 1248 cbM01Sector.addItem(Messages.getString("SmpDialogAction.197")); //$NON-NLS-1$ 1249 cbM01Sector.addItem(Messages.getString("SmpDialogAction.198")); //$NON-NLS-1$ 1250 cbM01Sector.addItem(Messages.getString("SmpDialogAction.199")); //$NON-NLS-1$ 1251 cbM01Sector.addItem(Messages.getString("SmpDialogAction.200")); //$NON-NLS-1$ 1252 cbM01Sector.addItem(Messages.getString("SmpDialogAction.201")); //$NON-NLS-1$ 1253 cbM01Sector.addItem(Messages.getString("SmpDialogAction.202")); //$NON-NLS-1$ 1254 cbM01Sector.addItem(Messages.getString("SmpDialogAction.203")); //$NON-NLS-1$ 1255 cbM01Sector.addActionListener(new ActionListener() { 1256 public void actionPerformed(ActionEvent e) { 1257 buoy.setSectorIndex(cbM01Sector.getSelectedIndex()); 1258 buoy.paintSign(); 1259 } 1260 }); 1261 } 1262 return cbM01Sector; 1263 } 1264 1265 private JTextField getTfM01Bearing() { 1266 if (tfM01Bearing == null) { 1267 tfM01Bearing = new JTextField(); 1268 tfM01Bearing.setBounds(new Rectangle(255, 295, 30, 20)); 1269 tfM01Bearing.addFocusListener(new FocusAdapter() { 1270 public void focusLost(FocusEvent e) { 1271 buoy.setBearing1(tfM01Bearing.getText().trim()); 1272 } 1273 }); 1274 } 1275 return tfM01Bearing; 1276 } 1277 1278 private JTextField getTfM02Bearing() { 1279 if (tfM02Bearing == null) { 1280 tfM02Bearing = new JTextField(); 1281 tfM02Bearing.setBounds(new Rectangle(300, 295, 30, 20)); 1282 tfM02Bearing.addFocusListener(new FocusAdapter() { 1283 public void focusLost(FocusEvent e) { 1284 buoy.setBearing2(tfM02Bearing.getText().trim()); 1285 } 1286 }); 1287 } 1288 return tfM02Bearing; 1289 } 1290 1291 private JTextField getTfM01Radius() { 1292 if (tfM01Radius == null) { 1293 tfM01Radius = new JTextField(); 1294 tfM01Radius.setBounds(new Rectangle(355, 295, 30, 20)); 1295 tfM01Radius.addFocusListener(new FocusAdapter() { 1296 public void focusLost(FocusEvent e) { 1297 buoy.setRadius(tfM01Radius.getText().trim()); 1298 } 1299 }); 1300 } 1301 return tfM01Radius; 1302 } 1303 1304 private JButton getBM01Close() { 1305 if (bM01Close == null) { 1306 bM01Close = new JButton(); 1307 bM01Close.setBounds(new Rectangle(20, 325, 110, 20)); 1308 bM01Close.setText(tr("Close")); 1309 bM01Close.addActionListener(new ActionListener() { 1310 public void actionPerformed(ActionEvent e) { 1311 // aufraeumen 1312 if (obuoy != null) 1313 PicRebuild(); 1314 // Deaktivierung des Listeners 1315 DataSet.removeSelectionListener(SmpListener); 1316 Selection = null; 1317 SmpItem.setEnabled(true); 1318 onode = null; 1319 1320 dM01SeaMap.dispose(); 1321 } 1322 }); 1323 } 1324 1325 return bM01Close; 1326 } 1327 1328 private JButton getBM01Save() { 1329 if (bM01Save == null) { 1330 bM01Save = new JButton(); 1331 bM01Save.setBounds(new Rectangle(150, 325, 110, 20)); 1332 bM01Save.setText(tr("Save")); 1333 bM01Save.setEnabled(false); 1334 1335 bM01Save.addActionListener(new ActionListener() { 1336 public void actionPerformed(ActionEvent e) { 1337 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1338 "/images/Auge.png"))); //$NON-NLS-1$ 1339 cM01IconVisible.setSelected(true); 1340 1341 buoy.saveSign(); 1342 } 1343 }); 1344 } 1345 1346 return bM01Save; 1347 } 1348 1349 private JCheckBox getCM01IconVisible() { 1350 if (cM01IconVisible == null) { 1351 cM01IconVisible = new JCheckBox(); 1352 cM01IconVisible.setBounds(new Rectangle(310, 325, 30, 21)); 1353 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1354 "/images/AugeN.png"))); //$NON-NLS-1$ 1355 cM01IconVisible.setSelected(false); 1356 cM01IconVisible.addActionListener(new ActionListener() { 1357 public void actionPerformed(ActionEvent e) { 1358 Command c; 1359 Node n = null; 1360 DataSet ds = Main.main.getCurrentDataSet(); 1361 1362 if (buoy != null) 1363 n = buoy.getNode(); 1364 1365 if (cM01IconVisible.isSelected()) { 1366 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1367 "/images/AugeN.png"))); //$NON-NLS-1$ 1368 if (n != null) { 1369 // seamark loeschen, wenn notwendig 1370 if (n.getKeys().containsKey("seamark")) { //$NON-NLS-1$ 1371 smb = n.getKeys().get("seamark"); // smb merken //$NON-NLS-1$ 1372 1373 c = new ChangePropertyCommand(n, "seamark", null); //$NON-NLS-1$ 1374 c.executeCommand(); 1375 ds.fireSelectionChanged(); 1376 obuoy = buoy; 1377 } 1378 1379 // seamark:type loeschen, wenn notwendig 1380 if (n.getKeys().containsKey("seamark:type")) { //$NON-NLS-1$ 1381 smt = n.getKeys().get("seamark:type"); // smt merken //$NON-NLS-1$ 1382 1383 c = new ChangePropertyCommand(n, "seamark:type", null); //$NON-NLS-1$ 1384 c.executeCommand(); 1385 ds.fireSelectionChanged(); 1386 obuoy = buoy; 1387 } 1388 1389 } 1390 } else { 1391 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1392 "/images/Auge.png"))); //$NON-NLS-1$ 1393 PicRebuild(); 1394 obuoy = null; 1395 } 1396 buoy.paintSign(); 1397 } 1398 }); 1399 } 1400 return cM01IconVisible; 1401 } 1402 1403 private JTextField getSM01StatusBar() { 1404 if (sM01StatusBar == null) { 1405 sM01StatusBar = new JTextField(); 1406 sM01StatusBar.setBounds(new Rectangle(7, 355, 385, 20)); 1407 sM01StatusBar.setBackground(SystemColor.activeCaptionBorder); 1408 } 1409 return sM01StatusBar; 1410 } 1410 1411 1411 1412 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java
r23193 r23224 18 18 public class BuoyCard extends Buoy { 19 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 20 public BuoyCard(SmpDialogAction dia, Node node) { 21 super(dia); 22 23 String str; 24 Map<String, String> keys; 25 keys = node.getKeys(); 26 setNode(node); 27 28 resetMask(); 29 dlg.cbM01CatOfMark.removeAllItems(); 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.158")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.159")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.160")); //$NON-NLS-1$ 34 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.161")); //$NON-NLS-1$ 35 36 dlg.cbM01CatOfMark.setEnabled(true); 37 dlg.cbM01CatOfMark.setVisible(true); 38 dlg.lM01CatOfMark.setVisible(true); 39 40 dlg.cbM01StyleOfMark.removeAllItems(); 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.setVisible(true); 48 dlg.lM01StyleOfMark.setVisible(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL); 51 52 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 53 if (keys.containsKey("name")) //$NON-NLS-1$ 54 setName(keys.get("name")); //$NON-NLS-1$ 55 56 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_cardinal:name")) //$NON-NLS-1$ 60 setName(keys.get("seamark:buoy_cardinal:name")); //$NON-NLS-1$ 61 else if (keys.containsKey("seamark:beacon_cardinal:name")) //$NON-NLS-1$ 62 setName(keys.get("seamark:beacon_cardinal:name")); //$NON-NLS-1$ 63 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 65 66 String cat = ""; //$NON-NLS-1$ 67 String col = ""; //$NON-NLS-1$ 68 69 if (keys.containsKey("seamark:buoy_cardinal:category")) //$NON-NLS-1$ 70 cat = keys.get("seamark:buoy_cardinal:category"); //$NON-NLS-1$ 71 else if (keys.containsKey("seamark:beacon_cardinal:category")) //$NON-NLS-1$ 72 cat = keys.get("seamark:beacon_cardinal:category"); //$NON-NLS-1$ 73 74 if (keys.containsKey("seamark:buoy_cardinal:colour")) //$NON-NLS-1$ 75 col = keys.get("seamark:buoy_cardinal:colour"); //$NON-NLS-1$ 76 else if (keys.containsKey("seamark:beacon_cardinal:colour")) //$NON-NLS-1$ 77 col = keys.get("seamark:beacon_cardinal:colour"); //$NON-NLS-1$ 78 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 79 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 80 81 if (cat.isEmpty()) { //$NON-NLS-1$ 82 if (col.equals("black;yellow")) { //$NON-NLS-1$ 83 setBuoyIndex(CARD_NORTH); 84 setColour(BLACK_YELLOW); 85 } else if (col.equals("black;yellow;black")) { //$NON-NLS-1$ 86 setBuoyIndex(CARD_EAST); 87 setColour(BLACK_YELLOW_BLACK); 88 } else if (col.equals("yellow;black")) { //$NON-NLS-1$ 89 setBuoyIndex(CARD_SOUTH); 90 setColour(YELLOW_BLACK); 91 } else if (col.equals("yellow;black;yellow")) { //$NON-NLS-1$ 92 setBuoyIndex(CARD_WEST); 93 setColour(YELLOW_BLACK_YELLOW); 94 } 95 } else if (cat.equals("north")) { //$NON-NLS-1$ 96 setBuoyIndex(CARD_NORTH); 97 setColour(BLACK_YELLOW); 98 } else if (cat.equals("east")) { //$NON-NLS-1$ 99 setBuoyIndex(CARD_EAST); 100 setColour(BLACK_YELLOW_BLACK); 101 } else if (cat.equals("south")) { //$NON-NLS-1$ 102 setBuoyIndex(CARD_SOUTH); 103 setColour(YELLOW_BLACK); 104 } else if (cat.equals("west")) { //$NON-NLS-1$ 105 setBuoyIndex(CARD_WEST); 106 setColour(YELLOW_BLACK_YELLOW); 107 } 108 109 if (keys.containsKey("seamark:buoy_cardinal:shape")) { //$NON-NLS-1$ 110 str = keys.get("seamark:buoy_cardinal:shape"); //$NON-NLS-1$ 111 112 if (str.equals("pillar")) //$NON-NLS-1$ 113 setStyleIndex(CARD_PILLAR); 114 else if (str.equals("spar")) //$NON-NLS-1$ 115 setStyleIndex(CARD_SPAR); 116 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 117 if (keys.containsKey("seamark:beacon_cardinal:shape")) { //$NON-NLS-1$ 118 str = keys.get("seamark:beacon_cardinal:shape"); //$NON-NLS-1$ 119 120 if (str.equals("tower")) //$NON-NLS-1$ 121 setStyleIndex(CARD_TOWER); 122 else 123 setStyleIndex(CARD_BEACON); 124 } else 125 setStyleIndex(CARD_BEACON); 126 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 127 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 128 setStyleIndex(CARD_FLOAT); 129 } 130 131 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 132 setStyleIndex(0); 133 134 refreshLights(); 135 parseLights(keys); 136 parseFogRadar(keys); 137 138 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 139 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 140 dlg.tfM01Name.setText(getName()); 141 dlg.cM01TopMark.setSelected(hasTopMark()); 142 } 143 144 public void refreshLights() { 145 int type = getBuoyIndex(); 146 147 dlg.cbM01Kennung.removeAllItems(); 148 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 149 dlg.cbM01Kennung.setSelectedIndex(0); 150 151 switch (type) { 152 case SeaMark.CARD_NORTH: 153 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 154 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 155 break; 156 157 case SeaMark.CARD_EAST: 158 dlg.cbM01Kennung.addItem("Q(3)"); //$NON-NLS-1$ 159 dlg.cbM01Kennung.addItem("VQ(3)"); //$NON-NLS-1$ 160 break; 161 162 case SeaMark.CARD_SOUTH: 163 dlg.cbM01Kennung.addItem("Q(6)+LFl"); //$NON-NLS-1$ 164 dlg.cbM01Kennung.addItem("VQ(6)+LFl"); //$NON-NLS-1$ 165 break; 166 167 case SeaMark.CARD_WEST: 168 dlg.cbM01Kennung.addItem("Q(9)"); //$NON-NLS-1$ 169 dlg.cbM01Kennung.addItem("VQ(9)"); //$NON-NLS-1$ 170 break; 171 172 default: 173 } 174 175 } 176 177 public boolean isValid() { 178 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 179 } 180 181 public void paintSign() { 182 if (dlg.paintlock) 183 return; 184 super.paintSign(); 185 186 dlg.sM01StatusBar.setText(getErrMsg()); 187 188 if (isValid()) { 189 dlg.tfM01Name.setEnabled(true); 190 dlg.tfM01Name.setText(getName()); 191 dlg.cM01TopMark.setSelected(true); 192 dlg.cM01TopMark.setVisible(true); 193 dlg.cM01TopMark.setEnabled(false); 194 dlg.cM01Radar.setVisible(true); 195 dlg.cM01Racon.setVisible(true); 196 dlg.cM01Fog.setVisible(true); 197 dlg.cM01Fired.setEnabled(true); 198 dlg.cM01Fired.setVisible(true); 199 dlg.cbM01Colour.setVisible(false); 200 dlg.lM01Colour.setVisible(false); 201 dlg.rbM01Fired1.setVisible(false); 202 dlg.rbM01FiredN.setVisible(false); 203 dlg.lM01Height.setVisible(false); 204 dlg.tfM01Height.setVisible(false); 205 dlg.lM01Range.setVisible(false); 206 dlg.tfM01Range.setVisible(false); 207 208 if (isFired()) { 209 switch (getStyleIndex()) { 210 case LAT_BEACON: 211 case LAT_TOWER: 212 dlg.rbM01Fired1.setVisible(true); 213 dlg.rbM01FiredN.setVisible(true); 214 dlg.lM01Height.setVisible(true); 215 dlg.tfM01Height.setVisible(true); 216 dlg.lM01Range.setVisible(true); 217 dlg.tfM01Range.setVisible(true); 218 break; 219 case LAT_FLOAT: 220 dlg.lM01Height.setVisible(true); 221 dlg.tfM01Height.setVisible(true); 222 dlg.lM01Range.setVisible(true); 223 dlg.tfM01Range.setVisible(true); 224 break; 225 default: 226 } 227 } 228 String image = "/images/Cardinal"; //$NON-NLS-1$ 229 230 switch (getStyleIndex()) { 231 case SeaMark.CARD_PILLAR: 232 image += "_Pillar"; //$NON-NLS-1$ 233 break; 234 235 case SeaMark.CARD_SPAR: 236 image += "_Spar"; //$NON-NLS-1$ 237 break; 238 239 case SeaMark.CARD_BEACON: 240 image += "_Beacon"; //$NON-NLS-1$ 241 break; 242 243 case SeaMark.CARD_TOWER: 244 image += "_Tower"; //$NON-NLS-1$ 245 break; 246 247 case SeaMark.CARD_FLOAT: 248 image += "_Float"; //$NON-NLS-1$ 249 break; 250 251 default: 252 return; 253 } 254 255 switch (getBuoyIndex()) { 256 case CARD_NORTH: 257 image += "_North"; //$NON-NLS-1$ 258 break; 259 case CARD_EAST: 260 image += "_East"; //$NON-NLS-1$ 261 break; 262 case CARD_SOUTH: 263 image += "_South"; //$NON-NLS-1$ 264 break; 265 case CARD_WEST: 266 image += "_West"; //$NON-NLS-1$ 267 break; 268 default: 269 return; 270 } 271 272 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 273 image += ".png"; //$NON-NLS-1$ 274 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 275 276 } else 277 dlg.lM01Icon.setIcon(null); 278 } 279 } 280 281 public void setLightColour() { 282 super.setLightColour("W"); //$NON-NLS-1$ 283 } 284 285 public void saveSign() { 286 Node node = getNode(); 287 if (node == null) { 288 return; 289 } 290 291 String shape = ""; //$NON-NLS-1$ 292 293 switch (getStyleIndex()) { 294 case CARD_PILLAR: 295 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 296 Main.main.undoRedo.add(new ChangePropertyCommand(node, 297 "seamark:buoy_cardinal:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 298 break; 299 case CARD_SPAR: 300 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 301 Main.main.undoRedo.add(new ChangePropertyCommand(node, 302 "seamark:buoy_cardinal:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 303 break; 304 case CARD_BEACON: 305 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 306 break; 307 case CARD_TOWER: 308 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 309 Main.main.undoRedo.add(new ChangePropertyCommand(node, 310 "seamark:beacon_cardinal:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 311 break; 312 case CARD_FLOAT: 313 super.saveSign("light_float"); //$NON-NLS-1$ 314 break; 315 default: 316 } 317 318 switch (getStyleIndex()) { 319 case CARD_PILLAR: 320 case CARD_SPAR: 321 switch (getBuoyIndex()) { 322 case SeaMark.CARD_NORTH: 323 Main.main.undoRedo.add(new ChangePropertyCommand(node, 324 "seamark:buoy_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 325 Main.main.undoRedo.add(new ChangePropertyCommand(node, 326 "seamark:buoy_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 327 shape = "2 cones up"; //$NON-NLS-1$ 328 break; 329 330 case SeaMark.CARD_EAST: 331 Main.main.undoRedo.add(new ChangePropertyCommand(node, 332 "seamark:buoy_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 333 Main.main.undoRedo.add(new ChangePropertyCommand(node, 334 "seamark:buoy_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 335 shape = "2 cones base together"; //$NON-NLS-1$ 336 break; 337 338 case SeaMark.CARD_SOUTH: 339 Main.main.undoRedo.add(new ChangePropertyCommand(node, 340 "seamark:buoy_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 341 Main.main.undoRedo.add(new ChangePropertyCommand(node, 342 "seamark:buoy_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 343 shape = "2 cones down"; //$NON-NLS-1$ 344 break; 345 346 case SeaMark.CARD_WEST: 347 Main.main.undoRedo.add(new ChangePropertyCommand(node, 348 "seamark:buoy_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 349 Main.main.undoRedo.add(new ChangePropertyCommand(node, 350 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 351 shape = "2 cones point together"; //$NON-NLS-1$ 352 break; 353 } 354 Main.main.undoRedo.add(new ChangePropertyCommand(node, 355 "seamark:buoy_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 356 break; 357 case CARD_BEACON: 358 case CARD_TOWER: 359 switch (getBuoyIndex()) { 360 case SeaMark.CARD_NORTH: 361 Main.main.undoRedo.add(new ChangePropertyCommand(node, 362 "seamark:beacon_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 363 Main.main.undoRedo.add(new ChangePropertyCommand(node, 364 "seamark:beacon_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 365 shape = "2 cones up"; //$NON-NLS-1$ 366 break; 367 368 case SeaMark.CARD_EAST: 369 Main.main.undoRedo.add(new ChangePropertyCommand(node, 370 "seamark:beacon_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 371 Main.main.undoRedo.add(new ChangePropertyCommand(node, 372 "seamark:beacon_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 373 shape = "2 cones base together"; //$NON-NLS-1$ 374 break; 375 376 case SeaMark.CARD_SOUTH: 377 Main.main.undoRedo.add(new ChangePropertyCommand(node, 378 "seamark:beacon_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 379 Main.main.undoRedo.add(new ChangePropertyCommand(node, 380 "seamark:beacon_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 381 shape = "2 cones down"; //$NON-NLS-1$ 382 break; 383 384 case SeaMark.CARD_WEST: 385 Main.main.undoRedo.add(new ChangePropertyCommand(node, 386 "seamark:beacon_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 387 Main.main.undoRedo.add(new ChangePropertyCommand(node, 388 "seamark:beacon_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 389 shape = "2 cones point together"; //$NON-NLS-1$ 390 break; 391 } 392 Main.main.undoRedo.add(new ChangePropertyCommand(node, 393 "seamark:beacon_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 394 break; 395 case CARD_FLOAT: 396 switch (getBuoyIndex()) { 397 case SeaMark.CARD_NORTH: 398 Main.main.undoRedo.add(new ChangePropertyCommand(node, 399 "seamark:light_float:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 400 shape = "2 cones up"; //$NON-NLS-1$ 401 break; 402 403 case SeaMark.CARD_EAST: 404 Main.main.undoRedo.add(new ChangePropertyCommand(node, 405 "seamark:light_float:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 406 shape = "2 cones base together"; //$NON-NLS-1$ 407 break; 408 409 case SeaMark.CARD_SOUTH: 410 Main.main.undoRedo.add(new ChangePropertyCommand(node, 411 "seamark:light_float:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 412 shape = "2 cones down"; //$NON-NLS-1$ 413 break; 414 415 case SeaMark.CARD_WEST: 416 Main.main.undoRedo.add(new ChangePropertyCommand(node, 417 "seamark:light_float:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 418 shape = "2 cones point together"; //$NON-NLS-1$ 419 break; 420 } 421 Main.main.undoRedo.add(new ChangePropertyCommand(node, 422 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 423 break; 424 } 425 saveTopMarkData(shape, "black"); //$NON-NLS-1$ 426 saveLightData(); //$NON-NLS-1$ 427 saveRadarFogData(); 428 } 429 429 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java
r23193 r23224 17 17 18 18 public class BuoyIsol extends Buoy { 19 public BuoyIsol(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(ISOLATED_DANGER); 42 setColour(SeaMark.BLACK_RED_BLACK); 43 setLightColour("W"); //$NON-NLS-1$ 44 setTopMark(true); 45 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 46 47 if (keys.containsKey("name")) //$NON-NLS-1$ 48 setName(keys.get("name")); //$NON-NLS-1$ 49 50 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 51 setName(keys.get("seamark:name")); //$NON-NLS-1$ 52 53 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$ 57 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 58 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$ 61 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$ 62 63 if (str.equals("pillar")) //$NON-NLS-1$ 64 setStyleIndex(ISOL_PILLAR); 65 else if (str.equals("spar")) //$NON-NLS-1$ 66 setStyleIndex(ISOL_SPAR); 67 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 68 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$ 69 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$ 70 71 if (str.equals("tower")) //$NON-NLS-1$ 72 setStyleIndex(ISOL_TOWER); 73 else 74 setStyleIndex(ISOL_BEACON); 75 } else 76 setStyleIndex(ISOL_BEACON); 77 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 78 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 79 setStyleIndex(CARD_FLOAT); 80 } 81 82 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 83 setStyleIndex(0); 84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 85 86 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 87 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 88 setTopMark(true); 89 } 90 91 refreshLights(); 92 parseLights(keys); 93 parseFogRadar(keys); 94 95 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 96 dlg.tfM01Name.setText(getName()); 97 dlg.cM01TopMark.setSelected(hasTopMark()); 98 } 99 100 public void refreshLights() { 101 dlg.cbM01Kennung.removeAllItems(); 102 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 103 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$ 104 dlg.cbM01Kennung.setSelectedIndex(0); 105 } 106 107 public boolean isValid() { 108 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 109 } 110 111 public void paintSign() { 112 if (dlg.paintlock) 113 return; 114 115 super.paintSign(); 116 117 dlg.sM01StatusBar.setText(getErrMsg()); 118 119 if (isValid()) { 120 dlg.tfM01Name.setEnabled(true); 121 dlg.tfM01Name.setText(getName()); 122 dlg.cM01TopMark.setVisible(true); 123 dlg.cM01Radar.setVisible(true); 124 dlg.cM01Racon.setVisible(true); 125 dlg.cM01Fog.setVisible(true); 126 dlg.cM01Fired.setVisible(true); 127 dlg.cbM01Colour.setVisible(false); 128 dlg.lM01Colour.setVisible(false); 129 dlg.rbM01Fired1.setVisible(false); 130 dlg.rbM01FiredN.setVisible(false); 131 dlg.lM01Height.setVisible(false); 132 dlg.tfM01Height.setVisible(false); 133 dlg.lM01Range.setVisible(false); 134 dlg.tfM01Range.setVisible(false); 135 136 if (isFired()) { 137 switch (getStyleIndex()) { 138 case SPEC_FLOAT: 139 dlg.lM01Height.setVisible(true); 140 dlg.tfM01Height.setVisible(true); 141 dlg.lM01Range.setVisible(true); 142 dlg.tfM01Range.setVisible(true); 143 break; 144 case SPEC_BEACON: 145 case SPEC_TOWER: 146 dlg.rbM01Fired1.setVisible(true); 147 dlg.rbM01FiredN.setVisible(true); 148 dlg.lM01Height.setVisible(true); 149 dlg.tfM01Height.setVisible(true); 150 dlg.lM01Range.setVisible(true); 151 dlg.tfM01Range.setVisible(true); 152 break; 153 default: 154 } 155 } 156 157 String image = "/images/Cardinal"; //$NON-NLS-1$ 158 159 switch (getStyleIndex()) { 160 case ISOL_PILLAR: 161 image += "_Pillar_Single"; //$NON-NLS-1$ 162 break; 163 case ISOL_SPAR: 164 image += "_Spar_Single"; //$NON-NLS-1$ 165 break; 166 case ISOL_BEACON: 167 image += "_Beacon_Single"; //$NON-NLS-1$ 168 break; 169 case ISOL_TOWER: 170 image += "_Tower_Single"; //$NON-NLS-1$ 171 break; 172 case ISOL_FLOAT: 173 image += "_Float_Single"; //$NON-NLS-1$ 174 break; 175 default: 176 } 177 178 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 179 image += ".png"; //$NON-NLS-1$ 180 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 181 } else 182 dlg.lM01Icon.setIcon(null); 183 } else { 184 dlg.tfM01Name.setEnabled(false); 185 dlg.tfM01Name.setText(""); //$NON-NLS-1$ 186 dlg.cM01TopMark.setVisible(false); 187 dlg.cM01Radar.setVisible(false); 188 dlg.cM01Racon.setVisible(false); 189 dlg.cM01Fog.setVisible(false); 190 dlg.cM01Fired.setVisible(false); 191 } 192 } 193 194 public void saveSign() { 195 Node node = getNode(); 196 197 if (node == null) { 198 return; 199 } 200 201 switch (getStyleIndex()) { 202 case ISOL_PILLAR: 203 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 204 Main.main.undoRedo.add(new ChangePropertyCommand(node, 205 "seamark:buoy_isolated_danger:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 206 break; 207 case ISOL_SPAR: 208 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 209 Main.main.undoRedo.add(new ChangePropertyCommand(node, 210 "seamark:buoy_isolated_danger:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 211 break; 212 case ISOL_BEACON: 213 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 214 break; 215 case ISOL_TOWER: 216 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 217 Main.main.undoRedo.add(new ChangePropertyCommand(node, 218 "seamark:beacon_isolated_danger:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 219 break; 220 case ISOL_FLOAT: 221 super.saveSign("light_float"); //$NON-NLS-1$ 222 break; 223 default: 224 } 225 226 switch (getStyleIndex()) { 227 case ISOL_PILLAR: 228 case ISOL_SPAR: 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 231 Main.main.undoRedo.add(new ChangePropertyCommand(node, 232 "seamark:buoy_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 233 break; 234 case ISOL_BEACON: 235 case ISOL_TOWER: 236 Main.main.undoRedo 237 .add(new ChangePropertyCommand(node, 238 "seamark:beacon_isolated_danger:colour_pattern", //$NON-NLS-1$ 239 "horizontal stripes")); //$NON-NLS-1$ 240 Main.main.undoRedo.add(new ChangePropertyCommand(node, 241 "seamark:beacon_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 242 break; 243 case ISOL_FLOAT: 244 Main.main.undoRedo.add(new ChangePropertyCommand(node, 245 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 246 Main.main.undoRedo.add(new ChangePropertyCommand(node, 247 "seamark:light_float:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 248 break; 249 } 250 251 saveTopMarkData("2 spheres", "black"); //$NON-NLS-1$ //$NON-NLS-2$ 252 saveLightData(); //$NON-NLS-1$ 253 saveRadarFogData(); 254 255 } 256 257 public void setLightColour() { 258 super.setLightColour("W"); //$NON-NLS-1$ 259 } 19 public BuoyIsol(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(ISOLATED_DANGER); 42 setColour(SeaMark.BLACK_RED_BLACK); 43 setLightColour("W"); //$NON-NLS-1$ 44 setTopMark(true); 45 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 46 47 if (keys.containsKey("name")) //$NON-NLS-1$ 48 setName(keys.get("name")); //$NON-NLS-1$ 49 50 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 51 setName(keys.get("seamark:name")); //$NON-NLS-1$ 52 53 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$ 57 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 58 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$ 61 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$ 62 63 if (str.equals("pillar")) //$NON-NLS-1$ 64 setStyleIndex(ISOL_PILLAR); 65 else if (str.equals("spar")) //$NON-NLS-1$ 66 setStyleIndex(ISOL_SPAR); 67 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 68 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$ 69 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$ 70 71 if (str.equals("tower")) //$NON-NLS-1$ 72 setStyleIndex(ISOL_TOWER); 73 else 74 setStyleIndex(ISOL_BEACON); 75 } else 76 setStyleIndex(ISOL_BEACON); 77 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 78 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 79 setStyleIndex(CARD_FLOAT); 80 } 81 82 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 83 setStyleIndex(0); 84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 85 86 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 87 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 88 setTopMark(true); 89 } 90 91 refreshLights(); 92 parseLights(keys); 93 parseFogRadar(keys); 94 95 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 96 dlg.tfM01Name.setText(getName()); 97 dlg.cM01TopMark.setSelected(hasTopMark()); 98 } 99 100 public void refreshLights() { 101 dlg.cbM01Kennung.removeAllItems(); 102 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 103 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$ 104 dlg.cbM01Kennung.setSelectedIndex(0); 105 } 106 107 public boolean isValid() { 108 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 109 } 110 111 public void paintSign() { 112 if (dlg.paintlock) 113 return; 114 115 super.paintSign(); 116 117 dlg.sM01StatusBar.setText(getErrMsg()); 118 119 if (isValid()) { 120 dlg.tfM01Name.setEnabled(true); 121 dlg.tfM01Name.setText(getName()); 122 dlg.cM01TopMark.setVisible(true); 123 dlg.cM01Radar.setVisible(true); 124 dlg.cM01Racon.setVisible(true); 125 dlg.cM01Fog.setVisible(true); 126 dlg.cM01Fired.setVisible(true); 127 dlg.cbM01Colour.setVisible(false); 128 dlg.lM01Colour.setVisible(false); 129 dlg.rbM01Fired1.setVisible(false); 130 dlg.rbM01FiredN.setVisible(false); 131 dlg.lM01Height.setVisible(false); 132 dlg.tfM01Height.setVisible(false); 133 dlg.lM01Range.setVisible(false); 134 dlg.tfM01Range.setVisible(false); 135 136 if (isFired()) { 137 switch (getStyleIndex()) { 138 case SPEC_FLOAT: 139 dlg.lM01Height.setVisible(true); 140 dlg.tfM01Height.setVisible(true); 141 dlg.lM01Range.setVisible(true); 142 dlg.tfM01Range.setVisible(true); 143 break; 144 case SPEC_BEACON: 145 case SPEC_TOWER: 146 dlg.rbM01Fired1.setVisible(true); 147 dlg.rbM01FiredN.setVisible(true); 148 dlg.lM01Height.setVisible(true); 149 dlg.tfM01Height.setVisible(true); 150 dlg.lM01Range.setVisible(true); 151 dlg.tfM01Range.setVisible(true); 152 break; 153 default: 154 } 155 } 156 157 String image = "/images/Cardinal"; //$NON-NLS-1$ 158 159 switch (getStyleIndex()) { 160 case ISOL_PILLAR: 161 image += "_Pillar_Single"; //$NON-NLS-1$ 162 break; 163 case ISOL_SPAR: 164 image += "_Spar_Single"; //$NON-NLS-1$ 165 break; 166 case ISOL_BEACON: 167 image += "_Beacon_Single"; //$NON-NLS-1$ 168 break; 169 case ISOL_TOWER: 170 image += "_Tower_Single"; //$NON-NLS-1$ 171 break; 172 case ISOL_FLOAT: 173 image += "_Float_Single"; //$NON-NLS-1$ 174 break; 175 default: 176 } 177 178 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 179 image += ".png"; //$NON-NLS-1$ 180 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 181 } else 182 dlg.lM01Icon.setIcon(null); 183 } else { 184 dlg.tfM01Name.setEnabled(false); 185 dlg.tfM01Name.setText(""); //$NON-NLS-1$ 186 dlg.cM01TopMark.setVisible(false); 187 dlg.cM01Radar.setVisible(false); 188 dlg.cM01Racon.setVisible(false); 189 dlg.cM01Fog.setVisible(false); 190 dlg.cM01Fired.setVisible(false); 191 } 192 } 193 194 public void saveSign() { 195 Node node = getNode(); 196 197 if (node == null) { 198 return; 199 } 200 201 switch (getStyleIndex()) { 202 case ISOL_PILLAR: 203 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 204 Main.main.undoRedo.add(new ChangePropertyCommand(node, 205 "seamark:buoy_isolated_danger:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 206 break; 207 case ISOL_SPAR: 208 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 209 Main.main.undoRedo.add(new ChangePropertyCommand(node, 210 "seamark:buoy_isolated_danger:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 211 break; 212 case ISOL_BEACON: 213 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 214 break; 215 case ISOL_TOWER: 216 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 217 Main.main.undoRedo.add(new ChangePropertyCommand(node, 218 "seamark:beacon_isolated_danger:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 219 break; 220 case ISOL_FLOAT: 221 super.saveSign("light_float"); //$NON-NLS-1$ 222 break; 223 default: 224 } 225 226 switch (getStyleIndex()) { 227 case ISOL_PILLAR: 228 case ISOL_SPAR: 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 231 Main.main.undoRedo.add(new ChangePropertyCommand(node, 232 "seamark:buoy_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 233 break; 234 case ISOL_BEACON: 235 case ISOL_TOWER: 236 Main.main.undoRedo.add(new ChangePropertyCommand(node, 237 "seamark:beacon_isolated_danger:colour_pattern", //$NON-NLS-1$ 238 "horizontal stripes")); //$NON-NLS-1$ 239 Main.main.undoRedo.add(new ChangePropertyCommand(node, 240 "seamark:beacon_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 241 break; 242 case ISOL_FLOAT: 243 Main.main.undoRedo.add(new ChangePropertyCommand(node, 244 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 245 Main.main.undoRedo.add(new ChangePropertyCommand(node, 246 "seamark:light_float:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 247 break; 248 } 249 250 saveTopMarkData("2 spheres", "black"); //$NON-NLS-1$ //$NON-NLS-2$ 251 saveLightData(); //$NON-NLS-1$ 252 saveRadarFogData(); 253 254 } 255 256 public void setLightColour() { 257 super.setLightColour("W"); //$NON-NLS-1$ 258 } 260 259 261 260 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java
r23223 r23224 16 16 17 17 public class BuoyLat extends Buoy { 18 public BuoyLat(SmpDialogAction dia, Node node) { 19 super(dia); 20 21 String str; 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 26 resetMask(); 27 28 dlg.cbM01CatOfMark.removeAllItems(); 29 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$ 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$ 34 35 dlg.rbM01RegionA.setEnabled(true); 36 dlg.rbM01RegionB.setEnabled(true); 37 dlg.cbM01CatOfMark.setEnabled(true); 38 dlg.cbM01CatOfMark.setVisible(true); 39 dlg.lM01CatOfMark.setVisible(true); 40 41 dlg.cbM01StyleOfMark.removeAllItems(); 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 48 dlg.cbM01StyleOfMark.setEnabled(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL); 51 52 if (keys.containsKey("name")) //$NON-NLS-1$ 53 setName(keys.get("name")); //$NON-NLS-1$ 54 55 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:name")); //$NON-NLS-1$ 57 58 if (keys.containsKey("seamark:buoy_lateral:name")) //$NON-NLS-1$ 59 setName(keys.get("seamark:buoy_lateral:name")); //$NON-NLS-1$ 60 else if (keys.containsKey("seamark:beacon_lateral:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:beacon_lateral:name")); //$NON-NLS-1$ 62 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 63 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 64 65 String cat = ""; //$NON-NLS-1$ 66 String col = ""; //$NON-NLS-1$ 67 String top = ""; //$NON-NLS-1$ 68 69 if (getStyleIndex() != LAT_PERCH) { 70 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 71 top = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 72 setTopMark(true); 73 } 74 if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 75 setTopMark(true); 76 } 77 } 78 79 if (keys.containsKey("seamark:buoy_lateral:colour")) //$NON-NLS-1$ 80 col = keys.get("seamark:buoy_lateral:colour"); //$NON-NLS-1$ 81 else if (keys.containsKey("seamark:beacon_lateral:colour")) //$NON-NLS-1$ 82 col = keys.get("seamark:beacon_lateral:colour"); //$NON-NLS-1$ 83 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 84 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 85 86 if (keys.containsKey("seamark:buoy_lateral:category")) //$NON-NLS-1$ 87 cat = keys.get("seamark:buoy_lateral:category"); //$NON-NLS-1$ 88 else if (keys.containsKey("seamark:beacon_lateral:category")) //$NON-NLS-1$ 89 cat = keys.get("seamark:beacon_lateral:category"); //$NON-NLS-1$ 90 91 if (cat.isEmpty()) { //$NON-NLS-1$ 92 if (col.equals("red")) { //$NON-NLS-1$ 93 setColour(RED); 94 if (top.equals("cylinder")) { //$NON-NLS-1$ 95 setBuoyIndex(PORT_HAND); 96 setRegion(IALA_A); 97 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 98 setBuoyIndex(STARBOARD_HAND); 99 setRegion(IALA_B); 100 } else { 101 if (getRegion() == IALA_A) 102 setBuoyIndex(PORT_HAND); 103 else 104 setBuoyIndex(STARBOARD_HAND); 105 } 106 } else if (col.equals("green")) { //$NON-NLS-1$ 107 setColour(GREEN); 108 if (top.equals("cone, point up")) { //$NON-NLS-1$ 109 setBuoyIndex(STARBOARD_HAND); 110 setRegion(IALA_A); 111 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 112 setBuoyIndex(PORT_HAND); 113 setRegion(IALA_B); 114 } else { 115 if (getRegion() == IALA_A) 116 setBuoyIndex(STARBOARD_HAND); 117 else 118 setBuoyIndex(PORT_HAND); 119 } 120 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 121 setColour(RED_GREEN_RED); 122 if (top.equals("cylinder")) { //$NON-NLS-1$ 123 setBuoyIndex(PREF_PORT_HAND); 124 setRegion(IALA_A); 125 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 126 setBuoyIndex(PREF_STARBOARD_HAND); 127 setRegion(IALA_B); 128 } else { 129 if (getRegion() == IALA_A) 130 setBuoyIndex(PREF_PORT_HAND); 131 else 132 setBuoyIndex(PREF_STARBOARD_HAND); 133 } 134 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 135 setColour(GREEN_RED_GREEN); 136 if (top.equals("cone, point up")) { //$NON-NLS-1$ 137 setBuoyIndex(PREF_STARBOARD_HAND); 138 setRegion(IALA_A); 139 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 140 setBuoyIndex(PREF_PORT_HAND); 141 setRegion(IALA_B); 142 } else { 143 if (getRegion() == IALA_A) 144 setBuoyIndex(PREF_STARBOARD_HAND); 145 else 146 setBuoyIndex(PREF_PORT_HAND); 147 } 148 } 149 } else if (cat.equals("port")) { //$NON-NLS-1$ 150 151 setBuoyIndex(PORT_HAND); 152 153 if (col.equals("red")) { //$NON-NLS-1$ 154 setRegion(IALA_A); 155 setColour(RED); 156 } else if (col.equals("green")) { //$NON-NLS-1$ 157 setRegion(IALA_B); 158 setColour(GREEN); 159 } else { 160 if (getRegion() == IALA_A) 161 setColour(RED); 162 else 163 setColour(GREEN); 164 } 165 } else if (cat.equals("starboard")) { //$NON-NLS-1$ 166 167 setBuoyIndex(STARBOARD_HAND); 168 169 if (col.equals("green")) { //$NON-NLS-1$ 170 setRegion(IALA_A); 171 setColour(GREEN); 172 } else if (col.equals("red")) { //$NON-NLS-1$ 173 setRegion(IALA_B); 174 setColour(RED); 175 } else { 176 if (getRegion() == IALA_A) 177 setColour(GREEN); 178 else 179 setColour(RED); 180 } 181 } else if (cat.equals("preferred_channel_port")) { //$NON-NLS-1$ 182 183 setBuoyIndex(PREF_PORT_HAND); 184 185 if (col.equals("red;green;red")) { //$NON-NLS-1$ 186 setRegion(IALA_A); 187 setColour(RED_GREEN_RED); 188 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 189 setRegion(IALA_B); 190 setColour(GREEN_RED_GREEN); 191 } else { 192 if (getRegion() == IALA_A) 193 setColour(RED_GREEN_RED); 194 else 195 setColour(GREEN_RED_GREEN); 196 } 197 198 } else if (cat.equals("preferred_channel_starboard")) { //$NON-NLS-1$ 199 200 setBuoyIndex(PREF_STARBOARD_HAND); 201 202 if (col.equals("green;red;green")) { //$NON-NLS-1$ 203 setRegion(IALA_A); 204 setColour(GREEN_RED_GREEN); 205 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 206 setRegion(IALA_B); 207 setColour(RED_GREEN_RED); 208 } else { 209 if (getRegion() == IALA_A) 210 setColour(GREEN_RED_GREEN); 211 else 212 setColour(RED_GREEN_RED); 213 } 214 } 215 216 if (keys.containsKey("seamark:buoy_lateral:shape")) { //$NON-NLS-1$ 217 str = keys.get("seamark:buoy_lateral:shape"); //$NON-NLS-1$ 218 219 switch (getBuoyIndex()) { 220 case PORT_HAND: 221 if (str.equals("can")) //$NON-NLS-1$ 222 setStyleIndex(LAT_CAN); 223 else if (str.equals("pillar")) //$NON-NLS-1$ 224 setStyleIndex(LAT_PILLAR); 225 else if (str.equals("spar")) //$NON-NLS-1$ 226 setStyleIndex(LAT_SPAR); 227 break; 228 229 case PREF_PORT_HAND: 230 if (str.equals("can")) //$NON-NLS-1$ 231 setStyleIndex(LAT_CAN); 232 else if (str.equals("pillar")) //$NON-NLS-1$ 233 setStyleIndex(LAT_PILLAR); 234 else if (str.equals("spar")) //$NON-NLS-1$ 235 setStyleIndex(LAT_SPAR); 236 break; 237 238 case STARBOARD_HAND: 239 if (str.equals("conical")) //$NON-NLS-1$ 240 setStyleIndex(LAT_CONE); 241 else if (str.equals("pillar")) //$NON-NLS-1$ 242 setStyleIndex(LAT_PILLAR); 243 else if (str.equals("spar")) //$NON-NLS-1$ 244 setStyleIndex(LAT_SPAR); 245 break; 246 247 case PREF_STARBOARD_HAND: 248 if (str.equals("conical")) //$NON-NLS-1$ 249 setStyleIndex(LAT_CONE); 250 else if (str.equals("pillar")) //$NON-NLS-1$ 251 setStyleIndex(LAT_PILLAR); 252 else if (str.equals("spar")) //$NON-NLS-1$ 253 setStyleIndex(LAT_SPAR); 254 break; 255 } 256 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { //$NON-NLS-1$ 257 str = keys.get("seamark:beacon_lateral:shape"); //$NON-NLS-1$ 258 if (str.equals("tower")) //$NON-NLS-1$ 259 setStyleIndex(LAT_TOWER); 260 else if (str.equals("perch")) //$NON-NLS-1$ 261 setStyleIndex(LAT_PERCH); 262 else 263 setStyleIndex(LAT_BEACON); 264 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 265 && (keys.get("seamark:type").equals("beacon_lateral"))) { //$NON-NLS-1$ //$NON-NLS-2$ 266 setStyleIndex(LAT_BEACON); 267 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 268 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 269 setStyleIndex(LAT_FLOAT); 270 } 271 272 refreshStyles(); 273 refreshLights(); 274 setLightColour(); 275 parseLights(keys); 276 parseFogRadar(keys); 277 278 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 279 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 280 dlg.tfM01Name.setText(getName()); 281 dlg.cM01TopMark.setSelected(hasTopMark()); 282 } 283 284 public void refreshStyles() { 285 int type = getBuoyIndex(); 286 int style = getStyleIndex(); 287 288 dlg.cbM01StyleOfMark.removeAllItems(); 289 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213")); //$NON-NLS-1$ 290 291 switch (type) { 292 case PORT_HAND: 293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 297 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 298 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 300 break; 301 302 case STARBOARD_HAND: 303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 305 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 306 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 307 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 308 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 309 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 310 break; 311 312 case PREF_PORT_HAND: 313 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 314 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 315 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 316 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 317 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 318 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 319 break; 320 321 case PREF_STARBOARD_HAND: 322 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 323 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 324 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 325 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 326 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 327 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 328 break; 329 330 default: 331 } 332 333 if (style >= dlg.cbM01StyleOfMark.getItemCount()) 334 style = 0; 335 setStyleIndex(style); 336 dlg.cbM01StyleOfMark.setSelectedIndex(style); 337 dlg.cbM01StyleOfMark.setVisible(true); 338 dlg.lM01StyleOfMark.setVisible(true); 339 } 340 341 public boolean isValid() { 342 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 343 } 344 345 public void paintSign() { 346 if (dlg.paintlock) 347 return; 348 super.paintSign(); 349 350 dlg.sM01StatusBar.setText(getErrMsg()); 351 352 if (isValid()) { 353 dlg.tfM01Name.setEnabled(true); 354 dlg.tfM01Name.setText(getName()); 355 356 int cat = getBuoyIndex(); 357 boolean region = getRegion(); 358 int style = getStyleIndex(); 359 360 if (style == LAT_PERCH) { 361 dlg.cM01TopMark.setVisible(false); 362 dlg.cM01TopMark.setSelected(false); 363 dlg.cM01Radar.setVisible(false); 364 dlg.cM01Racon.setVisible(false); 365 dlg.cM01Fog.setVisible(false); 366 dlg.cM01Fired.setVisible(false); 367 dlg.cM01Fired.setSelected(false); 368 } else { 369 dlg.cM01TopMark.setEnabled(true); 370 dlg.cM01TopMark.setVisible(true); 371 dlg.cM01Radar.setVisible(true); 372 dlg.cM01Racon.setVisible(true); 373 dlg.cM01Fog.setVisible(true); 374 dlg.cM01Fired.setVisible(true); 375 dlg.cM01Fired.setEnabled(true); 376 dlg.cM01TopMark.setEnabled(true); 377 } 378 dlg.cbM01Colour.setVisible(false); 379 dlg.lM01Colour.setVisible(false); 380 dlg.rbM01Fired1.setVisible(false); 381 dlg.rbM01FiredN.setVisible(false); 382 dlg.lM01Height.setVisible(false); 383 dlg.tfM01Height.setVisible(false); 384 dlg.lM01Range.setVisible(false); 385 dlg.tfM01Range.setVisible(false); 386 387 if (isFired()) { 388 switch (style) { 389 case LAT_BEACON: 390 case LAT_TOWER: 391 dlg.rbM01Fired1.setVisible(true); 392 dlg.rbM01FiredN.setVisible(true); 393 dlg.lM01Height.setVisible(true); 394 dlg.tfM01Height.setVisible(true); 395 dlg.lM01Range.setVisible(true); 396 dlg.tfM01Range.setVisible(true); 397 break; 398 case LAT_FLOAT: 399 dlg.lM01Height.setVisible(true); 400 dlg.tfM01Height.setVisible(true); 401 dlg.lM01Range.setVisible(true); 402 dlg.tfM01Range.setVisible(true); 403 break; 404 default: 405 } 406 } 407 String image = "/images/Lateral"; //$NON-NLS-1$ 408 409 switch (getBuoyIndex()) { 410 case PORT_HAND: 411 if (region == IALA_A) 412 switch (style) { 413 case LAT_CAN: 414 image += "_Can_Red"; //$NON-NLS-1$ 415 break; 416 case LAT_PILLAR: 417 image += "_Pillar_Red"; //$NON-NLS-1$ 418 break; 419 case LAT_SPAR: 420 image += "_Spar_Red"; //$NON-NLS-1$ 421 break; 422 case LAT_BEACON: 423 image += "_Beacon_Red"; //$NON-NLS-1$ 424 break; 425 case LAT_TOWER: 426 image += "_Tower_Red"; //$NON-NLS-1$ 427 break; 428 case LAT_FLOAT: 429 image += "_Float_Red"; //$NON-NLS-1$ 430 break; 431 case LAT_PERCH: 432 image += "_Perch_Port"; //$NON-NLS-1$ 433 break; 434 default: 435 } 436 else 437 switch (style) { 438 case LAT_CAN: 439 image += "_Can_Green"; //$NON-NLS-1$ 440 break; 441 case LAT_PILLAR: 442 image += "_Pillar_Green"; //$NON-NLS-1$ 443 break; 444 case LAT_SPAR: 445 image += "_Spar_Green"; //$NON-NLS-1$ 446 break; 447 case LAT_BEACON: 448 image += "_Beacon_Green"; //$NON-NLS-1$ 449 break; 450 case LAT_TOWER: 451 image += "_Tower_Green"; //$NON-NLS-1$ 452 break; 453 case LAT_FLOAT: 454 image += "_Float_Green"; //$NON-NLS-1$ 455 break; 456 case LAT_PERCH: 457 image += "_Perch_Port"; //$NON-NLS-1$ 458 break; 459 default: 460 } 461 break; 462 463 case STARBOARD_HAND: 464 if (region == IALA_A) 465 switch (style) { 466 case LAT_CONE: 467 image += "_Cone_Green"; //$NON-NLS-1$ 468 break; 469 case LAT_PILLAR: 470 image += "_Pillar_Green"; //$NON-NLS-1$ 471 break; 472 case LAT_SPAR: 473 image += "_Spar_Green"; //$NON-NLS-1$ 474 break; 475 case LAT_BEACON: 476 image += "_Beacon_Green"; //$NON-NLS-1$ 477 break; 478 case LAT_TOWER: 479 image += "_Tower_Green"; //$NON-NLS-1$ 480 break; 481 case LAT_FLOAT: 482 image += "_Float_Green"; //$NON-NLS-1$ 483 break; 484 case LAT_PERCH: 485 image += "_Perch_Starboard"; //$NON-NLS-1$ 486 break; 487 default: 488 } 489 else 490 switch (style) { 491 case LAT_CONE: 492 image += "_Cone_Red"; //$NON-NLS-1$ 493 break; 494 case LAT_PILLAR: 495 image += "_Pillar_Red"; //$NON-NLS-1$ 496 break; 497 case LAT_SPAR: 498 image += "_Spar_Red"; //$NON-NLS-1$ 499 break; 500 case LAT_BEACON: 501 image += "_Beacon_Red"; //$NON-NLS-1$ 502 break; 503 case LAT_TOWER: 504 image += "_Tower_Red"; //$NON-NLS-1$ 505 break; 506 case LAT_FLOAT: 507 image += "_Float_Red"; //$NON-NLS-1$ 508 break; 509 case LAT_PERCH: 510 image += "_Perch_Starboard"; //$NON-NLS-1$ 511 break; 512 default: 513 } 514 break; 515 516 case PREF_PORT_HAND: 517 if (region == IALA_A) 518 switch (style) { 519 case LAT_CAN: 520 image += "_Can_Red_Green_Red"; //$NON-NLS-1$ 521 break; 522 case LAT_PILLAR: 523 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 524 break; 525 case LAT_SPAR: 526 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 527 break; 528 case LAT_BEACON: 529 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 530 break; 531 case LAT_TOWER: 532 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 533 break; 534 case LAT_FLOAT: 535 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 536 break; 537 default: 538 } 539 else 540 switch (style) { 541 case LAT_CAN: 542 image += "_Can_Green_Red_Green"; //$NON-NLS-1$ 543 break; 544 case LAT_PILLAR: 545 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 546 break; 547 case LAT_SPAR: 548 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 549 break; 550 case LAT_BEACON: 551 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 552 break; 553 case LAT_TOWER: 554 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 555 break; 556 case LAT_FLOAT: 557 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 558 break; 559 default: 560 } 561 break; 562 563 case PREF_STARBOARD_HAND: 564 if (region == IALA_A) 565 switch (style) { 566 case LAT_CONE: 567 image += "_Cone_Green_Red_Green"; //$NON-NLS-1$ 568 break; 569 case LAT_PILLAR: 570 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 571 break; 572 case LAT_SPAR: 573 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 574 break; 575 case LAT_BEACON: 576 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 577 break; 578 case LAT_TOWER: 579 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 580 break; 581 case LAT_FLOAT: 582 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 583 break; 584 default: 585 } 586 else 587 switch (style) { 588 case LAT_CONE: 589 image += "_Cone_Red_Green_Red"; //$NON-NLS-1$ 590 break; 591 case LAT_PILLAR: 592 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 593 break; 594 case LAT_SPAR: 595 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 596 break; 597 case LAT_BEACON: 598 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 599 break; 600 case LAT_TOWER: 601 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 602 break; 603 case LAT_FLOAT: 604 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 605 break; 606 default: 607 } 608 break; 609 610 default: 611 } 612 613 if (!image.equals("/images/Lateral")) { //$NON-NLS-1$ 614 615 /* if (hasTopMark()) { 616 if (cat == PORT_HAND || cat == PREF_PORT_HAND) 617 image += "_Can"; //$NON-NLS-1$ 618 else 619 image += "_Cone"; //$NON-NLS-1$ 620 } 621 */ image += ".png"; //$NON-NLS-1$ 622 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 623 624 if (hasRadar()) { 625 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 626 "/images/Radar_Reflector.png"))); //$NON-NLS-1$ 627 } 628 629 } else 630 dlg.lM01Icon.setIcon(null); 631 } 632 } 633 634 public void saveSign() { 635 Node node = getNode(); 636 637 if (node == null) { 638 return; 639 } 640 641 int cat = getBuoyIndex(); 642 String shape = ""; //$NON-NLS-1$ 643 String colour = ""; //$NON-NLS-1$ 644 645 switch (cat) { 646 647 case PORT_HAND: 648 switch (getStyleIndex()) { 649 case LAT_CAN: 650 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 651 Main.main.undoRedo.add(new ChangePropertyCommand(node, 652 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 653 break; 654 case LAT_PILLAR: 655 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 656 Main.main.undoRedo.add(new ChangePropertyCommand(node, 657 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 658 break; 659 case LAT_SPAR: 660 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 661 Main.main.undoRedo.add(new ChangePropertyCommand(node, 662 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 663 break; 664 case LAT_BEACON: 665 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 666 break; 667 case LAT_TOWER: 668 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 669 Main.main.undoRedo.add(new ChangePropertyCommand(node, 670 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 671 break; 672 case LAT_FLOAT: 673 super.saveSign("light_float"); //$NON-NLS-1$ 674 break; 675 case LAT_PERCH: 676 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 677 Main.main.undoRedo.add(new ChangePropertyCommand(node, 678 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 679 break; 680 default: 681 } 682 switch (getStyleIndex()) { 683 case LAT_CAN: 684 case LAT_PILLAR: 685 case LAT_SPAR: 686 Main.main.undoRedo.add(new ChangePropertyCommand(node, 687 "seamark:buoy_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 688 if (getRegion() == IALA_A) { 689 Main.main.undoRedo.add(new ChangePropertyCommand(node, 690 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 691 colour = "red"; //$NON-NLS-1$ 692 } else { 693 Main.main.undoRedo.add(new ChangePropertyCommand(node, 694 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 695 colour = "green"; //$NON-NLS-1$ 696 } 697 break; 698 case LAT_PERCH: 699 Main.main.undoRedo.add(new ChangePropertyCommand(node, 700 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 701 break; 702 case LAT_BEACON: 703 case LAT_TOWER: 704 Main.main.undoRedo.add(new ChangePropertyCommand(node, 705 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 706 if (getRegion() == IALA_A) { 707 Main.main.undoRedo.add(new ChangePropertyCommand(node, 708 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 709 colour = "red"; //$NON-NLS-1$ 710 } else { 711 Main.main.undoRedo.add(new ChangePropertyCommand(node, 712 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 713 colour = "green"; //$NON-NLS-1$ 714 } 715 break; 716 case LAT_FLOAT: 717 if (getRegion() == IALA_A) { 718 Main.main.undoRedo.add(new ChangePropertyCommand(node, 719 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 720 colour = "red"; //$NON-NLS-1$ 721 } else { 722 Main.main.undoRedo.add(new ChangePropertyCommand(node, 723 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 724 colour = "green"; //$NON-NLS-1$ 725 } 726 break; 727 } 728 shape = "cylinder"; //$NON-NLS-1$ 729 break; 730 731 case PREF_PORT_HAND: 732 switch (getStyleIndex()) { 733 case LAT_CAN: 734 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 735 Main.main.undoRedo.add(new ChangePropertyCommand(node, 736 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 737 break; 738 case LAT_PILLAR: 739 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 740 Main.main.undoRedo.add(new ChangePropertyCommand(node, 741 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 742 break; 743 case LAT_SPAR: 744 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 745 Main.main.undoRedo.add(new ChangePropertyCommand(node, 746 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 747 break; 748 case LAT_BEACON: 749 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 750 break; 751 case LAT_TOWER: 752 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 753 Main.main.undoRedo.add(new ChangePropertyCommand(node, 754 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 755 break; 756 case LAT_FLOAT: 757 super.saveSign("light_float"); //$NON-NLS-1$ 758 break; 759 default: 760 } 761 switch (getStyleIndex()) { 762 case LAT_CAN: 763 case LAT_PILLAR: 764 case LAT_SPAR: 765 Main.main.undoRedo.add(new ChangePropertyCommand(node, 766 "seamark:buoy_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 767 Main.main.undoRedo.add(new ChangePropertyCommand(node, 768 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 769 if (getRegion() == IALA_A) { 770 Main.main.undoRedo.add(new ChangePropertyCommand(node, 771 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 772 colour = "red"; //$NON-NLS-1$ 773 } else { 774 Main.main.undoRedo.add(new ChangePropertyCommand(node, 775 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 776 colour = "green"; //$NON-NLS-1$ 777 } 778 break; 779 case LAT_BEACON: 780 case LAT_TOWER: 781 Main.main.undoRedo.add(new ChangePropertyCommand(node, 782 "seamark:beacon_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 783 Main.main.undoRedo.add(new ChangePropertyCommand(node, 784 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 785 if (getRegion() == IALA_A) { 786 Main.main.undoRedo.add(new ChangePropertyCommand(node, 787 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 788 colour = "red"; //$NON-NLS-1$ 789 } else { 790 Main.main.undoRedo.add(new ChangePropertyCommand(node, 791 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 792 colour = "green"; //$NON-NLS-1$ 793 } 794 break; 795 case LAT_FLOAT: 796 Main.main.undoRedo.add(new ChangePropertyCommand(node, 797 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 798 if (getRegion() == IALA_A) { 799 Main.main.undoRedo.add(new ChangePropertyCommand(node, 800 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 801 colour = "red"; //$NON-NLS-1$ 802 } else { 803 Main.main.undoRedo.add(new ChangePropertyCommand(node, 804 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 805 colour = "green"; //$NON-NLS-1$ 806 } 807 break; 808 } 809 shape = "cylinder"; //$NON-NLS-1$ 810 break; 811 812 case STARBOARD_HAND: 813 switch (getStyleIndex()) { 814 case LAT_CONE: 815 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 816 Main.main.undoRedo.add(new ChangePropertyCommand(node, 817 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 818 break; 819 case LAT_PILLAR: 820 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 821 Main.main.undoRedo.add(new ChangePropertyCommand(node, 822 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 823 break; 824 case LAT_SPAR: 825 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 826 Main.main.undoRedo.add(new ChangePropertyCommand(node, 827 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 828 break; 829 case LAT_BEACON: 830 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 831 Main.main.undoRedo.add(new ChangePropertyCommand(node, 832 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 833 break; 834 case LAT_TOWER: 835 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 836 Main.main.undoRedo.add(new ChangePropertyCommand(node, 837 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 838 break; 839 case LAT_FLOAT: 840 super.saveSign("light_float"); //$NON-NLS-1$ 841 break; 842 case LAT_PERCH: 843 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 844 Main.main.undoRedo.add(new ChangePropertyCommand(node, 845 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 846 break; 847 default: 848 } 849 switch (getStyleIndex()) { 850 case LAT_CAN: 851 case LAT_PILLAR: 852 case LAT_SPAR: 853 Main.main.undoRedo.add(new ChangePropertyCommand(node, 854 "seamark:buoy_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 855 if (getRegion() == IALA_A) { 856 Main.main.undoRedo.add(new ChangePropertyCommand(node, 857 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 858 colour = "green"; //$NON-NLS-1$ 859 } else { 860 Main.main.undoRedo.add(new ChangePropertyCommand(node, 861 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 862 colour = "red"; //$NON-NLS-1$ 863 } 864 break; 865 case LAT_BEACON: 866 case LAT_TOWER: 867 Main.main.undoRedo.add(new ChangePropertyCommand(node, 868 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 869 if (getRegion() == IALA_A) { 870 Main.main.undoRedo.add(new ChangePropertyCommand(node, 871 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 872 colour = "green"; //$NON-NLS-1$ 873 } else { 874 Main.main.undoRedo.add(new ChangePropertyCommand(node, 875 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 876 colour = "red"; //$NON-NLS-1$ 877 } 878 break; 879 case LAT_FLOAT: 880 if (getRegion() == IALA_A) { 881 Main.main.undoRedo.add(new ChangePropertyCommand(node, 882 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 883 colour = "green"; //$NON-NLS-1$ 884 } else { 885 Main.main.undoRedo.add(new ChangePropertyCommand(node, 886 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 887 colour = "red"; //$NON-NLS-1$ 888 } 889 break; 890 case LAT_PERCH: 891 Main.main.undoRedo.add(new ChangePropertyCommand(node, 892 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 893 break; 894 } 895 shape = "cone, point up"; //$NON-NLS-1$ 896 break; 897 898 case PREF_STARBOARD_HAND: 899 switch (getStyleIndex()) { 900 case LAT_CONE: 901 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 902 Main.main.undoRedo.add(new ChangePropertyCommand(node, 903 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 904 break; 905 case LAT_PILLAR: 906 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 907 Main.main.undoRedo.add(new ChangePropertyCommand(node, 908 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 909 break; 910 case LAT_SPAR: 911 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 912 Main.main.undoRedo.add(new ChangePropertyCommand(node, 913 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 914 break; 915 case LAT_BEACON: 916 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 917 Main.main.undoRedo.add(new ChangePropertyCommand(node, 918 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 919 break; 920 case LAT_TOWER: 921 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 922 Main.main.undoRedo.add(new ChangePropertyCommand(node, 923 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 924 break; 925 case LAT_FLOAT: 926 super.saveSign("light_float"); //$NON-NLS-1$ 927 break; 928 default: 929 } 930 switch (getStyleIndex()) { 931 case LAT_CAN: 932 case LAT_PILLAR: 933 case LAT_SPAR: 934 Main.main.undoRedo.add(new ChangePropertyCommand(node, 935 "seamark:buoy_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 936 Main.main.undoRedo.add(new ChangePropertyCommand(node, 937 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 938 if (getRegion() == IALA_A) { 939 Main.main.undoRedo.add(new ChangePropertyCommand(node, 940 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 941 colour = "green"; //$NON-NLS-1$ 942 } else { 943 Main.main.undoRedo.add(new ChangePropertyCommand(node, 944 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 945 colour = "red"; //$NON-NLS-1$ 946 } 947 break; 948 case LAT_BEACON: 949 case LAT_TOWER: 950 Main.main.undoRedo.add(new ChangePropertyCommand(node, 951 "seamark:beacon_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 952 Main.main.undoRedo.add(new ChangePropertyCommand(node, 953 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 954 if (getRegion() == IALA_A) { 955 Main.main.undoRedo.add(new ChangePropertyCommand(node, 956 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 957 colour = "green"; //$NON-NLS-1$ 958 } else { 959 Main.main.undoRedo.add(new ChangePropertyCommand(node, 960 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 961 colour = "red"; //$NON-NLS-1$ 962 } 963 break; 964 case LAT_FLOAT: 965 Main.main.undoRedo.add(new ChangePropertyCommand(node, 966 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 967 if (getRegion() == IALA_A) { 968 Main.main.undoRedo.add(new ChangePropertyCommand(node, 969 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 970 colour = "green"; //$NON-NLS-1$ 971 } else { 972 Main.main.undoRedo.add(new ChangePropertyCommand(node, 973 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 974 colour = "red"; //$NON-NLS-1$ 975 } 976 break; 977 } 978 shape = "cone, point up"; //$NON-NLS-1$ 979 break; 980 981 default: 982 } 983 saveTopMarkData(shape, colour); 984 saveLightData(); 985 saveRadarFogData(); 986 987 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 988 } 989 990 public void setLightColour() { 991 if (getRegion() == IALA_A) { 992 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 993 super.setLightColour("R"); //$NON-NLS-1$ 994 else 995 super.setLightColour("G"); //$NON-NLS-1$ 996 } else { 997 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 998 super.setLightColour("G"); //$NON-NLS-1$ 999 else 1000 super.setLightColour("R"); //$NON-NLS-1$ 1001 } 1002 } 1003 1004 public void setLightColour(String str) { 1005 int cat = getBuoyIndex(); 1006 1007 if (str == null) { 1008 return; 1009 } 1010 1011 switch (cat) { 1012 case PORT_HAND: 1013 case PREF_PORT_HAND: 1014 if (getRegion() == IALA_A) { 1015 if (str.equals("red")) { //$NON-NLS-1$ 1016 setFired(true); 1017 super.setLightColour("R"); //$NON-NLS-1$ 1018 } else { 1019 super.setLightColour(""); //$NON-NLS-1$ 1020 } 1021 } else { 1022 if (str.equals("green")) { //$NON-NLS-1$ 1023 setFired(true); 1024 super.setLightColour("G"); //$NON-NLS-1$ 1025 } else { 1026 super.setLightColour(""); //$NON-NLS-1$ 1027 } 1028 } 1029 break; 1030 1031 case STARBOARD_HAND: 1032 case PREF_STARBOARD_HAND: 1033 if (getRegion() == IALA_A) { 1034 if (str.equals("green")) { //$NON-NLS-1$ 1035 setFired(true); 1036 super.setLightColour("G"); //$NON-NLS-1$ 1037 } else { 1038 super.setLightColour(""); //$NON-NLS-1$ 1039 } 1040 } else { 1041 if (str.equals("red")) { //$NON-NLS-1$ 1042 setFired(true); 1043 super.setLightColour("R"); //$NON-NLS-1$ 1044 } else { 1045 super.setLightColour(""); //$NON-NLS-1$ 1046 } 1047 } 1048 break; 1049 default: 1050 } 1051 } 18 public BuoyLat(SmpDialogAction dia, Node node) { 19 super(dia); 20 21 String str; 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 26 resetMask(); 27 28 dlg.cbM01CatOfMark.removeAllItems(); 29 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$ 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$ 34 35 dlg.rbM01RegionA.setEnabled(true); 36 dlg.rbM01RegionB.setEnabled(true); 37 dlg.cbM01CatOfMark.setEnabled(true); 38 dlg.cbM01CatOfMark.setVisible(true); 39 dlg.lM01CatOfMark.setVisible(true); 40 41 dlg.cbM01StyleOfMark.removeAllItems(); 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 48 dlg.cbM01StyleOfMark.setEnabled(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL); 51 52 if (keys.containsKey("name")) //$NON-NLS-1$ 53 setName(keys.get("name")); //$NON-NLS-1$ 54 55 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:name")); //$NON-NLS-1$ 57 58 if (keys.containsKey("seamark:buoy_lateral:name")) //$NON-NLS-1$ 59 setName(keys.get("seamark:buoy_lateral:name")); //$NON-NLS-1$ 60 else if (keys.containsKey("seamark:beacon_lateral:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:beacon_lateral:name")); //$NON-NLS-1$ 62 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 63 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 64 65 String cat = ""; //$NON-NLS-1$ 66 String col = ""; //$NON-NLS-1$ 67 String top = ""; //$NON-NLS-1$ 68 69 if (getStyleIndex() != LAT_PERCH) { 70 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 71 top = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 72 setTopMark(true); 73 } 74 if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 75 setTopMark(true); 76 } 77 } 78 79 if (keys.containsKey("seamark:buoy_lateral:colour")) //$NON-NLS-1$ 80 col = keys.get("seamark:buoy_lateral:colour"); //$NON-NLS-1$ 81 else if (keys.containsKey("seamark:beacon_lateral:colour")) //$NON-NLS-1$ 82 col = keys.get("seamark:beacon_lateral:colour"); //$NON-NLS-1$ 83 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 84 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 85 86 if (keys.containsKey("seamark:buoy_lateral:category")) //$NON-NLS-1$ 87 cat = keys.get("seamark:buoy_lateral:category"); //$NON-NLS-1$ 88 else if (keys.containsKey("seamark:beacon_lateral:category")) //$NON-NLS-1$ 89 cat = keys.get("seamark:beacon_lateral:category"); //$NON-NLS-1$ 90 91 if (cat.isEmpty()) { //$NON-NLS-1$ 92 if (col.equals("red")) { //$NON-NLS-1$ 93 setColour(RED); 94 if (top.equals("cylinder")) { //$NON-NLS-1$ 95 setBuoyIndex(PORT_HAND); 96 setRegion(IALA_A); 97 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 98 setBuoyIndex(STARBOARD_HAND); 99 setRegion(IALA_B); 100 } else { 101 if (getRegion() == IALA_A) 102 setBuoyIndex(PORT_HAND); 103 else 104 setBuoyIndex(STARBOARD_HAND); 105 } 106 } else if (col.equals("green")) { //$NON-NLS-1$ 107 setColour(GREEN); 108 if (top.equals("cone, point up")) { //$NON-NLS-1$ 109 setBuoyIndex(STARBOARD_HAND); 110 setRegion(IALA_A); 111 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 112 setBuoyIndex(PORT_HAND); 113 setRegion(IALA_B); 114 } else { 115 if (getRegion() == IALA_A) 116 setBuoyIndex(STARBOARD_HAND); 117 else 118 setBuoyIndex(PORT_HAND); 119 } 120 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 121 setColour(RED_GREEN_RED); 122 if (top.equals("cylinder")) { //$NON-NLS-1$ 123 setBuoyIndex(PREF_PORT_HAND); 124 setRegion(IALA_A); 125 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 126 setBuoyIndex(PREF_STARBOARD_HAND); 127 setRegion(IALA_B); 128 } else { 129 if (getRegion() == IALA_A) 130 setBuoyIndex(PREF_PORT_HAND); 131 else 132 setBuoyIndex(PREF_STARBOARD_HAND); 133 } 134 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 135 setColour(GREEN_RED_GREEN); 136 if (top.equals("cone, point up")) { //$NON-NLS-1$ 137 setBuoyIndex(PREF_STARBOARD_HAND); 138 setRegion(IALA_A); 139 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 140 setBuoyIndex(PREF_PORT_HAND); 141 setRegion(IALA_B); 142 } else { 143 if (getRegion() == IALA_A) 144 setBuoyIndex(PREF_STARBOARD_HAND); 145 else 146 setBuoyIndex(PREF_PORT_HAND); 147 } 148 } 149 } else if (cat.equals("port")) { //$NON-NLS-1$ 150 151 setBuoyIndex(PORT_HAND); 152 153 if (col.equals("red")) { //$NON-NLS-1$ 154 setRegion(IALA_A); 155 setColour(RED); 156 } else if (col.equals("green")) { //$NON-NLS-1$ 157 setRegion(IALA_B); 158 setColour(GREEN); 159 } else { 160 if (getRegion() == IALA_A) 161 setColour(RED); 162 else 163 setColour(GREEN); 164 } 165 } else if (cat.equals("starboard")) { //$NON-NLS-1$ 166 167 setBuoyIndex(STARBOARD_HAND); 168 169 if (col.equals("green")) { //$NON-NLS-1$ 170 setRegion(IALA_A); 171 setColour(GREEN); 172 } else if (col.equals("red")) { //$NON-NLS-1$ 173 setRegion(IALA_B); 174 setColour(RED); 175 } else { 176 if (getRegion() == IALA_A) 177 setColour(GREEN); 178 else 179 setColour(RED); 180 } 181 } else if (cat.equals("preferred_channel_port")) { //$NON-NLS-1$ 182 183 setBuoyIndex(PREF_PORT_HAND); 184 185 if (col.equals("red;green;red")) { //$NON-NLS-1$ 186 setRegion(IALA_A); 187 setColour(RED_GREEN_RED); 188 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 189 setRegion(IALA_B); 190 setColour(GREEN_RED_GREEN); 191 } else { 192 if (getRegion() == IALA_A) 193 setColour(RED_GREEN_RED); 194 else 195 setColour(GREEN_RED_GREEN); 196 } 197 198 } else if (cat.equals("preferred_channel_starboard")) { //$NON-NLS-1$ 199 200 setBuoyIndex(PREF_STARBOARD_HAND); 201 202 if (col.equals("green;red;green")) { //$NON-NLS-1$ 203 setRegion(IALA_A); 204 setColour(GREEN_RED_GREEN); 205 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 206 setRegion(IALA_B); 207 setColour(RED_GREEN_RED); 208 } else { 209 if (getRegion() == IALA_A) 210 setColour(GREEN_RED_GREEN); 211 else 212 setColour(RED_GREEN_RED); 213 } 214 } 215 216 if (keys.containsKey("seamark:buoy_lateral:shape")) { //$NON-NLS-1$ 217 str = keys.get("seamark:buoy_lateral:shape"); //$NON-NLS-1$ 218 219 switch (getBuoyIndex()) { 220 case PORT_HAND: 221 if (str.equals("can")) //$NON-NLS-1$ 222 setStyleIndex(LAT_CAN); 223 else if (str.equals("pillar")) //$NON-NLS-1$ 224 setStyleIndex(LAT_PILLAR); 225 else if (str.equals("spar")) //$NON-NLS-1$ 226 setStyleIndex(LAT_SPAR); 227 break; 228 229 case PREF_PORT_HAND: 230 if (str.equals("can")) //$NON-NLS-1$ 231 setStyleIndex(LAT_CAN); 232 else if (str.equals("pillar")) //$NON-NLS-1$ 233 setStyleIndex(LAT_PILLAR); 234 else if (str.equals("spar")) //$NON-NLS-1$ 235 setStyleIndex(LAT_SPAR); 236 break; 237 238 case STARBOARD_HAND: 239 if (str.equals("conical")) //$NON-NLS-1$ 240 setStyleIndex(LAT_CONE); 241 else if (str.equals("pillar")) //$NON-NLS-1$ 242 setStyleIndex(LAT_PILLAR); 243 else if (str.equals("spar")) //$NON-NLS-1$ 244 setStyleIndex(LAT_SPAR); 245 break; 246 247 case PREF_STARBOARD_HAND: 248 if (str.equals("conical")) //$NON-NLS-1$ 249 setStyleIndex(LAT_CONE); 250 else if (str.equals("pillar")) //$NON-NLS-1$ 251 setStyleIndex(LAT_PILLAR); 252 else if (str.equals("spar")) //$NON-NLS-1$ 253 setStyleIndex(LAT_SPAR); 254 break; 255 } 256 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { //$NON-NLS-1$ 257 str = keys.get("seamark:beacon_lateral:shape"); //$NON-NLS-1$ 258 if (str.equals("tower")) //$NON-NLS-1$ 259 setStyleIndex(LAT_TOWER); 260 else if (str.equals("perch")) //$NON-NLS-1$ 261 setStyleIndex(LAT_PERCH); 262 else 263 setStyleIndex(LAT_BEACON); 264 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 265 && (keys.get("seamark:type").equals("beacon_lateral"))) { //$NON-NLS-1$ //$NON-NLS-2$ 266 setStyleIndex(LAT_BEACON); 267 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 268 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 269 setStyleIndex(LAT_FLOAT); 270 } 271 272 refreshStyles(); 273 refreshLights(); 274 setLightColour(); 275 parseLights(keys); 276 parseFogRadar(keys); 277 278 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 279 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 280 dlg.tfM01Name.setText(getName()); 281 dlg.cM01TopMark.setSelected(hasTopMark()); 282 } 283 284 public void refreshStyles() { 285 int type = getBuoyIndex(); 286 int style = getStyleIndex(); 287 288 dlg.cbM01StyleOfMark.removeAllItems(); 289 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213")); //$NON-NLS-1$ 290 291 switch (type) { 292 case PORT_HAND: 293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 297 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 298 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 300 break; 301 302 case STARBOARD_HAND: 303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 305 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 306 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 307 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 308 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 309 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 310 break; 311 312 case PREF_PORT_HAND: 313 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 314 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 315 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 316 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 317 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 318 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 319 break; 320 321 case PREF_STARBOARD_HAND: 322 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 323 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 324 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 325 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 326 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 327 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 328 break; 329 330 default: 331 } 332 333 if (style >= dlg.cbM01StyleOfMark.getItemCount()) 334 style = 0; 335 setStyleIndex(style); 336 dlg.cbM01StyleOfMark.setSelectedIndex(style); 337 dlg.cbM01StyleOfMark.setVisible(true); 338 dlg.lM01StyleOfMark.setVisible(true); 339 } 340 341 public boolean isValid() { 342 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 343 } 344 345 public void paintSign() { 346 if (dlg.paintlock) 347 return; 348 super.paintSign(); 349 350 dlg.sM01StatusBar.setText(getErrMsg()); 351 352 if (isValid()) { 353 dlg.tfM01Name.setEnabled(true); 354 dlg.tfM01Name.setText(getName()); 355 356 int cat = getBuoyIndex(); 357 boolean region = getRegion(); 358 int style = getStyleIndex(); 359 360 if (style == LAT_PERCH) { 361 dlg.cM01TopMark.setVisible(false); 362 dlg.cM01TopMark.setSelected(false); 363 dlg.cM01Radar.setVisible(false); 364 dlg.cM01Racon.setVisible(false); 365 dlg.cM01Fog.setVisible(false); 366 dlg.cM01Fired.setVisible(false); 367 dlg.cM01Fired.setSelected(false); 368 } else { 369 dlg.cM01TopMark.setEnabled(true); 370 dlg.cM01TopMark.setVisible(true); 371 dlg.cM01Radar.setVisible(true); 372 dlg.cM01Racon.setVisible(true); 373 dlg.cM01Fog.setVisible(true); 374 dlg.cM01Fired.setVisible(true); 375 dlg.cM01Fired.setEnabled(true); 376 dlg.cM01TopMark.setEnabled(true); 377 } 378 dlg.cbM01Colour.setVisible(false); 379 dlg.lM01Colour.setVisible(false); 380 dlg.rbM01Fired1.setVisible(false); 381 dlg.rbM01FiredN.setVisible(false); 382 dlg.lM01Height.setVisible(false); 383 dlg.tfM01Height.setVisible(false); 384 dlg.lM01Range.setVisible(false); 385 dlg.tfM01Range.setVisible(false); 386 387 if (isFired()) { 388 switch (style) { 389 case LAT_BEACON: 390 case LAT_TOWER: 391 dlg.rbM01Fired1.setVisible(true); 392 dlg.rbM01FiredN.setVisible(true); 393 dlg.lM01Height.setVisible(true); 394 dlg.tfM01Height.setVisible(true); 395 dlg.lM01Range.setVisible(true); 396 dlg.tfM01Range.setVisible(true); 397 break; 398 case LAT_FLOAT: 399 dlg.lM01Height.setVisible(true); 400 dlg.tfM01Height.setVisible(true); 401 dlg.lM01Range.setVisible(true); 402 dlg.tfM01Range.setVisible(true); 403 break; 404 default: 405 } 406 } 407 408 String image = "/images/Lateral"; //$NON-NLS-1$ 409 410 switch (getBuoyIndex()) { 411 case PORT_HAND: 412 if (region == IALA_A) 413 switch (style) { 414 case LAT_CAN: 415 image += "_Can_Red"; //$NON-NLS-1$ 416 break; 417 case LAT_PILLAR: 418 image += "_Pillar_Red"; //$NON-NLS-1$ 419 break; 420 case LAT_SPAR: 421 image += "_Spar_Red"; //$NON-NLS-1$ 422 break; 423 case LAT_BEACON: 424 image += "_Beacon_Red"; //$NON-NLS-1$ 425 break; 426 case LAT_TOWER: 427 image += "_Tower_Red"; //$NON-NLS-1$ 428 break; 429 case LAT_FLOAT: 430 image += "_Float_Red"; //$NON-NLS-1$ 431 break; 432 case LAT_PERCH: 433 image += "_Perch_Port"; //$NON-NLS-1$ 434 break; 435 default: 436 } 437 else 438 switch (style) { 439 case LAT_CAN: 440 image += "_Can_Green"; //$NON-NLS-1$ 441 break; 442 case LAT_PILLAR: 443 image += "_Pillar_Green"; //$NON-NLS-1$ 444 break; 445 case LAT_SPAR: 446 image += "_Spar_Green"; //$NON-NLS-1$ 447 break; 448 case LAT_BEACON: 449 image += "_Beacon_Green"; //$NON-NLS-1$ 450 break; 451 case LAT_TOWER: 452 image += "_Tower_Green"; //$NON-NLS-1$ 453 break; 454 case LAT_FLOAT: 455 image += "_Float_Green"; //$NON-NLS-1$ 456 break; 457 case LAT_PERCH: 458 image += "_Perch_Port"; //$NON-NLS-1$ 459 break; 460 default: 461 } 462 break; 463 464 case STARBOARD_HAND: 465 if (region == IALA_A) 466 switch (style) { 467 case LAT_CONE: 468 image += "_Cone_Green"; //$NON-NLS-1$ 469 break; 470 case LAT_PILLAR: 471 image += "_Pillar_Green"; //$NON-NLS-1$ 472 break; 473 case LAT_SPAR: 474 image += "_Spar_Green"; //$NON-NLS-1$ 475 break; 476 case LAT_BEACON: 477 image += "_Beacon_Green"; //$NON-NLS-1$ 478 break; 479 case LAT_TOWER: 480 image += "_Tower_Green"; //$NON-NLS-1$ 481 break; 482 case LAT_FLOAT: 483 image += "_Float_Green"; //$NON-NLS-1$ 484 break; 485 case LAT_PERCH: 486 image += "_Perch_Starboard"; //$NON-NLS-1$ 487 break; 488 default: 489 } 490 else 491 switch (style) { 492 case LAT_CONE: 493 image += "_Cone_Red"; //$NON-NLS-1$ 494 break; 495 case LAT_PILLAR: 496 image += "_Pillar_Red"; //$NON-NLS-1$ 497 break; 498 case LAT_SPAR: 499 image += "_Spar_Red"; //$NON-NLS-1$ 500 break; 501 case LAT_BEACON: 502 image += "_Beacon_Red"; //$NON-NLS-1$ 503 break; 504 case LAT_TOWER: 505 image += "_Tower_Red"; //$NON-NLS-1$ 506 break; 507 case LAT_FLOAT: 508 image += "_Float_Red"; //$NON-NLS-1$ 509 break; 510 case LAT_PERCH: 511 image += "_Perch_Starboard"; //$NON-NLS-1$ 512 break; 513 default: 514 } 515 break; 516 517 case PREF_PORT_HAND: 518 if (region == IALA_A) 519 switch (style) { 520 case LAT_CAN: 521 image += "_Can_Red_Green_Red"; //$NON-NLS-1$ 522 break; 523 case LAT_PILLAR: 524 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 525 break; 526 case LAT_SPAR: 527 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 528 break; 529 case LAT_BEACON: 530 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 531 break; 532 case LAT_TOWER: 533 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 534 break; 535 case LAT_FLOAT: 536 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 537 break; 538 default: 539 } 540 else 541 switch (style) { 542 case LAT_CAN: 543 image += "_Can_Green_Red_Green"; //$NON-NLS-1$ 544 break; 545 case LAT_PILLAR: 546 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 547 break; 548 case LAT_SPAR: 549 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 550 break; 551 case LAT_BEACON: 552 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 553 break; 554 case LAT_TOWER: 555 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 556 break; 557 case LAT_FLOAT: 558 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 559 break; 560 default: 561 } 562 break; 563 564 case PREF_STARBOARD_HAND: 565 if (region == IALA_A) 566 switch (style) { 567 case LAT_CONE: 568 image += "_Cone_Green_Red_Green"; //$NON-NLS-1$ 569 break; 570 case LAT_PILLAR: 571 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 572 break; 573 case LAT_SPAR: 574 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 575 break; 576 case LAT_BEACON: 577 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 578 break; 579 case LAT_TOWER: 580 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 581 break; 582 case LAT_FLOAT: 583 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 584 break; 585 default: 586 } 587 else 588 switch (style) { 589 case LAT_CONE: 590 image += "_Cone_Red_Green_Red"; //$NON-NLS-1$ 591 break; 592 case LAT_PILLAR: 593 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 594 break; 595 case LAT_SPAR: 596 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 597 break; 598 case LAT_BEACON: 599 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 600 break; 601 case LAT_TOWER: 602 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 603 break; 604 case LAT_FLOAT: 605 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 606 break; 607 default: 608 } 609 break; 610 611 default: 612 } 613 614 if (!image.equals("/images/Lateral")) { //$NON-NLS-1$ 615 616 image += ".png"; //$NON-NLS-1$ 617 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 618 619 if (hasTopMark()) { 620 image = ""; 621 switch (getBuoyIndex()) { 622 case PORT_HAND: 623 case PREF_PORT_HAND: 624 if (region == IALA_A) 625 switch (style) { 626 case LAT_CAN: 627 image = "/images/Top_Can_Red_Buoy_Small.png"; //$NON-NLS-1$ 628 break; 629 case LAT_PILLAR: 630 case LAT_SPAR: 631 image = "/images/Top_Can_Red_Buoy.png"; //$NON-NLS-1$ 632 break; 633 case LAT_BEACON: 634 case LAT_TOWER: 635 image = "/images/Top_Can_Red_Beacon.png"; //$NON-NLS-1$ 636 break; 637 case LAT_FLOAT: 638 image = "/images/Top_Can_Red_Float.png"; //$NON-NLS-1$ 639 break; 640 } 641 else 642 switch (style) { 643 case LAT_CAN: 644 image = "/images/Top_Can_Green_Buoy_Small.png"; //$NON-NLS-1$ 645 break; 646 case LAT_PILLAR: 647 case LAT_SPAR: 648 image = "/images/Top_Can_Green_Buoy.png"; //$NON-NLS-1$ 649 break; 650 case LAT_BEACON: 651 case LAT_TOWER: 652 image = "/images/Top_Can_Green_Beacon.png"; //$NON-NLS-1$ 653 break; 654 case LAT_FLOAT: 655 image = "/images/Top_Can_Green_Float.png"; //$NON-NLS-1$ 656 break; 657 } 658 break; 659 660 case STARBOARD_HAND: 661 case PREF_STARBOARD_HAND: 662 if (region == IALA_A) 663 switch (style) { 664 case LAT_CONE: 665 image = "/images/Top_Cone_Green_Buoy_Small.png"; //$NON-NLS-1$ 666 break; 667 case LAT_PILLAR: 668 case LAT_SPAR: 669 image = "/images/Top_Cone_Green_Buoy.png"; //$NON-NLS-1$ 670 break; 671 case LAT_BEACON: 672 case LAT_TOWER: 673 image = "/images/Top_Cone_Green_Beacon.png"; //$NON-NLS-1$ 674 break; 675 case LAT_FLOAT: 676 image = "/images/Top_Cone_Green_Float.png"; //$NON-NLS-1$ 677 break; 678 } 679 else 680 switch (style) { 681 case LAT_CONE: 682 image = "/images/Top_Cone_Red_Buoy_Small.png"; //$NON-NLS-1$ 683 break; 684 case LAT_PILLAR: 685 case LAT_SPAR: 686 image = "/images/Top_Cone_Red_Buoy.png"; //$NON-NLS-1$ 687 break; 688 case LAT_BEACON: 689 case LAT_TOWER: 690 image = "/images/Top_Cone_Red_Beacon.png"; //$NON-NLS-1$ 691 break; 692 case LAT_FLOAT: 693 image = "/images/Top_Cone_Red_Float.png"; //$NON-NLS-1$ 694 break; 695 } 696 break; 697 } 698 if (!image.isEmpty()) 699 dlg.lM06Icon.setIcon(new ImageIcon(getClass().getResource(image))); 700 } 701 if (hasRadar()) { 702 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 703 "/images/Radar_Reflector.png"))); //$NON-NLS-1$ 704 } 705 706 } else 707 dlg.lM01Icon.setIcon(null); 708 } 709 } 710 711 public void saveSign() { 712 Node node = getNode(); 713 714 if (node == null) { 715 return; 716 } 717 718 int cat = getBuoyIndex(); 719 String shape = ""; //$NON-NLS-1$ 720 String colour = ""; //$NON-NLS-1$ 721 722 switch (cat) { 723 724 case PORT_HAND: 725 switch (getStyleIndex()) { 726 case LAT_CAN: 727 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 728 Main.main.undoRedo.add(new ChangePropertyCommand(node, 729 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 730 break; 731 case LAT_PILLAR: 732 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 733 Main.main.undoRedo.add(new ChangePropertyCommand(node, 734 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 735 break; 736 case LAT_SPAR: 737 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 738 Main.main.undoRedo.add(new ChangePropertyCommand(node, 739 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 740 break; 741 case LAT_BEACON: 742 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 743 break; 744 case LAT_TOWER: 745 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 746 Main.main.undoRedo.add(new ChangePropertyCommand(node, 747 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 748 break; 749 case LAT_FLOAT: 750 super.saveSign("light_float"); //$NON-NLS-1$ 751 break; 752 case LAT_PERCH: 753 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 754 Main.main.undoRedo.add(new ChangePropertyCommand(node, 755 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 756 break; 757 default: 758 } 759 switch (getStyleIndex()) { 760 case LAT_CAN: 761 case LAT_PILLAR: 762 case LAT_SPAR: 763 Main.main.undoRedo.add(new ChangePropertyCommand(node, 764 "seamark:buoy_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 765 if (getRegion() == IALA_A) { 766 Main.main.undoRedo.add(new ChangePropertyCommand(node, 767 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 768 colour = "red"; //$NON-NLS-1$ 769 } else { 770 Main.main.undoRedo.add(new ChangePropertyCommand(node, 771 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 772 colour = "green"; //$NON-NLS-1$ 773 } 774 break; 775 case LAT_PERCH: 776 Main.main.undoRedo.add(new ChangePropertyCommand(node, 777 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 778 break; 779 case LAT_BEACON: 780 case LAT_TOWER: 781 Main.main.undoRedo.add(new ChangePropertyCommand(node, 782 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 783 if (getRegion() == IALA_A) { 784 Main.main.undoRedo.add(new ChangePropertyCommand(node, 785 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 786 colour = "red"; //$NON-NLS-1$ 787 } else { 788 Main.main.undoRedo.add(new ChangePropertyCommand(node, 789 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 790 colour = "green"; //$NON-NLS-1$ 791 } 792 break; 793 case LAT_FLOAT: 794 if (getRegion() == IALA_A) { 795 Main.main.undoRedo.add(new ChangePropertyCommand(node, 796 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 797 colour = "red"; //$NON-NLS-1$ 798 } else { 799 Main.main.undoRedo.add(new ChangePropertyCommand(node, 800 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 801 colour = "green"; //$NON-NLS-1$ 802 } 803 break; 804 } 805 shape = "cylinder"; //$NON-NLS-1$ 806 break; 807 808 case PREF_PORT_HAND: 809 switch (getStyleIndex()) { 810 case LAT_CAN: 811 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 812 Main.main.undoRedo.add(new ChangePropertyCommand(node, 813 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 814 break; 815 case LAT_PILLAR: 816 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 817 Main.main.undoRedo.add(new ChangePropertyCommand(node, 818 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 819 break; 820 case LAT_SPAR: 821 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 822 Main.main.undoRedo.add(new ChangePropertyCommand(node, 823 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 824 break; 825 case LAT_BEACON: 826 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 827 break; 828 case LAT_TOWER: 829 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 830 Main.main.undoRedo.add(new ChangePropertyCommand(node, 831 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 832 break; 833 case LAT_FLOAT: 834 super.saveSign("light_float"); //$NON-NLS-1$ 835 break; 836 default: 837 } 838 switch (getStyleIndex()) { 839 case LAT_CAN: 840 case LAT_PILLAR: 841 case LAT_SPAR: 842 Main.main.undoRedo.add(new ChangePropertyCommand(node, 843 "seamark:buoy_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 844 Main.main.undoRedo.add(new ChangePropertyCommand(node, 845 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 846 if (getRegion() == IALA_A) { 847 Main.main.undoRedo.add(new ChangePropertyCommand(node, 848 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 849 colour = "red"; //$NON-NLS-1$ 850 } else { 851 Main.main.undoRedo.add(new ChangePropertyCommand(node, 852 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 853 colour = "green"; //$NON-NLS-1$ 854 } 855 break; 856 case LAT_BEACON: 857 case LAT_TOWER: 858 Main.main.undoRedo.add(new ChangePropertyCommand(node, 859 "seamark:beacon_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 860 Main.main.undoRedo.add(new ChangePropertyCommand(node, 861 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 862 if (getRegion() == IALA_A) { 863 Main.main.undoRedo.add(new ChangePropertyCommand(node, 864 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 865 colour = "red"; //$NON-NLS-1$ 866 } else { 867 Main.main.undoRedo.add(new ChangePropertyCommand(node, 868 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 869 colour = "green"; //$NON-NLS-1$ 870 } 871 break; 872 case LAT_FLOAT: 873 Main.main.undoRedo.add(new ChangePropertyCommand(node, 874 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 875 if (getRegion() == IALA_A) { 876 Main.main.undoRedo.add(new ChangePropertyCommand(node, 877 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 878 colour = "red"; //$NON-NLS-1$ 879 } else { 880 Main.main.undoRedo.add(new ChangePropertyCommand(node, 881 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 882 colour = "green"; //$NON-NLS-1$ 883 } 884 break; 885 } 886 shape = "cylinder"; //$NON-NLS-1$ 887 break; 888 889 case STARBOARD_HAND: 890 switch (getStyleIndex()) { 891 case LAT_CONE: 892 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 893 Main.main.undoRedo.add(new ChangePropertyCommand(node, 894 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 895 break; 896 case LAT_PILLAR: 897 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 898 Main.main.undoRedo.add(new ChangePropertyCommand(node, 899 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 900 break; 901 case LAT_SPAR: 902 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 903 Main.main.undoRedo.add(new ChangePropertyCommand(node, 904 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 905 break; 906 case LAT_BEACON: 907 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 908 Main.main.undoRedo.add(new ChangePropertyCommand(node, 909 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 910 break; 911 case LAT_TOWER: 912 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 913 Main.main.undoRedo.add(new ChangePropertyCommand(node, 914 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 915 break; 916 case LAT_FLOAT: 917 super.saveSign("light_float"); //$NON-NLS-1$ 918 break; 919 case LAT_PERCH: 920 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 921 Main.main.undoRedo.add(new ChangePropertyCommand(node, 922 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 923 break; 924 default: 925 } 926 switch (getStyleIndex()) { 927 case LAT_CAN: 928 case LAT_PILLAR: 929 case LAT_SPAR: 930 Main.main.undoRedo.add(new ChangePropertyCommand(node, 931 "seamark:buoy_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 932 if (getRegion() == IALA_A) { 933 Main.main.undoRedo.add(new ChangePropertyCommand(node, 934 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 935 colour = "green"; //$NON-NLS-1$ 936 } else { 937 Main.main.undoRedo.add(new ChangePropertyCommand(node, 938 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 939 colour = "red"; //$NON-NLS-1$ 940 } 941 break; 942 case LAT_BEACON: 943 case LAT_TOWER: 944 Main.main.undoRedo.add(new ChangePropertyCommand(node, 945 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 946 if (getRegion() == IALA_A) { 947 Main.main.undoRedo.add(new ChangePropertyCommand(node, 948 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 949 colour = "green"; //$NON-NLS-1$ 950 } else { 951 Main.main.undoRedo.add(new ChangePropertyCommand(node, 952 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 953 colour = "red"; //$NON-NLS-1$ 954 } 955 break; 956 case LAT_FLOAT: 957 if (getRegion() == IALA_A) { 958 Main.main.undoRedo.add(new ChangePropertyCommand(node, 959 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 960 colour = "green"; //$NON-NLS-1$ 961 } else { 962 Main.main.undoRedo.add(new ChangePropertyCommand(node, 963 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 964 colour = "red"; //$NON-NLS-1$ 965 } 966 break; 967 case LAT_PERCH: 968 Main.main.undoRedo.add(new ChangePropertyCommand(node, 969 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 970 break; 971 } 972 shape = "cone, point up"; //$NON-NLS-1$ 973 break; 974 975 case PREF_STARBOARD_HAND: 976 switch (getStyleIndex()) { 977 case LAT_CONE: 978 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 979 Main.main.undoRedo.add(new ChangePropertyCommand(node, 980 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 981 break; 982 case LAT_PILLAR: 983 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 984 Main.main.undoRedo.add(new ChangePropertyCommand(node, 985 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 986 break; 987 case LAT_SPAR: 988 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 989 Main.main.undoRedo.add(new ChangePropertyCommand(node, 990 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 991 break; 992 case LAT_BEACON: 993 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 994 Main.main.undoRedo.add(new ChangePropertyCommand(node, 995 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 996 break; 997 case LAT_TOWER: 998 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 999 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1000 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 1001 break; 1002 case LAT_FLOAT: 1003 super.saveSign("light_float"); //$NON-NLS-1$ 1004 break; 1005 default: 1006 } 1007 switch (getStyleIndex()) { 1008 case LAT_CAN: 1009 case LAT_PILLAR: 1010 case LAT_SPAR: 1011 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1012 "seamark:buoy_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 1013 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1014 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 1015 if (getRegion() == IALA_A) { 1016 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1017 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 1018 colour = "green"; //$NON-NLS-1$ 1019 } else { 1020 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1021 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 1022 colour = "red"; //$NON-NLS-1$ 1023 } 1024 break; 1025 case LAT_BEACON: 1026 case LAT_TOWER: 1027 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1028 "seamark:beacon_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 1029 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1030 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 1031 if (getRegion() == IALA_A) { 1032 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1033 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 1034 colour = "green"; //$NON-NLS-1$ 1035 } else { 1036 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1037 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 1038 colour = "red"; //$NON-NLS-1$ 1039 } 1040 break; 1041 case LAT_FLOAT: 1042 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1043 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 1044 if (getRegion() == IALA_A) { 1045 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1046 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 1047 colour = "green"; //$NON-NLS-1$ 1048 } else { 1049 Main.main.undoRedo.add(new ChangePropertyCommand(node, 1050 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 1051 colour = "red"; //$NON-NLS-1$ 1052 } 1053 break; 1054 } 1055 shape = "cone, point up"; //$NON-NLS-1$ 1056 break; 1057 1058 default: 1059 } 1060 saveTopMarkData(shape, colour); 1061 saveLightData(); 1062 saveRadarFogData(); 1063 1064 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 1065 } 1066 1067 public void setLightColour() { 1068 if (getRegion() == IALA_A) { 1069 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 1070 super.setLightColour("R"); //$NON-NLS-1$ 1071 else 1072 super.setLightColour("G"); //$NON-NLS-1$ 1073 } else { 1074 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 1075 super.setLightColour("G"); //$NON-NLS-1$ 1076 else 1077 super.setLightColour("R"); //$NON-NLS-1$ 1078 } 1079 } 1080 1081 public void setLightColour(String str) { 1082 int cat = getBuoyIndex(); 1083 1084 if (str == null) { 1085 return; 1086 } 1087 1088 switch (cat) { 1089 case PORT_HAND: 1090 case PREF_PORT_HAND: 1091 if (getRegion() == IALA_A) { 1092 if (str.equals("red")) { //$NON-NLS-1$ 1093 setFired(true); 1094 super.setLightColour("R"); //$NON-NLS-1$ 1095 } else { 1096 super.setLightColour(""); //$NON-NLS-1$ 1097 } 1098 } else { 1099 if (str.equals("green")) { //$NON-NLS-1$ 1100 setFired(true); 1101 super.setLightColour("G"); //$NON-NLS-1$ 1102 } else { 1103 super.setLightColour(""); //$NON-NLS-1$ 1104 } 1105 } 1106 break; 1107 1108 case STARBOARD_HAND: 1109 case PREF_STARBOARD_HAND: 1110 if (getRegion() == IALA_A) { 1111 if (str.equals("green")) { //$NON-NLS-1$ 1112 setFired(true); 1113 super.setLightColour("G"); //$NON-NLS-1$ 1114 } else { 1115 super.setLightColour(""); //$NON-NLS-1$ 1116 } 1117 } else { 1118 if (str.equals("red")) { //$NON-NLS-1$ 1119 setFired(true); 1120 super.setLightColour("R"); //$NON-NLS-1$ 1121 } else { 1122 super.setLightColour(""); //$NON-NLS-1$ 1123 } 1124 } 1125 break; 1126 default: 1127 } 1128 } 1052 1129 1053 1130 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java
r23193 r23224 17 17 18 18 public class BuoyNota extends Buoy { 19 20 19 public BuoyNota(SmpDialogAction dia, Node node) { 20 super(dia); 21 21 22 23 24 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 25 26 26 resetMask(); 27 27 28 28 dlg.cbM01TypeOfMark.setSelectedIndex(LIGHT); 29 29 30 31 32 30 dlg.cbM01CatOfMark.setEnabled(true); 31 dlg.cbM01CatOfMark.setVisible(true); 32 dlg.lM01CatOfMark.setVisible(true); 33 33 34 35 36 37 38 39 34 dlg.cbM01CatOfMark.removeAllItems(); 35 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 36 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.206")); //$NON-NLS-1$ 37 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.207")); //$NON-NLS-1$ 38 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.208")); //$NON-NLS-1$ 39 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.209")); //$NON-NLS-1$ 40 40 41 41 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 42 42 43 44 43 if (keys.containsKey("name")) //$NON-NLS-1$ 44 setName(keys.get("name")); //$NON-NLS-1$ 45 45 46 47 46 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 47 setName(keys.get("seamark:name")); //$NON-NLS-1$ 48 48 49 50 51 52 53 54 55 56 49 if (keys.containsKey("seamark:landmark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:landmark:name")); //$NON-NLS-1$ 51 else if (keys.containsKey("seamark:light_major:name")) //$NON-NLS-1$ 52 setName(keys.get("seamark:light_major:name")); //$NON-NLS-1$ 53 else if (keys.containsKey("seamark:light_minor:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:light_minor:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:light_vessel:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:light_vessel:name")); //$NON-NLS-1$ 57 57 58 59 60 61 62 63 64 65 66 67 68 58 if (keys.containsKey("seamark:type")) { //$NON-NLS-1$ 59 String type = keys.get("seamark:type"); //$NON-NLS-1$ 60 if (type.equals("landmark")) 61 setBuoyIndex(LIGHT_HOUSE); 62 else if (type.equals("light_major")) 63 setBuoyIndex(LIGHT_MAJOR); 64 else if (type.equals("light_minor")) 65 setBuoyIndex(LIGHT_MINOR); 66 else if (type.equals("light_vessel")) 67 setBuoyIndex(LIGHT_VESSEL); 68 } 69 69 70 71 72 73 74 70 refreshLights(); 71 parseLights(keys); 72 parseFogRadar(keys); 73 setTopMark(false); 74 setFired(true); 75 75 76 77 78 79 80 76 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 77 dlg.tfM01Name.setText(getName()); 78 dlg.cM01Fired.setEnabled(false); 79 dlg.cM01Fired.setSelected(true); 80 } 81 81 82 83 84 82 public boolean isValid() { 83 return (getBuoyIndex() > 0); 84 } 85 85 86 87 88 89 86 public void paintSign() { 87 if (dlg.paintlock) 88 return; 89 super.paintSign(); 90 90 91 91 dlg.sM01StatusBar.setText(getErrMsg()); 92 92 93 94 95 96 93 if (isValid()) { 94 dlg.cM01Radar.setVisible(true); 95 dlg.cM01Racon.setVisible(true); 96 dlg.cM01Fog.setVisible(true); 97 97 98 99 100 101 102 103 98 dlg.rbM01Fired1.setVisible(true); 99 dlg.rbM01FiredN.setVisible(true); 100 dlg.lM01Height.setVisible(true); 101 dlg.tfM01Height.setVisible(true); 102 dlg.lM01Range.setVisible(true); 103 dlg.tfM01Range.setVisible(true); 104 104 105 106 107 108 109 105 switch (getBuoyIndex()) { 106 case SeaMark.LIGHT_HOUSE: 107 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 108 "/images/Light_House.png"))); //$NON-NLS-1$ 109 break; 110 110 111 112 113 114 111 case SeaMark.LIGHT_MAJOR: 112 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 113 "/images/Light_Major.png"))); //$NON-NLS-1$ 114 break; 115 115 116 117 118 119 116 case SeaMark.LIGHT_MINOR: 117 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 118 "/images/Light_Minor.png"))); //$NON-NLS-1$ 119 break; 120 120 121 122 123 124 121 case SeaMark.LIGHT_VESSEL: 122 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 123 "/images/Major_Float.png"))); //$NON-NLS-1$ 124 break; 125 125 126 127 128 129 126 default: 127 } 128 } 129 } 130 130 131 132 131 public void saveSign() { 132 Node node = getNode(); 133 133 134 135 136 134 if (node == null) { 135 return; 136 } 137 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 138 switch (getBuoyIndex()) { 139 case LIGHT_HOUSE: 140 super.saveSign("landmark"); //$NON-NLS-1$ 141 break; 142 case LIGHT_MAJOR: 143 super.saveSign("light_major"); //$NON-NLS-1$ 144 break; 145 case LIGHT_MINOR: 146 super.saveSign("light_minor"); //$NON-NLS-1$ 147 break; 148 case LIGHT_VESSEL: 149 super.saveSign("light_vessel"); //$NON-NLS-1$ 150 break; 151 default: 152 } 153 saveLightData(); //$NON-NLS-1$ 154 saveRadarFogData(); 155 } 156 156 157 158 157 public void setLightColour() { 158 } 159 159 160 160 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java
r23223 r23224 17 17 18 18 public class BuoySaw extends Buoy { 19 public BuoySaw(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(SAFE_WATER); 42 setColour(SeaMark.RED_WHITE); 43 setLightColour("W"); //$NON-NLS-1$ 44 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 45 46 if (keys.containsKey("name")) //$NON-NLS-1$ 47 setName(keys.get("name")); //$NON-NLS-1$ 48 49 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:name")); //$NON-NLS-1$ 51 52 if (keys.containsKey("seamark:buoy_safe_water:name")) //$NON-NLS-1$ 53 setName(keys.get("seamark:buoy_safe_water:name")); //$NON-NLS-1$ 54 else if (keys.containsKey("seamark:beacon_safe_water:name")) //$NON-NLS-1$ 55 setName(keys.get("seamark:beacon_safe_water:name")); //$NON-NLS-1$ 56 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_safe_water:shape")) { //$NON-NLS-1$ 60 str = keys.get("seamark:buoy_safe_water:shape"); //$NON-NLS-1$ 61 62 if (str.equals("pillar")) //$NON-NLS-1$ 63 setStyleIndex(SAFE_PILLAR); 64 else if (str.equals("spar")) //$NON-NLS-1$ 65 setStyleIndex(SAFE_SPAR); 66 else if (str.equals("sphere")) //$NON-NLS-1$ 67 setStyleIndex(SAFE_SPHERE); 68 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 69 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 70 setStyleIndex(SAFE_FLOAT); 71 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 72 && (keys.get("seamark:type").equals("beacon_safe_water"))) { //$NON-NLS-1$ //$NON-NLS-2$ 73 setStyleIndex(SAFE_BEACON); 74 } 75 76 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 77 setStyleIndex(0); 78 79 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 80 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 81 setTopMark(true); 82 } 83 84 refreshLights(); 85 parseLights(keys); 86 parseFogRadar(keys); 87 88 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 89 dlg.tfM01Name.setText(getName()); 90 dlg.cM01TopMark.setSelected(hasTopMark()); 91 } 92 93 public void refreshLights() { 94 dlg.cbM01Kennung.removeAllItems(); 95 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 96 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 97 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 98 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 99 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 100 dlg.cbM01Kennung.setSelectedIndex(0); 101 } 102 103 public boolean isValid() { 104 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 105 } 106 107 public void paintSign() { 108 if (dlg.paintlock) 109 return; 110 super.paintSign(); 111 112 dlg.sM01StatusBar.setText(getErrMsg()); 113 114 if (isValid()) { 115 dlg.tfM01Name.setEnabled(true); 116 dlg.tfM01Name.setText(getName()); 117 dlg.cM01TopMark.setEnabled(true); 118 dlg.cM01TopMark.setVisible(true); 119 dlg.cM01Radar.setVisible(true); 120 dlg.cM01Racon.setVisible(true); 121 dlg.cM01Fog.setVisible(true); 122 dlg.cM01Fired.setVisible(true); 123 dlg.cM01Fired.setEnabled(true); 124 dlg.cbM01Colour.setVisible(false); 125 dlg.lM01Colour.setVisible(false); 126 dlg.rbM01Fired1.setVisible(false); 127 dlg.rbM01FiredN.setVisible(false); 128 dlg.lM01Height.setVisible(false); 129 dlg.tfM01Height.setVisible(false); 130 dlg.lM01Range.setVisible(false); 131 dlg.tfM01Range.setVisible(false); 132 133 if (isFired()) { 134 switch (getStyleIndex()) { 135 case SPEC_FLOAT: 136 dlg.lM01Height.setVisible(true); 137 dlg.tfM01Height.setVisible(true); 138 dlg.lM01Range.setVisible(true); 139 dlg.tfM01Range.setVisible(true); 140 break; 141 case SPEC_BEACON: 142 case SPEC_TOWER: 143 dlg.rbM01Fired1.setVisible(true); 144 dlg.rbM01FiredN.setVisible(true); 145 dlg.lM01Height.setVisible(true); 146 dlg.tfM01Height.setVisible(true); 147 dlg.lM01Range.setVisible(true); 148 dlg.tfM01Range.setVisible(true); 149 break; 150 default: 151 } 152 } 153 154 String image = "/images/Safe_Water"; //$NON-NLS-1$ 155 156 switch (getStyleIndex()) { 157 case SAFE_PILLAR: 158 image += "_Pillar"; //$NON-NLS-1$ 159 break; 160 case SAFE_SPAR: 161 image += "_Spar"; //$NON-NLS-1$ 162 break; 163 case SAFE_SPHERE: 164 image += "_Sphere"; //$NON-NLS-1$ 165 break; 166 case SAFE_BEACON: 167 image += "_Beacon"; //$NON-NLS-1$ 168 break; 169 case SAFE_FLOAT: 170 image += "_Float"; //$NON-NLS-1$ 171 break; 172 default: 173 } 174 175 if (!image.equals("/images/Safe_Water")) { //$NON-NLS-1$ 176 // if (hasTopMark()) 177 // image += "_Sphere"; //$NON-NLS-1$ 178 image += ".png"; //$NON-NLS-1$ 179 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 180 } else 181 dlg.lM01Icon.setIcon(null); 182 } 183 } 184 185 public void saveSign() { 186 Node node = getNode(); 187 188 if (node == null) { 189 return; 190 } 191 192 switch (getStyleIndex()) { 193 case SAFE_PILLAR: 194 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 195 Main.main.undoRedo.add(new ChangePropertyCommand(node, 196 "seamark:buoy_safe_water:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 197 break; 198 case SAFE_SPAR: 199 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 200 Main.main.undoRedo.add(new ChangePropertyCommand(node, 201 "seamark:buoy_safe_water:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 202 break; 203 case SAFE_SPHERE: 204 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 205 Main.main.undoRedo.add(new ChangePropertyCommand(node, 206 "seamark:buoy_safe_water:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 207 break; 208 case SAFE_BEACON: 209 super.saveSign("beacon_safe_water"); //$NON-NLS-1$ 210 break; 211 case SAFE_FLOAT: 212 super.saveSign("light_float"); //$NON-NLS-1$ 213 break; 214 default: 215 } 216 217 switch (getStyleIndex()) { 218 case SAFE_PILLAR: 219 case SAFE_SPAR: 220 case SAFE_SPHERE: 221 Main.main.undoRedo.add(new ChangePropertyCommand(node, 222 "seamark:buoy_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 223 Main.main.undoRedo.add(new ChangePropertyCommand(node, 224 "seamark:buoy_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 225 break; 226 case SAFE_BEACON: 227 Main.main.undoRedo.add(new ChangePropertyCommand(node, 228 "seamark:beacon_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:beacon_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 231 break; 232 case SAFE_FLOAT: 233 Main.main.undoRedo.add(new ChangePropertyCommand(node, 234 "seamark:light_float:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 235 Main.main.undoRedo.add(new ChangePropertyCommand(node, 236 "seamark:light_float:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 237 break; 238 default: 239 } 240 saveTopMarkData("sphere", "red"); //$NON-NLS-1$ //$NON-NLS-2$ 241 saveLightData(); //$NON-NLS-1$ 242 saveRadarFogData(); 243 } 244 245 public void setLightColour() { 246 super.setLightColour("W"); //$NON-NLS-1$ 247 } 19 public BuoySaw(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(SAFE_WATER); 42 setColour(SeaMark.RED_WHITE); 43 setLightColour("W"); //$NON-NLS-1$ 44 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 45 46 if (keys.containsKey("name")) //$NON-NLS-1$ 47 setName(keys.get("name")); //$NON-NLS-1$ 48 49 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:name")); //$NON-NLS-1$ 51 52 if (keys.containsKey("seamark:buoy_safe_water:name")) //$NON-NLS-1$ 53 setName(keys.get("seamark:buoy_safe_water:name")); //$NON-NLS-1$ 54 else if (keys.containsKey("seamark:beacon_safe_water:name")) //$NON-NLS-1$ 55 setName(keys.get("seamark:beacon_safe_water:name")); //$NON-NLS-1$ 56 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_safe_water:shape")) { //$NON-NLS-1$ 60 str = keys.get("seamark:buoy_safe_water:shape"); //$NON-NLS-1$ 61 62 if (str.equals("pillar")) //$NON-NLS-1$ 63 setStyleIndex(SAFE_PILLAR); 64 else if (str.equals("spar")) //$NON-NLS-1$ 65 setStyleIndex(SAFE_SPAR); 66 else if (str.equals("sphere")) //$NON-NLS-1$ 67 setStyleIndex(SAFE_SPHERE); 68 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 69 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 70 setStyleIndex(SAFE_FLOAT); 71 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 72 && (keys.get("seamark:type").equals("beacon_safe_water"))) { //$NON-NLS-1$ //$NON-NLS-2$ 73 setStyleIndex(SAFE_BEACON); 74 } 75 76 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 77 setStyleIndex(0); 78 79 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 80 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 81 setTopMark(true); 82 } 83 84 refreshLights(); 85 parseLights(keys); 86 parseFogRadar(keys); 87 88 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 89 dlg.tfM01Name.setText(getName()); 90 dlg.cM01TopMark.setSelected(hasTopMark()); 91 } 92 93 public void refreshLights() { 94 dlg.cbM01Kennung.removeAllItems(); 95 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 96 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 97 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 98 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 99 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 100 dlg.cbM01Kennung.setSelectedIndex(0); 101 } 102 103 public boolean isValid() { 104 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 105 } 106 107 public void paintSign() { 108 if (dlg.paintlock) 109 return; 110 super.paintSign(); 111 112 dlg.sM01StatusBar.setText(getErrMsg()); 113 114 if (isValid()) { 115 dlg.tfM01Name.setEnabled(true); 116 dlg.tfM01Name.setText(getName()); 117 dlg.cM01TopMark.setEnabled(true); 118 dlg.cM01TopMark.setVisible(true); 119 dlg.cM01Radar.setVisible(true); 120 dlg.cM01Racon.setVisible(true); 121 dlg.cM01Fog.setVisible(true); 122 dlg.cM01Fired.setVisible(true); 123 dlg.cM01Fired.setEnabled(true); 124 dlg.cbM01Colour.setVisible(false); 125 dlg.lM01Colour.setVisible(false); 126 dlg.rbM01Fired1.setVisible(false); 127 dlg.rbM01FiredN.setVisible(false); 128 dlg.lM01Height.setVisible(false); 129 dlg.tfM01Height.setVisible(false); 130 dlg.lM01Range.setVisible(false); 131 dlg.tfM01Range.setVisible(false); 132 133 if (isFired()) { 134 switch (getStyleIndex()) { 135 case SPEC_FLOAT: 136 dlg.lM01Height.setVisible(true); 137 dlg.tfM01Height.setVisible(true); 138 dlg.lM01Range.setVisible(true); 139 dlg.tfM01Range.setVisible(true); 140 break; 141 case SPEC_BEACON: 142 case SPEC_TOWER: 143 dlg.rbM01Fired1.setVisible(true); 144 dlg.rbM01FiredN.setVisible(true); 145 dlg.lM01Height.setVisible(true); 146 dlg.tfM01Height.setVisible(true); 147 dlg.lM01Range.setVisible(true); 148 dlg.tfM01Range.setVisible(true); 149 break; 150 default: 151 } 152 } 153 154 String image = "/images/Safe_Water"; //$NON-NLS-1$ 155 156 switch (getStyleIndex()) { 157 case SAFE_PILLAR: 158 image += "_Pillar"; //$NON-NLS-1$ 159 break; 160 case SAFE_SPAR: 161 image += "_Spar"; //$NON-NLS-1$ 162 break; 163 case SAFE_SPHERE: 164 image += "_Sphere"; //$NON-NLS-1$ 165 break; 166 case SAFE_BEACON: 167 image += "_Beacon"; //$NON-NLS-1$ 168 break; 169 case SAFE_FLOAT: 170 image += "_Float"; //$NON-NLS-1$ 171 break; 172 default: 173 } 174 175 if (!image.equals("/images/Safe_Water")) { //$NON-NLS-1$ 176 image += ".png"; //$NON-NLS-1$ 177 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 178 if (hasTopMark()) { 179 image = ""; 180 switch (getStyleIndex()) { 181 case SAFE_PILLAR: 182 case SAFE_SPAR: 183 image = "/images/Top_Sphere_Red_Buoy.png"; //$NON-NLS-1$ 184 break; 185 case SAFE_SPHERE: 186 image = "/images/Top_Sphere_Red_Buoy_Small.png"; //$NON-NLS-1$ 187 break; 188 case SAFE_BEACON: 189 image = "/images/Top_Sphere_Red_Beacon.png"; //$NON-NLS-1$ 190 break; 191 case SAFE_FLOAT: 192 image = "/images/Top_Sphere_Red_Float.png"; //$NON-NLS-1$ 193 break; 194 } 195 if (!image.isEmpty()) 196 dlg.lM06Icon.setIcon(new ImageIcon(getClass().getResource(image))); 197 } 198 } else 199 dlg.lM01Icon.setIcon(null); 200 } 201 } 202 203 public void saveSign() { 204 Node node = getNode(); 205 206 if (node == null) { 207 return; 208 } 209 210 switch (getStyleIndex()) { 211 case SAFE_PILLAR: 212 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 213 Main.main.undoRedo.add(new ChangePropertyCommand(node, 214 "seamark:buoy_safe_water:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 215 break; 216 case SAFE_SPAR: 217 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 218 Main.main.undoRedo.add(new ChangePropertyCommand(node, 219 "seamark:buoy_safe_water:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 220 break; 221 case SAFE_SPHERE: 222 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 223 Main.main.undoRedo.add(new ChangePropertyCommand(node, 224 "seamark:buoy_safe_water:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 225 break; 226 case SAFE_BEACON: 227 super.saveSign("beacon_safe_water"); //$NON-NLS-1$ 228 break; 229 case SAFE_FLOAT: 230 super.saveSign("light_float"); //$NON-NLS-1$ 231 break; 232 default: 233 } 234 235 switch (getStyleIndex()) { 236 case SAFE_PILLAR: 237 case SAFE_SPAR: 238 case SAFE_SPHERE: 239 Main.main.undoRedo.add(new ChangePropertyCommand(node, 240 "seamark:buoy_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 241 Main.main.undoRedo.add(new ChangePropertyCommand(node, 242 "seamark:buoy_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 243 break; 244 case SAFE_BEACON: 245 Main.main.undoRedo.add(new ChangePropertyCommand(node, 246 "seamark:beacon_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 247 Main.main.undoRedo.add(new ChangePropertyCommand(node, 248 "seamark:beacon_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 249 break; 250 case SAFE_FLOAT: 251 Main.main.undoRedo.add(new ChangePropertyCommand(node, 252 "seamark:light_float:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 253 Main.main.undoRedo.add(new ChangePropertyCommand(node, 254 "seamark:light_float:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 255 break; 256 default: 257 } 258 saveTopMarkData("sphere", "red"); //$NON-NLS-1$ //$NON-NLS-2$ 259 saveLightData(); //$NON-NLS-1$ 260 saveRadarFogData(); 261 } 262 263 public void setLightColour() { 264 super.setLightColour("W"); //$NON-NLS-1$ 265 } 248 266 249 267 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java
r23193 r23224 17 17 18 18 public class BuoySpec extends Buoy { 19 public BuoySpec(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 39 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 40 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.09")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.setVisible(true); 43 dlg.lM01StyleOfMark.setVisible(true); 44 45 dlg.cbM01TopMark.removeAllItems(); 46 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212")); 47 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$ 48 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$ 49 50 dlg.cM01TopMark.setEnabled(true); 51 52 setBuoyIndex(SPECIAL_PURPOSE); 53 setColour(SeaMark.YELLOW); 54 setLightColour("W"); //$NON-NLS-1$ 55 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 56 57 if (keys.containsKey("name")) //$NON-NLS-1$ 58 setName(keys.get("name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:name")); //$NON-NLS-1$ 62 63 if (keys.containsKey("seamark:buoy_special_purpose:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:buoy_special_purpose:name")); //$NON-NLS-1$ 65 else if (keys.containsKey("seamark:beacon_special_purpose:name")) //$NON-NLS-1$ 66 setName(keys.get("seamark:beacon_special_purpose:name")); //$NON-NLS-1$ 67 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 68 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 69 70 if (keys.containsKey("seamark:buoy_special_purpose:shape")) { //$NON-NLS-1$ 71 str = keys.get("seamark:buoy_special_purpose:shape"); //$NON-NLS-1$ 72 73 if (str.equals("pillar")) //$NON-NLS-1$ 74 setStyleIndex(SPEC_PILLAR); 75 else if (str.equals("can")) //$NON-NLS-1$ 76 setStyleIndex(SPEC_CAN); 77 else if (str.equals("conical")) //$NON-NLS-1$ 78 setStyleIndex(SPEC_CONE); 79 else if (str.equals("spar")) //$NON-NLS-1$ 80 setStyleIndex(SPEC_SPAR); 81 else if (str.equals("sphere")) //$NON-NLS-1$ 82 setStyleIndex(SPEC_SPHERE); 83 else if (str.equals("barrel")) //$NON-NLS-1$ 84 setStyleIndex(SPEC_BARREL); 85 } 86 87 if (keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 88 str = keys.get("seamark:beacon_special_purpose:shape"); //$NON-NLS-1$ 89 if (str.equals("tower")) //$NON-NLS-1$ 90 setStyleIndex(SPEC_TOWER); 91 else 92 setStyleIndex(SPEC_BEACON); 93 } 94 95 if (keys.containsKey("seamark:light_float:colour")) { 96 setStyleIndex(SPEC_FLOAT); 97 } 98 99 if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals( //$NON-NLS-1$ //$NON-NLS-2$ 100 "beacon_special_purpose")) //$NON-NLS-1$ 101 || keys.containsKey("seamark:beacon_special_purpose:colour") //$NON-NLS-1$ 102 || keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 103 if (keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 104 && keys.get("seamark:beacon_special_purpose:shape").equals("tower")) //$NON-NLS-1$ //$NON-NLS-2$ 105 setStyleIndex(SPEC_TOWER); 106 else 107 setStyleIndex(SPEC_BEACON); 108 } else if (keys.containsKey("seamark:light_float:colour") //$NON-NLS-1$ 109 && keys.get("seamark:light_float:colour").equals("yellow")) //$NON-NLS-1$ //$NON-NLS-2$ 110 setStyleIndex(SPEC_FLOAT); 111 112 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 113 setStyleIndex(0); 114 115 keys = node.getKeys(); 116 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 117 str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 118 119 if (str.equals("x-shape")) { //$NON-NLS-1$ 120 setTopMark(true); 121 } 122 } 123 124 refreshLights(); 125 parseLights(keys); 126 parseFogRadar(keys); 127 128 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 129 dlg.tfM01Name.setText(getName()); 130 dlg.cM01TopMark.setSelected(hasTopMark()); 131 } 132 133 public void setStyleIndex(int styleIndex) { 134 super.setStyleIndex(styleIndex); 135 if (styleIndex == SPEC_BARREL) { 136 dlg.cM01Fired.setSelected(false); 137 dlg.cM01Fired.setEnabled(false); 138 dlg.cM01TopMark.setEnabled(true); 139 } else { 140 dlg.cM01Fired.setEnabled(true); 141 dlg.cM01TopMark.setEnabled(true); 142 } 143 } 144 145 public boolean isValid() { 146 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 147 } 148 149 public void paintSign() { 150 if (dlg.paintlock) 151 return; 152 super.paintSign(); 153 154 dlg.sM01StatusBar.setText(getErrMsg()); 155 156 if (isValid()) { 157 dlg.tfM01Name.setEnabled(true); 158 dlg.tfM01Name.setText(getName()); 159 dlg.cM01Radar.setVisible(true); 160 dlg.cM01Racon.setVisible(true); 161 dlg.cM01TopMark.setEnabled(true); 162 dlg.cM01TopMark.setVisible(true); 163 if (hasTopMark()) { 164 dlg.cbM01TopMark.setEnabled(true); 165 dlg.cbM01TopMark.setVisible(true); 166 } else { 167 dlg.cbM01TopMark.setVisible(false); 168 } 169 dlg.cM01Fog.setVisible(true); 170 dlg.cM01Fired.setVisible(true); 171 dlg.cM01Fired.setEnabled(true); 172 dlg.cbM01Colour.setVisible(false); 173 dlg.lM01Colour.setVisible(false); 174 dlg.rbM01Fired1.setVisible(false); 175 dlg.rbM01FiredN.setVisible(false); 176 dlg.lM01Height.setVisible(false); 177 dlg.tfM01Height.setVisible(false); 178 dlg.lM01Range.setVisible(false); 179 dlg.tfM01Range.setVisible(false); 180 181 if (isFired()) { 182 switch (getStyleIndex()) { 183 case SPEC_FLOAT: 184 dlg.lM01Height.setVisible(true); 185 dlg.tfM01Height.setVisible(true); 186 dlg.lM01Range.setVisible(true); 187 dlg.tfM01Range.setVisible(true); 188 break; 189 case SPEC_BEACON: 190 case SPEC_TOWER: 191 dlg.rbM01Fired1.setVisible(true); 192 dlg.rbM01FiredN.setVisible(true); 193 dlg.lM01Height.setVisible(true); 194 dlg.tfM01Height.setVisible(true); 195 dlg.lM01Range.setVisible(true); 196 dlg.tfM01Range.setVisible(true); 197 break; 198 default: 199 } 200 } 201 202 String image = "/images/Special_Purpose"; //$NON-NLS-1$ 203 204 switch (getStyleIndex()) { 205 case SPEC_PILLAR: 206 image += "_Pillar"; //$NON-NLS-1$ 207 break; 208 case SPEC_CAN: 209 image += "_Can"; //$NON-NLS-1$ 210 break; 211 case SPEC_CONE: 212 image += "_Cone"; //$NON-NLS-1$ 213 break; 214 case SPEC_SPAR: 215 image += "_Spar"; //$NON-NLS-1$ 216 break; 217 case SPEC_SPHERE: 218 image += "_Sphere"; //$NON-NLS-1$ 219 break; 220 case SPEC_BARREL: 221 image += "_Barrel"; //$NON-NLS-1$ 222 break; 223 case SPEC_FLOAT: 224 image += "_Float"; //$NON-NLS-1$ 225 break; 226 case SPEC_BEACON: 227 image += "_Beacon"; //$NON-NLS-1$ 228 break; 229 case SPEC_TOWER: 230 image += "_Tower"; //$NON-NLS-1$ 231 break; 232 default: 233 } 234 235 if (!image.equals("/images/Special_Purpose")) { //$NON-NLS-1$ 236 // if (hasTopMark()) 237 // image += "_CrossY"; //$NON-NLS-1$ 238 image += ".png"; //$NON-NLS-1$ 239 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 240 } else 241 dlg.lM01Icon.setIcon(null); 242 } 243 } 244 245 public void saveSign() { 246 Node node = getNode(); 247 248 if (node == null) { 249 return; 250 } 251 252 switch (getStyleIndex()) { 253 case SPEC_PILLAR: 254 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 255 Main.main.undoRedo.add(new ChangePropertyCommand(node, 256 "seamark:buoy_special_purpose:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 257 Main.main.undoRedo.add(new ChangePropertyCommand(node, 258 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 259 break; 260 case SPEC_SPAR: 261 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 262 Main.main.undoRedo.add(new ChangePropertyCommand(node, 263 "seamark:buoy_special_purpose:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 264 Main.main.undoRedo.add(new ChangePropertyCommand(node, 265 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 266 break; 267 case SPEC_SPHERE: 268 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 269 Main.main.undoRedo.add(new ChangePropertyCommand(node, 270 "seamark:buoy_special_purpose:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 271 Main.main.undoRedo.add(new ChangePropertyCommand(node, 272 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 273 break; 274 case SPEC_BARREL: 275 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 276 Main.main.undoRedo.add(new ChangePropertyCommand(node, 277 "seamark:buoy_special_purpose:shape", "barrel")); //$NON-NLS-1$ //$NON-NLS-2$ 278 Main.main.undoRedo.add(new ChangePropertyCommand(node, 279 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 280 break; 281 case SPEC_FLOAT: 282 super.saveSign("light_float"); //$NON-NLS-1$ 283 Main.main.undoRedo.add(new ChangePropertyCommand(node, 284 "seamark:light_float:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 285 break; 286 case SPEC_BEACON: 287 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 288 Main.main.undoRedo.add(new ChangePropertyCommand(node, 289 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 290 break; 291 case SPEC_TOWER: 292 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 293 Main.main.undoRedo.add(new ChangePropertyCommand(node, 294 "seamark:beacon_special_purpose:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 295 Main.main.undoRedo.add(new ChangePropertyCommand(node, 296 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 297 break; 298 default: 299 } 300 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$ 301 saveLightData(); //$NON-NLS-1$ 302 saveRadarFogData(); 303 } 304 305 public void setLightColour() { 306 super.setLightColour("W"); //$NON-NLS-1$ 307 } 19 public BuoySpec(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 39 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 40 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.09")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.setVisible(true); 43 dlg.lM01StyleOfMark.setVisible(true); 44 45 dlg.cbM01TopMark.removeAllItems(); 46 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212")); 47 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$ 48 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$ 49 50 dlg.cM01TopMark.setEnabled(true); 51 52 setBuoyIndex(SPECIAL_PURPOSE); 53 setColour(SeaMark.YELLOW); 54 setLightColour("W"); //$NON-NLS-1$ 55 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 56 57 if (keys.containsKey("name")) //$NON-NLS-1$ 58 setName(keys.get("name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:name")); //$NON-NLS-1$ 62 63 if (keys.containsKey("seamark:buoy_special_purpose:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:buoy_special_purpose:name")); //$NON-NLS-1$ 65 else if (keys.containsKey("seamark:beacon_special_purpose:name")) //$NON-NLS-1$ 66 setName(keys.get("seamark:beacon_special_purpose:name")); //$NON-NLS-1$ 67 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 68 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 69 70 if (keys.containsKey("seamark:buoy_special_purpose:shape")) { //$NON-NLS-1$ 71 str = keys.get("seamark:buoy_special_purpose:shape"); //$NON-NLS-1$ 72 73 if (str.equals("pillar")) //$NON-NLS-1$ 74 setStyleIndex(SPEC_PILLAR); 75 else if (str.equals("can")) //$NON-NLS-1$ 76 setStyleIndex(SPEC_CAN); 77 else if (str.equals("conical")) //$NON-NLS-1$ 78 setStyleIndex(SPEC_CONE); 79 else if (str.equals("spar")) //$NON-NLS-1$ 80 setStyleIndex(SPEC_SPAR); 81 else if (str.equals("sphere")) //$NON-NLS-1$ 82 setStyleIndex(SPEC_SPHERE); 83 else if (str.equals("barrel")) //$NON-NLS-1$ 84 setStyleIndex(SPEC_BARREL); 85 } 86 87 if (keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 88 str = keys.get("seamark:beacon_special_purpose:shape"); //$NON-NLS-1$ 89 if (str.equals("tower")) //$NON-NLS-1$ 90 setStyleIndex(SPEC_TOWER); 91 else 92 setStyleIndex(SPEC_BEACON); 93 } 94 95 if (keys.containsKey("seamark:light_float:colour")) { 96 setStyleIndex(SPEC_FLOAT); 97 } 98 99 if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals( //$NON-NLS-1$ //$NON-NLS-2$ 100 "beacon_special_purpose")) //$NON-NLS-1$ 101 || keys.containsKey("seamark:beacon_special_purpose:colour") //$NON-NLS-1$ 102 || keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 103 if (keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 104 && keys.get("seamark:beacon_special_purpose:shape").equals("tower")) //$NON-NLS-1$ //$NON-NLS-2$ 105 setStyleIndex(SPEC_TOWER); 106 else 107 setStyleIndex(SPEC_BEACON); 108 } else if (keys.containsKey("seamark:light_float:colour") //$NON-NLS-1$ 109 && keys.get("seamark:light_float:colour").equals("yellow")) //$NON-NLS-1$ //$NON-NLS-2$ 110 setStyleIndex(SPEC_FLOAT); 111 112 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 113 setStyleIndex(0); 114 115 keys = node.getKeys(); 116 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 117 str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 118 119 if (str.equals("x-shape")) { //$NON-NLS-1$ 120 setTopMark(true); 121 } 122 } 123 124 refreshLights(); 125 parseLights(keys); 126 parseFogRadar(keys); 127 128 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 129 dlg.tfM01Name.setText(getName()); 130 dlg.cM01TopMark.setSelected(hasTopMark()); 131 } 132 133 public void setStyleIndex(int styleIndex) { 134 super.setStyleIndex(styleIndex); 135 if (styleIndex == SPEC_BARREL) { 136 dlg.cM01Fired.setSelected(false); 137 dlg.cM01Fired.setEnabled(false); 138 dlg.cM01TopMark.setEnabled(true); 139 } else { 140 dlg.cM01Fired.setEnabled(true); 141 dlg.cM01TopMark.setEnabled(true); 142 } 143 } 144 145 public boolean isValid() { 146 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 147 } 148 149 public void paintSign() { 150 if (dlg.paintlock) 151 return; 152 super.paintSign(); 153 154 dlg.sM01StatusBar.setText(getErrMsg()); 155 156 if (isValid()) { 157 dlg.tfM01Name.setEnabled(true); 158 dlg.tfM01Name.setText(getName()); 159 dlg.cM01Radar.setVisible(true); 160 dlg.cM01Racon.setVisible(true); 161 dlg.cM01TopMark.setEnabled(true); 162 dlg.cM01TopMark.setVisible(true); 163 if (hasTopMark()) { 164 dlg.cbM01TopMark.setEnabled(true); 165 dlg.cbM01TopMark.setVisible(true); 166 } else { 167 dlg.cbM01TopMark.setVisible(false); 168 } 169 dlg.cM01Fog.setVisible(true); 170 dlg.cM01Fired.setVisible(true); 171 dlg.cM01Fired.setEnabled(true); 172 dlg.cbM01Colour.setVisible(false); 173 dlg.lM01Colour.setVisible(false); 174 dlg.rbM01Fired1.setVisible(false); 175 dlg.rbM01FiredN.setVisible(false); 176 dlg.lM01Height.setVisible(false); 177 dlg.tfM01Height.setVisible(false); 178 dlg.lM01Range.setVisible(false); 179 dlg.tfM01Range.setVisible(false); 180 181 if (isFired()) { 182 switch (getStyleIndex()) { 183 case SPEC_FLOAT: 184 dlg.lM01Height.setVisible(true); 185 dlg.tfM01Height.setVisible(true); 186 dlg.lM01Range.setVisible(true); 187 dlg.tfM01Range.setVisible(true); 188 break; 189 case SPEC_BEACON: 190 case SPEC_TOWER: 191 dlg.rbM01Fired1.setVisible(true); 192 dlg.rbM01FiredN.setVisible(true); 193 dlg.lM01Height.setVisible(true); 194 dlg.tfM01Height.setVisible(true); 195 dlg.lM01Range.setVisible(true); 196 dlg.tfM01Range.setVisible(true); 197 break; 198 default: 199 } 200 } 201 202 String image = "/images/Special_Purpose"; //$NON-NLS-1$ 203 204 switch (getStyleIndex()) { 205 case SPEC_PILLAR: 206 image += "_Pillar"; //$NON-NLS-1$ 207 break; 208 case SPEC_CAN: 209 image += "_Can"; //$NON-NLS-1$ 210 break; 211 case SPEC_CONE: 212 image += "_Cone"; //$NON-NLS-1$ 213 break; 214 case SPEC_SPAR: 215 image += "_Spar"; //$NON-NLS-1$ 216 break; 217 case SPEC_SPHERE: 218 image += "_Sphere"; //$NON-NLS-1$ 219 break; 220 case SPEC_BARREL: 221 image += "_Barrel"; //$NON-NLS-1$ 222 break; 223 case SPEC_FLOAT: 224 image += "_Float"; //$NON-NLS-1$ 225 break; 226 case SPEC_BEACON: 227 image += "_Beacon"; //$NON-NLS-1$ 228 break; 229 case SPEC_TOWER: 230 image += "_Tower"; //$NON-NLS-1$ 231 break; 232 default: 233 } 234 235 if (!image.equals("/images/Special_Purpose")) { //$NON-NLS-1$ 236 image += ".png"; //$NON-NLS-1$ 237 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 238 if (hasTopMark()) { 239 image = ""; 240 switch (getStyleIndex()) { 241 case SPEC_PILLAR: 242 case SPEC_SPAR: 243 image = "/images/Top_X_Yellow_Buoy.png"; //$NON-NLS-1$ 244 break; 245 case SPEC_CAN: 246 case SPEC_CONE: 247 case SPEC_SPHERE: 248 case SPEC_BARREL: 249 image = "/images/Top_X_Yellow_Buoy_Small.png"; //$NON-NLS-1$ 250 break; 251 case SPEC_BEACON: 252 case SPEC_TOWER: 253 image = "/images/Top_X_Yellow_Beacon.png"; //$NON-NLS-1$ 254 break; 255 case SPEC_FLOAT: 256 image = "/images/Top_X_Yellow_Float.png"; //$NON-NLS-1$ 257 break; 258 } 259 if (!image.isEmpty()) 260 dlg.lM06Icon.setIcon(new ImageIcon(getClass().getResource(image))); 261 } 262 } else 263 dlg.lM01Icon.setIcon(null); 264 } 265 } 266 267 public void saveSign() { 268 Node node = getNode(); 269 270 if (node == null) { 271 return; 272 } 273 274 switch (getStyleIndex()) { 275 case SPEC_PILLAR: 276 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 277 Main.main.undoRedo.add(new ChangePropertyCommand(node, 278 "seamark:buoy_special_purpose:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 279 Main.main.undoRedo.add(new ChangePropertyCommand(node, 280 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 281 break; 282 case SPEC_SPAR: 283 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 284 Main.main.undoRedo.add(new ChangePropertyCommand(node, 285 "seamark:buoy_special_purpose:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 286 Main.main.undoRedo.add(new ChangePropertyCommand(node, 287 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 288 break; 289 case SPEC_SPHERE: 290 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 291 Main.main.undoRedo.add(new ChangePropertyCommand(node, 292 "seamark:buoy_special_purpose:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 293 Main.main.undoRedo.add(new ChangePropertyCommand(node, 294 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 295 break; 296 case SPEC_BARREL: 297 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 298 Main.main.undoRedo.add(new ChangePropertyCommand(node, 299 "seamark:buoy_special_purpose:shape", "barrel")); //$NON-NLS-1$ //$NON-NLS-2$ 300 Main.main.undoRedo.add(new ChangePropertyCommand(node, 301 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 302 break; 303 case SPEC_FLOAT: 304 super.saveSign("light_float"); //$NON-NLS-1$ 305 Main.main.undoRedo.add(new ChangePropertyCommand(node, 306 "seamark:light_float:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 307 break; 308 case SPEC_BEACON: 309 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 310 Main.main.undoRedo.add(new ChangePropertyCommand(node, 311 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 312 break; 313 case SPEC_TOWER: 314 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 315 Main.main.undoRedo.add(new ChangePropertyCommand(node, 316 "seamark:beacon_special_purpose:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 317 Main.main.undoRedo.add(new ChangePropertyCommand(node, 318 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 319 break; 320 default: 321 } 322 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$ 323 saveLightData(); //$NON-NLS-1$ 324 saveRadarFogData(); 325 } 326 327 public void setLightColour() { 328 super.setLightColour("W"); //$NON-NLS-1$ 329 } 308 330 309 331 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java
r23193 r23224 11 11 12 12 public class BuoyUkn extends Buoy { 13 14 15 16 17 18 19 20 21 13 public BuoyUkn(SmpDialogAction dia, String Msg) { 14 super(dia); 15 resetMask(); 16 dlg.cbM01TypeOfMark.setSelectedIndex(0); 17 dlg.cbM01CatOfMark.removeAllItems(); 18 dlg.cbM01CatOfMark.setEnabled(false); 19 dlg.tfM01Name.setText(getName()); 20 setErrMsg(Msg); 21 } 22 22 23 public void paintSign() { 24 if (dlg.paintlock) return; 25 super.paintSign(); 23 public void paintSign() { 24 if (dlg.paintlock) 25 return; 26 super.paintSign(); 26 27 27 28 28 if (getErrMsg() != null) 29 dlg.sM01StatusBar.setText(getErrMsg()); 29 30 30 31 31 setErrMsg(null); 32 } 32 33 33 34 35 34 public void setLightColour() { 35 super.setLightColour(""); 36 } 36 37 37 38 38 public void saveSign() { 39 } 39 40 }
Note:
See TracChangeset
for help on using the changeset viewer.