Changeset 24808 in osm for applications/editors/josm/plugins/smed/plugs
- Timestamp:
- 2010-12-19T16:18:51+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24801 r24808 32 32 33 33 private SmedPluginManager manager; 34 private OSeaMAction dia = null;35 34 public PanelMain panelMain = null; 36 35 … … 63 62 64 63 manager = mngr; 65 dia = this;66 64 String str = Main.pref.get("mappaint.style.sources"); 67 65 if (!str.contains("dev.openseamap.org")) { … … 97 95 manager.showVisualMessage(""); 98 96 if (ds == null) { 99 manager.showVisualMessage( tr("Active layer contains no OSM data"));97 manager.showVisualMessage(Messages.getString("NoData")); 100 98 mark = new MarkUkn(this, null); 101 99 return; … … 106 104 107 105 if (nodes == 0) { 108 manager.showVisualMessage( tr("Please select a node"));106 manager.showVisualMessage(Messages.getString("SelectNode")); 109 107 mark = new MarkUkn(this, null); 110 108 return; … … 112 110 113 111 if (nodes > 1) { 114 manager.showVisualMessage( tr("Please select only one node"));112 manager.showVisualMessage(Messages.getString("OneNode")); 115 113 mark = new MarkUkn(this, null); 116 114 return; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages.properties
r24742 r24808 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data 57 SelectNode=Please select a node 58 OneNode=Please select only one node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_de.properties
r24742 r24808 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data 57 SelectNode=Please select a node 58 OneNode=Please select only one node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_en.properties
r24742 r24808 54 54 SquareDayTip=Square daymark 55 55 MooringTopTip=Mooring 56 NoData=Active layer contains no OSM data 57 SelectNode=Please select a node 58 OneNode=Please select only one node -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r24724 r24808 30 30 private JRadioButton prefStbdButton = null; 31 31 private JRadioButton safeWaterButton = null; 32 private ActionListener alCat = null; 32 33 private PanelPort panelPort = null; 33 34 private PanelStbd panelStbd = null; … … 37 38 38 39 public PanelChan() { 39 super();40 40 panelPort = new PanelPort(); 41 41 panelPort.setBounds(new Rectangle(55, 0, 225, 160)); … … 53 53 panelSafeWater.setBounds(new Rectangle(55, 0, 225, 160)); 54 54 panelSafeWater.setVisible(false); 55 initialize();56 }57 58 private void initialize() {59 55 this.setLayout(null); 60 56 this.add(panelPort, null); … … 74 70 catButtons.add(prefStbdButton); 75 71 catButtons.add(safeWaterButton); 76 ActionListeneralCat = new ActionListener() {72 alCat = new ActionListener() { 77 73 public void actionPerformed(java.awt.event.ActionEvent e) { 78 74 if (portButton.isSelected()) { … … 118 114 prefStbdButton.addActionListener(alCat); 119 115 safeWaterButton.addActionListener(alCat); 116 } 117 118 public void clearSelections() { 119 catButtons.clearSelection(); 120 alCat.actionPerformed(null); 121 panelPort.clearSelections(); 122 panelStbd.clearSelections(); 123 panelPrefPort.clearSelections(); 124 panelPrefStbd.clearSelections(); 125 panelSafeWater.clearSelections(); 120 126 } 121 127 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java
r24737 r24808 37 37 public JRadioButton violetButton = null; 38 38 public JRadioButton blackButton = null; 39 private ActionListener alColour = null; 39 40 40 41 public PanelCol() { 41 42 super(); 42 initialize();43 }44 45 private void initialize() {46 43 this.setLayout(null); 47 44 … … 67 64 colourButtons.add(violetButton); 68 65 colourButtons.add(blackButton); 69 ActionListeneralColour = new ActionListener() {66 alColour = new ActionListener() { 70 67 public void actionPerformed(java.awt.event.ActionEvent e) { 71 68 offButton.setBorderPainted(offButton.isSelected()); … … 93 90 } 94 91 92 public void clearSelections() { 93 colourButtons.clearSelection(); 94 alColour.actionPerformed(null); 95 } 96 95 97 private JRadioButton getOffButton() { 96 98 if (offButton == null) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelFog.java
r24720 r24808 23 23 public class PanelFog extends JPanel { 24 24 25 26 25 public PanelFog() { 27 26 super(); 28 initialize();27 this.setLayout(null); 29 28 } 30 29 31 p rivate void initialize() {32 this.setLayout(null);30 public void clearSelections() { 31 33 32 } 33 34 34 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r24799 r24808 5 5 6 6 import java.awt.Color; 7 import java.awt.Dimension;8 7 import java.awt.Rectangle; 9 import java.awt.Font;10 8 11 9 import javax.swing.ButtonGroup; 12 10 import javax.swing.ImageIcon; 13 import javax.swing.JLabel;14 import javax.swing.JTextField;15 import javax.swing.JComboBox;16 import javax.swing.JCheckBox;17 11 import javax.swing.JRadioButton; 18 12 19 13 import oseam.Messages; 20 14 import oseam.dialogs.OSeaMAction; 21 import oseam.panels.PanelMain;22 15 import oseam.seamarks.SeaMark.Cat; 23 16 import oseam.seamarks.SeaMark.Col; 24 17 import oseam.seamarks.SeaMark.Styl; 25 18 26 import java.awt.Cursor;27 19 import java.awt.event.ActionListener; 28 20 … … 36 28 public JRadioButton westButton = null; 37 29 public JRadioButton isolButton = null; 30 private ActionListener alCat = null; 38 31 39 32 private ButtonGroup shapeButtons = null; … … 43 36 public JRadioButton beaconButton = null; 44 37 public JRadioButton towerButton = null; 38 private ActionListener alShape = null; 45 39 46 40 public PanelHaz(OSeaMAction dia) { … … 58 52 catButtons.add(westButton); 59 53 catButtons.add(isolButton); 60 ActionListeneralCat = new ActionListener() {54 alCat = new ActionListener() { 61 55 public void actionPerformed(java.awt.event.ActionEvent e) { 62 56 if (northButton.isSelected()) { … … 64 58 dlg.mark.setCategory(Cat.CARD_NORTH); 65 59 dlg.mark.setColour(Col.BLACK_YELLOW); 60 dlg.panelMain.panelTop.northTopButton.doClick(); 61 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 66 62 } else { 67 63 northButton.setBorderPainted(false); … … 71 67 dlg.mark.setCategory(Cat.CARD_SOUTH); 72 68 dlg.mark.setColour(Col.YELLOW_BLACK); 69 dlg.panelMain.panelTop.southTopButton.doClick(); 70 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 73 71 } else { 74 72 southButton.setBorderPainted(false); … … 78 76 dlg.mark.setCategory(Cat.CARD_EAST); 79 77 dlg.mark.setColour(Col.BLACK_YELLOW_BLACK); 78 dlg.panelMain.panelTop.eastTopButton.doClick(); 79 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 80 80 } else { 81 81 eastButton.setBorderPainted(false); … … 85 85 dlg.mark.setCategory(Cat.CARD_WEST); 86 86 dlg.mark.setColour(Col.YELLOW_BLACK_YELLOW); 87 dlg.panelMain.panelTop.westTopButton.doClick(); 88 dlg.panelMain.panelTop.panelCol.blackButton.doClick(); 87 89 } else { 88 90 westButton.setBorderPainted(false); … … 108 110 shapeButtons.add(beaconButton); 109 111 shapeButtons.add(towerButton); 110 ActionListeneralShape = new ActionListener() {112 alShape = new ActionListener() { 111 113 public void actionPerformed(java.awt.event.ActionEvent e) { 112 114 if (pillarButton.isSelected()) { … … 149 151 } 150 152 153 public void clearSelections() { 154 catButtons.clearSelection(); 155 alCat.actionPerformed(null); 156 shapeButtons.clearSelection(); 157 alShape.actionPerformed(null); 158 } 159 151 160 private JRadioButton getNothButton() { 152 161 if (northButton == null) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLights.java
r24724 r24808 33 33 public PanelLights() { 34 34 super(); 35 initialize();36 }37 38 private void initialize() {39 35 this.setLayout(null); 40 36 this.add(getHouseButton(), null); … … 63 59 vesselButton.addActionListener(alCat); 64 60 floatButton.addActionListener(alCat); 61 } 62 63 public void clearSelections() { 64 65 65 } 66 66 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java
r24737 r24808 29 29 panelCol = new PanelCol(); 30 30 panelCol.setBounds(new Rectangle(0, 0, 34, 160)); 31 initialize();32 }33 34 private void initialize() {35 31 this.setLayout(null); 36 32 this.add(panelCol, null); 37 33 panelCol.blackButton.setVisible(false); 38 34 } 35 36 public void clearSelections() { 37 38 } 39 39 40 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r24799 r24808 29 29 private JLabel fogIcon = null; 30 30 private JLabel nameLabel = null; 31 p rivateJTextField nameBox = null;31 public JTextField nameBox = null; 32 32 private JButton saveButton = null; 33 33 public ButtonGroup typeButtons = null; … … 36 36 public JRadioButton specButton = null; 37 37 public JRadioButton lightsButton = null; 38 private ActionListener alType ;38 private ActionListener alType = null; 39 39 private ButtonGroup miscButtons = null; 40 p rivateJRadioButton topButton = null;41 p rivateJRadioButton fogButton = null;42 p rivateJRadioButton radarButton = null;43 p rivateJRadioButton litButton = null;44 private ActionListener alMisc ;40 public JRadioButton topButton = null; 41 public JRadioButton fogButton = null; 42 public JRadioButton radarButton = null; 43 public JRadioButton litButton = null; 44 private ActionListener alMisc = null; 45 45 public PanelChan panelChan = null; 46 46 public PanelHaz panelHaz = null; 47 47 public PanelSpec panelSpec = null; 48 48 public PanelLights panelLights = null; 49 p rivatePanelTop panelTop = null;50 p rivatePanelFog panelFog = null;51 p rivatePanelRadar panelRadar = null;52 p rivatePanelLit panelLit = null;49 public PanelTop panelTop = null; 50 public PanelFog panelFog = null; 51 public PanelRadar panelRadar = null; 52 public PanelLit panelLit = null; 53 53 54 54 public PanelMain(OSeaMAction dia) { … … 221 221 miscButtons.clearSelection(); 222 222 alMisc.actionPerformed(null); 223 shapeIcon.setIcon(null); 224 lightIcon.setIcon(null); 225 topIcon.setIcon(null); 226 reflIcon.setIcon(null); 227 radarIcon.setIcon(null); 228 fogIcon.setIcon(null); 229 panelChan.clearSelections(); 230 panelHaz.clearSelections(); 231 panelSpec.clearSelections(); 232 panelLights.clearSelections(); 233 panelTop.clearSelections(); 234 panelFog.clearSelections(); 235 panelRadar.clearSelections(); 236 panelLit.clearSelections(); 223 237 } 224 238 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r24724 r24808 38 38 public PanelPort() { 39 39 super(); 40 initialize();41 }42 43 private void initialize() {44 40 this.setLayout(null); 45 41 this.add(getRegionAButton(), null); … … 91 87 towerButton.addActionListener(alShape); 92 88 perchButton.addActionListener(alShape); 89 } 90 91 public void clearSelections() { 92 93 93 } 94 94 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPrefPort.java
r24724 r24808 37 37 public PanelPrefPort() { 38 38 super(); 39 initialize();40 }41 42 private void initialize() {43 39 this.setLayout(null); 44 40 this.add(getRegionAButton(), null); … … 86 82 beaconButton.addActionListener(alShape); 87 83 towerButton.addActionListener(alShape); 84 } 85 86 public void clearSelections() { 87 88 88 } 89 89 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPrefStbd.java
r24724 r24808 37 37 public PanelPrefStbd() { 38 38 super(); 39 initialize();40 }41 42 private void initialize() {43 39 this.setLayout(null); 44 40 this.add(getRegionAButton(), null); … … 86 82 beaconButton.addActionListener(alShape); 87 83 towerButton.addActionListener(alShape); 84 } 85 86 public void clearSelections() { 87 88 88 } 89 89 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelRadar.java
r24720 r24808 26 26 public PanelRadar() { 27 27 super(); 28 initialize();28 this.setLayout(null); 29 29 } 30 30 31 p rivate void initialize() {32 this.setLayout(null);31 public void clearSelections() { 32 33 33 } 34 34 35 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSafeWater.java
r24724 r24808 33 33 public PanelSafeWater() { 34 34 super(); 35 initialize();36 }37 38 private void initialize() {39 35 this.setLayout(null); 40 36 this.add(getPillarButton(), null); … … 64 60 barrelButton.addActionListener(alShape); 65 61 floatButton.addActionListener(alShape); 62 } 63 64 public void clearSelections() { 65 66 66 } 67 67 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java
r24737 r24808 43 43 panelCol = new PanelCol(); 44 44 panelCol.setBounds(new Rectangle(9, 0, 34, 160)); 45 initialize();46 }47 48 private void initialize() {49 45 this.setLayout(null); 50 46 … … 98 94 } 99 95 96 public void clearSelections() { 97 98 } 99 100 100 private JRadioButton getPillarButton() { 101 101 if (pillarButton == null) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r24724 r24808 38 38 public PanelStbd() { 39 39 super(); 40 initialize();41 }42 43 private void initialize() {44 40 this.setLayout(null); 45 41 this.add(getRegionAButton(), null); … … 91 87 towerButton.addActionListener(alShape); 92 88 perchButton.addActionListener(alShape); 89 } 90 91 public void clearSelections() { 92 93 93 } 94 94 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelTop.java
r24742 r24808 25 25 public class PanelTop extends JPanel { 26 26 27 p rivatePanelCol panelCol = null;27 public PanelCol panelCol = null; 28 28 private ButtonGroup topButtons = null; 29 private JRadioButton noTopButton = null; 30 private JRadioButton canTopButton = null; 31 private JRadioButton coneTopButton = null; 32 private JRadioButton sphereTopButton = null; 33 private JRadioButton XTopButton = null; 34 private JRadioButton northTopButton = null; 35 private JRadioButton southTopButton = null; 36 private JRadioButton eastTopButton = null; 37 private JRadioButton westTopButton = null; 38 private JRadioButton spheres2TopButton = null; 39 private JRadioButton boardDayButton = null; 40 private JRadioButton diamondDayButton = null; 41 private JRadioButton triangleDayButton = null; 42 private JRadioButton triangleInvDayButton = null; 43 private JRadioButton squareDayButton = null; 44 private JRadioButton mooringTopButton = null; 29 public JRadioButton noTopButton = null; 30 public JRadioButton canTopButton = null; 31 public JRadioButton coneTopButton = null; 32 public JRadioButton sphereTopButton = null; 33 public JRadioButton XTopButton = null; 34 public JRadioButton northTopButton = null; 35 public JRadioButton southTopButton = null; 36 public JRadioButton eastTopButton = null; 37 public JRadioButton westTopButton = null; 38 public JRadioButton spheres2TopButton = null; 39 public JRadioButton boardDayButton = null; 40 public JRadioButton diamondDayButton = null; 41 public JRadioButton triangleDayButton = null; 42 public JRadioButton triangleInvDayButton = null; 43 public JRadioButton squareDayButton = null; 44 public JRadioButton mooringTopButton = null; 45 ActionListener alTop = null; 45 46 46 47 public PanelTop() { … … 48 49 panelCol = new PanelCol(); 49 50 panelCol.setBounds(new Rectangle(0, 0, 34, 160)); 50 initialize();51 }52 53 private void initialize() {54 51 this.setLayout(null); 55 52 this.add(panelCol, null); … … 87 84 topButtons.add(squareDayButton); 88 85 topButtons.add(mooringTopButton); 89 ActionListeneralTop = new ActionListener() {86 alTop = new ActionListener() { 90 87 public void actionPerformed(java.awt.event.ActionEvent e) { 91 88 noTopButton.setBorderPainted(noTopButton.isSelected()); … … 125 122 } 126 123 124 public void clearSelections() { 125 topButtons.clearSelection(); 126 alTop.actionPerformed(null); 127 panelCol.clearSelections(); 128 } 129 127 130 private JRadioButton getNoTopButton() { 128 131 if (noTopButton == null) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkCard.java
r24801 r24808 4 4 import javax.swing.ImageIcon; 5 5 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.command.ChangePropertyCommand; 6 8 import org.openstreetmap.josm.data.osm.Node; 7 9 … … 79 81 dlg.panelMain.panelHaz.sparButton.doClick(); 80 82 } 81 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { 82 if (keys.containsKey("seamark:beacon_cardinal:shape")) { 83 } else if (keys.containsKey("seamark:beacon_cardinal:shape")) { 83 84 str = keys.get("seamark:beacon_cardinal:shape"); 84 85 if (str.equals("tower")) { … … 87 88 dlg.panelMain.panelHaz.beaconButton.doClick(); 88 89 } 89 } else {90 dlg.panelMain.panelHaz.beaconButton.doClick();91 }92 90 } else if (keys.containsKey("seamark:type") 93 91 && (keys.get("seamark:type").equals("light_float"))) { … … 95 93 } 96 94 97 // refreshLights(); 98 // parseLights(keys); 99 // parseFogRadar(keys); 95 parseLights(keys); 96 parseFogRadar(keys); 100 97 101 98 // dlg.cbM01CatOfMark.setSelectedIndex(getMarkIndex()); … … 105 102 } 106 103 107 /*108 * public void refreshLights() { dlg.cbM01Kennung.removeAllItems();109 * dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212"));110 * //$NON-NLS-1$ dlg.cbM01Kennung.setSelectedIndex(0);111 *112 * switch (getMarkIndex()) { case CARD_NORTH: dlg.cbM01Kennung.addItem("Q");113 * //$NON-NLS-1$ dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ break; case114 * CARD_EAST: dlg.cbM01Kennung.addItem("Q(3)"); //$NON-NLS-1$115 * dlg.cbM01Kennung.addItem("VQ(3)"); //$NON-NLS-1$ break; case CARD_SOUTH:116 * dlg.cbM01Kennung.addItem("Q(6)+LFl"); //$NON-NLS-1$117 * dlg.cbM01Kennung.addItem("VQ(6)+LFl"); //$NON-NLS-1$ break; case118 * CARD_WEST: dlg.cbM01Kennung.addItem("Q(9)"); //$NON-NLS-1$119 * dlg.cbM01Kennung.addItem("VQ(9)"); //$NON-NLS-1$ break; } }120 */121 104 public boolean isValid() { 122 105 return (getCategory() != Cat.UNKNOWN_CAT) … … 124 107 } 125 108 126 /* 127 * public void setLightColour() { super.setLightColour("W"); } 128 */ 109 public void setLightColour() { 110 super.setLightColour("W"); 111 } 112 129 113 public void paintSign() { 130 114 /* 131 *if (dlg.paintlock) return; super.paintSign();115 if (dlg.paintlock) return; super.paintSign(); 132 116 */ 133 117 if (isValid()) { 134 118 /* 135 *dlg.tfM01Name.setEnabled(true); dlg.tfM01Name.setText(getName());136 *dlg.cM01TopMark.setSelected(true);137 *dlg.cM01TopMark.setVisible(true);138 *dlg.cM01TopMark.setEnabled(false);139 *dlg.cM01Radar.setVisible(true); dlg.cM01Racon.setVisible(true);140 *dlg.cM01Fog.setVisible(true); dlg.cM01Fired.setEnabled(true);141 *dlg.cM01Fired.setVisible(true); dlg.tfM01Group.setVisible(false);142 *dlg.lM01Group.setVisible(false); if (!isSectored()) {143 *dlg.cbM01Colour.setVisible(false);144 *dlg.lM01Colour.setVisible(false); }145 *dlg.rbM01Fired1.setVisible(false);146 *dlg.rbM01FiredN.setVisible(false);147 *dlg.lM01Height.setVisible(false);148 *dlg.tfM01Height.setVisible(false);149 *dlg.lM01Range.setVisible(false);150 *dlg.tfM01Range.setVisible(false);151 *152 *if (isFired()) { switch (getStyleIndex()) { case CARD_BEACON:153 *case CARD_TOWER: case CARD_FLOAT:154 *dlg.lM01Height.setVisible(true);155 *dlg.tfM01Height.setVisible(true); dlg.lM01Range.setVisible(true);156 *dlg.tfM01Range.setVisible(true); break; default: } }119 dlg.tfM01Name.setEnabled(true); dlg.tfM01Name.setText(getName()); 120 dlg.cM01TopMark.setSelected(true); 121 dlg.cM01TopMark.setVisible(true); 122 dlg.cM01TopMark.setEnabled(false); 123 dlg.cM01Radar.setVisible(true); dlg.cM01Racon.setVisible(true); 124 dlg.cM01Fog.setVisible(true); dlg.cM01Fired.setEnabled(true); 125 dlg.cM01Fired.setVisible(true); dlg.tfM01Group.setVisible(false); 126 dlg.lM01Group.setVisible(false); if (!isSectored()) { 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()) { switch (getStyleIndex()) { case CARD_BEACON: 137 case CARD_TOWER: case CARD_FLOAT: 138 dlg.lM01Height.setVisible(true); 139 dlg.tfM01Height.setVisible(true); dlg.lM01Range.setVisible(true); 140 dlg.tfM01Range.setVisible(true); break; default: } } 157 141 */ 158 142 String image = "/images/Cardinal"; … … 204 188 205 189 public void saveSign() { 206 /* 207 * Node node = getNode(); if (node == null) { return; } 208 * 209 * String shape = ""; //$NON-NLS-1$ 210 * 211 * switch (getStyleIndex()) { case CARD_PILLAR: 212 * super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 213 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 214 * "seamark:buoy_cardinal:shape", "pillar")); //$NON-NLS-1$ 215 * //$NON-NLS-2$ break; case CARD_SPAR: super.saveSign("buoy_cardinal"); 216 * //$NON-NLS-1$ Main.main.undoRedo.add(new ChangePropertyCommand(node, 217 * "seamark:buoy_cardinal:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 218 * break; case CARD_BEACON: super.saveSign("beacon_cardinal"); 219 * //$NON-NLS-1$ break; case CARD_TOWER: 220 * super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 221 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 222 * "seamark:beacon_cardinal:shape", "tower")); //$NON-NLS-1$ 223 * //$NON-NLS-2$ break; case CARD_FLOAT: super.saveSign("light_float"); 224 * //$NON-NLS-1$ break; default: } 225 * 226 * switch (getStyleIndex()) { case CARD_PILLAR: case CARD_SPAR: switch 227 * (getMarkIndex()) { case SeaMark.CARD_NORTH: 228 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 229 * "seamark:buoy_cardinal:category", "north")); //$NON-NLS-1$ 230 * //$NON-NLS-2$ Main.main.undoRedo.add(new ChangePropertyCommand(node, 231 * "seamark:buoy_cardinal:colour", "black;yellow")); //$NON-NLS-1$ 232 * //$NON-NLS-2$ shape = "2 cones up"; //$NON-NLS-1$ break; 233 * 234 * case SeaMark.CARD_EAST: Main.main.undoRedo.add(new 235 * ChangePropertyCommand(node, "seamark:buoy_cardinal:category", 236 * "east")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 237 * ChangePropertyCommand(node, "seamark:buoy_cardinal:colour", 238 * "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 239 * "2 cones base together"; //$NON-NLS-1$ break; 240 * 241 * case SeaMark.CARD_SOUTH: Main.main.undoRedo.add(new 242 * ChangePropertyCommand(node, "seamark:buoy_cardinal:category", 243 * "south")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 244 * ChangePropertyCommand(node, "seamark:buoy_cardinal:colour", 245 * "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = "2 cones down"; 246 * //$NON-NLS-1$ break; 247 * 248 * case SeaMark.CARD_WEST: Main.main.undoRedo.add(new 249 * ChangePropertyCommand(node, "seamark:buoy_cardinal:category", 250 * "west")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 251 * ChangePropertyCommand(node, "seamark:buoy_cardinal:colour", 252 * "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 253 * "2 cones point together"; //$NON-NLS-1$ break; } 254 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 255 * "seamark:buoy_cardinal:colour_pattern", "horizontal stripes")); 256 * //$NON-NLS-1$ //$NON-NLS-2$ break; case CARD_BEACON: case CARD_TOWER: 257 * switch (getMarkIndex()) { case SeaMark.CARD_NORTH: 258 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 259 * "seamark:beacon_cardinal:category", "north")); //$NON-NLS-1$ 260 * //$NON-NLS-2$ Main.main.undoRedo.add(new ChangePropertyCommand(node, 261 * "seamark:beacon_cardinal:colour", "black;yellow")); //$NON-NLS-1$ 262 * //$NON-NLS-2$ shape = "2 cones up"; //$NON-NLS-1$ break; 263 * 264 * case SeaMark.CARD_EAST: Main.main.undoRedo.add(new 265 * ChangePropertyCommand(node, "seamark:beacon_cardinal:category", 266 * "east")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 267 * ChangePropertyCommand(node, "seamark:beacon_cardinal:colour", 268 * "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 269 * "2 cones base together"; //$NON-NLS-1$ break; 270 * 271 * case SeaMark.CARD_SOUTH: Main.main.undoRedo.add(new 272 * ChangePropertyCommand(node, "seamark:beacon_cardinal:category", 273 * "south")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 274 * ChangePropertyCommand(node, "seamark:beacon_cardinal:colour", 275 * "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = "2 cones down"; 276 * //$NON-NLS-1$ break; 277 * 278 * case SeaMark.CARD_WEST: Main.main.undoRedo.add(new 279 * ChangePropertyCommand(node, "seamark:beacon_cardinal:category", 280 * "west")); //$NON-NLS-1$ //$NON-NLS-2$ Main.main.undoRedo.add(new 281 * ChangePropertyCommand(node, "seamark:beacon_cardinal:colour", 282 * "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 283 * "2 cones point together"; //$NON-NLS-1$ break; } 284 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 285 * "seamark:beacon_cardinal:colour_pattern", "horizontal stripes")); 286 * //$NON-NLS-1$ //$NON-NLS-2$ break; case CARD_FLOAT: switch 287 * (getMarkIndex()) { case SeaMark.CARD_NORTH: 288 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 289 * "seamark:light_float:colour", "black;yellow")); //$NON-NLS-1$ 290 * //$NON-NLS-2$ shape = "2 cones up"; //$NON-NLS-1$ break; 291 * 292 * case SeaMark.CARD_EAST: Main.main.undoRedo.add(new 293 * ChangePropertyCommand(node, "seamark:light_float:colour", 294 * "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 295 * "2 cones base together"; //$NON-NLS-1$ break; 296 * 297 * case SeaMark.CARD_SOUTH: Main.main.undoRedo.add(new 298 * ChangePropertyCommand(node, "seamark:light_float:colour", 299 * "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ shape = "2 cones down"; 300 * //$NON-NLS-1$ break; 301 * 302 * case SeaMark.CARD_WEST: Main.main.undoRedo.add(new 303 * ChangePropertyCommand(node, "seamark:light_float:colour", 304 * "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ shape = 305 * "2 cones point together"; //$NON-NLS-1$ break; } 306 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 307 * "seamark:light_float:colour_pattern", "horizontal stripes")); 308 * //$NON-NLS-1$ //$NON-NLS-2$ break; } saveTopMarkData(shape, "black"); 309 * //$NON-NLS-1$ saveLightData(); //$NON-NLS-1$ saveRadarFogData(); 310 */} 190 Node node = getNode(); 191 if (node == null) 192 return; 193 194 String shape = ""; 195 196 switch (getShape()) { 197 case PILLAR: 198 super.saveSign("buoy_cardinal"); 199 Main.main.undoRedo.add(new ChangePropertyCommand(node, 200 "seamark:buoy_cardinal:shape", "pillar")); 201 break; 202 case SPAR: 203 super.saveSign("buoy_cardinal"); 204 Main.main.undoRedo.add(new ChangePropertyCommand(node, 205 "seamark:buoy_cardinal:shape", "spar")); 206 break; 207 case BEACON: 208 super.saveSign("beacon_cardinal"); 209 break; 210 case TOWER: 211 super.saveSign("beacon_cardinal"); 212 Main.main.undoRedo.add(new ChangePropertyCommand(node, 213 "seamark:beacon_cardinal:shape", "tower")); 214 break; 215 case FLOAT: 216 super.saveSign("light_float"); 217 break; 218 default: 219 } 220 221 switch (getShape()) { 222 case PILLAR: 223 case SPAR: 224 switch (getCategory()) { 225 case CARD_NORTH: 226 Main.main.undoRedo.add(new ChangePropertyCommand(node, 227 "seamark:buoy_cardinal:category", "north")); 228 Main.main.undoRedo.add(new ChangePropertyCommand(node, 229 "seamark:buoy_cardinal:colour", "black;yellow")); 230 shape = "2 cones up"; 231 break; 232 233 case CARD_EAST: 234 Main.main.undoRedo.add(new ChangePropertyCommand(node, 235 "seamark:buoy_cardinal:category", "east")); 236 Main.main.undoRedo.add(new ChangePropertyCommand(node, 237 "seamark:buoy_cardinal:colour", "black;yellow;black")); 238 shape = "2 cones base together"; 239 break; 240 241 case CARD_SOUTH: 242 Main.main.undoRedo.add(new ChangePropertyCommand(node, 243 "seamark:buoy_cardinal:category", "south")); 244 Main.main.undoRedo.add(new ChangePropertyCommand(node, 245 "seamark:buoy_cardinal:colour", "yellow;black")); 246 shape = "2 cones down"; 247 break; 248 249 case CARD_WEST: 250 Main.main.undoRedo.add(new ChangePropertyCommand(node, 251 "seamark:buoy_cardinal:category", "west")); 252 Main.main.undoRedo.add(new ChangePropertyCommand(node, 253 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); 254 shape = "2 cones point together"; 255 break; 256 } 257 Main.main.undoRedo.add(new ChangePropertyCommand(node, 258 "seamark:buoy_cardinal:colour_pattern", 259 "horizontal stripes")); 260 break; 261 262 case BEACON: 263 case TOWER: 264 switch (getCategory()) { 265 case CARD_NORTH: 266 Main.main.undoRedo.add(new ChangePropertyCommand(node, 267 "seamark:beacon_cardinal:category", "north")); 268 Main.main.undoRedo.add(new ChangePropertyCommand(node, 269 "seamark:beacon_cardinal:colour", "black;yellow")); 270 shape = "2 cones up"; 271 break; 272 273 case CARD_EAST: 274 Main.main.undoRedo.add(new ChangePropertyCommand(node, 275 "seamark:beacon_cardinal:category", "east")); 276 Main.main.undoRedo 277 .add(new ChangePropertyCommand(node, 278 "seamark:beacon_cardinal:colour", 279 "black;yellow;black")); 280 shape = "2 cones base together"; 281 break; 282 283 case CARD_SOUTH: 284 Main.main.undoRedo.add(new ChangePropertyCommand(node, 285 "seamark:beacon_cardinal:category", "south")); 286 Main.main.undoRedo.add(new ChangePropertyCommand(node, 287 "seamark:beacon_cardinal:colour", "yellow;black")); 288 shape = "2 cones down"; 289 break; 290 291 case CARD_WEST: 292 Main.main.undoRedo.add(new ChangePropertyCommand(node, 293 "seamark:beacon_cardinal:category", "west")); 294 Main.main.undoRedo 295 .add(new ChangePropertyCommand(node, 296 "seamark:beacon_cardinal:colour", 297 "yellow;black;yellow")); 298 shape = "2 cones point together"; 299 break; 300 } 301 Main.main.undoRedo.add(new ChangePropertyCommand(node, 302 "seamark:beacon_cardinal:colour_pattern", 303 "horizontal stripes")); 304 break; 305 306 case FLOAT: 307 switch (getCategory()) { 308 case CARD_NORTH: 309 Main.main.undoRedo.add(new ChangePropertyCommand(node, 310 "seamark:light_float:colour", "black;yellow")); 311 shape = "2 cones up"; 312 break; 313 314 case CARD_EAST: 315 Main.main.undoRedo.add(new ChangePropertyCommand(node, 316 "seamark:light_float:colour", "black;yellow;black")); 317 shape = "2 cones base together"; 318 break; 319 320 case CARD_SOUTH: 321 Main.main.undoRedo.add(new ChangePropertyCommand(node, 322 "seamark:light_float:colour", "yellow;black")); 323 shape = "2 cones down"; 324 break; 325 326 case CARD_WEST: 327 Main.main.undoRedo.add(new ChangePropertyCommand(node, 328 "seamark:light_float:colour", "yellow;black;yellow")); 329 shape = "2 cones point together"; 330 break; 331 } 332 Main.main.undoRedo 333 .add(new ChangePropertyCommand(node, 334 "seamark:light_float:colour_pattern", 335 "horizontal stripes")); 336 break; 337 } 338 saveTopMarkData(shape, "black"); 339 saveLightData(); 340 saveRadarFogData(); 341 } 311 342 312 343 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/MarkIsol.java
r24801 r24808 7 7 import oseam.dialogs.OSeaMAction; 8 8 import oseam.seamarks.SeaMark; 9 import oseam.seamarks.SeaMark.Cat; 10 import oseam.seamarks.SeaMark.Styl; 9 11 10 12 public class MarkIsol extends SeaMark { … … 18 20 Map<String, String> keys; 19 21 keys = getNode().getKeys(); 20 /* 21 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER); 22 23 dlg.cbM01StyleOfMark.removeAllItems(); 24 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 25 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 26 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 27 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 28 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 29 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 30 dlg.cbM01StyleOfMark.setVisible(true); 31 dlg.lM01StyleOfMark.setVisible(true); 32 33 setBuoyIndex(ISOLATED_DANGER); 34 setColour(SeaMark.BLACK_RED_BLACK); 35 setLightColour("W"); //$NON-NLS-1$ 36 setTopMark(true); 37 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 38 39 if (keys.containsKey("name")) //$NON-NLS-1$ 40 setName(keys.get("name")); //$NON-NLS-1$ 41 42 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 43 setName(keys.get("seamark:name")); //$NON-NLS-1$ 44 45 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$ 46 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$ 47 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$ 48 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$ 49 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 51 52 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$ 53 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$ 54 55 if (str.equals("pillar")) //$NON-NLS-1$ 56 setStyleIndex(ISOL_PILLAR); 57 else if (str.equals("spar")) //$NON-NLS-1$ 58 setStyleIndex(ISOL_SPAR); 59 } else if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$ 60 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$ 61 62 if (str.equals("tower")) //$NON-NLS-1$ 63 setStyleIndex(ISOL_TOWER); 64 else 65 setStyleIndex(ISOL_BEACON); 66 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 67 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 68 setStyleIndex(ISOL_FLOAT); 69 } 70 71 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 72 setStyleIndex(0); 73 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 74 75 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 76 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 77 setTopMark(true); 78 } 79 80 refreshLights(); 22 23 if (!dlg.panelMain.hazButton.isSelected()) 24 dlg.panelMain.hazButton.doClick(); 25 26 if (keys.containsKey("name")) 27 setName(keys.get("name")); 28 29 if (keys.containsKey("seamark:name")) 30 setName(keys.get("seamark:name")); 31 32 if (keys.containsKey("seamark:buoy_isolated_danger:name")) 33 setName(keys.get("seamark:buoy_isolated_danger:name")); 34 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) 35 setName(keys.get("seamark:beacon_isolated_danger:name")); 36 else if (keys.containsKey("seamark:light_float:name")) 37 setName(keys.get("seamark:light_float:name")); 38 39 dlg.panelMain.panelHaz.isolButton.doClick(); 40 41 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { 42 str = keys.get("seamark:buoy_isolated_danger:shape"); 43 44 if (str.equals("pillar")) { 45 dlg.panelMain.panelHaz.pillarButton.doClick(); 46 } else if (str.equals("spar")) { 47 dlg.panelMain.panelHaz.sparButton.doClick(); 48 } 49 } else if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { 50 str = keys.get("seamark:beacon_isolated_danger:shape"); 51 if (str.equals("tower")) { 52 dlg.panelMain.panelHaz.towerButton.doClick(); 53 } else { 54 dlg.panelMain.panelHaz.beaconButton.doClick(); 55 } 56 } else if (keys.containsKey("seamark:type") 57 && (keys.get("seamark:type").equals("light_float"))) { 58 dlg.panelMain.panelHaz.floatButton.doClick(); 59 } 60 81 61 parseLights(keys); 82 62 parseFogRadar(keys); 83 63 84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 85 dlg.tfM01Name.setText(getName()); 86 dlg.cM01TopMark.setSelected(hasTopMark()); 87 */ } 88 /* 89 public void refreshLights() { 90 dlg.cbM01Kennung.removeAllItems(); 91 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 92 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$ 93 dlg.cbM01Kennung.setSelectedIndex(0); 64 // dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 65 // dlg.tfM01Name.setText(getName()); 66 // dlg.cM01TopMark.setSelected(hasTopMark()); 94 67 } 95 68 96 69 public boolean isValid() { 97 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 70 return (getCategory() != Cat.UNKNOWN_CAT) 71 && (getShape() != Styl.UNKNOWN_SHAPE); 98 72 } 99 73 100 74 public void setLightColour() { 101 super.setLightColour("W"); //$NON-NLS-1$102 } 103 */ 75 super.setLightColour("W"); 76 } 77 104 78 public void paintSign() { 105 79 /* if (dlg.paintlock) -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24801 r24808 2 2 3 3 import java.util.Iterator; 4 import java.util.Map; 5 import java.util.regex.Matcher; 6 import java.util.regex.Pattern; 4 7 5 8 import org.openstreetmap.josm.Main; … … 11 14 abstract public class SeaMark { 12 15 13 public enum Type {UNKNOWN_TYPE, LATERAL, CARDINAL, SAFE_WATER, ISOLATED_DANGER, SPECIAL_PURPOSE, LIGHT} 14 15 public enum Cat {UNKNOWN_CAT, PORT_HAND, STARBOARD_HAND, PREF_PORT_HAND, PREF_STARBOARD_HAND, CARD_NORTH, CARD_EAST, CARD_SOUTH, CARD_WEST, LIGHT_HOUSE, LIGHT_MAJOR, LIGHT_MINOR, LIGHT_VESSEL} 16 public enum Type { 17 UNKNOWN_TYPE, LATERAL, CARDINAL, SAFE_WATER, ISOLATED_DANGER, SPECIAL_PURPOSE, LIGHT 18 } 19 20 public enum Cat { 21 UNKNOWN_CAT, PORT_HAND, STARBOARD_HAND, PREF_PORT_HAND, PREF_STARBOARD_HAND, CARD_NORTH, CARD_EAST, CARD_SOUTH, CARD_WEST, LIGHT_HOUSE, LIGHT_MAJOR, LIGHT_MINOR, LIGHT_VESSEL 22 } 16 23 17 24 public final static boolean IALA_A = false; 18 25 public final static boolean IALA_B = true; 19 26 20 public enum Styl {UNKNOWN_SHAPE, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, BEACON, TOWER, STAKE, PERCH} 21 22 public enum Col {UNKNOWN_COLOUR, RED, GREEN, RED_GREEN_RED, GREEN_RED_GREEN, RED_WHITE, BLACK_YELLOW, BLACK_YELLOW_BLACK, YELLOW_BLACK, YELLOW_BLACK_YELLOW, BLACK_RED_BLACK, YELLOW} 23 27 public enum Styl { 28 UNKNOWN_SHAPE, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, BEACON, TOWER, STAKE, PERCH 29 } 30 31 public enum Col { 32 UNKNOWN_COLOUR, RED, GREEN, RED_GREEN_RED, GREEN_RED_GREEN, RED_WHITE, BLACK_YELLOW, BLACK_YELLOW_BLACK, YELLOW_BLACK, YELLOW_BLACK_YELLOW, BLACK_RED_BLACK, YELLOW 33 } 34 24 35 public final static int WHITE_LIGHT = 1; 25 36 public final static int RED_LIGHT = 2; … … 68 79 } 69 80 70 public void setDlg(OSeaMAction dia) {71 dlg = dia;72 }73 74 81 protected SeaMark(OSeaMAction dia, Node node) { 75 82 dlg = dia; … … 157 164 } 158 165 166 private boolean Radar = false; 167 168 public boolean hasRadar() { 169 return Radar; 170 } 171 172 public void setRadar(boolean radar) { 173 Radar = radar; 174 } 175 176 private boolean Racon = false; 177 178 public boolean hasRacon() { 179 return Racon; 180 } 181 182 public void setRacon(boolean racon) { 183 Racon = racon; 184 } 185 186 private int RaType = 0; 187 188 public int getRaType() { 189 return RaType; 190 } 191 192 public void setRaType(int type) { 193 RaType = type; 194 } 195 196 private String RaconGroup = ""; 197 198 public String getRaconGroup() { 199 return RaconGroup; 200 } 201 202 public void setRaconGroup(String raconGroup) { 203 RaconGroup = raconGroup; 204 } 205 206 private boolean Fog = false; 207 208 public boolean hasFog() { 209 return Fog; 210 } 211 212 public void setFog(boolean fog) { 213 Fog = fog; 214 } 215 216 private int FogSound = 0; 217 218 public int getFogSound() { 219 return FogSound; 220 } 221 222 public void setFogSound(int sound) { 223 FogSound = sound; 224 } 225 226 private String FogGroup = ""; 227 228 public String getFogGroup() { 229 return FogGroup; 230 } 231 232 public void setFogGroup(String group) { 233 FogGroup = group; 234 } 235 236 private String FogPeriod = ""; 237 238 public String getFogPeriod() { 239 return FogPeriod; 240 } 241 242 public void setFogPeriod(String period) { 243 FogPeriod = period; 244 } 245 246 private boolean Fired = false; 247 248 public boolean isFired() { 249 return Fired; 250 } 251 252 public void setFired(boolean fired) { 253 Fired = fired; 254 } 255 256 private boolean Sectored = false; 257 258 public boolean isSectored() { 259 return Sectored; 260 } 261 262 public void setSectored(boolean sectored) { 263 Sectored = sectored; 264 if (sectored) { 265 LightColour[0] = ""; 266 } else { 267 setSectorIndex(0); 268 setLightChar(""); 269 setLightColour(""); 270 setLightGroup(""); 271 setHeight(""); 272 setRange(""); 273 setBearing1(""); 274 setBearing2(""); 275 setRadius(""); 276 } 277 } 278 159 279 private int SectorIndex = 0; 160 280 … … 165 285 public void setSectorIndex(int sector) { 166 286 SectorIndex = sector; 287 } 288 289 private String[] LightChar = new String[10]; 290 291 public String getLightChar() { 292 if (LightChar[SectorIndex] == null) 293 return (LightChar[0]); 294 return LightChar[SectorIndex]; 295 } 296 297 public void setLightChar(String lightChar) { 298 if (SectorIndex == 0) { 299 LightChar = new String[10]; 300 LightChar[0] = lightChar; 301 } else if (LightChar[0].isEmpty()) 302 LightChar[SectorIndex] = lightChar; 167 303 } 168 304 … … 179 315 } 180 316 317 private String[] LightGroup = new String[10]; 318 319 public String getLightGroup() { 320 if (LightGroup[SectorIndex] == null) 321 return (LightGroup[0]); 322 return LightGroup[SectorIndex]; 323 } 324 325 public void setLightGroup(String lightGroup) { 326 if (SectorIndex == 0) 327 LightGroup = new String[10]; 328 LightGroup[SectorIndex] = lightGroup; 329 } 330 331 protected void setLightGroup(Map<String, String> k) { 332 String s = ""; 333 if (k.containsKey("seamark:light:group")) { 334 s = k.get("seamark:light:group"); 335 setLightGroup(s); 336 } 337 } 338 339 private String[] Height = new String[10]; 340 341 public String getHeight() { 342 if (Height[SectorIndex] == null) 343 return (Height[0]); 344 return Height[SectorIndex]; 345 } 346 347 public void setHeight(String height) { 348 if (SectorIndex == 0) 349 Height = new String[10]; 350 Height[SectorIndex] = height; 351 } 352 353 private String[] Range = new String[10]; 354 355 public String getRange() { 356 if (Range[SectorIndex] == null) 357 return (Range[0]); 358 return Range[SectorIndex]; 359 } 360 361 public void setRange(String range) { 362 if (SectorIndex == 0) 363 Range = new String[10]; 364 Range[SectorIndex] = range; 365 } 366 367 private String[] Bearing1 = new String[10]; 368 369 public String getBearing1() { 370 if (Bearing1[SectorIndex] == null) 371 return (Bearing1[0]); 372 return Bearing1[SectorIndex]; 373 } 374 375 public void setBearing1(String bearing) { 376 if (SectorIndex == 0) 377 Bearing1 = new String[10]; 378 Bearing1[SectorIndex] = bearing; 379 } 380 381 private String[] Bearing2 = new String[10]; 382 383 public String getBearing2() { 384 if (Bearing2[SectorIndex] == null) 385 return (Bearing2[0]); 386 return Bearing2[SectorIndex]; 387 } 388 389 public void setBearing2(String bearing) { 390 if (SectorIndex == 0) 391 Bearing2 = new String[10]; 392 Bearing2[SectorIndex] = bearing; 393 } 394 395 private String[] Radius = new String[10]; 396 397 public String getRadius() { 398 if (Radius[SectorIndex] == null) 399 return (Radius[0]); 400 return Radius[SectorIndex]; 401 } 402 403 public void setRadius(String radius) { 404 if (SectorIndex == 0) 405 Radius = new String[10]; 406 Radius[SectorIndex] = radius; 407 } 408 409 private String[] LightPeriod = new String[10]; 410 411 public String getLightPeriod() { 412 if (LightPeriod[SectorIndex] == null) 413 return (LightPeriod[0]); 414 return LightPeriod[SectorIndex]; 415 } 416 417 public void setLightPeriod(String lightPeriod) { 418 String regex = "^[\\d\\s.]+$"; 419 420 if (!lightPeriod.isEmpty()) { 421 422 Pattern pat = Pattern.compile(regex); 423 Matcher matcher = pat.matcher(lightPeriod); 424 425 if (matcher.find()) { 426 setErrMsg(null); 427 } else { 428 setErrMsg("Must be a number"); 429 lightPeriod = ""; 430 // dlg.tfM01RepeatTime.requestFocus(); 431 } 432 } 433 if (SectorIndex == 0) 434 LightPeriod = new String[10]; 435 LightPeriod[SectorIndex] = lightPeriod; 436 } 437 181 438 public abstract void parseMark(); 182 439 440 public void parseLights(Map<String, String> k) { 441 setFired(false); 442 setSectored(false); 443 Iterator it = k.entrySet().iterator(); 444 while (it.hasNext()) { 445 Map.Entry entry = (Map.Entry) it.next(); 446 String key = (String) entry.getKey(); 447 String value = ((String) entry.getValue()).trim(); 448 if (key.contains("seamark:light:")) { 449 setFired(true); 450 int index = 0; 451 key = key.substring(14); 452 if (key.matches("^\\d:.*")) { 453 index = key.charAt(0) - '0'; 454 key = key.substring(2); 455 } else if (key.matches("^\\d$")) { 456 index = key.charAt(0) - '0'; 457 String values[] = value.split(":"); 458 if (values[0].equals("red")) 459 LightColour[index] = "R"; 460 else if (values[0].equals("green")) 461 LightColour[index] = "G"; 462 else if (values[0].equals("white")) 463 LightColour[index] = "W"; 464 if (values.length > 1) 465 Bearing1[index] = values[1]; 466 if (values.length > 2) 467 Bearing2[index] = values[2]; 468 if (values.length > 3) 469 Radius[index] = values[3]; 470 } else { 471 index = 0; 472 } 473 if (index != 0) 474 setSectored(true); 475 if (key.equals("colour")) { 476 if (value.equals("red")) 477 LightColour[index] = "R"; 478 else if (value.equals("green")) 479 LightColour[index] = "G"; 480 else if (value.equals("white")) 481 LightColour[index] = "W"; 482 } else if (key.equals("character")) { 483 LightChar[index] = value; 484 } else if (key.equals("group")) { 485 LightGroup[index] = value; 486 } else if (key.equals("period")) { 487 LightPeriod[index] = value; 488 } else if (key.equals("height")) { 489 Height[index] = value; 490 } else if (key.equals("range")) { 491 Range[index] = value; 492 } 493 } 494 } 495 setSectorIndex(0); 496 // dlg.cbM01Sector.setSelectedIndex(0); 497 // dlg.cM01Fired.setSelected(isFired()); 498 // dlg.rbM01Fired1.setSelected(!isSectored()); 499 // dlg.rbM01FiredN.setSelected(isSectored()); 500 // dlg.cbM01Kennung.setSelectedItem(getLightChar()); 501 // dlg.tfM01Height.setText(getHeight()); 502 // dlg.tfM01Range.setText(getRange()); 503 // dlg.tfM01Group.setText(getLightGroup()); 504 // dlg.tfM01RepeatTime.setText(getLightPeriod()); 505 // dlg.cbM01Colour.setSelectedItem(getLightColour()); 506 } 507 508 public void parseFogRadar(Map<String, String> k) { 509 String str; 510 setFog(false); 511 setRadar(false); 512 setRacon(false); 513 if (k.containsKey("seamark:fog_signal") 514 || k.containsKey("seamark:fog_signal:category") 515 || k.containsKey("seamark:fog_signal:group") 516 || k.containsKey("seamark:fog_signal:period")) { 517 setFog(true); 518 if (k.containsKey("seamark:fog_signal:category")) { 519 str = k.get("seamark:fog_signal:category"); 520 if (str.equals("horn")) 521 setFogSound(FOG_HORN); 522 else if (str.equals("siren")) 523 setFogSound(FOG_SIREN); 524 else if (str.equals("diaphone")) 525 setFogSound(FOG_DIA); 526 else if (str.equals("bell")) 527 setFogSound(FOG_BELL); 528 else if (str.equals("whis")) 529 setFogSound(FOG_WHIS); 530 else if (str.equals("gong")) 531 setFogSound(FOG_GONG); 532 else if (str.equals("explosive")) 533 setFogSound(FOG_EXPLOS); 534 else 535 setFogSound(UNKNOWN_FOG); 536 } 537 if (k.containsKey("seamark:fog_signal:group")) 538 setFogGroup(k.get("seamark:fog_signal:group")); 539 if (k.containsKey("seamark:fog_signal:period")) 540 setFogPeriod(k.get("seamark:fog_signal:period")); 541 } 542 // dlg.cM01Fog.setSelected(hasFog()); 543 // dlg.cbM01Fog.setSelectedIndex(getFogSound()); 544 // dlg.tfM01FogGroup.setText(getFogGroup()); 545 // dlg.tfM01FogPeriod.setText(getFogPeriod()); 546 547 if (k.containsKey("seamark:radar_transponder") 548 || k.containsKey("seamark:radar_transponder:category") 549 || k.containsKey("seamark:radar_transponder:group")) { 550 setRacon(true); 551 if (k.containsKey("seamark:radar_transponder:category")) { 552 str = k.get("seamark:radar_transponder:category"); 553 if (str.equals("racon")) 554 setRaType(RATYPE_RACON); 555 else if (str.equals("ramark")) 556 setRaType(RATYPE_RAMARK); 557 else if (str.equals("leading")) 558 setRaType(RATYPE_LEADING); 559 else 560 setRaType(UNKNOWN_RATYPE); 561 } 562 if (k.containsKey("seamark:radar_transponder:group")) 563 setRaconGroup(k.get("seamark:radar_transponder:group")); 564 } else if (k.containsKey("seamark:radar_reflector")) 565 setRadar(true); 566 // dlg.cM01Radar.setSelected(hasRadar()); 567 // dlg.cM01Racon.setSelected(hasRacon()); 568 // dlg.cbM01Racon.setSelectedIndex(getRaType()); 569 // dlg.tfM01Racon.setText(getRaconGroup()); 570 } 571 183 572 public abstract void paintSign(); 184 573 185 public abstract void saveSign(); 574 public void saveSign(String type) { 575 delSeaMarkKeys(node); 576 577 String str = dlg.panelMain.nameBox.getText(); 578 if (!str.isEmpty()) 579 Main.main.undoRedo.add(new ChangePropertyCommand(node, 580 "seamark:name", str)); 581 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", 582 type)); 583 } 584 585 protected void saveLightData() { 586 /* String colour; 587 if (dlg.cM01Fired.isSelected()) { 588 if (!(colour = LightColour[0]).isEmpty()) 589 if (colour.equals("R")) { 590 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 591 "seamark:light:colour", "red")); 592 } else if (colour.equals("G")) { 593 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 594 "seamark:light:colour", "green")); 595 } else if (colour.equals("W")) { 596 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 597 "seamark:light:colour", "white")); 598 } 599 600 if (!LightPeriod[0].isEmpty()) 601 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 602 "seamark:light:period", LightPeriod[0])); 603 604 if (!LightChar[0].isEmpty()) 605 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 606 "seamark:light:character", LightChar[0])); 607 608 if (!LightGroup[0].isEmpty()) 609 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 610 "seamark:light:group", LightGroup[0])); 611 612 if (!Height[0].isEmpty()) 613 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 614 "seamark:light:height", Height[0])); 615 616 if (!Range[0].isEmpty()) 617 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 618 "seamark:light:range", Range[0])); 619 620 for (int i = 1; i < 10; i++) { 621 if ((colour = LightColour[i]) != null) 622 if (colour.equals("R")) { 623 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 624 "seamark:light:" + i + ":colour", "red")); 625 if ((Bearing1[i] != null) && (Bearing2[i] != null) 626 && (Radius[i] != null)) 627 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 628 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 629 + Bearing2[i] + ":" + Radius[i])); 630 } else if (colour.equals("G")) { 631 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 632 "seamark:light:" + i + ":colour", "green")); 633 if ((Bearing1[i] != null) && (Bearing2[i] != null) 634 && (Radius[i] != null)) 635 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 636 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 637 + Bearing2[i] + ":" + Radius[i])); 638 } else if (colour.equals("W")) { 639 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 640 "seamark:light:" + i + ":colour", "white")); 641 if ((Bearing1[i] != null) && (Bearing2[i] != null) 642 && (Radius[i] != null)) 643 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 644 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 645 + Bearing2[i] + ":" + Radius[i])); 646 } 647 648 if (LightPeriod[i] != null) 649 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 650 "seamark:light:" + i + ":period", LightPeriod[i])); 651 652 if (LightChar[i] != null) 653 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 654 "seamark:light:" + i + ":character", LightChar[i])); 655 656 if (LightGroup[i] != null) 657 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 658 "seamark:light:" + i + ":group", LightGroup[i])); 659 660 if (Height[i] != null) 661 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 662 "seamark:light:" + i + ":height", Height[i])); 663 664 if (Range[i] != null) 665 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 666 "seamark:light:" + i + ":range", Range[i])); 667 668 if (Bearing1[i] != null) 669 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 670 "seamark:light:" + i + ":sector_start", Bearing1[i])); 671 672 if (Bearing2[i] != null) 673 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 674 "seamark:light:" + i + ":sector_end", Bearing2[i])); 675 } 676 } 677 */ } 678 679 protected void saveTopMarkData(String shape, String colour) { 680 /* if (hasTopMark()) { 681 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 682 "seamark:topmark:shape", shape)); 683 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 684 "seamark:topmark:colour", colour)); 685 } 686 */ } 687 688 protected void saveRadarFogData() { 689 /* if (hasRadar()) { 690 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 691 "seamark:radar_reflector", "yes")); 692 } 693 if (hasRacon()) { 694 switch (RaType) { 695 case RATYPE_RACON: 696 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 697 "seamark:radar_transponder:category", "racon")); 698 if (!getRaconGroup().isEmpty()) 699 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 700 "seamark:radar_transponder:group", getRaconGroup())); 701 break; 702 case RATYPE_RAMARK: 703 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 704 "seamark:radar_transponder:category", "ramark")); 705 break; 706 case RATYPE_LEADING: 707 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 708 "seamark:radar_transponder:category", "leading")); 709 break; 710 default: 711 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 712 "seamark:radar_transponder", "yes")); 713 } 714 } 715 if (hasFog()) { 716 if (getFogSound() == 0) { 717 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 718 "seamark:fog_signal", "yes")); 719 } else { 720 switch (getFogSound()) { 721 case FOG_HORN: 722 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 723 "seamark:fog_signal:category", "horn")); 724 break; 725 case FOG_SIREN: 726 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 727 "seamark:fog_signal:category", "siren")); 728 break; 729 case FOG_DIA: 730 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 731 "seamark:fog_signal:category", "diaphone")); 732 break; 733 case FOG_BELL: 734 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 735 "seamark:fog_signal:category", "bell")); 736 break; 737 case FOG_WHIS: 738 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 739 "seamark:fog_signal:category", "whistle")); 740 break; 741 case FOG_GONG: 742 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 743 "seamark:fog_signal:category", "gong")); 744 break; 745 case FOG_EXPLOS: 746 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 747 "seamark:fog_signal:category", "explosive")); 748 break; 749 } 750 if (!getFogGroup().isEmpty()) 751 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 752 "seamark:fog_signal:group", getFogGroup())); 753 if (!getFogPeriod().isEmpty()) 754 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 755 "seamark:fog_signal:period", getFogPeriod())); 756 } 757 } 758 */ } 186 759 187 760 protected void delSeaMarkKeys(Node node) { … … 194 767 if (str.contains("seamark") == true) 195 768 if (str.compareTo("seamark") != 0) { 196 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 769 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, 770 null)); 197 771 } 198 772 }
Note:
See TracChangeset
for help on using the changeset viewer.