Changeset 22626 in osm for applications/editors
- Timestamp:
- 2010-08-13T19:17:07+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java
r22623 r22626 19 19 import javax.swing.ImageIcon; 20 20 import javax.swing.JButton; 21 import javax.swing.JToggleButton; 21 22 import javax.swing.JCheckBox; 22 23 import javax.swing.JComboBox; … … 108 109 private JDialog dM01SeaMap = null; 109 110 private JPanel pM01SeaMap = null; 110 private JLabel lM01Colour = null;111 111 private JLabel lM01TimeUnit = null; 112 private JLabel lM01HeightUnit = null;113 private JLabel lM01RangeUnit = null;114 112 private JLabel lM01RepeatTime = null; 115 113 private JLabel lM01Kennung = null; 116 private JLabel lM01Height = null;117 private JLabel lM01Range = null;118 114 private JLabel lM01Name = null; 119 115 private JLabel lM01Props02 = null; … … 123 119 private JLabel lM01Head = null; 124 120 public JLabel lM01Icon01 = null; 125 public J ComboBox cbM01Region = null;121 public JToggleButton tbM01Region = null; 126 122 public JComboBox cbM01TypeOfMark = null; 127 123 public JComboBox cbM01StyleOfMark = null; … … 135 131 private JButton bM01Close = null; 136 132 public JTextField tfM01RepeatTime = null; 137 public JTextField tfM01Range = null;138 public JTextField tfM01Height = null;139 133 public JComboBox cbM01Kennung = null; 140 public JComboBox cbM01Colour = null;141 134 public JTextField tfM01FireMark = null; 142 135 private JCheckBox cM01IconVisible = null; … … 320 313 "/images/Auge.png"))); 321 314 322 cbM01Region.setEnabled(true);315 tbM01Region.setEnabled(true); 323 316 cbM01TypeOfMark.setEnabled(true); 324 317 cbM01StyleOfMark.setEnabled(true); … … 342 335 343 336 if (keys.containsKey("seamark") || keys.containsKey("seamark:type")) { 344 if (keys.containsKey("seamark:type")) { 345 } 346 347 if ((keys.containsKey("seamark:buoy_lateral:category") == true) 348 || (keys.containsKey("seamark:beacon_lateral:category") == true)) { 337 338 if (keys.containsKey("seamark:buoy_lateral:category") 339 || keys.containsKey("seamark:beacon_lateral:category")) { 349 340 350 341 buoy = null; // Prototyp der Lateraltonne 351 int ind = 0; // index für cbM01TypeOfMark352 342 String cat; // Kathegorie 353 343 … … 385 375 } 386 376 buoy.setName(name); 387 ind = SeaMark.PORT_HAND;388 377 } 389 378 … … 399 388 } 400 389 buoy.setName(name); 401 ind = SeaMark.STARBOARD_HAND;402 390 } 403 391 … … 414 402 415 403 buoy.setName(name); 416 ind = SeaMark.PREF_PORT_HAND;417 404 } 418 405 … … 429 416 430 417 buoy.setName(name); 431 ind = SeaMark.PREF_STARBOARD_HAND;432 418 } 433 419 … … 455 441 buoy.setNode(node); 456 442 buoy.setValid(true); 457 buoy.setBuoyIndex(ind);458 443 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 459 444 buoy.paintSign(); … … 473 458 474 459 buoy = null; // Prototyp der Kardinaltonne 475 int ind = 6; // index für cbM01TypeOfMark476 460 String cat; // Kathegorie 477 461 … … 485 469 if (name.compareTo("") == 0) { 486 470 if (keys.containsKey("seamark:buoy_cardinal:name")) 487 name = keys.get("seamark:buoy_ lateral:name");471 name = keys.get("seamark:buoy_cardinal:name"); 488 472 if (keys.containsKey("seamark:beacon_cardinal:name")) 489 name = keys.get("seamark:beacon_ lateral:name");473 name = keys.get("seamark:beacon_cardinal:name"); 490 474 } 491 475 … … 507 491 508 492 buoy.setName(name); 509 ind = SeaMark.CARD_NORTH;510 493 } // Ende if(str.compareTo("black;yellow")== 0) 511 494 … … 519 502 520 503 buoy.setName(name); 521 ind = SeaMark.CARD_EAST;522 504 } // Ende if(str.compareTo("black;yellow;black")== 0) 523 505 … … 531 513 532 514 buoy.setName(name); 533 ind = SeaMark.CARD_SOUTH;534 515 } // Ende if(str.compareTo("yellow;black")== 0) 535 516 … … 543 524 544 525 buoy.setName(name); 545 ind = SeaMark.CARD_WEST;546 526 } // Ende if(str.compareTo("yellow;black;black")== 0) 547 527 … … 564 544 buoy.setNode(node); 565 545 buoy.setValid(true); 566 buoy.setBuoyIndex(ind);567 546 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 568 547 buoy.paintSign(); … … 579 558 580 559 // Test buoy_safewater 581 if (keys.containsKey("seamark:buoy_ water:shape") == true) {560 if (keys.containsKey("seamark:buoy_safe_water:shape") == true) { 582 561 583 562 if (keys.containsKey("seamark:buoy_safe_water:colour") == false) { … … 620 599 buoy.setValid(true); 621 600 buoy.setNode(node); 622 buoy.setBuoyIndex(5);623 601 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 624 602 buoy.paintSign(); … … 670 648 buoy.setValid(true); 671 649 buoy.setNode(node); 672 buoy.setBuoyIndex(5);673 650 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 674 651 buoy.paintSign(); … … 679 656 680 657 // Test buoy_isolated_danger 681 if ((keys.containsKey("seamark:buoy_isolated_danger: shape") == true)682 || (keys.containsKey("seamark:beacon_isolated_danger: shape") == true)) {683 684 if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == false)685 && (keys.containsKey("seamark:b eacon_isolated_danger:colour") == false)) {686 buoy = new BuoyUkn(this, "Parse-Error: No colourset");687 buoy.setNode(node); 688 return; 689 } 690 691 if (keys.containsKey("seamark:buoy_isolated_danger: shape") == true)658 if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == true) 659 || (keys.containsKey("seamark:beacon_isolated_danger:colour") == true)) { 660 661 if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == true) 662 && (keys.containsKey("seamark:buoy_isolated_danger:shape") == false)) { 663 buoy = new BuoyUkn(this, "Parse-Error: No shape set"); 664 buoy.setNode(node); 665 return; 666 } 667 668 if (keys.containsKey("seamark:buoy_isolated_danger:colour") == true) 692 669 str = keys.get("seamark:buoy_isolated_danger:colour"); 693 670 else … … 725 702 buoy.setValid(true); 726 703 buoy.setNode(node); 727 buoy.setBuoyIndex(5); 704 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 705 buoy.paintSign(); 706 707 return; 708 709 } 710 711 // Test light_float 712 713 if ((keys.containsKey("seamark:type") == true) 714 && (keys.get("seamark:type").equals("light_float"))) { 715 716 if (keys.containsKey("seamark:light_float:colour") == false) { 717 buoy = new BuoyUkn(this, "Parse-Error: No colour set"); 718 buoy.setNode(node); 719 return; 720 } 721 722 str = keys.get("seamark:light_float:colour"); 723 if (str.equals("red") || str.equals("green") 724 || str.equals("red;green;red") || str.equals("green;red;green")) { 725 boolean region = Main.pref.get("tomsplugin.IALA").equals("B"); 726 if (str.equals("red")) { 727 if ((keys.containsKey("seamark:topmark:shape") && keys.get( 728 "seamark:topmark:shape").equals("cylinder")) 729 || (region == SeaMark.IALA_A)) { 730 buoy = new BuoyLat(this, SeaMark.PORT_HAND); 731 } else { 732 buoy = new BuoyLat(this, SeaMark.STARBOARD_HAND); 733 } 734 buoy.setColour(SeaMark.RED); 735 } else if (str.equals("green")) { 736 if ((keys.containsKey("seamark:topmark:shape") && keys.get( 737 "seamark:topmark:shape").equals("cone, point up")) 738 || (region == SeaMark.IALA_A)) { 739 buoy = new BuoyLat(this, SeaMark.STARBOARD_HAND); 740 } else { 741 buoy = new BuoyLat(this, SeaMark.PORT_HAND); 742 } 743 buoy.setColour(SeaMark.GREEN); 744 } else if (str.equals("red;green;red")) { 745 if ((keys.containsKey("seamark:topmark:shape") && keys.get( 746 "seamark:topmark:shape").equals("cylinder")) 747 || (region == SeaMark.IALA_A)) { 748 buoy = new BuoyLat(this, SeaMark.PREF_PORT_HAND); 749 } else { 750 buoy = new BuoyLat(this, SeaMark.PREF_STARBOARD_HAND); 751 } 752 buoy.setColour(SeaMark.RED_GREEN_RED); 753 } else if (str.equals("green;red;green")) { 754 if ((keys.containsKey("seamark:topmark:shape") && keys.get( 755 "seamark:topmark:shape").equals("cone, point up")) 756 || (region == SeaMark.IALA_A)) { 757 buoy = new BuoyLat(this, SeaMark.PREF_STARBOARD_HAND); 758 } else { 759 buoy = new BuoyLat(this, SeaMark.PREF_PORT_HAND); 760 } 761 buoy.setColour(SeaMark.GREEN_RED_GREEN); 762 } 763 } else if (str.equals("black;yellow")) { 764 buoy = new BuoyCard(this, SeaMark.CARD_NORTH); 765 buoy.setColour(SeaMark.BLACK_YELLOW); 766 } else if (str.equals("black;yellow;black")) { 767 buoy = new BuoyCard(this, SeaMark.CARD_EAST); 768 buoy.setColour(SeaMark.BLACK_YELLOW_BLACK); 769 } else if (str.equals("yellow;black")) { 770 buoy = new BuoyCard(this, SeaMark.CARD_SOUTH); 771 buoy.setColour(SeaMark.YELLOW_BLACK); 772 } else if (str.equals("yellow;black;yellow")) { 773 buoy = new BuoyCard(this, SeaMark.CARD_WEST); 774 buoy.setColour(SeaMark.YELLOW_BLACK_YELLOW); 775 } else if (str.equals("black;red;black")) { 776 buoy = new BuoyIsol(this, SeaMark.ISOLATED_DANGER); 777 buoy.setColour(SeaMark.BLACK_RED_BLACK); 778 } else if (str.equals("red;white")) { 779 buoy = new BuoySaw(this, SeaMark.SAFE_WATER); 780 buoy.setColour(SeaMark.RED_WHITE); 781 } else { 782 buoy = new BuoyUkn(this, "Parse-Error: Invalid colour"); 783 buoy.setNode(node); 784 return; 785 } 786 787 buoy.setName(name); 788 789 if (buoy.parseTopMark(node) == false) { 790 str = buoy.getErrMsg(); 791 if (str == null) 792 buoy.setValid(false); 793 } 794 795 if (buoy.parseLight(node) == false) { 796 str = buoy.getErrMsg(); 797 if (str == null) 798 buoy.setValid(false); 799 } 800 801 if (buoy.parseShape(node) == false) { 802 str = buoy.getErrMsg(); 803 if (str == null) 804 buoy = new BuoyUkn(this, str); 805 buoy.setNode(node); 806 return; 807 } 808 809 buoy.setValid(true); 810 buoy.setNode(node); 728 811 cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex()); 729 812 buoy.paintSign(); … … 780 863 if (pM01SeaMap == null) { 781 864 lM01TimeUnit = new JLabel(); 782 lM01TimeUnit.setBounds(new Rectangle( 125, 250, 26, 20));865 lM01TimeUnit.setBounds(new Rectangle(325, 230, 26, 20)); 783 866 lM01TimeUnit.setFont(new Font("Dialog", Font.PLAIN, 12)); 784 867 lM01TimeUnit.setText("s"); 785 868 786 lM01HeightUnit = new JLabel();787 lM01HeightUnit.setBounds(new Rectangle(220, 250, 26, 20));788 lM01HeightUnit.setFont(new Font("Dialog", Font.PLAIN, 12));789 lM01HeightUnit.setText("m");790 791 lM01RangeUnit = new JLabel();792 lM01RangeUnit.setBounds(new Rectangle(320, 250, 26, 20));793 lM01RangeUnit.setFont(new Font("Dialog", Font.PLAIN, 12));794 lM01RangeUnit.setText("M");795 796 lM01Height = new JLabel();797 lM01Height.setBounds(new Rectangle(140, 250, 70, 20));798 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12));799 lM01Height.setText("Height:");800 801 lM01Range = new JLabel();802 lM01Range.setBounds(new Rectangle(240, 250, 70, 20));803 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12));804 lM01Range.setText("Range:");805 806 869 lM01RepeatTime = new JLabel(); 807 lM01RepeatTime.setBounds(new Rectangle( 45, 250, 70, 20));870 lM01RepeatTime.setBounds(new Rectangle(245, 230, 70, 20)); 808 871 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); 809 872 lM01RepeatTime.setText("Period:"); … … 814 877 lM01Kennung.setText("Character:"); 815 878 816 lM01Colour = new JLabel();817 lM01Colour.setBounds(new Rectangle(240, 230, 60, 20));818 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12));819 lM01Colour.setText("Colour:");820 821 879 lM01Name = new JLabel(); 822 880 lM01Name.setBounds(new Rectangle(5, 120, 82, 16)); … … 856 914 pM01SeaMap.setLayout(null); 857 915 pM01SeaMap.add(lM01TimeUnit, null); 858 // pM01SeaMap.add(lM01HeightUnit, null);859 // pM01SeaMap.add(lM01RangeUnit, null);860 // pM01SeaMap.add(lM01Height, null);861 // pM01SeaMap.add(lM01Range, null);862 916 pM01SeaMap.add(lM01RepeatTime, null); 863 pM01SeaMap.add(lM01Colour, null);864 917 pM01SeaMap.add(lM01Kennung, null); 865 918 pM01SeaMap.add(lM01Name, null); … … 870 923 pM01SeaMap.add(lM01Head, null); 871 924 pM01SeaMap.add(lM01Icon01, null); 872 pM01SeaMap.add(get CbM01Region(), null);925 pM01SeaMap.add(getTbM01Region(), null); 873 926 pM01SeaMap.add(getCbM01TypeOfMark(), null); 874 927 pM01SeaMap.add(getCbM01StyleOfMark(), null); … … 882 935 pM01SeaMap.add(getBM01Close(), null); 883 936 pM01SeaMap.add(getTfM01RepeatTime(), null); 884 // pM01SeaMap.add(getTfM01Range(), null);885 // pM01SeaMap.add(getTfM01Height(), null);886 937 pM01SeaMap.add(getCbM01Kennung(), null); 887 pM01SeaMap.add(getCbM01Colour(), null);888 938 pM01SeaMap.add(getTfM01FireMark(), null); 889 939 pM01SeaMap.add(getCM01IconVisible(), null); … … 948 998 buoy.setColour(SeaMark.RED); 949 999 buoy.setRegion(SeaMark.IALA_A); 950 cbM01Region.setSelectedIndex(SeaMark.IALA_A);1000 tbM01Region.setSelected(SeaMark.IALA_A); 951 1001 } else { 952 1002 buoy.setColour(SeaMark.GREEN); … … 960 1010 buoy.setColour(SeaMark.GREEN); 961 1011 buoy.setRegion(SeaMark.IALA_A); 962 cbM01Region.setSelectedIndex(SeaMark.IALA_A);1012 tbM01Region.setSelected(SeaMark.IALA_A); 963 1013 } else { 964 1014 buoy.setColour(SeaMark.RED); … … 972 1022 buoy.setColour(SeaMark.RED_GREEN_RED); 973 1023 buoy.setRegion(SeaMark.IALA_A); 974 cbM01Region.setSelectedIndex(SeaMark.IALA_A);1024 tbM01Region.setSelected(SeaMark.IALA_A); 975 1025 } else { 976 1026 buoy.setColour(SeaMark.GREEN_RED_GREEN); … … 984 1034 buoy.setColour(SeaMark.GREEN_RED_GREEN); 985 1035 buoy.setRegion(SeaMark.IALA_A); 986 cbM01Region.setSelectedIndex(SeaMark.IALA_A);1036 tbM01Region.setSelected(SeaMark.IALA_A); 987 1037 } else { 988 1038 buoy.setColour(SeaMark.RED_GREEN_RED); … … 1037 1087 } 1038 1088 1039 private JComboBox getCbM01Region() { 1040 if (cbM01Region == null) { 1041 cbM01Region = new JComboBox(); 1042 1043 // Inhalt der ComboBox 1044 cbM01Region.addItem("Not set"); 1045 cbM01Region.addItem("IALA-A"); 1046 cbM01Region.addItem("IALA-B"); 1047 1048 cbM01Region.setBounds(new Rectangle(60, 55, 100, 25)); 1049 cbM01Region.setEditable(false); 1050 cbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); 1051 cbM01Region.setEnabled(true); 1052 1053 cbM01Region.addActionListener(new java.awt.event.ActionListener() { 1089 private JToggleButton getTbM01Region() { 1090 if (tbM01Region == null) { 1091 tbM01Region = new JToggleButton(); 1092 1093 tbM01Region.setBounds(new Rectangle(60, 55, 80, 25)); 1094 tbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); 1095 tbM01Region.setEnabled(false); 1096 if (Main.pref.get("tomsplugin.IALA").equals("B")) { 1097 tbM01Region.setSelected(true); 1098 tbM01Region.setText("IALA-B"); 1099 } else { 1100 tbM01Region.setSelected(false); 1101 tbM01Region.setText("IALA-A"); 1102 } 1103 1104 tbM01Region.addActionListener(new java.awt.event.ActionListener() { 1054 1105 public void actionPerformed(java.awt.event.ActionEvent e) { 1055 buoy.setRegion(cbM01Region.getSelectedIndex()); 1106 if (tbM01Region.isSelected()) { 1107 buoy.setRegion(true); 1108 tbM01Region.setText("IALA-B"); 1109 } else { 1110 buoy.setRegion(false); 1111 tbM01Region.setText("IALA-A"); 1112 } 1056 1113 if (buoy instanceof BuoyLat) 1057 1114 buoy.setLightColour(); … … 1061 1118 } 1062 1119 1063 return cbM01Region;1120 return tbM01Region; 1064 1121 } 1065 1122 … … 1225 1282 if (tfM01RepeatTime == null) { 1226 1283 tfM01RepeatTime = new JTextField(); 1227 tfM01RepeatTime.setBounds(new Rectangle( 90, 250, 30, 20));1284 tfM01RepeatTime.setBounds(new Rectangle(290, 230, 30, 20)); 1228 1285 tfM01RepeatTime.addActionListener(new java.awt.event.ActionListener() { 1229 1286 public void actionPerformed(java.awt.event.ActionEvent e) { … … 1246 1303 1247 1304 return tfM01RepeatTime; 1248 }1249 1250 private JTextField getTfM01Range() {1251 if (tfM01Range == null) {1252 tfM01Range = new JTextField();1253 tfM01Range.setBounds(new Rectangle(285, 250, 30, 20));1254 tfM01Range.setEnabled(false);1255 tfM01Range.addActionListener(new java.awt.event.ActionListener() {1256 public void actionPerformed(java.awt.event.ActionEvent e) {1257 String s = tfM01Range.getText();1258 1259 buoy.setRange(s);1260 buoy.paintSign();1261 }1262 });1263 1264 tfM01Range.addFocusListener(new java.awt.event.FocusAdapter() {1265 public void focusLost(java.awt.event.FocusEvent e) {1266 String s = tfM01Range.getText();1267 1268 buoy.setRange(s);1269 buoy.paintSign();1270 }1271 });1272 }1273 1274 return tfM01Range;1275 }1276 1277 private JTextField getTfM01Height() {1278 if (tfM01Height == null) {1279 tfM01Height = new JTextField();1280 tfM01Height.setBounds(new Rectangle(185, 250, 30, 20));1281 tfM01Height.setEnabled(false);1282 tfM01Height.addActionListener(new java.awt.event.ActionListener() {1283 public void actionPerformed(java.awt.event.ActionEvent e) {1284 String s = tfM01Height.getText();1285 1286 buoy.setHeight(s);1287 buoy.paintSign();1288 }1289 });1290 1291 tfM01Height.addFocusListener(new java.awt.event.FocusAdapter() {1292 public void focusLost(java.awt.event.FocusEvent e) {1293 String s = tfM01Height.getText();1294 1295 buoy.setHeight(s);1296 buoy.paintSign();1297 }1298 });1299 }1300 1301 return tfM01Height;1302 1305 } 1303 1306 … … 1352 1355 1353 1356 return cbM01Kennung; 1354 }1355 1356 private JComboBox getCbM01Colour() {1357 if (cbM01Colour == null) {1358 cbM01Colour = new JComboBox();1359 cbM01Colour.setBounds(new Rectangle(285, 230, 50, 20));1360 cbM01Colour.addActionListener(new java.awt.event.ActionListener() {1361 public void actionPerformed(java.awt.event.ActionEvent e) {1362 String it = (String) cbM01Colour.getSelectedItem();1363 1364 if (it == null)1365 return;1366 1367 if (it.compareTo("Not set") == 0)1368 return;1369 1370 if (buoy == null) {1371 return;1372 }1373 buoy.setLightColour(it);1374 buoy.paintSign();1375 }1376 });1377 }1378 1379 return cbM01Colour;1380 1357 } 1381 1358 -
applications/editors/josm/plugins/toms/src/toms/seamarks/SeaMark.java
r22623 r22626 56 56 * Regions 57 57 */ 58 public final static int UNKNOWN_REGION = 0; 59 public final static int IALA_A = 1; 60 public final static int IALA_B = 2; 58 public final static boolean IALA_A = false; 59 public final static boolean IALA_B = true; 61 60 62 61 /** -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r22623 r22626 47 47 } 48 48 49 private int Region = 0;50 51 public intgetRegion() {49 private boolean Region = false; 50 51 public boolean getRegion() { 52 52 return Region; 53 53 } 54 54 55 public void setRegion( intregion) {55 public void setRegion(boolean region) { 56 56 Region = region; 57 dlg.tbM01Region.setSelected(region); 58 dlg.tbM01Region.setText(region ? "IALA-B" : "IALA-A"); 57 59 } 58 60 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java
r22623 r22626 28 28 dlg.cbM01StyleOfMark.addItem("Float"); 29 29 30 dlg.cbM01Colour.removeAllItems();31 dlg.cbM01Colour.addItem("W");32 dlg.cbM01Colour.setSelectedIndex(0);33 dlg.cbM01Colour.setEnabled(false);34 30 dlg.cM01Fired.setSelected(false); 35 31 dlg.cM01TopMark.setSelected(false); 36 32 dlg.tbM01Region.setEnabled(false); 33 34 setBuoyIndex(type); 37 35 setStyleIndex(0); 38 setBuoyIndex(type);39 36 setLightColour("W"); 40 37 … … 251 248 else if (str.compareTo("spar") == 0) 252 249 setStyleIndex(CARD_SPAR); 253 else if (str.compareTo("float") == 0)254 setStyleIndex(CARD_FLOAT);255 250 else 256 251 ret = false; 257 } else if (keys.containsKey("seamark:beacon_cardinal ")) {252 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { 258 253 if (keys.containsKey("seamark:beacon_cardinal:shape")) { 259 254 str = keys.get("seamark:beacon_cardinal:shape"); … … 261 256 if (str.compareTo("tower") == 0) 262 257 setStyleIndex(CARD_TOWER); 258 else 259 setStyleIndex(CARD_BEACON); 263 260 } else 264 261 setStyleIndex(CARD_BEACON); 262 } else if ((keys.containsKey("seamark:type") == true) 263 && (keys.get("seamark:type").equals("light_float"))) { 264 setStyleIndex(CARD_FLOAT); 265 265 } 266 266 return ret; -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java
r22623 r22626 31 31 dlg.cbM01Kennung.addItem("Fl(2)"); 32 32 33 dlg.cbM01Colour.removeAllItems();34 dlg.cbM01Colour.addItem("W");35 dlg.cbM01Colour.setSelectedIndex(0);36 dlg.cbM01Colour.setEnabled(false);37 33 dlg.cM01Fired.setSelected(false); 38 34 dlg.cM01TopMark.setSelected(true); 39 35 dlg.cM01TopMark.setEnabled(false); 36 dlg.tbM01Region.setEnabled(false); 40 37 41 38 setColour(SeaMark.BLACK_RED_BLACK); … … 243 240 else 244 241 ret = false; 245 } 246 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { 247 str = keys.get("seamark:beacon_isolated_danger:shape"); 248 249 if (str.compareTo("stake") == 0) 242 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { 243 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { 244 str = keys.get("seamark:beacon_isolated_danger:shape"); 245 246 if (str.compareTo("tower") == 0) 247 setStyleIndex(ISOL_TOWER); 248 else 249 setStyleIndex(ISOL_BEACON); 250 } else 250 251 setStyleIndex(ISOL_BEACON); 251 else252 ret = false;253 }254 252 } else if ((keys.containsKey("seamark:type") == true) 253 && (keys.get("seamark:type").equals("light_float"))) { 254 setStyleIndex(CARD_FLOAT); 255 } 255 256 return ret; 256 257 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java
r22623 r22626 32 32 dlg.cbM01Kennung.setSelectedIndex(0); 33 33 34 dlg.cbM01Colour.removeAllItems();35 dlg.cbM01Colour.addItem("");36 dlg.cbM01Colour.addItem("R");37 dlg.cbM01Colour.addItem("G");38 dlg.cbM01Colour.setSelectedIndex(0);39 dlg.cbM01Colour.setEnabled(false);40 41 34 setBuoyIndex(type); 42 35 setStyleIndex(0); … … 44 37 setFired(false); 45 38 setTopMark(false); 39 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 46 40 47 41 refreshStyles(); … … 119 113 120 114 int cat = getBuoyIndex(); 121 intregion = getRegion();115 boolean region = getRegion(); 122 116 int style = getStyleIndex(); 123 117 … … 351 345 image += ".png"; 352 346 353 // System.out.println("finename: " + image);347 // System.out.println("finename: " + image); 354 348 dlg.lM01Icon01.setIcon(new ImageIcon(getClass().getResource(image))); 355 349 } else … … 701 695 702 696 saveTopMarkData(shape, colour); 703 704 697 saveLightData(colour); 698 699 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); 705 700 } 706 701 … … 723 718 case PORT_HAND: 724 719 case PREF_PORT_HAND: 725 if (str. compareTo("cylinder") == 0) {720 if (str.equals("cylinder")) { 726 721 setTopMark(true); 727 722 setRegion(IALA_A); 723 } else if (str.equals("cone, point up")) { 724 setTopMark(true); 725 setRegion(IALA_B); 728 726 } else { 729 727 setTopMark(false); … … 734 732 case STARBOARD_HAND: 735 733 case PREF_STARBOARD_HAND: 736 if (str. compareTo("cone, point up") == 0 || str.compareTo("cone") == 0) {734 if (str.equals("cone, point up")) { 737 735 setTopMark(true); 738 736 setRegion(IALA_A); 737 } else if (str.equals("cylinder")) { 738 setTopMark(true); 739 setRegion(IALA_B); 739 740 } else { 740 741 setTopMark(false); … … 746 747 ret = false; 747 748 } 748 749 749 if (!hasTopMark()) { 750 750 setErrMsg("Parse-Error: Topmark falsch"); 751 751 ret = false; 752 752 } 753 754 } 755 753 } 756 754 return ret; 757 755 } … … 779 777 780 778 if (isFired()) { 779 781 780 } else { 782 781 if (getErrMsg() == null) … … 792 791 793 792 public void setLightColour() { 794 if (getRegion() != IALA_B793 if (getRegion() == IALA_A 795 794 && (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)) { 796 795 super.setLightColour("R"); 797 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT);798 796 } else { 799 797 super.setLightColour("G"); 800 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT);801 798 } 802 799 } … … 812 809 case PORT_HAND: 813 810 case PREF_PORT_HAND: 814 if (str.compareTo("red") == 0) { 815 816 setFired(true); 817 super.setLightColour("R"); 811 if (getRegion() == IALA_A) { 812 if (str.compareTo("red") == 0) { 813 setFired(true); 814 super.setLightColour("R"); 815 } else { 816 super.setLightColour(""); 817 } 818 818 } else { 819 super.setLightColour(""); 820 } 821 819 if (str.compareTo("green") == 0) { 820 setFired(true); 821 super.setLightColour("G"); 822 } else { 823 super.setLightColour(""); 824 } 825 } 822 826 break; 823 827 824 828 case STARBOARD_HAND: 825 829 case PREF_STARBOARD_HAND: 826 if (str.compareTo("green") == 0) { 827 setFired(true); 828 super.setLightColour("G"); 830 if (getRegion() == IALA_A) { 831 if (str.compareTo("green") == 0) { 832 setFired(true); 833 super.setLightColour("G"); 834 } else { 835 super.setLightColour(""); 836 } 829 837 } else { 830 super.setLightColour(""); 838 if (str.compareTo("red") == 0) { 839 setFired(true); 840 super.setLightColour("R"); 841 } else { 842 super.setLightColour(""); 843 } 831 844 } 832 845 break; … … 856 869 else if (str.compareTo("spar") == 0) 857 870 setStyleIndex(LAT_SPAR); 858 else if (str.compareTo("float") == 0)859 setStyleIndex(LAT_FLOAT);860 else if (str.compareTo("perch") == 0)861 setStyleIndex(LAT_PERCH);862 871 else 863 872 ret = false; … … 882 891 else if (str.compareTo("spar") == 0) 883 892 setStyleIndex(LAT_SPAR); 884 else if (str.compareTo("float") == 0)885 setStyleIndex(LAT_FLOAT);886 else if (str.compareTo("perch") == 0)887 setStyleIndex(LAT_PERCH);888 893 else 889 894 ret = false; … … 904 909 ret = false; 905 910 } 906 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { 907 str = keys.get("seamark:beacon_lateral:shape"); 908 909 int cat = getBuoyIndex(); 910 switch (cat) { 911 case PORT_HAND: 912 if (str.compareTo("stake") == 0) 913 setStyleIndex(LAT_BEACON); 914 else if (str.compareTo("tower") == 0) 911 } else if (keys.containsKey("seamark:beacon_lateral:colour")) { 912 if (keys.containsKey("seamark:beacon_lateral:shape")) { 913 str = keys.get("seamark:beacon_lateral:shape"); 914 if (str.compareTo("tower") == 0) 915 915 setStyleIndex(LAT_TOWER); 916 916 else 917 ret = false;918 break;919 920 case PREF_PORT_HAND:921 if (str.compareTo("stake") == 0)922 917 setStyleIndex(LAT_BEACON); 923 else if (str.compareTo("tower") == 0) 924 setStyleIndex(LAT_TOWER); 925 else 926 ret = false; 927 break; 928 929 case STARBOARD_HAND: 930 if (str.compareTo("stake") == 0) 931 setStyleIndex(LAT_BEACON); 932 else if (str.compareTo("tower") == 0) 933 setStyleIndex(LAT_TOWER); 934 else 935 ret = false; 936 break; 937 938 case PREF_STARBOARD_HAND: 939 if (str.compareTo("stake") == 0) 940 setStyleIndex(LAT_BEACON); 941 else if (str.compareTo("tower") == 0) 942 setStyleIndex(LAT_TOWER); 943 else 944 ret = false; 945 break; 946 947 default: 948 ret = false; 949 } 918 } else 919 setStyleIndex(LAT_BEACON); 920 } else if ((keys.containsKey("seamark:type") == true) 921 && (keys.get("seamark:type").equals("light_float"))) { 922 setStyleIndex(LAT_FLOAT); 950 923 } 951 924 return ret; -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java
r22623 r22626 32 32 dlg.cbM01Kennung.setSelectedIndex(0); 33 33 34 dlg.cbM01Colour.removeAllItems(); 35 dlg.cbM01Colour.addItem("Not set"); 36 dlg.cbM01Colour.addItem("R"); 37 dlg.cbM01Colour.addItem("G"); 38 dlg.cbM01Colour.addItem("W"); 39 dlg.cbM01Colour.setEnabled(true); 34 dlg.tbM01Region.setEnabled(false); 40 35 41 36 setBuoyIndex(type); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java
r22623 r22626 33 33 dlg.cbM01Kennung.addItem("Mo()"); 34 34 35 dlg.cbM01Colour.removeAllItems();36 dlg.cbM01Colour.addItem("W");37 dlg.cbM01Colour.setSelectedIndex(0);38 dlg.cbM01Colour.setEnabled(false);39 35 dlg.cM01Fired.setSelected(false); 40 36 dlg.cM01TopMark.setSelected(false); 37 dlg.tbM01Region.setEnabled(false); 41 38 42 39 setColour(SeaMark.RED_WHITE); … … 227 224 else if (str.compareTo("sphere") == 0) 228 225 setStyleIndex(SAFE_SPHERE); 229 else if (str.compareTo("float") == 0)230 setStyleIndex(SAFE_FLOAT);231 226 else 232 227 ret = false; 228 } else if ((keys.containsKey("seamark:type") == true) 229 && (keys.get("seamark:type").equals("light_float"))) { 230 setStyleIndex(SAFE_FLOAT); 233 231 } 234 232 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java
r22623 r22626 28 28 dlg.cbM01Kennung.addItem("Not set"); 29 29 30 dlg.cbM01Colour.removeAllItems();31 dlg.cbM01Colour.addItem("W");32 dlg.cbM01Colour.setSelectedIndex(0);33 dlg.cbM01Colour.setEnabled(false);34 30 dlg.cM01Fired.setSelected(false); 35 31 dlg.cM01TopMark.setSelected(false); 32 dlg.tbM01Region.setEnabled(false); 36 33 37 34 setColour(SeaMark.YELLOW); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java
r22623 r22626 13 13 super(dia); 14 14 15 setBuoyIndex(0);16 15 if (dlg.cbM01Kennung != null) { 17 16 dlg.cbM01Kennung.removeAllItems(); … … 19 18 } 20 19 21 dlg.cbM01Colour.removeAllItems();22 dlg.cbM01Colour.setEnabled(false);23 20 dlg.cM01Fired.setSelected(false); 24 21 dlg.cM01TopMark.setSelected(false); 22 dlg.tbM01Region.setEnabled(false); 25 23 26 24 setErrMsg(Msg); … … 29 27 setFired(false); 30 28 setValid(false); 29 setBuoyIndex(0); 31 30 32 31 paintSign();
Note:
See TracChangeset
for help on using the changeset viewer.