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