Changeset 23193 in osm for applications/editors/josm/plugins/toms/src
- Timestamp:
- 2010-09-15T19:01:04+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms
- Files:
-
- 16 edited
-
Messages.java (modified) (1 diff)
-
Toms.java (modified) (1 diff)
-
dialogs/SmpDialogAction.java (modified) (1 diff)
-
plug/PluginApp.java (modified) (1 diff)
-
plug/ifc/Pluggable.java (modified) (1 diff)
-
plug/ifc/PluginManager.java (modified) (1 diff)
-
plug/util/PluginLoader.java (modified) (1 diff)
-
seamarks/SeaMark.java (modified) (1 diff)
-
seamarks/buoys/Buoy.java (modified) (1 diff)
-
seamarks/buoys/BuoyCard.java (modified) (1 diff)
-
seamarks/buoys/BuoyIsol.java (modified) (1 diff)
-
seamarks/buoys/BuoyLat.java (modified) (1 diff)
-
seamarks/buoys/BuoyNota.java (modified) (1 diff)
-
seamarks/buoys/BuoySaw.java (modified) (1 diff)
-
seamarks/buoys/BuoySpec.java (modified) (1 diff)
-
seamarks/buoys/BuoyUkn.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified applications/editors/josm/plugins/toms/src/toms/Messages.java ¶
r23007 r23193 5 5 6 6 public class Messages { 7 private static final String BUNDLE_NAME = "toms.msg.messages"; //$NON-NLS-1$7 private static final String BUNDLE_NAME = "toms.msg.messages"; //$NON-NLS-1$ 8 8 9 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle10 .getBundle(BUNDLE_NAME);9 private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle 10 .getBundle(BUNDLE_NAME); 11 11 12 private Messages() {13 }12 private Messages() { 13 } 14 14 15 public static String getString(String key) {16 try {17 return RESOURCE_BUNDLE.getString(key);18 } catch (MissingResourceException e) {19 return '!' + key + '!';20 }21 }15 public static String getString(String key) { 16 try { 17 return RESOURCE_BUNDLE.getString(key); 18 } catch (MissingResourceException e) { 19 return '!' + key + '!'; 20 } 21 } 22 22 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/Toms.java ¶
r23121 r23193 53 53 public class Toms extends Plugin { 54 54 55 private JMenuItem Smp;56 private SmpDialogAction SmpDialog;55 private JMenuItem Smp; 56 private SmpDialogAction SmpDialog; 57 57 58 public Toms(PluginInformation info) {59 super(info);58 public Toms(PluginInformation info) { 59 super(info); 60 60 61 String os = ""; //$NON-NLS-1$62 String userHome = ""; //$NON-NLS-1$61 String os = ""; //$NON-NLS-1$ 62 String userHome = ""; //$NON-NLS-1$ 63 63 64 SmpDialog = new SmpDialogAction();65 Smp = Main.main.menu.toolsMenu.add(SmpDialog);66 // Smp = MainMenu.add(Main.main.menu.toolsMenu, SmpDialog);64 SmpDialog = new SmpDialogAction(); 65 Smp = Main.main.menu.toolsMenu.add(SmpDialog); 66 // Smp = MainMenu.add(Main.main.menu.toolsMenu, SmpDialog); 67 67 68 SmpDialog.setSmpItem(Smp);69 SmpDialog.setOs(os);70 SmpDialog.setUserHome(userHome);71 Smp.setEnabled(false);68 SmpDialog.setSmpItem(Smp); 69 SmpDialog.setOs(os); 70 SmpDialog.setUserHome(userHome); 71 Smp.setEnabled(false); 72 72 73 File pluginDir = Main.pref.getPluginsDirectory();74 String pluginDirName = pluginDir.getAbsolutePath();75 File tplug = new File(pluginDirName + "/tplug");76 if(!tplug.exists()) tplug.mkdir();77 78 // build ifc.jar from toms.jar79 JarEntry ent = null;80 BufferedInputStream inp = null;81 String entName = null;82 byte[] buffer = new byte[16384];83 int len;73 File pluginDir = Main.pref.getPluginsDirectory(); 74 String pluginDirName = pluginDir.getAbsolutePath(); 75 File tplug = new File(pluginDirName + "/tplug"); 76 if(!tplug.exists()) tplug.mkdir(); 77 78 // build ifc.jar from toms.jar 79 JarEntry ent = null; 80 BufferedInputStream inp = null; 81 String entName = null; 82 byte[] buffer = new byte[16384]; 83 int len; 84 84 85 try {86 JarFile file = new JarFile(pluginDirName + "/toms.jar");87 FileOutputStream fos = new FileOutputStream(pluginDirName + "/tplug/ifc.jar");88 JarOutputStream jos = new JarOutputStream(fos);89 BufferedOutputStream oos = new BufferedOutputStream( jos);85 try { 86 JarFile file = new JarFile(pluginDirName + "/toms.jar"); 87 FileOutputStream fos = new FileOutputStream(pluginDirName + "/tplug/ifc.jar"); 88 JarOutputStream jos = new JarOutputStream(fos); 89 BufferedOutputStream oos = new BufferedOutputStream( jos); 90 90 91 ent = file.getJarEntry("toms/plug/ifc/Pluggable.class");92 inp = new BufferedInputStream(file.getInputStream( ent ));93 entName = ent.getName();91 ent = file.getJarEntry("toms/plug/ifc/Pluggable.class"); 92 inp = new BufferedInputStream(file.getInputStream( ent )); 93 entName = ent.getName(); 94 94 95 jos.putNextEntry(new JarEntry(entName));96 97 while ((len = inp.read(buffer)) > 0) {98 oos.write(buffer, 0, len);95 jos.putNextEntry(new JarEntry(entName)); 96 97 while ((len = inp.read(buffer)) > 0) { 98 oos.write(buffer, 0, len); 99 99 } 100 100 101 oos.flush();102 inp.close();103 104 ent = file.getJarEntry("toms/plug/ifc/PluginManager.class");105 inp = new BufferedInputStream(file.getInputStream( ent ));106 entName = ent.getName();107 jos.putNextEntry(new JarEntry(entName));108 109 while ((len = inp.read(buffer)) > 0) {110 oos.write(buffer, 0, len);101 oos.flush(); 102 inp.close(); 103 104 ent = file.getJarEntry("toms/plug/ifc/PluginManager.class"); 105 inp = new BufferedInputStream(file.getInputStream( ent )); 106 entName = ent.getName(); 107 jos.putNextEntry(new JarEntry(entName)); 108 109 while ((len = inp.read(buffer)) > 0) { 110 oos.write(buffer, 0, len); 111 111 } 112 112 113 oos.flush();114 oos.close();115 fos.flush();116 fos.close();117 inp.close();118 119 } catch (Exception e) {120 e.printStackTrace();121 }122 123 124 // add ifc.jar to classpath (josm need this archive, or perhaps only the interface)125 File f = new java.io.File(pluginDirName + "/tplug/ifc.jar");126 ClassLoader myClassLoader = Thread.currentThread().getContextClassLoader();113 oos.flush(); 114 oos.close(); 115 fos.flush(); 116 fos.close(); 117 inp.close(); 118 119 } catch (Exception e) { 120 e.printStackTrace(); 121 } 122 123 124 // add ifc.jar to classpath (josm need this archive, or perhaps only the interface) 125 File f = new java.io.File(pluginDirName + "/tplug/ifc.jar"); 126 ClassLoader myClassLoader = Thread.currentThread().getContextClassLoader(); 127 127 128 try {129 Method addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class});130 addUrlMethod.setAccessible(true);131 addUrlMethod.invoke(myClassLoader, f.toURI().toURL());132 } catch (Exception e) {133 e.printStackTrace();134 }128 try { 129 Method addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class}); 130 addUrlMethod.setAccessible(true); 131 addUrlMethod.invoke(myClassLoader, f.toURI().toURL()); 132 } catch (Exception e) { 133 e.printStackTrace(); 134 } 135 135 136 137 try {138 PluginApp.runPlugins();139 } catch (Exception e) {140 e.printStackTrace();141 }136 137 try { 138 PluginApp.runPlugins(); 139 } catch (Exception e) { 140 e.printStackTrace(); 141 } 142 142 143 }143 } 144 144 145 145 146 @Override147 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {148 if (oldFrame == null && newFrame != null) {149 Smp.setEnabled(true);150 } else {151 Smp.setEnabled(false);152 SmpDialog.CloseDialog();153 }154 }146 @Override 147 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 148 if (oldFrame == null && newFrame != null) { 149 Smp.setEnabled(true); 150 } else { 151 Smp.setEnabled(false); 152 SmpDialog.CloseDialog(); 153 } 154 } 155 155 156 156 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java ¶
r23179 r23193 62 62 63 63 public class SmpDialogAction extends JosmAction { 64 private static final long serialVersionUID = -2976230949744302905L;65 66 /**67 * lokale Variable, private68 */69 private SmpDialogAction dia = null; // Variable für den Handle von70 // SmpDialogAction71 private Buoy buoy = null; // Variable für Objekte des Typs "Tonne" //72 // @jve:decl-index=0:73 private boolean isOpen = false; // zeigt den Status des Dialogs an74 private Node onode = null; // gemerkter Knoten75 private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0:76 private JMenuItem SmpItem = null; // Info über item in der Werkzeugleiste77 private String smt = ""; // value vom key "seamark:type" // @jve:decl-index=0: //$NON-NLS-1$78 private String smb = ""; // value vom key "seamark" // @jve:decl-index=0: //$NON-NLS-1$79 private Collection<? extends OsmPrimitive> Selection = null; // @jve:decl-index=0:80 private OsmPrimitive SelNode = null;81 private String Os = ""; // @jve:decl-index=0: //$NON-NLS-1$82 private String UserHome = ""; // @jve:decl-index=0: //$NON-NLS-1$83 84 // SelectionChangedListner der in die Eventqueue von josm eingehängt wird85 private SelectionChangedListener SmpListener = new SelectionChangedListener() {86 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {87 Node node;88 Selection = newSelection;89 90 // System.out.println("hello");91 for (OsmPrimitive osm : Selection) {92 if (osm instanceof Node) {93 node = (Node) osm;94 if (Selection.size() == 1)95 // Absicherung gegen Doppelevents96 if (node.compareTo(SelNode) != 0) {97 SelNode = node;98 parseSeaMark();99 buoy.paintSign();100 }101 }102 }103 104 Selection = null;105 106 }107 };108 109 /**110 * lokale Variable der Maske111 */112 private JDialog dM01SeaMap = null;113 private JPanel pM01SeaMap = null;114 private JLabel lM01Head = null;115 private JLabel lM01Region = null;116 private JLabel lM02Region = null;117 public ButtonGroup bgM01Region = null;118 public JRadioButton rbM01RegionA = null;119 public JRadioButton rbM01RegionB = null;120 public JLabel lM01Icon = null; // Shape121 public JLabel lM02Icon = null; // Light122 public JLabel lM03Icon = null; // Reflector123 public JLabel lM04Icon = null; // Racon124 public JLabel lM05Icon = null; // Fog125 public JLabel lM01FireMark = null;126 private JLabel lM01TypeOfMark = null;127 public JComboBox cbM01TypeOfMark = null;128 public JLabel lM01CatOfMark = null;129 public JComboBox cbM01CatOfMark = null;130 public JLabel lM01StyleOfMark = null;131 public JComboBox cbM01StyleOfMark = null;132 private JLabel lM01Name = null;133 public JTextField tfM01Name = null;134 private JLabel lM01Props02 = null;135 public JCheckBox cM01TopMark = null;136 public JComboBox cbM01TopMark = null;137 public JCheckBox cM01Radar = null;138 public JCheckBox cM01Racon = null;139 public JComboBox cbM01Racon = null;140 public JTextField tfM01Racon = null;141 public JLabel lM01Racon = null;142 public JCheckBox cM01Fog = null;143 public JComboBox cbM01Fog = null;144 public JLabel lM01FogGroup = null;145 public JTextField tfM01FogGroup = null;146 public JLabel lM01FogPeriod = null;147 public JTextField tfM01FogPeriod = null;148 public JCheckBox cM01Fired = null;149 public ButtonGroup bgM01Fired = null;150 public JRadioButton rbM01Fired1 = null;151 public JRadioButton rbM01FiredN = null;152 public JLabel lM01Kennung = null;153 public JComboBox cbM01Kennung = null;154 public JLabel lM01Height = null;155 public JTextField tfM01Height = null;156 public JLabel lM01Range = null;157 public JTextField tfM01Range = null;158 public JLabel lM01Group = null;159 public JTextField tfM01Group = null;160 public JLabel lM01RepeatTime = null;161 public JTextField tfM01RepeatTime = null;162 public JLabel lM01Sector = null;163 public JComboBox cbM01Sector = null;164 public JLabel lM01Colour = null;165 public JComboBox cbM01Colour = null;166 public JLabel lM01Bearing = null;167 public JTextField tfM01Bearing = null;168 public JTextField tfM02Bearing = null;169 public JTextField tfM01Radius = null;170 public JButton bM01Save = null;171 public JButton bM01Close = null;172 public JCheckBox cM01IconVisible = null;173 public JTextField sM01StatusBar = null;174 175 public boolean paintlock = false;176 177 public JMenuItem getSmpItem() {178 return SmpItem;179 }180 181 public void setSmpItem(JMenuItem smpItem) {182 SmpItem = smpItem;183 }184 185 public boolean isOpen() {186 return isOpen;187 }188 189 public void setOpen(boolean isOpen) {190 this.isOpen = isOpen;191 }192 193 public String getOs() {194 return Os;195 }196 197 public void setOs(String os) {198 Os = os;199 }200 201 public String getUserHome() {202 return UserHome;203 }204 205 public void setUserHome(String userHome) {206 UserHome = userHome;207 }208 209 public SmpDialogAction() {210 super(211 Messages.getString("SmpDialogAction.4"), "Smp", Messages.getString("SmpDialogAction.0"), Shortcut //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$212 .registerShortcut(213 "tools:Semarks", //$NON-NLS-1$214 tr("Tool: {0}", Messages.getString("SmpDialogAction.9")), KeyEvent.VK_S, //$NON-NLS-1$ //$NON-NLS-2$215 Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);216 217 dia = this;218 String str = Main.pref.get("mappaint.style.sources"); //$NON-NLS-1$219 if (!str.contains("dev.openseamap.org")) { //$NON-NLS-1$220 if (!str.isEmpty()) //$NON-NLS-1$221 str += new String(new char[] { 0x1e });222 Main.pref.put("mappaint.style.sources", str //$NON-NLS-1$223 + "http://dev.openseamap.org/josm/seamark_styles.xml"); //$NON-NLS-1$224 }225 str = Main.pref.get("color.background"); //$NON-NLS-1$226 if (str.equals("#000000") || str.isEmpty()) //$NON-NLS-1$ //$NON-NLS-2$227 Main.pref.put("color.background", "#606060"); //$NON-NLS-1$ //$NON-NLS-2$228 }229 230 public void CloseDialog() {231 onode = null;232 DataSet.removeSelectionListener(SmpListener);233 Selection = null;234 235 if (isOpen)236 dM01SeaMap.dispose();237 isOpen = false;238 239 }240 241 public void actionPerformed(ActionEvent e) {242 243 /*244 * int option = JOptionPane.showConfirmDialog(Main.parent,245 * tr("THIS IS EXPERIMENTAL. Save your work and verify before uploading.\n"246 * + "Are you really sure to continue?"),247 * tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,248 * JOptionPane.WARNING_MESSAGE);249 * 250 * if (option != JOptionPane.YES_OPTION) { return; }251 */252 253 onode = null;254 obuoy = null;255 256 SwingUtilities.invokeLater(new Runnable() {257 public void run() {258 JDialog dialog = getDM01SeaMap();259 260 if (SmpItem == null) {261 }262 dialog.setVisible(true);263 }264 });265 266 setOpen(true);267 268 if (SmpItem == null) {269 return;270 }271 SmpItem.setEnabled(false);272 273 // Ausprobe: Möglichkeit der Benachrichtigung, wenn etwas neu274 // selektiert wird (ueber SelectionChangedListener)275 // private Collection<? extends OsmPrimitive> sel;276 // siehe org.openstreetmap.josm.plugins.osb -> OsbLayer.java277 // Einhängen des Listeners in die Eventqueue von josm278 DataSet.addSelectionListener(SmpListener);279 }280 281 private void PicRebuild() {282 283 DataSet ds = Main.main.getCurrentDataSet();284 285 if (obuoy == null) {286 return;287 }288 289 Node n = obuoy.getNode();290 291 if (n != null) {292 Command c;293 294 if (smb != "") { //$NON-NLS-1$295 296 c = new ChangePropertyCommand(n, "seamark", smb); //$NON-NLS-1$297 c.executeCommand();298 ds.fireSelectionChanged();299 300 smb = ""; //$NON-NLS-1$301 }302 303 if (smt != "") { //$NON-NLS-1$304 305 c = new ChangePropertyCommand(n, "seamark:type", smt); //$NON-NLS-1$306 c.executeCommand();307 ds.fireSelectionChanged();308 309 smt = ""; //$NON-NLS-1$310 }311 }312 313 obuoy = null;314 315 }316 317 private void parseSeaMark() {318 319 int nodes = 0;320 Node node = null;321 Collection<Node> selection = null;322 Map<String, String> keys;323 DataSet ds;324 325 ds = Main.main.getCurrentDataSet();326 327 if (ds == null) {328 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.26")); //$NON-NLS-1$329 buoy.setNode(null);330 return;331 }332 333 selection = ds.getSelectedNodes();334 nodes = selection.size();335 336 if (nodes == 0) {337 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.27")); //$NON-NLS-1$338 buoy.setNode(null);339 return;340 }341 342 if (nodes > 1) {343 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.28")); //$NON-NLS-1$344 buoy.setNode(null);345 return;346 }347 348 Iterator<Node> it = selection.iterator();349 node = it.next();350 351 if (onode != null)352 if (node.equals(onode))353 return;354 355 // Knoten wurde gewechselt -> die alten tags (benutzt zum Ausblenden der356 // Pictogramme) wiederherstellen357 if (obuoy != null)358 PicRebuild();359 360 onode = node;361 362 cM01IconVisible.setEnabled(true);363 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(364 "/images/Auge.png"))); //$NON-NLS-1$365 366 cbM01TypeOfMark.setEnabled(true);367 368 // Soweit das Vorspiel. Ab hier beginnt das Parsen369 String type = ""; //$NON-NLS-1$370 String str = ""; //$NON-NLS-1$371 372 keys = node.getKeys();373 374 // vorsorglich den Namen holen und verwenden, wenn es ein375 // Seezeichen ist. Name kann durch die weiteren Tags ueber-376 // schrieben werden377 378 if (keys.containsKey("seamark:type")) //$NON-NLS-1$379 type = keys.get("seamark:type"); //$NON-NLS-1$380 381 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$382 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$383 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$384 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$385 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$386 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$387 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$388 buoy = new BuoyLat(this, node);389 return;390 391 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$392 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$393 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$394 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$395 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$396 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$397 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$398 buoy = new BuoyCard(this, node);399 return;400 401 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$402 || type.equals("beacon_safe_water") //$NON-NLS-1$403 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$404 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$405 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$406 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$407 buoy = new BuoySaw(this, node);408 return;409 410 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$411 || type.equals("beacon_special_purpose") //$NON-NLS-1$412 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$413 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$414 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$415 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$416 buoy = new BuoySpec(this, node);417 return;418 419 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$420 || type.equals("beacon_isolated_danger") //$NON-NLS-1$421 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$422 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$423 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$424 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$425 buoy = new BuoyIsol(this, node);426 return;427 428 } else if (type.equals("landmark") || type.equals("light_vessel") //$NON-NLS-1$429 || type.equals("light_major") || type.equals("light_minor")) { //$NON-NLS-1$430 buoy = new BuoyNota(this, node);431 return;432 433 } else if (type.equals("light_float")) { //$NON-NLS-1$434 if (keys.containsKey("seamark:light_float:colour")) { //$NON-NLS-1$435 str = keys.get("seamark:light_float:colour"); //$NON-NLS-1$436 if (str.equals("red") || str.equals("green") //$NON-NLS-1$ //$NON-NLS-2$437 || str.equals("red;green;red") || str.equals("green;red;green")) { //$NON-NLS-1$ //$NON-NLS-2$438 buoy = new BuoyLat(this, node);439 return;440 } else if (str.equals("black;yellow") //$NON-NLS-1$441 || str.equals("black;yellow;black") || str.equals("yellow;black") //$NON-NLS-1$ //$NON-NLS-2$442 || str.equals("yellow;black;yellow")) { //$NON-NLS-1$443 buoy = new BuoyCard(this, node);444 return;445 } else if (str.equals("black;red;black")) { //$NON-NLS-1$446 buoy = new BuoyIsol(this, node);447 return;448 } else if (str.equals("red;white")) { //$NON-NLS-1$449 buoy = new BuoySaw(this, node);450 return;451 } else if (str.equals("yellow")) { //$NON-NLS-1$452 buoy = new BuoySpec(this, node);453 return;454 }455 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { //$NON-NLS-1$456 str = keys.get("seamark:light_float:topmark:shape"); //$NON-NLS-1$457 if (str.equals("cylinder") || str.equals("cone, point up")) { //$NON-NLS-1$ //$NON-NLS-2$458 buoy = new BuoyLat(this, node);459 return;460 }461 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { //$NON-NLS-1$462 str = keys.get("seamark:light_float:topmark:colour"); //$NON-NLS-1$463 if (str.equals("red") || str.equals("green")) { //$NON-NLS-1$ //$NON-NLS-2$464 buoy = new BuoyLat(this, node);465 return;466 }467 }468 }469 470 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.91")); //$NON-NLS-1$471 buoy.setNode(node);472 return;473 }474 475 private JDialog getDM01SeaMap() {476 477 if (dM01SeaMap == null) {478 dM01SeaMap = new JDialog();479 dM01SeaMap.setSize(new Dimension(400, 400));480 dM01SeaMap.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);481 dM01SeaMap.setModal(false);482 dM01SeaMap.setResizable(false);483 dM01SeaMap.setContentPane(getPM01SeaMap());484 dM01SeaMap.setTitle(Messages.getString("SmpDialogAction.9")); //$NON-NLS-1$485 dM01SeaMap.setVisible(false);486 dM01SeaMap.setAlwaysOnTop(true);487 dM01SeaMap.addWindowListener(new java.awt.event.WindowAdapter() {488 public void windowClosing(java.awt.event.WindowEvent e) {489 490 // Pictogramme wiederherstellen und aufraeumen491 if (obuoy != null)492 PicRebuild();493 // Deaktivierung des Listeners494 DataSet.removeSelectionListener(SmpListener);495 Selection = null;496 497 SmpItem.setEnabled(true);498 }499 500 public void windowActivated(WindowEvent arg0) {501 parseSeaMark();502 buoy.paintSign();503 }504 });505 }506 return dM01SeaMap;507 }508 509 private JPanel getPM01SeaMap() {510 if (pM01SeaMap == null) {511 512 lM01Icon = new JLabel();513 lM01Icon.setBounds(new Rectangle(210, 20, 150, 200));514 lM01Icon.setIcon(null);515 lM01Icon.setText(""); //$NON-NLS-1$516 517 lM02Icon = new JLabel();518 lM02Icon.setBounds(new Rectangle(210, 20, 150, 200));519 lM02Icon.setIcon(null);520 lM02Icon.setText(""); //$NON-NLS-1$521 522 lM03Icon = new JLabel();523 lM03Icon.setBounds(new Rectangle(210, -50, 150, 200));524 lM03Icon.setIcon(null);525 lM03Icon.setText(""); //$NON-NLS-1$526 527 lM04Icon = new JLabel();528 lM04Icon.setBounds(new Rectangle(210, 20, 150, 200));529 lM04Icon.setIcon(null);530 lM04Icon.setText(""); //$NON-NLS-1$531 532 lM05Icon = new JLabel();533 lM05Icon.setBounds(new Rectangle(210, 20, 150, 200));534 lM05Icon.setIcon(null);535 lM05Icon.setText(""); //$NON-NLS-1$536 537 lM01FireMark = new JLabel();538 lM01FireMark.setBounds(new Rectangle(300, 85, 95, 20));539 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$540 lM01FireMark.setText(""); //$NON-NLS-1$541 542 lM01Head = new JLabel();543 lM01Head.setBounds(new Rectangle(5, 3, 316, 16));544 lM01Head.setText(Messages.getString("SmpDialogAction.97")); //$NON-NLS-1$545 546 lM01Region = new JLabel();547 lM01Region.setBounds(new Rectangle(220, 7, 120, 16));548 lM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$549 lM01Region.setText(Messages.getString("SmpDialogAction.99")); //$NON-NLS-1$550 551 lM02Region = new JLabel();552 lM02Region.setBounds(new Rectangle(270, 7, 120, 16));553 lM02Region.setFont(new Font("Dialog", Font.BOLD, 12)); //$NON-NLS-1$554 lM02Region.setText(Messages.getString("SmpDialogAction.101")); //$NON-NLS-1$555 556 lM01TypeOfMark = new JLabel();557 lM01TypeOfMark.setBounds(new Rectangle(5, 28, 120, 16));558 lM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$559 lM01TypeOfMark.setText(Messages.getString("SmpDialogAction.103")); //$NON-NLS-1$560 561 lM01CatOfMark = new JLabel();562 lM01CatOfMark.setBounds(new Rectangle(5, 58, 120, 16));563 lM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$564 lM01CatOfMark.setText(Messages.getString("SmpDialogAction.1")); //$NON-NLS-1$565 566 lM01StyleOfMark = new JLabel();567 lM01StyleOfMark.setBounds(new Rectangle(5, 88, 148, 16));568 lM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$569 lM01StyleOfMark.setText(Messages.getString("SmpDialogAction.107")); //$NON-NLS-1$570 571 lM01Name = new JLabel();572 lM01Name.setBounds(new Rectangle(5, 120, 82, 16));573 lM01Name.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$574 lM01Name.setText(Messages.getString("SmpDialogAction.109")); //$NON-NLS-1$575 576 lM01Props02 = new JLabel();577 lM01Props02.setBounds(new Rectangle(5, 150, 172, 16));578 lM01Props02.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$579 lM01Props02.setText(Messages.getString("SmpDialogAction.111")); //$NON-NLS-1$580 581 lM01Racon = new JLabel();582 lM01Racon.setBounds(new Rectangle(335, 195, 65, 20));583 lM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$584 lM01Racon.setText(Messages.getString("SmpDialogAction.113")); //$NON-NLS-1$585 586 lM01FogGroup = new JLabel();587 lM01FogGroup.setBounds(new Rectangle(190, 220, 100, 20));588 lM01FogGroup.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$589 lM01FogGroup.setText(Messages.getString("SmpDialogAction.115")); //$NON-NLS-1$590 591 lM01FogPeriod = new JLabel();592 lM01FogPeriod.setBounds(new Rectangle(300, 220, 100, 20));593 lM01FogPeriod.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$594 lM01FogPeriod.setText(Messages.getString("SmpDialogAction.117")); //$NON-NLS-1$595 596 lM01Kennung = new JLabel();597 lM01Kennung.setBounds(new Rectangle(240, 245, 60, 20));598 lM01Kennung.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$599 lM01Kennung.setText(Messages.getString("SmpDialogAction.119")); //$NON-NLS-1$600 601 lM01Height = new JLabel();602 lM01Height.setBounds(new Rectangle(10, 270, 100, 20));603 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$604 lM01Height.setText(Messages.getString("SmpDialogAction.121")); //$NON-NLS-1$605 606 lM01Range = new JLabel();607 lM01Range.setBounds(new Rectangle(108, 270, 100, 20));608 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$609 lM01Range.setText(Messages.getString("SmpDialogAction.123")); //$NON-NLS-1$610 611 lM01Group = new JLabel();612 lM01Group.setBounds(new Rectangle(204, 270, 100, 20));613 lM01Group.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$614 lM01Group.setText(Messages.getString("SmpDialogAction.125")); //$NON-NLS-1$615 616 lM01RepeatTime = new JLabel();617 lM01RepeatTime.setBounds(new Rectangle(300, 270, 100, 20));618 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$619 lM01RepeatTime.setText(Messages.getString("SmpDialogAction.127")); //$NON-NLS-1$620 621 lM01Sector = new JLabel();622 lM01Sector.setBounds(new Rectangle(10, 295, 180, 20));623 lM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$624 lM01Sector.setText(Messages.getString("SmpDialogAction.129")); //$NON-NLS-1$625 626 lM01Colour = new JLabel();627 lM01Colour.setBounds(new Rectangle(120, 295, 180, 20));628 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$629 lM01Colour.setText(Messages.getString("SmpDialogAction.131")); //$NON-NLS-1$630 631 lM01Bearing = new JLabel();632 lM01Bearing.setBounds(new Rectangle(228, 295, 180, 20));633 lM01Bearing.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$634 lM01Bearing.setText(Messages.getString("SmpDialogAction.133")); //$NON-NLS-1$635 636 rbM01RegionA = new JRadioButton(637 Messages.getString("SmpDialogAction.134"), Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$638 .equals("A")); //$NON-NLS-1$639 rbM01RegionA.setBounds(new Rectangle(305, 0, 50, 30));640 rbM01RegionB = new JRadioButton("-B", Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$641 .equals("B")); //$NON-NLS-1$642 rbM01RegionB.setBounds(new Rectangle(352, 0, 50, 30));643 bgM01Region = new ButtonGroup();644 bgM01Region.add(rbM01RegionA);645 bgM01Region.add(rbM01RegionB);646 647 ActionListener alM01Region = new ActionListener() {648 public void actionPerformed(java.awt.event.ActionEvent e) {649 if (buoy instanceof BuoyLat) {650 buoy.setRegion(rbM01RegionB.isSelected());651 buoy.setLightColour();652 buoy.paintSign();653 }654 }655 };656 rbM01RegionA.addActionListener(alM01Region);657 rbM01RegionB.addActionListener(alM01Region);658 659 rbM01Fired1 = new JRadioButton(660 Messages.getString("SmpDialogAction.140"), true); //$NON-NLS-1$661 rbM01Fired1.setBounds(new Rectangle(85, 240, 70, 30));662 rbM01FiredN = new JRadioButton(663 Messages.getString("SmpDialogAction.141"), false); //$NON-NLS-1$664 rbM01FiredN.setBounds(new Rectangle(155, 240, 80, 30));665 bgM01Fired = new ButtonGroup();666 bgM01Fired.add(rbM01Fired1);667 bgM01Fired.add(rbM01FiredN);668 669 ActionListener alM01Fired = new ActionListener() {670 public void actionPerformed(java.awt.event.ActionEvent e) {671 buoy.setSectored(rbM01FiredN.isSelected());672 cbM01Sector.setSelectedIndex(0);673 buoy.setSectorIndex(0);674 buoy.paintSign();675 }676 };677 rbM01Fired1.addActionListener(alM01Fired);678 rbM01FiredN.addActionListener(alM01Fired);679 680 pM01SeaMap = new JPanel();681 pM01SeaMap.setLayout(null);682 pM01SeaMap.add(lM01Head, null);683 pM01SeaMap.add(rbM01RegionA, null);684 pM01SeaMap.add(rbM01RegionB, null);685 pM01SeaMap.add(lM01Region, null);686 pM01SeaMap.add(lM02Region, null);687 pM01SeaMap.add(lM01Icon, null);688 pM01SeaMap.add(lM02Icon, null);689 pM01SeaMap.add(lM03Icon, null);690 pM01SeaMap.add(lM04Icon, null);691 pM01SeaMap.add(lM05Icon, null);692 pM01SeaMap.add(getCbM01TypeOfMark(), null);693 pM01SeaMap.add(lM01TypeOfMark, null);694 pM01SeaMap.add(getCbM01CatOfMark(), null);695 pM01SeaMap.add(lM01CatOfMark, null);696 pM01SeaMap.add(getCbM01StyleOfMark(), null);697 pM01SeaMap.add(lM01StyleOfMark, null);698 pM01SeaMap.add(lM01Name, null);699 pM01SeaMap.add(getTfM01Name(), null);700 pM01SeaMap.add(lM01Props02, null);701 pM01SeaMap.add(getCM01TopMark(), null);702 pM01SeaMap.add(getCbM01TopMark(), null);703 pM01SeaMap.add(getCM01Radar(), null);704 pM01SeaMap.add(getCM01Racon(), null);705 pM01SeaMap.add(getCbM01Racon(), null);706 pM01SeaMap.add(getTfM01Racon(), null);707 pM01SeaMap.add(lM01Racon, null);708 pM01SeaMap.add(getCM01Fog(), null);709 pM01SeaMap.add(getCbM01Fog(), null);710 pM01SeaMap.add(getTfM01FogGroup(), null);711 pM01SeaMap.add(lM01FogGroup, null);712 pM01SeaMap.add(getTfM01FogPeriod(), null);713 pM01SeaMap.add(lM01FogPeriod, null);714 pM01SeaMap.add(getCM01Fired(), null);715 pM01SeaMap.add(rbM01Fired1, null);716 pM01SeaMap.add(rbM01FiredN, null);717 pM01SeaMap.add(getTfM01RepeatTime(), null);718 pM01SeaMap.add(lM01RepeatTime, null);719 pM01SeaMap.add(getCbM01Kennung(), null);720 pM01SeaMap.add(lM01Kennung, null);721 pM01SeaMap.add(lM01Group, null);722 pM01SeaMap.add(getTfM01Group(), null);723 pM01SeaMap.add(lM01Sector, null);724 pM01SeaMap.add(getCbM01Sector(), null);725 pM01SeaMap.add(lM01Colour, null);726 pM01SeaMap.add(getCbM01Colour(), null);727 pM01SeaMap.add(lM01Bearing, null);728 pM01SeaMap.add(getTfM01Bearing(), null);729 pM01SeaMap.add(getTfM02Bearing(), null);730 pM01SeaMap.add(getTfM01Radius(), null);731 pM01SeaMap.add(lM01Height, null);732 pM01SeaMap.add(getTfM01Height(), null);733 pM01SeaMap.add(lM01Range, null);734 pM01SeaMap.add(getTfM01Range(), null);735 pM01SeaMap.add(lM01FireMark, null);736 pM01SeaMap.add(getBM01Save(), null);737 pM01SeaMap.add(getSM01StatusBar(), null);738 pM01SeaMap.add(getBM01Close(), null);739 pM01SeaMap.add(getCM01IconVisible(), null);740 }741 return pM01SeaMap;742 }743 744 private JComboBox getCbM01TypeOfMark() {745 746 if (cbM01TypeOfMark == null) {747 748 cbM01TypeOfMark = new JComboBox();749 750 // Inhalt der ComboBox751 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.142")); //$NON-NLS-1$752 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.143")); //$NON-NLS-1$753 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.144")); //$NON-NLS-1$754 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.145")); //$NON-NLS-1$755 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.146")); //$NON-NLS-1$756 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.147")); //$NON-NLS-1$757 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.148")); //$NON-NLS-1$758 759 cbM01TypeOfMark.setBounds(new Rectangle(45, 25, 165, 25));760 // cbM01TypeOfMark.setEditable(false);761 cbM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$762 cbM01TypeOfMark.setEnabled(true);763 764 cbM01TypeOfMark.addActionListener(new ActionListener() {765 public void actionPerformed(java.awt.event.ActionEvent e) {766 int type = cbM01TypeOfMark.getSelectedIndex();767 768 if (buoy == null) {769 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$770 return;771 }772 773 Node n = buoy.getNode();774 if (n == null)775 return;776 777 paintlock = true;778 switch (type) {779 780 case SeaMark.UNKNOWN_TYPE:781 if (!(buoy instanceof BuoyUkn))782 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$783 buoy.setBuoyIndex(type);784 break;785 786 case SeaMark.LATERAL:787 if (!(buoy instanceof BuoyLat)) {788 buoy = new BuoyLat(dia, n);789 buoy.setBuoyIndex(0);790 }791 break;792 793 case SeaMark.CARDINAL:794 if (!(buoy instanceof BuoyCard)) {795 buoy = new BuoyCard(dia, n);796 buoy.setBuoyIndex(0);797 }798 break;799 800 case SeaMark.SAFE_WATER:801 if (!(buoy instanceof BuoySaw)) {802 buoy = new BuoySaw(dia, n);803 }804 buoy.setBuoyIndex(type);805 break;806 807 case SeaMark.ISOLATED_DANGER:808 if (!(buoy instanceof BuoyIsol)) {809 buoy = new BuoyIsol(dia, n);810 }811 buoy.setBuoyIndex(type);812 break;813 814 case SeaMark.SPECIAL_PURPOSE:815 if (!(buoy instanceof BuoySpec)) {816 buoy = new BuoySpec(dia, n);817 }818 buoy.setBuoyIndex(type);819 break;820 821 case SeaMark.LIGHT:822 if (!(buoy instanceof BuoyNota)) {823 buoy = new BuoyNota(dia, n);824 buoy.setBuoyIndex(0);825 }826 break;827 }828 829 buoy.refreshStyles();830 buoy.refreshLights();831 buoy.setLightColour();832 paintlock = false;833 buoy.paintSign();834 }835 });836 }837 return cbM01TypeOfMark;838 }839 840 private JComboBox getCbM01CatOfMark() {841 if (cbM01CatOfMark == null) {842 cbM01CatOfMark = new JComboBox();843 cbM01CatOfMark.setBounds(new Rectangle(60, 55, 150, 25));844 cbM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$845 cbM01CatOfMark.setEnabled(true);846 847 cbM01CatOfMark.addActionListener(new ActionListener() {848 public void actionPerformed(ActionEvent e) {849 int cat = cbM01CatOfMark.getSelectedIndex();850 851 if (buoy == null) {852 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$853 return;854 }855 856 Node n = buoy.getNode();857 if (n == null)858 return;859 860 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LATERAL) {861 if (!(buoy instanceof BuoyLat))862 buoy = new BuoyLat(dia, n);863 buoy.setBuoyIndex(cat);864 }865 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.CARDINAL) {866 if (!(buoy instanceof BuoyCard))867 buoy = new BuoyCard(dia, n);868 buoy.setBuoyIndex(cat);869 }870 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LIGHT) {871 if (!(buoy instanceof BuoyNota))872 buoy = new BuoyNota(dia, n);873 buoy.setBuoyIndex(cat);874 }875 876 buoy.refreshStyles();877 buoy.refreshLights();878 buoy.setLightColour();879 buoy.paintSign();880 }881 });882 }883 return cbM01CatOfMark;884 }885 886 private JComboBox getCbM01StyleOfMark() {887 if (cbM01StyleOfMark == null) {888 cbM01StyleOfMark = new JComboBox();889 cbM01StyleOfMark.setBounds(new Rectangle(45, 85, 165, 25));890 cbM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$891 cbM01StyleOfMark.addActionListener(new ActionListener() {892 public void actionPerformed(ActionEvent e) {893 int style = cbM01StyleOfMark.getSelectedIndex();894 if (buoy != null && style != buoy.getStyleIndex()) {895 buoy.setStyleIndex(style);896 buoy.paintSign();897 }898 }899 });900 }901 return cbM01StyleOfMark;902 }903 904 private JTextField getTfM01Name() {905 if (tfM01Name == null) {906 tfM01Name = new JTextField();907 tfM01Name.setBounds(new Rectangle(50, 120, 150, 20));908 tfM01Name.addFocusListener(new FocusAdapter() {909 public void focusLost(FocusEvent e) {910 buoy.setName(tfM01Name.getText());911 }912 });913 }914 return tfM01Name;915 }916 917 private JCheckBox getCM01TopMark() {918 if (cM01TopMark == null) {919 cM01TopMark = new JCheckBox();920 cM01TopMark.setBounds(new Rectangle(10, 170, 100, 20));921 cM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$922 cM01TopMark.setText(Messages.getString("SmpDialogAction.166")); //$NON-NLS-1$923 cM01TopMark.addItemListener(new ItemListener() {924 public void itemStateChanged(ItemEvent e) {925 if (buoy == null) {926 return;927 }928 buoy.setTopMark(cM01TopMark.isSelected());929 buoy.paintSign();930 }931 });932 }933 return cM01TopMark;934 }935 936 private JComboBox getCbM01TopMark() {937 if (cbM01TopMark == null) {938 cbM01TopMark = new JComboBox();939 cbM01TopMark.setBounds(new Rectangle(110, 170, 80, 20));940 cbM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$941 cbM01TopMark.addActionListener(new ActionListener() {942 public void actionPerformed(ActionEvent e) {943 int top = cbM01TopMark.getSelectedIndex();944 buoy.paintSign();945 }946 });947 }948 return cbM01TopMark;949 }950 951 private JCheckBox getCM01Radar() {952 if (cM01Radar == null) {953 cM01Radar = new JCheckBox();954 cM01Radar.setBounds(new Rectangle(10, 195, 120, 20));955 cM01Radar.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$956 cM01Radar.setText(Messages.getString("SmpDialogAction.169")); //$NON-NLS-1$957 cM01Radar.addActionListener(new ActionListener() {958 public void actionPerformed(ActionEvent e) {959 if (cM01Radar.isSelected()) {960 buoy.setRadar(true);961 buoy.setRacon(false);962 cM01Racon.setSelected(false);963 } else {964 buoy.setRadar(false);965 }966 buoy.paintSign();967 }968 });969 }970 return cM01Radar;971 }972 973 private JCheckBox getCM01Racon() {974 if (cM01Racon == null) {975 cM01Racon = new JCheckBox();976 cM01Racon.setBounds(new Rectangle(130, 195, 110, 20));977 cM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$978 cM01Racon.setText(Messages.getString("SmpDialogAction.171")); //$NON-NLS-1$979 cM01Racon.addActionListener(new ActionListener() {980 public void actionPerformed(ActionEvent e) {981 if (cM01Racon.isSelected()) {982 buoy.setRacon(true);983 buoy.setRadar(false);984 cM01Radar.setSelected(false);985 } else {986 buoy.setRacon(false);987 }988 buoy.paintSign();989 }990 });991 }992 return cM01Racon;993 }994 995 private JComboBox getCbM01Racon() {996 if (cbM01Racon == null) {997 cbM01Racon = new JComboBox();998 cbM01Racon.setBounds(new Rectangle(240, 195, 80, 20));999 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1000 cbM01Racon.removeAllItems();1001 cbM01Racon.addItem("Any");1002 cbM01Racon.addItem("Racon");1003 cbM01Racon.addItem("Ramark");1004 cbM01Racon.addItem("Leading");1005 cbM01Racon.addActionListener(new ActionListener() {1006 public void actionPerformed(ActionEvent e) {1007 int rac = cbM01Racon.getSelectedIndex();1008 buoy.setRaType(rac);1009 buoy.paintSign();1010 }1011 });1012 }1013 return cbM01Racon;1014 }1015 1016 private JTextField getTfM01Racon() {1017 if (tfM01Racon == null) {1018 tfM01Racon = new JTextField();1019 tfM01Racon.setBounds(new Rectangle(345, 195, 30, 20));1020 tfM01Racon.addFocusListener(new FocusAdapter() {1021 public void focusLost(FocusEvent e) {1022 buoy.setRaconGroup(tfM01Racon.getText().trim());1023 }1024 });1025 }1026 return tfM01Racon;1027 }1028 1029 private JCheckBox getCM01Fog() {1030 if (cM01Fog == null) {1031 cM01Fog = new JCheckBox();1032 cM01Fog.setBounds(new Rectangle(10, 220, 90, 20));1033 cM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1034 cM01Fog.setText(Messages.getString("SmpDialogAction.174")); //$NON-NLS-1$1035 cM01Fog.addActionListener(new ActionListener() {1036 public void actionPerformed(ActionEvent e) {1037 buoy.setFog(cM01Fog.isSelected());1038 buoy.paintSign();1039 }1040 });1041 }1042 return cM01Fog;1043 }1044 1045 private JComboBox getCbM01Fog() {1046 if (cbM01Fog == null) {1047 cbM01Fog = new JComboBox();1048 cbM01Fog.setBounds(new Rectangle(100, 220, 70, 20));1049 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1050 cbM01Fog.removeAllItems();1051 cbM01Fog.addItem("Any");1052 cbM01Fog.addItem("Horn");1053 cbM01Fog.addItem("Siren");1054 cbM01Fog.addItem("Dia");1055 cbM01Fog.addItem("Bell");1056 cbM01Fog.addItem("Whis");1057 cbM01Fog.addItem("Gong");1058 cbM01Fog.addItem("Explos");1059 cbM01Fog.addActionListener(new ActionListener() {1060 public void actionPerformed(ActionEvent e) {1061 if (cbM01Fog.getSelectedIndex() > 0)1062 buoy.setFogSound(cbM01Fog.getSelectedIndex());1063 else1064 buoy.setFogSound(0);1065 buoy.paintSign();1066 }1067 });1068 }1069 return cbM01Fog;1070 }1071 1072 private JTextField getTfM01FogGroup() {1073 if (tfM01FogGroup == null) {1074 tfM01FogGroup = new JTextField();1075 tfM01FogGroup.setBounds(new Rectangle(243, 220, 30, 20));1076 tfM01FogGroup.addFocusListener(new FocusAdapter() {1077 public void focusLost(FocusEvent e) {1078 buoy.setFogGroup(tfM01FogGroup.getText().trim());1079 }1080 });1081 }1082 return tfM01FogGroup;1083 }1084 1085 private JTextField getTfM01FogPeriod() {1086 if (tfM01FogPeriod == null) {1087 tfM01FogPeriod = new JTextField();1088 tfM01FogPeriod.setBounds(new Rectangle(345, 220, 30, 20));1089 tfM01FogPeriod.addFocusListener(new FocusAdapter() {1090 public void focusLost(FocusEvent e) {1091 buoy.setFogPeriod(tfM01FogPeriod.getText().trim());1092 }1093 });1094 }1095 return tfM01FogPeriod;1096 }1097 1098 private JCheckBox getCM01Fired() {1099 if (cM01Fired == null) {1100 cM01Fired = new JCheckBox();1101 cM01Fired.setBounds(new Rectangle(10, 245, 75, 20));1102 cM01Fired.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1103 cM01Fired.setText(Messages.getString("SmpDialogAction.177")); //$NON-NLS-1$1104 cM01Fired.addItemListener(new ItemListener() {1105 public void itemStateChanged(ItemEvent e) {1106 if (buoy == null) {1107 return;1108 }1109 buoy.setFired(cM01Fired.isSelected());1110 buoy.setLightColour();1111 buoy.paintSign();1112 }1113 });1114 }1115 1116 return cM01Fired;1117 }1118 1119 private JComboBox getCbM01Kennung() {1120 if (cbM01Kennung == null) {1121 cbM01Kennung = new JComboBox();1122 cbM01Kennung.setBounds(new Rectangle(305, 245, 70, 20));1123 cbM01Kennung.addActionListener(new ActionListener() {1124 public void actionPerformed(ActionEvent e) {1125 int i1, i2;1126 String c = ""; //$NON-NLS-1$ //$NON-NLS-2$1127 String it = (String) cbM01Kennung.getSelectedItem();1128 1129 if (it == null)1130 return;1131 if (it.equals(Messages.getString("SmpDialogAction.212"))) //$NON-NLS-1$1132 return;1133 if (buoy == null)1134 return;1135 1136 if (it.contains("(")) {1137 i1 = it.indexOf("(");1138 i2 = it.indexOf(")");1139 c = it.substring(i1+1, i2);1140 it = it.substring(0, i1) + it.substring(i2+1);1141 }1142 if (!c.isEmpty())1143 buoy.setLightGroup(c);;1144 buoy.setLightChar(it);1145 buoy.paintSign();1146 }1147 });1148 }1149 return cbM01Kennung;1150 }1151 1152 private JTextField getTfM01Height() {1153 if (tfM01Height == null) {1154 tfM01Height = new JTextField();1155 tfM01Height.setBounds(new Rectangle(54, 270, 30, 20));1156 tfM01Height.addFocusListener(new FocusAdapter() {1157 public void focusLost(FocusEvent e) {1158 buoy.setHeight(tfM01Height.getText().trim());1159 }1160 });1161 }1162 return tfM01Height;1163 }1164 1165 private JTextField getTfM01Range() {1166 if (tfM01Range == null) {1167 tfM01Range = new JTextField();1168 tfM01Range.setBounds(new Rectangle(151, 270, 30, 20));1169 tfM01Range.addFocusListener(new FocusAdapter() {1170 public void focusLost(FocusEvent e) {1171 buoy.setRange(tfM01Range.getText().trim());1172 }1173 });1174 }1175 return tfM01Range;1176 }1177 1178 private JTextField getTfM01Group() {1179 if (tfM01Group == null) {1180 tfM01Group = new JTextField();1181 tfM01Group.setBounds(new Rectangle(255, 270, 30, 20));1182 tfM01Group.addFocusListener(new FocusAdapter() {1183 public void focusLost(FocusEvent e) {1184 buoy.setLightGroup(tfM01Group.getText().trim());1185 buoy.paintSign();1186 }1187 });1188 }1189 return tfM01Group;1190 }1191 1192 private JTextField getTfM01RepeatTime() {1193 if (tfM01RepeatTime == null) {1194 tfM01RepeatTime = new JTextField();1195 tfM01RepeatTime.setBounds(new Rectangle(345, 270, 30, 20));1196 tfM01RepeatTime.addActionListener(new ActionListener() {1197 public void actionPerformed(ActionEvent e) {1198 buoy.setLightPeriod(tfM01RepeatTime.getText().trim());1199 buoy.paintSign();1200 }1201 });1202 1203 tfM01RepeatTime.addFocusListener(new FocusAdapter() {1204 public void focusLost(FocusEvent e) {1205 buoy.setLightPeriod(tfM01RepeatTime.getText().trim());1206 buoy.paintSign();1207 }1208 });1209 }1210 return tfM01RepeatTime;1211 }1212 1213 private JComboBox getCbM01Colour() {1214 if (cbM01Colour == null) {1215 cbM01Colour = new JComboBox();1216 cbM01Colour.setBounds(new Rectangle(165, 295, 40, 20));1217 cbM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1218 cbM01Colour.addItem(""); //$NON-NLS-1$1219 cbM01Colour.addItem(Messages.getString("SmpDialogAction.190")); //$NON-NLS-1$1220 cbM01Colour.addItem(Messages.getString("SmpDialogAction.191")); //$NON-NLS-1$1221 cbM01Colour.addItem(Messages.getString("SmpDialogAction.192")); //$NON-NLS-1$1222 cbM01Colour.addActionListener(new ActionListener() {1223 public void actionPerformed(ActionEvent e) {1224 buoy.setLightColour((String)cbM01Colour.getSelectedItem());1225 buoy.paintSign();1226 }1227 });1228 }1229 return cbM01Colour;1230 }1231 1232 private JComboBox getCbM01Sector() {1233 if (cbM01Sector == null) {1234 cbM01Sector = new JComboBox();1235 cbM01Sector.setBounds(new Rectangle(55, 295, 50, 20));1236 cbM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$1237 cbM01Sector.addItem(Messages.getString("SmpDialogAction.194")); //$NON-NLS-1$1238 cbM01Sector.addItem(Messages.getString("SmpDialogAction.195")); //$NON-NLS-1$1239 cbM01Sector.addItem(Messages.getString("SmpDialogAction.196")); //$NON-NLS-1$1240 cbM01Sector.addItem(Messages.getString("SmpDialogAction.197")); //$NON-NLS-1$1241 cbM01Sector.addItem(Messages.getString("SmpDialogAction.198")); //$NON-NLS-1$1242 cbM01Sector.addItem(Messages.getString("SmpDialogAction.199")); //$NON-NLS-1$1243 cbM01Sector.addItem(Messages.getString("SmpDialogAction.200")); //$NON-NLS-1$1244 cbM01Sector.addItem(Messages.getString("SmpDialogAction.201")); //$NON-NLS-1$1245 cbM01Sector.addItem(Messages.getString("SmpDialogAction.202")); //$NON-NLS-1$1246 cbM01Sector.addItem(Messages.getString("SmpDialogAction.203")); //$NON-NLS-1$1247 cbM01Sector.addActionListener(new ActionListener() {1248 public void actionPerformed(ActionEvent e) {1249 buoy.setSectorIndex(cbM01Sector.getSelectedIndex());1250 buoy.paintSign();1251 }1252 });1253 }1254 return cbM01Sector;1255 }1256 1257 private JTextField getTfM01Bearing() {1258 if (tfM01Bearing == null) {1259 tfM01Bearing = new JTextField();1260 tfM01Bearing.setBounds(new Rectangle(255, 295, 30, 20));1261 tfM01Bearing.addFocusListener(new FocusAdapter() {1262 public void focusLost(FocusEvent e) {1263 buoy.setBearing1(tfM01Bearing.getText().trim());1264 }1265 });1266 }1267 return tfM01Bearing;1268 }1269 1270 private JTextField getTfM02Bearing() {1271 if (tfM02Bearing == null) {1272 tfM02Bearing = new JTextField();1273 tfM02Bearing.setBounds(new Rectangle(300, 295, 30, 20));1274 tfM02Bearing.addFocusListener(new FocusAdapter() {1275 public void focusLost(FocusEvent e) {1276 buoy.setBearing2(tfM02Bearing.getText().trim());1277 }1278 });1279 }1280 return tfM02Bearing;1281 }1282 1283 private JTextField getTfM01Radius() {1284 if (tfM01Radius == null) {1285 tfM01Radius = new JTextField();1286 tfM01Radius.setBounds(new Rectangle(355, 295, 30, 20));1287 tfM01Radius.addFocusListener(new FocusAdapter() {1288 public void focusLost(FocusEvent e) {1289 buoy.setRadius(tfM01Radius.getText().trim());1290 }1291 });1292 }1293 return tfM01Radius;1294 }1295 1296 private JButton getBM01Close() {1297 if (bM01Close == null) {1298 bM01Close = new JButton();1299 bM01Close.setBounds(new Rectangle(20, 325, 110, 20));1300 bM01Close.setText(tr("Close"));1301 bM01Close.addActionListener(new ActionListener() {1302 public void actionPerformed(ActionEvent e) {1303 // aufraeumen1304 if (obuoy != null)1305 PicRebuild();1306 // Deaktivierung des Listeners1307 DataSet.removeSelectionListener(SmpListener);1308 Selection = null;1309 SmpItem.setEnabled(true);1310 onode = null;1311 1312 dM01SeaMap.dispose();1313 }1314 });1315 }1316 1317 return bM01Close;1318 }1319 1320 private JButton getBM01Save() {1321 if (bM01Save == null) {1322 bM01Save = new JButton();1323 bM01Save.setBounds(new Rectangle(150, 325, 110, 20));1324 bM01Save.setText(tr("Save"));1325 bM01Save.setEnabled(false);1326 1327 bM01Save.addActionListener(new ActionListener() {1328 public void actionPerformed(ActionEvent e) {1329 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(1330 "/images/Auge.png"))); //$NON-NLS-1$1331 cM01IconVisible.setSelected(true);1332 1333 buoy.saveSign();1334 }1335 });1336 }1337 1338 return bM01Save;1339 }1340 1341 private JCheckBox getCM01IconVisible() {1342 if (cM01IconVisible == null) {1343 cM01IconVisible = new JCheckBox();1344 cM01IconVisible.setBounds(new Rectangle(310, 325, 30, 21));1345 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(1346 "/images/AugeN.png"))); //$NON-NLS-1$1347 cM01IconVisible.setSelected(false);1348 cM01IconVisible.addActionListener(new ActionListener() {1349 public void actionPerformed(ActionEvent e) {1350 Command c;1351 Node n = null;1352 DataSet ds = Main.main.getCurrentDataSet();1353 1354 if (buoy != null)1355 n = buoy.getNode();1356 1357 if (cM01IconVisible.isSelected()) {1358 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(1359 "/images/AugeN.png"))); //$NON-NLS-1$1360 if (n != null) {1361 // seamark loeschen, wenn notwendig1362 if (n.getKeys().containsKey("seamark")) { //$NON-NLS-1$1363 smb = n.getKeys().get("seamark"); // smb merken //$NON-NLS-1$1364 1365 c = new ChangePropertyCommand(n, "seamark", null); //$NON-NLS-1$1366 c.executeCommand();1367 ds.fireSelectionChanged();1368 obuoy = buoy;1369 }1370 1371 // seamark:type loeschen, wenn notwendig1372 if (n.getKeys().containsKey("seamark:type")) { //$NON-NLS-1$1373 smt = n.getKeys().get("seamark:type"); // smt merken //$NON-NLS-1$1374 1375 c = new ChangePropertyCommand(n, "seamark:type", null); //$NON-NLS-1$1376 c.executeCommand();1377 ds.fireSelectionChanged();1378 obuoy = buoy;1379 }1380 1381 }1382 } else {1383 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(1384 "/images/Auge.png"))); //$NON-NLS-1$1385 PicRebuild();1386 obuoy = null;1387 }1388 buoy.paintSign();1389 }1390 });1391 }1392 return cM01IconVisible;1393 }1394 1395 private JTextField getSM01StatusBar() {1396 if (sM01StatusBar == null) {1397 sM01StatusBar = new JTextField();1398 sM01StatusBar.setBounds(new Rectangle(7, 355, 385, 20));1399 sM01StatusBar.setBackground(SystemColor.activeCaptionBorder);1400 }1401 return sM01StatusBar;1402 }64 private static final long serialVersionUID = -2976230949744302905L; 65 66 /** 67 * lokale Variable, private 68 */ 69 private SmpDialogAction dia = null; // Variable für den Handle von 70 // SmpDialogAction 71 private Buoy buoy = null; // Variable für Objekte des Typs "Tonne" // 72 // @jve:decl-index=0: 73 private boolean isOpen = false; // zeigt den Status des Dialogs an 74 private Node onode = null; // gemerkter Knoten 75 private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0: 76 private JMenuItem SmpItem = null; // Info über item in der Werkzeugleiste 77 private String smt = ""; // value vom key "seamark:type" // @jve:decl-index=0: //$NON-NLS-1$ 78 private String smb = ""; // value vom key "seamark" // @jve:decl-index=0: //$NON-NLS-1$ 79 private Collection<? extends OsmPrimitive> Selection = null; // @jve:decl-index=0: 80 private OsmPrimitive SelNode = null; 81 private String Os = ""; // @jve:decl-index=0: //$NON-NLS-1$ 82 private String UserHome = ""; // @jve:decl-index=0: //$NON-NLS-1$ 83 84 // SelectionChangedListner der in die Eventqueue von josm eingehängt wird 85 private SelectionChangedListener SmpListener = new SelectionChangedListener() { 86 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 87 Node node; 88 Selection = newSelection; 89 90 // System.out.println("hello"); 91 for (OsmPrimitive osm : Selection) { 92 if (osm instanceof Node) { 93 node = (Node) osm; 94 if (Selection.size() == 1) 95 // Absicherung gegen Doppelevents 96 if (node.compareTo(SelNode) != 0) { 97 SelNode = node; 98 parseSeaMark(); 99 buoy.paintSign(); 100 } 101 } 102 } 103 104 Selection = null; 105 106 } 107 }; 108 109 /** 110 * lokale Variable der Maske 111 */ 112 private JDialog dM01SeaMap = null; 113 private JPanel pM01SeaMap = null; 114 private JLabel lM01Head = null; 115 private JLabel lM01Region = null; 116 private JLabel lM02Region = null; 117 public ButtonGroup bgM01Region = null; 118 public JRadioButton rbM01RegionA = null; 119 public JRadioButton rbM01RegionB = null; 120 public JLabel lM01Icon = null; // Shape 121 public JLabel lM02Icon = null; // Light 122 public JLabel lM03Icon = null; // Reflector 123 public JLabel lM04Icon = null; // Racon 124 public JLabel lM05Icon = null; // Fog 125 public JLabel lM01FireMark = null; 126 private JLabel lM01TypeOfMark = null; 127 public JComboBox cbM01TypeOfMark = null; 128 public JLabel lM01CatOfMark = null; 129 public JComboBox cbM01CatOfMark = null; 130 public JLabel lM01StyleOfMark = null; 131 public JComboBox cbM01StyleOfMark = null; 132 private JLabel lM01Name = null; 133 public JTextField tfM01Name = null; 134 private JLabel lM01Props02 = null; 135 public JCheckBox cM01TopMark = null; 136 public JComboBox cbM01TopMark = null; 137 public JCheckBox cM01Radar = null; 138 public JCheckBox cM01Racon = null; 139 public JComboBox cbM01Racon = null; 140 public JTextField tfM01Racon = null; 141 public JLabel lM01Racon = null; 142 public JCheckBox cM01Fog = null; 143 public JComboBox cbM01Fog = null; 144 public JLabel lM01FogGroup = null; 145 public JTextField tfM01FogGroup = null; 146 public JLabel lM01FogPeriod = null; 147 public JTextField tfM01FogPeriod = null; 148 public JCheckBox cM01Fired = null; 149 public ButtonGroup bgM01Fired = null; 150 public JRadioButton rbM01Fired1 = null; 151 public JRadioButton rbM01FiredN = null; 152 public JLabel lM01Kennung = null; 153 public JComboBox cbM01Kennung = null; 154 public JLabel lM01Height = null; 155 public JTextField tfM01Height = null; 156 public JLabel lM01Range = null; 157 public JTextField tfM01Range = null; 158 public JLabel lM01Group = null; 159 public JTextField tfM01Group = null; 160 public JLabel lM01RepeatTime = null; 161 public JTextField tfM01RepeatTime = null; 162 public JLabel lM01Sector = null; 163 public JComboBox cbM01Sector = null; 164 public JLabel lM01Colour = null; 165 public JComboBox cbM01Colour = null; 166 public JLabel lM01Bearing = null; 167 public JTextField tfM01Bearing = null; 168 public JTextField tfM02Bearing = null; 169 public JTextField tfM01Radius = null; 170 public JButton bM01Save = null; 171 public JButton bM01Close = null; 172 public JCheckBox cM01IconVisible = null; 173 public JTextField sM01StatusBar = null; 174 175 public boolean paintlock = false; 176 177 public JMenuItem getSmpItem() { 178 return SmpItem; 179 } 180 181 public void setSmpItem(JMenuItem smpItem) { 182 SmpItem = smpItem; 183 } 184 185 public boolean isOpen() { 186 return isOpen; 187 } 188 189 public void setOpen(boolean isOpen) { 190 this.isOpen = isOpen; 191 } 192 193 public String getOs() { 194 return Os; 195 } 196 197 public void setOs(String os) { 198 Os = os; 199 } 200 201 public String getUserHome() { 202 return UserHome; 203 } 204 205 public void setUserHome(String userHome) { 206 UserHome = userHome; 207 } 208 209 public SmpDialogAction() { 210 super( 211 Messages.getString("SmpDialogAction.4"), "Smp", Messages.getString("SmpDialogAction.0"), Shortcut //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 212 .registerShortcut( 213 "tools:Semarks", //$NON-NLS-1$ 214 tr("Tool: {0}", Messages.getString("SmpDialogAction.9")), KeyEvent.VK_S, //$NON-NLS-1$ //$NON-NLS-2$ 215 Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 216 217 dia = this; 218 String str = Main.pref.get("mappaint.style.sources"); //$NON-NLS-1$ 219 if (!str.contains("dev.openseamap.org")) { //$NON-NLS-1$ 220 if (!str.isEmpty()) //$NON-NLS-1$ 221 str += new String(new char[] { 0x1e }); 222 Main.pref.put("mappaint.style.sources", str //$NON-NLS-1$ 223 + "http://dev.openseamap.org/josm/seamark_styles.xml"); //$NON-NLS-1$ 224 } 225 str = Main.pref.get("color.background"); //$NON-NLS-1$ 226 if (str.equals("#000000") || str.isEmpty()) //$NON-NLS-1$ //$NON-NLS-2$ 227 Main.pref.put("color.background", "#606060"); //$NON-NLS-1$ //$NON-NLS-2$ 228 } 229 230 public void CloseDialog() { 231 onode = null; 232 DataSet.removeSelectionListener(SmpListener); 233 Selection = null; 234 235 if (isOpen) 236 dM01SeaMap.dispose(); 237 isOpen = false; 238 239 } 240 241 public void actionPerformed(ActionEvent e) { 242 243 /* 244 * int option = JOptionPane.showConfirmDialog(Main.parent, 245 * tr("THIS IS EXPERIMENTAL. Save your work and verify before uploading.\n" 246 * + "Are you really sure to continue?"), 247 * tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION, 248 * JOptionPane.WARNING_MESSAGE); 249 * 250 * if (option != JOptionPane.YES_OPTION) { return; } 251 */ 252 253 onode = null; 254 obuoy = null; 255 256 SwingUtilities.invokeLater(new Runnable() { 257 public void run() { 258 JDialog dialog = getDM01SeaMap(); 259 260 if (SmpItem == null) { 261 } 262 dialog.setVisible(true); 263 } 264 }); 265 266 setOpen(true); 267 268 if (SmpItem == null) { 269 return; 270 } 271 SmpItem.setEnabled(false); 272 273 // Ausprobe: Möglichkeit der Benachrichtigung, wenn etwas neu 274 // selektiert wird (ueber SelectionChangedListener) 275 // private Collection<? extends OsmPrimitive> sel; 276 // siehe org.openstreetmap.josm.plugins.osb -> OsbLayer.java 277 // Einhängen des Listeners in die Eventqueue von josm 278 DataSet.addSelectionListener(SmpListener); 279 } 280 281 private void PicRebuild() { 282 283 DataSet ds = Main.main.getCurrentDataSet(); 284 285 if (obuoy == null) { 286 return; 287 } 288 289 Node n = obuoy.getNode(); 290 291 if (n != null) { 292 Command c; 293 294 if (smb != "") { //$NON-NLS-1$ 295 296 c = new ChangePropertyCommand(n, "seamark", smb); //$NON-NLS-1$ 297 c.executeCommand(); 298 ds.fireSelectionChanged(); 299 300 smb = ""; //$NON-NLS-1$ 301 } 302 303 if (smt != "") { //$NON-NLS-1$ 304 305 c = new ChangePropertyCommand(n, "seamark:type", smt); //$NON-NLS-1$ 306 c.executeCommand(); 307 ds.fireSelectionChanged(); 308 309 smt = ""; //$NON-NLS-1$ 310 } 311 } 312 313 obuoy = null; 314 315 } 316 317 private void parseSeaMark() { 318 319 int nodes = 0; 320 Node node = null; 321 Collection<Node> selection = null; 322 Map<String, String> keys; 323 DataSet ds; 324 325 ds = Main.main.getCurrentDataSet(); 326 327 if (ds == null) { 328 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.26")); //$NON-NLS-1$ 329 buoy.setNode(null); 330 return; 331 } 332 333 selection = ds.getSelectedNodes(); 334 nodes = selection.size(); 335 336 if (nodes == 0) { 337 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.27")); //$NON-NLS-1$ 338 buoy.setNode(null); 339 return; 340 } 341 342 if (nodes > 1) { 343 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.28")); //$NON-NLS-1$ 344 buoy.setNode(null); 345 return; 346 } 347 348 Iterator<Node> it = selection.iterator(); 349 node = it.next(); 350 351 if (onode != null) 352 if (node.equals(onode)) 353 return; 354 355 // Knoten wurde gewechselt -> die alten tags (benutzt zum Ausblenden der 356 // Pictogramme) wiederherstellen 357 if (obuoy != null) 358 PicRebuild(); 359 360 onode = node; 361 362 cM01IconVisible.setEnabled(true); 363 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 364 "/images/Auge.png"))); //$NON-NLS-1$ 365 366 cbM01TypeOfMark.setEnabled(true); 367 368 // Soweit das Vorspiel. Ab hier beginnt das Parsen 369 String type = ""; //$NON-NLS-1$ 370 String str = ""; //$NON-NLS-1$ 371 372 keys = node.getKeys(); 373 374 // vorsorglich den Namen holen und verwenden, wenn es ein 375 // Seezeichen ist. Name kann durch die weiteren Tags ueber- 376 // schrieben werden 377 378 if (keys.containsKey("seamark:type")) //$NON-NLS-1$ 379 type = keys.get("seamark:type"); //$NON-NLS-1$ 380 381 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$ 382 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$ 383 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$ 384 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$ 385 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$ 386 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$ 387 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$ 388 buoy = new BuoyLat(this, node); 389 return; 390 391 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$ 392 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$ 393 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$ 394 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$ 395 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$ 396 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$ 397 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 398 buoy = new BuoyCard(this, node); 399 return; 400 401 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$ 402 || type.equals("beacon_safe_water") //$NON-NLS-1$ 403 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$ 404 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$ 405 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$ 406 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$ 407 buoy = new BuoySaw(this, node); 408 return; 409 410 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$ 411 || type.equals("beacon_special_purpose") //$NON-NLS-1$ 412 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$ 413 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$ 414 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 415 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$ 416 buoy = new BuoySpec(this, node); 417 return; 418 419 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$ 420 || type.equals("beacon_isolated_danger") //$NON-NLS-1$ 421 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$ 422 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$ 423 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$ 424 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 425 buoy = new BuoyIsol(this, node); 426 return; 427 428 } else if (type.equals("landmark") || type.equals("light_vessel") //$NON-NLS-1$ 429 || type.equals("light_major") || type.equals("light_minor")) { //$NON-NLS-1$ 430 buoy = new BuoyNota(this, node); 431 return; 432 433 } else if (type.equals("light_float")) { //$NON-NLS-1$ 434 if (keys.containsKey("seamark:light_float:colour")) { //$NON-NLS-1$ 435 str = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 436 if (str.equals("red") || str.equals("green") //$NON-NLS-1$ //$NON-NLS-2$ 437 || str.equals("red;green;red") || str.equals("green;red;green")) { //$NON-NLS-1$ //$NON-NLS-2$ 438 buoy = new BuoyLat(this, node); 439 return; 440 } else if (str.equals("black;yellow") //$NON-NLS-1$ 441 || str.equals("black;yellow;black") || str.equals("yellow;black") //$NON-NLS-1$ //$NON-NLS-2$ 442 || str.equals("yellow;black;yellow")) { //$NON-NLS-1$ 443 buoy = new BuoyCard(this, node); 444 return; 445 } else if (str.equals("black;red;black")) { //$NON-NLS-1$ 446 buoy = new BuoyIsol(this, node); 447 return; 448 } else if (str.equals("red;white")) { //$NON-NLS-1$ 449 buoy = new BuoySaw(this, node); 450 return; 451 } else if (str.equals("yellow")) { //$NON-NLS-1$ 452 buoy = new BuoySpec(this, node); 453 return; 454 } 455 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { //$NON-NLS-1$ 456 str = keys.get("seamark:light_float:topmark:shape"); //$NON-NLS-1$ 457 if (str.equals("cylinder") || str.equals("cone, point up")) { //$NON-NLS-1$ //$NON-NLS-2$ 458 buoy = new BuoyLat(this, node); 459 return; 460 } 461 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { //$NON-NLS-1$ 462 str = keys.get("seamark:light_float:topmark:colour"); //$NON-NLS-1$ 463 if (str.equals("red") || str.equals("green")) { //$NON-NLS-1$ //$NON-NLS-2$ 464 buoy = new BuoyLat(this, node); 465 return; 466 } 467 } 468 } 469 470 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.91")); //$NON-NLS-1$ 471 buoy.setNode(node); 472 return; 473 } 474 475 private JDialog getDM01SeaMap() { 476 477 if (dM01SeaMap == null) { 478 dM01SeaMap = new JDialog(); 479 dM01SeaMap.setSize(new Dimension(400, 400)); 480 dM01SeaMap.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 481 dM01SeaMap.setModal(false); 482 dM01SeaMap.setResizable(false); 483 dM01SeaMap.setContentPane(getPM01SeaMap()); 484 dM01SeaMap.setTitle(Messages.getString("SmpDialogAction.9")); //$NON-NLS-1$ 485 dM01SeaMap.setVisible(false); 486 dM01SeaMap.setAlwaysOnTop(true); 487 dM01SeaMap.addWindowListener(new java.awt.event.WindowAdapter() { 488 public void windowClosing(java.awt.event.WindowEvent e) { 489 490 // Pictogramme wiederherstellen und aufraeumen 491 if (obuoy != null) 492 PicRebuild(); 493 // Deaktivierung des Listeners 494 DataSet.removeSelectionListener(SmpListener); 495 Selection = null; 496 497 SmpItem.setEnabled(true); 498 } 499 500 public void windowActivated(WindowEvent arg0) { 501 parseSeaMark(); 502 buoy.paintSign(); 503 } 504 }); 505 } 506 return dM01SeaMap; 507 } 508 509 private JPanel getPM01SeaMap() { 510 if (pM01SeaMap == null) { 511 512 lM01Icon = new JLabel(); 513 lM01Icon.setBounds(new Rectangle(210, 20, 150, 200)); 514 lM01Icon.setIcon(null); 515 lM01Icon.setText(""); //$NON-NLS-1$ 516 517 lM02Icon = new JLabel(); 518 lM02Icon.setBounds(new Rectangle(210, 20, 150, 200)); 519 lM02Icon.setIcon(null); 520 lM02Icon.setText(""); //$NON-NLS-1$ 521 522 lM03Icon = new JLabel(); 523 lM03Icon.setBounds(new Rectangle(210, -50, 150, 200)); 524 lM03Icon.setIcon(null); 525 lM03Icon.setText(""); //$NON-NLS-1$ 526 527 lM04Icon = new JLabel(); 528 lM04Icon.setBounds(new Rectangle(210, 20, 150, 200)); 529 lM04Icon.setIcon(null); 530 lM04Icon.setText(""); //$NON-NLS-1$ 531 532 lM05Icon = new JLabel(); 533 lM05Icon.setBounds(new Rectangle(210, 20, 150, 200)); 534 lM05Icon.setIcon(null); 535 lM05Icon.setText(""); //$NON-NLS-1$ 536 537 lM01FireMark = new JLabel(); 538 lM01FireMark.setBounds(new Rectangle(300, 85, 95, 20)); 539 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 540 lM01FireMark.setText(""); //$NON-NLS-1$ 541 542 lM01Head = new JLabel(); 543 lM01Head.setBounds(new Rectangle(5, 3, 316, 16)); 544 lM01Head.setText(Messages.getString("SmpDialogAction.97")); //$NON-NLS-1$ 545 546 lM01Region = new JLabel(); 547 lM01Region.setBounds(new Rectangle(220, 7, 120, 16)); 548 lM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 549 lM01Region.setText(Messages.getString("SmpDialogAction.99")); //$NON-NLS-1$ 550 551 lM02Region = new JLabel(); 552 lM02Region.setBounds(new Rectangle(270, 7, 120, 16)); 553 lM02Region.setFont(new Font("Dialog", Font.BOLD, 12)); //$NON-NLS-1$ 554 lM02Region.setText(Messages.getString("SmpDialogAction.101")); //$NON-NLS-1$ 555 556 lM01TypeOfMark = new JLabel(); 557 lM01TypeOfMark.setBounds(new Rectangle(5, 28, 120, 16)); 558 lM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 559 lM01TypeOfMark.setText(Messages.getString("SmpDialogAction.103")); //$NON-NLS-1$ 560 561 lM01CatOfMark = new JLabel(); 562 lM01CatOfMark.setBounds(new Rectangle(5, 58, 120, 16)); 563 lM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 564 lM01CatOfMark.setText(Messages.getString("SmpDialogAction.1")); //$NON-NLS-1$ 565 566 lM01StyleOfMark = new JLabel(); 567 lM01StyleOfMark.setBounds(new Rectangle(5, 88, 148, 16)); 568 lM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 569 lM01StyleOfMark.setText(Messages.getString("SmpDialogAction.107")); //$NON-NLS-1$ 570 571 lM01Name = new JLabel(); 572 lM01Name.setBounds(new Rectangle(5, 120, 82, 16)); 573 lM01Name.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 574 lM01Name.setText(Messages.getString("SmpDialogAction.109")); //$NON-NLS-1$ 575 576 lM01Props02 = new JLabel(); 577 lM01Props02.setBounds(new Rectangle(5, 150, 172, 16)); 578 lM01Props02.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 579 lM01Props02.setText(Messages.getString("SmpDialogAction.111")); //$NON-NLS-1$ 580 581 lM01Racon = new JLabel(); 582 lM01Racon.setBounds(new Rectangle(335, 195, 65, 20)); 583 lM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 584 lM01Racon.setText(Messages.getString("SmpDialogAction.113")); //$NON-NLS-1$ 585 586 lM01FogGroup = new JLabel(); 587 lM01FogGroup.setBounds(new Rectangle(190, 220, 100, 20)); 588 lM01FogGroup.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 589 lM01FogGroup.setText(Messages.getString("SmpDialogAction.115")); //$NON-NLS-1$ 590 591 lM01FogPeriod = new JLabel(); 592 lM01FogPeriod.setBounds(new Rectangle(300, 220, 100, 20)); 593 lM01FogPeriod.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 594 lM01FogPeriod.setText(Messages.getString("SmpDialogAction.117")); //$NON-NLS-1$ 595 596 lM01Kennung = new JLabel(); 597 lM01Kennung.setBounds(new Rectangle(240, 245, 60, 20)); 598 lM01Kennung.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 599 lM01Kennung.setText(Messages.getString("SmpDialogAction.119")); //$NON-NLS-1$ 600 601 lM01Height = new JLabel(); 602 lM01Height.setBounds(new Rectangle(10, 270, 100, 20)); 603 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 604 lM01Height.setText(Messages.getString("SmpDialogAction.121")); //$NON-NLS-1$ 605 606 lM01Range = new JLabel(); 607 lM01Range.setBounds(new Rectangle(108, 270, 100, 20)); 608 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 609 lM01Range.setText(Messages.getString("SmpDialogAction.123")); //$NON-NLS-1$ 610 611 lM01Group = new JLabel(); 612 lM01Group.setBounds(new Rectangle(204, 270, 100, 20)); 613 lM01Group.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 614 lM01Group.setText(Messages.getString("SmpDialogAction.125")); //$NON-NLS-1$ 615 616 lM01RepeatTime = new JLabel(); 617 lM01RepeatTime.setBounds(new Rectangle(300, 270, 100, 20)); 618 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 619 lM01RepeatTime.setText(Messages.getString("SmpDialogAction.127")); //$NON-NLS-1$ 620 621 lM01Sector = new JLabel(); 622 lM01Sector.setBounds(new Rectangle(10, 295, 180, 20)); 623 lM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 624 lM01Sector.setText(Messages.getString("SmpDialogAction.129")); //$NON-NLS-1$ 625 626 lM01Colour = new JLabel(); 627 lM01Colour.setBounds(new Rectangle(120, 295, 180, 20)); 628 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 629 lM01Colour.setText(Messages.getString("SmpDialogAction.131")); //$NON-NLS-1$ 630 631 lM01Bearing = new JLabel(); 632 lM01Bearing.setBounds(new Rectangle(228, 295, 180, 20)); 633 lM01Bearing.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 634 lM01Bearing.setText(Messages.getString("SmpDialogAction.133")); //$NON-NLS-1$ 635 636 rbM01RegionA = new JRadioButton( 637 Messages.getString("SmpDialogAction.134"), Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 638 .equals("A")); //$NON-NLS-1$ 639 rbM01RegionA.setBounds(new Rectangle(305, 0, 50, 30)); 640 rbM01RegionB = new JRadioButton("-B", Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$ 641 .equals("B")); //$NON-NLS-1$ 642 rbM01RegionB.setBounds(new Rectangle(352, 0, 50, 30)); 643 bgM01Region = new ButtonGroup(); 644 bgM01Region.add(rbM01RegionA); 645 bgM01Region.add(rbM01RegionB); 646 647 ActionListener alM01Region = new ActionListener() { 648 public void actionPerformed(java.awt.event.ActionEvent e) { 649 if (buoy instanceof BuoyLat) { 650 buoy.setRegion(rbM01RegionB.isSelected()); 651 buoy.setLightColour(); 652 buoy.paintSign(); 653 } 654 } 655 }; 656 rbM01RegionA.addActionListener(alM01Region); 657 rbM01RegionB.addActionListener(alM01Region); 658 659 rbM01Fired1 = new JRadioButton( 660 Messages.getString("SmpDialogAction.140"), true); //$NON-NLS-1$ 661 rbM01Fired1.setBounds(new Rectangle(85, 240, 70, 30)); 662 rbM01FiredN = new JRadioButton( 663 Messages.getString("SmpDialogAction.141"), false); //$NON-NLS-1$ 664 rbM01FiredN.setBounds(new Rectangle(155, 240, 80, 30)); 665 bgM01Fired = new ButtonGroup(); 666 bgM01Fired.add(rbM01Fired1); 667 bgM01Fired.add(rbM01FiredN); 668 669 ActionListener alM01Fired = new ActionListener() { 670 public void actionPerformed(java.awt.event.ActionEvent e) { 671 buoy.setSectored(rbM01FiredN.isSelected()); 672 cbM01Sector.setSelectedIndex(0); 673 buoy.setSectorIndex(0); 674 buoy.paintSign(); 675 } 676 }; 677 rbM01Fired1.addActionListener(alM01Fired); 678 rbM01FiredN.addActionListener(alM01Fired); 679 680 pM01SeaMap = new JPanel(); 681 pM01SeaMap.setLayout(null); 682 pM01SeaMap.add(lM01Head, null); 683 pM01SeaMap.add(rbM01RegionA, null); 684 pM01SeaMap.add(rbM01RegionB, null); 685 pM01SeaMap.add(lM01Region, null); 686 pM01SeaMap.add(lM02Region, null); 687 pM01SeaMap.add(lM01Icon, null); 688 pM01SeaMap.add(lM02Icon, null); 689 pM01SeaMap.add(lM03Icon, null); 690 pM01SeaMap.add(lM04Icon, null); 691 pM01SeaMap.add(lM05Icon, null); 692 pM01SeaMap.add(getCbM01TypeOfMark(), null); 693 pM01SeaMap.add(lM01TypeOfMark, null); 694 pM01SeaMap.add(getCbM01CatOfMark(), null); 695 pM01SeaMap.add(lM01CatOfMark, null); 696 pM01SeaMap.add(getCbM01StyleOfMark(), null); 697 pM01SeaMap.add(lM01StyleOfMark, null); 698 pM01SeaMap.add(lM01Name, null); 699 pM01SeaMap.add(getTfM01Name(), null); 700 pM01SeaMap.add(lM01Props02, null); 701 pM01SeaMap.add(getCM01TopMark(), null); 702 pM01SeaMap.add(getCbM01TopMark(), null); 703 pM01SeaMap.add(getCM01Radar(), null); 704 pM01SeaMap.add(getCM01Racon(), null); 705 pM01SeaMap.add(getCbM01Racon(), null); 706 pM01SeaMap.add(getTfM01Racon(), null); 707 pM01SeaMap.add(lM01Racon, null); 708 pM01SeaMap.add(getCM01Fog(), null); 709 pM01SeaMap.add(getCbM01Fog(), null); 710 pM01SeaMap.add(getTfM01FogGroup(), null); 711 pM01SeaMap.add(lM01FogGroup, null); 712 pM01SeaMap.add(getTfM01FogPeriod(), null); 713 pM01SeaMap.add(lM01FogPeriod, null); 714 pM01SeaMap.add(getCM01Fired(), null); 715 pM01SeaMap.add(rbM01Fired1, null); 716 pM01SeaMap.add(rbM01FiredN, null); 717 pM01SeaMap.add(getTfM01RepeatTime(), null); 718 pM01SeaMap.add(lM01RepeatTime, null); 719 pM01SeaMap.add(getCbM01Kennung(), null); 720 pM01SeaMap.add(lM01Kennung, null); 721 pM01SeaMap.add(lM01Group, null); 722 pM01SeaMap.add(getTfM01Group(), null); 723 pM01SeaMap.add(lM01Sector, null); 724 pM01SeaMap.add(getCbM01Sector(), null); 725 pM01SeaMap.add(lM01Colour, null); 726 pM01SeaMap.add(getCbM01Colour(), null); 727 pM01SeaMap.add(lM01Bearing, null); 728 pM01SeaMap.add(getTfM01Bearing(), null); 729 pM01SeaMap.add(getTfM02Bearing(), null); 730 pM01SeaMap.add(getTfM01Radius(), null); 731 pM01SeaMap.add(lM01Height, null); 732 pM01SeaMap.add(getTfM01Height(), null); 733 pM01SeaMap.add(lM01Range, null); 734 pM01SeaMap.add(getTfM01Range(), null); 735 pM01SeaMap.add(lM01FireMark, null); 736 pM01SeaMap.add(getBM01Save(), null); 737 pM01SeaMap.add(getSM01StatusBar(), null); 738 pM01SeaMap.add(getBM01Close(), null); 739 pM01SeaMap.add(getCM01IconVisible(), null); 740 } 741 return pM01SeaMap; 742 } 743 744 private JComboBox getCbM01TypeOfMark() { 745 746 if (cbM01TypeOfMark == null) { 747 748 cbM01TypeOfMark = new JComboBox(); 749 750 // Inhalt der ComboBox 751 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.142")); //$NON-NLS-1$ 752 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.143")); //$NON-NLS-1$ 753 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.144")); //$NON-NLS-1$ 754 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.145")); //$NON-NLS-1$ 755 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.146")); //$NON-NLS-1$ 756 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.147")); //$NON-NLS-1$ 757 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.148")); //$NON-NLS-1$ 758 759 cbM01TypeOfMark.setBounds(new Rectangle(45, 25, 165, 25)); 760 // cbM01TypeOfMark.setEditable(false); 761 cbM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 762 cbM01TypeOfMark.setEnabled(true); 763 764 cbM01TypeOfMark.addActionListener(new ActionListener() { 765 public void actionPerformed(java.awt.event.ActionEvent e) { 766 int type = cbM01TypeOfMark.getSelectedIndex(); 767 768 if (buoy == null) { 769 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 770 return; 771 } 772 773 Node n = buoy.getNode(); 774 if (n == null) 775 return; 776 777 paintlock = true; 778 switch (type) { 779 780 case SeaMark.UNKNOWN_TYPE: 781 if (!(buoy instanceof BuoyUkn)) 782 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 783 buoy.setBuoyIndex(type); 784 break; 785 786 case SeaMark.LATERAL: 787 if (!(buoy instanceof BuoyLat)) { 788 buoy = new BuoyLat(dia, n); 789 buoy.setBuoyIndex(0); 790 } 791 break; 792 793 case SeaMark.CARDINAL: 794 if (!(buoy instanceof BuoyCard)) { 795 buoy = new BuoyCard(dia, n); 796 buoy.setBuoyIndex(0); 797 } 798 break; 799 800 case SeaMark.SAFE_WATER: 801 if (!(buoy instanceof BuoySaw)) { 802 buoy = new BuoySaw(dia, n); 803 } 804 buoy.setBuoyIndex(type); 805 break; 806 807 case SeaMark.ISOLATED_DANGER: 808 if (!(buoy instanceof BuoyIsol)) { 809 buoy = new BuoyIsol(dia, n); 810 } 811 buoy.setBuoyIndex(type); 812 break; 813 814 case SeaMark.SPECIAL_PURPOSE: 815 if (!(buoy instanceof BuoySpec)) { 816 buoy = new BuoySpec(dia, n); 817 } 818 buoy.setBuoyIndex(type); 819 break; 820 821 case SeaMark.LIGHT: 822 if (!(buoy instanceof BuoyNota)) { 823 buoy = new BuoyNota(dia, n); 824 buoy.setBuoyIndex(0); 825 } 826 break; 827 } 828 829 buoy.refreshStyles(); 830 buoy.refreshLights(); 831 buoy.setLightColour(); 832 paintlock = false; 833 buoy.paintSign(); 834 } 835 }); 836 } 837 return cbM01TypeOfMark; 838 } 839 840 private JComboBox getCbM01CatOfMark() { 841 if (cbM01CatOfMark == null) { 842 cbM01CatOfMark = new JComboBox(); 843 cbM01CatOfMark.setBounds(new Rectangle(60, 55, 150, 25)); 844 cbM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 845 cbM01CatOfMark.setEnabled(true); 846 847 cbM01CatOfMark.addActionListener(new ActionListener() { 848 public void actionPerformed(ActionEvent e) { 849 int cat = cbM01CatOfMark.getSelectedIndex(); 850 851 if (buoy == null) { 852 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$ 853 return; 854 } 855 856 Node n = buoy.getNode(); 857 if (n == null) 858 return; 859 860 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LATERAL) { 861 if (!(buoy instanceof BuoyLat)) 862 buoy = new BuoyLat(dia, n); 863 buoy.setBuoyIndex(cat); 864 } 865 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.CARDINAL) { 866 if (!(buoy instanceof BuoyCard)) 867 buoy = new BuoyCard(dia, n); 868 buoy.setBuoyIndex(cat); 869 } 870 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LIGHT) { 871 if (!(buoy instanceof BuoyNota)) 872 buoy = new BuoyNota(dia, n); 873 buoy.setBuoyIndex(cat); 874 } 875 876 buoy.refreshStyles(); 877 buoy.refreshLights(); 878 buoy.setLightColour(); 879 buoy.paintSign(); 880 } 881 }); 882 } 883 return cbM01CatOfMark; 884 } 885 886 private JComboBox getCbM01StyleOfMark() { 887 if (cbM01StyleOfMark == null) { 888 cbM01StyleOfMark = new JComboBox(); 889 cbM01StyleOfMark.setBounds(new Rectangle(45, 85, 165, 25)); 890 cbM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 891 cbM01StyleOfMark.addActionListener(new ActionListener() { 892 public void actionPerformed(ActionEvent e) { 893 int style = cbM01StyleOfMark.getSelectedIndex(); 894 if (buoy != null && style != buoy.getStyleIndex()) { 895 buoy.setStyleIndex(style); 896 buoy.paintSign(); 897 } 898 } 899 }); 900 } 901 return cbM01StyleOfMark; 902 } 903 904 private JTextField getTfM01Name() { 905 if (tfM01Name == null) { 906 tfM01Name = new JTextField(); 907 tfM01Name.setBounds(new Rectangle(50, 120, 150, 20)); 908 tfM01Name.addFocusListener(new FocusAdapter() { 909 public void focusLost(FocusEvent e) { 910 buoy.setName(tfM01Name.getText()); 911 } 912 }); 913 } 914 return tfM01Name; 915 } 916 917 private JCheckBox getCM01TopMark() { 918 if (cM01TopMark == null) { 919 cM01TopMark = new JCheckBox(); 920 cM01TopMark.setBounds(new Rectangle(10, 170, 100, 20)); 921 cM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 922 cM01TopMark.setText(Messages.getString("SmpDialogAction.166")); //$NON-NLS-1$ 923 cM01TopMark.addItemListener(new ItemListener() { 924 public void itemStateChanged(ItemEvent e) { 925 if (buoy == null) { 926 return; 927 } 928 buoy.setTopMark(cM01TopMark.isSelected()); 929 buoy.paintSign(); 930 } 931 }); 932 } 933 return cM01TopMark; 934 } 935 936 private JComboBox getCbM01TopMark() { 937 if (cbM01TopMark == null) { 938 cbM01TopMark = new JComboBox(); 939 cbM01TopMark.setBounds(new Rectangle(110, 170, 80, 20)); 940 cbM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 941 cbM01TopMark.addActionListener(new ActionListener() { 942 public void actionPerformed(ActionEvent e) { 943 int top = cbM01TopMark.getSelectedIndex(); 944 buoy.paintSign(); 945 } 946 }); 947 } 948 return cbM01TopMark; 949 } 950 951 private JCheckBox getCM01Radar() { 952 if (cM01Radar == null) { 953 cM01Radar = new JCheckBox(); 954 cM01Radar.setBounds(new Rectangle(10, 195, 120, 20)); 955 cM01Radar.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 956 cM01Radar.setText(Messages.getString("SmpDialogAction.169")); //$NON-NLS-1$ 957 cM01Radar.addActionListener(new ActionListener() { 958 public void actionPerformed(ActionEvent e) { 959 if (cM01Radar.isSelected()) { 960 buoy.setRadar(true); 961 buoy.setRacon(false); 962 cM01Racon.setSelected(false); 963 } else { 964 buoy.setRadar(false); 965 } 966 buoy.paintSign(); 967 } 968 }); 969 } 970 return cM01Radar; 971 } 972 973 private JCheckBox getCM01Racon() { 974 if (cM01Racon == null) { 975 cM01Racon = new JCheckBox(); 976 cM01Racon.setBounds(new Rectangle(130, 195, 110, 20)); 977 cM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 978 cM01Racon.setText(Messages.getString("SmpDialogAction.171")); //$NON-NLS-1$ 979 cM01Racon.addActionListener(new ActionListener() { 980 public void actionPerformed(ActionEvent e) { 981 if (cM01Racon.isSelected()) { 982 buoy.setRacon(true); 983 buoy.setRadar(false); 984 cM01Radar.setSelected(false); 985 } else { 986 buoy.setRacon(false); 987 } 988 buoy.paintSign(); 989 } 990 }); 991 } 992 return cM01Racon; 993 } 994 995 private JComboBox getCbM01Racon() { 996 if (cbM01Racon == null) { 997 cbM01Racon = new JComboBox(); 998 cbM01Racon.setBounds(new Rectangle(240, 195, 80, 20)); 999 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1000 cbM01Racon.removeAllItems(); 1001 cbM01Racon.addItem("Any"); 1002 cbM01Racon.addItem("Racon"); 1003 cbM01Racon.addItem("Ramark"); 1004 cbM01Racon.addItem("Leading"); 1005 cbM01Racon.addActionListener(new ActionListener() { 1006 public void actionPerformed(ActionEvent e) { 1007 int rac = cbM01Racon.getSelectedIndex(); 1008 buoy.setRaType(rac); 1009 buoy.paintSign(); 1010 } 1011 }); 1012 } 1013 return cbM01Racon; 1014 } 1015 1016 private JTextField getTfM01Racon() { 1017 if (tfM01Racon == null) { 1018 tfM01Racon = new JTextField(); 1019 tfM01Racon.setBounds(new Rectangle(345, 195, 30, 20)); 1020 tfM01Racon.addFocusListener(new FocusAdapter() { 1021 public void focusLost(FocusEvent e) { 1022 buoy.setRaconGroup(tfM01Racon.getText().trim()); 1023 } 1024 }); 1025 } 1026 return tfM01Racon; 1027 } 1028 1029 private JCheckBox getCM01Fog() { 1030 if (cM01Fog == null) { 1031 cM01Fog = new JCheckBox(); 1032 cM01Fog.setBounds(new Rectangle(10, 220, 90, 20)); 1033 cM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1034 cM01Fog.setText(Messages.getString("SmpDialogAction.174")); //$NON-NLS-1$ 1035 cM01Fog.addActionListener(new ActionListener() { 1036 public void actionPerformed(ActionEvent e) { 1037 buoy.setFog(cM01Fog.isSelected()); 1038 buoy.paintSign(); 1039 } 1040 }); 1041 } 1042 return cM01Fog; 1043 } 1044 1045 private JComboBox getCbM01Fog() { 1046 if (cbM01Fog == null) { 1047 cbM01Fog = new JComboBox(); 1048 cbM01Fog.setBounds(new Rectangle(100, 220, 70, 20)); 1049 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1050 cbM01Fog.removeAllItems(); 1051 cbM01Fog.addItem("Any"); 1052 cbM01Fog.addItem("Horn"); 1053 cbM01Fog.addItem("Siren"); 1054 cbM01Fog.addItem("Dia"); 1055 cbM01Fog.addItem("Bell"); 1056 cbM01Fog.addItem("Whis"); 1057 cbM01Fog.addItem("Gong"); 1058 cbM01Fog.addItem("Explos"); 1059 cbM01Fog.addActionListener(new ActionListener() { 1060 public void actionPerformed(ActionEvent e) { 1061 if (cbM01Fog.getSelectedIndex() > 0) 1062 buoy.setFogSound(cbM01Fog.getSelectedIndex()); 1063 else 1064 buoy.setFogSound(0); 1065 buoy.paintSign(); 1066 } 1067 }); 1068 } 1069 return cbM01Fog; 1070 } 1071 1072 private JTextField getTfM01FogGroup() { 1073 if (tfM01FogGroup == null) { 1074 tfM01FogGroup = new JTextField(); 1075 tfM01FogGroup.setBounds(new Rectangle(243, 220, 30, 20)); 1076 tfM01FogGroup.addFocusListener(new FocusAdapter() { 1077 public void focusLost(FocusEvent e) { 1078 buoy.setFogGroup(tfM01FogGroup.getText().trim()); 1079 } 1080 }); 1081 } 1082 return tfM01FogGroup; 1083 } 1084 1085 private JTextField getTfM01FogPeriod() { 1086 if (tfM01FogPeriod == null) { 1087 tfM01FogPeriod = new JTextField(); 1088 tfM01FogPeriod.setBounds(new Rectangle(345, 220, 30, 20)); 1089 tfM01FogPeriod.addFocusListener(new FocusAdapter() { 1090 public void focusLost(FocusEvent e) { 1091 buoy.setFogPeriod(tfM01FogPeriod.getText().trim()); 1092 } 1093 }); 1094 } 1095 return tfM01FogPeriod; 1096 } 1097 1098 private JCheckBox getCM01Fired() { 1099 if (cM01Fired == null) { 1100 cM01Fired = new JCheckBox(); 1101 cM01Fired.setBounds(new Rectangle(10, 245, 75, 20)); 1102 cM01Fired.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1103 cM01Fired.setText(Messages.getString("SmpDialogAction.177")); //$NON-NLS-1$ 1104 cM01Fired.addItemListener(new ItemListener() { 1105 public void itemStateChanged(ItemEvent e) { 1106 if (buoy == null) { 1107 return; 1108 } 1109 buoy.setFired(cM01Fired.isSelected()); 1110 buoy.setLightColour(); 1111 buoy.paintSign(); 1112 } 1113 }); 1114 } 1115 1116 return cM01Fired; 1117 } 1118 1119 private JComboBox getCbM01Kennung() { 1120 if (cbM01Kennung == null) { 1121 cbM01Kennung = new JComboBox(); 1122 cbM01Kennung.setBounds(new Rectangle(305, 245, 70, 20)); 1123 cbM01Kennung.addActionListener(new ActionListener() { 1124 public void actionPerformed(ActionEvent e) { 1125 int i1, i2; 1126 String c = ""; //$NON-NLS-1$ //$NON-NLS-2$ 1127 String it = (String) cbM01Kennung.getSelectedItem(); 1128 1129 if (it == null) 1130 return; 1131 if (it.equals(Messages.getString("SmpDialogAction.212"))) //$NON-NLS-1$ 1132 return; 1133 if (buoy == null) 1134 return; 1135 1136 if (it.contains("(")) { 1137 i1 = it.indexOf("("); 1138 i2 = it.indexOf(")"); 1139 c = it.substring(i1+1, i2); 1140 it = it.substring(0, i1) + it.substring(i2+1); 1141 } 1142 if (!c.isEmpty()) 1143 buoy.setLightGroup(c);; 1144 buoy.setLightChar(it); 1145 buoy.paintSign(); 1146 } 1147 }); 1148 } 1149 return cbM01Kennung; 1150 } 1151 1152 private JTextField getTfM01Height() { 1153 if (tfM01Height == null) { 1154 tfM01Height = new JTextField(); 1155 tfM01Height.setBounds(new Rectangle(54, 270, 30, 20)); 1156 tfM01Height.addFocusListener(new FocusAdapter() { 1157 public void focusLost(FocusEvent e) { 1158 buoy.setHeight(tfM01Height.getText().trim()); 1159 } 1160 }); 1161 } 1162 return tfM01Height; 1163 } 1164 1165 private JTextField getTfM01Range() { 1166 if (tfM01Range == null) { 1167 tfM01Range = new JTextField(); 1168 tfM01Range.setBounds(new Rectangle(151, 270, 30, 20)); 1169 tfM01Range.addFocusListener(new FocusAdapter() { 1170 public void focusLost(FocusEvent e) { 1171 buoy.setRange(tfM01Range.getText().trim()); 1172 } 1173 }); 1174 } 1175 return tfM01Range; 1176 } 1177 1178 private JTextField getTfM01Group() { 1179 if (tfM01Group == null) { 1180 tfM01Group = new JTextField(); 1181 tfM01Group.setBounds(new Rectangle(255, 270, 30, 20)); 1182 tfM01Group.addFocusListener(new FocusAdapter() { 1183 public void focusLost(FocusEvent e) { 1184 buoy.setLightGroup(tfM01Group.getText().trim()); 1185 buoy.paintSign(); 1186 } 1187 }); 1188 } 1189 return tfM01Group; 1190 } 1191 1192 private JTextField getTfM01RepeatTime() { 1193 if (tfM01RepeatTime == null) { 1194 tfM01RepeatTime = new JTextField(); 1195 tfM01RepeatTime.setBounds(new Rectangle(345, 270, 30, 20)); 1196 tfM01RepeatTime.addActionListener(new ActionListener() { 1197 public void actionPerformed(ActionEvent e) { 1198 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1199 buoy.paintSign(); 1200 } 1201 }); 1202 1203 tfM01RepeatTime.addFocusListener(new FocusAdapter() { 1204 public void focusLost(FocusEvent e) { 1205 buoy.setLightPeriod(tfM01RepeatTime.getText().trim()); 1206 buoy.paintSign(); 1207 } 1208 }); 1209 } 1210 return tfM01RepeatTime; 1211 } 1212 1213 private JComboBox getCbM01Colour() { 1214 if (cbM01Colour == null) { 1215 cbM01Colour = new JComboBox(); 1216 cbM01Colour.setBounds(new Rectangle(165, 295, 40, 20)); 1217 cbM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1218 cbM01Colour.addItem(""); //$NON-NLS-1$ 1219 cbM01Colour.addItem(Messages.getString("SmpDialogAction.190")); //$NON-NLS-1$ 1220 cbM01Colour.addItem(Messages.getString("SmpDialogAction.191")); //$NON-NLS-1$ 1221 cbM01Colour.addItem(Messages.getString("SmpDialogAction.192")); //$NON-NLS-1$ 1222 cbM01Colour.addActionListener(new ActionListener() { 1223 public void actionPerformed(ActionEvent e) { 1224 buoy.setLightColour((String)cbM01Colour.getSelectedItem()); 1225 buoy.paintSign(); 1226 } 1227 }); 1228 } 1229 return cbM01Colour; 1230 } 1231 1232 private JComboBox getCbM01Sector() { 1233 if (cbM01Sector == null) { 1234 cbM01Sector = new JComboBox(); 1235 cbM01Sector.setBounds(new Rectangle(55, 295, 50, 20)); 1236 cbM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1237 cbM01Sector.addItem(Messages.getString("SmpDialogAction.194")); //$NON-NLS-1$ 1238 cbM01Sector.addItem(Messages.getString("SmpDialogAction.195")); //$NON-NLS-1$ 1239 cbM01Sector.addItem(Messages.getString("SmpDialogAction.196")); //$NON-NLS-1$ 1240 cbM01Sector.addItem(Messages.getString("SmpDialogAction.197")); //$NON-NLS-1$ 1241 cbM01Sector.addItem(Messages.getString("SmpDialogAction.198")); //$NON-NLS-1$ 1242 cbM01Sector.addItem(Messages.getString("SmpDialogAction.199")); //$NON-NLS-1$ 1243 cbM01Sector.addItem(Messages.getString("SmpDialogAction.200")); //$NON-NLS-1$ 1244 cbM01Sector.addItem(Messages.getString("SmpDialogAction.201")); //$NON-NLS-1$ 1245 cbM01Sector.addItem(Messages.getString("SmpDialogAction.202")); //$NON-NLS-1$ 1246 cbM01Sector.addItem(Messages.getString("SmpDialogAction.203")); //$NON-NLS-1$ 1247 cbM01Sector.addActionListener(new ActionListener() { 1248 public void actionPerformed(ActionEvent e) { 1249 buoy.setSectorIndex(cbM01Sector.getSelectedIndex()); 1250 buoy.paintSign(); 1251 } 1252 }); 1253 } 1254 return cbM01Sector; 1255 } 1256 1257 private JTextField getTfM01Bearing() { 1258 if (tfM01Bearing == null) { 1259 tfM01Bearing = new JTextField(); 1260 tfM01Bearing.setBounds(new Rectangle(255, 295, 30, 20)); 1261 tfM01Bearing.addFocusListener(new FocusAdapter() { 1262 public void focusLost(FocusEvent e) { 1263 buoy.setBearing1(tfM01Bearing.getText().trim()); 1264 } 1265 }); 1266 } 1267 return tfM01Bearing; 1268 } 1269 1270 private JTextField getTfM02Bearing() { 1271 if (tfM02Bearing == null) { 1272 tfM02Bearing = new JTextField(); 1273 tfM02Bearing.setBounds(new Rectangle(300, 295, 30, 20)); 1274 tfM02Bearing.addFocusListener(new FocusAdapter() { 1275 public void focusLost(FocusEvent e) { 1276 buoy.setBearing2(tfM02Bearing.getText().trim()); 1277 } 1278 }); 1279 } 1280 return tfM02Bearing; 1281 } 1282 1283 private JTextField getTfM01Radius() { 1284 if (tfM01Radius == null) { 1285 tfM01Radius = new JTextField(); 1286 tfM01Radius.setBounds(new Rectangle(355, 295, 30, 20)); 1287 tfM01Radius.addFocusListener(new FocusAdapter() { 1288 public void focusLost(FocusEvent e) { 1289 buoy.setRadius(tfM01Radius.getText().trim()); 1290 } 1291 }); 1292 } 1293 return tfM01Radius; 1294 } 1295 1296 private JButton getBM01Close() { 1297 if (bM01Close == null) { 1298 bM01Close = new JButton(); 1299 bM01Close.setBounds(new Rectangle(20, 325, 110, 20)); 1300 bM01Close.setText(tr("Close")); 1301 bM01Close.addActionListener(new ActionListener() { 1302 public void actionPerformed(ActionEvent e) { 1303 // aufraeumen 1304 if (obuoy != null) 1305 PicRebuild(); 1306 // Deaktivierung des Listeners 1307 DataSet.removeSelectionListener(SmpListener); 1308 Selection = null; 1309 SmpItem.setEnabled(true); 1310 onode = null; 1311 1312 dM01SeaMap.dispose(); 1313 } 1314 }); 1315 } 1316 1317 return bM01Close; 1318 } 1319 1320 private JButton getBM01Save() { 1321 if (bM01Save == null) { 1322 bM01Save = new JButton(); 1323 bM01Save.setBounds(new Rectangle(150, 325, 110, 20)); 1324 bM01Save.setText(tr("Save")); 1325 bM01Save.setEnabled(false); 1326 1327 bM01Save.addActionListener(new ActionListener() { 1328 public void actionPerformed(ActionEvent e) { 1329 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1330 "/images/Auge.png"))); //$NON-NLS-1$ 1331 cM01IconVisible.setSelected(true); 1332 1333 buoy.saveSign(); 1334 } 1335 }); 1336 } 1337 1338 return bM01Save; 1339 } 1340 1341 private JCheckBox getCM01IconVisible() { 1342 if (cM01IconVisible == null) { 1343 cM01IconVisible = new JCheckBox(); 1344 cM01IconVisible.setBounds(new Rectangle(310, 325, 30, 21)); 1345 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1346 "/images/AugeN.png"))); //$NON-NLS-1$ 1347 cM01IconVisible.setSelected(false); 1348 cM01IconVisible.addActionListener(new ActionListener() { 1349 public void actionPerformed(ActionEvent e) { 1350 Command c; 1351 Node n = null; 1352 DataSet ds = Main.main.getCurrentDataSet(); 1353 1354 if (buoy != null) 1355 n = buoy.getNode(); 1356 1357 if (cM01IconVisible.isSelected()) { 1358 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1359 "/images/AugeN.png"))); //$NON-NLS-1$ 1360 if (n != null) { 1361 // seamark loeschen, wenn notwendig 1362 if (n.getKeys().containsKey("seamark")) { //$NON-NLS-1$ 1363 smb = n.getKeys().get("seamark"); // smb merken //$NON-NLS-1$ 1364 1365 c = new ChangePropertyCommand(n, "seamark", null); //$NON-NLS-1$ 1366 c.executeCommand(); 1367 ds.fireSelectionChanged(); 1368 obuoy = buoy; 1369 } 1370 1371 // seamark:type loeschen, wenn notwendig 1372 if (n.getKeys().containsKey("seamark:type")) { //$NON-NLS-1$ 1373 smt = n.getKeys().get("seamark:type"); // smt merken //$NON-NLS-1$ 1374 1375 c = new ChangePropertyCommand(n, "seamark:type", null); //$NON-NLS-1$ 1376 c.executeCommand(); 1377 ds.fireSelectionChanged(); 1378 obuoy = buoy; 1379 } 1380 1381 } 1382 } else { 1383 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource( 1384 "/images/Auge.png"))); //$NON-NLS-1$ 1385 PicRebuild(); 1386 obuoy = null; 1387 } 1388 buoy.paintSign(); 1389 } 1390 }); 1391 } 1392 return cM01IconVisible; 1393 } 1394 1395 private JTextField getSM01StatusBar() { 1396 if (sM01StatusBar == null) { 1397 sM01StatusBar = new JTextField(); 1398 sM01StatusBar.setBounds(new Rectangle(7, 355, 385, 20)); 1399 sM01StatusBar.setBackground(SystemColor.activeCaptionBorder); 1400 } 1401 return sM01StatusBar; 1402 } 1403 1403 1404 1404 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/plug/PluginApp.java ¶
r23138 r23193 13 13 14 14 public class PluginApp implements Runnable { 15 16 public static void runPlugins() throws IOException {17 String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath();18 15 19 //!! List<Pluggable> plugins = PluginLoader.loadPlugins(new File(pluginDirName + "/tplug")); 16 public static void runPlugins() throws IOException { 17 String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath(); 20 18 21 //!! if(plugins == null) return; 22 23 //!! PluginManager manager = new PluginManagerImpl(); 24 25 //!! for(Pluggable p : plugins) p.setPluginManager(manager); 26 //!! for(Pluggable p : plugins) p.start(); 27 28 // wait 29 try { 30 Thread.sleep(10000); 31 } catch (InterruptedException e) { 32 e.printStackTrace(); 33 } 34 35 //!! for(Pluggable p: plugins) p.stop(); 36 } 19 //!! List<Pluggable> plugins = PluginLoader.loadPlugins(new File(pluginDirName + "/tplug")); 37 20 38 @Override 39 public void run() { 40 try { 41 runPlugins(); 42 } catch (IOException e) { 43 e.printStackTrace(); 44 } 45 46 } 21 //!! if(plugins == null) return; 22 23 //!! PluginManager manager = new PluginManagerImpl(); 24 25 //!! for(Pluggable p : plugins) p.setPluginManager(manager); 26 //!! for(Pluggable p : plugins) p.start(); 27 28 // wait 29 try { 30 Thread.sleep(10000); 31 } catch (InterruptedException e) { 32 e.printStackTrace(); 33 } 34 35 //!! for(Pluggable p: plugins) p.stop(); 36 } 37 38 @Override 39 public void run() { 40 try { 41 runPlugins(); 42 } catch (IOException e) { 43 e.printStackTrace(); 44 } 45 46 } 47 47 48 48 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/plug/ifc/Pluggable.java ¶
r23079 r23193 3 3 public interface Pluggable { 4 4 5 boolean start();6 boolean stop();7 8 void setPluginManager(PluginManager manager);5 boolean start(); 6 boolean stop(); 7 8 void setPluginManager(PluginManager manager); 9 9 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/plug/ifc/PluginManager.java ¶
r23079 r23193 2 2 3 3 public interface PluginManager { 4 void showVisualMessage(String message);4 void showVisualMessage(String message); 5 5 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/plug/util/PluginLoader.java ¶
r23138 r23193 19 19 public class PluginLoader { 20 20 21 //!! public static List<Pluggable> loadPlugins(File plugDir) throws IOException { 22 //!! File[] plugJars = plugDir.listFiles(new JARFileFilter()); 23 //!! ClassLoader cl = new URLClassLoader(PluginLoader.fileArrayToURLArray(plugJars)); 24 25 //!! if(cl == null) return null; 26 27 //!! List<Class<Pluggable>> plugClasses = PluginLoader.extractClassesFromJARs(plugJars, cl); 28 29 //!! return PluginLoader.createPluggableObjects(plugClasses); 30 //!! } 21 //!! public static List<Pluggable> loadPlugins(File plugDir) throws IOException { 22 //!! File[] plugJars = plugDir.listFiles(new JARFileFilter()); 23 //!! ClassLoader cl = new URLClassLoader(PluginLoader.fileArrayToURLArray(plugJars)); 31 24 32 private static List<Pluggable> createPluggableObjects(List<Class<Pluggable>> pluggables) { 33 List<Pluggable> plugs = new ArrayList<Pluggable>(pluggables.size()); 34 for(Class<Pluggable> plug : pluggables) { 35 try { 36 plugs.add(plug.newInstance()); 37 } catch (InstantiationException e) { 38 System.err.println("Can't instantiate plugin: " + plug.getName()); 39 e.printStackTrace(); 40 } catch (IllegalAccessException e) { 41 System.err.println("IllegalAccess for plugin: " + plug.getName()); 42 e.printStackTrace(); 43 } 44 } 45 46 return plugs; 25 //!! if(cl == null) return null; 47 26 48 } 27 //!! List<Class<Pluggable>> plugClasses = PluginLoader.extractClassesFromJARs(plugJars, cl); 49 28 50 private static List<Class<Pluggable>> extractClassesFromJARs( File[] jars, ClassLoader cl) throws FileNotFoundException, IOException { 51 List<Class<Pluggable>> classes = new ArrayList<Class<Pluggable>>(); 52 53 for(File jar : jars) { 54 classes.addAll(PluginLoader.extractClassesFromJAR(jar, cl)); 55 } 29 //!! return PluginLoader.createPluggableObjects(plugClasses); 30 //!! } 56 31 57 return classes; 58 } 32 private static List<Pluggable> createPluggableObjects(List<Class<Pluggable>> pluggables) { 33 List<Pluggable> plugs = new ArrayList<Pluggable>(pluggables.size()); 34 for(Class<Pluggable> plug : pluggables) { 35 try { 36 plugs.add(plug.newInstance()); 37 } catch (InstantiationException e) { 38 System.err.println("Can't instantiate plugin: " + plug.getName()); 39 e.printStackTrace(); 40 } catch (IllegalAccessException e) { 41 System.err.println("IllegalAccess for plugin: " + plug.getName()); 42 e.printStackTrace(); 43 } 44 } 59 45 60 @SuppressWarnings("unchecked") 61 private static Collection<? extends Class<Pluggable>> extractClassesFromJAR(File jar, ClassLoader cl) throws FileNotFoundException, IOException { 62 List<Class<Pluggable>> classes = new ArrayList<Class<Pluggable>>(); 63 JarInputStream jaris = new JarInputStream(new FileInputStream(jar)); 64 JarEntry ent = null; 65 66 while ((ent = jaris.getNextJarEntry()) != null) { 67 String entName = ent.getName(); //.toLowerCase(); 68 69 if (entName.endsWith(".class")) { 70 try { 71 Class<?> cls = cl.loadClass(entName.substring(0, entName.length()- 6).replace('/', '.')); 72 if (PluginLoader.isPluggableClass(cls)) classes.add((Class<Pluggable>) cls); 73 } catch (ClassNotFoundException e) { 74 System.err.println("Can't load Class" + entName); 75 e.printStackTrace(); 76 } 77 } 78 } 79 80 jaris.close(); 81 82 return classes; 83 } 46 return plugs; 84 47 85 private static boolean isPluggableClass(Class<?> cls) { 86 for (Class<?> i: cls.getInterfaces()) { 87 if (i.equals(Pluggable.class)) return true; 88 } 89 90 return false; 48 } 91 49 92 } 50 private static List<Class<Pluggable>> extractClassesFromJARs( File[] jars, ClassLoader cl) throws FileNotFoundException, IOException { 51 List<Class<Pluggable>> classes = new ArrayList<Class<Pluggable>>(); 93 52 94 private static URL[] fileArrayToURLArray(File[] files) throws MalformedURLException { 95 URL[] urls = new URL[files.length]; 96 97 if(urls == null) return null; 98 99 for(int i = 0; i < files.length; i++) { 100 urls[i] = files[i].toURI().toURL(); 101 } 102 103 return urls; 104 } 53 for(File jar : jars) { 54 classes.addAll(PluginLoader.extractClassesFromJAR(jar, cl)); 55 } 56 57 return classes; 58 } 59 60 @SuppressWarnings("unchecked") 61 private static Collection<? extends Class<Pluggable>> extractClassesFromJAR(File jar, ClassLoader cl) throws FileNotFoundException, IOException { 62 List<Class<Pluggable>> classes = new ArrayList<Class<Pluggable>>(); 63 JarInputStream jaris = new JarInputStream(new FileInputStream(jar)); 64 JarEntry ent = null; 65 66 while ((ent = jaris.getNextJarEntry()) != null) { 67 String entName = ent.getName(); //.toLowerCase(); 68 69 if (entName.endsWith(".class")) { 70 try { 71 Class<?> cls = cl.loadClass(entName.substring(0, entName.length()- 6).replace('/', '.')); 72 if (PluginLoader.isPluggableClass(cls)) classes.add((Class<Pluggable>) cls); 73 } catch (ClassNotFoundException e) { 74 System.err.println("Can't load Class" + entName); 75 e.printStackTrace(); 76 } 77 } 78 } 79 80 jaris.close(); 81 82 return classes; 83 } 84 85 private static boolean isPluggableClass(Class<?> cls) { 86 for (Class<?> i: cls.getInterfaces()) { 87 if (i.equals(Pluggable.class)) return true; 88 } 89 90 return false; 91 92 } 93 94 private static URL[] fileArrayToURLArray(File[] files) throws MalformedURLException { 95 URL[] urls = new URL[files.length]; 96 97 if(urls == null) return null; 98 99 for(int i = 0; i < files.length; i++) { 100 urls[i] = files[i].toURI().toURL(); 101 } 102 103 return urls; 104 } 105 105 106 106 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/SeaMark.java ¶
r23176 r23193 14 14 abstract public class SeaMark { 15 15 16 /**17 * CONSTANTS18 */19 20 /**21 * Colours22 */23 24 public final static int UNKNOWN_COLOUR = 0;25 public final static int RED = 1;26 public final static int GREEN = 2;27 public final static int RED_GREEN_RED = 3;28 public final static int GREEN_RED_GREEN = 4;29 public final static int RED_WHITE = 5;30 public final static int BLACK_YELLOW = 6;31 public final static int BLACK_YELLOW_BLACK = 7;32 public final static int YELLOW_BLACK = 8;33 public final static int YELLOW_BLACK_YELLOW = 9;34 public final static int BLACK_RED_BLACK = 10;35 public final static int YELLOW = 11;36 public final static int WHITE_LIGHT = 1;37 public final static int RED_LIGHT = 2;38 public final static int GREEN_LIGHT = 3;39 40 /**41 * Types - correspond to TypeIndex42 */43 public final static int UNKNOWN_TYPE = 0;44 public final static int LATERAL = 1;45 public final static int CARDINAL = 2;46 public final static int SAFE_WATER = 3;47 public final static int ISOLATED_DANGER = 4;48 public final static int SPECIAL_PURPOSE = 5;49 public final static int LIGHT = 6;50 51 /**52 * Categories - correspond to CatIndex53 */54 public final static int UNKNOWN_CAT = 0;55 public final static int PORT_HAND = 1;56 public final static int STARBOARD_HAND = 2;57 public final static int PREF_PORT_HAND = 3;58 public final static int PREF_STARBOARD_HAND = 4;59 public final static int CARD_NORTH = 1;60 public final static int CARD_EAST = 2;61 public final static int CARD_SOUTH = 3;62 public final static int CARD_WEST = 4;63 public final static int LIGHT_HOUSE = 1;64 public final static int LIGHT_MAJOR = 2;65 public final static int LIGHT_MINOR = 3;66 public final static int LIGHT_VESSEL = 4;67 68 /**69 * Regions70 */71 public final static boolean IALA_A = false;72 public final static boolean IALA_B = true;73 74 /**75 * Shapes - correspond to StyleIndex76 */77 public final static int UNKNOWN_SHAPE = 0;78 public final static int LAT_CAN = 1;79 public final static int LAT_CONE = 1;80 public final static int LAT_PILLAR = 2;81 public final static int LAT_SPAR = 3;82 public final static int LAT_BEACON = 4;83 public final static int LAT_TOWER = 5;84 public final static int LAT_FLOAT = 6;85 public final static int LAT_PERCH = 7;86 public final static int CARD_PILLAR = 1;87 public final static int CARD_SPAR = 2;88 public final static int CARD_BEACON = 3;89 public final static int CARD_TOWER = 4;90 public final static int CARD_FLOAT = 5;91 public final static int SAFE_PILLAR = 1;92 public final static int SAFE_SPAR = 2;93 public final static int SAFE_SPHERE = 3;94 public final static int SAFE_BEACON = 4;95 public final static int SAFE_FLOAT = 5;96 public final static int ISOL_PILLAR = 1;97 public final static int ISOL_SPAR = 2;98 public final static int ISOL_BEACON = 3;99 public final static int ISOL_TOWER = 4;100 public final static int ISOL_FLOAT = 5;101 public final static int SPEC_PILLAR = 1;102 public final static int SPEC_CAN = 2;103 public final static int SPEC_CONE = 3;104 public final static int SPEC_SPAR = 4;105 public final static int SPEC_BEACON = 5;106 public final static int SPEC_TOWER = 6;107 public final static int SPEC_FLOAT = 7;108 public final static int SPEC_SPHERE = 8;109 public final static int SPEC_BARREL = 9;110 111 /**112 * Radar Beacons - correspond to Ratyp Index113 */114 115 public final static int UNKNOWN_RATYPE = 0;116 public final static int RATYPE_RACON = 1;117 public final static int RATYPE_RAMARK = 2;118 public final static int RATYPE_LEADING = 3;119 120 /**121 * Fog Signals - correspond to FogSound Index122 */123 124 public final static int UNKNOWN_FOG = 0;125 public final static int FOG_HORN = 1;126 public final static int FOG_SIREN = 2;127 public final static int FOG_DIA = 3;128 public final static int FOG_BELL = 4;129 public final static int FOG_WHIS = 5;130 public final static int FOG_GONG = 6;131 public final static int FOG_EXPLOS = 7;132 133 /**134 * Variables135 */136 137 /**138 * private Variablen139 */140 141 public abstract void paintSign();142 143 public abstract void saveSign();144 145 private int Colour = UNKNOWN_COLOUR;146 147 public int getColour() {148 return Colour;149 }150 151 public void setColour(int colour) {152 if (colour < UNKNOWN_COLOUR || colour > RED_WHITE) {153 return;154 }155 Colour = colour;156 157 }158 159 private String ErrMsg = null;160 161 public String getErrMsg() {162 return ErrMsg;163 }164 165 public void setErrMsg(String errMsg) {166 ErrMsg = errMsg;167 }168 169 private String Name;170 171 public String getName() {172 return Name;173 }174 175 public void setName(String name) {176 Name = name;177 }178 179 private boolean valid = true;180 181 public boolean isValid() {182 return valid;183 }184 185 public void setValid(boolean valid) {186 this.valid = valid;187 188 }189 190 protected void delSeaMarkKeys(Node node) {191 Iterator<String> it = node.getKeys().keySet().iterator();192 String str;193 194 while (it.hasNext()) {195 str = it.next();196 197 if (str.contains("seamark") == true)198 if (str.compareTo("seamark") != 0) {199 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));200 }201 }202 }16 /** 17 * CONSTANTS 18 */ 19 20 /** 21 * Colours 22 */ 23 24 public final static int UNKNOWN_COLOUR = 0; 25 public final static int RED = 1; 26 public final static int GREEN = 2; 27 public final static int RED_GREEN_RED = 3; 28 public final static int GREEN_RED_GREEN = 4; 29 public final static int RED_WHITE = 5; 30 public final static int BLACK_YELLOW = 6; 31 public final static int BLACK_YELLOW_BLACK = 7; 32 public final static int YELLOW_BLACK = 8; 33 public final static int YELLOW_BLACK_YELLOW = 9; 34 public final static int BLACK_RED_BLACK = 10; 35 public final static int YELLOW = 11; 36 public final static int WHITE_LIGHT = 1; 37 public final static int RED_LIGHT = 2; 38 public final static int GREEN_LIGHT = 3; 39 40 /** 41 * Types - correspond to TypeIndex 42 */ 43 public final static int UNKNOWN_TYPE = 0; 44 public final static int LATERAL = 1; 45 public final static int CARDINAL = 2; 46 public final static int SAFE_WATER = 3; 47 public final static int ISOLATED_DANGER = 4; 48 public final static int SPECIAL_PURPOSE = 5; 49 public final static int LIGHT = 6; 50 51 /** 52 * Categories - correspond to CatIndex 53 */ 54 public final static int UNKNOWN_CAT = 0; 55 public final static int PORT_HAND = 1; 56 public final static int STARBOARD_HAND = 2; 57 public final static int PREF_PORT_HAND = 3; 58 public final static int PREF_STARBOARD_HAND = 4; 59 public final static int CARD_NORTH = 1; 60 public final static int CARD_EAST = 2; 61 public final static int CARD_SOUTH = 3; 62 public final static int CARD_WEST = 4; 63 public final static int LIGHT_HOUSE = 1; 64 public final static int LIGHT_MAJOR = 2; 65 public final static int LIGHT_MINOR = 3; 66 public final static int LIGHT_VESSEL = 4; 67 68 /** 69 * Regions 70 */ 71 public final static boolean IALA_A = false; 72 public final static boolean IALA_B = true; 73 74 /** 75 * Shapes - correspond to StyleIndex 76 */ 77 public final static int UNKNOWN_SHAPE = 0; 78 public final static int LAT_CAN = 1; 79 public final static int LAT_CONE = 1; 80 public final static int LAT_PILLAR = 2; 81 public final static int LAT_SPAR = 3; 82 public final static int LAT_BEACON = 4; 83 public final static int LAT_TOWER = 5; 84 public final static int LAT_FLOAT = 6; 85 public final static int LAT_PERCH = 7; 86 public final static int CARD_PILLAR = 1; 87 public final static int CARD_SPAR = 2; 88 public final static int CARD_BEACON = 3; 89 public final static int CARD_TOWER = 4; 90 public final static int CARD_FLOAT = 5; 91 public final static int SAFE_PILLAR = 1; 92 public final static int SAFE_SPAR = 2; 93 public final static int SAFE_SPHERE = 3; 94 public final static int SAFE_BEACON = 4; 95 public final static int SAFE_FLOAT = 5; 96 public final static int ISOL_PILLAR = 1; 97 public final static int ISOL_SPAR = 2; 98 public final static int ISOL_BEACON = 3; 99 public final static int ISOL_TOWER = 4; 100 public final static int ISOL_FLOAT = 5; 101 public final static int SPEC_PILLAR = 1; 102 public final static int SPEC_CAN = 2; 103 public final static int SPEC_CONE = 3; 104 public final static int SPEC_SPAR = 4; 105 public final static int SPEC_BEACON = 5; 106 public final static int SPEC_TOWER = 6; 107 public final static int SPEC_FLOAT = 7; 108 public final static int SPEC_SPHERE = 8; 109 public final static int SPEC_BARREL = 9; 110 111 /** 112 * Radar Beacons - correspond to Ratyp Index 113 */ 114 115 public final static int UNKNOWN_RATYPE = 0; 116 public final static int RATYPE_RACON = 1; 117 public final static int RATYPE_RAMARK = 2; 118 public final static int RATYPE_LEADING = 3; 119 120 /** 121 * Fog Signals - correspond to FogSound Index 122 */ 123 124 public final static int UNKNOWN_FOG = 0; 125 public final static int FOG_HORN = 1; 126 public final static int FOG_SIREN = 2; 127 public final static int FOG_DIA = 3; 128 public final static int FOG_BELL = 4; 129 public final static int FOG_WHIS = 5; 130 public final static int FOG_GONG = 6; 131 public final static int FOG_EXPLOS = 7; 132 133 /** 134 * Variables 135 */ 136 137 /** 138 * private Variablen 139 */ 140 141 public abstract void paintSign(); 142 143 public abstract void saveSign(); 144 145 private int Colour = UNKNOWN_COLOUR; 146 147 public int getColour() { 148 return Colour; 149 } 150 151 public void setColour(int colour) { 152 if (colour < UNKNOWN_COLOUR || colour > RED_WHITE) { 153 return; 154 } 155 Colour = colour; 156 157 } 158 159 private String ErrMsg = null; 160 161 public String getErrMsg() { 162 return ErrMsg; 163 } 164 165 public void setErrMsg(String errMsg) { 166 ErrMsg = errMsg; 167 } 168 169 private String Name; 170 171 public String getName() { 172 return Name; 173 } 174 175 public void setName(String name) { 176 Name = name; 177 } 178 179 private boolean valid = true; 180 181 public boolean isValid() { 182 return valid; 183 } 184 185 public void setValid(boolean valid) { 186 this.valid = valid; 187 188 } 189 190 protected void delSeaMarkKeys(Node node) { 191 Iterator<String> it = node.getKeys().keySet().iterator(); 192 String str; 193 194 while (it.hasNext()) { 195 str = it.next(); 196 197 if (str.contains("seamark") == true) 198 if (str.compareTo("seamark") != 0) { 199 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 200 } 201 } 202 } 203 203 204 204 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java ¶
r23176 r23193 23 23 abstract public class Buoy extends SeaMark { 24 24 25 public abstract void setLightColour();26 27 /**28 * private Variablen29 */30 31 private int BuoyIndex = 0;32 33 public int getBuoyIndex() {34 return BuoyIndex;35 }36 37 public void setBuoyIndex(int buoyIndex) {38 BuoyIndex = buoyIndex;39 }40 41 private int StyleIndex = 0;42 43 public int getStyleIndex() {44 return StyleIndex;45 }46 47 public void setStyleIndex(int styleIndex) {48 StyleIndex = styleIndex;49 }50 51 private boolean Region = false;52 53 public boolean getRegion() {54 return Region;55 }56 57 public void setRegion(boolean region) {58 Region = region;59 }60 61 private boolean Radar = false;62 63 public boolean hasRadar() {64 return Radar;65 }66 67 public void setRadar(boolean radar) {68 Radar = radar;69 }70 71 private boolean Racon = false;72 73 public boolean hasRacon() {74 return Racon;75 }76 77 public void setRacon(boolean racon) {78 Racon = racon;79 }80 81 private int RaType = 0;82 83 public int getRaType() {84 return RaType;85 }86 87 public void setRaType(int type) {88 RaType = type;89 }90 91 private String RaconGroup = "";92 93 public String getRaconGroup() {94 return RaconGroup;95 }96 97 public void setRaconGroup(String raconGroup) {98 RaconGroup = raconGroup;99 }100 101 private boolean Fog = false;102 103 public boolean hasFog() {104 return Fog;105 }106 107 public void setFog(boolean fog) {108 Fog = fog;109 }110 111 private int FogSound = 0;112 113 public int getFogSound() {114 return FogSound;115 }116 117 public void setFogSound(int sound) {118 FogSound = sound;119 }120 121 private String FogGroup = "";122 123 public String getFogGroup() {124 return FogGroup;125 }126 127 public void setFogGroup(String group) {128 FogGroup = group;129 }130 131 private String FogPeriod = "";132 133 public String getFogPeriod() {134 return FogPeriod;135 }136 137 public void setFogPeriod(String period) {138 FogPeriod = period;139 }140 141 private boolean Fired = false;142 143 public boolean isFired() {144 return Fired;145 }146 147 public void setFired(boolean fired) {148 Fired = fired;149 }150 151 private boolean Sectored = false;152 153 public boolean isSectored() {154 return Sectored;155 }156 157 public void setSectored(boolean sectored) {158 Sectored = sectored;159 }160 161 private int SectorIndex = 0;162 163 public int getSectorIndex() {164 return SectorIndex;165 }166 167 public void setSectorIndex(int sector) {168 SectorIndex = sector;169 }170 171 private String[] LightChar = new String[10];172 173 public String getLightChar() {174 if (LightChar[SectorIndex] == null)175 return (LightChar[0]);176 return LightChar[SectorIndex];177 }178 179 public void setLightChar(String lightChar) {180 if (SectorIndex == 0)181 LightChar = new String[10];182 LightChar[SectorIndex] = lightChar;183 }184 185 private String[] LightColour = new String[10];186 187 public String getLightColour() {188 if (LightColour[SectorIndex] == null)189 return (LightColour[0]);190 return LightColour[SectorIndex];191 }192 193 public void setLightColour(String lightColour) {194 if (SectorIndex == 0)195 LightColour = new String[10];196 LightColour[SectorIndex] = lightColour;197 }198 199 private String[] LightGroup = new String[10];200 201 public String getLightGroup() {202 if (LightGroup[SectorIndex] == null)203 return (LightGroup[0]);204 return LightGroup[SectorIndex];205 }206 207 public void setLightGroup(String lightGroup) {208 if (SectorIndex == 0)209 LightGroup = new String[10];210 LightGroup[SectorIndex] = lightGroup;211 }212 213 protected void setLightGroup(Map<String, String> k) {214 String s = "";215 if (k.containsKey("seamark:light:group")) {216 s = k.get("seamark:light:group");217 setLightGroup(s);218 }219 }220 221 private String[] Height = new String[10];222 223 public String getHeight() {224 if (Height[SectorIndex] == null)225 return (Height[0]);226 return Height[SectorIndex];227 }228 229 public void setHeight(String height) {230 if (SectorIndex == 0)231 Height = new String[10];232 Height[SectorIndex] = height;233 }234 235 private String[] Range = new String[10];236 237 public String getRange() {238 if (Range[SectorIndex] == null)239 return (Range[0]);240 return Range[SectorIndex];241 }242 243 public void setRange(String range) {244 if (SectorIndex == 0)245 Range = new String[10];246 Range[SectorIndex] = range;247 }248 249 private String[] Bearing1 = new String[10];250 251 public String getBearing1() {252 if (Bearing1[SectorIndex] == null)253 return (Bearing1[0]);254 return Bearing1[SectorIndex];255 }256 257 public void setBearing1(String bearing) {258 if (SectorIndex == 0)259 Bearing1 = new String[10];260 Bearing1[SectorIndex] = bearing;261 }262 263 private String[] Bearing2 = new String[10];264 265 public String getBearing2() {266 if (Bearing2[SectorIndex] == null)267 return (Bearing2[0]);268 return Bearing2[SectorIndex];269 }270 271 public void setBearing2(String bearing) {272 if (SectorIndex == 0)273 Bearing2 = new String[10];274 Bearing2[SectorIndex] = bearing;275 }276 277 private String[] Radius = new String[10];278 279 public String getRadius() {280 if (Radius[SectorIndex] == null)281 return (Radius[0]);282 return Radius[SectorIndex];283 }284 285 public void setRadius(String radius) {286 if (SectorIndex == 0)287 Radius = new String[10];288 Radius[SectorIndex] = radius;289 }290 291 private String[] LightPeriod = new String[10];292 293 public String getLightPeriod() {294 if (LightPeriod[SectorIndex] == null)295 return (LightPeriod[0]);296 return LightPeriod[SectorIndex];297 }298 299 public void setLightPeriod(String lightPeriod) {300 String regex = "^[\\d\\s.]+$";301 302 if (!lightPeriod.isEmpty()) {303 304 Pattern pat = Pattern.compile(regex);305 Matcher matcher = pat.matcher(lightPeriod);306 307 if (matcher.find()) {308 setErrMsg(null);309 } else {310 setErrMsg("Must be a number");311 lightPeriod = "";312 dlg.tfM01RepeatTime.requestFocus();313 }314 }315 if (SectorIndex == 0)316 LightPeriod = new String[10];317 LightPeriod[SectorIndex] = lightPeriod;318 }319 320 private Node Node = null;321 322 public Node getNode() {323 return Node;324 }325 326 public void setNode(Node node) {327 Node = node;328 }329 330 private boolean TopMark = false;331 332 public boolean hasTopMark() {333 return TopMark;334 }335 336 public void setTopMark(boolean topMark) {337 TopMark = topMark;338 /*339 * if (dlg.cM01TopMark == null) { return; }340 */341 dlg.cM01TopMark.setSelected(topMark);342 }343 344 protected SmpDialogAction dlg = null; // hier wird der Dialog referenziert345 346 public SmpDialogAction getDlg() {347 return dlg;348 }349 350 public void setDlg(SmpDialogAction dlg) {351 this.dlg = dlg;352 }353 354 protected Buoy(SmpDialogAction dia) {355 dlg = dia;356 }357 358 public boolean isValid() {359 return false;360 }361 362 public void parseLights(Map<String, String> k) {363 setFired(false);364 setSectored(false);365 Iterator it = k.entrySet().iterator();366 while (it.hasNext()) {367 Map.Entry entry = (Map.Entry) it.next();368 String key = (String) entry.getKey();369 String value = ((String) entry.getValue()).trim();370 if (key.contains("seamark:light:")) {371 setFired(true);372 int index = 0;373 key = key.substring(14);374 if (key.matches("^\\d:.*")) {375 index = key.charAt(0) - '0';376 key = key.substring(2);377 } else if (key.matches("^\\d$")) {378 index = key.charAt(0) - '0';379 String values[] = value.split(":");380 if (values[0].equals("red"))381 LightColour[index] = "R";382 else if (values[0].equals("green"))383 LightColour[index] = "G";384 else if (values[0].equals("white"))385 LightColour[index] = "W";386 Bearing1[index] = values[1];387 Bearing2[index] = values[2];388 Radius[index] = values[3];389 } else {390 index = 0;391 }392 if (index != 0)393 setSectored(true);394 if (key.equals("colour")) {395 if (value.equals("red"))396 LightColour[index] = "R";397 else if (value.equals("green"))398 LightColour[index] = "G";399 else if (value.equals("white"))400 LightColour[index] = "W";401 } else if (key.equals("character")) {402 LightChar[index] = value;403 } else if (key.equals("group")) {404 LightGroup[index] = value;405 } else if (key.equals("period")) {406 LightPeriod[index] = value;407 } else if (key.equals("height")) {408 Height[index] = value;409 } else if (key.equals("range")) {410 Range[index] = value;411 }412 }413 }414 setSectorIndex(0);415 dlg.cbM01Sector.setSelectedIndex(0);416 dlg.cM01Fired.setSelected(isFired());417 dlg.rbM01Fired1.setSelected(!isSectored());418 dlg.rbM01FiredN.setSelected(isSectored());419 dlg.cbM01Kennung.setSelectedItem(getLightChar());420 dlg.tfM01Height.setText(getHeight());421 dlg.tfM01Range.setText(getRange());422 dlg.tfM01Group.setText(getLightGroup());423 dlg.tfM01RepeatTime.setText(getLightPeriod());424 dlg.cbM01Colour.setSelectedItem(getLightColour());425 }426 427 public void parseFogRadar(Map<String, String> k) {428 String str;429 setFog(false);430 setRadar(false);431 setRacon(false);432 if (k.containsKey("seamark:fog_signal")433 || k.containsKey("seamark:fog_signal:category")434 || k.containsKey("seamark:fog_signal:group")435 || k.containsKey("seamark:fog_signal:period")) {436 setFog(true);437 if (k.containsKey("seamark:fog_signal:category")) {438 str = k.get("seamark:fog_signal:category");439 if (str.equals("horn"))440 setFogSound(FOG_HORN);441 else if (str.equals("siren"))442 setFogSound(FOG_SIREN);443 else if (str.equals("diaphone"))444 setFogSound(FOG_DIA);445 else if (str.equals("bell"))446 setFogSound(FOG_BELL);447 else if (str.equals("whis"))448 setFogSound(FOG_WHIS);449 else if (str.equals("gong"))450 setFogSound(FOG_GONG);451 else if (str.equals("explosive"))452 setFogSound(FOG_EXPLOS);453 else454 setFogSound(UNKNOWN_FOG);455 }456 if (k.containsKey("seamark:fog_signal:group"))457 setFogGroup(k.get("seamark:fog_signal:group"));458 if (k.containsKey("seamark:fog_signal:period"))459 setFogPeriod(k.get("seamark:fog_signal:period"));460 }461 dlg.cM01Fog.setSelected(hasFog());462 dlg.cbM01Fog.setSelectedIndex(getFogSound());463 dlg.tfM01FogGroup.setText(getFogGroup());464 dlg.tfM01FogPeriod.setText(getFogPeriod());465 466 if (k.containsKey("seamark:radar_transponder")467 || k.containsKey("seamark:radar_transponder:category")468 || k.containsKey("seamark:radar_transponder:group")) {469 setRacon(true);470 if (k.containsKey("seamark:radar_transponder:category")) {471 str = k.get("seamark:radar_transponder:category");472 if (str.equals("racon"))473 setRaType(RATYPE_RACON);474 else if (str.equals("ramark"))475 setRaType(RATYPE_RAMARK);476 else if (str.equals("leading"))477 setRaType(RATYPE_LEADING);478 else479 setRaType(UNKNOWN_RATYPE);480 }481 if (k.containsKey("seamark:radar_transponder:group"))482 setRaconGroup(k.get("seamark:radar_transponder:group"));483 } else if (k.containsKey("seamark:radar_reflector"))484 setRadar(true);485 dlg.cM01Radar.setSelected(hasRadar());486 dlg.cM01Racon.setSelected(hasRacon());487 dlg.cbM01Racon.setSelectedIndex(getRaType());488 dlg.tfM01Racon.setText(getRaconGroup());489 }490 491 public void paintSign() {492 493 if (dlg.paintlock)494 return;495 else496 dlg.paintlock = true;497 498 dlg.lM01Icon.setIcon(null);499 dlg.lM02Icon.setIcon(null);500 dlg.lM03Icon.setIcon(null);501 dlg.lM04Icon.setIcon(null);502 dlg.lM05Icon.setIcon(null);503 504 dlg.rbM01RegionA.setSelected(!getRegion());505 dlg.rbM01RegionB.setSelected(getRegion());506 507 if (isValid()) {508 dlg.bM01Save.setEnabled(true);509 510 dlg.cM01TopMark.setSelected(hasTopMark());511 dlg.cM01Fired.setSelected(isFired());512 513 dlg.tfM01RepeatTime.setText(getLightPeriod());514 515 dlg.tfM01Name.setText(getName());516 dlg.tfM01Name.setEnabled(true);517 518 if (hasRadar()) {519 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource(520 "/images/Radar_Reflector.png")));521 }522 523 if (hasRacon()) {524 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource(525 "/images/Radar_Station.png")));526 dlg.cbM01Racon.setVisible(true);527 if (getRaType() == RATYPE_RACON) {528 dlg.lM01Racon.setVisible(true);529 dlg.tfM01Racon.setVisible(true);530 dlg.tfM01Racon.setEnabled(true);531 } else {532 dlg.lM01Racon.setVisible(false);533 dlg.tfM01Racon.setVisible(false);534 }535 } else {536 dlg.cbM01Racon.setVisible(false);537 dlg.lM01Racon.setVisible(false);538 dlg.tfM01Racon.setVisible(false);539 }540 541 if (hasFog()) {542 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource(543 "/images/Fog_Signal.png")));544 dlg.cbM01Fog.setVisible(true);545 if (getFogSound() == 0) {546 dlg.lM01FogGroup.setVisible(false);547 dlg.tfM01FogGroup.setVisible(false);548 dlg.lM01FogPeriod.setVisible(false);549 dlg.tfM01FogPeriod.setVisible(false);550 } else {551 dlg.lM01FogGroup.setVisible(true);552 dlg.tfM01FogGroup.setVisible(true);553 dlg.lM01FogPeriod.setVisible(true);554 dlg.tfM01FogPeriod.setVisible(true);555 }556 } else {557 dlg.cbM01Fog.setVisible(false);558 dlg.lM01FogGroup.setVisible(false);559 dlg.tfM01FogGroup.setVisible(false);560 dlg.lM01FogPeriod.setVisible(false);561 dlg.tfM01FogPeriod.setVisible(false);562 }563 564 if (isFired()) {565 String lp, c;566 String tmp = null;567 int i1;568 569 String col = getLightColour();570 if (col.equals("W")) {571 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(572 "/images/Light_White_120.png")));573 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT);574 } else if (col.equals("R")) {575 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(576 "/images/Light_Red_120.png")));577 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT);578 } else if (col.equals("G")) {579 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(580 "/images/Light_Green_120.png")));581 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT);582 } else {583 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(584 "/images/Light_Magenta_120.png")));585 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR);586 }587 588 c = getLightChar();589 if (c.contains("+")) {590 i1 = c.indexOf("+");591 tmp = c.substring(i1, c.length());592 c = c.substring(0, i1);593 if (!getLightGroup().isEmpty()) {594 c = c + "(" + getLightGroup() + ")";595 }596 if (tmp != null)597 c = c + tmp;598 }599 dlg.cbM01Kennung.setSelectedItem(c);600 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup()601 .isEmpty())602 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("("))603 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) {604 c = c + "(" + getLightGroup() + ")";605 dlg.cbM01Kennung.setSelectedItem(c);606 }607 c = c + " " + getLightColour();608 lp = getLightPeriod();609 if (!lp.isEmpty())610 c = c + " " + lp + "s";611 dlg.lM01FireMark.setText(c);612 dlg.cM01Fired.setVisible(true);613 dlg.lM01Kennung.setVisible(true);614 dlg.cbM01Kennung.setVisible(true);615 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) {616 dlg.tfM01Group.setVisible(false);617 dlg.lM01Group.setVisible(false);618 } else {619 dlg.lM01Group.setVisible(true);620 dlg.tfM01Group.setVisible(true);621 }622 dlg.tfM01Group.setText(getLightGroup());623 dlg.lM01RepeatTime.setVisible(true);624 dlg.tfM01RepeatTime.setVisible(true);625 if (isSectored()) {626 dlg.rbM01Fired1.setSelected(false);627 dlg.rbM01FiredN.setSelected(true);628 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty()))629 dlg.cbM01Kennung.setEnabled(false);630 else631 dlg.cbM01Kennung.setEnabled(true);632 dlg.cbM01Kennung.setSelectedItem(getLightChar());633 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty()))634 dlg.tfM01Group.setEnabled(false);635 else636 dlg.tfM01Group.setEnabled(true);637 dlg.tfM01Group.setText(getLightGroup());638 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty()))639 dlg.tfM01RepeatTime.setEnabled(false);640 else641 dlg.tfM01RepeatTime.setEnabled(true);642 dlg.tfM01RepeatTime.setText(getLightPeriod());643 if ((getSectorIndex() != 0) && (!Height[0].isEmpty()))644 dlg.tfM01Height.setEnabled(false);645 else646 dlg.tfM01Height.setEnabled(true);647 dlg.tfM01Height.setText(getHeight());648 if ((getSectorIndex() != 0) && (!Range[0].isEmpty()))649 dlg.tfM01Range.setEnabled(false);650 else651 dlg.tfM01Range.setEnabled(true);652 dlg.tfM01Range.setText(getRange());653 dlg.lM01Sector.setVisible(true);654 dlg.cbM01Sector.setVisible(true);655 if (getSectorIndex() == 0) {656 dlg.lM01Colour.setVisible(false);657 dlg.cbM01Colour.setVisible(false);658 dlg.lM01Bearing.setVisible(false);659 dlg.tfM01Bearing.setVisible(false);660 dlg.tfM02Bearing.setVisible(false);661 dlg.tfM01Radius.setVisible(false);662 } else {663 dlg.lM01Colour.setVisible(true);664 dlg.cbM01Colour.setVisible(true);665 dlg.lM01Bearing.setVisible(true);666 dlg.tfM01Bearing.setVisible(true);667 dlg.tfM01Bearing.setText(getBearing1());668 dlg.tfM02Bearing.setVisible(true);669 dlg.tfM02Bearing.setText(getBearing2());670 dlg.tfM01Radius.setVisible(true);671 dlg.tfM01Radius.setText(getRadius());672 }673 } else {674 dlg.rbM01FiredN.setSelected(false);675 dlg.rbM01Fired1.setSelected(true);676 dlg.cbM01Kennung.setEnabled(true);677 dlg.tfM01Group.setEnabled(true);678 dlg.tfM01RepeatTime.setEnabled(true);679 dlg.tfM01Height.setEnabled(true);680 dlg.tfM01Range.setEnabled(true);681 dlg.lM01Colour.setVisible(true);682 dlg.cbM01Colour.setVisible(true);683 dlg.lM01Sector.setVisible(false);684 dlg.cbM01Sector.setVisible(false);685 dlg.lM01Bearing.setVisible(false);686 dlg.tfM01Bearing.setVisible(false);687 dlg.tfM02Bearing.setVisible(false);688 dlg.tfM01Radius.setVisible(false);689 }690 } else {691 dlg.lM01FireMark.setText("");692 dlg.rbM01Fired1.setVisible(false);693 dlg.rbM01FiredN.setVisible(false);694 dlg.cbM01Kennung.setVisible(false);695 dlg.lM01Kennung.setVisible(false);696 dlg.tfM01Height.setVisible(false);697 dlg.lM01Height.setVisible(false);698 dlg.tfM01Range.setVisible(false);699 dlg.lM01Range.setVisible(false);700 dlg.cbM01Colour.setVisible(false);701 dlg.lM01Colour.setVisible(false);702 dlg.cbM01Sector.setVisible(false);703 dlg.lM01Sector.setVisible(false);704 dlg.tfM01Group.setVisible(false);705 dlg.lM01Group.setVisible(false);706 dlg.tfM01RepeatTime.setVisible(false);707 dlg.lM01RepeatTime.setVisible(false);708 dlg.tfM01Bearing.setVisible(false);709 dlg.lM01Bearing.setVisible(false);710 dlg.tfM02Bearing.setVisible(false);711 dlg.tfM01Radius.setVisible(false);712 }713 } else {714 dlg.bM01Save.setEnabled(false);715 dlg.tfM01Name.setEnabled(false);716 dlg.cM01TopMark.setVisible(false);717 dlg.cbM01TopMark.setVisible(false);718 dlg.cM01Radar.setVisible(false);719 dlg.cM01Racon.setVisible(false);720 dlg.cbM01Racon.setVisible(false);721 dlg.tfM01Racon.setVisible(false);722 dlg.lM01Racon.setVisible(false);723 dlg.cM01Fog.setVisible(false);724 dlg.cbM01Fog.setVisible(false);725 dlg.tfM01FogGroup.setVisible(false);726 dlg.lM01FogGroup.setVisible(false);727 dlg.tfM01FogPeriod.setVisible(false);728 dlg.lM01FogPeriod.setVisible(false);729 dlg.cM01Fired.setVisible(false);730 dlg.rbM01Fired1.setVisible(false);731 dlg.rbM01FiredN.setVisible(false);732 dlg.cbM01Kennung.setVisible(false);733 dlg.lM01Kennung.setVisible(false);734 dlg.tfM01Height.setVisible(false);735 dlg.lM01Height.setVisible(false);736 dlg.tfM01Range.setVisible(false);737 dlg.lM01Range.setVisible(false);738 dlg.cbM01Colour.setVisible(false);739 dlg.lM01Colour.setVisible(false);740 dlg.cbM01Sector.setVisible(false);741 dlg.lM01Sector.setVisible(false);742 dlg.tfM01Group.setVisible(false);743 dlg.lM01Group.setVisible(false);744 dlg.tfM01RepeatTime.setVisible(false);745 dlg.lM01RepeatTime.setVisible(false);746 dlg.tfM01Bearing.setVisible(false);747 dlg.lM01Bearing.setVisible(false);748 dlg.tfM02Bearing.setVisible(false);749 dlg.tfM01Radius.setVisible(false);750 }751 dlg.paintlock = false;752 }753 754 public void saveSign(String type) {755 delSeaMarkKeys(Node);756 757 String str = dlg.tfM01Name.getText();758 if (!str.isEmpty())759 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name",760 str));761 Main.main.undoRedo762 .add(new ChangePropertyCommand(Node, "seamark:type", type));763 }764 765 protected void saveLightData() {766 String colour;767 if (dlg.cM01Fired.isSelected()) {768 if (!(colour = LightColour[0]).isEmpty())769 if (colour.equals("R")) {770 Main.main.undoRedo.add(new ChangePropertyCommand(Node,771 "seamark:light:colour", "red"));772 } else if (colour.equals("G")) {773 Main.main.undoRedo.add(new ChangePropertyCommand(Node,774 "seamark:light:colour", "green"));775 } else if (colour.equals("W")) {776 Main.main.undoRedo.add(new ChangePropertyCommand(Node,777 "seamark:light:colour", "white"));778 }779 780 if (!LightPeriod[0].isEmpty())781 Main.main.undoRedo.add(new ChangePropertyCommand(Node,782 "seamark:light:period", LightPeriod[0]));783 784 if (!LightChar[0].isEmpty())785 Main.main.undoRedo.add(new ChangePropertyCommand(Node,786 "seamark:light:character", LightChar[0]));787 788 if (!LightGroup[0].isEmpty())789 Main.main.undoRedo.add(new ChangePropertyCommand(Node,790 "seamark:light:group", LightGroup[0]));791 792 if (!Height[0].isEmpty())793 Main.main.undoRedo.add(new ChangePropertyCommand(Node,794 "seamark:light:height", Height[0]));795 796 if (!Range[0].isEmpty())797 Main.main.undoRedo.add(new ChangePropertyCommand(Node,798 "seamark:light:range", Range[0]));799 800 for (int i = 1; i < 10; i++) {801 if ((colour = LightColour[i]) != null)802 if (colour.equals("R")) {803 Main.main.undoRedo.add(new ChangePropertyCommand(Node,804 "seamark:light:" + i + ":colour", "red"));805 if ((Bearing1[i] != null) && (Bearing2[i] != null)806 && (Radius[i] != null))807 Main.main.undoRedo.add(new ChangePropertyCommand(Node,808 "seamark:light:" + i, "red:" + Bearing1[i] + ":"809 + Bearing2[i] + ":" + Radius[i]));810 } else if (colour.equals("G")) {811 Main.main.undoRedo.add(new ChangePropertyCommand(Node,812 "seamark:light:" + i + ":colour", "green"));813 if ((Bearing1[i] != null) && (Bearing2[i] != null)814 && (Radius[i] != null))815 Main.main.undoRedo.add(new ChangePropertyCommand(Node,816 "seamark:light:" + i, "green:" + Bearing1[i] + ":"817 + Bearing2[i] + ":" + Radius[i]));818 } else if (colour.equals("W")) {819 Main.main.undoRedo.add(new ChangePropertyCommand(Node,820 "seamark:light:" + i + ":colour", "white"));821 if ((Bearing1[i] != null) && (Bearing2[i] != null)822 && (Radius[i] != null))823 Main.main.undoRedo.add(new ChangePropertyCommand(Node,824 "seamark:light:" + i, "white:" + Bearing1[i] + ":"825 + Bearing2[i] + ":" + Radius[i]));826 }827 828 if (LightPeriod[i] != null)829 Main.main.undoRedo.add(new ChangePropertyCommand(Node,830 "seamark:light:" + i + ":period", LightPeriod[i]));831 832 if (LightChar[i] != null)833 Main.main.undoRedo.add(new ChangePropertyCommand(Node,834 "seamark:light:" + i + ":character", LightChar[i]));835 836 if (LightGroup[i] != null)837 Main.main.undoRedo.add(new ChangePropertyCommand(Node,838 "seamark:light:" + i + ":group", LightGroup[i]));839 840 if (Height[i] != null)841 Main.main.undoRedo.add(new ChangePropertyCommand(Node,842 "seamark:light:" + i + ":height", Height[i]));843 844 if (Range[i] != null)845 Main.main.undoRedo.add(new ChangePropertyCommand(Node,846 "seamark:light:" + i + ":range", Range[i]));847 848 if (Bearing1[i] != null)849 Main.main.undoRedo.add(new ChangePropertyCommand(Node,850 "seamark:light:" + i + ":sector_start", Bearing1[i]));851 852 if (Bearing2[i] != null)853 Main.main.undoRedo.add(new ChangePropertyCommand(Node,854 "seamark:light:" + i + ":sector_end", Bearing2[i]));855 }856 }857 }858 859 protected void saveTopMarkData(String shape, String colour) {860 if (dlg.cM01TopMark.isSelected()) {861 Main.main.undoRedo.add(new ChangePropertyCommand(Node,862 "seamark:topmark:shape", shape));863 Main.main.undoRedo.add(new ChangePropertyCommand(Node,864 "seamark:topmark:colour", colour));865 }866 }867 868 protected void saveRadarFogData() {869 if (hasRadar()) {870 Main.main.undoRedo.add(new ChangePropertyCommand(Node,871 "seamark:radar_reflector", "yes"));872 }873 if (hasRacon()) {874 switch (RaType) {875 case RATYPE_RACON:876 Main.main.undoRedo.add(new ChangePropertyCommand(Node,877 "seamark:radar_transponder:category", "racon"));878 if (!getRaconGroup().isEmpty())879 Main.main.undoRedo.add(new ChangePropertyCommand(Node,880 "seamark:radar_transponder:group", getRaconGroup()));881 break;882 case RATYPE_RAMARK:883 Main.main.undoRedo.add(new ChangePropertyCommand(Node,884 "seamark:radar_transponder:category", "ramark"));885 break;886 case RATYPE_LEADING:887 Main.main.undoRedo.add(new ChangePropertyCommand(Node,888 "seamark:radar_transponder:category", "leading"));889 break;890 default:891 Main.main.undoRedo.add(new ChangePropertyCommand(Node,892 "seamark:radar_transponder", "yes"));893 }894 }895 if (hasFog()) {896 if (getFogSound() == 0) {897 Main.main.undoRedo.add(new ChangePropertyCommand(Node,898 "seamark:fog_signal", "yes"));899 } else {900 switch (getFogSound()) {901 case FOG_HORN:902 Main.main.undoRedo.add(new ChangePropertyCommand(Node,903 "seamark:fog_signal:category", "horn"));904 break;905 case FOG_SIREN:906 Main.main.undoRedo.add(new ChangePropertyCommand(Node,907 "seamark:fog_signal:category", "siren"));908 break;909 case FOG_DIA:910 Main.main.undoRedo.add(new ChangePropertyCommand(Node,911 "seamark:fog_signal:category", "diaphone"));912 break;913 case FOG_BELL:914 Main.main.undoRedo.add(new ChangePropertyCommand(Node,915 "seamark:fog_signal:category", "bell"));916 break;917 case FOG_WHIS:918 Main.main.undoRedo.add(new ChangePropertyCommand(Node,919 "seamark:fog_signal:category", "whistle"));920 break;921 case FOG_GONG:922 Main.main.undoRedo.add(new ChangePropertyCommand(Node,923 "seamark:fog_signal:category", "gong"));924 break;925 case FOG_EXPLOS:926 Main.main.undoRedo.add(new ChangePropertyCommand(Node,927 "seamark:fog_signal:category", "explosive"));928 break;929 }930 if (!getFogGroup().isEmpty())931 Main.main.undoRedo.add(new ChangePropertyCommand(Node,932 "seamark:fog_signal:group", getFogGroup()));933 if (!getFogPeriod().isEmpty())934 Main.main.undoRedo.add(new ChangePropertyCommand(Node,935 "seamark:fog_signal:period", getFogPeriod()));936 }937 }938 }939 940 public void refreshStyles() {941 }942 943 public void refreshLights() {944 dlg.cbM01Kennung.removeAllItems();945 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$946 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$947 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$948 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$949 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$950 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$951 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$952 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$953 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$954 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$955 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$956 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$957 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$958 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$959 dlg.cbM01Kennung.setSelectedIndex(0);960 }961 962 public void resetMask() {963 setRegion(Main.pref.get("tomsplugin.IALA").equals("B"));964 965 dlg.lM01Icon.setIcon(null);966 dlg.lM02Icon.setIcon(null);967 dlg.lM03Icon.setIcon(null);968 dlg.lM04Icon.setIcon(null);969 970 dlg.rbM01RegionA.setEnabled(false);971 dlg.rbM01RegionB.setEnabled(false);972 dlg.lM01FireMark.setText("");973 dlg.cbM01CatOfMark.removeAllItems();974 dlg.cbM01CatOfMark.setVisible(false);975 dlg.lM01CatOfMark.setVisible(false);976 setBuoyIndex(0);977 dlg.cbM01StyleOfMark.removeAllItems();978 dlg.cbM01StyleOfMark.setVisible(false);979 dlg.lM01StyleOfMark.setVisible(false);980 setStyleIndex(0);981 dlg.tfM01Name.setText("");982 dlg.tfM01Name.setEnabled(false);983 setName("");984 dlg.cM01TopMark.setSelected(false);985 dlg.cM01TopMark.setVisible(false);986 dlg.cbM01TopMark.removeAllItems();987 dlg.cbM01TopMark.setVisible(false);988 setTopMark(false);989 dlg.cM01Radar.setSelected(false);990 dlg.cM01Radar.setVisible(false);991 setRadar(false);992 dlg.cM01Racon.setSelected(false);993 dlg.cM01Racon.setVisible(false);994 dlg.cbM01Racon.setVisible(false);995 dlg.tfM01Racon.setText("");996 dlg.tfM01Racon.setVisible(false);997 dlg.lM01Racon.setVisible(false);998 setRacon(false);999 setRaType(0);1000 dlg.cM01Fog.setSelected(false);1001 dlg.cM01Fog.setVisible(false);1002 dlg.cbM01Fog.setVisible(false);1003 setFogSound(0);1004 dlg.tfM01FogGroup.setText("");1005 dlg.tfM01FogGroup.setVisible(false);1006 dlg.lM01FogGroup.setVisible(false);1007 dlg.tfM01FogPeriod.setText("");1008 dlg.tfM01FogPeriod.setVisible(false);1009 dlg.lM01FogPeriod.setVisible(false);1010 setFog(false);1011 dlg.cM01Fired.setSelected(false);1012 dlg.cM01Fired.setVisible(false);1013 setFired(false);1014 dlg.rbM01Fired1.setVisible(false);1015 dlg.rbM01Fired1.setSelected(true);1016 dlg.rbM01FiredN.setVisible(false);1017 dlg.rbM01FiredN.setSelected(false);1018 setSectored(false);1019 dlg.cbM01Kennung.removeAllItems();1020 dlg.cbM01Kennung.setVisible(false);1021 dlg.lM01Kennung.setVisible(false);1022 setLightChar("");1023 dlg.tfM01Height.setText("");1024 dlg.tfM01Height.setVisible(false);1025 dlg.lM01Height.setVisible(false);1026 setHeight("");1027 dlg.tfM01Range.setText("");1028 dlg.tfM01Range.setVisible(false);1029 dlg.lM01Range.setVisible(false);1030 setRange("");1031 dlg.cbM01Colour.setVisible(false);1032 dlg.lM01Colour.setVisible(false);1033 setLightColour("");1034 dlg.cbM01Sector.setVisible(false);1035 dlg.lM01Sector.setVisible(false);1036 setSectorIndex(0);1037 dlg.tfM01Group.setText("");1038 dlg.tfM01Group.setVisible(false);1039 dlg.lM01Group.setVisible(false);1040 setLightGroup("");1041 dlg.tfM01RepeatTime.setText("");1042 dlg.tfM01RepeatTime.setVisible(false);1043 dlg.lM01RepeatTime.setVisible(false);1044 setLightPeriod("");1045 dlg.tfM01Bearing.setText("");1046 dlg.tfM01Bearing.setVisible(false);1047 dlg.lM01Bearing.setVisible(false);1048 setBearing1("");1049 dlg.tfM02Bearing.setText("");1050 dlg.tfM02Bearing.setVisible(false);1051 setBearing2("");1052 dlg.tfM01Radius.setText("");1053 dlg.tfM01Radius.setVisible(false);1054 setRadius("");1055 1056 dlg.bM01Save.setEnabled(false);1057 }25 public abstract void setLightColour(); 26 27 /** 28 * private Variablen 29 */ 30 31 private int BuoyIndex = 0; 32 33 public int getBuoyIndex() { 34 return BuoyIndex; 35 } 36 37 public void setBuoyIndex(int buoyIndex) { 38 BuoyIndex = buoyIndex; 39 } 40 41 private int StyleIndex = 0; 42 43 public int getStyleIndex() { 44 return StyleIndex; 45 } 46 47 public void setStyleIndex(int styleIndex) { 48 StyleIndex = styleIndex; 49 } 50 51 private boolean Region = false; 52 53 public boolean getRegion() { 54 return Region; 55 } 56 57 public void setRegion(boolean region) { 58 Region = region; 59 } 60 61 private boolean Radar = false; 62 63 public boolean hasRadar() { 64 return Radar; 65 } 66 67 public void setRadar(boolean radar) { 68 Radar = radar; 69 } 70 71 private boolean Racon = false; 72 73 public boolean hasRacon() { 74 return Racon; 75 } 76 77 public void setRacon(boolean racon) { 78 Racon = racon; 79 } 80 81 private int RaType = 0; 82 83 public int getRaType() { 84 return RaType; 85 } 86 87 public void setRaType(int type) { 88 RaType = type; 89 } 90 91 private String RaconGroup = ""; 92 93 public String getRaconGroup() { 94 return RaconGroup; 95 } 96 97 public void setRaconGroup(String raconGroup) { 98 RaconGroup = raconGroup; 99 } 100 101 private boolean Fog = false; 102 103 public boolean hasFog() { 104 return Fog; 105 } 106 107 public void setFog(boolean fog) { 108 Fog = fog; 109 } 110 111 private int FogSound = 0; 112 113 public int getFogSound() { 114 return FogSound; 115 } 116 117 public void setFogSound(int sound) { 118 FogSound = sound; 119 } 120 121 private String FogGroup = ""; 122 123 public String getFogGroup() { 124 return FogGroup; 125 } 126 127 public void setFogGroup(String group) { 128 FogGroup = group; 129 } 130 131 private String FogPeriod = ""; 132 133 public String getFogPeriod() { 134 return FogPeriod; 135 } 136 137 public void setFogPeriod(String period) { 138 FogPeriod = period; 139 } 140 141 private boolean Fired = false; 142 143 public boolean isFired() { 144 return Fired; 145 } 146 147 public void setFired(boolean fired) { 148 Fired = fired; 149 } 150 151 private boolean Sectored = false; 152 153 public boolean isSectored() { 154 return Sectored; 155 } 156 157 public void setSectored(boolean sectored) { 158 Sectored = sectored; 159 } 160 161 private int SectorIndex = 0; 162 163 public int getSectorIndex() { 164 return SectorIndex; 165 } 166 167 public void setSectorIndex(int sector) { 168 SectorIndex = sector; 169 } 170 171 private String[] LightChar = new String[10]; 172 173 public String getLightChar() { 174 if (LightChar[SectorIndex] == null) 175 return (LightChar[0]); 176 return LightChar[SectorIndex]; 177 } 178 179 public void setLightChar(String lightChar) { 180 if (SectorIndex == 0) 181 LightChar = new String[10]; 182 LightChar[SectorIndex] = lightChar; 183 } 184 185 private String[] LightColour = new String[10]; 186 187 public String getLightColour() { 188 if (LightColour[SectorIndex] == null) 189 return (LightColour[0]); 190 return LightColour[SectorIndex]; 191 } 192 193 public void setLightColour(String lightColour) { 194 if (SectorIndex == 0) 195 LightColour = new String[10]; 196 LightColour[SectorIndex] = lightColour; 197 } 198 199 private String[] LightGroup = new String[10]; 200 201 public String getLightGroup() { 202 if (LightGroup[SectorIndex] == null) 203 return (LightGroup[0]); 204 return LightGroup[SectorIndex]; 205 } 206 207 public void setLightGroup(String lightGroup) { 208 if (SectorIndex == 0) 209 LightGroup = new String[10]; 210 LightGroup[SectorIndex] = lightGroup; 211 } 212 213 protected void setLightGroup(Map<String, String> k) { 214 String s = ""; 215 if (k.containsKey("seamark:light:group")) { 216 s = k.get("seamark:light:group"); 217 setLightGroup(s); 218 } 219 } 220 221 private String[] Height = new String[10]; 222 223 public String getHeight() { 224 if (Height[SectorIndex] == null) 225 return (Height[0]); 226 return Height[SectorIndex]; 227 } 228 229 public void setHeight(String height) { 230 if (SectorIndex == 0) 231 Height = new String[10]; 232 Height[SectorIndex] = height; 233 } 234 235 private String[] Range = new String[10]; 236 237 public String getRange() { 238 if (Range[SectorIndex] == null) 239 return (Range[0]); 240 return Range[SectorIndex]; 241 } 242 243 public void setRange(String range) { 244 if (SectorIndex == 0) 245 Range = new String[10]; 246 Range[SectorIndex] = range; 247 } 248 249 private String[] Bearing1 = new String[10]; 250 251 public String getBearing1() { 252 if (Bearing1[SectorIndex] == null) 253 return (Bearing1[0]); 254 return Bearing1[SectorIndex]; 255 } 256 257 public void setBearing1(String bearing) { 258 if (SectorIndex == 0) 259 Bearing1 = new String[10]; 260 Bearing1[SectorIndex] = bearing; 261 } 262 263 private String[] Bearing2 = new String[10]; 264 265 public String getBearing2() { 266 if (Bearing2[SectorIndex] == null) 267 return (Bearing2[0]); 268 return Bearing2[SectorIndex]; 269 } 270 271 public void setBearing2(String bearing) { 272 if (SectorIndex == 0) 273 Bearing2 = new String[10]; 274 Bearing2[SectorIndex] = bearing; 275 } 276 277 private String[] Radius = new String[10]; 278 279 public String getRadius() { 280 if (Radius[SectorIndex] == null) 281 return (Radius[0]); 282 return Radius[SectorIndex]; 283 } 284 285 public void setRadius(String radius) { 286 if (SectorIndex == 0) 287 Radius = new String[10]; 288 Radius[SectorIndex] = radius; 289 } 290 291 private String[] LightPeriod = new String[10]; 292 293 public String getLightPeriod() { 294 if (LightPeriod[SectorIndex] == null) 295 return (LightPeriod[0]); 296 return LightPeriod[SectorIndex]; 297 } 298 299 public void setLightPeriod(String lightPeriod) { 300 String regex = "^[\\d\\s.]+$"; 301 302 if (!lightPeriod.isEmpty()) { 303 304 Pattern pat = Pattern.compile(regex); 305 Matcher matcher = pat.matcher(lightPeriod); 306 307 if (matcher.find()) { 308 setErrMsg(null); 309 } else { 310 setErrMsg("Must be a number"); 311 lightPeriod = ""; 312 dlg.tfM01RepeatTime.requestFocus(); 313 } 314 } 315 if (SectorIndex == 0) 316 LightPeriod = new String[10]; 317 LightPeriod[SectorIndex] = lightPeriod; 318 } 319 320 private Node Node = null; 321 322 public Node getNode() { 323 return Node; 324 } 325 326 public void setNode(Node node) { 327 Node = node; 328 } 329 330 private boolean TopMark = false; 331 332 public boolean hasTopMark() { 333 return TopMark; 334 } 335 336 public void setTopMark(boolean topMark) { 337 TopMark = topMark; 338 /* 339 * if (dlg.cM01TopMark == null) { return; } 340 */ 341 dlg.cM01TopMark.setSelected(topMark); 342 } 343 344 protected SmpDialogAction dlg = null; // hier wird der Dialog referenziert 345 346 public SmpDialogAction getDlg() { 347 return dlg; 348 } 349 350 public void setDlg(SmpDialogAction dlg) { 351 this.dlg = dlg; 352 } 353 354 protected Buoy(SmpDialogAction dia) { 355 dlg = dia; 356 } 357 358 public boolean isValid() { 359 return false; 360 } 361 362 public void parseLights(Map<String, String> k) { 363 setFired(false); 364 setSectored(false); 365 Iterator it = k.entrySet().iterator(); 366 while (it.hasNext()) { 367 Map.Entry entry = (Map.Entry) it.next(); 368 String key = (String) entry.getKey(); 369 String value = ((String) entry.getValue()).trim(); 370 if (key.contains("seamark:light:")) { 371 setFired(true); 372 int index = 0; 373 key = key.substring(14); 374 if (key.matches("^\\d:.*")) { 375 index = key.charAt(0) - '0'; 376 key = key.substring(2); 377 } else if (key.matches("^\\d$")) { 378 index = key.charAt(0) - '0'; 379 String values[] = value.split(":"); 380 if (values[0].equals("red")) 381 LightColour[index] = "R"; 382 else if (values[0].equals("green")) 383 LightColour[index] = "G"; 384 else if (values[0].equals("white")) 385 LightColour[index] = "W"; 386 Bearing1[index] = values[1]; 387 Bearing2[index] = values[2]; 388 Radius[index] = values[3]; 389 } else { 390 index = 0; 391 } 392 if (index != 0) 393 setSectored(true); 394 if (key.equals("colour")) { 395 if (value.equals("red")) 396 LightColour[index] = "R"; 397 else if (value.equals("green")) 398 LightColour[index] = "G"; 399 else if (value.equals("white")) 400 LightColour[index] = "W"; 401 } else if (key.equals("character")) { 402 LightChar[index] = value; 403 } else if (key.equals("group")) { 404 LightGroup[index] = value; 405 } else if (key.equals("period")) { 406 LightPeriod[index] = value; 407 } else if (key.equals("height")) { 408 Height[index] = value; 409 } else if (key.equals("range")) { 410 Range[index] = value; 411 } 412 } 413 } 414 setSectorIndex(0); 415 dlg.cbM01Sector.setSelectedIndex(0); 416 dlg.cM01Fired.setSelected(isFired()); 417 dlg.rbM01Fired1.setSelected(!isSectored()); 418 dlg.rbM01FiredN.setSelected(isSectored()); 419 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 420 dlg.tfM01Height.setText(getHeight()); 421 dlg.tfM01Range.setText(getRange()); 422 dlg.tfM01Group.setText(getLightGroup()); 423 dlg.tfM01RepeatTime.setText(getLightPeriod()); 424 dlg.cbM01Colour.setSelectedItem(getLightColour()); 425 } 426 427 public void parseFogRadar(Map<String, String> k) { 428 String str; 429 setFog(false); 430 setRadar(false); 431 setRacon(false); 432 if (k.containsKey("seamark:fog_signal") 433 || k.containsKey("seamark:fog_signal:category") 434 || k.containsKey("seamark:fog_signal:group") 435 || k.containsKey("seamark:fog_signal:period")) { 436 setFog(true); 437 if (k.containsKey("seamark:fog_signal:category")) { 438 str = k.get("seamark:fog_signal:category"); 439 if (str.equals("horn")) 440 setFogSound(FOG_HORN); 441 else if (str.equals("siren")) 442 setFogSound(FOG_SIREN); 443 else if (str.equals("diaphone")) 444 setFogSound(FOG_DIA); 445 else if (str.equals("bell")) 446 setFogSound(FOG_BELL); 447 else if (str.equals("whis")) 448 setFogSound(FOG_WHIS); 449 else if (str.equals("gong")) 450 setFogSound(FOG_GONG); 451 else if (str.equals("explosive")) 452 setFogSound(FOG_EXPLOS); 453 else 454 setFogSound(UNKNOWN_FOG); 455 } 456 if (k.containsKey("seamark:fog_signal:group")) 457 setFogGroup(k.get("seamark:fog_signal:group")); 458 if (k.containsKey("seamark:fog_signal:period")) 459 setFogPeriod(k.get("seamark:fog_signal:period")); 460 } 461 dlg.cM01Fog.setSelected(hasFog()); 462 dlg.cbM01Fog.setSelectedIndex(getFogSound()); 463 dlg.tfM01FogGroup.setText(getFogGroup()); 464 dlg.tfM01FogPeriod.setText(getFogPeriod()); 465 466 if (k.containsKey("seamark:radar_transponder") 467 || k.containsKey("seamark:radar_transponder:category") 468 || k.containsKey("seamark:radar_transponder:group")) { 469 setRacon(true); 470 if (k.containsKey("seamark:radar_transponder:category")) { 471 str = k.get("seamark:radar_transponder:category"); 472 if (str.equals("racon")) 473 setRaType(RATYPE_RACON); 474 else if (str.equals("ramark")) 475 setRaType(RATYPE_RAMARK); 476 else if (str.equals("leading")) 477 setRaType(RATYPE_LEADING); 478 else 479 setRaType(UNKNOWN_RATYPE); 480 } 481 if (k.containsKey("seamark:radar_transponder:group")) 482 setRaconGroup(k.get("seamark:radar_transponder:group")); 483 } else if (k.containsKey("seamark:radar_reflector")) 484 setRadar(true); 485 dlg.cM01Radar.setSelected(hasRadar()); 486 dlg.cM01Racon.setSelected(hasRacon()); 487 dlg.cbM01Racon.setSelectedIndex(getRaType()); 488 dlg.tfM01Racon.setText(getRaconGroup()); 489 } 490 491 public void paintSign() { 492 493 if (dlg.paintlock) 494 return; 495 else 496 dlg.paintlock = true; 497 498 dlg.lM01Icon.setIcon(null); 499 dlg.lM02Icon.setIcon(null); 500 dlg.lM03Icon.setIcon(null); 501 dlg.lM04Icon.setIcon(null); 502 dlg.lM05Icon.setIcon(null); 503 504 dlg.rbM01RegionA.setSelected(!getRegion()); 505 dlg.rbM01RegionB.setSelected(getRegion()); 506 507 if (isValid()) { 508 dlg.bM01Save.setEnabled(true); 509 510 dlg.cM01TopMark.setSelected(hasTopMark()); 511 dlg.cM01Fired.setSelected(isFired()); 512 513 dlg.tfM01RepeatTime.setText(getLightPeriod()); 514 515 dlg.tfM01Name.setText(getName()); 516 dlg.tfM01Name.setEnabled(true); 517 518 if (hasRadar()) { 519 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 520 "/images/Radar_Reflector.png"))); 521 } 522 523 if (hasRacon()) { 524 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 525 "/images/Radar_Station.png"))); 526 dlg.cbM01Racon.setVisible(true); 527 if (getRaType() == RATYPE_RACON) { 528 dlg.lM01Racon.setVisible(true); 529 dlg.tfM01Racon.setVisible(true); 530 dlg.tfM01Racon.setEnabled(true); 531 } else { 532 dlg.lM01Racon.setVisible(false); 533 dlg.tfM01Racon.setVisible(false); 534 } 535 } else { 536 dlg.cbM01Racon.setVisible(false); 537 dlg.lM01Racon.setVisible(false); 538 dlg.tfM01Racon.setVisible(false); 539 } 540 541 if (hasFog()) { 542 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 543 "/images/Fog_Signal.png"))); 544 dlg.cbM01Fog.setVisible(true); 545 if (getFogSound() == 0) { 546 dlg.lM01FogGroup.setVisible(false); 547 dlg.tfM01FogGroup.setVisible(false); 548 dlg.lM01FogPeriod.setVisible(false); 549 dlg.tfM01FogPeriod.setVisible(false); 550 } else { 551 dlg.lM01FogGroup.setVisible(true); 552 dlg.tfM01FogGroup.setVisible(true); 553 dlg.lM01FogPeriod.setVisible(true); 554 dlg.tfM01FogPeriod.setVisible(true); 555 } 556 } else { 557 dlg.cbM01Fog.setVisible(false); 558 dlg.lM01FogGroup.setVisible(false); 559 dlg.tfM01FogGroup.setVisible(false); 560 dlg.lM01FogPeriod.setVisible(false); 561 dlg.tfM01FogPeriod.setVisible(false); 562 } 563 564 if (isFired()) { 565 String lp, c; 566 String tmp = null; 567 int i1; 568 569 String col = getLightColour(); 570 if (col.equals("W")) { 571 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 572 "/images/Light_White_120.png"))); 573 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT); 574 } else if (col.equals("R")) { 575 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 576 "/images/Light_Red_120.png"))); 577 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT); 578 } else if (col.equals("G")) { 579 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 580 "/images/Light_Green_120.png"))); 581 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT); 582 } else { 583 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 584 "/images/Light_Magenta_120.png"))); 585 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR); 586 } 587 588 c = getLightChar(); 589 if (c.contains("+")) { 590 i1 = c.indexOf("+"); 591 tmp = c.substring(i1, c.length()); 592 c = c.substring(0, i1); 593 if (!getLightGroup().isEmpty()) { 594 c = c + "(" + getLightGroup() + ")"; 595 } 596 if (tmp != null) 597 c = c + tmp; 598 } 599 dlg.cbM01Kennung.setSelectedItem(c); 600 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup() 601 .isEmpty()) 602 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) 603 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) { 604 c = c + "(" + getLightGroup() + ")"; 605 dlg.cbM01Kennung.setSelectedItem(c); 606 } 607 c = c + " " + getLightColour(); 608 lp = getLightPeriod(); 609 if (!lp.isEmpty()) 610 c = c + " " + lp + "s"; 611 dlg.lM01FireMark.setText(c); 612 dlg.cM01Fired.setVisible(true); 613 dlg.lM01Kennung.setVisible(true); 614 dlg.cbM01Kennung.setVisible(true); 615 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) { 616 dlg.tfM01Group.setVisible(false); 617 dlg.lM01Group.setVisible(false); 618 } else { 619 dlg.lM01Group.setVisible(true); 620 dlg.tfM01Group.setVisible(true); 621 } 622 dlg.tfM01Group.setText(getLightGroup()); 623 dlg.lM01RepeatTime.setVisible(true); 624 dlg.tfM01RepeatTime.setVisible(true); 625 if (isSectored()) { 626 dlg.rbM01Fired1.setSelected(false); 627 dlg.rbM01FiredN.setSelected(true); 628 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty())) 629 dlg.cbM01Kennung.setEnabled(false); 630 else 631 dlg.cbM01Kennung.setEnabled(true); 632 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 633 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty())) 634 dlg.tfM01Group.setEnabled(false); 635 else 636 dlg.tfM01Group.setEnabled(true); 637 dlg.tfM01Group.setText(getLightGroup()); 638 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty())) 639 dlg.tfM01RepeatTime.setEnabled(false); 640 else 641 dlg.tfM01RepeatTime.setEnabled(true); 642 dlg.tfM01RepeatTime.setText(getLightPeriod()); 643 if ((getSectorIndex() != 0) && (!Height[0].isEmpty())) 644 dlg.tfM01Height.setEnabled(false); 645 else 646 dlg.tfM01Height.setEnabled(true); 647 dlg.tfM01Height.setText(getHeight()); 648 if ((getSectorIndex() != 0) && (!Range[0].isEmpty())) 649 dlg.tfM01Range.setEnabled(false); 650 else 651 dlg.tfM01Range.setEnabled(true); 652 dlg.tfM01Range.setText(getRange()); 653 dlg.lM01Sector.setVisible(true); 654 dlg.cbM01Sector.setVisible(true); 655 if (getSectorIndex() == 0) { 656 dlg.lM01Colour.setVisible(false); 657 dlg.cbM01Colour.setVisible(false); 658 dlg.lM01Bearing.setVisible(false); 659 dlg.tfM01Bearing.setVisible(false); 660 dlg.tfM02Bearing.setVisible(false); 661 dlg.tfM01Radius.setVisible(false); 662 } else { 663 dlg.lM01Colour.setVisible(true); 664 dlg.cbM01Colour.setVisible(true); 665 dlg.lM01Bearing.setVisible(true); 666 dlg.tfM01Bearing.setVisible(true); 667 dlg.tfM01Bearing.setText(getBearing1()); 668 dlg.tfM02Bearing.setVisible(true); 669 dlg.tfM02Bearing.setText(getBearing2()); 670 dlg.tfM01Radius.setVisible(true); 671 dlg.tfM01Radius.setText(getRadius()); 672 } 673 } else { 674 dlg.rbM01FiredN.setSelected(false); 675 dlg.rbM01Fired1.setSelected(true); 676 dlg.cbM01Kennung.setEnabled(true); 677 dlg.tfM01Group.setEnabled(true); 678 dlg.tfM01RepeatTime.setEnabled(true); 679 dlg.tfM01Height.setEnabled(true); 680 dlg.tfM01Range.setEnabled(true); 681 dlg.lM01Colour.setVisible(true); 682 dlg.cbM01Colour.setVisible(true); 683 dlg.lM01Sector.setVisible(false); 684 dlg.cbM01Sector.setVisible(false); 685 dlg.lM01Bearing.setVisible(false); 686 dlg.tfM01Bearing.setVisible(false); 687 dlg.tfM02Bearing.setVisible(false); 688 dlg.tfM01Radius.setVisible(false); 689 } 690 } else { 691 dlg.lM01FireMark.setText(""); 692 dlg.rbM01Fired1.setVisible(false); 693 dlg.rbM01FiredN.setVisible(false); 694 dlg.cbM01Kennung.setVisible(false); 695 dlg.lM01Kennung.setVisible(false); 696 dlg.tfM01Height.setVisible(false); 697 dlg.lM01Height.setVisible(false); 698 dlg.tfM01Range.setVisible(false); 699 dlg.lM01Range.setVisible(false); 700 dlg.cbM01Colour.setVisible(false); 701 dlg.lM01Colour.setVisible(false); 702 dlg.cbM01Sector.setVisible(false); 703 dlg.lM01Sector.setVisible(false); 704 dlg.tfM01Group.setVisible(false); 705 dlg.lM01Group.setVisible(false); 706 dlg.tfM01RepeatTime.setVisible(false); 707 dlg.lM01RepeatTime.setVisible(false); 708 dlg.tfM01Bearing.setVisible(false); 709 dlg.lM01Bearing.setVisible(false); 710 dlg.tfM02Bearing.setVisible(false); 711 dlg.tfM01Radius.setVisible(false); 712 } 713 } else { 714 dlg.bM01Save.setEnabled(false); 715 dlg.tfM01Name.setEnabled(false); 716 dlg.cM01TopMark.setVisible(false); 717 dlg.cbM01TopMark.setVisible(false); 718 dlg.cM01Radar.setVisible(false); 719 dlg.cM01Racon.setVisible(false); 720 dlg.cbM01Racon.setVisible(false); 721 dlg.tfM01Racon.setVisible(false); 722 dlg.lM01Racon.setVisible(false); 723 dlg.cM01Fog.setVisible(false); 724 dlg.cbM01Fog.setVisible(false); 725 dlg.tfM01FogGroup.setVisible(false); 726 dlg.lM01FogGroup.setVisible(false); 727 dlg.tfM01FogPeriod.setVisible(false); 728 dlg.lM01FogPeriod.setVisible(false); 729 dlg.cM01Fired.setVisible(false); 730 dlg.rbM01Fired1.setVisible(false); 731 dlg.rbM01FiredN.setVisible(false); 732 dlg.cbM01Kennung.setVisible(false); 733 dlg.lM01Kennung.setVisible(false); 734 dlg.tfM01Height.setVisible(false); 735 dlg.lM01Height.setVisible(false); 736 dlg.tfM01Range.setVisible(false); 737 dlg.lM01Range.setVisible(false); 738 dlg.cbM01Colour.setVisible(false); 739 dlg.lM01Colour.setVisible(false); 740 dlg.cbM01Sector.setVisible(false); 741 dlg.lM01Sector.setVisible(false); 742 dlg.tfM01Group.setVisible(false); 743 dlg.lM01Group.setVisible(false); 744 dlg.tfM01RepeatTime.setVisible(false); 745 dlg.lM01RepeatTime.setVisible(false); 746 dlg.tfM01Bearing.setVisible(false); 747 dlg.lM01Bearing.setVisible(false); 748 dlg.tfM02Bearing.setVisible(false); 749 dlg.tfM01Radius.setVisible(false); 750 } 751 dlg.paintlock = false; 752 } 753 754 public void saveSign(String type) { 755 delSeaMarkKeys(Node); 756 757 String str = dlg.tfM01Name.getText(); 758 if (!str.isEmpty()) 759 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name", 760 str)); 761 Main.main.undoRedo 762 .add(new ChangePropertyCommand(Node, "seamark:type", type)); 763 } 764 765 protected void saveLightData() { 766 String colour; 767 if (dlg.cM01Fired.isSelected()) { 768 if (!(colour = LightColour[0]).isEmpty()) 769 if (colour.equals("R")) { 770 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 771 "seamark:light:colour", "red")); 772 } else if (colour.equals("G")) { 773 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 774 "seamark:light:colour", "green")); 775 } else if (colour.equals("W")) { 776 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 777 "seamark:light:colour", "white")); 778 } 779 780 if (!LightPeriod[0].isEmpty()) 781 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 782 "seamark:light:period", LightPeriod[0])); 783 784 if (!LightChar[0].isEmpty()) 785 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 786 "seamark:light:character", LightChar[0])); 787 788 if (!LightGroup[0].isEmpty()) 789 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 790 "seamark:light:group", LightGroup[0])); 791 792 if (!Height[0].isEmpty()) 793 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 794 "seamark:light:height", Height[0])); 795 796 if (!Range[0].isEmpty()) 797 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 798 "seamark:light:range", Range[0])); 799 800 for (int i = 1; i < 10; i++) { 801 if ((colour = LightColour[i]) != null) 802 if (colour.equals("R")) { 803 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 804 "seamark:light:" + i + ":colour", "red")); 805 if ((Bearing1[i] != null) && (Bearing2[i] != null) 806 && (Radius[i] != null)) 807 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 808 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 809 + Bearing2[i] + ":" + Radius[i])); 810 } else if (colour.equals("G")) { 811 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 812 "seamark:light:" + i + ":colour", "green")); 813 if ((Bearing1[i] != null) && (Bearing2[i] != null) 814 && (Radius[i] != null)) 815 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 816 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 817 + Bearing2[i] + ":" + Radius[i])); 818 } else if (colour.equals("W")) { 819 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 820 "seamark:light:" + i + ":colour", "white")); 821 if ((Bearing1[i] != null) && (Bearing2[i] != null) 822 && (Radius[i] != null)) 823 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 824 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 825 + Bearing2[i] + ":" + Radius[i])); 826 } 827 828 if (LightPeriod[i] != null) 829 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 830 "seamark:light:" + i + ":period", LightPeriod[i])); 831 832 if (LightChar[i] != null) 833 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 834 "seamark:light:" + i + ":character", LightChar[i])); 835 836 if (LightGroup[i] != null) 837 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 838 "seamark:light:" + i + ":group", LightGroup[i])); 839 840 if (Height[i] != null) 841 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 842 "seamark:light:" + i + ":height", Height[i])); 843 844 if (Range[i] != null) 845 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 846 "seamark:light:" + i + ":range", Range[i])); 847 848 if (Bearing1[i] != null) 849 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 850 "seamark:light:" + i + ":sector_start", Bearing1[i])); 851 852 if (Bearing2[i] != null) 853 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 854 "seamark:light:" + i + ":sector_end", Bearing2[i])); 855 } 856 } 857 } 858 859 protected void saveTopMarkData(String shape, String colour) { 860 if (dlg.cM01TopMark.isSelected()) { 861 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 862 "seamark:topmark:shape", shape)); 863 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 864 "seamark:topmark:colour", colour)); 865 } 866 } 867 868 protected void saveRadarFogData() { 869 if (hasRadar()) { 870 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 871 "seamark:radar_reflector", "yes")); 872 } 873 if (hasRacon()) { 874 switch (RaType) { 875 case RATYPE_RACON: 876 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 877 "seamark:radar_transponder:category", "racon")); 878 if (!getRaconGroup().isEmpty()) 879 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 880 "seamark:radar_transponder:group", getRaconGroup())); 881 break; 882 case RATYPE_RAMARK: 883 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 884 "seamark:radar_transponder:category", "ramark")); 885 break; 886 case RATYPE_LEADING: 887 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 888 "seamark:radar_transponder:category", "leading")); 889 break; 890 default: 891 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 892 "seamark:radar_transponder", "yes")); 893 } 894 } 895 if (hasFog()) { 896 if (getFogSound() == 0) { 897 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 898 "seamark:fog_signal", "yes")); 899 } else { 900 switch (getFogSound()) { 901 case FOG_HORN: 902 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 903 "seamark:fog_signal:category", "horn")); 904 break; 905 case FOG_SIREN: 906 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 907 "seamark:fog_signal:category", "siren")); 908 break; 909 case FOG_DIA: 910 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 911 "seamark:fog_signal:category", "diaphone")); 912 break; 913 case FOG_BELL: 914 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 915 "seamark:fog_signal:category", "bell")); 916 break; 917 case FOG_WHIS: 918 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 919 "seamark:fog_signal:category", "whistle")); 920 break; 921 case FOG_GONG: 922 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 923 "seamark:fog_signal:category", "gong")); 924 break; 925 case FOG_EXPLOS: 926 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 927 "seamark:fog_signal:category", "explosive")); 928 break; 929 } 930 if (!getFogGroup().isEmpty()) 931 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 932 "seamark:fog_signal:group", getFogGroup())); 933 if (!getFogPeriod().isEmpty()) 934 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 935 "seamark:fog_signal:period", getFogPeriod())); 936 } 937 } 938 } 939 940 public void refreshStyles() { 941 } 942 943 public void refreshLights() { 944 dlg.cbM01Kennung.removeAllItems(); 945 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 946 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$ 947 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 948 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 949 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$ 950 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$ 951 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 952 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 953 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$ 954 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 955 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$ 956 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$ 957 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$ 958 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 959 dlg.cbM01Kennung.setSelectedIndex(0); 960 } 961 962 public void resetMask() { 963 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 964 965 dlg.lM01Icon.setIcon(null); 966 dlg.lM02Icon.setIcon(null); 967 dlg.lM03Icon.setIcon(null); 968 dlg.lM04Icon.setIcon(null); 969 970 dlg.rbM01RegionA.setEnabled(false); 971 dlg.rbM01RegionB.setEnabled(false); 972 dlg.lM01FireMark.setText(""); 973 dlg.cbM01CatOfMark.removeAllItems(); 974 dlg.cbM01CatOfMark.setVisible(false); 975 dlg.lM01CatOfMark.setVisible(false); 976 setBuoyIndex(0); 977 dlg.cbM01StyleOfMark.removeAllItems(); 978 dlg.cbM01StyleOfMark.setVisible(false); 979 dlg.lM01StyleOfMark.setVisible(false); 980 setStyleIndex(0); 981 dlg.tfM01Name.setText(""); 982 dlg.tfM01Name.setEnabled(false); 983 setName(""); 984 dlg.cM01TopMark.setSelected(false); 985 dlg.cM01TopMark.setVisible(false); 986 dlg.cbM01TopMark.removeAllItems(); 987 dlg.cbM01TopMark.setVisible(false); 988 setTopMark(false); 989 dlg.cM01Radar.setSelected(false); 990 dlg.cM01Radar.setVisible(false); 991 setRadar(false); 992 dlg.cM01Racon.setSelected(false); 993 dlg.cM01Racon.setVisible(false); 994 dlg.cbM01Racon.setVisible(false); 995 dlg.tfM01Racon.setText(""); 996 dlg.tfM01Racon.setVisible(false); 997 dlg.lM01Racon.setVisible(false); 998 setRacon(false); 999 setRaType(0); 1000 dlg.cM01Fog.setSelected(false); 1001 dlg.cM01Fog.setVisible(false); 1002 dlg.cbM01Fog.setVisible(false); 1003 setFogSound(0); 1004 dlg.tfM01FogGroup.setText(""); 1005 dlg.tfM01FogGroup.setVisible(false); 1006 dlg.lM01FogGroup.setVisible(false); 1007 dlg.tfM01FogPeriod.setText(""); 1008 dlg.tfM01FogPeriod.setVisible(false); 1009 dlg.lM01FogPeriod.setVisible(false); 1010 setFog(false); 1011 dlg.cM01Fired.setSelected(false); 1012 dlg.cM01Fired.setVisible(false); 1013 setFired(false); 1014 dlg.rbM01Fired1.setVisible(false); 1015 dlg.rbM01Fired1.setSelected(true); 1016 dlg.rbM01FiredN.setVisible(false); 1017 dlg.rbM01FiredN.setSelected(false); 1018 setSectored(false); 1019 dlg.cbM01Kennung.removeAllItems(); 1020 dlg.cbM01Kennung.setVisible(false); 1021 dlg.lM01Kennung.setVisible(false); 1022 setLightChar(""); 1023 dlg.tfM01Height.setText(""); 1024 dlg.tfM01Height.setVisible(false); 1025 dlg.lM01Height.setVisible(false); 1026 setHeight(""); 1027 dlg.tfM01Range.setText(""); 1028 dlg.tfM01Range.setVisible(false); 1029 dlg.lM01Range.setVisible(false); 1030 setRange(""); 1031 dlg.cbM01Colour.setVisible(false); 1032 dlg.lM01Colour.setVisible(false); 1033 setLightColour(""); 1034 dlg.cbM01Sector.setVisible(false); 1035 dlg.lM01Sector.setVisible(false); 1036 setSectorIndex(0); 1037 dlg.tfM01Group.setText(""); 1038 dlg.tfM01Group.setVisible(false); 1039 dlg.lM01Group.setVisible(false); 1040 setLightGroup(""); 1041 dlg.tfM01RepeatTime.setText(""); 1042 dlg.tfM01RepeatTime.setVisible(false); 1043 dlg.lM01RepeatTime.setVisible(false); 1044 setLightPeriod(""); 1045 dlg.tfM01Bearing.setText(""); 1046 dlg.tfM01Bearing.setVisible(false); 1047 dlg.lM01Bearing.setVisible(false); 1048 setBearing1(""); 1049 dlg.tfM02Bearing.setText(""); 1050 dlg.tfM02Bearing.setVisible(false); 1051 setBearing2(""); 1052 dlg.tfM01Radius.setText(""); 1053 dlg.tfM01Radius.setVisible(false); 1054 setRadius(""); 1055 1056 dlg.bM01Save.setEnabled(false); 1057 } 1058 1058 1059 1059 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java ¶
r23179 r23193 18 18 public class BuoyCard extends Buoy { 19 19 20 public BuoyCard(SmpDialogAction dia, Node node) {21 super(dia);22 23 String str;24 Map<String, String> keys;25 keys = node.getKeys();26 setNode(node);27 28 resetMask();29 dlg.cbM01CatOfMark.removeAllItems();30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.158")); //$NON-NLS-1$32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.159")); //$NON-NLS-1$33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.160")); //$NON-NLS-1$34 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.161")); //$NON-NLS-1$35 36 dlg.cbM01CatOfMark.setEnabled(true);37 dlg.cbM01CatOfMark.setVisible(true);38 dlg.lM01CatOfMark.setVisible(true);39 40 dlg.cbM01StyleOfMark.removeAllItems();41 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$42 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$47 dlg.cbM01StyleOfMark.setVisible(true);48 dlg.lM01StyleOfMark.setVisible(true);49 50 dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL);51 52 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$53 if (keys.containsKey("name")) //$NON-NLS-1$54 setName(keys.get("name")); //$NON-NLS-1$55 56 if (keys.containsKey("seamark:name")) //$NON-NLS-1$57 setName(keys.get("seamark:name")); //$NON-NLS-1$58 59 if (keys.containsKey("seamark:buoy_cardinal:name")) //$NON-NLS-1$60 setName(keys.get("seamark:buoy_cardinal:name")); //$NON-NLS-1$61 else if (keys.containsKey("seamark:beacon_cardinal:name")) //$NON-NLS-1$62 setName(keys.get("seamark:beacon_cardinal:name")); //$NON-NLS-1$63 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$64 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$65 66 String cat = ""; //$NON-NLS-1$67 String col = ""; //$NON-NLS-1$68 69 if (keys.containsKey("seamark:buoy_cardinal:category")) //$NON-NLS-1$70 cat = keys.get("seamark:buoy_cardinal:category"); //$NON-NLS-1$71 else if (keys.containsKey("seamark:beacon_cardinal:category")) //$NON-NLS-1$72 cat = keys.get("seamark:beacon_cardinal:category"); //$NON-NLS-1$73 74 if (keys.containsKey("seamark:buoy_cardinal:colour")) //$NON-NLS-1$75 col = keys.get("seamark:buoy_cardinal:colour"); //$NON-NLS-1$76 else if (keys.containsKey("seamark:beacon_cardinal:colour")) //$NON-NLS-1$77 col = keys.get("seamark:beacon_cardinal:colour"); //$NON-NLS-1$78 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$79 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$80 81 if (cat.isEmpty()) { //$NON-NLS-1$82 if (col.equals("black;yellow")) { //$NON-NLS-1$83 setBuoyIndex(CARD_NORTH);84 setColour(BLACK_YELLOW);85 } else if (col.equals("black;yellow;black")) { //$NON-NLS-1$86 setBuoyIndex(CARD_EAST);87 setColour(BLACK_YELLOW_BLACK);88 } else if (col.equals("yellow;black")) { //$NON-NLS-1$89 setBuoyIndex(CARD_SOUTH);90 setColour(YELLOW_BLACK);91 } else if (col.equals("yellow;black;yellow")) { //$NON-NLS-1$92 setBuoyIndex(CARD_WEST);93 setColour(YELLOW_BLACK_YELLOW);94 }95 } else if (cat.equals("north")) { //$NON-NLS-1$96 setBuoyIndex(CARD_NORTH);97 setColour(BLACK_YELLOW);98 } else if (cat.equals("east")) { //$NON-NLS-1$99 setBuoyIndex(CARD_EAST);100 setColour(BLACK_YELLOW_BLACK);101 } else if (cat.equals("south")) { //$NON-NLS-1$102 setBuoyIndex(CARD_SOUTH);103 setColour(YELLOW_BLACK);104 } else if (cat.equals("west")) { //$NON-NLS-1$105 setBuoyIndex(CARD_WEST);106 setColour(YELLOW_BLACK_YELLOW);107 }108 109 if (keys.containsKey("seamark:buoy_cardinal:shape")) { //$NON-NLS-1$110 str = keys.get("seamark:buoy_cardinal:shape"); //$NON-NLS-1$111 112 if (str.equals("pillar")) //$NON-NLS-1$113 setStyleIndex(CARD_PILLAR);114 else if (str.equals("spar")) //$NON-NLS-1$115 setStyleIndex(CARD_SPAR);116 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$117 if (keys.containsKey("seamark:beacon_cardinal:shape")) { //$NON-NLS-1$118 str = keys.get("seamark:beacon_cardinal:shape"); //$NON-NLS-1$119 120 if (str.equals("tower")) //$NON-NLS-1$121 setStyleIndex(CARD_TOWER);122 else123 setStyleIndex(CARD_BEACON);124 } else125 setStyleIndex(CARD_BEACON);126 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$127 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$128 setStyleIndex(CARD_FLOAT);129 }130 131 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount())132 setStyleIndex(0);133 134 refreshLights();135 parseLights(keys);136 parseFogRadar(keys);137 138 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex());139 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());140 dlg.tfM01Name.setText(getName());141 dlg.cM01TopMark.setSelected(hasTopMark());142 }143 144 public void refreshLights() {145 int type = getBuoyIndex();146 147 dlg.cbM01Kennung.removeAllItems();148 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$149 dlg.cbM01Kennung.setSelectedIndex(0);150 151 switch (type) {152 case SeaMark.CARD_NORTH:153 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$154 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$155 break;156 157 case SeaMark.CARD_EAST:158 dlg.cbM01Kennung.addItem("Q(3)"); //$NON-NLS-1$159 dlg.cbM01Kennung.addItem("VQ(3)"); //$NON-NLS-1$160 break;161 162 case SeaMark.CARD_SOUTH:163 dlg.cbM01Kennung.addItem("Q(6)+LFl"); //$NON-NLS-1$164 dlg.cbM01Kennung.addItem("VQ(6)+LFl"); //$NON-NLS-1$165 break;166 167 case SeaMark.CARD_WEST:168 dlg.cbM01Kennung.addItem("Q(9)"); //$NON-NLS-1$169 dlg.cbM01Kennung.addItem("VQ(9)"); //$NON-NLS-1$170 break;171 172 default:173 }174 175 }176 177 public boolean isValid() {178 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);179 }180 181 public void paintSign() {182 if (dlg.paintlock)183 return;184 super.paintSign();185 186 dlg.sM01StatusBar.setText(getErrMsg());187 188 if (isValid()) {189 dlg.tfM01Name.setEnabled(true);190 dlg.tfM01Name.setText(getName());191 dlg.cM01TopMark.setSelected(true);192 dlg.cM01TopMark.setVisible(true);193 dlg.cM01TopMark.setEnabled(false);194 dlg.cM01Radar.setVisible(true);195 dlg.cM01Racon.setVisible(true);196 dlg.cM01Fog.setVisible(true);197 dlg.cM01Fired.setEnabled(true);198 dlg.cM01Fired.setVisible(true);199 dlg.cbM01Colour.setVisible(false);200 dlg.lM01Colour.setVisible(false);201 dlg.rbM01Fired1.setVisible(false);202 dlg.rbM01FiredN.setVisible(false);203 dlg.lM01Height.setVisible(false);204 dlg.tfM01Height.setVisible(false);205 dlg.lM01Range.setVisible(false);206 dlg.tfM01Range.setVisible(false);207 208 if (isFired()) {209 switch (getStyleIndex()) {210 case LAT_BEACON:211 case LAT_TOWER:212 dlg.rbM01Fired1.setVisible(true);213 dlg.rbM01FiredN.setVisible(true);214 dlg.lM01Height.setVisible(true);215 dlg.tfM01Height.setVisible(true);216 dlg.lM01Range.setVisible(true);217 dlg.tfM01Range.setVisible(true);218 break;219 case LAT_FLOAT:220 dlg.lM01Height.setVisible(true);221 dlg.tfM01Height.setVisible(true);222 dlg.lM01Range.setVisible(true);223 dlg.tfM01Range.setVisible(true);224 break;225 default:226 }227 }228 String image = "/images/Cardinal"; //$NON-NLS-1$229 230 switch (getStyleIndex()) {231 case SeaMark.CARD_PILLAR:232 image += "_Pillar"; //$NON-NLS-1$233 break;234 235 case SeaMark.CARD_SPAR:236 image += "_Spar"; //$NON-NLS-1$237 break;238 239 case SeaMark.CARD_BEACON:240 image += "_Beacon"; //$NON-NLS-1$241 break;242 243 case SeaMark.CARD_TOWER:244 image += "_Tower"; //$NON-NLS-1$245 break;246 247 case SeaMark.CARD_FLOAT:248 image += "_Float"; //$NON-NLS-1$249 break;250 251 default:252 return;253 }254 255 switch (getBuoyIndex()) {256 case CARD_NORTH:257 image += "_North"; //$NON-NLS-1$258 break;259 case CARD_EAST:260 image += "_East"; //$NON-NLS-1$261 break;262 case CARD_SOUTH:263 image += "_South"; //$NON-NLS-1$264 break;265 case CARD_WEST:266 image += "_West"; //$NON-NLS-1$267 break;268 default:269 return;270 }271 272 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$273 image += ".png"; //$NON-NLS-1$274 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));275 276 } else277 dlg.lM01Icon.setIcon(null);278 }279 }280 281 public void setLightColour() {282 super.setLightColour("W"); //$NON-NLS-1$283 }284 285 public void saveSign() {286 Node node = getNode();287 if (node == null) {288 return;289 }290 291 String shape = ""; //$NON-NLS-1$292 293 switch (getStyleIndex()) {294 case CARD_PILLAR:295 super.saveSign("buoy_cardinal"); //$NON-NLS-1$296 Main.main.undoRedo.add(new ChangePropertyCommand(node,297 "seamark:buoy_cardinal:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$298 break;299 case CARD_SPAR:300 super.saveSign("buoy_cardinal"); //$NON-NLS-1$301 Main.main.undoRedo.add(new ChangePropertyCommand(node,302 "seamark:buoy_cardinal:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$303 break;304 case CARD_BEACON:305 super.saveSign("beacon_cardinal"); //$NON-NLS-1$306 break;307 case CARD_TOWER:308 super.saveSign("beacon_cardinal"); //$NON-NLS-1$309 Main.main.undoRedo.add(new ChangePropertyCommand(node,310 "seamark:beacon_cardinal:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$311 break;312 case CARD_FLOAT:313 super.saveSign("light_float"); //$NON-NLS-1$314 break;315 default:316 }317 318 switch (getStyleIndex()) {319 case CARD_PILLAR:320 case CARD_SPAR:321 switch (getBuoyIndex()) {322 case SeaMark.CARD_NORTH:323 Main.main.undoRedo.add(new ChangePropertyCommand(node,324 "seamark:buoy_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$325 Main.main.undoRedo.add(new ChangePropertyCommand(node,326 "seamark:buoy_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$327 shape = "2 cones up"; //$NON-NLS-1$328 break;329 330 case SeaMark.CARD_EAST:331 Main.main.undoRedo.add(new ChangePropertyCommand(node,332 "seamark:buoy_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$333 Main.main.undoRedo.add(new ChangePropertyCommand(node,334 "seamark:buoy_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$335 shape = "2 cones base together"; //$NON-NLS-1$336 break;337 338 case SeaMark.CARD_SOUTH:339 Main.main.undoRedo.add(new ChangePropertyCommand(node,340 "seamark:buoy_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$341 Main.main.undoRedo.add(new ChangePropertyCommand(node,342 "seamark:buoy_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$343 shape = "2 cones down"; //$NON-NLS-1$344 break;345 346 case SeaMark.CARD_WEST:347 Main.main.undoRedo.add(new ChangePropertyCommand(node,348 "seamark:buoy_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$349 Main.main.undoRedo.add(new ChangePropertyCommand(node,350 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$351 shape = "2 cones point together"; //$NON-NLS-1$352 break;353 }354 Main.main.undoRedo.add(new ChangePropertyCommand(node,355 "seamark:buoy_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$356 break;357 case CARD_BEACON:358 case CARD_TOWER:359 switch (getBuoyIndex()) {360 case SeaMark.CARD_NORTH:361 Main.main.undoRedo.add(new ChangePropertyCommand(node,362 "seamark:beacon_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$363 Main.main.undoRedo.add(new ChangePropertyCommand(node,364 "seamark:beacon_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$365 shape = "2 cones up"; //$NON-NLS-1$366 break;367 368 case SeaMark.CARD_EAST:369 Main.main.undoRedo.add(new ChangePropertyCommand(node,370 "seamark:beacon_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$371 Main.main.undoRedo.add(new ChangePropertyCommand(node,372 "seamark:beacon_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$373 shape = "2 cones base together"; //$NON-NLS-1$374 break;375 376 case SeaMark.CARD_SOUTH:377 Main.main.undoRedo.add(new ChangePropertyCommand(node,378 "seamark:beacon_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$379 Main.main.undoRedo.add(new ChangePropertyCommand(node,380 "seamark:beacon_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$381 shape = "2 cones down"; //$NON-NLS-1$382 break;383 384 case SeaMark.CARD_WEST:385 Main.main.undoRedo.add(new ChangePropertyCommand(node,386 "seamark:beacon_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$387 Main.main.undoRedo.add(new ChangePropertyCommand(node,388 "seamark:beacon_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$389 shape = "2 cones point together"; //$NON-NLS-1$390 break;391 }392 Main.main.undoRedo.add(new ChangePropertyCommand(node,393 "seamark:beacon_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$394 break;395 case CARD_FLOAT:396 switch (getBuoyIndex()) {397 case SeaMark.CARD_NORTH:398 Main.main.undoRedo.add(new ChangePropertyCommand(node,399 "seamark:light_float:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$400 shape = "2 cones up"; //$NON-NLS-1$401 break;402 403 case SeaMark.CARD_EAST:404 Main.main.undoRedo.add(new ChangePropertyCommand(node,405 "seamark:light_float:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$406 shape = "2 cones base together"; //$NON-NLS-1$407 break;408 409 case SeaMark.CARD_SOUTH:410 Main.main.undoRedo.add(new ChangePropertyCommand(node,411 "seamark:light_float:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$412 shape = "2 cones down"; //$NON-NLS-1$413 break;414 415 case SeaMark.CARD_WEST:416 Main.main.undoRedo.add(new ChangePropertyCommand(node,417 "seamark:light_float:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$418 shape = "2 cones point together"; //$NON-NLS-1$419 break;420 }421 Main.main.undoRedo.add(new ChangePropertyCommand(node,422 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$423 break;424 }425 saveTopMarkData(shape, "black"); //$NON-NLS-1$426 saveLightData(); //$NON-NLS-1$427 saveRadarFogData();428 }20 public BuoyCard(SmpDialogAction dia, Node node) { 21 super(dia); 22 23 String str; 24 Map<String, String> keys; 25 keys = node.getKeys(); 26 setNode(node); 27 28 resetMask(); 29 dlg.cbM01CatOfMark.removeAllItems(); 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.158")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.159")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.160")); //$NON-NLS-1$ 34 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.161")); //$NON-NLS-1$ 35 36 dlg.cbM01CatOfMark.setEnabled(true); 37 dlg.cbM01CatOfMark.setVisible(true); 38 dlg.lM01CatOfMark.setVisible(true); 39 40 dlg.cbM01StyleOfMark.removeAllItems(); 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.setVisible(true); 48 dlg.lM01StyleOfMark.setVisible(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL); 51 52 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 53 if (keys.containsKey("name")) //$NON-NLS-1$ 54 setName(keys.get("name")); //$NON-NLS-1$ 55 56 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_cardinal:name")) //$NON-NLS-1$ 60 setName(keys.get("seamark:buoy_cardinal:name")); //$NON-NLS-1$ 61 else if (keys.containsKey("seamark:beacon_cardinal:name")) //$NON-NLS-1$ 62 setName(keys.get("seamark:beacon_cardinal:name")); //$NON-NLS-1$ 63 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 65 66 String cat = ""; //$NON-NLS-1$ 67 String col = ""; //$NON-NLS-1$ 68 69 if (keys.containsKey("seamark:buoy_cardinal:category")) //$NON-NLS-1$ 70 cat = keys.get("seamark:buoy_cardinal:category"); //$NON-NLS-1$ 71 else if (keys.containsKey("seamark:beacon_cardinal:category")) //$NON-NLS-1$ 72 cat = keys.get("seamark:beacon_cardinal:category"); //$NON-NLS-1$ 73 74 if (keys.containsKey("seamark:buoy_cardinal:colour")) //$NON-NLS-1$ 75 col = keys.get("seamark:buoy_cardinal:colour"); //$NON-NLS-1$ 76 else if (keys.containsKey("seamark:beacon_cardinal:colour")) //$NON-NLS-1$ 77 col = keys.get("seamark:beacon_cardinal:colour"); //$NON-NLS-1$ 78 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 79 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 80 81 if (cat.isEmpty()) { //$NON-NLS-1$ 82 if (col.equals("black;yellow")) { //$NON-NLS-1$ 83 setBuoyIndex(CARD_NORTH); 84 setColour(BLACK_YELLOW); 85 } else if (col.equals("black;yellow;black")) { //$NON-NLS-1$ 86 setBuoyIndex(CARD_EAST); 87 setColour(BLACK_YELLOW_BLACK); 88 } else if (col.equals("yellow;black")) { //$NON-NLS-1$ 89 setBuoyIndex(CARD_SOUTH); 90 setColour(YELLOW_BLACK); 91 } else if (col.equals("yellow;black;yellow")) { //$NON-NLS-1$ 92 setBuoyIndex(CARD_WEST); 93 setColour(YELLOW_BLACK_YELLOW); 94 } 95 } else if (cat.equals("north")) { //$NON-NLS-1$ 96 setBuoyIndex(CARD_NORTH); 97 setColour(BLACK_YELLOW); 98 } else if (cat.equals("east")) { //$NON-NLS-1$ 99 setBuoyIndex(CARD_EAST); 100 setColour(BLACK_YELLOW_BLACK); 101 } else if (cat.equals("south")) { //$NON-NLS-1$ 102 setBuoyIndex(CARD_SOUTH); 103 setColour(YELLOW_BLACK); 104 } else if (cat.equals("west")) { //$NON-NLS-1$ 105 setBuoyIndex(CARD_WEST); 106 setColour(YELLOW_BLACK_YELLOW); 107 } 108 109 if (keys.containsKey("seamark:buoy_cardinal:shape")) { //$NON-NLS-1$ 110 str = keys.get("seamark:buoy_cardinal:shape"); //$NON-NLS-1$ 111 112 if (str.equals("pillar")) //$NON-NLS-1$ 113 setStyleIndex(CARD_PILLAR); 114 else if (str.equals("spar")) //$NON-NLS-1$ 115 setStyleIndex(CARD_SPAR); 116 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 117 if (keys.containsKey("seamark:beacon_cardinal:shape")) { //$NON-NLS-1$ 118 str = keys.get("seamark:beacon_cardinal:shape"); //$NON-NLS-1$ 119 120 if (str.equals("tower")) //$NON-NLS-1$ 121 setStyleIndex(CARD_TOWER); 122 else 123 setStyleIndex(CARD_BEACON); 124 } else 125 setStyleIndex(CARD_BEACON); 126 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 127 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 128 setStyleIndex(CARD_FLOAT); 129 } 130 131 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 132 setStyleIndex(0); 133 134 refreshLights(); 135 parseLights(keys); 136 parseFogRadar(keys); 137 138 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 139 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 140 dlg.tfM01Name.setText(getName()); 141 dlg.cM01TopMark.setSelected(hasTopMark()); 142 } 143 144 public void refreshLights() { 145 int type = getBuoyIndex(); 146 147 dlg.cbM01Kennung.removeAllItems(); 148 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 149 dlg.cbM01Kennung.setSelectedIndex(0); 150 151 switch (type) { 152 case SeaMark.CARD_NORTH: 153 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 154 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 155 break; 156 157 case SeaMark.CARD_EAST: 158 dlg.cbM01Kennung.addItem("Q(3)"); //$NON-NLS-1$ 159 dlg.cbM01Kennung.addItem("VQ(3)"); //$NON-NLS-1$ 160 break; 161 162 case SeaMark.CARD_SOUTH: 163 dlg.cbM01Kennung.addItem("Q(6)+LFl"); //$NON-NLS-1$ 164 dlg.cbM01Kennung.addItem("VQ(6)+LFl"); //$NON-NLS-1$ 165 break; 166 167 case SeaMark.CARD_WEST: 168 dlg.cbM01Kennung.addItem("Q(9)"); //$NON-NLS-1$ 169 dlg.cbM01Kennung.addItem("VQ(9)"); //$NON-NLS-1$ 170 break; 171 172 default: 173 } 174 175 } 176 177 public boolean isValid() { 178 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 179 } 180 181 public void paintSign() { 182 if (dlg.paintlock) 183 return; 184 super.paintSign(); 185 186 dlg.sM01StatusBar.setText(getErrMsg()); 187 188 if (isValid()) { 189 dlg.tfM01Name.setEnabled(true); 190 dlg.tfM01Name.setText(getName()); 191 dlg.cM01TopMark.setSelected(true); 192 dlg.cM01TopMark.setVisible(true); 193 dlg.cM01TopMark.setEnabled(false); 194 dlg.cM01Radar.setVisible(true); 195 dlg.cM01Racon.setVisible(true); 196 dlg.cM01Fog.setVisible(true); 197 dlg.cM01Fired.setEnabled(true); 198 dlg.cM01Fired.setVisible(true); 199 dlg.cbM01Colour.setVisible(false); 200 dlg.lM01Colour.setVisible(false); 201 dlg.rbM01Fired1.setVisible(false); 202 dlg.rbM01FiredN.setVisible(false); 203 dlg.lM01Height.setVisible(false); 204 dlg.tfM01Height.setVisible(false); 205 dlg.lM01Range.setVisible(false); 206 dlg.tfM01Range.setVisible(false); 207 208 if (isFired()) { 209 switch (getStyleIndex()) { 210 case LAT_BEACON: 211 case LAT_TOWER: 212 dlg.rbM01Fired1.setVisible(true); 213 dlg.rbM01FiredN.setVisible(true); 214 dlg.lM01Height.setVisible(true); 215 dlg.tfM01Height.setVisible(true); 216 dlg.lM01Range.setVisible(true); 217 dlg.tfM01Range.setVisible(true); 218 break; 219 case LAT_FLOAT: 220 dlg.lM01Height.setVisible(true); 221 dlg.tfM01Height.setVisible(true); 222 dlg.lM01Range.setVisible(true); 223 dlg.tfM01Range.setVisible(true); 224 break; 225 default: 226 } 227 } 228 String image = "/images/Cardinal"; //$NON-NLS-1$ 229 230 switch (getStyleIndex()) { 231 case SeaMark.CARD_PILLAR: 232 image += "_Pillar"; //$NON-NLS-1$ 233 break; 234 235 case SeaMark.CARD_SPAR: 236 image += "_Spar"; //$NON-NLS-1$ 237 break; 238 239 case SeaMark.CARD_BEACON: 240 image += "_Beacon"; //$NON-NLS-1$ 241 break; 242 243 case SeaMark.CARD_TOWER: 244 image += "_Tower"; //$NON-NLS-1$ 245 break; 246 247 case SeaMark.CARD_FLOAT: 248 image += "_Float"; //$NON-NLS-1$ 249 break; 250 251 default: 252 return; 253 } 254 255 switch (getBuoyIndex()) { 256 case CARD_NORTH: 257 image += "_North"; //$NON-NLS-1$ 258 break; 259 case CARD_EAST: 260 image += "_East"; //$NON-NLS-1$ 261 break; 262 case CARD_SOUTH: 263 image += "_South"; //$NON-NLS-1$ 264 break; 265 case CARD_WEST: 266 image += "_West"; //$NON-NLS-1$ 267 break; 268 default: 269 return; 270 } 271 272 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 273 image += ".png"; //$NON-NLS-1$ 274 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 275 276 } else 277 dlg.lM01Icon.setIcon(null); 278 } 279 } 280 281 public void setLightColour() { 282 super.setLightColour("W"); //$NON-NLS-1$ 283 } 284 285 public void saveSign() { 286 Node node = getNode(); 287 if (node == null) { 288 return; 289 } 290 291 String shape = ""; //$NON-NLS-1$ 292 293 switch (getStyleIndex()) { 294 case CARD_PILLAR: 295 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 296 Main.main.undoRedo.add(new ChangePropertyCommand(node, 297 "seamark:buoy_cardinal:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 298 break; 299 case CARD_SPAR: 300 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 301 Main.main.undoRedo.add(new ChangePropertyCommand(node, 302 "seamark:buoy_cardinal:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 303 break; 304 case CARD_BEACON: 305 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 306 break; 307 case CARD_TOWER: 308 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 309 Main.main.undoRedo.add(new ChangePropertyCommand(node, 310 "seamark:beacon_cardinal:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 311 break; 312 case CARD_FLOAT: 313 super.saveSign("light_float"); //$NON-NLS-1$ 314 break; 315 default: 316 } 317 318 switch (getStyleIndex()) { 319 case CARD_PILLAR: 320 case CARD_SPAR: 321 switch (getBuoyIndex()) { 322 case SeaMark.CARD_NORTH: 323 Main.main.undoRedo.add(new ChangePropertyCommand(node, 324 "seamark:buoy_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 325 Main.main.undoRedo.add(new ChangePropertyCommand(node, 326 "seamark:buoy_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 327 shape = "2 cones up"; //$NON-NLS-1$ 328 break; 329 330 case SeaMark.CARD_EAST: 331 Main.main.undoRedo.add(new ChangePropertyCommand(node, 332 "seamark:buoy_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 333 Main.main.undoRedo.add(new ChangePropertyCommand(node, 334 "seamark:buoy_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 335 shape = "2 cones base together"; //$NON-NLS-1$ 336 break; 337 338 case SeaMark.CARD_SOUTH: 339 Main.main.undoRedo.add(new ChangePropertyCommand(node, 340 "seamark:buoy_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 341 Main.main.undoRedo.add(new ChangePropertyCommand(node, 342 "seamark:buoy_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 343 shape = "2 cones down"; //$NON-NLS-1$ 344 break; 345 346 case SeaMark.CARD_WEST: 347 Main.main.undoRedo.add(new ChangePropertyCommand(node, 348 "seamark:buoy_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 349 Main.main.undoRedo.add(new ChangePropertyCommand(node, 350 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 351 shape = "2 cones point together"; //$NON-NLS-1$ 352 break; 353 } 354 Main.main.undoRedo.add(new ChangePropertyCommand(node, 355 "seamark:buoy_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 356 break; 357 case CARD_BEACON: 358 case CARD_TOWER: 359 switch (getBuoyIndex()) { 360 case SeaMark.CARD_NORTH: 361 Main.main.undoRedo.add(new ChangePropertyCommand(node, 362 "seamark:beacon_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 363 Main.main.undoRedo.add(new ChangePropertyCommand(node, 364 "seamark:beacon_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 365 shape = "2 cones up"; //$NON-NLS-1$ 366 break; 367 368 case SeaMark.CARD_EAST: 369 Main.main.undoRedo.add(new ChangePropertyCommand(node, 370 "seamark:beacon_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 371 Main.main.undoRedo.add(new ChangePropertyCommand(node, 372 "seamark:beacon_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 373 shape = "2 cones base together"; //$NON-NLS-1$ 374 break; 375 376 case SeaMark.CARD_SOUTH: 377 Main.main.undoRedo.add(new ChangePropertyCommand(node, 378 "seamark:beacon_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 379 Main.main.undoRedo.add(new ChangePropertyCommand(node, 380 "seamark:beacon_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 381 shape = "2 cones down"; //$NON-NLS-1$ 382 break; 383 384 case SeaMark.CARD_WEST: 385 Main.main.undoRedo.add(new ChangePropertyCommand(node, 386 "seamark:beacon_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 387 Main.main.undoRedo.add(new ChangePropertyCommand(node, 388 "seamark:beacon_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 389 shape = "2 cones point together"; //$NON-NLS-1$ 390 break; 391 } 392 Main.main.undoRedo.add(new ChangePropertyCommand(node, 393 "seamark:beacon_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 394 break; 395 case CARD_FLOAT: 396 switch (getBuoyIndex()) { 397 case SeaMark.CARD_NORTH: 398 Main.main.undoRedo.add(new ChangePropertyCommand(node, 399 "seamark:light_float:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 400 shape = "2 cones up"; //$NON-NLS-1$ 401 break; 402 403 case SeaMark.CARD_EAST: 404 Main.main.undoRedo.add(new ChangePropertyCommand(node, 405 "seamark:light_float:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 406 shape = "2 cones base together"; //$NON-NLS-1$ 407 break; 408 409 case SeaMark.CARD_SOUTH: 410 Main.main.undoRedo.add(new ChangePropertyCommand(node, 411 "seamark:light_float:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 412 shape = "2 cones down"; //$NON-NLS-1$ 413 break; 414 415 case SeaMark.CARD_WEST: 416 Main.main.undoRedo.add(new ChangePropertyCommand(node, 417 "seamark:light_float:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 418 shape = "2 cones point together"; //$NON-NLS-1$ 419 break; 420 } 421 Main.main.undoRedo.add(new ChangePropertyCommand(node, 422 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 423 break; 424 } 425 saveTopMarkData(shape, "black"); //$NON-NLS-1$ 426 saveLightData(); //$NON-NLS-1$ 427 saveRadarFogData(); 428 } 429 429 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java ¶
r23179 r23193 17 17 18 18 public class BuoyIsol extends Buoy { 19 public BuoyIsol(SmpDialogAction dia, Node node) {20 super(dia);21 22 String str;23 Map<String, String> keys;24 keys = node.getKeys();25 setNode(node);26 27 resetMask();28 29 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER);30 31 dlg.cbM01StyleOfMark.removeAllItems();32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$38 dlg.cbM01StyleOfMark.setVisible(true);39 dlg.lM01StyleOfMark.setVisible(true);40 41 setBuoyIndex(ISOLATED_DANGER);42 setColour(SeaMark.BLACK_RED_BLACK);43 setLightColour("W"); //$NON-NLS-1$44 setTopMark(true);45 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$46 47 if (keys.containsKey("name")) //$NON-NLS-1$48 setName(keys.get("name")); //$NON-NLS-1$49 50 if (keys.containsKey("seamark:name")) //$NON-NLS-1$51 setName(keys.get("seamark:name")); //$NON-NLS-1$52 53 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$54 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$55 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$56 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$57 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$58 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$59 60 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$61 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$62 63 if (str.equals("pillar")) //$NON-NLS-1$64 setStyleIndex(ISOL_PILLAR);65 else if (str.equals("spar")) //$NON-NLS-1$66 setStyleIndex(ISOL_SPAR);67 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$68 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$69 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$70 71 if (str.equals("tower")) //$NON-NLS-1$72 setStyleIndex(ISOL_TOWER);73 else74 setStyleIndex(ISOL_BEACON);75 } else76 setStyleIndex(ISOL_BEACON);77 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$78 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$79 setStyleIndex(CARD_FLOAT);80 }81 82 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount())83 setStyleIndex(0);84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());85 86 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$87 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$88 setTopMark(true);89 }90 91 refreshLights();92 parseLights(keys);93 parseFogRadar(keys);94 95 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());96 dlg.tfM01Name.setText(getName());97 dlg.cM01TopMark.setSelected(hasTopMark());98 }99 100 public void refreshLights() {101 dlg.cbM01Kennung.removeAllItems();102 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$103 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$104 dlg.cbM01Kennung.setSelectedIndex(0);105 }106 107 public boolean isValid() {108 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);109 }110 111 public void paintSign() {112 if (dlg.paintlock)113 return;114 115 super.paintSign();116 117 dlg.sM01StatusBar.setText(getErrMsg());118 119 if (isValid()) {120 dlg.tfM01Name.setEnabled(true);121 dlg.tfM01Name.setText(getName());122 dlg.cM01TopMark.setVisible(true);123 dlg.cM01Radar.setVisible(true);124 dlg.cM01Racon.setVisible(true);125 dlg.cM01Fog.setVisible(true);126 dlg.cM01Fired.setVisible(true);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()) {137 switch (getStyleIndex()) {138 case SPEC_FLOAT:139 dlg.lM01Height.setVisible(true);140 dlg.tfM01Height.setVisible(true);141 dlg.lM01Range.setVisible(true);142 dlg.tfM01Range.setVisible(true);143 break;144 case SPEC_BEACON:145 case SPEC_TOWER:146 dlg.rbM01Fired1.setVisible(true);147 dlg.rbM01FiredN.setVisible(true);148 dlg.lM01Height.setVisible(true);149 dlg.tfM01Height.setVisible(true);150 dlg.lM01Range.setVisible(true);151 dlg.tfM01Range.setVisible(true);152 break;153 default:154 }155 }156 157 String image = "/images/Cardinal"; //$NON-NLS-1$158 159 switch (getStyleIndex()) {160 case ISOL_PILLAR:161 image += "_Pillar_Single"; //$NON-NLS-1$162 break;163 case ISOL_SPAR:164 image += "_Spar_Single"; //$NON-NLS-1$165 break;166 case ISOL_BEACON:167 image += "_Beacon_Single"; //$NON-NLS-1$168 break;169 case ISOL_TOWER:170 image += "_Tower_Single"; //$NON-NLS-1$171 break;172 case ISOL_FLOAT:173 image += "_Float_Single"; //$NON-NLS-1$174 break;175 default:176 }177 178 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$179 image += ".png"; //$NON-NLS-1$180 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));181 } else182 dlg.lM01Icon.setIcon(null);183 } else {184 dlg.tfM01Name.setEnabled(false);185 dlg.tfM01Name.setText(""); //$NON-NLS-1$186 dlg.cM01TopMark.setVisible(false);187 dlg.cM01Radar.setVisible(false);188 dlg.cM01Racon.setVisible(false);189 dlg.cM01Fog.setVisible(false);190 dlg.cM01Fired.setVisible(false);191 }192 }193 194 public void saveSign() {195 Node node = getNode();196 197 if (node == null) {198 return;199 }200 201 switch (getStyleIndex()) {202 case ISOL_PILLAR:203 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$204 Main.main.undoRedo.add(new ChangePropertyCommand(node,205 "seamark:buoy_isolated_danger:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$206 break;207 case ISOL_SPAR:208 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$209 Main.main.undoRedo.add(new ChangePropertyCommand(node,210 "seamark:buoy_isolated_danger:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$211 break;212 case ISOL_BEACON:213 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$214 break;215 case ISOL_TOWER:216 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$217 Main.main.undoRedo.add(new ChangePropertyCommand(node,218 "seamark:beacon_isolated_danger:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$219 break;220 case ISOL_FLOAT:221 super.saveSign("light_float"); //$NON-NLS-1$222 break;223 default:224 }225 226 switch (getStyleIndex()) {227 case ISOL_PILLAR:228 case ISOL_SPAR:229 Main.main.undoRedo.add(new ChangePropertyCommand(node,230 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$231 Main.main.undoRedo.add(new ChangePropertyCommand(node,232 "seamark:buoy_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$233 break;234 case ISOL_BEACON:235 case ISOL_TOWER:236 Main.main.undoRedo237 .add(new ChangePropertyCommand(node,238 "seamark:beacon_isolated_danger:colour_pattern", //$NON-NLS-1$239 "horizontal stripes")); //$NON-NLS-1$240 Main.main.undoRedo.add(new ChangePropertyCommand(node,241 "seamark:beacon_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$242 break;243 case ISOL_FLOAT:244 Main.main.undoRedo.add(new ChangePropertyCommand(node,245 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$246 Main.main.undoRedo.add(new ChangePropertyCommand(node,247 "seamark:light_float:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$248 break;249 }250 251 saveTopMarkData("2 spheres", "black"); //$NON-NLS-1$ //$NON-NLS-2$252 saveLightData(); //$NON-NLS-1$253 saveRadarFogData();254 255 }256 257 public void setLightColour() {258 super.setLightColour("W"); //$NON-NLS-1$259 }19 public BuoyIsol(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(ISOLATED_DANGER); 42 setColour(SeaMark.BLACK_RED_BLACK); 43 setLightColour("W"); //$NON-NLS-1$ 44 setTopMark(true); 45 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 46 47 if (keys.containsKey("name")) //$NON-NLS-1$ 48 setName(keys.get("name")); //$NON-NLS-1$ 49 50 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 51 setName(keys.get("seamark:name")); //$NON-NLS-1$ 52 53 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$ 57 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 58 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$ 61 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$ 62 63 if (str.equals("pillar")) //$NON-NLS-1$ 64 setStyleIndex(ISOL_PILLAR); 65 else if (str.equals("spar")) //$NON-NLS-1$ 66 setStyleIndex(ISOL_SPAR); 67 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 68 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$ 69 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$ 70 71 if (str.equals("tower")) //$NON-NLS-1$ 72 setStyleIndex(ISOL_TOWER); 73 else 74 setStyleIndex(ISOL_BEACON); 75 } else 76 setStyleIndex(ISOL_BEACON); 77 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 78 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 79 setStyleIndex(CARD_FLOAT); 80 } 81 82 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 83 setStyleIndex(0); 84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 85 86 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 87 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 88 setTopMark(true); 89 } 90 91 refreshLights(); 92 parseLights(keys); 93 parseFogRadar(keys); 94 95 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 96 dlg.tfM01Name.setText(getName()); 97 dlg.cM01TopMark.setSelected(hasTopMark()); 98 } 99 100 public void refreshLights() { 101 dlg.cbM01Kennung.removeAllItems(); 102 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 103 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$ 104 dlg.cbM01Kennung.setSelectedIndex(0); 105 } 106 107 public boolean isValid() { 108 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 109 } 110 111 public void paintSign() { 112 if (dlg.paintlock) 113 return; 114 115 super.paintSign(); 116 117 dlg.sM01StatusBar.setText(getErrMsg()); 118 119 if (isValid()) { 120 dlg.tfM01Name.setEnabled(true); 121 dlg.tfM01Name.setText(getName()); 122 dlg.cM01TopMark.setVisible(true); 123 dlg.cM01Radar.setVisible(true); 124 dlg.cM01Racon.setVisible(true); 125 dlg.cM01Fog.setVisible(true); 126 dlg.cM01Fired.setVisible(true); 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()) { 137 switch (getStyleIndex()) { 138 case SPEC_FLOAT: 139 dlg.lM01Height.setVisible(true); 140 dlg.tfM01Height.setVisible(true); 141 dlg.lM01Range.setVisible(true); 142 dlg.tfM01Range.setVisible(true); 143 break; 144 case SPEC_BEACON: 145 case SPEC_TOWER: 146 dlg.rbM01Fired1.setVisible(true); 147 dlg.rbM01FiredN.setVisible(true); 148 dlg.lM01Height.setVisible(true); 149 dlg.tfM01Height.setVisible(true); 150 dlg.lM01Range.setVisible(true); 151 dlg.tfM01Range.setVisible(true); 152 break; 153 default: 154 } 155 } 156 157 String image = "/images/Cardinal"; //$NON-NLS-1$ 158 159 switch (getStyleIndex()) { 160 case ISOL_PILLAR: 161 image += "_Pillar_Single"; //$NON-NLS-1$ 162 break; 163 case ISOL_SPAR: 164 image += "_Spar_Single"; //$NON-NLS-1$ 165 break; 166 case ISOL_BEACON: 167 image += "_Beacon_Single"; //$NON-NLS-1$ 168 break; 169 case ISOL_TOWER: 170 image += "_Tower_Single"; //$NON-NLS-1$ 171 break; 172 case ISOL_FLOAT: 173 image += "_Float_Single"; //$NON-NLS-1$ 174 break; 175 default: 176 } 177 178 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 179 image += ".png"; //$NON-NLS-1$ 180 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 181 } else 182 dlg.lM01Icon.setIcon(null); 183 } else { 184 dlg.tfM01Name.setEnabled(false); 185 dlg.tfM01Name.setText(""); //$NON-NLS-1$ 186 dlg.cM01TopMark.setVisible(false); 187 dlg.cM01Radar.setVisible(false); 188 dlg.cM01Racon.setVisible(false); 189 dlg.cM01Fog.setVisible(false); 190 dlg.cM01Fired.setVisible(false); 191 } 192 } 193 194 public void saveSign() { 195 Node node = getNode(); 196 197 if (node == null) { 198 return; 199 } 200 201 switch (getStyleIndex()) { 202 case ISOL_PILLAR: 203 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 204 Main.main.undoRedo.add(new ChangePropertyCommand(node, 205 "seamark:buoy_isolated_danger:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 206 break; 207 case ISOL_SPAR: 208 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 209 Main.main.undoRedo.add(new ChangePropertyCommand(node, 210 "seamark:buoy_isolated_danger:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 211 break; 212 case ISOL_BEACON: 213 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 214 break; 215 case ISOL_TOWER: 216 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 217 Main.main.undoRedo.add(new ChangePropertyCommand(node, 218 "seamark:beacon_isolated_danger:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 219 break; 220 case ISOL_FLOAT: 221 super.saveSign("light_float"); //$NON-NLS-1$ 222 break; 223 default: 224 } 225 226 switch (getStyleIndex()) { 227 case ISOL_PILLAR: 228 case ISOL_SPAR: 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 231 Main.main.undoRedo.add(new ChangePropertyCommand(node, 232 "seamark:buoy_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 233 break; 234 case ISOL_BEACON: 235 case ISOL_TOWER: 236 Main.main.undoRedo 237 .add(new ChangePropertyCommand(node, 238 "seamark:beacon_isolated_danger:colour_pattern", //$NON-NLS-1$ 239 "horizontal stripes")); //$NON-NLS-1$ 240 Main.main.undoRedo.add(new ChangePropertyCommand(node, 241 "seamark:beacon_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 242 break; 243 case ISOL_FLOAT: 244 Main.main.undoRedo.add(new ChangePropertyCommand(node, 245 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 246 Main.main.undoRedo.add(new ChangePropertyCommand(node, 247 "seamark:light_float:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 248 break; 249 } 250 251 saveTopMarkData("2 spheres", "black"); //$NON-NLS-1$ //$NON-NLS-2$ 252 saveLightData(); //$NON-NLS-1$ 253 saveRadarFogData(); 254 255 } 256 257 public void setLightColour() { 258 super.setLightColour("W"); //$NON-NLS-1$ 259 } 260 260 261 261 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java ¶
r23179 r23193 16 16 17 17 public class BuoyLat extends Buoy { 18 public BuoyLat(SmpDialogAction dia, Node node) {19 super(dia);20 21 String str;22 Map<String, String> keys;23 keys = node.getKeys();24 setNode(node);25 26 resetMask();27 28 dlg.cbM01CatOfMark.removeAllItems();29 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$34 35 dlg.rbM01RegionA.setEnabled(true);36 dlg.rbM01RegionB.setEnabled(true);37 dlg.cbM01CatOfMark.setEnabled(true);38 dlg.cbM01CatOfMark.setVisible(true);39 dlg.lM01CatOfMark.setVisible(true);40 41 dlg.cbM01StyleOfMark.removeAllItems();42 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$47 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$48 dlg.cbM01StyleOfMark.setEnabled(true);49 50 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL);51 52 if (keys.containsKey("name")) //$NON-NLS-1$53 setName(keys.get("name")); //$NON-NLS-1$54 55 if (keys.containsKey("seamark:name")) //$NON-NLS-1$56 setName(keys.get("seamark:name")); //$NON-NLS-1$57 58 if (keys.containsKey("seamark:buoy_lateral:name")) //$NON-NLS-1$59 setName(keys.get("seamark:buoy_lateral:name")); //$NON-NLS-1$60 else if (keys.containsKey("seamark:beacon_lateral:name")) //$NON-NLS-1$61 setName(keys.get("seamark:beacon_lateral:name")); //$NON-NLS-1$62 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$63 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$64 65 String cat = ""; //$NON-NLS-1$66 String col = ""; //$NON-NLS-1$67 String top = ""; //$NON-NLS-1$68 69 if (getStyleIndex() != LAT_PERCH) {70 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$71 top = keys.get("seamark:topmark:shape"); //$NON-NLS-1$72 setTopMark(true);73 }74 if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$75 setTopMark(true);76 }77 }78 79 if (keys.containsKey("seamark:buoy_lateral:colour")) //$NON-NLS-1$80 col = keys.get("seamark:buoy_lateral:colour"); //$NON-NLS-1$81 else if (keys.containsKey("seamark:beacon_lateral:colour")) //$NON-NLS-1$82 col = keys.get("seamark:beacon_lateral:colour"); //$NON-NLS-1$83 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$84 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$85 86 if (keys.containsKey("seamark:buoy_lateral:category")) //$NON-NLS-1$87 cat = keys.get("seamark:buoy_lateral:category"); //$NON-NLS-1$88 else if (keys.containsKey("seamark:beacon_lateral:category")) //$NON-NLS-1$89 cat = keys.get("seamark:beacon_lateral:category"); //$NON-NLS-1$90 91 if (cat.isEmpty()) { //$NON-NLS-1$92 if (col.equals("red")) { //$NON-NLS-1$93 setColour(RED);94 if (top.equals("cylinder")) { //$NON-NLS-1$95 setBuoyIndex(PORT_HAND);96 setRegion(IALA_A);97 } else if (top.equals("cone, point up")) { //$NON-NLS-1$98 setBuoyIndex(STARBOARD_HAND);99 setRegion(IALA_B);100 } else {101 if (getRegion() == IALA_A)102 setBuoyIndex(PORT_HAND);103 else104 setBuoyIndex(STARBOARD_HAND);105 }106 } else if (col.equals("green")) { //$NON-NLS-1$107 setColour(GREEN);108 if (top.equals("cone, point up")) { //$NON-NLS-1$109 setBuoyIndex(STARBOARD_HAND);110 setRegion(IALA_A);111 } else if (top.equals("cylinder")) { //$NON-NLS-1$112 setBuoyIndex(PORT_HAND);113 setRegion(IALA_B);114 } else {115 if (getRegion() == IALA_A)116 setBuoyIndex(STARBOARD_HAND);117 else118 setBuoyIndex(PORT_HAND);119 }120 } else if (col.equals("red;green;red")) { //$NON-NLS-1$121 setColour(RED_GREEN_RED);122 if (top.equals("cylinder")) { //$NON-NLS-1$123 setBuoyIndex(PREF_PORT_HAND);124 setRegion(IALA_A);125 } else if (top.equals("cone, point up")) { //$NON-NLS-1$126 setBuoyIndex(PREF_STARBOARD_HAND);127 setRegion(IALA_B);128 } else {129 if (getRegion() == IALA_A)130 setBuoyIndex(PREF_PORT_HAND);131 else132 setBuoyIndex(PREF_STARBOARD_HAND);133 }134 } else if (col.equals("green;red;green")) { //$NON-NLS-1$135 setColour(GREEN_RED_GREEN);136 if (top.equals("cone, point up")) { //$NON-NLS-1$137 setBuoyIndex(PREF_STARBOARD_HAND);138 setRegion(IALA_A);139 } else if (top.equals("cylinder")) { //$NON-NLS-1$140 setBuoyIndex(PREF_PORT_HAND);141 setRegion(IALA_B);142 } else {143 if (getRegion() == IALA_A)144 setBuoyIndex(PREF_STARBOARD_HAND);145 else146 setBuoyIndex(PREF_PORT_HAND);147 }148 }149 } else if (cat.equals("port")) { //$NON-NLS-1$150 151 setBuoyIndex(PORT_HAND);152 153 if (col.equals("red")) { //$NON-NLS-1$154 setRegion(IALA_A);155 setColour(RED);156 } else if (col.equals("green")) { //$NON-NLS-1$157 setRegion(IALA_B);158 setColour(GREEN);159 } else {160 if (getRegion() == IALA_A)161 setColour(RED);162 else163 setColour(GREEN);164 }165 } else if (cat.equals("starboard")) { //$NON-NLS-1$166 167 setBuoyIndex(STARBOARD_HAND);168 169 if (col.equals("green")) { //$NON-NLS-1$170 setRegion(IALA_A);171 setColour(GREEN);172 } else if (col.equals("red")) { //$NON-NLS-1$173 setRegion(IALA_B);174 setColour(RED);175 } else {176 if (getRegion() == IALA_A)177 setColour(GREEN);178 else179 setColour(RED);180 }181 } else if (cat.equals("preferred_channel_port")) { //$NON-NLS-1$182 183 setBuoyIndex(PREF_PORT_HAND);184 185 if (col.equals("red;green;red")) { //$NON-NLS-1$186 setRegion(IALA_A);187 setColour(RED_GREEN_RED);188 } else if (col.equals("green;red;green")) { //$NON-NLS-1$189 setRegion(IALA_B);190 setColour(GREEN_RED_GREEN);191 } else {192 if (getRegion() == IALA_A)193 setColour(RED_GREEN_RED);194 else195 setColour(GREEN_RED_GREEN);196 }197 198 } else if (cat.equals("preferred_channel_starboard")) { //$NON-NLS-1$199 200 setBuoyIndex(PREF_STARBOARD_HAND);201 202 if (col.equals("green;red;green")) { //$NON-NLS-1$203 setRegion(IALA_A);204 setColour(GREEN_RED_GREEN);205 } else if (col.equals("red;green;red")) { //$NON-NLS-1$206 setRegion(IALA_B);207 setColour(RED_GREEN_RED);208 } else {209 if (getRegion() == IALA_A)210 setColour(GREEN_RED_GREEN);211 else212 setColour(RED_GREEN_RED);213 }214 }215 216 if (keys.containsKey("seamark:buoy_lateral:shape")) { //$NON-NLS-1$217 str = keys.get("seamark:buoy_lateral:shape"); //$NON-NLS-1$218 219 switch (getBuoyIndex()) {220 case PORT_HAND:221 if (str.equals("can")) //$NON-NLS-1$222 setStyleIndex(LAT_CAN);223 else if (str.equals("pillar")) //$NON-NLS-1$224 setStyleIndex(LAT_PILLAR);225 else if (str.equals("spar")) //$NON-NLS-1$226 setStyleIndex(LAT_SPAR);227 break;228 229 case PREF_PORT_HAND:230 if (str.equals("can")) //$NON-NLS-1$231 setStyleIndex(LAT_CAN);232 else if (str.equals("pillar")) //$NON-NLS-1$233 setStyleIndex(LAT_PILLAR);234 else if (str.equals("spar")) //$NON-NLS-1$235 setStyleIndex(LAT_SPAR);236 break;237 238 case STARBOARD_HAND:239 if (str.equals("conical")) //$NON-NLS-1$240 setStyleIndex(LAT_CONE);241 else if (str.equals("pillar")) //$NON-NLS-1$242 setStyleIndex(LAT_PILLAR);243 else if (str.equals("spar")) //$NON-NLS-1$244 setStyleIndex(LAT_SPAR);245 break;246 247 case PREF_STARBOARD_HAND:248 if (str.equals("conical")) //$NON-NLS-1$249 setStyleIndex(LAT_CONE);250 else if (str.equals("pillar")) //$NON-NLS-1$251 setStyleIndex(LAT_PILLAR);252 else if (str.equals("spar")) //$NON-NLS-1$253 setStyleIndex(LAT_SPAR);254 break;255 }256 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { //$NON-NLS-1$257 str = keys.get("seamark:beacon_lateral:shape"); //$NON-NLS-1$258 if (str.equals("tower")) //$NON-NLS-1$259 setStyleIndex(LAT_TOWER);260 else if (str.equals("perch")) //$NON-NLS-1$261 setStyleIndex(LAT_PERCH);262 else263 setStyleIndex(LAT_BEACON);264 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$265 && (keys.get("seamark:type").equals("beacon_lateral"))) { //$NON-NLS-1$ //$NON-NLS-2$266 setStyleIndex(LAT_BEACON);267 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$268 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$269 setStyleIndex(LAT_FLOAT);270 }271 272 refreshStyles();273 refreshLights();274 setLightColour();275 parseLights(keys);276 parseFogRadar(keys);277 278 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex());279 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());280 dlg.tfM01Name.setText(getName());281 dlg.cM01TopMark.setSelected(hasTopMark());282 }283 284 public void refreshStyles() {285 int type = getBuoyIndex();286 int style = getStyleIndex();287 288 dlg.cbM01StyleOfMark.removeAllItems();289 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213")); //$NON-NLS-1$290 291 switch (type) {292 case PORT_HAND:293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$297 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$298 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$300 break;301 302 case STARBOARD_HAND:303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$305 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$306 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$307 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$308 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$309 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$310 break;311 312 case PREF_PORT_HAND:313 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$314 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$315 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$316 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$317 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$318 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$319 break;320 321 case PREF_STARBOARD_HAND:322 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$323 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$324 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$325 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$326 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$327 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$328 break;329 330 default:331 }332 333 if (style >= dlg.cbM01StyleOfMark.getItemCount())334 style = 0;335 setStyleIndex(style);336 dlg.cbM01StyleOfMark.setSelectedIndex(style);337 dlg.cbM01StyleOfMark.setVisible(true);338 dlg.lM01StyleOfMark.setVisible(true);339 }340 341 public boolean isValid() {342 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);343 }344 345 public void paintSign() {346 if (dlg.paintlock)347 return;348 super.paintSign();349 350 dlg.sM01StatusBar.setText(getErrMsg());351 352 if (isValid()) {353 dlg.tfM01Name.setEnabled(true);354 dlg.tfM01Name.setText(getName());355 356 int cat = getBuoyIndex();357 boolean region = getRegion();358 int style = getStyleIndex();359 360 if (style == LAT_PERCH) {361 dlg.cM01TopMark.setVisible(false);362 dlg.cM01TopMark.setSelected(false);363 dlg.cM01Radar.setVisible(false);364 dlg.cM01Racon.setVisible(false);365 dlg.cM01Fog.setVisible(false);366 dlg.cM01Fired.setVisible(false);367 dlg.cM01Fired.setSelected(false);368 } else {369 dlg.cM01TopMark.setEnabled(true);370 dlg.cM01TopMark.setVisible(true);371 dlg.cM01Radar.setVisible(true);372 dlg.cM01Racon.setVisible(true);373 dlg.cM01Fog.setVisible(true);374 dlg.cM01Fired.setVisible(true);375 dlg.cM01Fired.setEnabled(true);376 dlg.cM01TopMark.setEnabled(true);377 }378 dlg.cbM01Colour.setVisible(false);379 dlg.lM01Colour.setVisible(false);380 dlg.rbM01Fired1.setVisible(false);381 dlg.rbM01FiredN.setVisible(false);382 dlg.lM01Height.setVisible(false);383 dlg.tfM01Height.setVisible(false);384 dlg.lM01Range.setVisible(false);385 dlg.tfM01Range.setVisible(false);386 387 if (isFired()) {388 switch (style) {389 case LAT_BEACON:390 case LAT_TOWER:391 dlg.rbM01Fired1.setVisible(true);392 dlg.rbM01FiredN.setVisible(true);393 dlg.lM01Height.setVisible(true);394 dlg.tfM01Height.setVisible(true);395 dlg.lM01Range.setVisible(true);396 dlg.tfM01Range.setVisible(true);397 break;398 case LAT_FLOAT:399 dlg.lM01Height.setVisible(true);400 dlg.tfM01Height.setVisible(true);401 dlg.lM01Range.setVisible(true);402 dlg.tfM01Range.setVisible(true);403 break;404 default:405 }406 }407 String image = "/images/Lateral"; //$NON-NLS-1$408 409 switch (getBuoyIndex()) {410 case PORT_HAND:411 if (region == IALA_A)412 switch (style) {413 case LAT_CAN:414 image += "_Can_Red"; //$NON-NLS-1$415 break;416 case LAT_PILLAR:417 image += "_Pillar_Red"; //$NON-NLS-1$418 break;419 case LAT_SPAR:420 image += "_Spar_Red"; //$NON-NLS-1$421 break;422 case LAT_BEACON:423 image += "_Beacon_Red"; //$NON-NLS-1$424 break;425 case LAT_TOWER:426 image += "_Tower_Red"; //$NON-NLS-1$427 break;428 case LAT_FLOAT:429 image += "_Float_Red"; //$NON-NLS-1$430 break;431 case LAT_PERCH:432 image += "_Perch_Port"; //$NON-NLS-1$433 break;434 default:435 }436 else437 switch (style) {438 case LAT_CAN:439 image += "_Can_Green"; //$NON-NLS-1$440 break;441 case LAT_PILLAR:442 image += "_Pillar_Green"; //$NON-NLS-1$443 break;444 case LAT_SPAR:445 image += "_Spar_Green"; //$NON-NLS-1$446 break;447 case LAT_BEACON:448 image += "_Beacon_Green"; //$NON-NLS-1$449 break;450 case LAT_TOWER:451 image += "_Tower_Green"; //$NON-NLS-1$452 break;453 case LAT_FLOAT:454 image += "_Float_Green"; //$NON-NLS-1$455 break;456 case LAT_PERCH:457 image += "_Perch_Port"; //$NON-NLS-1$458 break;459 default:460 }461 break;462 463 case STARBOARD_HAND:464 if (region == IALA_A)465 switch (style) {466 case LAT_CONE:467 image += "_Cone_Green"; //$NON-NLS-1$468 break;469 case LAT_PILLAR:470 image += "_Pillar_Green"; //$NON-NLS-1$471 break;472 case LAT_SPAR:473 image += "_Spar_Green"; //$NON-NLS-1$474 break;475 case LAT_BEACON:476 image += "_Beacon_Green"; //$NON-NLS-1$477 break;478 case LAT_TOWER:479 image += "_Tower_Green"; //$NON-NLS-1$480 break;481 case LAT_FLOAT:482 image += "_Float_Green"; //$NON-NLS-1$483 break;484 case LAT_PERCH:485 image += "_Perch_Starboard"; //$NON-NLS-1$486 break;487 default:488 }489 else490 switch (style) {491 case LAT_CONE:492 image += "_Cone_Red"; //$NON-NLS-1$493 break;494 case LAT_PILLAR:495 image += "_Pillar_Red"; //$NON-NLS-1$496 break;497 case LAT_SPAR:498 image += "_Spar_Red"; //$NON-NLS-1$499 break;500 case LAT_BEACON:501 image += "_Beacon_Red"; //$NON-NLS-1$502 break;503 case LAT_TOWER:504 image += "_Tower_Red"; //$NON-NLS-1$505 break;506 case LAT_FLOAT:507 image += "_Float_Red"; //$NON-NLS-1$508 break;509 case LAT_PERCH:510 image += "_Perch_Starboard"; //$NON-NLS-1$511 break;512 default:513 }514 break;515 516 case PREF_PORT_HAND:517 if (region == IALA_A)518 switch (style) {519 case LAT_CAN:520 image += "_Can_Red_Green_Red"; //$NON-NLS-1$521 break;522 case LAT_PILLAR:523 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$524 break;525 case LAT_SPAR:526 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$527 break;528 case LAT_BEACON:529 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$530 break;531 case LAT_TOWER:532 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$533 break;534 case LAT_FLOAT:535 image += "_Float_Red_Green_Red"; //$NON-NLS-1$536 break;537 default:538 }539 else540 switch (style) {541 case LAT_CAN:542 image += "_Can_Green_Red_Green"; //$NON-NLS-1$543 break;544 case LAT_PILLAR:545 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$546 break;547 case LAT_SPAR:548 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$549 break;550 case LAT_BEACON:551 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$552 break;553 case LAT_TOWER:554 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$555 break;556 case LAT_FLOAT:557 image += "_Float_Green_Red_Green"; //$NON-NLS-1$558 break;559 default:560 }561 break;562 563 case PREF_STARBOARD_HAND:564 if (region == IALA_A)565 switch (style) {566 case LAT_CONE:567 image += "_Cone_Green_Red_Green"; //$NON-NLS-1$568 break;569 case LAT_PILLAR:570 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$571 break;572 case LAT_SPAR:573 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$574 break;575 case LAT_BEACON:576 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$577 break;578 case LAT_TOWER:579 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$580 break;581 case LAT_FLOAT:582 image += "_Float_Green_Red_Green"; //$NON-NLS-1$583 break;584 default:585 }586 else587 switch (style) {588 case LAT_CONE:589 image += "_Cone_Red_Green_Red"; //$NON-NLS-1$590 break;591 case LAT_PILLAR:592 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$593 break;594 case LAT_SPAR:595 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$596 break;597 case LAT_BEACON:598 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$599 break;600 case LAT_TOWER:601 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$602 break;603 case LAT_FLOAT:604 image += "_Float_Red_Green_Red"; //$NON-NLS-1$605 break;606 default:607 }608 break;609 610 default:611 }612 613 if (!image.equals("/images/Lateral")) { //$NON-NLS-1$614 615 if (hasTopMark()) {616 if (cat == PORT_HAND || cat == PREF_PORT_HAND)617 image += "_Can"; //$NON-NLS-1$618 else619 image += "_Cone"; //$NON-NLS-1$620 }621 image += ".png"; //$NON-NLS-1$622 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));623 624 if (hasRadar()) {625 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource(626 "/images/Radar_Reflector.png"))); //$NON-NLS-1$627 }628 629 } else630 dlg.lM01Icon.setIcon(null);631 }632 }633 634 public void saveSign() {635 Node node = getNode();636 637 if (node == null) {638 return;639 }640 641 int cat = getBuoyIndex();642 String shape = ""; //$NON-NLS-1$643 String colour = ""; //$NON-NLS-1$644 645 switch (cat) {646 647 case PORT_HAND:648 switch (getStyleIndex()) {649 case LAT_CAN:650 super.saveSign("buoy_lateral"); //$NON-NLS-1$651 Main.main.undoRedo.add(new ChangePropertyCommand(node,652 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$653 break;654 case LAT_PILLAR:655 super.saveSign("buoy_lateral"); //$NON-NLS-1$656 Main.main.undoRedo.add(new ChangePropertyCommand(node,657 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$658 break;659 case LAT_SPAR:660 super.saveSign("buoy_lateral"); //$NON-NLS-1$661 Main.main.undoRedo.add(new ChangePropertyCommand(node,662 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$663 break;664 case LAT_BEACON:665 super.saveSign("beacon_lateral"); //$NON-NLS-1$666 break;667 case LAT_TOWER:668 super.saveSign("beacon_lateral"); //$NON-NLS-1$669 Main.main.undoRedo.add(new ChangePropertyCommand(node,670 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$671 break;672 case LAT_FLOAT:673 super.saveSign("light_float"); //$NON-NLS-1$674 break;675 case LAT_PERCH:676 super.saveSign("beacon_lateral"); //$NON-NLS-1$677 Main.main.undoRedo.add(new ChangePropertyCommand(node,678 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$679 break;680 default:681 }682 switch (getStyleIndex()) {683 case LAT_CAN:684 case LAT_PILLAR:685 case LAT_SPAR:686 Main.main.undoRedo.add(new ChangePropertyCommand(node,687 "seamark:buoy_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$688 if (getRegion() == IALA_A) {689 Main.main.undoRedo.add(new ChangePropertyCommand(node,690 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$691 colour = "red"; //$NON-NLS-1$692 } else {693 Main.main.undoRedo.add(new ChangePropertyCommand(node,694 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$695 colour = "green"; //$NON-NLS-1$696 }697 break;698 case LAT_PERCH:699 Main.main.undoRedo.add(new ChangePropertyCommand(node,700 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$701 break;702 case LAT_BEACON:703 case LAT_TOWER:704 Main.main.undoRedo.add(new ChangePropertyCommand(node,705 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$706 if (getRegion() == IALA_A) {707 Main.main.undoRedo.add(new ChangePropertyCommand(node,708 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$709 colour = "red"; //$NON-NLS-1$710 } else {711 Main.main.undoRedo.add(new ChangePropertyCommand(node,712 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$713 colour = "green"; //$NON-NLS-1$714 }715 break;716 case LAT_FLOAT:717 if (getRegion() == IALA_A) {718 Main.main.undoRedo.add(new ChangePropertyCommand(node,719 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$720 colour = "red"; //$NON-NLS-1$721 } else {722 Main.main.undoRedo.add(new ChangePropertyCommand(node,723 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$724 colour = "green"; //$NON-NLS-1$725 }726 break;727 }728 shape = "cylinder"; //$NON-NLS-1$729 break;730 731 case PREF_PORT_HAND:732 switch (getStyleIndex()) {733 case LAT_CAN:734 super.saveSign("buoy_lateral"); //$NON-NLS-1$735 Main.main.undoRedo.add(new ChangePropertyCommand(node,736 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$737 break;738 case LAT_PILLAR:739 super.saveSign("buoy_lateral"); //$NON-NLS-1$740 Main.main.undoRedo.add(new ChangePropertyCommand(node,741 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$742 break;743 case LAT_SPAR:744 super.saveSign("buoy_lateral"); //$NON-NLS-1$745 Main.main.undoRedo.add(new ChangePropertyCommand(node,746 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$747 break;748 case LAT_BEACON:749 super.saveSign("beacon_lateral"); //$NON-NLS-1$750 break;751 case LAT_TOWER:752 super.saveSign("beacon_lateral"); //$NON-NLS-1$753 Main.main.undoRedo.add(new ChangePropertyCommand(node,754 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$755 break;756 case LAT_FLOAT:757 super.saveSign("light_float"); //$NON-NLS-1$758 break;759 default:760 }761 switch (getStyleIndex()) {762 case LAT_CAN:763 case LAT_PILLAR:764 case LAT_SPAR:765 Main.main.undoRedo.add(new ChangePropertyCommand(node,766 "seamark:buoy_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$767 Main.main.undoRedo.add(new ChangePropertyCommand(node,768 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$769 if (getRegion() == IALA_A) {770 Main.main.undoRedo.add(new ChangePropertyCommand(node,771 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$772 colour = "red"; //$NON-NLS-1$773 } else {774 Main.main.undoRedo.add(new ChangePropertyCommand(node,775 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$776 colour = "green"; //$NON-NLS-1$777 }778 break;779 case LAT_BEACON:780 case LAT_TOWER:781 Main.main.undoRedo.add(new ChangePropertyCommand(node,782 "seamark:beacon_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$783 Main.main.undoRedo.add(new ChangePropertyCommand(node,784 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$785 if (getRegion() == IALA_A) {786 Main.main.undoRedo.add(new ChangePropertyCommand(node,787 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$788 colour = "red"; //$NON-NLS-1$789 } else {790 Main.main.undoRedo.add(new ChangePropertyCommand(node,791 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$792 colour = "green"; //$NON-NLS-1$793 }794 break;795 case LAT_FLOAT:796 Main.main.undoRedo.add(new ChangePropertyCommand(node,797 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$798 if (getRegion() == IALA_A) {799 Main.main.undoRedo.add(new ChangePropertyCommand(node,800 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$801 colour = "red"; //$NON-NLS-1$802 } else {803 Main.main.undoRedo.add(new ChangePropertyCommand(node,804 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$805 colour = "green"; //$NON-NLS-1$806 }807 break;808 }809 shape = "cylinder"; //$NON-NLS-1$810 break;811 812 case STARBOARD_HAND:813 switch (getStyleIndex()) {814 case LAT_CONE:815 super.saveSign("buoy_lateral"); //$NON-NLS-1$816 Main.main.undoRedo.add(new ChangePropertyCommand(node,817 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$818 break;819 case LAT_PILLAR:820 super.saveSign("buoy_lateral"); //$NON-NLS-1$821 Main.main.undoRedo.add(new ChangePropertyCommand(node,822 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$823 break;824 case LAT_SPAR:825 super.saveSign("buoy_lateral"); //$NON-NLS-1$826 Main.main.undoRedo.add(new ChangePropertyCommand(node,827 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$828 break;829 case LAT_BEACON:830 super.saveSign("beacon_lateral"); //$NON-NLS-1$831 Main.main.undoRedo.add(new ChangePropertyCommand(node,832 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$833 break;834 case LAT_TOWER:835 super.saveSign("beacon_lateral"); //$NON-NLS-1$836 Main.main.undoRedo.add(new ChangePropertyCommand(node,837 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$838 break;839 case LAT_FLOAT:840 super.saveSign("light_float"); //$NON-NLS-1$841 break;842 case LAT_PERCH:843 super.saveSign("beacon_lateral"); //$NON-NLS-1$844 Main.main.undoRedo.add(new ChangePropertyCommand(node,845 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$846 break;847 default:848 }849 switch (getStyleIndex()) {850 case LAT_CAN:851 case LAT_PILLAR:852 case LAT_SPAR:853 Main.main.undoRedo.add(new ChangePropertyCommand(node,854 "seamark:buoy_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$855 if (getRegion() == IALA_A) {856 Main.main.undoRedo.add(new ChangePropertyCommand(node,857 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$858 colour = "green"; //$NON-NLS-1$859 } else {860 Main.main.undoRedo.add(new ChangePropertyCommand(node,861 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$862 colour = "red"; //$NON-NLS-1$863 }864 break;865 case LAT_BEACON:866 case LAT_TOWER:867 Main.main.undoRedo.add(new ChangePropertyCommand(node,868 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$869 if (getRegion() == IALA_A) {870 Main.main.undoRedo.add(new ChangePropertyCommand(node,871 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$872 colour = "green"; //$NON-NLS-1$873 } else {874 Main.main.undoRedo.add(new ChangePropertyCommand(node,875 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$876 colour = "red"; //$NON-NLS-1$877 }878 break;879 case LAT_FLOAT:880 if (getRegion() == IALA_A) {881 Main.main.undoRedo.add(new ChangePropertyCommand(node,882 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$883 colour = "green"; //$NON-NLS-1$884 } else {885 Main.main.undoRedo.add(new ChangePropertyCommand(node,886 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$887 colour = "red"; //$NON-NLS-1$888 }889 break;890 case LAT_PERCH:891 Main.main.undoRedo.add(new ChangePropertyCommand(node,892 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$893 break;894 }895 shape = "cone, point up"; //$NON-NLS-1$896 break;897 898 case PREF_STARBOARD_HAND:899 switch (getStyleIndex()) {900 case LAT_CONE:901 super.saveSign("buoy_lateral"); //$NON-NLS-1$902 Main.main.undoRedo.add(new ChangePropertyCommand(node,903 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$904 break;905 case LAT_PILLAR:906 super.saveSign("buoy_lateral"); //$NON-NLS-1$907 Main.main.undoRedo.add(new ChangePropertyCommand(node,908 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$909 break;910 case LAT_SPAR:911 super.saveSign("buoy_lateral"); //$NON-NLS-1$912 Main.main.undoRedo.add(new ChangePropertyCommand(node,913 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$914 break;915 case LAT_BEACON:916 super.saveSign("beacon_lateral"); //$NON-NLS-1$917 Main.main.undoRedo.add(new ChangePropertyCommand(node,918 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$919 break;920 case LAT_TOWER:921 super.saveSign("beacon_lateral"); //$NON-NLS-1$922 Main.main.undoRedo.add(new ChangePropertyCommand(node,923 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$924 break;925 case LAT_FLOAT:926 super.saveSign("light_float"); //$NON-NLS-1$927 break;928 default:929 }930 switch (getStyleIndex()) {931 case LAT_CAN:932 case LAT_PILLAR:933 case LAT_SPAR:934 Main.main.undoRedo.add(new ChangePropertyCommand(node,935 "seamark:buoy_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$936 Main.main.undoRedo.add(new ChangePropertyCommand(node,937 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$938 if (getRegion() == IALA_A) {939 Main.main.undoRedo.add(new ChangePropertyCommand(node,940 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$941 colour = "green"; //$NON-NLS-1$942 } else {943 Main.main.undoRedo.add(new ChangePropertyCommand(node,944 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$945 colour = "red"; //$NON-NLS-1$946 }947 break;948 case LAT_BEACON:949 case LAT_TOWER:950 Main.main.undoRedo.add(new ChangePropertyCommand(node,951 "seamark:beacon_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$952 Main.main.undoRedo.add(new ChangePropertyCommand(node,953 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$954 if (getRegion() == IALA_A) {955 Main.main.undoRedo.add(new ChangePropertyCommand(node,956 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$957 colour = "green"; //$NON-NLS-1$958 } else {959 Main.main.undoRedo.add(new ChangePropertyCommand(node,960 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$961 colour = "red"; //$NON-NLS-1$962 }963 break;964 case LAT_FLOAT:965 Main.main.undoRedo.add(new ChangePropertyCommand(node,966 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$967 if (getRegion() == IALA_A) {968 Main.main.undoRedo.add(new ChangePropertyCommand(node,969 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$970 colour = "green"; //$NON-NLS-1$971 } else {972 Main.main.undoRedo.add(new ChangePropertyCommand(node,973 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$974 colour = "red"; //$NON-NLS-1$975 }976 break;977 }978 shape = "cone, point up"; //$NON-NLS-1$979 break;980 981 default:982 }983 saveTopMarkData(shape, colour);984 saveLightData();985 saveRadarFogData();986 987 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$988 }989 990 public void setLightColour() {991 if (getRegion() == IALA_A) {992 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)993 super.setLightColour("R"); //$NON-NLS-1$994 else995 super.setLightColour("G"); //$NON-NLS-1$996 } else {997 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)998 super.setLightColour("G"); //$NON-NLS-1$999 else1000 super.setLightColour("R"); //$NON-NLS-1$1001 }1002 }1003 1004 public void setLightColour(String str) {1005 int cat = getBuoyIndex();1006 1007 if (str == null) {1008 return;1009 }1010 1011 switch (cat) {1012 case PORT_HAND:1013 case PREF_PORT_HAND:1014 if (getRegion() == IALA_A) {1015 if (str.equals("red")) { //$NON-NLS-1$1016 setFired(true);1017 super.setLightColour("R"); //$NON-NLS-1$1018 } else {1019 super.setLightColour(""); //$NON-NLS-1$1020 }1021 } else {1022 if (str.equals("green")) { //$NON-NLS-1$1023 setFired(true);1024 super.setLightColour("G"); //$NON-NLS-1$1025 } else {1026 super.setLightColour(""); //$NON-NLS-1$1027 }1028 }1029 break;1030 1031 case STARBOARD_HAND:1032 case PREF_STARBOARD_HAND:1033 if (getRegion() == IALA_A) {1034 if (str.equals("green")) { //$NON-NLS-1$1035 setFired(true);1036 super.setLightColour("G"); //$NON-NLS-1$1037 } else {1038 super.setLightColour(""); //$NON-NLS-1$1039 }1040 } else {1041 if (str.equals("red")) { //$NON-NLS-1$1042 setFired(true);1043 super.setLightColour("R"); //$NON-NLS-1$1044 } else {1045 super.setLightColour(""); //$NON-NLS-1$1046 }1047 }1048 break;1049 default:1050 }1051 }18 public BuoyLat(SmpDialogAction dia, Node node) { 19 super(dia); 20 21 String str; 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 26 resetMask(); 27 28 dlg.cbM01CatOfMark.removeAllItems(); 29 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$ 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$ 34 35 dlg.rbM01RegionA.setEnabled(true); 36 dlg.rbM01RegionB.setEnabled(true); 37 dlg.cbM01CatOfMark.setEnabled(true); 38 dlg.cbM01CatOfMark.setVisible(true); 39 dlg.lM01CatOfMark.setVisible(true); 40 41 dlg.cbM01StyleOfMark.removeAllItems(); 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 48 dlg.cbM01StyleOfMark.setEnabled(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL); 51 52 if (keys.containsKey("name")) //$NON-NLS-1$ 53 setName(keys.get("name")); //$NON-NLS-1$ 54 55 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:name")); //$NON-NLS-1$ 57 58 if (keys.containsKey("seamark:buoy_lateral:name")) //$NON-NLS-1$ 59 setName(keys.get("seamark:buoy_lateral:name")); //$NON-NLS-1$ 60 else if (keys.containsKey("seamark:beacon_lateral:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:beacon_lateral:name")); //$NON-NLS-1$ 62 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 63 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 64 65 String cat = ""; //$NON-NLS-1$ 66 String col = ""; //$NON-NLS-1$ 67 String top = ""; //$NON-NLS-1$ 68 69 if (getStyleIndex() != LAT_PERCH) { 70 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 71 top = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 72 setTopMark(true); 73 } 74 if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 75 setTopMark(true); 76 } 77 } 78 79 if (keys.containsKey("seamark:buoy_lateral:colour")) //$NON-NLS-1$ 80 col = keys.get("seamark:buoy_lateral:colour"); //$NON-NLS-1$ 81 else if (keys.containsKey("seamark:beacon_lateral:colour")) //$NON-NLS-1$ 82 col = keys.get("seamark:beacon_lateral:colour"); //$NON-NLS-1$ 83 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 84 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 85 86 if (keys.containsKey("seamark:buoy_lateral:category")) //$NON-NLS-1$ 87 cat = keys.get("seamark:buoy_lateral:category"); //$NON-NLS-1$ 88 else if (keys.containsKey("seamark:beacon_lateral:category")) //$NON-NLS-1$ 89 cat = keys.get("seamark:beacon_lateral:category"); //$NON-NLS-1$ 90 91 if (cat.isEmpty()) { //$NON-NLS-1$ 92 if (col.equals("red")) { //$NON-NLS-1$ 93 setColour(RED); 94 if (top.equals("cylinder")) { //$NON-NLS-1$ 95 setBuoyIndex(PORT_HAND); 96 setRegion(IALA_A); 97 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 98 setBuoyIndex(STARBOARD_HAND); 99 setRegion(IALA_B); 100 } else { 101 if (getRegion() == IALA_A) 102 setBuoyIndex(PORT_HAND); 103 else 104 setBuoyIndex(STARBOARD_HAND); 105 } 106 } else if (col.equals("green")) { //$NON-NLS-1$ 107 setColour(GREEN); 108 if (top.equals("cone, point up")) { //$NON-NLS-1$ 109 setBuoyIndex(STARBOARD_HAND); 110 setRegion(IALA_A); 111 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 112 setBuoyIndex(PORT_HAND); 113 setRegion(IALA_B); 114 } else { 115 if (getRegion() == IALA_A) 116 setBuoyIndex(STARBOARD_HAND); 117 else 118 setBuoyIndex(PORT_HAND); 119 } 120 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 121 setColour(RED_GREEN_RED); 122 if (top.equals("cylinder")) { //$NON-NLS-1$ 123 setBuoyIndex(PREF_PORT_HAND); 124 setRegion(IALA_A); 125 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 126 setBuoyIndex(PREF_STARBOARD_HAND); 127 setRegion(IALA_B); 128 } else { 129 if (getRegion() == IALA_A) 130 setBuoyIndex(PREF_PORT_HAND); 131 else 132 setBuoyIndex(PREF_STARBOARD_HAND); 133 } 134 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 135 setColour(GREEN_RED_GREEN); 136 if (top.equals("cone, point up")) { //$NON-NLS-1$ 137 setBuoyIndex(PREF_STARBOARD_HAND); 138 setRegion(IALA_A); 139 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 140 setBuoyIndex(PREF_PORT_HAND); 141 setRegion(IALA_B); 142 } else { 143 if (getRegion() == IALA_A) 144 setBuoyIndex(PREF_STARBOARD_HAND); 145 else 146 setBuoyIndex(PREF_PORT_HAND); 147 } 148 } 149 } else if (cat.equals("port")) { //$NON-NLS-1$ 150 151 setBuoyIndex(PORT_HAND); 152 153 if (col.equals("red")) { //$NON-NLS-1$ 154 setRegion(IALA_A); 155 setColour(RED); 156 } else if (col.equals("green")) { //$NON-NLS-1$ 157 setRegion(IALA_B); 158 setColour(GREEN); 159 } else { 160 if (getRegion() == IALA_A) 161 setColour(RED); 162 else 163 setColour(GREEN); 164 } 165 } else if (cat.equals("starboard")) { //$NON-NLS-1$ 166 167 setBuoyIndex(STARBOARD_HAND); 168 169 if (col.equals("green")) { //$NON-NLS-1$ 170 setRegion(IALA_A); 171 setColour(GREEN); 172 } else if (col.equals("red")) { //$NON-NLS-1$ 173 setRegion(IALA_B); 174 setColour(RED); 175 } else { 176 if (getRegion() == IALA_A) 177 setColour(GREEN); 178 else 179 setColour(RED); 180 } 181 } else if (cat.equals("preferred_channel_port")) { //$NON-NLS-1$ 182 183 setBuoyIndex(PREF_PORT_HAND); 184 185 if (col.equals("red;green;red")) { //$NON-NLS-1$ 186 setRegion(IALA_A); 187 setColour(RED_GREEN_RED); 188 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 189 setRegion(IALA_B); 190 setColour(GREEN_RED_GREEN); 191 } else { 192 if (getRegion() == IALA_A) 193 setColour(RED_GREEN_RED); 194 else 195 setColour(GREEN_RED_GREEN); 196 } 197 198 } else if (cat.equals("preferred_channel_starboard")) { //$NON-NLS-1$ 199 200 setBuoyIndex(PREF_STARBOARD_HAND); 201 202 if (col.equals("green;red;green")) { //$NON-NLS-1$ 203 setRegion(IALA_A); 204 setColour(GREEN_RED_GREEN); 205 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 206 setRegion(IALA_B); 207 setColour(RED_GREEN_RED); 208 } else { 209 if (getRegion() == IALA_A) 210 setColour(GREEN_RED_GREEN); 211 else 212 setColour(RED_GREEN_RED); 213 } 214 } 215 216 if (keys.containsKey("seamark:buoy_lateral:shape")) { //$NON-NLS-1$ 217 str = keys.get("seamark:buoy_lateral:shape"); //$NON-NLS-1$ 218 219 switch (getBuoyIndex()) { 220 case PORT_HAND: 221 if (str.equals("can")) //$NON-NLS-1$ 222 setStyleIndex(LAT_CAN); 223 else if (str.equals("pillar")) //$NON-NLS-1$ 224 setStyleIndex(LAT_PILLAR); 225 else if (str.equals("spar")) //$NON-NLS-1$ 226 setStyleIndex(LAT_SPAR); 227 break; 228 229 case PREF_PORT_HAND: 230 if (str.equals("can")) //$NON-NLS-1$ 231 setStyleIndex(LAT_CAN); 232 else if (str.equals("pillar")) //$NON-NLS-1$ 233 setStyleIndex(LAT_PILLAR); 234 else if (str.equals("spar")) //$NON-NLS-1$ 235 setStyleIndex(LAT_SPAR); 236 break; 237 238 case STARBOARD_HAND: 239 if (str.equals("conical")) //$NON-NLS-1$ 240 setStyleIndex(LAT_CONE); 241 else if (str.equals("pillar")) //$NON-NLS-1$ 242 setStyleIndex(LAT_PILLAR); 243 else if (str.equals("spar")) //$NON-NLS-1$ 244 setStyleIndex(LAT_SPAR); 245 break; 246 247 case PREF_STARBOARD_HAND: 248 if (str.equals("conical")) //$NON-NLS-1$ 249 setStyleIndex(LAT_CONE); 250 else if (str.equals("pillar")) //$NON-NLS-1$ 251 setStyleIndex(LAT_PILLAR); 252 else if (str.equals("spar")) //$NON-NLS-1$ 253 setStyleIndex(LAT_SPAR); 254 break; 255 } 256 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { //$NON-NLS-1$ 257 str = keys.get("seamark:beacon_lateral:shape"); //$NON-NLS-1$ 258 if (str.equals("tower")) //$NON-NLS-1$ 259 setStyleIndex(LAT_TOWER); 260 else if (str.equals("perch")) //$NON-NLS-1$ 261 setStyleIndex(LAT_PERCH); 262 else 263 setStyleIndex(LAT_BEACON); 264 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 265 && (keys.get("seamark:type").equals("beacon_lateral"))) { //$NON-NLS-1$ //$NON-NLS-2$ 266 setStyleIndex(LAT_BEACON); 267 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 268 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 269 setStyleIndex(LAT_FLOAT); 270 } 271 272 refreshStyles(); 273 refreshLights(); 274 setLightColour(); 275 parseLights(keys); 276 parseFogRadar(keys); 277 278 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 279 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 280 dlg.tfM01Name.setText(getName()); 281 dlg.cM01TopMark.setSelected(hasTopMark()); 282 } 283 284 public void refreshStyles() { 285 int type = getBuoyIndex(); 286 int style = getStyleIndex(); 287 288 dlg.cbM01StyleOfMark.removeAllItems(); 289 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213")); //$NON-NLS-1$ 290 291 switch (type) { 292 case PORT_HAND: 293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 297 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 298 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 300 break; 301 302 case STARBOARD_HAND: 303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 305 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 306 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 307 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 308 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 309 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 310 break; 311 312 case PREF_PORT_HAND: 313 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 314 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 315 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 316 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 317 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 318 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 319 break; 320 321 case PREF_STARBOARD_HAND: 322 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 323 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 324 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 325 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 326 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 327 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 328 break; 329 330 default: 331 } 332 333 if (style >= dlg.cbM01StyleOfMark.getItemCount()) 334 style = 0; 335 setStyleIndex(style); 336 dlg.cbM01StyleOfMark.setSelectedIndex(style); 337 dlg.cbM01StyleOfMark.setVisible(true); 338 dlg.lM01StyleOfMark.setVisible(true); 339 } 340 341 public boolean isValid() { 342 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 343 } 344 345 public void paintSign() { 346 if (dlg.paintlock) 347 return; 348 super.paintSign(); 349 350 dlg.sM01StatusBar.setText(getErrMsg()); 351 352 if (isValid()) { 353 dlg.tfM01Name.setEnabled(true); 354 dlg.tfM01Name.setText(getName()); 355 356 int cat = getBuoyIndex(); 357 boolean region = getRegion(); 358 int style = getStyleIndex(); 359 360 if (style == LAT_PERCH) { 361 dlg.cM01TopMark.setVisible(false); 362 dlg.cM01TopMark.setSelected(false); 363 dlg.cM01Radar.setVisible(false); 364 dlg.cM01Racon.setVisible(false); 365 dlg.cM01Fog.setVisible(false); 366 dlg.cM01Fired.setVisible(false); 367 dlg.cM01Fired.setSelected(false); 368 } else { 369 dlg.cM01TopMark.setEnabled(true); 370 dlg.cM01TopMark.setVisible(true); 371 dlg.cM01Radar.setVisible(true); 372 dlg.cM01Racon.setVisible(true); 373 dlg.cM01Fog.setVisible(true); 374 dlg.cM01Fired.setVisible(true); 375 dlg.cM01Fired.setEnabled(true); 376 dlg.cM01TopMark.setEnabled(true); 377 } 378 dlg.cbM01Colour.setVisible(false); 379 dlg.lM01Colour.setVisible(false); 380 dlg.rbM01Fired1.setVisible(false); 381 dlg.rbM01FiredN.setVisible(false); 382 dlg.lM01Height.setVisible(false); 383 dlg.tfM01Height.setVisible(false); 384 dlg.lM01Range.setVisible(false); 385 dlg.tfM01Range.setVisible(false); 386 387 if (isFired()) { 388 switch (style) { 389 case LAT_BEACON: 390 case LAT_TOWER: 391 dlg.rbM01Fired1.setVisible(true); 392 dlg.rbM01FiredN.setVisible(true); 393 dlg.lM01Height.setVisible(true); 394 dlg.tfM01Height.setVisible(true); 395 dlg.lM01Range.setVisible(true); 396 dlg.tfM01Range.setVisible(true); 397 break; 398 case LAT_FLOAT: 399 dlg.lM01Height.setVisible(true); 400 dlg.tfM01Height.setVisible(true); 401 dlg.lM01Range.setVisible(true); 402 dlg.tfM01Range.setVisible(true); 403 break; 404 default: 405 } 406 } 407 String image = "/images/Lateral"; //$NON-NLS-1$ 408 409 switch (getBuoyIndex()) { 410 case PORT_HAND: 411 if (region == IALA_A) 412 switch (style) { 413 case LAT_CAN: 414 image += "_Can_Red"; //$NON-NLS-1$ 415 break; 416 case LAT_PILLAR: 417 image += "_Pillar_Red"; //$NON-NLS-1$ 418 break; 419 case LAT_SPAR: 420 image += "_Spar_Red"; //$NON-NLS-1$ 421 break; 422 case LAT_BEACON: 423 image += "_Beacon_Red"; //$NON-NLS-1$ 424 break; 425 case LAT_TOWER: 426 image += "_Tower_Red"; //$NON-NLS-1$ 427 break; 428 case LAT_FLOAT: 429 image += "_Float_Red"; //$NON-NLS-1$ 430 break; 431 case LAT_PERCH: 432 image += "_Perch_Port"; //$NON-NLS-1$ 433 break; 434 default: 435 } 436 else 437 switch (style) { 438 case LAT_CAN: 439 image += "_Can_Green"; //$NON-NLS-1$ 440 break; 441 case LAT_PILLAR: 442 image += "_Pillar_Green"; //$NON-NLS-1$ 443 break; 444 case LAT_SPAR: 445 image += "_Spar_Green"; //$NON-NLS-1$ 446 break; 447 case LAT_BEACON: 448 image += "_Beacon_Green"; //$NON-NLS-1$ 449 break; 450 case LAT_TOWER: 451 image += "_Tower_Green"; //$NON-NLS-1$ 452 break; 453 case LAT_FLOAT: 454 image += "_Float_Green"; //$NON-NLS-1$ 455 break; 456 case LAT_PERCH: 457 image += "_Perch_Port"; //$NON-NLS-1$ 458 break; 459 default: 460 } 461 break; 462 463 case STARBOARD_HAND: 464 if (region == IALA_A) 465 switch (style) { 466 case LAT_CONE: 467 image += "_Cone_Green"; //$NON-NLS-1$ 468 break; 469 case LAT_PILLAR: 470 image += "_Pillar_Green"; //$NON-NLS-1$ 471 break; 472 case LAT_SPAR: 473 image += "_Spar_Green"; //$NON-NLS-1$ 474 break; 475 case LAT_BEACON: 476 image += "_Beacon_Green"; //$NON-NLS-1$ 477 break; 478 case LAT_TOWER: 479 image += "_Tower_Green"; //$NON-NLS-1$ 480 break; 481 case LAT_FLOAT: 482 image += "_Float_Green"; //$NON-NLS-1$ 483 break; 484 case LAT_PERCH: 485 image += "_Perch_Starboard"; //$NON-NLS-1$ 486 break; 487 default: 488 } 489 else 490 switch (style) { 491 case LAT_CONE: 492 image += "_Cone_Red"; //$NON-NLS-1$ 493 break; 494 case LAT_PILLAR: 495 image += "_Pillar_Red"; //$NON-NLS-1$ 496 break; 497 case LAT_SPAR: 498 image += "_Spar_Red"; //$NON-NLS-1$ 499 break; 500 case LAT_BEACON: 501 image += "_Beacon_Red"; //$NON-NLS-1$ 502 break; 503 case LAT_TOWER: 504 image += "_Tower_Red"; //$NON-NLS-1$ 505 break; 506 case LAT_FLOAT: 507 image += "_Float_Red"; //$NON-NLS-1$ 508 break; 509 case LAT_PERCH: 510 image += "_Perch_Starboard"; //$NON-NLS-1$ 511 break; 512 default: 513 } 514 break; 515 516 case PREF_PORT_HAND: 517 if (region == IALA_A) 518 switch (style) { 519 case LAT_CAN: 520 image += "_Can_Red_Green_Red"; //$NON-NLS-1$ 521 break; 522 case LAT_PILLAR: 523 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 524 break; 525 case LAT_SPAR: 526 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 527 break; 528 case LAT_BEACON: 529 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 530 break; 531 case LAT_TOWER: 532 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 533 break; 534 case LAT_FLOAT: 535 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 536 break; 537 default: 538 } 539 else 540 switch (style) { 541 case LAT_CAN: 542 image += "_Can_Green_Red_Green"; //$NON-NLS-1$ 543 break; 544 case LAT_PILLAR: 545 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 546 break; 547 case LAT_SPAR: 548 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 549 break; 550 case LAT_BEACON: 551 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 552 break; 553 case LAT_TOWER: 554 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 555 break; 556 case LAT_FLOAT: 557 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 558 break; 559 default: 560 } 561 break; 562 563 case PREF_STARBOARD_HAND: 564 if (region == IALA_A) 565 switch (style) { 566 case LAT_CONE: 567 image += "_Cone_Green_Red_Green"; //$NON-NLS-1$ 568 break; 569 case LAT_PILLAR: 570 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 571 break; 572 case LAT_SPAR: 573 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 574 break; 575 case LAT_BEACON: 576 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 577 break; 578 case LAT_TOWER: 579 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 580 break; 581 case LAT_FLOAT: 582 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 583 break; 584 default: 585 } 586 else 587 switch (style) { 588 case LAT_CONE: 589 image += "_Cone_Red_Green_Red"; //$NON-NLS-1$ 590 break; 591 case LAT_PILLAR: 592 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 593 break; 594 case LAT_SPAR: 595 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 596 break; 597 case LAT_BEACON: 598 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 599 break; 600 case LAT_TOWER: 601 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 602 break; 603 case LAT_FLOAT: 604 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 605 break; 606 default: 607 } 608 break; 609 610 default: 611 } 612 613 if (!image.equals("/images/Lateral")) { //$NON-NLS-1$ 614 615 if (hasTopMark()) { 616 if (cat == PORT_HAND || cat == PREF_PORT_HAND) 617 image += "_Can"; //$NON-NLS-1$ 618 else 619 image += "_Cone"; //$NON-NLS-1$ 620 } 621 image += ".png"; //$NON-NLS-1$ 622 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 623 624 if (hasRadar()) { 625 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 626 "/images/Radar_Reflector.png"))); //$NON-NLS-1$ 627 } 628 629 } else 630 dlg.lM01Icon.setIcon(null); 631 } 632 } 633 634 public void saveSign() { 635 Node node = getNode(); 636 637 if (node == null) { 638 return; 639 } 640 641 int cat = getBuoyIndex(); 642 String shape = ""; //$NON-NLS-1$ 643 String colour = ""; //$NON-NLS-1$ 644 645 switch (cat) { 646 647 case PORT_HAND: 648 switch (getStyleIndex()) { 649 case LAT_CAN: 650 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 651 Main.main.undoRedo.add(new ChangePropertyCommand(node, 652 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 653 break; 654 case LAT_PILLAR: 655 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 656 Main.main.undoRedo.add(new ChangePropertyCommand(node, 657 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 658 break; 659 case LAT_SPAR: 660 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 661 Main.main.undoRedo.add(new ChangePropertyCommand(node, 662 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 663 break; 664 case LAT_BEACON: 665 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 666 break; 667 case LAT_TOWER: 668 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 669 Main.main.undoRedo.add(new ChangePropertyCommand(node, 670 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 671 break; 672 case LAT_FLOAT: 673 super.saveSign("light_float"); //$NON-NLS-1$ 674 break; 675 case LAT_PERCH: 676 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 677 Main.main.undoRedo.add(new ChangePropertyCommand(node, 678 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 679 break; 680 default: 681 } 682 switch (getStyleIndex()) { 683 case LAT_CAN: 684 case LAT_PILLAR: 685 case LAT_SPAR: 686 Main.main.undoRedo.add(new ChangePropertyCommand(node, 687 "seamark:buoy_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 688 if (getRegion() == IALA_A) { 689 Main.main.undoRedo.add(new ChangePropertyCommand(node, 690 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 691 colour = "red"; //$NON-NLS-1$ 692 } else { 693 Main.main.undoRedo.add(new ChangePropertyCommand(node, 694 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 695 colour = "green"; //$NON-NLS-1$ 696 } 697 break; 698 case LAT_PERCH: 699 Main.main.undoRedo.add(new ChangePropertyCommand(node, 700 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 701 break; 702 case LAT_BEACON: 703 case LAT_TOWER: 704 Main.main.undoRedo.add(new ChangePropertyCommand(node, 705 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 706 if (getRegion() == IALA_A) { 707 Main.main.undoRedo.add(new ChangePropertyCommand(node, 708 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 709 colour = "red"; //$NON-NLS-1$ 710 } else { 711 Main.main.undoRedo.add(new ChangePropertyCommand(node, 712 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 713 colour = "green"; //$NON-NLS-1$ 714 } 715 break; 716 case LAT_FLOAT: 717 if (getRegion() == IALA_A) { 718 Main.main.undoRedo.add(new ChangePropertyCommand(node, 719 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 720 colour = "red"; //$NON-NLS-1$ 721 } else { 722 Main.main.undoRedo.add(new ChangePropertyCommand(node, 723 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 724 colour = "green"; //$NON-NLS-1$ 725 } 726 break; 727 } 728 shape = "cylinder"; //$NON-NLS-1$ 729 break; 730 731 case PREF_PORT_HAND: 732 switch (getStyleIndex()) { 733 case LAT_CAN: 734 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 735 Main.main.undoRedo.add(new ChangePropertyCommand(node, 736 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 737 break; 738 case LAT_PILLAR: 739 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 740 Main.main.undoRedo.add(new ChangePropertyCommand(node, 741 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 742 break; 743 case LAT_SPAR: 744 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 745 Main.main.undoRedo.add(new ChangePropertyCommand(node, 746 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 747 break; 748 case LAT_BEACON: 749 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 750 break; 751 case LAT_TOWER: 752 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 753 Main.main.undoRedo.add(new ChangePropertyCommand(node, 754 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 755 break; 756 case LAT_FLOAT: 757 super.saveSign("light_float"); //$NON-NLS-1$ 758 break; 759 default: 760 } 761 switch (getStyleIndex()) { 762 case LAT_CAN: 763 case LAT_PILLAR: 764 case LAT_SPAR: 765 Main.main.undoRedo.add(new ChangePropertyCommand(node, 766 "seamark:buoy_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 767 Main.main.undoRedo.add(new ChangePropertyCommand(node, 768 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 769 if (getRegion() == IALA_A) { 770 Main.main.undoRedo.add(new ChangePropertyCommand(node, 771 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 772 colour = "red"; //$NON-NLS-1$ 773 } else { 774 Main.main.undoRedo.add(new ChangePropertyCommand(node, 775 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 776 colour = "green"; //$NON-NLS-1$ 777 } 778 break; 779 case LAT_BEACON: 780 case LAT_TOWER: 781 Main.main.undoRedo.add(new ChangePropertyCommand(node, 782 "seamark:beacon_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 783 Main.main.undoRedo.add(new ChangePropertyCommand(node, 784 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 785 if (getRegion() == IALA_A) { 786 Main.main.undoRedo.add(new ChangePropertyCommand(node, 787 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 788 colour = "red"; //$NON-NLS-1$ 789 } else { 790 Main.main.undoRedo.add(new ChangePropertyCommand(node, 791 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 792 colour = "green"; //$NON-NLS-1$ 793 } 794 break; 795 case LAT_FLOAT: 796 Main.main.undoRedo.add(new ChangePropertyCommand(node, 797 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 798 if (getRegion() == IALA_A) { 799 Main.main.undoRedo.add(new ChangePropertyCommand(node, 800 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 801 colour = "red"; //$NON-NLS-1$ 802 } else { 803 Main.main.undoRedo.add(new ChangePropertyCommand(node, 804 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 805 colour = "green"; //$NON-NLS-1$ 806 } 807 break; 808 } 809 shape = "cylinder"; //$NON-NLS-1$ 810 break; 811 812 case STARBOARD_HAND: 813 switch (getStyleIndex()) { 814 case LAT_CONE: 815 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 816 Main.main.undoRedo.add(new ChangePropertyCommand(node, 817 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 818 break; 819 case LAT_PILLAR: 820 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 821 Main.main.undoRedo.add(new ChangePropertyCommand(node, 822 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 823 break; 824 case LAT_SPAR: 825 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 826 Main.main.undoRedo.add(new ChangePropertyCommand(node, 827 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 828 break; 829 case LAT_BEACON: 830 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 831 Main.main.undoRedo.add(new ChangePropertyCommand(node, 832 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 833 break; 834 case LAT_TOWER: 835 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 836 Main.main.undoRedo.add(new ChangePropertyCommand(node, 837 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 838 break; 839 case LAT_FLOAT: 840 super.saveSign("light_float"); //$NON-NLS-1$ 841 break; 842 case LAT_PERCH: 843 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 844 Main.main.undoRedo.add(new ChangePropertyCommand(node, 845 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 846 break; 847 default: 848 } 849 switch (getStyleIndex()) { 850 case LAT_CAN: 851 case LAT_PILLAR: 852 case LAT_SPAR: 853 Main.main.undoRedo.add(new ChangePropertyCommand(node, 854 "seamark:buoy_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 855 if (getRegion() == IALA_A) { 856 Main.main.undoRedo.add(new ChangePropertyCommand(node, 857 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 858 colour = "green"; //$NON-NLS-1$ 859 } else { 860 Main.main.undoRedo.add(new ChangePropertyCommand(node, 861 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 862 colour = "red"; //$NON-NLS-1$ 863 } 864 break; 865 case LAT_BEACON: 866 case LAT_TOWER: 867 Main.main.undoRedo.add(new ChangePropertyCommand(node, 868 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 869 if (getRegion() == IALA_A) { 870 Main.main.undoRedo.add(new ChangePropertyCommand(node, 871 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 872 colour = "green"; //$NON-NLS-1$ 873 } else { 874 Main.main.undoRedo.add(new ChangePropertyCommand(node, 875 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 876 colour = "red"; //$NON-NLS-1$ 877 } 878 break; 879 case LAT_FLOAT: 880 if (getRegion() == IALA_A) { 881 Main.main.undoRedo.add(new ChangePropertyCommand(node, 882 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 883 colour = "green"; //$NON-NLS-1$ 884 } else { 885 Main.main.undoRedo.add(new ChangePropertyCommand(node, 886 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 887 colour = "red"; //$NON-NLS-1$ 888 } 889 break; 890 case LAT_PERCH: 891 Main.main.undoRedo.add(new ChangePropertyCommand(node, 892 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 893 break; 894 } 895 shape = "cone, point up"; //$NON-NLS-1$ 896 break; 897 898 case PREF_STARBOARD_HAND: 899 switch (getStyleIndex()) { 900 case LAT_CONE: 901 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 902 Main.main.undoRedo.add(new ChangePropertyCommand(node, 903 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 904 break; 905 case LAT_PILLAR: 906 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 907 Main.main.undoRedo.add(new ChangePropertyCommand(node, 908 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 909 break; 910 case LAT_SPAR: 911 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 912 Main.main.undoRedo.add(new ChangePropertyCommand(node, 913 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 914 break; 915 case LAT_BEACON: 916 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 917 Main.main.undoRedo.add(new ChangePropertyCommand(node, 918 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 919 break; 920 case LAT_TOWER: 921 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 922 Main.main.undoRedo.add(new ChangePropertyCommand(node, 923 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 924 break; 925 case LAT_FLOAT: 926 super.saveSign("light_float"); //$NON-NLS-1$ 927 break; 928 default: 929 } 930 switch (getStyleIndex()) { 931 case LAT_CAN: 932 case LAT_PILLAR: 933 case LAT_SPAR: 934 Main.main.undoRedo.add(new ChangePropertyCommand(node, 935 "seamark:buoy_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 936 Main.main.undoRedo.add(new ChangePropertyCommand(node, 937 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 938 if (getRegion() == IALA_A) { 939 Main.main.undoRedo.add(new ChangePropertyCommand(node, 940 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 941 colour = "green"; //$NON-NLS-1$ 942 } else { 943 Main.main.undoRedo.add(new ChangePropertyCommand(node, 944 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 945 colour = "red"; //$NON-NLS-1$ 946 } 947 break; 948 case LAT_BEACON: 949 case LAT_TOWER: 950 Main.main.undoRedo.add(new ChangePropertyCommand(node, 951 "seamark:beacon_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 952 Main.main.undoRedo.add(new ChangePropertyCommand(node, 953 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 954 if (getRegion() == IALA_A) { 955 Main.main.undoRedo.add(new ChangePropertyCommand(node, 956 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 957 colour = "green"; //$NON-NLS-1$ 958 } else { 959 Main.main.undoRedo.add(new ChangePropertyCommand(node, 960 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 961 colour = "red"; //$NON-NLS-1$ 962 } 963 break; 964 case LAT_FLOAT: 965 Main.main.undoRedo.add(new ChangePropertyCommand(node, 966 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 967 if (getRegion() == IALA_A) { 968 Main.main.undoRedo.add(new ChangePropertyCommand(node, 969 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 970 colour = "green"; //$NON-NLS-1$ 971 } else { 972 Main.main.undoRedo.add(new ChangePropertyCommand(node, 973 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 974 colour = "red"; //$NON-NLS-1$ 975 } 976 break; 977 } 978 shape = "cone, point up"; //$NON-NLS-1$ 979 break; 980 981 default: 982 } 983 saveTopMarkData(shape, colour); 984 saveLightData(); 985 saveRadarFogData(); 986 987 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 988 } 989 990 public void setLightColour() { 991 if (getRegion() == IALA_A) { 992 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 993 super.setLightColour("R"); //$NON-NLS-1$ 994 else 995 super.setLightColour("G"); //$NON-NLS-1$ 996 } else { 997 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 998 super.setLightColour("G"); //$NON-NLS-1$ 999 else 1000 super.setLightColour("R"); //$NON-NLS-1$ 1001 } 1002 } 1003 1004 public void setLightColour(String str) { 1005 int cat = getBuoyIndex(); 1006 1007 if (str == null) { 1008 return; 1009 } 1010 1011 switch (cat) { 1012 case PORT_HAND: 1013 case PREF_PORT_HAND: 1014 if (getRegion() == IALA_A) { 1015 if (str.equals("red")) { //$NON-NLS-1$ 1016 setFired(true); 1017 super.setLightColour("R"); //$NON-NLS-1$ 1018 } else { 1019 super.setLightColour(""); //$NON-NLS-1$ 1020 } 1021 } else { 1022 if (str.equals("green")) { //$NON-NLS-1$ 1023 setFired(true); 1024 super.setLightColour("G"); //$NON-NLS-1$ 1025 } else { 1026 super.setLightColour(""); //$NON-NLS-1$ 1027 } 1028 } 1029 break; 1030 1031 case STARBOARD_HAND: 1032 case PREF_STARBOARD_HAND: 1033 if (getRegion() == IALA_A) { 1034 if (str.equals("green")) { //$NON-NLS-1$ 1035 setFired(true); 1036 super.setLightColour("G"); //$NON-NLS-1$ 1037 } else { 1038 super.setLightColour(""); //$NON-NLS-1$ 1039 } 1040 } else { 1041 if (str.equals("red")) { //$NON-NLS-1$ 1042 setFired(true); 1043 super.setLightColour("R"); //$NON-NLS-1$ 1044 } else { 1045 super.setLightColour(""); //$NON-NLS-1$ 1046 } 1047 } 1048 break; 1049 default: 1050 } 1051 } 1052 1052 1053 1053 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java ¶
r23174 r23193 17 17 18 18 public class BuoyNota extends Buoy { 19 public BuoyNota(SmpDialogAction dia, Node node) {20 super(dia);19 public BuoyNota(SmpDialogAction dia, Node node) { 20 super(dia); 21 21 22 Map<String, String> keys;23 keys = node.getKeys();24 setNode(node);22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 25 26 resetMask();26 resetMask(); 27 27 28 dlg.cbM01TypeOfMark.setSelectedIndex(LIGHT);28 dlg.cbM01TypeOfMark.setSelectedIndex(LIGHT); 29 29 30 dlg.cbM01CatOfMark.setEnabled(true);31 dlg.cbM01CatOfMark.setVisible(true);32 dlg.lM01CatOfMark.setVisible(true);30 dlg.cbM01CatOfMark.setEnabled(true); 31 dlg.cbM01CatOfMark.setVisible(true); 32 dlg.lM01CatOfMark.setVisible(true); 33 33 34 dlg.cbM01CatOfMark.removeAllItems();35 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$36 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.206")); //$NON-NLS-1$37 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.207")); //$NON-NLS-1$38 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.208")); //$NON-NLS-1$39 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.209")); //$NON-NLS-1$34 dlg.cbM01CatOfMark.removeAllItems(); 35 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 36 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.206")); //$NON-NLS-1$ 37 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.207")); //$NON-NLS-1$ 38 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.208")); //$NON-NLS-1$ 39 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.209")); //$NON-NLS-1$ 40 40 41 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$41 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 42 42 43 if (keys.containsKey("name")) //$NON-NLS-1$44 setName(keys.get("name")); //$NON-NLS-1$43 if (keys.containsKey("name")) //$NON-NLS-1$ 44 setName(keys.get("name")); //$NON-NLS-1$ 45 45 46 if (keys.containsKey("seamark:name")) //$NON-NLS-1$47 setName(keys.get("seamark:name")); //$NON-NLS-1$46 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 47 setName(keys.get("seamark:name")); //$NON-NLS-1$ 48 48 49 if (keys.containsKey("seamark:landmark:name")) //$NON-NLS-1$50 setName(keys.get("seamark:landmark:name")); //$NON-NLS-1$51 else if (keys.containsKey("seamark:light_major:name")) //$NON-NLS-1$52 setName(keys.get("seamark:light_major:name")); //$NON-NLS-1$53 else if (keys.containsKey("seamark:light_minor:name")) //$NON-NLS-1$54 setName(keys.get("seamark:light_minor:name")); //$NON-NLS-1$55 else if (keys.containsKey("seamark:light_vessel:name")) //$NON-NLS-1$56 setName(keys.get("seamark:light_vessel:name")); //$NON-NLS-1$49 if (keys.containsKey("seamark:landmark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:landmark:name")); //$NON-NLS-1$ 51 else if (keys.containsKey("seamark:light_major:name")) //$NON-NLS-1$ 52 setName(keys.get("seamark:light_major:name")); //$NON-NLS-1$ 53 else if (keys.containsKey("seamark:light_minor:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:light_minor:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:light_vessel:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:light_vessel:name")); //$NON-NLS-1$ 57 57 58 if (keys.containsKey("seamark:type")) { //$NON-NLS-1$59 String type = keys.get("seamark:type"); //$NON-NLS-1$60 if (type.equals("landmark"))61 setBuoyIndex(LIGHT_HOUSE);62 else if (type.equals("light_major"))63 setBuoyIndex(LIGHT_MAJOR);64 else if (type.equals("light_minor"))65 setBuoyIndex(LIGHT_MINOR);66 else if (type.equals("light_vessel"))67 setBuoyIndex(LIGHT_VESSEL);68 }58 if (keys.containsKey("seamark:type")) { //$NON-NLS-1$ 59 String type = keys.get("seamark:type"); //$NON-NLS-1$ 60 if (type.equals("landmark")) 61 setBuoyIndex(LIGHT_HOUSE); 62 else if (type.equals("light_major")) 63 setBuoyIndex(LIGHT_MAJOR); 64 else if (type.equals("light_minor")) 65 setBuoyIndex(LIGHT_MINOR); 66 else if (type.equals("light_vessel")) 67 setBuoyIndex(LIGHT_VESSEL); 68 } 69 69 70 refreshLights();71 parseLights(keys);72 parseFogRadar(keys);73 setTopMark(false);74 setFired(true);70 refreshLights(); 71 parseLights(keys); 72 parseFogRadar(keys); 73 setTopMark(false); 74 setFired(true); 75 75 76 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex());77 dlg.tfM01Name.setText(getName());78 dlg.cM01Fired.setEnabled(false);79 dlg.cM01Fired.setSelected(true);80 }76 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 77 dlg.tfM01Name.setText(getName()); 78 dlg.cM01Fired.setEnabled(false); 79 dlg.cM01Fired.setSelected(true); 80 } 81 81 82 public boolean isValid() {83 return (getBuoyIndex() > 0);84 }82 public boolean isValid() { 83 return (getBuoyIndex() > 0); 84 } 85 85 86 public void paintSign() {87 if (dlg.paintlock)88 return;89 super.paintSign();86 public void paintSign() { 87 if (dlg.paintlock) 88 return; 89 super.paintSign(); 90 90 91 dlg.sM01StatusBar.setText(getErrMsg());91 dlg.sM01StatusBar.setText(getErrMsg()); 92 92 93 if (isValid()) {94 dlg.cM01Radar.setVisible(true);95 dlg.cM01Racon.setVisible(true);96 dlg.cM01Fog.setVisible(true);93 if (isValid()) { 94 dlg.cM01Radar.setVisible(true); 95 dlg.cM01Racon.setVisible(true); 96 dlg.cM01Fog.setVisible(true); 97 97 98 dlg.rbM01Fired1.setVisible(true);99 dlg.rbM01FiredN.setVisible(true);100 dlg.lM01Height.setVisible(true);101 dlg.tfM01Height.setVisible(true);102 dlg.lM01Range.setVisible(true);103 dlg.tfM01Range.setVisible(true);98 dlg.rbM01Fired1.setVisible(true); 99 dlg.rbM01FiredN.setVisible(true); 100 dlg.lM01Height.setVisible(true); 101 dlg.tfM01Height.setVisible(true); 102 dlg.lM01Range.setVisible(true); 103 dlg.tfM01Range.setVisible(true); 104 104 105 switch (getBuoyIndex()) {106 case SeaMark.LIGHT_HOUSE:107 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(108 "/images/Light_House.png"))); //$NON-NLS-1$109 break;105 switch (getBuoyIndex()) { 106 case SeaMark.LIGHT_HOUSE: 107 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 108 "/images/Light_House.png"))); //$NON-NLS-1$ 109 break; 110 110 111 case SeaMark.LIGHT_MAJOR:112 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(113 "/images/Light_Major.png"))); //$NON-NLS-1$114 break;111 case SeaMark.LIGHT_MAJOR: 112 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 113 "/images/Light_Major.png"))); //$NON-NLS-1$ 114 break; 115 115 116 case SeaMark.LIGHT_MINOR:117 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(118 "/images/Light_Minor.png"))); //$NON-NLS-1$119 break;116 case SeaMark.LIGHT_MINOR: 117 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 118 "/images/Light_Minor.png"))); //$NON-NLS-1$ 119 break; 120 120 121 case SeaMark.LIGHT_VESSEL:122 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(123 "/images/Major_Float.png"))); //$NON-NLS-1$124 break;121 case SeaMark.LIGHT_VESSEL: 122 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 123 "/images/Major_Float.png"))); //$NON-NLS-1$ 124 break; 125 125 126 default:127 }128 }129 }126 default: 127 } 128 } 129 } 130 130 131 public void saveSign() {132 Node node = getNode();131 public void saveSign() { 132 Node node = getNode(); 133 133 134 if (node == null) {135 return;136 }134 if (node == null) { 135 return; 136 } 137 137 138 switch (getBuoyIndex()) {139 case LIGHT_HOUSE:140 super.saveSign("landmark"); //$NON-NLS-1$141 break;142 case LIGHT_MAJOR:143 super.saveSign("light_major"); //$NON-NLS-1$144 break;145 case LIGHT_MINOR:146 super.saveSign("light_minor"); //$NON-NLS-1$147 break;148 case LIGHT_VESSEL:149 super.saveSign("light_vessel"); //$NON-NLS-1$150 break;151 default:152 }153 saveLightData(); //$NON-NLS-1$154 saveRadarFogData();155 }138 switch (getBuoyIndex()) { 139 case LIGHT_HOUSE: 140 super.saveSign("landmark"); //$NON-NLS-1$ 141 break; 142 case LIGHT_MAJOR: 143 super.saveSign("light_major"); //$NON-NLS-1$ 144 break; 145 case LIGHT_MINOR: 146 super.saveSign("light_minor"); //$NON-NLS-1$ 147 break; 148 case LIGHT_VESSEL: 149 super.saveSign("light_vessel"); //$NON-NLS-1$ 150 break; 151 default: 152 } 153 saveLightData(); //$NON-NLS-1$ 154 saveRadarFogData(); 155 } 156 156 157 public void setLightColour() {158 }157 public void setLightColour() { 158 } 159 159 160 160 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java ¶
r23179 r23193 17 17 18 18 public class BuoySaw extends Buoy { 19 public BuoySaw(SmpDialogAction dia, Node node) {20 super(dia);21 22 String str;23 Map<String, String> keys;24 keys = node.getKeys();25 setNode(node);26 27 resetMask();28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER);30 31 dlg.cbM01StyleOfMark.removeAllItems();32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$38 dlg.cbM01StyleOfMark.setVisible(true);39 dlg.lM01StyleOfMark.setVisible(true);40 41 setBuoyIndex(SAFE_WATER);42 setColour(SeaMark.RED_WHITE);43 setLightColour("W"); //$NON-NLS-1$44 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$45 46 if (keys.containsKey("name")) //$NON-NLS-1$47 setName(keys.get("name")); //$NON-NLS-1$48 49 if (keys.containsKey("seamark:name")) //$NON-NLS-1$50 setName(keys.get("seamark:name")); //$NON-NLS-1$51 52 if (keys.containsKey("seamark:buoy_safe_water:name")) //$NON-NLS-1$53 setName(keys.get("seamark:buoy_safe_water:name")); //$NON-NLS-1$54 else if (keys.containsKey("seamark:beacon_safe_water:name")) //$NON-NLS-1$55 setName(keys.get("seamark:beacon_safe_water:name")); //$NON-NLS-1$56 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$57 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$58 59 if (keys.containsKey("seamark:buoy_safe_water:shape")) { //$NON-NLS-1$60 str = keys.get("seamark:buoy_safe_water:shape"); //$NON-NLS-1$61 62 if (str.equals("pillar")) //$NON-NLS-1$63 setStyleIndex(SAFE_PILLAR);64 else if (str.equals("spar")) //$NON-NLS-1$65 setStyleIndex(SAFE_SPAR);66 else if (str.equals("sphere")) //$NON-NLS-1$67 setStyleIndex(SAFE_SPHERE);68 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$69 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$70 setStyleIndex(SAFE_FLOAT);71 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$72 && (keys.get("seamark:type").equals("beacon_safe_water"))) { //$NON-NLS-1$ //$NON-NLS-2$73 setStyleIndex(SAFE_BEACON);74 }75 76 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount())77 setStyleIndex(0);78 79 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$80 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$81 setTopMark(true);82 }83 84 refreshLights();85 parseLights(keys);86 parseFogRadar(keys);87 88 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());89 dlg.tfM01Name.setText(getName());90 dlg.cM01TopMark.setSelected(hasTopMark());91 }92 93 public void refreshLights() {94 dlg.cbM01Kennung.removeAllItems();95 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$96 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$97 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$98 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$99 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$100 dlg.cbM01Kennung.setSelectedIndex(0);101 }102 103 public boolean isValid() {104 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);105 }106 107 public void paintSign() {108 if (dlg.paintlock)109 return;110 super.paintSign();111 112 dlg.sM01StatusBar.setText(getErrMsg());113 114 if (isValid()) {115 dlg.tfM01Name.setEnabled(true);116 dlg.tfM01Name.setText(getName());117 dlg.cM01TopMark.setEnabled(true);118 dlg.cM01TopMark.setVisible(true);119 dlg.cM01Radar.setVisible(true);120 dlg.cM01Racon.setVisible(true);121 dlg.cM01Fog.setVisible(true);122 dlg.cM01Fired.setVisible(true);123 dlg.cM01Fired.setEnabled(true);124 dlg.cbM01Colour.setVisible(false);125 dlg.lM01Colour.setVisible(false);126 dlg.rbM01Fired1.setVisible(false);127 dlg.rbM01FiredN.setVisible(false);128 dlg.lM01Height.setVisible(false);129 dlg.tfM01Height.setVisible(false);130 dlg.lM01Range.setVisible(false);131 dlg.tfM01Range.setVisible(false);132 133 if (isFired()) {134 switch (getStyleIndex()) {135 case SPEC_FLOAT:136 dlg.lM01Height.setVisible(true);137 dlg.tfM01Height.setVisible(true);138 dlg.lM01Range.setVisible(true);139 dlg.tfM01Range.setVisible(true);140 break;141 case SPEC_BEACON:142 case SPEC_TOWER:143 dlg.rbM01Fired1.setVisible(true);144 dlg.rbM01FiredN.setVisible(true);145 dlg.lM01Height.setVisible(true);146 dlg.tfM01Height.setVisible(true);147 dlg.lM01Range.setVisible(true);148 dlg.tfM01Range.setVisible(true);149 break;150 default:151 }152 }153 154 String image = "/images/Safe_Water"; //$NON-NLS-1$155 156 switch (getStyleIndex()) {157 case SAFE_PILLAR:158 image += "_Pillar"; //$NON-NLS-1$159 break;160 case SAFE_SPAR:161 image += "_Spar"; //$NON-NLS-1$162 break;163 case SAFE_SPHERE:164 image += "_Sphere"; //$NON-NLS-1$165 break;166 case SAFE_BEACON:167 image += "_Beacon"; //$NON-NLS-1$168 break;169 case SAFE_FLOAT:170 image += "_Float"; //$NON-NLS-1$171 break;172 default:173 }174 175 if (!image.equals("/images/Safe_Water")) { //$NON-NLS-1$176 if (hasTopMark())177 image += "_Sphere"; //$NON-NLS-1$178 image += ".png"; //$NON-NLS-1$179 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));180 } else181 dlg.lM01Icon.setIcon(null);182 }183 }184 185 public void saveSign() {186 Node node = getNode();187 188 if (node == null) {189 return;190 }191 192 switch (getStyleIndex()) {193 case SAFE_PILLAR:194 super.saveSign("buoy_safe_water"); //$NON-NLS-1$195 Main.main.undoRedo.add(new ChangePropertyCommand(node,196 "seamark:buoy_safe_water:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$197 break;198 case SAFE_SPAR:199 super.saveSign("buoy_safe_water"); //$NON-NLS-1$200 Main.main.undoRedo.add(new ChangePropertyCommand(node,201 "seamark:buoy_safe_water:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$202 break;203 case SAFE_SPHERE:204 super.saveSign("buoy_safe_water"); //$NON-NLS-1$205 Main.main.undoRedo.add(new ChangePropertyCommand(node,206 "seamark:buoy_safe_water:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$207 break;208 case SAFE_BEACON:209 super.saveSign("beacon_safe_water"); //$NON-NLS-1$210 break;211 case SAFE_FLOAT:212 super.saveSign("light_float"); //$NON-NLS-1$213 break;214 default:215 }216 217 switch (getStyleIndex()) {218 case SAFE_PILLAR:219 case SAFE_SPAR:220 case SAFE_SPHERE:221 Main.main.undoRedo.add(new ChangePropertyCommand(node,222 "seamark:buoy_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$223 Main.main.undoRedo.add(new ChangePropertyCommand(node,224 "seamark:buoy_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$225 break;226 case SAFE_BEACON:227 Main.main.undoRedo.add(new ChangePropertyCommand(node,228 "seamark:beacon_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$229 Main.main.undoRedo.add(new ChangePropertyCommand(node,230 "seamark:beacon_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$231 break;232 case SAFE_FLOAT:233 Main.main.undoRedo.add(new ChangePropertyCommand(node,234 "seamark:light_float:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$235 Main.main.undoRedo.add(new ChangePropertyCommand(node,236 "seamark:light_float:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$237 break;238 default:239 }240 saveTopMarkData("spherical", "red"); //$NON-NLS-1$ //$NON-NLS-2$241 saveLightData(); //$NON-NLS-1$242 saveRadarFogData();243 }244 245 public void setLightColour() {246 super.setLightColour("W"); //$NON-NLS-1$247 }19 public BuoySaw(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(SAFE_WATER); 42 setColour(SeaMark.RED_WHITE); 43 setLightColour("W"); //$NON-NLS-1$ 44 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 45 46 if (keys.containsKey("name")) //$NON-NLS-1$ 47 setName(keys.get("name")); //$NON-NLS-1$ 48 49 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:name")); //$NON-NLS-1$ 51 52 if (keys.containsKey("seamark:buoy_safe_water:name")) //$NON-NLS-1$ 53 setName(keys.get("seamark:buoy_safe_water:name")); //$NON-NLS-1$ 54 else if (keys.containsKey("seamark:beacon_safe_water:name")) //$NON-NLS-1$ 55 setName(keys.get("seamark:beacon_safe_water:name")); //$NON-NLS-1$ 56 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_safe_water:shape")) { //$NON-NLS-1$ 60 str = keys.get("seamark:buoy_safe_water:shape"); //$NON-NLS-1$ 61 62 if (str.equals("pillar")) //$NON-NLS-1$ 63 setStyleIndex(SAFE_PILLAR); 64 else if (str.equals("spar")) //$NON-NLS-1$ 65 setStyleIndex(SAFE_SPAR); 66 else if (str.equals("sphere")) //$NON-NLS-1$ 67 setStyleIndex(SAFE_SPHERE); 68 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 69 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 70 setStyleIndex(SAFE_FLOAT); 71 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 72 && (keys.get("seamark:type").equals("beacon_safe_water"))) { //$NON-NLS-1$ //$NON-NLS-2$ 73 setStyleIndex(SAFE_BEACON); 74 } 75 76 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 77 setStyleIndex(0); 78 79 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 80 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 81 setTopMark(true); 82 } 83 84 refreshLights(); 85 parseLights(keys); 86 parseFogRadar(keys); 87 88 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 89 dlg.tfM01Name.setText(getName()); 90 dlg.cM01TopMark.setSelected(hasTopMark()); 91 } 92 93 public void refreshLights() { 94 dlg.cbM01Kennung.removeAllItems(); 95 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 96 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 97 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 98 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 99 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 100 dlg.cbM01Kennung.setSelectedIndex(0); 101 } 102 103 public boolean isValid() { 104 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 105 } 106 107 public void paintSign() { 108 if (dlg.paintlock) 109 return; 110 super.paintSign(); 111 112 dlg.sM01StatusBar.setText(getErrMsg()); 113 114 if (isValid()) { 115 dlg.tfM01Name.setEnabled(true); 116 dlg.tfM01Name.setText(getName()); 117 dlg.cM01TopMark.setEnabled(true); 118 dlg.cM01TopMark.setVisible(true); 119 dlg.cM01Radar.setVisible(true); 120 dlg.cM01Racon.setVisible(true); 121 dlg.cM01Fog.setVisible(true); 122 dlg.cM01Fired.setVisible(true); 123 dlg.cM01Fired.setEnabled(true); 124 dlg.cbM01Colour.setVisible(false); 125 dlg.lM01Colour.setVisible(false); 126 dlg.rbM01Fired1.setVisible(false); 127 dlg.rbM01FiredN.setVisible(false); 128 dlg.lM01Height.setVisible(false); 129 dlg.tfM01Height.setVisible(false); 130 dlg.lM01Range.setVisible(false); 131 dlg.tfM01Range.setVisible(false); 132 133 if (isFired()) { 134 switch (getStyleIndex()) { 135 case SPEC_FLOAT: 136 dlg.lM01Height.setVisible(true); 137 dlg.tfM01Height.setVisible(true); 138 dlg.lM01Range.setVisible(true); 139 dlg.tfM01Range.setVisible(true); 140 break; 141 case SPEC_BEACON: 142 case SPEC_TOWER: 143 dlg.rbM01Fired1.setVisible(true); 144 dlg.rbM01FiredN.setVisible(true); 145 dlg.lM01Height.setVisible(true); 146 dlg.tfM01Height.setVisible(true); 147 dlg.lM01Range.setVisible(true); 148 dlg.tfM01Range.setVisible(true); 149 break; 150 default: 151 } 152 } 153 154 String image = "/images/Safe_Water"; //$NON-NLS-1$ 155 156 switch (getStyleIndex()) { 157 case SAFE_PILLAR: 158 image += "_Pillar"; //$NON-NLS-1$ 159 break; 160 case SAFE_SPAR: 161 image += "_Spar"; //$NON-NLS-1$ 162 break; 163 case SAFE_SPHERE: 164 image += "_Sphere"; //$NON-NLS-1$ 165 break; 166 case SAFE_BEACON: 167 image += "_Beacon"; //$NON-NLS-1$ 168 break; 169 case SAFE_FLOAT: 170 image += "_Float"; //$NON-NLS-1$ 171 break; 172 default: 173 } 174 175 if (!image.equals("/images/Safe_Water")) { //$NON-NLS-1$ 176 if (hasTopMark()) 177 image += "_Sphere"; //$NON-NLS-1$ 178 image += ".png"; //$NON-NLS-1$ 179 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 180 } else 181 dlg.lM01Icon.setIcon(null); 182 } 183 } 184 185 public void saveSign() { 186 Node node = getNode(); 187 188 if (node == null) { 189 return; 190 } 191 192 switch (getStyleIndex()) { 193 case SAFE_PILLAR: 194 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 195 Main.main.undoRedo.add(new ChangePropertyCommand(node, 196 "seamark:buoy_safe_water:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 197 break; 198 case SAFE_SPAR: 199 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 200 Main.main.undoRedo.add(new ChangePropertyCommand(node, 201 "seamark:buoy_safe_water:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 202 break; 203 case SAFE_SPHERE: 204 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 205 Main.main.undoRedo.add(new ChangePropertyCommand(node, 206 "seamark:buoy_safe_water:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 207 break; 208 case SAFE_BEACON: 209 super.saveSign("beacon_safe_water"); //$NON-NLS-1$ 210 break; 211 case SAFE_FLOAT: 212 super.saveSign("light_float"); //$NON-NLS-1$ 213 break; 214 default: 215 } 216 217 switch (getStyleIndex()) { 218 case SAFE_PILLAR: 219 case SAFE_SPAR: 220 case SAFE_SPHERE: 221 Main.main.undoRedo.add(new ChangePropertyCommand(node, 222 "seamark:buoy_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 223 Main.main.undoRedo.add(new ChangePropertyCommand(node, 224 "seamark:buoy_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 225 break; 226 case SAFE_BEACON: 227 Main.main.undoRedo.add(new ChangePropertyCommand(node, 228 "seamark:beacon_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:beacon_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 231 break; 232 case SAFE_FLOAT: 233 Main.main.undoRedo.add(new ChangePropertyCommand(node, 234 "seamark:light_float:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 235 Main.main.undoRedo.add(new ChangePropertyCommand(node, 236 "seamark:light_float:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 237 break; 238 default: 239 } 240 saveTopMarkData("spherical", "red"); //$NON-NLS-1$ //$NON-NLS-2$ 241 saveLightData(); //$NON-NLS-1$ 242 saveRadarFogData(); 243 } 244 245 public void setLightColour() { 246 super.setLightColour("W"); //$NON-NLS-1$ 247 } 248 248 249 249 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java ¶
r23179 r23193 17 17 18 18 public class BuoySpec extends Buoy { 19 public BuoySpec(SmpDialogAction dia, Node node) {20 super(dia);21 22 String str;23 Map<String, String> keys;24 keys = node.getKeys();25 setNode(node);26 27 resetMask();28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE);30 31 dlg.cbM01StyleOfMark.removeAllItems();32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$38 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$39 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$40 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$41 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.09")); //$NON-NLS-1$42 dlg.cbM01StyleOfMark.setVisible(true);43 dlg.lM01StyleOfMark.setVisible(true);44 45 dlg.cbM01TopMark.removeAllItems();46 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212"));47 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$48 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$49 50 dlg.cM01TopMark.setEnabled(true);51 52 setBuoyIndex(SPECIAL_PURPOSE);53 setColour(SeaMark.YELLOW);54 setLightColour("W"); //$NON-NLS-1$55 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$56 57 if (keys.containsKey("name")) //$NON-NLS-1$58 setName(keys.get("name")); //$NON-NLS-1$59 60 if (keys.containsKey("seamark:name")) //$NON-NLS-1$61 setName(keys.get("seamark:name")); //$NON-NLS-1$62 63 if (keys.containsKey("seamark:buoy_special_purpose:name")) //$NON-NLS-1$64 setName(keys.get("seamark:buoy_special_purpose:name")); //$NON-NLS-1$65 else if (keys.containsKey("seamark:beacon_special_purpose:name")) //$NON-NLS-1$66 setName(keys.get("seamark:beacon_special_purpose:name")); //$NON-NLS-1$67 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$68 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$69 70 if (keys.containsKey("seamark:buoy_special_purpose:shape")) { //$NON-NLS-1$71 str = keys.get("seamark:buoy_special_purpose:shape"); //$NON-NLS-1$72 73 if (str.equals("pillar")) //$NON-NLS-1$74 setStyleIndex(SPEC_PILLAR);75 else if (str.equals("can")) //$NON-NLS-1$76 setStyleIndex(SPEC_CAN);77 else if (str.equals("conical")) //$NON-NLS-1$78 setStyleIndex(SPEC_CONE);79 else if (str.equals("spar")) //$NON-NLS-1$80 setStyleIndex(SPEC_SPAR);81 else if (str.equals("sphere")) //$NON-NLS-1$82 setStyleIndex(SPEC_SPHERE);83 else if (str.equals("barrel")) //$NON-NLS-1$84 setStyleIndex(SPEC_BARREL);85 }86 87 if (keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$88 str = keys.get("seamark:beacon_special_purpose:shape"); //$NON-NLS-1$89 if (str.equals("tower")) //$NON-NLS-1$90 setStyleIndex(SPEC_TOWER);91 else92 setStyleIndex(SPEC_BEACON);93 }94 95 if (keys.containsKey("seamark:light_float:colour")) {96 setStyleIndex(SPEC_FLOAT);97 }98 99 if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals( //$NON-NLS-1$ //$NON-NLS-2$100 "beacon_special_purpose")) //$NON-NLS-1$101 || keys.containsKey("seamark:beacon_special_purpose:colour") //$NON-NLS-1$102 || keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$103 if (keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$104 && keys.get("seamark:beacon_special_purpose:shape").equals("tower")) //$NON-NLS-1$ //$NON-NLS-2$105 setStyleIndex(SPEC_TOWER);106 else107 setStyleIndex(SPEC_BEACON);108 } else if (keys.containsKey("seamark:light_float:colour") //$NON-NLS-1$109 && keys.get("seamark:light_float:colour").equals("yellow")) //$NON-NLS-1$ //$NON-NLS-2$110 setStyleIndex(SPEC_FLOAT);111 112 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount())113 setStyleIndex(0);114 115 keys = node.getKeys();116 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$117 str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$118 119 if (str.equals("x-shape")) { //$NON-NLS-1$120 setTopMark(true);121 }122 }123 124 refreshLights();125 parseLights(keys);126 parseFogRadar(keys);127 128 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex());129 dlg.tfM01Name.setText(getName());130 dlg.cM01TopMark.setSelected(hasTopMark());131 }132 133 public void setStyleIndex(int styleIndex) {134 super.setStyleIndex(styleIndex);135 if (styleIndex == SPEC_BARREL) {136 dlg.cM01Fired.setSelected(false);137 dlg.cM01Fired.setEnabled(false);138 dlg.cM01TopMark.setEnabled(true);139 } else {140 dlg.cM01Fired.setEnabled(true);141 dlg.cM01TopMark.setEnabled(true);142 }143 }144 145 public boolean isValid() {146 return (getBuoyIndex() > 0) && (getStyleIndex() > 0);147 }148 149 public void paintSign() {150 if (dlg.paintlock)151 return;152 super.paintSign();153 154 dlg.sM01StatusBar.setText(getErrMsg());155 156 if (isValid()) {157 dlg.tfM01Name.setEnabled(true);158 dlg.tfM01Name.setText(getName());159 dlg.cM01Radar.setVisible(true);160 dlg.cM01Racon.setVisible(true);161 dlg.cM01TopMark.setEnabled(true);162 dlg.cM01TopMark.setVisible(true);163 if (hasTopMark()) {164 dlg.cbM01TopMark.setEnabled(true);165 dlg.cbM01TopMark.setVisible(true);166 } else {167 dlg.cbM01TopMark.setVisible(false);168 }169 dlg.cM01Fog.setVisible(true);170 dlg.cM01Fired.setVisible(true);171 dlg.cM01Fired.setEnabled(true);172 dlg.cbM01Colour.setVisible(false);173 dlg.lM01Colour.setVisible(false);174 dlg.rbM01Fired1.setVisible(false);175 dlg.rbM01FiredN.setVisible(false);176 dlg.lM01Height.setVisible(false);177 dlg.tfM01Height.setVisible(false);178 dlg.lM01Range.setVisible(false);179 dlg.tfM01Range.setVisible(false);180 181 if (isFired()) {182 switch (getStyleIndex()) {183 case SPEC_FLOAT:184 dlg.lM01Height.setVisible(true);185 dlg.tfM01Height.setVisible(true);186 dlg.lM01Range.setVisible(true);187 dlg.tfM01Range.setVisible(true);188 break;189 case SPEC_BEACON:190 case SPEC_TOWER:191 dlg.rbM01Fired1.setVisible(true);192 dlg.rbM01FiredN.setVisible(true);193 dlg.lM01Height.setVisible(true);194 dlg.tfM01Height.setVisible(true);195 dlg.lM01Range.setVisible(true);196 dlg.tfM01Range.setVisible(true);197 break;198 default:199 }200 }201 202 String image = "/images/Special_Purpose"; //$NON-NLS-1$203 204 switch (getStyleIndex()) {205 case SPEC_PILLAR:206 image += "_Pillar"; //$NON-NLS-1$207 break;208 case SPEC_CAN:209 image += "_Can"; //$NON-NLS-1$210 break;211 case SPEC_CONE:212 image += "_Cone"; //$NON-NLS-1$213 break;214 case SPEC_SPAR:215 image += "_Spar"; //$NON-NLS-1$216 break;217 case SPEC_SPHERE:218 image += "_Sphere"; //$NON-NLS-1$219 break;220 case SPEC_BARREL:221 image += "_Barrel"; //$NON-NLS-1$222 break;223 case SPEC_FLOAT:224 image += "_Float"; //$NON-NLS-1$225 break;226 case SPEC_BEACON:227 image += "_Beacon"; //$NON-NLS-1$228 break;229 case SPEC_TOWER:230 image += "_Tower"; //$NON-NLS-1$231 break;232 default:233 }234 235 if (!image.equals("/images/Special_Purpose")) { //$NON-NLS-1$236 // if (hasTopMark())237 // image += "_CrossY"; //$NON-NLS-1$238 image += ".png"; //$NON-NLS-1$239 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image)));240 } else241 dlg.lM01Icon.setIcon(null);242 }243 }244 245 public void saveSign() {246 Node node = getNode();247 248 if (node == null) {249 return;250 }251 252 switch (getStyleIndex()) {253 case SPEC_PILLAR:254 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$255 Main.main.undoRedo.add(new ChangePropertyCommand(node,256 "seamark:buoy_special_purpose:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$257 Main.main.undoRedo.add(new ChangePropertyCommand(node,258 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$259 break;260 case SPEC_SPAR:261 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$262 Main.main.undoRedo.add(new ChangePropertyCommand(node,263 "seamark:buoy_special_purpose:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$264 Main.main.undoRedo.add(new ChangePropertyCommand(node,265 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$266 break;267 case SPEC_SPHERE:268 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$269 Main.main.undoRedo.add(new ChangePropertyCommand(node,270 "seamark:buoy_special_purpose:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$271 Main.main.undoRedo.add(new ChangePropertyCommand(node,272 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$273 break;274 case SPEC_BARREL:275 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$276 Main.main.undoRedo.add(new ChangePropertyCommand(node,277 "seamark:buoy_special_purpose:shape", "barrel")); //$NON-NLS-1$ //$NON-NLS-2$278 Main.main.undoRedo.add(new ChangePropertyCommand(node,279 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$280 break;281 case SPEC_FLOAT:282 super.saveSign("light_float"); //$NON-NLS-1$283 Main.main.undoRedo.add(new ChangePropertyCommand(node,284 "seamark:light_float:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$285 break;286 case SPEC_BEACON:287 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$288 Main.main.undoRedo.add(new ChangePropertyCommand(node,289 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$290 break;291 case SPEC_TOWER:292 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$293 Main.main.undoRedo.add(new ChangePropertyCommand(node,294 "seamark:beacon_special_purpose:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$295 Main.main.undoRedo.add(new ChangePropertyCommand(node,296 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$297 break;298 default:299 }300 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$301 saveLightData(); //$NON-NLS-1$302 saveRadarFogData();303 }304 305 public void setLightColour() {306 super.setLightColour("W"); //$NON-NLS-1$307 }19 public BuoySpec(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 39 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 40 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.09")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.setVisible(true); 43 dlg.lM01StyleOfMark.setVisible(true); 44 45 dlg.cbM01TopMark.removeAllItems(); 46 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212")); 47 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$ 48 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$ 49 50 dlg.cM01TopMark.setEnabled(true); 51 52 setBuoyIndex(SPECIAL_PURPOSE); 53 setColour(SeaMark.YELLOW); 54 setLightColour("W"); //$NON-NLS-1$ 55 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 56 57 if (keys.containsKey("name")) //$NON-NLS-1$ 58 setName(keys.get("name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:name")); //$NON-NLS-1$ 62 63 if (keys.containsKey("seamark:buoy_special_purpose:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:buoy_special_purpose:name")); //$NON-NLS-1$ 65 else if (keys.containsKey("seamark:beacon_special_purpose:name")) //$NON-NLS-1$ 66 setName(keys.get("seamark:beacon_special_purpose:name")); //$NON-NLS-1$ 67 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 68 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 69 70 if (keys.containsKey("seamark:buoy_special_purpose:shape")) { //$NON-NLS-1$ 71 str = keys.get("seamark:buoy_special_purpose:shape"); //$NON-NLS-1$ 72 73 if (str.equals("pillar")) //$NON-NLS-1$ 74 setStyleIndex(SPEC_PILLAR); 75 else if (str.equals("can")) //$NON-NLS-1$ 76 setStyleIndex(SPEC_CAN); 77 else if (str.equals("conical")) //$NON-NLS-1$ 78 setStyleIndex(SPEC_CONE); 79 else if (str.equals("spar")) //$NON-NLS-1$ 80 setStyleIndex(SPEC_SPAR); 81 else if (str.equals("sphere")) //$NON-NLS-1$ 82 setStyleIndex(SPEC_SPHERE); 83 else if (str.equals("barrel")) //$NON-NLS-1$ 84 setStyleIndex(SPEC_BARREL); 85 } 86 87 if (keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 88 str = keys.get("seamark:beacon_special_purpose:shape"); //$NON-NLS-1$ 89 if (str.equals("tower")) //$NON-NLS-1$ 90 setStyleIndex(SPEC_TOWER); 91 else 92 setStyleIndex(SPEC_BEACON); 93 } 94 95 if (keys.containsKey("seamark:light_float:colour")) { 96 setStyleIndex(SPEC_FLOAT); 97 } 98 99 if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals( //$NON-NLS-1$ //$NON-NLS-2$ 100 "beacon_special_purpose")) //$NON-NLS-1$ 101 || keys.containsKey("seamark:beacon_special_purpose:colour") //$NON-NLS-1$ 102 || keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 103 if (keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 104 && keys.get("seamark:beacon_special_purpose:shape").equals("tower")) //$NON-NLS-1$ //$NON-NLS-2$ 105 setStyleIndex(SPEC_TOWER); 106 else 107 setStyleIndex(SPEC_BEACON); 108 } else if (keys.containsKey("seamark:light_float:colour") //$NON-NLS-1$ 109 && keys.get("seamark:light_float:colour").equals("yellow")) //$NON-NLS-1$ //$NON-NLS-2$ 110 setStyleIndex(SPEC_FLOAT); 111 112 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 113 setStyleIndex(0); 114 115 keys = node.getKeys(); 116 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 117 str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 118 119 if (str.equals("x-shape")) { //$NON-NLS-1$ 120 setTopMark(true); 121 } 122 } 123 124 refreshLights(); 125 parseLights(keys); 126 parseFogRadar(keys); 127 128 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 129 dlg.tfM01Name.setText(getName()); 130 dlg.cM01TopMark.setSelected(hasTopMark()); 131 } 132 133 public void setStyleIndex(int styleIndex) { 134 super.setStyleIndex(styleIndex); 135 if (styleIndex == SPEC_BARREL) { 136 dlg.cM01Fired.setSelected(false); 137 dlg.cM01Fired.setEnabled(false); 138 dlg.cM01TopMark.setEnabled(true); 139 } else { 140 dlg.cM01Fired.setEnabled(true); 141 dlg.cM01TopMark.setEnabled(true); 142 } 143 } 144 145 public boolean isValid() { 146 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 147 } 148 149 public void paintSign() { 150 if (dlg.paintlock) 151 return; 152 super.paintSign(); 153 154 dlg.sM01StatusBar.setText(getErrMsg()); 155 156 if (isValid()) { 157 dlg.tfM01Name.setEnabled(true); 158 dlg.tfM01Name.setText(getName()); 159 dlg.cM01Radar.setVisible(true); 160 dlg.cM01Racon.setVisible(true); 161 dlg.cM01TopMark.setEnabled(true); 162 dlg.cM01TopMark.setVisible(true); 163 if (hasTopMark()) { 164 dlg.cbM01TopMark.setEnabled(true); 165 dlg.cbM01TopMark.setVisible(true); 166 } else { 167 dlg.cbM01TopMark.setVisible(false); 168 } 169 dlg.cM01Fog.setVisible(true); 170 dlg.cM01Fired.setVisible(true); 171 dlg.cM01Fired.setEnabled(true); 172 dlg.cbM01Colour.setVisible(false); 173 dlg.lM01Colour.setVisible(false); 174 dlg.rbM01Fired1.setVisible(false); 175 dlg.rbM01FiredN.setVisible(false); 176 dlg.lM01Height.setVisible(false); 177 dlg.tfM01Height.setVisible(false); 178 dlg.lM01Range.setVisible(false); 179 dlg.tfM01Range.setVisible(false); 180 181 if (isFired()) { 182 switch (getStyleIndex()) { 183 case SPEC_FLOAT: 184 dlg.lM01Height.setVisible(true); 185 dlg.tfM01Height.setVisible(true); 186 dlg.lM01Range.setVisible(true); 187 dlg.tfM01Range.setVisible(true); 188 break; 189 case SPEC_BEACON: 190 case SPEC_TOWER: 191 dlg.rbM01Fired1.setVisible(true); 192 dlg.rbM01FiredN.setVisible(true); 193 dlg.lM01Height.setVisible(true); 194 dlg.tfM01Height.setVisible(true); 195 dlg.lM01Range.setVisible(true); 196 dlg.tfM01Range.setVisible(true); 197 break; 198 default: 199 } 200 } 201 202 String image = "/images/Special_Purpose"; //$NON-NLS-1$ 203 204 switch (getStyleIndex()) { 205 case SPEC_PILLAR: 206 image += "_Pillar"; //$NON-NLS-1$ 207 break; 208 case SPEC_CAN: 209 image += "_Can"; //$NON-NLS-1$ 210 break; 211 case SPEC_CONE: 212 image += "_Cone"; //$NON-NLS-1$ 213 break; 214 case SPEC_SPAR: 215 image += "_Spar"; //$NON-NLS-1$ 216 break; 217 case SPEC_SPHERE: 218 image += "_Sphere"; //$NON-NLS-1$ 219 break; 220 case SPEC_BARREL: 221 image += "_Barrel"; //$NON-NLS-1$ 222 break; 223 case SPEC_FLOAT: 224 image += "_Float"; //$NON-NLS-1$ 225 break; 226 case SPEC_BEACON: 227 image += "_Beacon"; //$NON-NLS-1$ 228 break; 229 case SPEC_TOWER: 230 image += "_Tower"; //$NON-NLS-1$ 231 break; 232 default: 233 } 234 235 if (!image.equals("/images/Special_Purpose")) { //$NON-NLS-1$ 236 // if (hasTopMark()) 237 // image += "_CrossY"; //$NON-NLS-1$ 238 image += ".png"; //$NON-NLS-1$ 239 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 240 } else 241 dlg.lM01Icon.setIcon(null); 242 } 243 } 244 245 public void saveSign() { 246 Node node = getNode(); 247 248 if (node == null) { 249 return; 250 } 251 252 switch (getStyleIndex()) { 253 case SPEC_PILLAR: 254 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 255 Main.main.undoRedo.add(new ChangePropertyCommand(node, 256 "seamark:buoy_special_purpose:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 257 Main.main.undoRedo.add(new ChangePropertyCommand(node, 258 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 259 break; 260 case SPEC_SPAR: 261 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 262 Main.main.undoRedo.add(new ChangePropertyCommand(node, 263 "seamark:buoy_special_purpose:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 264 Main.main.undoRedo.add(new ChangePropertyCommand(node, 265 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 266 break; 267 case SPEC_SPHERE: 268 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 269 Main.main.undoRedo.add(new ChangePropertyCommand(node, 270 "seamark:buoy_special_purpose:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 271 Main.main.undoRedo.add(new ChangePropertyCommand(node, 272 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 273 break; 274 case SPEC_BARREL: 275 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 276 Main.main.undoRedo.add(new ChangePropertyCommand(node, 277 "seamark:buoy_special_purpose:shape", "barrel")); //$NON-NLS-1$ //$NON-NLS-2$ 278 Main.main.undoRedo.add(new ChangePropertyCommand(node, 279 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 280 break; 281 case SPEC_FLOAT: 282 super.saveSign("light_float"); //$NON-NLS-1$ 283 Main.main.undoRedo.add(new ChangePropertyCommand(node, 284 "seamark:light_float:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 285 break; 286 case SPEC_BEACON: 287 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 288 Main.main.undoRedo.add(new ChangePropertyCommand(node, 289 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 290 break; 291 case SPEC_TOWER: 292 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 293 Main.main.undoRedo.add(new ChangePropertyCommand(node, 294 "seamark:beacon_special_purpose:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 295 Main.main.undoRedo.add(new ChangePropertyCommand(node, 296 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 297 break; 298 default: 299 } 300 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$ 301 saveLightData(); //$NON-NLS-1$ 302 saveRadarFogData(); 303 } 304 305 public void setLightColour() { 306 super.setLightColour("W"); //$NON-NLS-1$ 307 } 308 308 309 309 } -
TabularUnified applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java ¶
r23047 r23193 11 11 12 12 public class BuoyUkn extends Buoy { 13 public BuoyUkn(SmpDialogAction dia, String Msg) {14 super(dia);15 resetMask();16 dlg.cbM01TypeOfMark.setSelectedIndex(0);17 dlg.cbM01CatOfMark.removeAllItems();18 dlg.cbM01CatOfMark.setEnabled(false);19 dlg.tfM01Name.setText(getName());20 setErrMsg(Msg);21 }13 public BuoyUkn(SmpDialogAction dia, String Msg) { 14 super(dia); 15 resetMask(); 16 dlg.cbM01TypeOfMark.setSelectedIndex(0); 17 dlg.cbM01CatOfMark.removeAllItems(); 18 dlg.cbM01CatOfMark.setEnabled(false); 19 dlg.tfM01Name.setText(getName()); 20 setErrMsg(Msg); 21 } 22 22 23 public void paintSign() {24 if (dlg.paintlock) return;25 super.paintSign();23 public void paintSign() { 24 if (dlg.paintlock) return; 25 super.paintSign(); 26 26 27 if (getErrMsg() != null)28 dlg.sM01StatusBar.setText(getErrMsg());27 if (getErrMsg() != null) 28 dlg.sM01StatusBar.setText(getErrMsg()); 29 29 30 setErrMsg(null);31 }30 setErrMsg(null); 31 } 32 32 33 public void setLightColour() {34 super.setLightColour("");35 }33 public void setLightColour() { 34 super.setLightColour(""); 35 } 36 36 37 public void saveSign() {38 }37 public void saveSign() { 38 } 39 39 }
Note:
See TracChangeset
for help on using the changeset viewer.
