Changeset 24931 in osm for applications
- Timestamp:
- 2011-01-01T19:28:28+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24925 r24931 1 1 package oseam.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr;4 2 5 3 import oseam.panels.*; … … 7 5 import java.awt.Dimension; 8 6 import java.util.Collection; 9 import java.util.Iterator;10 import java.util.Map;11 7 12 8 import javax.swing.JPanel; … … 20 16 import oseam.Messages; 21 17 import oseam.seamarks.SeaMark; 22 import oseam.seamarks.SeaMark.Obj;23 18 import smed.plug.ifc.SmedPluginManager; 24 19 25 20 public class OSeaMAction { 26 21 27 private SmedPluginManager manager; 22 private OSeaMAction dlg = null; 23 public SmedPluginManager manager = null;; 28 24 public PanelMain panelMain = null; 29 25 … … 44 40 if (nextNode.compareTo(node) != 0) { 45 41 node = nextNode; 46 parseNode();42 mark = new SeaMark(dlg); 47 43 } 48 44 } else … … 61 57 public OSeaMAction(SmedPluginManager mngr) { 62 58 59 dlg = this; 60 manager = mngr; 63 61 DataSet.addSelectionListener(SmpListener); 64 manager = mngr;65 62 String str = Main.pref.get("mappaint.style.sources"); 66 63 if (!str.contains("dev.openseamap.org")) { … … 82 79 return panelMain; 83 80 } 84 85 private void parseNode() { 86 87 Map<String, String> keys; 88 89 manager.showVisualMessage(""); 90 String type = ""; 91 String str = ""; 92 93 mark = new SeaMark(this); 94 keys = node.getKeys(); 95 96 if (keys.containsKey("seamark:type")) 97 type = keys.get("seamark:type"); 98 99 Iterator<Obj> it = mark.objects.keySet().iterator(); 100 while (it.hasNext()) { 101 Obj obj = it.next(); 102 if (mark.objects.get(obj).equals(type)) { 103 mark.setObject(obj); 104 } 105 } 106 107 if (type.equals("light_float")) { 108 if (keys.containsKey("seamark:light_float:colour")) { 109 str = keys.get("seamark:light_float:colour"); 110 if (str.equals("red") || str.equals("green") || str.equals("red;green;red") || str.equals("green;red;green")) { 111 mark.setObject(Obj.BOYLAT); 112 } else if (str.equals("black;yellow") || str.equals("black;yellow;black") || str.equals("yellow;black") 113 || str.equals("yellow;black;yellow")) { 114 mark.setObject(Obj.BOYCAR); 115 } else if (str.equals("black;red;black")) { 116 mark.setObject(Obj.BOYISD); 117 } else if (str.equals("red;white")) { 118 mark.setObject(Obj.BOYSAW); 119 } else if (str.equals("yellow")) { 120 mark.setObject(Obj.BOYSPP); 121 } 122 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { 123 str = keys.get("seamark:light_float:topmark:shape"); 124 if (str.equals("cylinder") || str.equals("cone, point up")) { 125 mark.setObject(Obj.BOYLAT); 126 } 127 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { 128 str = keys.get("seamark:light_float:topmark:colour"); 129 if (str.equals("red") || str.equals("green")) { 130 mark.setObject(Obj.BOYLAT); 131 } 132 } 133 } else if (keys.containsKey("buoy_lateral:category") || keys.containsKey("buoy_lateral:shape") || keys.containsKey("buoy_lateral:colour")) { 134 mark.setObject(Obj.BOYLAT); 135 } else if (keys.containsKey("beacon_lateral:category") || keys.containsKey("beacon_lateral:shape") || keys.containsKey("beacon_lateral:colour")) { 136 mark.setObject(Obj.BCNLAT); 137 } else if (keys.containsKey("buoy_cardinal:category") || keys.containsKey("buoy_cardinal:shape") || keys.containsKey("buoy_cardinal:colour")) { 138 mark.setObject(Obj.BOYCAR); 139 } else if (keys.containsKey("beacon_cardinal:category") || keys.containsKey("beacon_cardinal:shape") || keys.containsKey("beacon_cardinal:colour")) { 140 mark.setObject(Obj.BCNCAR); 141 } else if (keys.containsKey("buoy_isolated_danger:category") || keys.containsKey("buoy_isolated_danger:shape") || keys.containsKey("buoy_isolated_danger:colour")) { 142 mark.setObject(Obj.BOYISD); 143 } else if (keys.containsKey("beacon_isolated_danger:category") || keys.containsKey("beacon_isolated_danger:shape") || keys.containsKey("beacon_isolated_danger:colour")) { 144 mark.setObject(Obj.BCNISD); 145 } else if (keys.containsKey("buoy_safe_water:category") || keys.containsKey("buoy_safe_water:shape") || keys.containsKey("buoy_safe_water:colour")) { 146 mark.setObject(Obj.BOYSAW); 147 } else if (keys.containsKey("beacon_safe_water:category") || keys.containsKey("beacon_safe_water:shape") || keys.containsKey("beacon_safe_water:colour")) { 148 mark.setObject(Obj.BCNSAW); 149 } else if (keys.containsKey("buoy_special_purpose:category") || keys.containsKey("buoy_special_purpose:shape") || keys.containsKey("buoy_special_purpose:colour")) { 150 mark.setObject(Obj.BOYSPP); 151 } else if (keys.containsKey("beacon_special_purpose:category") || keys.containsKey("beacon_special_purpose:shape") || keys.containsKey("beacon_special_purpose:colour")) { 152 mark.setObject(Obj.BCNSPP); 153 } 154 155 if (mark.getObject() == Obj.UNKNOWN) { 156 manager.showVisualMessage(Messages.getString("NoMark")); 157 panelMain.clearSelections(); 158 } else { 159 if (keys.containsKey("seamark:" + type + ":name")) { 160 panelMain.nameBox.setText(keys.get("seamark:" + type + ":name")); 161 panelMain.nameBox.postActionEvent(); 162 } else if (keys.containsKey("seamark:name")) { 163 panelMain.nameBox.setText(keys.get("seamark:name")); 164 panelMain.nameBox.postActionEvent(); 165 } else if (keys.containsKey("name")) { 166 panelMain.nameBox.setText(keys.get("name")); 167 panelMain.nameBox.postActionEvent(); 168 } else 169 panelMain.nameBox.setText(""); 170 mark.parseMark(); 171 mark.paintSign(); 172 } 173 } 81 174 82 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r24925 r24931 42 42 shp = dlg.mark.getShape(); 43 43 if (portButton.isSelected() || prefPortButton.isSelected()) { 44 // if (!(dlg.mark instanceof MarkLat)) { 45 // dlg.mark = new MarkLat(dlg); 46 dlg.panelMain.topButton.setEnabled(true); 47 dlg.panelMain.fogButton.setEnabled(true); 48 dlg.panelMain.radButton.setEnabled(true); 49 dlg.panelMain.litButton.setEnabled(true); 50 // } 44 dlg.panelMain.topButton.setEnabled(true); 45 dlg.panelMain.fogButton.setEnabled(true); 46 dlg.panelMain.radButton.setEnabled(true); 47 dlg.panelMain.litButton.setEnabled(true); 51 48 dlg.panelMain.panelTop.enableAll(false); 52 49 dlg.panelMain.panelTop.noTopButton.setEnabled(true); … … 107 104 } 108 105 if (stbdButton.isSelected() || prefStbdButton.isSelected()) { 109 // if (!(dlg.mark instanceof MarkLat)) { 110 // dlg.mark = new MarkLat(dlg); 111 dlg.panelMain.topButton.setEnabled(true); 112 dlg.panelMain.fogButton.setEnabled(true); 113 dlg.panelMain.radButton.setEnabled(true); 114 dlg.panelMain.litButton.setEnabled(true); 115 // } 106 dlg.panelMain.topButton.setEnabled(true); 107 dlg.panelMain.fogButton.setEnabled(true); 108 dlg.panelMain.radButton.setEnabled(true); 109 dlg.panelMain.litButton.setEnabled(true); 116 110 dlg.panelMain.panelTop.enableAll(false); 117 111 dlg.panelMain.panelTop.noTopButton.setEnabled(true); … … 172 166 } 173 167 if (safeWaterButton.isSelected()) { 174 // if (!(dlg.mark instanceof MarkSaw)) { 175 // dlg.mark = new MarkSaw(dlg); 176 if (panelSaw.shapes.containsKey(shp)) { 177 panelSaw.shapes.get(shp).doClick(); 178 } else { 179 panelSaw.clearSelections(); 180 dlg.mark.setShape(Shp.UNKNOWN); 181 } 182 dlg.panelMain.panelTop.enableAll(false); 183 dlg.panelMain.panelTop.noTopButton.setEnabled(true); 184 dlg.panelMain.panelTop.sphereTopButton.setEnabled(true); 185 dlg.panelMain.panelTop.panelCol.enableAll(false); 186 dlg.panelMain.panelTop.panelCol.redButton.setEnabled(true); 187 dlg.panelMain.panelTop.panelCol.redButton.doClick(); 188 // } 168 if (panelSaw.shapes.containsKey(shp)) { 169 panelSaw.shapes.get(shp).doClick(); 170 } else { 171 panelSaw.clearSelections(); 172 dlg.mark.setShape(Shp.UNKNOWN); 173 } 174 dlg.panelMain.panelTop.enableAll(false); 175 dlg.panelMain.panelTop.noTopButton.setEnabled(true); 176 dlg.panelMain.panelTop.sphereTopButton.setEnabled(true); 177 dlg.panelMain.panelTop.panelCol.enableAll(false); 178 dlg.panelMain.panelTop.panelCol.redButton.setEnabled(true); 179 dlg.panelMain.panelTop.panelCol.redButton.doClick(); 189 180 dlg.mark.setColour(Ent.BODY, Col.RED_WHITE); 190 181 safeWaterButton.setBorderPainted(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java
r24904 r24931 14 14 15 15 import java.util.EnumMap; 16 import java.util.Iterator;17 16 18 17 import oseam.dialogs.OSeaMAction; … … 38 37 private ActionListener alColour = new ActionListener() { 39 38 public void actionPerformed(java.awt.event.ActionEvent e) { 40 Iterator<Col> it = colours.keySet().iterator(); 41 while (it.hasNext()) { 42 Col col = it.next(); 39 for (Col col : colours.keySet()) { 43 40 JRadioButton button = colours.get(col); 44 41 if (button.isSelected()) { … … 73 70 74 71 public void enableAll(boolean state) { 75 Iterator<Col> it = colours.keySet().iterator(); 76 while (it.hasNext()) { 77 colours.get(it.next()).setEnabled(state); 72 for (JRadioButton button : colours.values()) { 73 button.setEnabled(state); 78 74 } 79 75 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r24925 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 111 110 private ActionListener alShape = new ActionListener() { 112 111 public void actionPerformed(java.awt.event.ActionEvent e) { 113 Iterator<Shp> it = shapes.keySet().iterator(); 114 while (it.hasNext()) { 115 Shp shp = it.next(); 112 for (Shp shp : shapes.keySet()) { 116 113 JRadioButton button = shapes.get(shp); 117 114 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLights.java
r24917 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 23 22 private OSeaMAction dlg; 24 23 private ButtonGroup catButtons = new ButtonGroup(); 25 p rivateJRadioButton houseButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LighthouseButton.png")));26 p rivateJRadioButton majorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMajorButton.png")));27 p rivateJRadioButton minorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMinorButton.png")));28 p rivateJRadioButton vesselButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightVesselButton.png")));29 p rivateJRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightFloatButton.png")));24 public JRadioButton houseButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LighthouseButton.png"))); 25 public JRadioButton majorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMajorButton.png"))); 26 public JRadioButton minorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMinorButton.png"))); 27 public JRadioButton vesselButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightVesselButton.png"))); 28 public JRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightFloatButton.png"))); 30 29 private EnumMap<Cat, JRadioButton> categories = new EnumMap<Cat, JRadioButton>(Cat.class); 31 30 private EnumMap<Cat, Obj> objects = new EnumMap<Cat, Obj>(Cat.class); 32 31 private ActionListener alCat = new ActionListener() { 33 32 public void actionPerformed(java.awt.event.ActionEvent e) { 34 Iterator<Cat> it = categories.keySet().iterator(); 35 while (it.hasNext()) { 36 Cat cat = it.next(); 33 for (Cat cat : categories.keySet()) { 37 34 JRadioButton button = categories.get(cat); 38 35 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java
r24896 r24931 5 5 import java.awt.Rectangle; 6 6 7 import oseam.Messages;8 7 import oseam.dialogs.OSeaMAction; 9 8 import oseam.seamarks.SeaMark.Ent; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r24925 r24931 119 119 } 120 120 if (chanButton.isSelected()) { 121 // if (!((dlg.mark instanceof MarkLat) || (dlg.mark instanceof MarkSaw))) {122 // dlg.mark = null;123 // clearType();124 // }125 121 chanButton.setBorderPainted(true); 126 122 panelChan.setVisible(true); … … 131 127 } 132 128 if (hazButton.isSelected()) { 133 // if (!((dlg.mark instanceof MarkCard) || (dlg.mark instanceof MarkIsol))) {134 // dlg.mark = null;135 // clearType();136 // }137 129 hazButton.setBorderPainted(true); 138 130 panelHaz.setVisible(true); … … 143 135 } 144 136 if (specButton.isSelected()) { 145 // if (!(dlg.mark instanceof MarkSpec)) { 146 // dlg.mark = new MarkSpec(dlg); 147 // clearType(); 148 dlg.panelMain.panelSpec.panelCol.yellowButton.doClick(); 149 dlg.panelMain.panelTop.enableAll(true); 150 dlg.panelMain.panelTop.noTopButton.doClick(); 151 dlg.panelMain.panelTop.panelCol.enableAll(true); 152 dlg.panelMain.panelTop.panelCol.yellowButton.doClick(); 153 topButton.setEnabled(true); 154 fogButton.setEnabled(true); 155 radButton.setEnabled(true); 156 litButton.setEnabled(true); 157 // } 137 dlg.panelMain.panelSpec.panelCol.yellowButton.doClick(); 138 dlg.panelMain.panelTop.enableAll(true); 139 dlg.panelMain.panelTop.noTopButton.doClick(); 140 dlg.panelMain.panelTop.panelCol.enableAll(true); 141 dlg.panelMain.panelTop.panelCol.yellowButton.doClick(); 142 topButton.setEnabled(true); 143 fogButton.setEnabled(true); 144 radButton.setEnabled(true); 145 litButton.setEnabled(true); 158 146 specButton.setBorderPainted(true); 159 147 panelSpec.setVisible(true); … … 164 152 } 165 153 if (lightsButton.isSelected()) { 166 // if (!(dlg.mark instanceof MarkLight)) { 167 // dlg.mark = new MarkLight(dlg); 168 // clearType(); 169 fogButton.setEnabled(true); 170 radButton.setEnabled(true); 171 litButton.setEnabled(true); 172 litButton.doClick(); 173 // } 154 fogButton.setEnabled(true); 155 radButton.setEnabled(true); 156 litButton.setEnabled(true); 157 litButton.doClick(); 174 158 lightsButton.setBorderPainted(true); 175 159 panelLights.setVisible(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r24896 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 44 43 private ActionListener alShape = new ActionListener() { 45 44 public void actionPerformed(java.awt.event.ActionEvent e) { 46 Iterator<Shp> it = shapes.keySet().iterator(); 47 while (it.hasNext()) { 48 Shp shp = it.next(); 45 for (Shp shp : shapes.keySet()) { 49 46 JRadioButton button = shapes.get(shp); 50 47 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelRadar.java
r24839 r24931 3 3 import javax.swing.JPanel; 4 4 5 import java.awt.Color;6 import java.awt.Dimension;7 import java.awt.Rectangle;8 import java.awt.Font;9 10 import javax.swing.ButtonGroup;11 import javax.swing.ImageIcon;12 import javax.swing.JLabel;13 import javax.swing.JTextField;14 import javax.swing.JComboBox;15 import javax.swing.JCheckBox;16 import javax.swing.JRadioButton;17 18 import oseam.Messages;19 5 import oseam.dialogs.OSeaMAction; 20 21 import java.awt.Cursor;22 import java.awt.event.ActionListener;23 6 24 7 public class PanelRadar extends JPanel { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSaw.java
r24896 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 32 31 private ActionListener alShape = new ActionListener() { 33 32 public void actionPerformed(java.awt.event.ActionEvent e) { 34 Iterator<Shp> it = shapes.keySet().iterator(); 35 while (it.hasNext()) { 36 Shp shp = it.next(); 33 for (Shp shp : shapes.keySet()) { 37 34 JRadioButton button = shapes.get(shp); 38 35 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java
r24896 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 39 38 private ActionListener alShape = new ActionListener() { 40 39 public void actionPerformed(java.awt.event.ActionEvent e) { 41 Iterator<Shp> it = shapes.keySet().iterator(); 42 while (it.hasNext()) { 43 Shp shp = it.next(); 40 for (Shp shp : shapes.keySet()) { 44 41 JRadioButton button = shapes.get(shp); 45 42 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r24896 r24931 12 12 13 13 import java.util.EnumMap; 14 import java.util.Iterator;15 14 16 15 import oseam.Messages; … … 44 43 private ActionListener alShape = new ActionListener() { 45 44 public void actionPerformed(java.awt.event.ActionEvent e) { 46 Iterator<Shp> it = shapes.keySet().iterator(); 47 while (it.hasNext()) { 48 Shp shp = it.next(); 45 for (Shp shp : shapes.keySet()) { 49 46 JRadioButton button = shapes.get(shp); 50 47 if (button.isSelected()) { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelTop.java
r24919 r24931 11 11 import java.awt.event.ActionListener; 12 12 import java.util.EnumMap; 13 import java.util.Iterator;14 13 15 14 import oseam.Messages; 16 15 import oseam.dialogs.OSeaMAction; 17 import oseam.seamarks.SeaMark.Col;18 16 import oseam.seamarks.SeaMark.Top; 19 17 import oseam.seamarks.SeaMark.Day; … … 46 44 private ActionListener alTop = new ActionListener() { 47 45 public void actionPerformed(java.awt.event.ActionEvent e) { 48 Iterator<Top> it = tops.keySet().iterator(); 49 while (it.hasNext()) { 50 Top top = it.next(); 46 for (Top top : tops.keySet()) { 51 47 JRadioButton button = tops.get(top); 52 48 if (button.isSelected()) { … … 57 53 button.setBorderPainted(false); 58 54 } 59 Iterator<Day> id = days.keySet().iterator(); 60 while (id.hasNext()) { 61 Day day = id.next(); 55 for (Day day : days.keySet()) { 62 56 JRadioButton button = days.get(day); 63 57 if (button.isSelected()) { … … 104 98 105 99 public void enableAll(boolean state) { 106 Iterator<Top> it = tops.keySet().iterator(); 107 while (it.hasNext()) { 108 tops.get(it.next()).setEnabled(state); 100 for (JRadioButton button : tops.values()) { 101 button.setEnabled(state); 109 102 } 110 103 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24925 r24931 2 2 3 3 import javax.swing.ImageIcon; 4 import javax.swing.JRadioButton;5 4 6 5 import java.util.EnumMap; 7 import java.util.Iterator;8 6 import java.util.Map; 9 7 import java.util.regex.Matcher; … … 13 11 import org.openstreetmap.josm.command.ChangePropertyCommand; 14 12 13 import oseam.Messages; 15 14 import oseam.dialogs.OSeaMAction; 16 15 … … 26 25 dlg = dia; 27 26 region = Main.pref.get("tomsplugin.IALA").equals("A") ? Reg.A : Reg.B; 27 parseNode(); 28 28 } 29 29 … … 113 113 groups.put(Obj.MORFAC, Grp.SPP); 114 114 } 115 115 116 116 public enum Cat { 117 117 UNKNOWN, LAT_PORT, LAT_STBD, LAT_PREF_PORT, LAT_PREF_STBD, CARD_NORTH, CARD_EAST, CARD_SOUTH, CARD_WEST, LIGHT_HOUSE, LIGHT_MAJOR, LIGHT_MINOR, LIGHT_VESSEL, LIGHT_FLOAT, MOORING_BUOY … … 576 576 } 577 577 578 public void parseMark() { 579 580 String str; 581 Map<String, String> keys; 582 keys = dlg.node.getKeys(); 578 public void parseNode() { 579 580 dlg.panelMain.clearSelections(); 581 dlg.manager.showVisualMessage(""); 582 String type = ""; 583 String str = ""; 584 String col = ""; 585 586 Map<String, String> keys = dlg.node.getKeys(); 587 588 if (keys.containsKey("seamark:type")) 589 type = keys.get("seamark:type"); 590 591 for (Obj obj : objects.keySet()) { 592 if (objects.get(obj).equals(type)) 593 setObject(obj); 594 } 595 596 if (type.equals("light_float") || type.equals("") || keys.containsKey("seamark:light_float:colour") 597 || keys.containsKey("seamark:light_float:colour_pattern")) { 598 if (keys.containsKey("seamark:light_float:colour_pattern")) { 599 setObject(Obj.LITFLT); 600 type = "light_float"; 601 } 602 if (keys.containsKey("seamark:light_float:colour")) { 603 col = keys.get("seamark:light_float:colour"); 604 if (col.equals("red") || col.equals("green") || col.equals("red;green;red") || col.equals("green;red;green")) { 605 setObject(Obj.BOYLAT); 606 } else if (col.equals("black;yellow") || col.equals("black;yellow;black") || col.equals("yellow;black") 607 || col.equals("yellow;black;yellow")) { 608 setObject(Obj.BOYCAR); 609 } else if (col.equals("black;red;black")) { 610 setObject(Obj.BOYISD); 611 } else if (col.equals("red;white")) { 612 setObject(Obj.BOYSAW); 613 } else if (col.equals("yellow")) { 614 setObject(Obj.BOYSPP); 615 } else 616 setObject(Obj.LITFLT); 617 type = "light_float"; 618 } 619 if (type.equals("")) { 620 if (keys.containsKey("seamark:buoy_lateral:category") || keys.containsKey("seamark:buoy_lateral:shape") 621 || keys.containsKey("seamark:buoy_lateral:colour")) { 622 setObject(Obj.BOYLAT); 623 } else if (keys.containsKey("seamark:beacon_lateral:category") || keys.containsKey("seamark:beacon_lateral:shape") 624 || keys.containsKey("seamark:beacon_lateral:colour")) { 625 setObject(Obj.BCNLAT); 626 } else if (keys.containsKey("seamark:buoy_cardinal:category") || keys.containsKey("seamark:buoy_cardinal:shape") 627 || keys.containsKey("seamark:buoy_cardinal:colour")) { 628 setObject(Obj.BOYCAR); 629 } else if (keys.containsKey("seamark:beacon_cardinal:category") || keys.containsKey("seamark:beacon_cardinal:shape") 630 || keys.containsKey("seamark:beacon_cardinal:colour")) { 631 setObject(Obj.BCNCAR); 632 } else if (keys.containsKey("seamark:buoy_isolated_danger:category") || keys.containsKey("seamark:buoy_isolated_danger:shape") 633 || keys.containsKey("seamark:buoy_isolated_danger:colour")) { 634 setObject(Obj.BOYISD); 635 } else if (keys.containsKey("seamark:beacon_isolated_danger:category") || keys.containsKey("seamark:beacon_isolated_danger:shape") 636 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { 637 setObject(Obj.BCNISD); 638 } else if (keys.containsKey("seamark:buoy_safe_water:category") || keys.containsKey("seamark:buoy_safe_water:shape") 639 || keys.containsKey("seamark:buoy_safe_water:colour")) { 640 setObject(Obj.BOYSAW); 641 } else if (keys.containsKey("seamark:beacon_safe_water:category") || keys.containsKey("seamark:beacon_safe_water:shape") 642 || keys.containsKey("seamark:beacon_safe_water:colour")) { 643 setObject(Obj.BCNSAW); 644 } else if (keys.containsKey("seamark:buoy_special_purpose:category") || keys.containsKey("seamark:buoy_special_purpose:shape") 645 || keys.containsKey("seamark:buoy_special_purpose:colour")) { 646 setObject(Obj.BOYSPP); 647 } else if (keys.containsKey("seamark:beacon_special_purpose:category") || keys.containsKey("seamark:beacon_special_purpose:shape") 648 || keys.containsKey("seamark:beacon_special_purpose:colour")) { 649 setObject(Obj.BCNSPP); 650 } 651 } 652 } 653 654 if (getObject() == Obj.UNKNOWN) { 655 dlg.manager.showVisualMessage(Messages.getString("NoMark")); 656 return; 657 } 658 659 if (keys.containsKey("seamark:" + type + ":name")) { 660 dlg.panelMain.nameBox.setText(keys.get("seamark:" + type + ":name")); 661 dlg.panelMain.nameBox.postActionEvent(); 662 } else if (keys.containsKey("seamark:name")) { 663 dlg.panelMain.nameBox.setText(keys.get("seamark:name")); 664 dlg.panelMain.nameBox.postActionEvent(); 665 } else if (keys.containsKey("name")) { 666 dlg.panelMain.nameBox.setText(keys.get("name")); 667 dlg.panelMain.nameBox.postActionEvent(); 668 } else 669 dlg.panelMain.nameBox.setText(""); 670 671 switch (groups.get(getObject())) { 672 case LAT: 673 dlg.panelMain.chanButton.doClick(); 674 switch (getObject()) { 675 case BCNLAT: 676 if (keys.containsKey("seamark:beacon_lateral:category")) 677 str = keys.get("seamark:beacon_lateral:category"); 678 break; 679 case BOYLAT: 680 if (keys.containsKey("seamark:buoy_lateral:category")) 681 str = keys.get("seamark:buoy_lateral:category"); 682 else if (type.equals("light_float")) { 683 if (region == Reg.A) { 684 if (col.equals("red")) 685 dlg.panelMain.panelChan.portButton.doClick(); 686 else if (col.equals("green")) 687 dlg.panelMain.panelChan.stbdButton.doClick(); 688 else if (col.equals("red;green;red")) 689 dlg.panelMain.panelChan.prefPortButton.doClick(); 690 else if (col.equals("green;red;green")) 691 dlg.panelMain.panelChan.prefStbdButton.doClick(); 692 } else { 693 if (col.equals("green")) 694 dlg.panelMain.panelChan.portButton.doClick(); 695 else if (col.equals("red")) 696 dlg.panelMain.panelChan.stbdButton.doClick(); 697 else if (col.equals("green;red;green")) 698 dlg.panelMain.panelChan.prefPortButton.doClick(); 699 else if (col.equals("red;green;red")) 700 dlg.panelMain.panelChan.prefStbdButton.doClick(); 701 } 702 } 703 break; 704 } 705 if (str.equals("port")) 706 dlg.panelMain.panelChan.portButton.doClick(); 707 else if (str.equals("starboard")) 708 dlg.panelMain.panelChan.stbdButton.doClick(); 709 else if (str.equals("preferred_channel_port")) 710 dlg.panelMain.panelChan.prefPortButton.doClick(); 711 else if (str.equals("preferred_channel_starboard")) 712 dlg.panelMain.panelChan.prefStbdButton.doClick(); 713 break; 714 case CAR: 715 dlg.panelMain.hazButton.doClick(); 716 switch (getObject()) { 717 case BCNCAR: 718 if (keys.containsKey("seamark:beacon_cardinal:category")) 719 str = keys.get("seamark:beacon_cardinal:category"); 720 break; 721 case BOYCAR: 722 if (keys.containsKey("seamark:buoy_cardinal:category")) 723 str = keys.get("seamark:buoy_cardinal:category"); 724 else if (type.equals("light_float")) { 725 if (col.equals("black;yellow")) 726 dlg.panelMain.panelHaz.northButton.doClick(); 727 else if (col.equals("yellow;black")) 728 dlg.panelMain.panelHaz.southButton.doClick(); 729 else if (col.equals("black;yellow;black")) 730 dlg.panelMain.panelHaz.eastButton.doClick(); 731 else if (col.equals("yellow;black;yellow")) 732 dlg.panelMain.panelHaz.westButton.doClick(); 733 } 734 break; 735 } 736 if (str.equals("north")) 737 dlg.panelMain.panelHaz.northButton.doClick(); 738 else if (str.equals("south")) 739 dlg.panelMain.panelHaz.southButton.doClick(); 740 else if (str.equals("east")) 741 dlg.panelMain.panelHaz.eastButton.doClick(); 742 else if (str.equals("west")) 743 dlg.panelMain.panelHaz.westButton.doClick(); 744 break; 745 case SAW: 746 dlg.panelMain.chanButton.doClick(); 747 dlg.panelMain.panelChan.safeWaterButton.doClick(); 748 break; 749 case ISD: 750 dlg.panelMain.hazButton.doClick(); 751 dlg.panelMain.panelHaz.isolButton.doClick(); 752 break; 753 case SPP: 754 dlg.panelMain.specButton.doClick(); 755 break; 756 case FLT: 757 dlg.panelMain.lightsButton.doClick(); 758 dlg.panelMain.panelLights.floatButton.doClick(); 759 break; 760 case LIT: 761 dlg.panelMain.lightsButton.doClick(); 762 break; 763 } 583 764 584 765 if (keys.containsKey("seamark:topmark:shape")) { … … 586 767 } 587 768 588 setFired(false); 589 setSectored(false); 590 Iterator it = keys.entrySet().iterator(); 591 while (it.hasNext()) { 592 Map.Entry entry = (Map.Entry) it.next(); 593 String key = (String) entry.getKey(); 594 String value = ((String) entry.getValue()).trim(); 769 for (Map.Entry<String, String> entry : keys.entrySet()) { 770 String key = entry.getKey(); 771 String value = entry.getValue().trim(); 595 772 if (key.contains("seamark:light:")) { 596 773 setFired(true); … … 641 818 } 642 819 643 setFog(false);644 setRadar(false);645 setRacon(false);646 820 if (keys.containsKey("seamark:fog_signal") || keys.containsKey("seamark:fog_signal:category") 647 821 || keys.containsKey("seamark:fog_signal:group") || keys.containsKey("seamark:fog_signal:period")) { … … 708 882 } 709 883 imgStr += ".png"; 710 if (getClass().getResource(imgStr) == null)711 System.out.println(imgStr);712 else713 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));884 if (getClass().getResource(imgStr) == null) 885 System.out.println(imgStr); 886 else 887 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 714 888 } 715 889 … … 749 923 imgStr += ("_" + colStr); 750 924 imgStr += ".png"; 751 if (getClass().getResource(imgStr) == null) 752 System.out.println(imgStr); 753 else 754 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 755 } 756 } 757 /* 758 if (hasRadar()) { 759 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png"))); 760 } else if (hasRacon()) { 761 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Station.png"))); 762 // if (getRaType() != 0) { 763 // String c = (String) dlg.cbM01Racon.getSelectedItem(); 764 // if ((getRaType() == RATYPE_RACON) && !getRaconGroup().isEmpty()) 765 // c += ("(" + getRaconGroup() + ")"); 766 // dlg.lM01RadarMarkeys.setText(c); 767 // } 768 } 769 770 if (hasFog()) { 771 dlg.panelMain.fogIcon.setIcon(new ImageIcon(getClass().getResource("/images/Fog_Signal.png"))); 772 // if (getFogSound() != 0) { 773 // String c = (String) dlg.cbM01Fog.getSelectedItem(); 774 // if (!getFogGroup().isEmpty()) 775 // c += ("(" + getFogGroup() + ")"); 776 // if (!getFogPeriod().isEmpty()) 777 // c += (" " + getFogPeriod() + "s"); 778 // dlg.lM01FogMarkeys.setText(c); 779 // } 780 } 781 782 if (isFired()) { 783 String lp, c; 784 String tmp = null; 785 int i1; 786 787 Col col = getColour(Ent.LIGHT); 788 if (col == Col.WHITE) { 789 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_White_120.png"))); 790 } else if (col == Col.RED) { 791 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Red_120.png"))); 792 } else if (col == Col.GREEN) { 793 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Green_120.png"))); 794 } else { 795 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png"))); 796 } 797 798 c = getLightChar(); if (c.contains("+")) { i1 = c.indexOf("+"); tmp = 799 c.substring(i1, c.length()); c = c.substring(0, i1); if 800 (!getLightGroup().isEmpty()) { c = c + "(" + getLightGroup() + ")"; } 801 if (tmp != null) c = c + tmp; } else if (!getLightGroup().isEmpty()) c 802 = c + "(" + getLightGroup() + ")"; c = c + " " + getLightColour(); lp = 803 getLightPeriod(); if (!lp.isEmpty()) c = c + " " + lp + "s"; 804 }*/ 925 if (getClass().getResource(imgStr) == null) 926 System.out.println(imgStr); 927 else 928 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 929 } 930 } 931 /* 932 * if (hasRadar()) { dlg.panelMain.radarIcon.setIcon(new 933 * ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png"))); } 934 * else if (hasRacon()) { dlg.panelMain.radarIcon.setIcon(new 935 * ImageIcon(getClass().getResource("/images/Radar_Station.png"))); // if 936 * (getRaType() != 0) { // String c = (String) 937 * dlg.cbM01Racon.getSelectedItem(); // if ((getRaType() == RATYPE_RACON) && 938 * !getRaconGroup().isEmpty()) // c += ("(" + getRaconGroup() + ")"); // 939 * dlg.lM01RadarMarkeys.setText(c); // } } 940 * 941 * if (hasFog()) { dlg.panelMain.fogIcon.setIcon(new 942 * ImageIcon(getClass().getResource("/images/Fog_Signal.png"))); // if 943 * (getFogSound() != 0) { // String c = (String) 944 * dlg.cbM01Fog.getSelectedItem(); // if (!getFogGroup().isEmpty()) // c += 945 * ("(" + getFogGroup() + ")"); // if (!getFogPeriod().isEmpty()) // c += 946 * (" " + getFogPeriod() + "s"); // dlg.lM01FogMarkeys.setText(c); // } } 947 * 948 * if (isFired()) { String lp, c; String tmp = null; int i1; 949 * 950 * Col col = getColour(Ent.LIGHT); if (col == Col.WHITE) { 951 * dlg.panelMain.lightIcon.setIcon(new 952 * ImageIcon(getClass().getResource("/images/Light_White_120.png"))); } else 953 * if (col == Col.RED) { dlg.panelMain.lightIcon.setIcon(new 954 * ImageIcon(getClass().getResource("/images/Light_Red_120.png"))); } else 955 * if (col == Col.GREEN) { dlg.panelMain.lightIcon.setIcon(new 956 * ImageIcon(getClass().getResource("/images/Light_Green_120.png"))); } else 957 * { dlg.panelMain.lightIcon.setIcon(new 958 * ImageIcon(getClass().getResource("/images/Light_Magenta_120.png"))); } 959 * 960 * c = getLightChar(); if (c.contains("+")) { i1 = c.indexOf("+"); tmp = 961 * c.substring(i1, c.length()); c = c.substring(0, i1); if 962 * (!getLightGroup().isEmpty()) { c = c + "(" + getLightGroup() + ")"; } if 963 * (tmp != null) c = c + tmp; } else if (!getLightGroup().isEmpty()) c = c + 964 * "(" + getLightGroup() + ")"; c = c + " " + getLightColour(); lp = 965 * getLightPeriod(); if (!lp.isEmpty()) c = c + " " + lp + "s"; } 966 */ 805 967 } 806 968 807 969 public void saveSign() { 808 Iterator<String> it = dlg.node.getKeys().keySet().iterator();809 String str;810 970 811 971 Main.pref.put("tomsplugin.IALA", getRegion() == Reg.A ? "A" : "B"); 812 972 813 while (it.hasNext()) { 814 str = it.next(); 973 for (String str : dlg.node.getKeys().keySet()) { 815 974 if (str.contains("seamark")) 816 975 if (!str.equals("seamark")) { … … 825 984 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, "seamark:type", objStr)); 826 985 827 str = categories.get(category);986 String str = categories.get(category); 828 987 if (str != null) 829 988 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, "seamark:" + objStr + ":category", str)); … … 851 1010 } 852 1011 853 str = tops.get(topShape);1012 String str = tops.get(topShape); 854 1013 if (str != null) { 855 1014 Main.main.undoRedo.add(new ChangePropertyCommand(dlg.node, "seamark:topmark:shape", str));
Note:
See TracChangeset
for help on using the changeset viewer.