Changeset 22923 in osm for applications/editors
- Timestamp:
- 2010-09-01T19:14:25+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java
r22907 r22923 19 19 import javax.swing.ImageIcon; 20 20 import javax.swing.JButton; 21 import javax.swing.JToggleButton; 21 import javax.swing.JRadioButton; 22 import javax.swing.ButtonGroup; 22 23 import javax.swing.JCheckBox; 23 24 import javax.swing.JComboBox; … … 51 52 52 53 public class SmpDialogAction extends JosmAction { 53 /**54 *55 */56 54 private static final long serialVersionUID = -2976230949744302905L; 57 55 … … 115 113 public JLabel lM01Icon01 = null; 116 114 public JLabel lM01Icon02 = null; 117 public JToggleButton tbM01Region = null; 115 public ButtonGroup bgM01Region = null; 116 public JRadioButton rbM01RegionA = null; 117 public JRadioButton rbM01RegionB = null; 118 118 public JComboBox cbM01TypeOfMark = null; 119 119 public JComboBox cbM01StyleOfMark = null; … … 172 172 String str = Main.pref.get("mappaint.style.sources"); 173 173 if (!str.contains("dev.openseamap.org")) { 174 if (!str.equals("")) str += new String(new char[] {0x1e}); 175 Main.pref.put("mappaint.style.sources", str + "http://dev.openseamap.org/josm/seamark_styles.xml"); 174 if (!str.equals("")) 175 str += new String(new char[] { 0x1e }); 176 Main.pref.put("mappaint.style.sources", str 177 + "http://dev.openseamap.org/josm/seamark_styles.xml"); 176 178 } 177 179 str = Main.pref.get("color.background"); … … 183 185 onode = null; 184 186 DataSet.selListeners.remove(SmpListener); 185 //DataSet.removeSelectionListener(SmpListener);187 // DataSet.removeSelectionListener(SmpListener); 186 188 Selection = null; 187 189 … … 230 232 // Einhängen des Listeners in die Eventqueue von josm 231 233 DataSet.selListeners.add(SmpListener); 232 //DataSet.addSelectionListener(SmpListener);234 // DataSet.addSelectionListener(SmpListener); 233 235 } 234 236 … … 318 320 "/images/Auge.png"))); 319 321 320 tbM01Region.setEnabled(true);321 322 cbM01TypeOfMark.setEnabled(true); 322 323 cbM01StyleOfMark.setEnabled(true); … … 449 450 // Deaktivierung des Listeners 450 451 DataSet.selListeners.remove(SmpListener); 451 //DataSet.removeSelectionListener(SmpListener);452 // DataSet.removeSelectionListener(SmpListener); 452 453 Selection = null; 453 454 … … 523 524 lM01Icon02.setIcon(null); 524 525 lM01Icon02.setText(""); 526 527 rbM01RegionA = new JRadioButton("A", Main.pref.get("tomsplugin.IALA") 528 .equals("A")); 529 rbM01RegionA.setBounds(new Rectangle(60, 55, 40, 30)); 530 rbM01RegionB = new JRadioButton("B", Main.pref.get("tomsplugin.IALA") 531 .equals("B")); 532 rbM01RegionB.setBounds(new Rectangle(100, 55, 40, 30)); 533 bgM01Region = new ButtonGroup(); 534 bgM01Region.add(rbM01RegionA); 535 bgM01Region.add(rbM01RegionB); 536 537 java.awt.event.ActionListener alM01Region = new java.awt.event.ActionListener() { 538 public void actionPerformed(java.awt.event.ActionEvent e) { 539 if (buoy instanceof BuoyLat) { 540 buoy.setRegion(rbM01RegionB.isSelected()); 541 buoy.setLightColour(); 542 buoy.paintSign(); 543 } 544 } 545 }; 546 rbM01RegionA.addActionListener(alM01Region); 547 rbM01RegionB.addActionListener(alM01Region); 525 548 526 549 pM01SeaMap = new JPanel(); … … 537 560 pM01SeaMap.add(lM01Icon01, null); 538 561 pM01SeaMap.add(lM01Icon02, null); 539 pM01SeaMap.add(getTbM01Region(), null); 562 pM01SeaMap.add(rbM01RegionA, null); 563 pM01SeaMap.add(rbM01RegionB, null); 564 // pM01SeaMap.add(getTbM01Region(), null); 540 565 pM01SeaMap.add(getCbM01TypeOfMark(), null); 541 566 pM01SeaMap.add(getCbM01StyleOfMark(), null); … … 653 678 } 654 679 655 private JToggleButton getTbM01Region() { 656 if (tbM01Region == null) { 657 tbM01Region = new JToggleButton(); 658 659 tbM01Region.setBounds(new Rectangle(60, 55, 80, 25)); 660 tbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); 661 tbM01Region.setEnabled(false); 662 if (Main.pref.get("tomsplugin.IALA").equals("B")) { 663 tbM01Region.setSelected(true); 664 tbM01Region.setText("IALA-B"); 665 } else { 666 tbM01Region.setSelected(false); 667 tbM01Region.setText("IALA-A"); 668 } 669 670 tbM01Region.addActionListener(new java.awt.event.ActionListener() { 671 public void actionPerformed(java.awt.event.ActionEvent e) { 672 if (tbM01Region.isSelected()) { 673 buoy.setRegion(true); 674 tbM01Region.setText("IALA-B"); 675 } else { 676 buoy.setRegion(false); 677 tbM01Region.setText("IALA-A"); 678 } 679 buoy.paintSign(); 680 } 681 }); 682 } 683 684 return tbM01Region; 685 } 686 680 /* 681 * private JToggleButton getTbM01Region() { if (tbM01Region == null) { 682 * tbM01Region = new JToggleButton(); 683 * 684 * tbM01Region.setBounds(new Rectangle(60, 55, 80, 25)); 685 * tbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); 686 * tbM01Region.setEnabled(false); if 687 * (Main.pref.get("tomsplugin.IALA").equals("B")) { 688 * tbM01Region.setSelected(true); tbM01Region.setText("IALA-B"); } else { 689 * tbM01Region.setSelected(false); tbM01Region.setText("IALA-A"); } 690 * 691 * tbM01Region.addActionListener(new java.awt.event.ActionListener() { public 692 * void actionPerformed(java.awt.event.ActionEvent e) { if 693 * (tbM01Region.isSelected()) { buoy.setRegion(true); 694 * tbM01Region.setText("IALA-B"); } else { buoy.setRegion(false); 695 * tbM01Region.setText("IALA-A"); } buoy.paintSign(); } }); } 696 * 697 * return tbM01Region; } 698 */ 699 687 700 private JComboBox getCbM01StyleOfMark() { 688 701 if (cbM01StyleOfMark == null) { … … 829 842 // Deaktivierung des Listeners 830 843 DataSet.selListeners.remove(SmpListener); 831 //DataSet.removeSelectionListener(SmpListener);844 // DataSet.removeSelectionListener(SmpListener); 832 845 Selection = null; 833 846 SmpItem.setEnabled(true); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r22887 r22923 55 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 dlg.rbM01RegionA.setSelected(!region); 58 dlg.rbM01RegionB.setSelected(region); 59 59 } 60 60 … … 67 67 public void setFired(boolean fired) { 68 68 Fired = fired; 69 /*70 * if (dlg.cM01Fired == null) { return; }71 */72 dlg.cM01Fired.setSelected(fired);73 74 69 } 75 70 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java
r22887 r22923 35 35 dlg.cM01Fired.setSelected(false); 36 36 dlg.cM01TopMark.setSelected(false); 37 dlg.tbM01Region.setEnabled(false);38 37 39 38 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java
r22887 r22923 39 39 dlg.cM01TopMark.setSelected(true); 40 40 dlg.cM01TopMark.setEnabled(false); 41 dlg.tbM01Region.setEnabled(false);42 41 43 42 setColour(SeaMark.BLACK_RED_BLACK); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java
r22894 r22923 45 45 dlg.cM01Fired.setSelected(false); 46 46 dlg.cM01TopMark.setSelected(false); 47 dlg.tbM01Region.setEnabled(true);48 47 49 48 if (keys.containsKey("name")) … … 149 148 150 149 if (col.equals("red")) { 151 setRegion( SeaMark.IALA_A);152 setColour( SeaMark.RED);150 setRegion(IALA_A); 151 setColour(RED); 153 152 } else if (col.equals("green")) { 154 setRegion( SeaMark.IALA_B);155 setColour( SeaMark.GREEN);153 setRegion(IALA_B); 154 setColour(GREEN); 156 155 } else { 157 156 if (getRegion() == IALA_A) 158 setColour( SeaMark.RED);157 setColour(RED); 159 158 else 160 setColour( SeaMark.GREEN);159 setColour(GREEN); 161 160 } 162 161 } else if (cat.equals("starboard")) { … … 165 164 166 165 if (col.equals("green")) { 167 setRegion( SeaMark.IALA_A);168 setColour( SeaMark.GREEN);166 setRegion(IALA_A); 167 setColour(GREEN); 169 168 } else if (col.equals("red")) { 170 setRegion( SeaMark.IALA_B);171 setColour( SeaMark.RED);169 setRegion(IALA_B); 170 setColour(RED); 172 171 } else { 173 172 if (getRegion() == IALA_A) 174 setColour( SeaMark.GREEN);173 setColour(GREEN); 175 174 else 176 setColour( SeaMark.RED);175 setColour(RED); 177 176 } 178 177 } else if (cat.equals("preferred_channel_port")) { … … 181 180 182 181 if (col.equals("red;green;red")) { 183 setRegion( SeaMark.IALA_A);184 setColour( SeaMark.RED_GREEN_RED);182 setRegion(IALA_A); 183 setColour(RED_GREEN_RED); 185 184 } else if (col.equals("green;red;green")) { 186 setRegion( SeaMark.IALA_B);187 setColour( SeaMark.GREEN_RED_GREEN);185 setRegion(IALA_B); 186 setColour(GREEN_RED_GREEN); 188 187 } else { 189 188 if (getRegion() == IALA_A) 190 setColour( SeaMark.RED_GREEN_RED);189 setColour(RED_GREEN_RED); 191 190 else 192 setColour( SeaMark.GREEN_RED_GREEN);191 setColour(GREEN_RED_GREEN); 193 192 } 194 193 … … 198 197 199 198 if (col.equals("green;red;green")) { 200 setRegion( SeaMark.IALA_A);201 setColour( SeaMark.GREEN_RED_GREEN);199 setRegion(IALA_A); 200 setColour(GREEN_RED_GREEN); 202 201 } else if (col.equals("red;green;red")) { 203 setRegion( SeaMark.IALA_B);204 setColour( SeaMark.RED_GREEN_RED);202 setRegion(IALA_B); 203 setColour(RED_GREEN_RED); 205 204 } else { 206 205 if (getRegion() == IALA_A) 207 setColour( SeaMark.GREEN_RED_GREEN);206 setColour(GREEN_RED_GREEN); 208 207 else 209 setColour( SeaMark.RED_GREEN_RED);208 setColour(RED_GREEN_RED); 210 209 } 211 210 } … … 278 277 setLightChar(keys.get("seamark:light:character")); 279 278 setLightPeriod(keys); 280 } 279 setFired(true); 280 } 281 setLightColour(); 281 282 } 282 283 … … 364 365 365 366 switch (getBuoyIndex()) { 366 case SeaMark.PORT_HAND:367 if (region != SeaMark.IALA_B)367 case PORT_HAND: 368 if (region == IALA_A) 368 369 switch (style) { 369 370 case LAT_CAN: … … 417 418 break; 418 419 419 case S eaMark.STARBOARD_HAND:420 if (region != SeaMark.IALA_B)420 case STARBOARD_HAND: 421 if (region == IALA_A) 421 422 switch (style) { 422 423 case LAT_CONE: … … 470 471 break; 471 472 472 case SeaMark.PREF_PORT_HAND:473 if (region != SeaMark.IALA_B)473 case PREF_PORT_HAND: 474 if (region == IALA_A) 474 475 switch (style) { 475 476 case LAT_CAN: … … 517 518 break; 518 519 519 case SeaMark.PREF_STARBOARD_HAND:520 if (region != SeaMark.IALA_B)520 case PREF_STARBOARD_HAND: 521 if (region == IALA_A) 521 522 switch (style) { 522 523 case LAT_CONE: … … 655 656 Main.main.undoRedo.add(new ChangePropertyCommand(node, 656 657 "seamark:buoy_lateral:category", "port")); 657 if (getRegion() != SeaMark.IALA_B) {658 if (getRegion() == IALA_A) { 658 659 Main.main.undoRedo.add(new ChangePropertyCommand(node, 659 660 "seamark:buoy_lateral:colour", "red")); … … 673 674 Main.main.undoRedo.add(new ChangePropertyCommand(node, 674 675 "seamark:beacon_lateral:category", "port")); 675 if (getRegion() != SeaMark.IALA_B) {676 if (getRegion() == IALA_A) { 676 677 Main.main.undoRedo.add(new ChangePropertyCommand(node, 677 678 "seamark:beacon_lateral:colour", "red")); … … 684 685 break; 685 686 case LAT_FLOAT: 686 if (getRegion() != SeaMark.IALA_B) {687 if (getRegion() == IALA_A) { 687 688 Main.main.undoRedo.add(new ChangePropertyCommand(node, 688 689 "seamark:light_float:colour", "red")); … … 736 737 Main.main.undoRedo.add(new ChangePropertyCommand(node, 737 738 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); 738 if (getRegion() != SeaMark.IALA_B) {739 if (getRegion() == IALA_A) { 739 740 Main.main.undoRedo.add(new ChangePropertyCommand(node, 740 741 "seamark:buoy_lateral:colour", "red;green;red")); … … 752 753 Main.main.undoRedo.add(new ChangePropertyCommand(node, 753 754 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); 754 if (getRegion() != SeaMark.IALA_B) {755 if (getRegion() == IALA_A) { 755 756 Main.main.undoRedo.add(new ChangePropertyCommand(node, 756 757 "seamark:beacon_lateral:colour", "red;green;red")); … … 765 766 Main.main.undoRedo.add(new ChangePropertyCommand(node, 766 767 "seamark:light_float:colour_pattern", "horizontal stripes")); 767 if (getRegion() != SeaMark.IALA_B) {768 if (getRegion() == IALA_A) { 768 769 Main.main.undoRedo.add(new ChangePropertyCommand(node, 769 770 "seamark:light_float:colour", "red;green;red")); … … 822 823 Main.main.undoRedo.add(new ChangePropertyCommand(node, 823 824 "seamark:buoy_lateral:category", "starboard")); 824 if (getRegion() != SeaMark.IALA_B) {825 if (getRegion() == IALA_A) { 825 826 Main.main.undoRedo.add(new ChangePropertyCommand(node, 826 827 "seamark:buoy_lateral:colour", "green")); … … 836 837 Main.main.undoRedo.add(new ChangePropertyCommand(node, 837 838 "seamark:beacon_lateral:category", "starboard")); 838 if (getRegion() != SeaMark.IALA_B) {839 if (getRegion() == IALA_A) { 839 840 Main.main.undoRedo.add(new ChangePropertyCommand(node, 840 841 "seamark:beacon_lateral:colour", "green")); … … 847 848 break; 848 849 case LAT_FLOAT: 849 if (getRegion() != SeaMark.IALA_B) {850 if (getRegion() == IALA_A) { 850 851 Main.main.undoRedo.add(new ChangePropertyCommand(node, 851 852 "seamark:light_float:colour", "green")); … … 905 906 Main.main.undoRedo.add(new ChangePropertyCommand(node, 906 907 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); 907 if (getRegion() != SeaMark.IALA_B) {908 if (getRegion() == IALA_A) { 908 909 Main.main.undoRedo.add(new ChangePropertyCommand(node, 909 910 "seamark:buoy_lateral:colour", "green;red;green")); … … 921 922 Main.main.undoRedo.add(new ChangePropertyCommand(node, 922 923 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); 923 if (getRegion() != SeaMark.IALA_B) {924 if (getRegion() == IALA_A) { 924 925 Main.main.undoRedo.add(new ChangePropertyCommand(node, 925 926 "seamark:beacon_lateral:colour", "green;red;green")); … … 934 935 Main.main.undoRedo.add(new ChangePropertyCommand(node, 935 936 "seamark:light_float:colour_pattern", "horizontal stripes")); 936 if (getRegion() != SeaMark.IALA_B) {937 if (getRegion() == IALA_A) { 937 938 Main.main.undoRedo.add(new ChangePropertyCommand(node, 938 939 "seamark:light_float:colour", "green;red;green")); … … 958 959 959 960 public void setLightColour() { 960 if (getRegion() == IALA_A 961 && (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)) { 962 super.setLightColour("R"); 961 if (getRegion() == IALA_A) { 962 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 963 super.setLightColour("R"); 964 else 965 super.setLightColour("G"); 963 966 } else { 964 super.setLightColour("G"); 967 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 968 super.setLightColour("G"); 969 else 970 super.setLightColour("R"); 965 971 } 966 972 } … … 1011 1017 } 1012 1018 break; 1013 1014 1019 default: 1015 1020 } 1016 1017 1021 } 1018 1022 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java
r22692 r22923 31 31 dlg.cbM01Kennung.addItem("IQ"); 32 32 dlg.cbM01Kennung.setSelectedIndex(0); 33 34 dlg.tbM01Region.setEnabled(false);35 33 36 34 setBuoyIndex(type); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java
r22887 r22923 41 41 dlg.cM01Fired.setSelected(false); 42 42 dlg.cM01TopMark.setSelected(false); 43 dlg.tbM01Region.setEnabled(false);44 43 45 44 setColour(SeaMark.RED_WHITE); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java
r22887 r22923 51 51 dlg.cM01Fired.setEnabled(false); 52 52 dlg.cM01TopMark.setEnabled(true); 53 dlg.tbM01Region.setEnabled(false);54 53 55 54 setColour(SeaMark.YELLOW); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java
r22887 r22923 5 5 6 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.osm.Node;8 7 9 8 import toms.dialogs.SmpDialogAction; 10 import toms.seamarks.SeaMark;11 9 12 10 public class BuoyUkn extends Buoy { … … 24 22 dlg.cM01Fired.setSelected(false); 25 23 dlg.cM01TopMark.setSelected(false); 26 dlg.tbM01Region.setEnabled(false);27 24 28 25 setErrMsg(Msg);
Note:
See TracChangeset
for help on using the changeset viewer.