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