Changeset 24925 in osm for applications/editors/josm/plugins/smed
- Timestamp:
- 2010-12-31T16:46:49+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 6 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24924 r24925 7 7 import java.awt.Dimension; 8 8 import java.util.Collection; 9 import java.util.Iterator; 9 10 import java.util.Map; 10 11 … … 20 21 import oseam.seamarks.SeaMark; 21 22 import oseam.seamarks.SeaMark.Obj; 22 import oseam.seamarks.MarkCard;23 import oseam.seamarks.MarkIsol;24 import oseam.seamarks.MarkLat;25 import oseam.seamarks.MarkLight;26 import oseam.seamarks.MarkSpec;27 import oseam.seamarks.MarkSaw;28 23 import smed.plug.ifc.SmedPluginManager; 29 24 … … 93 88 94 89 manager.showVisualMessage(""); 95 mark = null;96 90 String type = ""; 97 91 String str = ""; 98 92 93 mark = new SeaMark(this); 99 94 keys = node.getKeys(); 100 95 101 96 if (keys.containsKey("seamark:type")) 102 97 type = keys.get("seamark:type"); 103 if (type.equals("buoy_lateral")) { 104 mark = new MarkLat(this); 105 mark.setObject(Obj.BOYLAT); 106 } else if (type.equals("beacon_lateral")) { 107 mark = new MarkLat(this); 108 mark.setObject(Obj.BCNLAT); 109 } else if (type.equals("buoy_cardinal")) { 110 mark = new MarkCard(this); 111 mark.setObject(Obj.BOYCAR); 112 } else if (type.equals("beacon_cardinal")) { 113 mark = new MarkCard(this); 114 mark.setObject(Obj.BCNCAR); 115 } else if (type.equals("buoy_safe_water")) { 116 mark = new MarkSaw(this); 117 mark.setObject(Obj.BOYSAW); 118 } else if (type.equals("beacon_safe_water")) { 119 mark = new MarkSaw(this); 120 mark.setObject(Obj.BCNSAW); 121 } else if (type.equals("buoy_special_purpose")) { 122 mark = new MarkSpec(this); 123 mark.setObject(Obj.BOYSPP); 124 } else if (type.equals("beacon_special_purpose")) { 125 mark = new MarkSpec(this); 126 mark.setObject(Obj.BCNSPP); 127 } else if (type.equals("buoy_isolated_danger")) { 128 mark = new MarkIsol(this); 129 mark.setObject(Obj.BOYISD); 130 } else if (type.equals("beacon_isolated_danger")) { 131 mark = new MarkIsol(this); 132 mark.setObject(Obj.BCNISD); 133 } else if (type.equals("landmark")) { 134 mark = new MarkLight(this); 135 mark.setObject(Obj.LNDMRK); 136 } else if (type.equals("light_vessel")) { 137 mark = new MarkLight(this); 138 mark.setObject(Obj.LITVES); 139 } else if (type.equals("light_major")) { 140 mark = new MarkLight(this); 141 mark.setObject(Obj.LITMAJ); 142 } else if (type.equals("light_minor")) { 143 mark = new MarkLight(this); 144 mark.setObject(Obj.LITMIN); 145 } else if (type.equals("light_float")) { 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")) { 146 108 if (keys.containsKey("seamark:light_float:colour")) { 147 109 str = keys.get("seamark:light_float:colour"); 148 110 if (str.equals("red") || str.equals("green") || str.equals("red;green;red") || str.equals("green;red;green")) { 149 mark = new MarkLat(this);150 111 mark.setObject(Obj.BOYLAT); 151 112 } else if (str.equals("black;yellow") || str.equals("black;yellow;black") || str.equals("yellow;black") 152 113 || str.equals("yellow;black;yellow")) { 153 mark = new MarkCard(this);154 114 mark.setObject(Obj.BOYCAR); 155 115 } else if (str.equals("black;red;black")) { 156 mark = new MarkIsol(this);157 116 mark.setObject(Obj.BOYISD); 158 117 } else if (str.equals("red;white")) { 159 mark = new MarkSaw(this);160 118 mark.setObject(Obj.BOYSAW); 161 119 } else if (str.equals("yellow")) { 162 mark = new MarkSpec(this);163 120 mark.setObject(Obj.BOYSPP); 164 121 } … … 166 123 str = keys.get("seamark:light_float:topmark:shape"); 167 124 if (str.equals("cylinder") || str.equals("cone, point up")) { 168 mark = new MarkLat(this);169 125 mark.setObject(Obj.BOYLAT); 170 126 } … … 172 128 str = keys.get("seamark:light_float:topmark:colour"); 173 129 if (str.equals("red") || str.equals("green")) { 174 mark = new MarkLat(this);175 130 mark.setObject(Obj.BOYLAT); 176 131 } 177 132 } 178 133 } else if (keys.containsKey("buoy_lateral:category") || keys.containsKey("buoy_lateral:shape") || keys.containsKey("buoy_lateral:colour")) { 179 mark = new MarkLat(this);180 134 mark.setObject(Obj.BOYLAT); 181 135 } else if (keys.containsKey("beacon_lateral:category") || keys.containsKey("beacon_lateral:shape") || keys.containsKey("beacon_lateral:colour")) { 182 mark = new MarkLat(this);183 136 mark.setObject(Obj.BCNLAT); 184 137 } else if (keys.containsKey("buoy_cardinal:category") || keys.containsKey("buoy_cardinal:shape") || keys.containsKey("buoy_cardinal:colour")) { 185 mark = new MarkCard(this);186 138 mark.setObject(Obj.BOYCAR); 187 139 } else if (keys.containsKey("beacon_cardinal:category") || keys.containsKey("beacon_cardinal:shape") || keys.containsKey("beacon_cardinal:colour")) { 188 mark = new MarkCard(this);189 140 mark.setObject(Obj.BCNCAR); 190 141 } else if (keys.containsKey("buoy_isolated_danger:category") || keys.containsKey("buoy_isolated_danger:shape") || keys.containsKey("buoy_isolated_danger:colour")) { 191 mark = new MarkIsol(this);192 142 mark.setObject(Obj.BOYISD); 193 143 } else if (keys.containsKey("beacon_isolated_danger:category") || keys.containsKey("beacon_isolated_danger:shape") || keys.containsKey("beacon_isolated_danger:colour")) { 194 mark = new MarkIsol(this);195 144 mark.setObject(Obj.BCNISD); 196 145 } else if (keys.containsKey("buoy_safe_water:category") || keys.containsKey("buoy_safe_water:shape") || keys.containsKey("buoy_safe_water:colour")) { 197 mark = new MarkSaw(this);198 146 mark.setObject(Obj.BOYSAW); 199 147 } else if (keys.containsKey("beacon_safe_water:category") || keys.containsKey("beacon_safe_water:shape") || keys.containsKey("beacon_safe_water:colour")) { 200 mark = new MarkSaw(this);201 148 mark.setObject(Obj.BCNSAW); 202 149 } else if (keys.containsKey("buoy_special_purpose:category") || keys.containsKey("buoy_special_purpose:shape") || keys.containsKey("buoy_special_purpose:colour")) { 203 mark = new MarkSpec(this);204 150 mark.setObject(Obj.BOYSPP); 205 151 } else if (keys.containsKey("beacon_special_purpose:category") || keys.containsKey("beacon_special_purpose:shape") || keys.containsKey("beacon_special_purpose:colour")) { 206 mark = new MarkSpec(this);207 152 mark.setObject(Obj.BCNSPP); 208 153 } 209 154 210 if (mark == null) {155 if (mark.getObject() == Obj.UNKNOWN) { 211 156 manager.showVisualMessage(Messages.getString("NoMark")); 212 157 panelMain.clearSelections(); 213 158 } else { 214 if (keys.containsKey("name")) {215 panelMain.nameBox.setText(keys.get("name"));216 panelMain.nameBox.postActionEvent();217 }218 if (keys.containsKey("seamark:name")) {219 panelMain.nameBox.setText(keys.get("seamark:name"));220 panelMain.nameBox.postActionEvent();221 }222 159 if (keys.containsKey("seamark:" + type + ":name")) { 223 160 panelMain.nameBox.setText(keys.get("seamark:" + type + ":name")); 224 161 panelMain.nameBox.postActionEvent(); 225 } 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(""); 226 170 mark.parseMark(); 227 171 mark.paintSign(); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r24917 r24925 21 21 import oseam.seamarks.SeaMark.Shp; 22 22 import oseam.seamarks.SeaMark.Reg; 23 import oseam.seamarks.MarkLat;24 import oseam.seamarks.MarkSaw;25 23 26 24 import java.awt.event.ActionListener; … … 44 42 shp = dlg.mark.getShape(); 45 43 if (portButton.isSelected() || prefPortButton.isSelected()) { 46 if (!(dlg.mark instanceof MarkLat)) {47 dlg.mark = new MarkLat(dlg);44 // if (!(dlg.mark instanceof MarkLat)) { 45 // dlg.mark = new MarkLat(dlg); 48 46 dlg.panelMain.topButton.setEnabled(true); 49 47 dlg.panelMain.fogButton.setEnabled(true); 50 48 dlg.panelMain.radButton.setEnabled(true); 51 49 dlg.panelMain.litButton.setEnabled(true); 52 }50 // } 53 51 dlg.panelMain.panelTop.enableAll(false); 54 52 dlg.panelMain.panelTop.noTopButton.setEnabled(true); … … 109 107 } 110 108 if (stbdButton.isSelected() || prefStbdButton.isSelected()) { 111 if (!(dlg.mark instanceof MarkLat)) {112 dlg.mark = new MarkLat(dlg);109 // if (!(dlg.mark instanceof MarkLat)) { 110 // dlg.mark = new MarkLat(dlg); 113 111 dlg.panelMain.topButton.setEnabled(true); 114 112 dlg.panelMain.fogButton.setEnabled(true); 115 113 dlg.panelMain.radButton.setEnabled(true); 116 114 dlg.panelMain.litButton.setEnabled(true); 117 }115 // } 118 116 dlg.panelMain.panelTop.enableAll(false); 119 117 dlg.panelMain.panelTop.noTopButton.setEnabled(true); … … 174 172 } 175 173 if (safeWaterButton.isSelected()) { 176 if (!(dlg.mark instanceof MarkSaw)) {177 dlg.mark = new MarkSaw(dlg);174 // if (!(dlg.mark instanceof MarkSaw)) { 175 // dlg.mark = new MarkSaw(dlg); 178 176 if (panelSaw.shapes.containsKey(shp)) { 179 177 panelSaw.shapes.get(shp).doClick(); … … 188 186 dlg.panelMain.panelTop.panelCol.redButton.setEnabled(true); 189 187 dlg.panelMain.panelTop.panelCol.redButton.doClick(); 190 }188 // } 191 189 dlg.mark.setColour(Ent.BODY, Col.RED_WHITE); 192 190 safeWaterButton.setBorderPainted(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r24904 r24925 16 16 import oseam.Messages; 17 17 import oseam.dialogs.OSeaMAction; 18 import oseam.seamarks.MarkCard;19 import oseam.seamarks.MarkIsol;20 import oseam.seamarks.MarkLat;21 18 import oseam.seamarks.SeaMark.Cat; 22 19 import oseam.seamarks.SeaMark.Col; … … 37 34 public void actionPerformed(java.awt.event.ActionEvent e) { 38 35 if (catButtons.getSelection() != null) { 39 if (!(dlg.mark instanceof MarkCard) && !isolButton.isSelected()) {40 dlg.mark = new MarkCard(dlg);41 alShape.actionPerformed(null);42 }36 // if (!(dlg.mark instanceof MarkCard) && !isolButton.isSelected()) { 37 // dlg.mark = new MarkCard(dlg); 38 // alShape.actionPerformed(null); 39 // } 43 40 dlg.panelMain.topButton.setEnabled(true); 44 41 dlg.panelMain.fogButton.setEnabled(true); … … 87 84 } 88 85 if (isolButton.isSelected()) { 89 if (!(dlg.mark instanceof MarkIsol)) {90 dlg.mark = new MarkIsol(dlg);91 alShape.actionPerformed(null);92 }86 // if (!(dlg.mark instanceof MarkIsol)) { 87 // dlg.mark = new MarkIsol(dlg); 88 // alShape.actionPerformed(null); 89 // } 93 90 dlg.mark.setColour(Ent.BODY, Col.BLACK_RED_BLACK); 94 91 dlg.panelMain.panelTop.spheres2TopButton.setEnabled(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r24924 r24925 18 18 import oseam.Messages; 19 19 import oseam.dialogs.OSeaMAction; 20 import oseam.seamarks.MarkLat;21 import oseam.seamarks.MarkSaw;22 import oseam.seamarks.MarkCard;23 import oseam.seamarks.MarkIsol;24 import oseam.seamarks.MarkSpec;25 import oseam.seamarks.MarkLight;26 20 27 21 public class PanelMain extends JPanel { … … 125 119 } 126 120 if (chanButton.isSelected()) { 127 if (!((dlg.mark instanceof MarkLat) || (dlg.mark instanceof MarkSaw))) {128 dlg.mark = null;129 clearType();130 }121 // if (!((dlg.mark instanceof MarkLat) || (dlg.mark instanceof MarkSaw))) { 122 // dlg.mark = null; 123 // clearType(); 124 // } 131 125 chanButton.setBorderPainted(true); 132 126 panelChan.setVisible(true); … … 137 131 } 138 132 if (hazButton.isSelected()) { 139 if (!((dlg.mark instanceof MarkCard) || (dlg.mark instanceof MarkIsol))) {140 dlg.mark = null;141 clearType();142 }133 // if (!((dlg.mark instanceof MarkCard) || (dlg.mark instanceof MarkIsol))) { 134 // dlg.mark = null; 135 // clearType(); 136 // } 143 137 hazButton.setBorderPainted(true); 144 138 panelHaz.setVisible(true); … … 149 143 } 150 144 if (specButton.isSelected()) { 151 if (!(dlg.mark instanceof MarkSpec)) {152 dlg.mark = new MarkSpec(dlg);153 clearType();145 // if (!(dlg.mark instanceof MarkSpec)) { 146 // dlg.mark = new MarkSpec(dlg); 147 // clearType(); 154 148 dlg.panelMain.panelSpec.panelCol.yellowButton.doClick(); 155 149 dlg.panelMain.panelTop.enableAll(true); … … 161 155 radButton.setEnabled(true); 162 156 litButton.setEnabled(true); 163 }157 // } 164 158 specButton.setBorderPainted(true); 165 159 panelSpec.setVisible(true); … … 170 164 } 171 165 if (lightsButton.isSelected()) { 172 if (!(dlg.mark instanceof MarkLight)) {173 dlg.mark = new MarkLight(dlg);174 clearType();166 // if (!(dlg.mark instanceof MarkLight)) { 167 // dlg.mark = new MarkLight(dlg); 168 // clearType(); 175 169 fogButton.setEnabled(true); 176 170 radButton.setEnabled(true); 177 171 litButton.setEnabled(true); 178 172 litButton.doClick(); 179 }173 // } 180 174 lightsButton.setBorderPainted(true); 181 175 panelLights.setVisible(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24924 r24925 15 15 import oseam.dialogs.OSeaMAction; 16 16 17 abstractpublic class SeaMark {18 19 p rotectedOSeaMAction dlg = null;17 public class SeaMark { 18 19 public OSeaMAction dlg = null; 20 20 21 21 public OSeaMAction getDlg() { … … 23 23 } 24 24 25 p rotectedSeaMark(OSeaMAction dia) {25 public SeaMark(OSeaMAction dia) { 26 26 dlg = dia; 27 27 region = Main.pref.get("tomsplugin.IALA").equals("A") ? Reg.A : Reg.B; … … 91 91 92 92 public enum Grp { 93 LAT, CAR, SAW, ISD, SPP, LIT93 LAT, CAR, SAW, ISD, SPP, FLT, LIT 94 94 } 95 95 … … 108 108 groups.put(Obj.LITMAJ, Grp.LIT); 109 109 groups.put(Obj.LITMIN, Grp.LIT); 110 groups.put(Obj.LITFLT, Grp. LIT);110 groups.put(Obj.LITFLT, Grp.FLT); 111 111 groups.put(Obj.LITVES, Grp.LIT); 112 112 groups.put(Obj.LNDMRK, Grp.LIT);
Note:
See TracChangeset
for help on using the changeset viewer.