Changeset 23209 in osm for applications/editors
- Timestamp:
- 2010-09-16T11:38:18+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins
- Files:
-
- 6 edited
-
smed/src/smed/plug/ifc/SmedPluggable.java (modified) (1 diff)
-
smed/src/smed/plug/util/SmedPluginLoader.java (modified) (1 diff)
-
smed/src/smed/tabs/SmedTabbedPane.java (modified) (1 diff)
-
smed_about/src/smed_about/SmedAbout.java (modified) (1 diff)
-
smed_ex/src/smed_ex/SmedEx.java (modified) (1 diff)
-
toms/src/toms/seamarks/buoys/Buoy.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/src/smed/plug/ifc/SmedPluggable.java
r23199 r23209 6 6 public interface SmedPluggable { 7 7 8 boolean start();9 boolean stop();10 String getName();11 String getInfo();12 JComponent getComponent();13 14 void setPluginManager(SmedPluginManager manager);8 boolean start(); 9 boolean stop(); 10 String getName(); 11 String getInfo(); 12 JComponent getComponent(); 13 14 void setPluginManager(SmedPluginManager manager); 15 15 16 16 } -
applications/editors/josm/plugins/smed/src/smed/plug/util/SmedPluginLoader.java
r23199 r23209 21 21 22 22 23 public static List<SmedPluggable> loadPlugins(File plugDir) throws IOException {24 File[] plugJars = plugDir.listFiles(new JARFileFilter());25 Arrays.sort(plugJars);26 27 URL[] urls = fileArrayToURLArray(plugJars);28 if(urls == null) return null;29 30 ClassLoader cl = new URLClassLoader(urls);31 List<Class<SmedPluggable>> plugClasses = extractClassesFromJARs(plugJars, cl);32 33 if(plugClasses == null) return null;34 else return createPluggableObjects(plugClasses);35 }23 public static List<SmedPluggable> loadPlugins(File plugDir) throws IOException { 24 File[] plugJars = plugDir.listFiles(new JARFileFilter()); 25 Arrays.sort(plugJars); 26 27 URL[] urls = fileArrayToURLArray(plugJars); 28 if(urls == null) return null; 29 30 ClassLoader cl = new URLClassLoader(urls); 31 List<Class<SmedPluggable>> plugClasses = extractClassesFromJARs(plugJars, cl); 32 33 if(plugClasses == null) return null; 34 else return createPluggableObjects(plugClasses); 35 } 36 36 37 37 private static List<SmedPluggable> createPluggableObjects(List<Class<SmedPluggable>> pluggables) { -
applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabbedPane.java
r23199 r23209 24 24 private static final long serialVersionUID = 1L; 25 25 26 public SmedTabbedPane() {27 super(new GridLayout(1, 1));28 29 List<SmedPluggable> plugins = null;30 String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath();31 try {32 plugins = SmedPluginLoader.loadPlugins(new File(pluginDirName + "/splug"));33 } catch (IOException e) {34 e.printStackTrace();35 }36 26 public SmedTabbedPane() { 27 super(new GridLayout(1, 1)); 28 29 List<SmedPluggable> plugins = null; 30 String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath(); 31 try { 32 plugins = SmedPluginLoader.loadPlugins(new File(pluginDirName + "/splug")); 33 } catch (IOException e) { 34 e.printStackTrace(); 35 } 36 37 37 38 38 Icon icon = null; 39 39 JTabbedPane tabbedPane = new JTabbedPane(); 40 40 41 JComponent panel;42 int i = 0;43 for(SmedPluggable p : plugins) {44 panel = p.getComponent();45 tabbedPane.addTab(p.getName(),icon, panel, p.getInfo());46 tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i);47 48 i++;49 }41 JComponent panel; 42 int i = 0; 43 for(SmedPluggable p : plugins) { 44 panel = p.getComponent(); 45 tabbedPane.addTab(p.getName(),icon, panel, p.getInfo()); 46 tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i); 47 48 i++; 49 } 50 50 51 51 //Add the tabbed pane to this panel. -
applications/editors/josm/plugins/smed_about/src/smed_about/SmedAbout.java
r23200 r23209 12 12 public class SmedAbout implements SmedPluggable{ 13 13 14 private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="43,24"15 private JLabel jLabel = null;16 private JLabel jLabel1 = null;17 private JLabel jLabel2 = null;18 @Override19 public boolean start() {20 // TODO Auto-generated method stub21 return false;22 }14 private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="43,24" 15 private JLabel jLabel = null; 16 private JLabel jLabel1 = null; 17 private JLabel jLabel2 = null; 18 @Override 19 public boolean start() { 20 // TODO Auto-generated method stub 21 return false; 22 } 23 23 24 @Override25 public boolean stop() {26 // TODO Auto-generated method stub27 return false;28 }24 @Override 25 public boolean stop() { 26 // TODO Auto-generated method stub 27 return false; 28 } 29 29 30 @Override31 public String getName() {32 return "About";33 }30 @Override 31 public String getName() { 32 return "About"; 33 } 34 34 35 @Override 36 public void setPluginManager(SmedPluginManager manager) { 37 // TODO Auto-generated method stub 38 39 } 35 @Override 36 public void setPluginManager(SmedPluginManager manager) { 37 // TODO Auto-generated method stub 40 38 41 @Override 42 public String getInfo() { 39 } 43 40 44 return "something about the programm"; 45 } 41 @Override 42 public String getInfo() { 46 43 47 @Override 48 public JComponent getComponent() { 44 return "something about the programm"; 45 } 49 46 50 return getJPanel(); 51 } 47 @Override 48 public JComponent getComponent() { 52 49 53 54 /** 55 * This method initializes jPanel 56 * 57 * @return javax.swing.JPanel 58 */ 59 private JPanel getJPanel() { 60 if (jPanel == null) { 61 jLabel2 = new JLabel(); 62 jLabel2.setBounds(new Rectangle(30, 90, 340, 30)); 63 jLabel2.setText("Description:"); 64 jLabel1 = new JLabel(); 65 jLabel1.setBounds(new Rectangle(30, 55, 340, 30)); 66 jLabel1.setText("Version: Date:"); 67 jLabel = new JLabel(); 68 jLabel.setBounds(new Rectangle(30, 20, 340, 30)); 69 jLabel.setText("Authors: Werner König and Malclom Herring"); 70 jPanel = new JPanel(); 71 jPanel.setLayout(null); 72 jPanel.setSize(new Dimension(400, 300)); 73 jPanel.add(jLabel, null); 74 jPanel.add(jLabel1, null); 75 jPanel.add(jLabel2, null); 76 } 77 return jPanel; 78 } 50 return getJPanel(); 51 } 52 53 54 /** 55 * This method initializes jPanel 56 * 57 * @return javax.swing.JPanel 58 */ 59 private JPanel getJPanel() { 60 if (jPanel == null) { 61 jLabel2 = new JLabel(); 62 jLabel2.setBounds(new Rectangle(30, 90, 340, 30)); 63 jLabel2.setText("Description:"); 64 jLabel1 = new JLabel(); 65 jLabel1.setBounds(new Rectangle(30, 55, 340, 30)); 66 jLabel1.setText("Version: Date:"); 67 jLabel = new JLabel(); 68 jLabel.setBounds(new Rectangle(30, 20, 340, 30)); 69 jLabel.setText("Authors: Werner König and Malclom Herring"); 70 jPanel = new JPanel(); 71 jPanel.setLayout(null); 72 jPanel.setSize(new Dimension(400, 300)); 73 jPanel.add(jLabel, null); 74 jPanel.add(jLabel1, null); 75 jPanel.add(jLabel2, null); 76 } 77 return jPanel; 78 } 79 79 80 80 } -
applications/editors/josm/plugins/smed_ex/src/smed_ex/SmedEx.java
r23206 r23209 16 16 public class SmedEx implements SmedPluggable { 17 17 18 private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="78,30"19 private JButton jButton = null;18 private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="78,30" 19 private JButton jButton = null; 20 20 21 @Override22 public boolean stop() {23 // TODO Auto-generated method stub24 return false;25 }21 @Override 22 public boolean stop() { 23 // TODO Auto-generated method stub 24 return false; 25 } 26 26 27 @Override28 public String getName() {27 @Override 28 public String getName() { 29 29 30 return "hello";31 }30 return "hello"; 31 } 32 32 33 @Override34 public String getInfo() {33 @Override 34 public String getInfo() { 35 35 36 return "say hello";37 }36 return "say hello"; 37 } 38 38 39 @Override 40 public JComponent getComponent() { 41 42 return getJPanel(); 43 } 39 @Override 40 public JComponent getComponent() { 44 41 45 @Override 46 public void setPluginManager(SmedPluginManager manager) { 47 // TODO Auto-generated method stub 42 return getJPanel(); 43 } 48 44 49 } 45 @Override 46 public void setPluginManager(SmedPluginManager manager) { 47 // TODO Auto-generated method stub 50 48 51 /** 52 * This method initializes jPanel 53 * 54 * @return javax.swing.JPanel 55 */ 56 private JPanel getJPanel() { 57 if (jPanel == null) { 58 jPanel = new JPanel(); 59 jPanel.setLayout(null); 60 jPanel.setPreferredSize(new Dimension(200, 130)); 61 jPanel.add(getJButton(), null); 62 } 63 return jPanel; 64 } 49 } 65 50 66 /** 67 * This method initializes jButton 68 * 69 * @return javax.swing.JButton 70 */ 71 private JButton getJButton() { 72 if (jButton == null) { 73 jButton = new JButton(); 74 jButton.setBounds(new Rectangle(15, 40, 160, 40)); 75 jButton.setText("Hello World!"); 76 77 jButton.addActionListener(new ActionListener() { 51 /** 52 * This method initializes jPanel 53 * 54 * @return javax.swing.JPanel 55 */ 56 private JPanel getJPanel() { 57 if (jPanel == null) { 58 jPanel = new JPanel(); 59 jPanel.setLayout(null); 60 jPanel.setPreferredSize(new Dimension(200, 130)); 61 jPanel.add(getJButton(), null); 62 } 63 return jPanel; 64 } 78 65 79 @Override 80 public void actionPerformed(ActionEvent e) { 81 JOptionPane.showMessageDialog( null, "it works" ); 82 } 83 84 }); 85 } 86 return jButton; 87 } 66 /** 67 * This method initializes jButton 68 * 69 * @return javax.swing.JButton 70 */ 71 private JButton getJButton() { 72 if (jButton == null) { 73 jButton = new JButton(); 74 jButton.setBounds(new Rectangle(15, 40, 160, 40)); 75 jButton.setText("Hello World!"); 88 76 89 @Override 90 public boolean start() { 91 // TODO Auto-generated method stub 92 return false; 93 } 77 jButton.addActionListener(new ActionListener() { 78 79 @Override 80 public void actionPerformed(ActionEvent e) { 81 JOptionPane.showMessageDialog( null, "it works" ); 82 } 83 84 }); 85 } 86 return jButton; 87 } 88 89 @Override 90 public boolean start() { 91 // TODO Auto-generated method stub 92 return false; 93 } 94 94 95 95 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r23194 r23209 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 LightColour[SectorIndex] = lightColour;195 }196 197 private String[] LightGroup = new String[10];198 199 public String getLightGroup() {200 if (LightGroup[SectorIndex] == null)201 return (LightGroup[0]);202 return LightGroup[SectorIndex];203 }204 205 public void setLightGroup(String lightGroup) {206 if (SectorIndex == 0)207 LightGroup = new String[10];208 LightGroup[SectorIndex] = lightGroup;209 }210 211 protected void setLightGroup(Map<String, String> k) {212 String s = "";213 if (k.containsKey("seamark:light:group")) {214 s = k.get("seamark:light:group");215 setLightGroup(s);216 }217 }218 219 private String[] Height = new String[10];220 221 public String getHeight() {222 if (Height[SectorIndex] == null)223 return (Height[0]);224 return Height[SectorIndex];225 }226 227 public void setHeight(String height) {228 if (SectorIndex == 0)229 Height = new String[10];230 Height[SectorIndex] = height;231 }232 233 private String[] Range = new String[10];234 235 public String getRange() {236 if (Range[SectorIndex] == null)237 return (Range[0]);238 return Range[SectorIndex];239 }240 241 public void setRange(String range) {242 if (SectorIndex == 0)243 Range = new String[10];244 Range[SectorIndex] = range;245 }246 247 private String[] Bearing1 = new String[10];248 249 public String getBearing1() {250 if (Bearing1[SectorIndex] == null)251 return (Bearing1[0]);252 return Bearing1[SectorIndex];253 }254 255 public void setBearing1(String bearing) {256 if (SectorIndex == 0)257 Bearing1 = new String[10];258 Bearing1[SectorIndex] = bearing;259 }260 261 private String[] Bearing2 = new String[10];262 263 public String getBearing2() {264 if (Bearing2[SectorIndex] == null)265 return (Bearing2[0]);266 return Bearing2[SectorIndex];267 }268 269 public void setBearing2(String bearing) {270 if (SectorIndex == 0)271 Bearing2 = new String[10];272 Bearing2[SectorIndex] = bearing;273 }274 275 private String[] Radius = new String[10];276 277 public String getRadius() {278 if (Radius[SectorIndex] == null)279 return (Radius[0]);280 return Radius[SectorIndex];281 }282 283 public void setRadius(String radius) {284 if (SectorIndex == 0)285 Radius = new String[10];286 Radius[SectorIndex] = radius;287 }288 289 private String[] LightPeriod = new String[10];290 291 public String getLightPeriod() {292 if (LightPeriod[SectorIndex] == null)293 return (LightPeriod[0]);294 return LightPeriod[SectorIndex];295 }296 297 public void setLightPeriod(String lightPeriod) {298 String regex = "^[\\d\\s.]+$";299 300 if (!lightPeriod.isEmpty()) {301 302 Pattern pat = Pattern.compile(regex);303 Matcher matcher = pat.matcher(lightPeriod);304 305 if (matcher.find()) {306 setErrMsg(null);307 } else {308 setErrMsg("Must be a number");309 lightPeriod = "";310 dlg.tfM01RepeatTime.requestFocus();311 }312 }313 if (SectorIndex == 0)314 LightPeriod = new String[10];315 LightPeriod[SectorIndex] = lightPeriod;316 }317 318 private Node Node = null;319 320 public Node getNode() {321 return Node;322 }323 324 public void setNode(Node node) {325 Node = node;326 }327 328 private boolean TopMark = false;329 330 public boolean hasTopMark() {331 return TopMark;332 }333 334 public void setTopMark(boolean topMark) {335 TopMark = topMark;336 /*337 * if (dlg.cM01TopMark == null) { return; }338 */339 dlg.cM01TopMark.setSelected(topMark);340 }341 342 protected SmpDialogAction dlg = null; // hier wird der Dialog referenziert343 344 public SmpDialogAction getDlg() {345 return dlg;346 }347 348 public void setDlg(SmpDialogAction dlg) {349 this.dlg = dlg;350 }351 352 protected Buoy(SmpDialogAction dia) {353 dlg = dia;354 }355 356 public boolean isValid() {357 return false;358 }359 360 public void parseLights(Map<String, String> k) {361 setFired(false);362 setSectored(false);363 Iterator it = k.entrySet().iterator();364 while (it.hasNext()) {365 Map.Entry entry = (Map.Entry) it.next();366 String key = (String) entry.getKey();367 String value = ((String) entry.getValue()).trim();368 if (key.contains("seamark:light:")) {369 setFired(true);370 int index = 0;371 key = key.substring(14);372 if (key.matches("^\\d:.*")) {373 index = key.charAt(0) - '0';374 key = key.substring(2);375 } else if (key.matches("^\\d$")) {376 index = key.charAt(0) - '0';377 String values[] = value.split(":");378 if (values[0].equals("red"))379 LightColour[index] = "R";380 else if (values[0].equals("green"))381 LightColour[index] = "G";382 else if (values[0].equals("white"))383 LightColour[index] = "W";384 Bearing1[index] = values[1];385 Bearing2[index] = values[2];386 Radius[index] = values[3];387 } else {388 index = 0;389 }390 if (index != 0)391 setSectored(true);392 if (key.equals("colour")) {393 if (value.equals("red"))394 LightColour[index] = "R";395 else if (value.equals("green"))396 LightColour[index] = "G";397 else if (value.equals("white"))398 LightColour[index] = "W";399 } else if (key.equals("character")) {400 LightChar[index] = value;401 } else if (key.equals("group")) {402 LightGroup[index] = value;403 } else if (key.equals("period")) {404 LightPeriod[index] = value;405 } else if (key.equals("height")) {406 Height[index] = value;407 } else if (key.equals("range")) {408 Range[index] = value;409 }410 }411 }412 setSectorIndex(0);413 dlg.cbM01Sector.setSelectedIndex(0);414 dlg.cM01Fired.setSelected(isFired());415 dlg.rbM01Fired1.setSelected(!isSectored());416 dlg.rbM01FiredN.setSelected(isSectored());417 dlg.cbM01Kennung.setSelectedItem(getLightChar());418 dlg.tfM01Height.setText(getHeight());419 dlg.tfM01Range.setText(getRange());420 dlg.tfM01Group.setText(getLightGroup());421 dlg.tfM01RepeatTime.setText(getLightPeriod());422 dlg.cbM01Colour.setSelectedItem(getLightColour());423 }424 425 public void parseFogRadar(Map<String, String> k) {426 String str;427 setFog(false);428 setRadar(false);429 setRacon(false);430 if (k.containsKey("seamark:fog_signal")431 || k.containsKey("seamark:fog_signal:category")432 || k.containsKey("seamark:fog_signal:group")433 || k.containsKey("seamark:fog_signal:period")) {434 setFog(true);435 if (k.containsKey("seamark:fog_signal:category")) {436 str = k.get("seamark:fog_signal:category");437 if (str.equals("horn"))438 setFogSound(FOG_HORN);439 else if (str.equals("siren"))440 setFogSound(FOG_SIREN);441 else if (str.equals("diaphone"))442 setFogSound(FOG_DIA);443 else if (str.equals("bell"))444 setFogSound(FOG_BELL);445 else if (str.equals("whis"))446 setFogSound(FOG_WHIS);447 else if (str.equals("gong"))448 setFogSound(FOG_GONG);449 else if (str.equals("explosive"))450 setFogSound(FOG_EXPLOS);451 else452 setFogSound(UNKNOWN_FOG);453 }454 if (k.containsKey("seamark:fog_signal:group"))455 setFogGroup(k.get("seamark:fog_signal:group"));456 if (k.containsKey("seamark:fog_signal:period"))457 setFogPeriod(k.get("seamark:fog_signal:period"));458 }459 dlg.cM01Fog.setSelected(hasFog());460 dlg.cbM01Fog.setSelectedIndex(getFogSound());461 dlg.tfM01FogGroup.setText(getFogGroup());462 dlg.tfM01FogPeriod.setText(getFogPeriod());463 464 if (k.containsKey("seamark:radar_transponder")465 || k.containsKey("seamark:radar_transponder:category")466 || k.containsKey("seamark:radar_transponder:group")) {467 setRacon(true);468 if (k.containsKey("seamark:radar_transponder:category")) {469 str = k.get("seamark:radar_transponder:category");470 if (str.equals("racon"))471 setRaType(RATYPE_RACON);472 else if (str.equals("ramark"))473 setRaType(RATYPE_RAMARK);474 else if (str.equals("leading"))475 setRaType(RATYPE_LEADING);476 else477 setRaType(UNKNOWN_RATYPE);478 }479 if (k.containsKey("seamark:radar_transponder:group"))480 setRaconGroup(k.get("seamark:radar_transponder:group"));481 } else if (k.containsKey("seamark:radar_reflector"))482 setRadar(true);483 dlg.cM01Radar.setSelected(hasRadar());484 dlg.cM01Racon.setSelected(hasRacon());485 dlg.cbM01Racon.setSelectedIndex(getRaType());486 dlg.tfM01Racon.setText(getRaconGroup());487 }488 489 public void paintSign() {490 491 if (dlg.paintlock)492 return;493 else494 dlg.paintlock = true;495 496 dlg.lM01Icon.setIcon(null);497 dlg.lM02Icon.setIcon(null);498 dlg.lM03Icon.setIcon(null);499 dlg.lM04Icon.setIcon(null);500 dlg.lM05Icon.setIcon(null);501 502 dlg.rbM01RegionA.setSelected(!getRegion());503 dlg.rbM01RegionB.setSelected(getRegion());504 505 if (isValid()) {506 dlg.bM01Save.setEnabled(true);507 508 dlg.cM01TopMark.setSelected(hasTopMark());509 dlg.cM01Fired.setSelected(isFired());510 511 dlg.tfM01RepeatTime.setText(getLightPeriod());512 513 dlg.tfM01Name.setText(getName());514 dlg.tfM01Name.setEnabled(true);515 516 if (hasRadar()) {517 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource(518 "/images/Radar_Reflector.png")));519 }520 521 if (hasRacon()) {522 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource(523 "/images/Radar_Station.png")));524 dlg.cbM01Racon.setVisible(true);525 if (getRaType() == RATYPE_RACON) {526 dlg.lM01Racon.setVisible(true);527 dlg.tfM01Racon.setVisible(true);528 dlg.tfM01Racon.setEnabled(true);529 } else {530 dlg.lM01Racon.setVisible(false);531 dlg.tfM01Racon.setVisible(false);532 }533 } else {534 dlg.cbM01Racon.setVisible(false);535 dlg.lM01Racon.setVisible(false);536 dlg.tfM01Racon.setVisible(false);537 }538 539 if (hasFog()) {540 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource(541 "/images/Fog_Signal.png")));542 dlg.cbM01Fog.setVisible(true);543 if (getFogSound() == 0) {544 dlg.lM01FogGroup.setVisible(false);545 dlg.tfM01FogGroup.setVisible(false);546 dlg.lM01FogPeriod.setVisible(false);547 dlg.tfM01FogPeriod.setVisible(false);548 } else {549 dlg.lM01FogGroup.setVisible(true);550 dlg.tfM01FogGroup.setVisible(true);551 dlg.lM01FogPeriod.setVisible(true);552 dlg.tfM01FogPeriod.setVisible(true);553 }554 } else {555 dlg.cbM01Fog.setVisible(false);556 dlg.lM01FogGroup.setVisible(false);557 dlg.tfM01FogGroup.setVisible(false);558 dlg.lM01FogPeriod.setVisible(false);559 dlg.tfM01FogPeriod.setVisible(false);560 }561 562 if (isFired()) {563 String lp, c;564 String tmp = null;565 int i1;566 567 String col = getLightColour();568 if (col.equals("W")) {569 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(570 "/images/Light_White_120.png")));571 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT);572 } else if (col.equals("R")) {573 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(574 "/images/Light_Red_120.png")));575 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT);576 } else if (col.equals("G")) {577 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(578 "/images/Light_Green_120.png")));579 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT);580 } else {581 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource(582 "/images/Light_Magenta_120.png")));583 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR);584 }585 586 c = getLightChar();587 if (c.contains("+")) {588 i1 = c.indexOf("+");589 tmp = c.substring(i1, c.length());590 c = c.substring(0, i1);591 if (!getLightGroup().isEmpty()) {592 c = c + "(" + getLightGroup() + ")";593 }594 if (tmp != null)595 c = c + tmp;596 }597 dlg.cbM01Kennung.setSelectedItem(c);598 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup()599 .isEmpty())600 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("("))601 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) {602 c = c + "(" + getLightGroup() + ")";603 dlg.cbM01Kennung.setSelectedItem(c);604 }605 c = c + " " + getLightColour();606 lp = getLightPeriod();607 if (!lp.isEmpty())608 c = c + " " + lp + "s";609 dlg.lM01FireMark.setText(c);610 dlg.cM01Fired.setVisible(true);611 dlg.lM01Kennung.setVisible(true);612 dlg.cbM01Kennung.setVisible(true);613 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) {614 dlg.tfM01Group.setVisible(false);615 dlg.lM01Group.setVisible(false);616 } else {617 dlg.lM01Group.setVisible(true);618 dlg.tfM01Group.setVisible(true);619 }620 dlg.tfM01Group.setText(getLightGroup());621 dlg.lM01RepeatTime.setVisible(true);622 dlg.tfM01RepeatTime.setVisible(true);623 if (isSectored()) {624 dlg.rbM01Fired1.setSelected(false);625 dlg.rbM01FiredN.setSelected(true);626 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty()))627 dlg.cbM01Kennung.setEnabled(false);628 else629 dlg.cbM01Kennung.setEnabled(true);630 dlg.cbM01Kennung.setSelectedItem(getLightChar());631 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty()))632 dlg.tfM01Group.setEnabled(false);633 else634 dlg.tfM01Group.setEnabled(true);635 dlg.tfM01Group.setText(getLightGroup());636 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty()))637 dlg.tfM01RepeatTime.setEnabled(false);638 else639 dlg.tfM01RepeatTime.setEnabled(true);640 dlg.tfM01RepeatTime.setText(getLightPeriod());641 if ((getSectorIndex() != 0) && (!Height[0].isEmpty()))642 dlg.tfM01Height.setEnabled(false);643 else644 dlg.tfM01Height.setEnabled(true);645 dlg.tfM01Height.setText(getHeight());646 if ((getSectorIndex() != 0) && (!Range[0].isEmpty()))647 dlg.tfM01Range.setEnabled(false);648 else649 dlg.tfM01Range.setEnabled(true);650 dlg.tfM01Range.setText(getRange());651 dlg.lM01Sector.setVisible(true);652 dlg.cbM01Sector.setVisible(true);653 if (getSectorIndex() == 0) {654 dlg.lM01Colour.setVisible(false);655 dlg.cbM01Colour.setVisible(false);656 dlg.lM01Bearing.setVisible(false);657 dlg.tfM01Bearing.setVisible(false);658 dlg.tfM02Bearing.setVisible(false);659 dlg.tfM01Radius.setVisible(false);660 } else {661 dlg.lM01Colour.setVisible(true);662 dlg.cbM01Colour.setVisible(true);663 dlg.lM01Bearing.setVisible(true);664 dlg.tfM01Bearing.setVisible(true);665 dlg.tfM01Bearing.setText(getBearing1());666 dlg.tfM02Bearing.setVisible(true);667 dlg.tfM02Bearing.setText(getBearing2());668 dlg.tfM01Radius.setVisible(true);669 dlg.tfM01Radius.setText(getRadius());670 }671 } else {672 dlg.rbM01FiredN.setSelected(false);673 dlg.rbM01Fired1.setSelected(true);674 dlg.cbM01Kennung.setEnabled(true);675 dlg.tfM01Group.setEnabled(true);676 dlg.tfM01RepeatTime.setEnabled(true);677 dlg.tfM01Height.setEnabled(true);678 dlg.tfM01Range.setEnabled(true);679 dlg.lM01Colour.setVisible(true);680 dlg.cbM01Colour.setVisible(true);681 dlg.lM01Sector.setVisible(false);682 dlg.cbM01Sector.setVisible(false);683 dlg.lM01Bearing.setVisible(false);684 dlg.tfM01Bearing.setVisible(false);685 dlg.tfM02Bearing.setVisible(false);686 dlg.tfM01Radius.setVisible(false);687 }688 } else {689 dlg.lM01FireMark.setText("");690 dlg.rbM01Fired1.setVisible(false);691 dlg.rbM01FiredN.setVisible(false);692 dlg.cbM01Kennung.setVisible(false);693 dlg.lM01Kennung.setVisible(false);694 dlg.tfM01Height.setVisible(false);695 dlg.lM01Height.setVisible(false);696 dlg.tfM01Range.setVisible(false);697 dlg.lM01Range.setVisible(false);698 dlg.cbM01Colour.setVisible(false);699 dlg.lM01Colour.setVisible(false);700 dlg.cbM01Sector.setVisible(false);701 dlg.lM01Sector.setVisible(false);702 dlg.tfM01Group.setVisible(false);703 dlg.lM01Group.setVisible(false);704 dlg.tfM01RepeatTime.setVisible(false);705 dlg.lM01RepeatTime.setVisible(false);706 dlg.tfM01Bearing.setVisible(false);707 dlg.lM01Bearing.setVisible(false);708 dlg.tfM02Bearing.setVisible(false);709 dlg.tfM01Radius.setVisible(false);710 }711 } else {712 dlg.bM01Save.setEnabled(false);713 dlg.tfM01Name.setEnabled(false);714 dlg.cM01TopMark.setVisible(false);715 dlg.cbM01TopMark.setVisible(false);716 dlg.cM01Radar.setVisible(false);717 dlg.cM01Racon.setVisible(false);718 dlg.cbM01Racon.setVisible(false);719 dlg.tfM01Racon.setVisible(false);720 dlg.lM01Racon.setVisible(false);721 dlg.cM01Fog.setVisible(false);722 dlg.cbM01Fog.setVisible(false);723 dlg.tfM01FogGroup.setVisible(false);724 dlg.lM01FogGroup.setVisible(false);725 dlg.tfM01FogPeriod.setVisible(false);726 dlg.lM01FogPeriod.setVisible(false);727 dlg.cM01Fired.setVisible(false);728 dlg.rbM01Fired1.setVisible(false);729 dlg.rbM01FiredN.setVisible(false);730 dlg.cbM01Kennung.setVisible(false);731 dlg.lM01Kennung.setVisible(false);732 dlg.tfM01Height.setVisible(false);733 dlg.lM01Height.setVisible(false);734 dlg.tfM01Range.setVisible(false);735 dlg.lM01Range.setVisible(false);736 dlg.cbM01Colour.setVisible(false);737 dlg.lM01Colour.setVisible(false);738 dlg.cbM01Sector.setVisible(false);739 dlg.lM01Sector.setVisible(false);740 dlg.tfM01Group.setVisible(false);741 dlg.lM01Group.setVisible(false);742 dlg.tfM01RepeatTime.setVisible(false);743 dlg.lM01RepeatTime.setVisible(false);744 dlg.tfM01Bearing.setVisible(false);745 dlg.lM01Bearing.setVisible(false);746 dlg.tfM02Bearing.setVisible(false);747 dlg.tfM01Radius.setVisible(false);748 }749 dlg.paintlock = false;750 }751 752 public void saveSign(String type) {753 delSeaMarkKeys(Node);754 755 String str = dlg.tfM01Name.getText();756 if (!str.isEmpty())757 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name",758 str));759 Main.main.undoRedo760 .add(new ChangePropertyCommand(Node, "seamark:type", type));761 }762 763 protected void saveLightData() {764 String colour;765 if (dlg.cM01Fired.isSelected()) {766 if (!(colour = LightColour[0]).isEmpty())767 if (colour.equals("R")) {768 Main.main.undoRedo.add(new ChangePropertyCommand(Node,769 "seamark:light:colour", "red"));770 } else if (colour.equals("G")) {771 Main.main.undoRedo.add(new ChangePropertyCommand(Node,772 "seamark:light:colour", "green"));773 } else if (colour.equals("W")) {774 Main.main.undoRedo.add(new ChangePropertyCommand(Node,775 "seamark:light:colour", "white"));776 }777 778 if (!LightPeriod[0].isEmpty())779 Main.main.undoRedo.add(new ChangePropertyCommand(Node,780 "seamark:light:period", LightPeriod[0]));781 782 if (!LightChar[0].isEmpty())783 Main.main.undoRedo.add(new ChangePropertyCommand(Node,784 "seamark:light:character", LightChar[0]));785 786 if (!LightGroup[0].isEmpty())787 Main.main.undoRedo.add(new ChangePropertyCommand(Node,788 "seamark:light:group", LightGroup[0]));789 790 if (!Height[0].isEmpty())791 Main.main.undoRedo.add(new ChangePropertyCommand(Node,792 "seamark:light:height", Height[0]));793 794 if (!Range[0].isEmpty())795 Main.main.undoRedo.add(new ChangePropertyCommand(Node,796 "seamark:light:range", Range[0]));797 798 for (int i = 1; i < 10; i++) {799 if ((colour = LightColour[i]) != null)800 if (colour.equals("R")) {801 Main.main.undoRedo.add(new ChangePropertyCommand(Node,802 "seamark:light:" + i + ":colour", "red"));803 if ((Bearing1[i] != null) && (Bearing2[i] != null)804 && (Radius[i] != null))805 Main.main.undoRedo.add(new ChangePropertyCommand(Node,806 "seamark:light:" + i, "red:" + Bearing1[i] + ":"807 + Bearing2[i] + ":" + Radius[i]));808 } else if (colour.equals("G")) {809 Main.main.undoRedo.add(new ChangePropertyCommand(Node,810 "seamark:light:" + i + ":colour", "green"));811 if ((Bearing1[i] != null) && (Bearing2[i] != null)812 && (Radius[i] != null))813 Main.main.undoRedo.add(new ChangePropertyCommand(Node,814 "seamark:light:" + i, "green:" + Bearing1[i] + ":"815 + Bearing2[i] + ":" + Radius[i]));816 } else if (colour.equals("W")) {817 Main.main.undoRedo.add(new ChangePropertyCommand(Node,818 "seamark:light:" + i + ":colour", "white"));819 if ((Bearing1[i] != null) && (Bearing2[i] != null)820 && (Radius[i] != null))821 Main.main.undoRedo.add(new ChangePropertyCommand(Node,822 "seamark:light:" + i, "white:" + Bearing1[i] + ":"823 + Bearing2[i] + ":" + Radius[i]));824 }825 826 if (LightPeriod[i] != null)827 Main.main.undoRedo.add(new ChangePropertyCommand(Node,828 "seamark:light:" + i + ":period", LightPeriod[i]));829 830 if (LightChar[i] != null)831 Main.main.undoRedo.add(new ChangePropertyCommand(Node,832 "seamark:light:" + i + ":character", LightChar[i]));833 834 if (LightGroup[i] != null)835 Main.main.undoRedo.add(new ChangePropertyCommand(Node,836 "seamark:light:" + i + ":group", LightGroup[i]));837 838 if (Height[i] != null)839 Main.main.undoRedo.add(new ChangePropertyCommand(Node,840 "seamark:light:" + i + ":height", Height[i]));841 842 if (Range[i] != null)843 Main.main.undoRedo.add(new ChangePropertyCommand(Node,844 "seamark:light:" + i + ":range", Range[i]));845 846 if (Bearing1[i] != null)847 Main.main.undoRedo.add(new ChangePropertyCommand(Node,848 "seamark:light:" + i + ":sector_start", Bearing1[i]));849 850 if (Bearing2[i] != null)851 Main.main.undoRedo.add(new ChangePropertyCommand(Node,852 "seamark:light:" + i + ":sector_end", Bearing2[i]));853 }854 }855 }856 857 protected void saveTopMarkData(String shape, String colour) {858 if (dlg.cM01TopMark.isSelected()) {859 Main.main.undoRedo.add(new ChangePropertyCommand(Node,860 "seamark:topmark:shape", shape));861 Main.main.undoRedo.add(new ChangePropertyCommand(Node,862 "seamark:topmark:colour", colour));863 }864 }865 866 protected void saveRadarFogData() {867 if (hasRadar()) {868 Main.main.undoRedo.add(new ChangePropertyCommand(Node,869 "seamark:radar_reflector", "yes"));870 }871 if (hasRacon()) {872 switch (RaType) {873 case RATYPE_RACON:874 Main.main.undoRedo.add(new ChangePropertyCommand(Node,875 "seamark:radar_transponder:category", "racon"));876 if (!getRaconGroup().isEmpty())877 Main.main.undoRedo.add(new ChangePropertyCommand(Node,878 "seamark:radar_transponder:group", getRaconGroup()));879 break;880 case RATYPE_RAMARK:881 Main.main.undoRedo.add(new ChangePropertyCommand(Node,882 "seamark:radar_transponder:category", "ramark"));883 break;884 case RATYPE_LEADING:885 Main.main.undoRedo.add(new ChangePropertyCommand(Node,886 "seamark:radar_transponder:category", "leading"));887 break;888 default:889 Main.main.undoRedo.add(new ChangePropertyCommand(Node,890 "seamark:radar_transponder", "yes"));891 }892 }893 if (hasFog()) {894 if (getFogSound() == 0) {895 Main.main.undoRedo.add(new ChangePropertyCommand(Node,896 "seamark:fog_signal", "yes"));897 } else {898 switch (getFogSound()) {899 case FOG_HORN:900 Main.main.undoRedo.add(new ChangePropertyCommand(Node,901 "seamark:fog_signal:category", "horn"));902 break;903 case FOG_SIREN:904 Main.main.undoRedo.add(new ChangePropertyCommand(Node,905 "seamark:fog_signal:category", "siren"));906 break;907 case FOG_DIA:908 Main.main.undoRedo.add(new ChangePropertyCommand(Node,909 "seamark:fog_signal:category", "diaphone"));910 break;911 case FOG_BELL:912 Main.main.undoRedo.add(new ChangePropertyCommand(Node,913 "seamark:fog_signal:category", "bell"));914 break;915 case FOG_WHIS:916 Main.main.undoRedo.add(new ChangePropertyCommand(Node,917 "seamark:fog_signal:category", "whistle"));918 break;919 case FOG_GONG:920 Main.main.undoRedo.add(new ChangePropertyCommand(Node,921 "seamark:fog_signal:category", "gong"));922 break;923 case FOG_EXPLOS:924 Main.main.undoRedo.add(new ChangePropertyCommand(Node,925 "seamark:fog_signal:category", "explosive"));926 break;927 }928 if (!getFogGroup().isEmpty())929 Main.main.undoRedo.add(new ChangePropertyCommand(Node,930 "seamark:fog_signal:group", getFogGroup()));931 if (!getFogPeriod().isEmpty())932 Main.main.undoRedo.add(new ChangePropertyCommand(Node,933 "seamark:fog_signal:period", getFogPeriod()));934 }935 }936 }937 938 public void refreshStyles() {939 }940 941 public void refreshLights() {942 dlg.cbM01Kennung.removeAllItems();943 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$944 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$945 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$946 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$947 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$948 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$949 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$950 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$951 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$952 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$953 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$954 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$955 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$956 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$957 dlg.cbM01Kennung.setSelectedIndex(0);958 }959 960 public void resetMask() {961 setRegion(Main.pref.get("tomsplugin.IALA").equals("B"));962 963 dlg.lM01Icon.setIcon(null);964 dlg.lM02Icon.setIcon(null);965 dlg.lM03Icon.setIcon(null);966 dlg.lM04Icon.setIcon(null);967 968 dlg.rbM01RegionA.setEnabled(false);969 dlg.rbM01RegionB.setEnabled(false);970 dlg.lM01FireMark.setText("");971 dlg.cbM01CatOfMark.removeAllItems();972 dlg.cbM01CatOfMark.setVisible(false);973 dlg.lM01CatOfMark.setVisible(false);974 setBuoyIndex(0);975 dlg.cbM01StyleOfMark.removeAllItems();976 dlg.cbM01StyleOfMark.setVisible(false);977 dlg.lM01StyleOfMark.setVisible(false);978 setStyleIndex(0);979 dlg.tfM01Name.setText("");980 dlg.tfM01Name.setEnabled(false);981 setName("");982 dlg.cM01TopMark.setSelected(false);983 dlg.cM01TopMark.setVisible(false);984 dlg.cbM01TopMark.removeAllItems();985 dlg.cbM01TopMark.setVisible(false);986 setTopMark(false);987 dlg.cM01Radar.setSelected(false);988 dlg.cM01Radar.setVisible(false);989 setRadar(false);990 dlg.cM01Racon.setSelected(false);991 dlg.cM01Racon.setVisible(false);992 dlg.cbM01Racon.setVisible(false);993 dlg.tfM01Racon.setText("");994 dlg.tfM01Racon.setVisible(false);995 dlg.lM01Racon.setVisible(false);996 setRacon(false);997 setRaType(0);998 dlg.cM01Fog.setSelected(false);999 dlg.cM01Fog.setVisible(false);1000 dlg.cbM01Fog.setVisible(false);1001 setFogSound(0);1002 dlg.tfM01FogGroup.setText("");1003 dlg.tfM01FogGroup.setVisible(false);1004 dlg.lM01FogGroup.setVisible(false);1005 dlg.tfM01FogPeriod.setText("");1006 dlg.tfM01FogPeriod.setVisible(false);1007 dlg.lM01FogPeriod.setVisible(false);1008 setFog(false);1009 dlg.cM01Fired.setSelected(false);1010 dlg.cM01Fired.setVisible(false);1011 setFired(false);1012 dlg.rbM01Fired1.setVisible(false);1013 dlg.rbM01Fired1.setSelected(true);1014 dlg.rbM01FiredN.setVisible(false);1015 dlg.rbM01FiredN.setSelected(false);1016 setSectored(false);1017 dlg.cbM01Kennung.removeAllItems();1018 dlg.cbM01Kennung.setVisible(false);1019 dlg.lM01Kennung.setVisible(false);1020 setLightChar("");1021 dlg.tfM01Height.setText("");1022 dlg.tfM01Height.setVisible(false);1023 dlg.lM01Height.setVisible(false);1024 setHeight("");1025 dlg.tfM01Range.setText("");1026 dlg.tfM01Range.setVisible(false);1027 dlg.lM01Range.setVisible(false);1028 setRange("");1029 dlg.cbM01Colour.setVisible(false);1030 dlg.lM01Colour.setVisible(false);1031 setLightColour("");1032 dlg.cbM01Sector.setVisible(false);1033 dlg.lM01Sector.setVisible(false);1034 setSectorIndex(0);1035 dlg.tfM01Group.setText("");1036 dlg.tfM01Group.setVisible(false);1037 dlg.lM01Group.setVisible(false);1038 setLightGroup("");1039 dlg.tfM01RepeatTime.setText("");1040 dlg.tfM01RepeatTime.setVisible(false);1041 dlg.lM01RepeatTime.setVisible(false);1042 setLightPeriod("");1043 dlg.tfM01Bearing.setText("");1044 dlg.tfM01Bearing.setVisible(false);1045 dlg.lM01Bearing.setVisible(false);1046 setBearing1("");1047 dlg.tfM02Bearing.setText("");1048 dlg.tfM02Bearing.setVisible(false);1049 setBearing2("");1050 dlg.tfM01Radius.setText("");1051 dlg.tfM01Radius.setVisible(false);1052 setRadius("");1053 1054 dlg.bM01Save.setEnabled(false);1055 }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 LightColour[SectorIndex] = lightColour; 195 } 196 197 private String[] LightGroup = new String[10]; 198 199 public String getLightGroup() { 200 if (LightGroup[SectorIndex] == null) 201 return (LightGroup[0]); 202 return LightGroup[SectorIndex]; 203 } 204 205 public void setLightGroup(String lightGroup) { 206 if (SectorIndex == 0) 207 LightGroup = new String[10]; 208 LightGroup[SectorIndex] = lightGroup; 209 } 210 211 protected void setLightGroup(Map<String, String> k) { 212 String s = ""; 213 if (k.containsKey("seamark:light:group")) { 214 s = k.get("seamark:light:group"); 215 setLightGroup(s); 216 } 217 } 218 219 private String[] Height = new String[10]; 220 221 public String getHeight() { 222 if (Height[SectorIndex] == null) 223 return (Height[0]); 224 return Height[SectorIndex]; 225 } 226 227 public void setHeight(String height) { 228 if (SectorIndex == 0) 229 Height = new String[10]; 230 Height[SectorIndex] = height; 231 } 232 233 private String[] Range = new String[10]; 234 235 public String getRange() { 236 if (Range[SectorIndex] == null) 237 return (Range[0]); 238 return Range[SectorIndex]; 239 } 240 241 public void setRange(String range) { 242 if (SectorIndex == 0) 243 Range = new String[10]; 244 Range[SectorIndex] = range; 245 } 246 247 private String[] Bearing1 = new String[10]; 248 249 public String getBearing1() { 250 if (Bearing1[SectorIndex] == null) 251 return (Bearing1[0]); 252 return Bearing1[SectorIndex]; 253 } 254 255 public void setBearing1(String bearing) { 256 if (SectorIndex == 0) 257 Bearing1 = new String[10]; 258 Bearing1[SectorIndex] = bearing; 259 } 260 261 private String[] Bearing2 = new String[10]; 262 263 public String getBearing2() { 264 if (Bearing2[SectorIndex] == null) 265 return (Bearing2[0]); 266 return Bearing2[SectorIndex]; 267 } 268 269 public void setBearing2(String bearing) { 270 if (SectorIndex == 0) 271 Bearing2 = new String[10]; 272 Bearing2[SectorIndex] = bearing; 273 } 274 275 private String[] Radius = new String[10]; 276 277 public String getRadius() { 278 if (Radius[SectorIndex] == null) 279 return (Radius[0]); 280 return Radius[SectorIndex]; 281 } 282 283 public void setRadius(String radius) { 284 if (SectorIndex == 0) 285 Radius = new String[10]; 286 Radius[SectorIndex] = radius; 287 } 288 289 private String[] LightPeriod = new String[10]; 290 291 public String getLightPeriod() { 292 if (LightPeriod[SectorIndex] == null) 293 return (LightPeriod[0]); 294 return LightPeriod[SectorIndex]; 295 } 296 297 public void setLightPeriod(String lightPeriod) { 298 String regex = "^[\\d\\s.]+$"; 299 300 if (!lightPeriod.isEmpty()) { 301 302 Pattern pat = Pattern.compile(regex); 303 Matcher matcher = pat.matcher(lightPeriod); 304 305 if (matcher.find()) { 306 setErrMsg(null); 307 } else { 308 setErrMsg("Must be a number"); 309 lightPeriod = ""; 310 dlg.tfM01RepeatTime.requestFocus(); 311 } 312 } 313 if (SectorIndex == 0) 314 LightPeriod = new String[10]; 315 LightPeriod[SectorIndex] = lightPeriod; 316 } 317 318 private Node Node = null; 319 320 public Node getNode() { 321 return Node; 322 } 323 324 public void setNode(Node node) { 325 Node = node; 326 } 327 328 private boolean TopMark = false; 329 330 public boolean hasTopMark() { 331 return TopMark; 332 } 333 334 public void setTopMark(boolean topMark) { 335 TopMark = topMark; 336 /* 337 * if (dlg.cM01TopMark == null) { return; } 338 */ 339 dlg.cM01TopMark.setSelected(topMark); 340 } 341 342 protected SmpDialogAction dlg = null; // hier wird der Dialog referenziert 343 344 public SmpDialogAction getDlg() { 345 return dlg; 346 } 347 348 public void setDlg(SmpDialogAction dlg) { 349 this.dlg = dlg; 350 } 351 352 protected Buoy(SmpDialogAction dia) { 353 dlg = dia; 354 } 355 356 public boolean isValid() { 357 return false; 358 } 359 360 public void parseLights(Map<String, String> k) { 361 setFired(false); 362 setSectored(false); 363 Iterator it = k.entrySet().iterator(); 364 while (it.hasNext()) { 365 Map.Entry entry = (Map.Entry) it.next(); 366 String key = (String) entry.getKey(); 367 String value = ((String) entry.getValue()).trim(); 368 if (key.contains("seamark:light:")) { 369 setFired(true); 370 int index = 0; 371 key = key.substring(14); 372 if (key.matches("^\\d:.*")) { 373 index = key.charAt(0) - '0'; 374 key = key.substring(2); 375 } else if (key.matches("^\\d$")) { 376 index = key.charAt(0) - '0'; 377 String values[] = value.split(":"); 378 if (values[0].equals("red")) 379 LightColour[index] = "R"; 380 else if (values[0].equals("green")) 381 LightColour[index] = "G"; 382 else if (values[0].equals("white")) 383 LightColour[index] = "W"; 384 Bearing1[index] = values[1]; 385 Bearing2[index] = values[2]; 386 Radius[index] = values[3]; 387 } else { 388 index = 0; 389 } 390 if (index != 0) 391 setSectored(true); 392 if (key.equals("colour")) { 393 if (value.equals("red")) 394 LightColour[index] = "R"; 395 else if (value.equals("green")) 396 LightColour[index] = "G"; 397 else if (value.equals("white")) 398 LightColour[index] = "W"; 399 } else if (key.equals("character")) { 400 LightChar[index] = value; 401 } else if (key.equals("group")) { 402 LightGroup[index] = value; 403 } else if (key.equals("period")) { 404 LightPeriod[index] = value; 405 } else if (key.equals("height")) { 406 Height[index] = value; 407 } else if (key.equals("range")) { 408 Range[index] = value; 409 } 410 } 411 } 412 setSectorIndex(0); 413 dlg.cbM01Sector.setSelectedIndex(0); 414 dlg.cM01Fired.setSelected(isFired()); 415 dlg.rbM01Fired1.setSelected(!isSectored()); 416 dlg.rbM01FiredN.setSelected(isSectored()); 417 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 418 dlg.tfM01Height.setText(getHeight()); 419 dlg.tfM01Range.setText(getRange()); 420 dlg.tfM01Group.setText(getLightGroup()); 421 dlg.tfM01RepeatTime.setText(getLightPeriod()); 422 dlg.cbM01Colour.setSelectedItem(getLightColour()); 423 } 424 425 public void parseFogRadar(Map<String, String> k) { 426 String str; 427 setFog(false); 428 setRadar(false); 429 setRacon(false); 430 if (k.containsKey("seamark:fog_signal") 431 || k.containsKey("seamark:fog_signal:category") 432 || k.containsKey("seamark:fog_signal:group") 433 || k.containsKey("seamark:fog_signal:period")) { 434 setFog(true); 435 if (k.containsKey("seamark:fog_signal:category")) { 436 str = k.get("seamark:fog_signal:category"); 437 if (str.equals("horn")) 438 setFogSound(FOG_HORN); 439 else if (str.equals("siren")) 440 setFogSound(FOG_SIREN); 441 else if (str.equals("diaphone")) 442 setFogSound(FOG_DIA); 443 else if (str.equals("bell")) 444 setFogSound(FOG_BELL); 445 else if (str.equals("whis")) 446 setFogSound(FOG_WHIS); 447 else if (str.equals("gong")) 448 setFogSound(FOG_GONG); 449 else if (str.equals("explosive")) 450 setFogSound(FOG_EXPLOS); 451 else 452 setFogSound(UNKNOWN_FOG); 453 } 454 if (k.containsKey("seamark:fog_signal:group")) 455 setFogGroup(k.get("seamark:fog_signal:group")); 456 if (k.containsKey("seamark:fog_signal:period")) 457 setFogPeriod(k.get("seamark:fog_signal:period")); 458 } 459 dlg.cM01Fog.setSelected(hasFog()); 460 dlg.cbM01Fog.setSelectedIndex(getFogSound()); 461 dlg.tfM01FogGroup.setText(getFogGroup()); 462 dlg.tfM01FogPeriod.setText(getFogPeriod()); 463 464 if (k.containsKey("seamark:radar_transponder") 465 || k.containsKey("seamark:radar_transponder:category") 466 || k.containsKey("seamark:radar_transponder:group")) { 467 setRacon(true); 468 if (k.containsKey("seamark:radar_transponder:category")) { 469 str = k.get("seamark:radar_transponder:category"); 470 if (str.equals("racon")) 471 setRaType(RATYPE_RACON); 472 else if (str.equals("ramark")) 473 setRaType(RATYPE_RAMARK); 474 else if (str.equals("leading")) 475 setRaType(RATYPE_LEADING); 476 else 477 setRaType(UNKNOWN_RATYPE); 478 } 479 if (k.containsKey("seamark:radar_transponder:group")) 480 setRaconGroup(k.get("seamark:radar_transponder:group")); 481 } else if (k.containsKey("seamark:radar_reflector")) 482 setRadar(true); 483 dlg.cM01Radar.setSelected(hasRadar()); 484 dlg.cM01Racon.setSelected(hasRacon()); 485 dlg.cbM01Racon.setSelectedIndex(getRaType()); 486 dlg.tfM01Racon.setText(getRaconGroup()); 487 } 488 489 public void paintSign() { 490 491 if (dlg.paintlock) 492 return; 493 else 494 dlg.paintlock = true; 495 496 dlg.lM01Icon.setIcon(null); 497 dlg.lM02Icon.setIcon(null); 498 dlg.lM03Icon.setIcon(null); 499 dlg.lM04Icon.setIcon(null); 500 dlg.lM05Icon.setIcon(null); 501 502 dlg.rbM01RegionA.setSelected(!getRegion()); 503 dlg.rbM01RegionB.setSelected(getRegion()); 504 505 if (isValid()) { 506 dlg.bM01Save.setEnabled(true); 507 508 dlg.cM01TopMark.setSelected(hasTopMark()); 509 dlg.cM01Fired.setSelected(isFired()); 510 511 dlg.tfM01RepeatTime.setText(getLightPeriod()); 512 513 dlg.tfM01Name.setText(getName()); 514 dlg.tfM01Name.setEnabled(true); 515 516 if (hasRadar()) { 517 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 518 "/images/Radar_Reflector.png"))); 519 } 520 521 if (hasRacon()) { 522 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 523 "/images/Radar_Station.png"))); 524 dlg.cbM01Racon.setVisible(true); 525 if (getRaType() == RATYPE_RACON) { 526 dlg.lM01Racon.setVisible(true); 527 dlg.tfM01Racon.setVisible(true); 528 dlg.tfM01Racon.setEnabled(true); 529 } else { 530 dlg.lM01Racon.setVisible(false); 531 dlg.tfM01Racon.setVisible(false); 532 } 533 } else { 534 dlg.cbM01Racon.setVisible(false); 535 dlg.lM01Racon.setVisible(false); 536 dlg.tfM01Racon.setVisible(false); 537 } 538 539 if (hasFog()) { 540 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 541 "/images/Fog_Signal.png"))); 542 dlg.cbM01Fog.setVisible(true); 543 if (getFogSound() == 0) { 544 dlg.lM01FogGroup.setVisible(false); 545 dlg.tfM01FogGroup.setVisible(false); 546 dlg.lM01FogPeriod.setVisible(false); 547 dlg.tfM01FogPeriod.setVisible(false); 548 } else { 549 dlg.lM01FogGroup.setVisible(true); 550 dlg.tfM01FogGroup.setVisible(true); 551 dlg.lM01FogPeriod.setVisible(true); 552 dlg.tfM01FogPeriod.setVisible(true); 553 } 554 } else { 555 dlg.cbM01Fog.setVisible(false); 556 dlg.lM01FogGroup.setVisible(false); 557 dlg.tfM01FogGroup.setVisible(false); 558 dlg.lM01FogPeriod.setVisible(false); 559 dlg.tfM01FogPeriod.setVisible(false); 560 } 561 562 if (isFired()) { 563 String lp, c; 564 String tmp = null; 565 int i1; 566 567 String col = getLightColour(); 568 if (col.equals("W")) { 569 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 570 "/images/Light_White_120.png"))); 571 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT); 572 } else if (col.equals("R")) { 573 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 574 "/images/Light_Red_120.png"))); 575 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT); 576 } else if (col.equals("G")) { 577 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 578 "/images/Light_Green_120.png"))); 579 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT); 580 } else { 581 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 582 "/images/Light_Magenta_120.png"))); 583 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR); 584 } 585 586 c = getLightChar(); 587 if (c.contains("+")) { 588 i1 = c.indexOf("+"); 589 tmp = c.substring(i1, c.length()); 590 c = c.substring(0, i1); 591 if (!getLightGroup().isEmpty()) { 592 c = c + "(" + getLightGroup() + ")"; 593 } 594 if (tmp != null) 595 c = c + tmp; 596 } 597 dlg.cbM01Kennung.setSelectedItem(c); 598 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup() 599 .isEmpty()) 600 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) 601 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) { 602 c = c + "(" + getLightGroup() + ")"; 603 dlg.cbM01Kennung.setSelectedItem(c); 604 } 605 c = c + " " + getLightColour(); 606 lp = getLightPeriod(); 607 if (!lp.isEmpty()) 608 c = c + " " + lp + "s"; 609 dlg.lM01FireMark.setText(c); 610 dlg.cM01Fired.setVisible(true); 611 dlg.lM01Kennung.setVisible(true); 612 dlg.cbM01Kennung.setVisible(true); 613 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) { 614 dlg.tfM01Group.setVisible(false); 615 dlg.lM01Group.setVisible(false); 616 } else { 617 dlg.lM01Group.setVisible(true); 618 dlg.tfM01Group.setVisible(true); 619 } 620 dlg.tfM01Group.setText(getLightGroup()); 621 dlg.lM01RepeatTime.setVisible(true); 622 dlg.tfM01RepeatTime.setVisible(true); 623 if (isSectored()) { 624 dlg.rbM01Fired1.setSelected(false); 625 dlg.rbM01FiredN.setSelected(true); 626 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty())) 627 dlg.cbM01Kennung.setEnabled(false); 628 else 629 dlg.cbM01Kennung.setEnabled(true); 630 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 631 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty())) 632 dlg.tfM01Group.setEnabled(false); 633 else 634 dlg.tfM01Group.setEnabled(true); 635 dlg.tfM01Group.setText(getLightGroup()); 636 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty())) 637 dlg.tfM01RepeatTime.setEnabled(false); 638 else 639 dlg.tfM01RepeatTime.setEnabled(true); 640 dlg.tfM01RepeatTime.setText(getLightPeriod()); 641 if ((getSectorIndex() != 0) && (!Height[0].isEmpty())) 642 dlg.tfM01Height.setEnabled(false); 643 else 644 dlg.tfM01Height.setEnabled(true); 645 dlg.tfM01Height.setText(getHeight()); 646 if ((getSectorIndex() != 0) && (!Range[0].isEmpty())) 647 dlg.tfM01Range.setEnabled(false); 648 else 649 dlg.tfM01Range.setEnabled(true); 650 dlg.tfM01Range.setText(getRange()); 651 dlg.lM01Sector.setVisible(true); 652 dlg.cbM01Sector.setVisible(true); 653 if (getSectorIndex() == 0) { 654 dlg.lM01Colour.setVisible(false); 655 dlg.cbM01Colour.setVisible(false); 656 dlg.lM01Bearing.setVisible(false); 657 dlg.tfM01Bearing.setVisible(false); 658 dlg.tfM02Bearing.setVisible(false); 659 dlg.tfM01Radius.setVisible(false); 660 } else { 661 dlg.lM01Colour.setVisible(true); 662 dlg.cbM01Colour.setVisible(true); 663 dlg.lM01Bearing.setVisible(true); 664 dlg.tfM01Bearing.setVisible(true); 665 dlg.tfM01Bearing.setText(getBearing1()); 666 dlg.tfM02Bearing.setVisible(true); 667 dlg.tfM02Bearing.setText(getBearing2()); 668 dlg.tfM01Radius.setVisible(true); 669 dlg.tfM01Radius.setText(getRadius()); 670 } 671 } else { 672 dlg.rbM01FiredN.setSelected(false); 673 dlg.rbM01Fired1.setSelected(true); 674 dlg.cbM01Kennung.setEnabled(true); 675 dlg.tfM01Group.setEnabled(true); 676 dlg.tfM01RepeatTime.setEnabled(true); 677 dlg.tfM01Height.setEnabled(true); 678 dlg.tfM01Range.setEnabled(true); 679 dlg.lM01Colour.setVisible(true); 680 dlg.cbM01Colour.setVisible(true); 681 dlg.lM01Sector.setVisible(false); 682 dlg.cbM01Sector.setVisible(false); 683 dlg.lM01Bearing.setVisible(false); 684 dlg.tfM01Bearing.setVisible(false); 685 dlg.tfM02Bearing.setVisible(false); 686 dlg.tfM01Radius.setVisible(false); 687 } 688 } else { 689 dlg.lM01FireMark.setText(""); 690 dlg.rbM01Fired1.setVisible(false); 691 dlg.rbM01FiredN.setVisible(false); 692 dlg.cbM01Kennung.setVisible(false); 693 dlg.lM01Kennung.setVisible(false); 694 dlg.tfM01Height.setVisible(false); 695 dlg.lM01Height.setVisible(false); 696 dlg.tfM01Range.setVisible(false); 697 dlg.lM01Range.setVisible(false); 698 dlg.cbM01Colour.setVisible(false); 699 dlg.lM01Colour.setVisible(false); 700 dlg.cbM01Sector.setVisible(false); 701 dlg.lM01Sector.setVisible(false); 702 dlg.tfM01Group.setVisible(false); 703 dlg.lM01Group.setVisible(false); 704 dlg.tfM01RepeatTime.setVisible(false); 705 dlg.lM01RepeatTime.setVisible(false); 706 dlg.tfM01Bearing.setVisible(false); 707 dlg.lM01Bearing.setVisible(false); 708 dlg.tfM02Bearing.setVisible(false); 709 dlg.tfM01Radius.setVisible(false); 710 } 711 } else { 712 dlg.bM01Save.setEnabled(false); 713 dlg.tfM01Name.setEnabled(false); 714 dlg.cM01TopMark.setVisible(false); 715 dlg.cbM01TopMark.setVisible(false); 716 dlg.cM01Radar.setVisible(false); 717 dlg.cM01Racon.setVisible(false); 718 dlg.cbM01Racon.setVisible(false); 719 dlg.tfM01Racon.setVisible(false); 720 dlg.lM01Racon.setVisible(false); 721 dlg.cM01Fog.setVisible(false); 722 dlg.cbM01Fog.setVisible(false); 723 dlg.tfM01FogGroup.setVisible(false); 724 dlg.lM01FogGroup.setVisible(false); 725 dlg.tfM01FogPeriod.setVisible(false); 726 dlg.lM01FogPeriod.setVisible(false); 727 dlg.cM01Fired.setVisible(false); 728 dlg.rbM01Fired1.setVisible(false); 729 dlg.rbM01FiredN.setVisible(false); 730 dlg.cbM01Kennung.setVisible(false); 731 dlg.lM01Kennung.setVisible(false); 732 dlg.tfM01Height.setVisible(false); 733 dlg.lM01Height.setVisible(false); 734 dlg.tfM01Range.setVisible(false); 735 dlg.lM01Range.setVisible(false); 736 dlg.cbM01Colour.setVisible(false); 737 dlg.lM01Colour.setVisible(false); 738 dlg.cbM01Sector.setVisible(false); 739 dlg.lM01Sector.setVisible(false); 740 dlg.tfM01Group.setVisible(false); 741 dlg.lM01Group.setVisible(false); 742 dlg.tfM01RepeatTime.setVisible(false); 743 dlg.lM01RepeatTime.setVisible(false); 744 dlg.tfM01Bearing.setVisible(false); 745 dlg.lM01Bearing.setVisible(false); 746 dlg.tfM02Bearing.setVisible(false); 747 dlg.tfM01Radius.setVisible(false); 748 } 749 dlg.paintlock = false; 750 } 751 752 public void saveSign(String type) { 753 delSeaMarkKeys(Node); 754 755 String str = dlg.tfM01Name.getText(); 756 if (!str.isEmpty()) 757 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name", 758 str)); 759 Main.main.undoRedo 760 .add(new ChangePropertyCommand(Node, "seamark:type", type)); 761 } 762 763 protected void saveLightData() { 764 String colour; 765 if (dlg.cM01Fired.isSelected()) { 766 if (!(colour = LightColour[0]).isEmpty()) 767 if (colour.equals("R")) { 768 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 769 "seamark:light:colour", "red")); 770 } else if (colour.equals("G")) { 771 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 772 "seamark:light:colour", "green")); 773 } else if (colour.equals("W")) { 774 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 775 "seamark:light:colour", "white")); 776 } 777 778 if (!LightPeriod[0].isEmpty()) 779 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 780 "seamark:light:period", LightPeriod[0])); 781 782 if (!LightChar[0].isEmpty()) 783 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 784 "seamark:light:character", LightChar[0])); 785 786 if (!LightGroup[0].isEmpty()) 787 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 788 "seamark:light:group", LightGroup[0])); 789 790 if (!Height[0].isEmpty()) 791 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 792 "seamark:light:height", Height[0])); 793 794 if (!Range[0].isEmpty()) 795 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 796 "seamark:light:range", Range[0])); 797 798 for (int i = 1; i < 10; i++) { 799 if ((colour = LightColour[i]) != null) 800 if (colour.equals("R")) { 801 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 802 "seamark:light:" + i + ":colour", "red")); 803 if ((Bearing1[i] != null) && (Bearing2[i] != null) 804 && (Radius[i] != null)) 805 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 806 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 807 + Bearing2[i] + ":" + Radius[i])); 808 } else if (colour.equals("G")) { 809 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 810 "seamark:light:" + i + ":colour", "green")); 811 if ((Bearing1[i] != null) && (Bearing2[i] != null) 812 && (Radius[i] != null)) 813 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 814 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 815 + Bearing2[i] + ":" + Radius[i])); 816 } else if (colour.equals("W")) { 817 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 818 "seamark:light:" + i + ":colour", "white")); 819 if ((Bearing1[i] != null) && (Bearing2[i] != null) 820 && (Radius[i] != null)) 821 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 822 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 823 + Bearing2[i] + ":" + Radius[i])); 824 } 825 826 if (LightPeriod[i] != null) 827 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 828 "seamark:light:" + i + ":period", LightPeriod[i])); 829 830 if (LightChar[i] != null) 831 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 832 "seamark:light:" + i + ":character", LightChar[i])); 833 834 if (LightGroup[i] != null) 835 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 836 "seamark:light:" + i + ":group", LightGroup[i])); 837 838 if (Height[i] != null) 839 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 840 "seamark:light:" + i + ":height", Height[i])); 841 842 if (Range[i] != null) 843 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 844 "seamark:light:" + i + ":range", Range[i])); 845 846 if (Bearing1[i] != null) 847 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 848 "seamark:light:" + i + ":sector_start", Bearing1[i])); 849 850 if (Bearing2[i] != null) 851 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 852 "seamark:light:" + i + ":sector_end", Bearing2[i])); 853 } 854 } 855 } 856 857 protected void saveTopMarkData(String shape, String colour) { 858 if (dlg.cM01TopMark.isSelected()) { 859 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 860 "seamark:topmark:shape", shape)); 861 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 862 "seamark:topmark:colour", colour)); 863 } 864 } 865 866 protected void saveRadarFogData() { 867 if (hasRadar()) { 868 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 869 "seamark:radar_reflector", "yes")); 870 } 871 if (hasRacon()) { 872 switch (RaType) { 873 case RATYPE_RACON: 874 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 875 "seamark:radar_transponder:category", "racon")); 876 if (!getRaconGroup().isEmpty()) 877 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 878 "seamark:radar_transponder:group", getRaconGroup())); 879 break; 880 case RATYPE_RAMARK: 881 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 882 "seamark:radar_transponder:category", "ramark")); 883 break; 884 case RATYPE_LEADING: 885 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 886 "seamark:radar_transponder:category", "leading")); 887 break; 888 default: 889 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 890 "seamark:radar_transponder", "yes")); 891 } 892 } 893 if (hasFog()) { 894 if (getFogSound() == 0) { 895 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 896 "seamark:fog_signal", "yes")); 897 } else { 898 switch (getFogSound()) { 899 case FOG_HORN: 900 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 901 "seamark:fog_signal:category", "horn")); 902 break; 903 case FOG_SIREN: 904 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 905 "seamark:fog_signal:category", "siren")); 906 break; 907 case FOG_DIA: 908 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 909 "seamark:fog_signal:category", "diaphone")); 910 break; 911 case FOG_BELL: 912 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 913 "seamark:fog_signal:category", "bell")); 914 break; 915 case FOG_WHIS: 916 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 917 "seamark:fog_signal:category", "whistle")); 918 break; 919 case FOG_GONG: 920 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 921 "seamark:fog_signal:category", "gong")); 922 break; 923 case FOG_EXPLOS: 924 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 925 "seamark:fog_signal:category", "explosive")); 926 break; 927 } 928 if (!getFogGroup().isEmpty()) 929 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 930 "seamark:fog_signal:group", getFogGroup())); 931 if (!getFogPeriod().isEmpty()) 932 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 933 "seamark:fog_signal:period", getFogPeriod())); 934 } 935 } 936 } 937 938 public void refreshStyles() { 939 } 940 941 public void refreshLights() { 942 dlg.cbM01Kennung.removeAllItems(); 943 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 944 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$ 945 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 946 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 947 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$ 948 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$ 949 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 950 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 951 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$ 952 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 953 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$ 954 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$ 955 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$ 956 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 957 dlg.cbM01Kennung.setSelectedIndex(0); 958 } 959 960 public void resetMask() { 961 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 962 963 dlg.lM01Icon.setIcon(null); 964 dlg.lM02Icon.setIcon(null); 965 dlg.lM03Icon.setIcon(null); 966 dlg.lM04Icon.setIcon(null); 967 968 dlg.rbM01RegionA.setEnabled(false); 969 dlg.rbM01RegionB.setEnabled(false); 970 dlg.lM01FireMark.setText(""); 971 dlg.cbM01CatOfMark.removeAllItems(); 972 dlg.cbM01CatOfMark.setVisible(false); 973 dlg.lM01CatOfMark.setVisible(false); 974 setBuoyIndex(0); 975 dlg.cbM01StyleOfMark.removeAllItems(); 976 dlg.cbM01StyleOfMark.setVisible(false); 977 dlg.lM01StyleOfMark.setVisible(false); 978 setStyleIndex(0); 979 dlg.tfM01Name.setText(""); 980 dlg.tfM01Name.setEnabled(false); 981 setName(""); 982 dlg.cM01TopMark.setSelected(false); 983 dlg.cM01TopMark.setVisible(false); 984 dlg.cbM01TopMark.removeAllItems(); 985 dlg.cbM01TopMark.setVisible(false); 986 setTopMark(false); 987 dlg.cM01Radar.setSelected(false); 988 dlg.cM01Radar.setVisible(false); 989 setRadar(false); 990 dlg.cM01Racon.setSelected(false); 991 dlg.cM01Racon.setVisible(false); 992 dlg.cbM01Racon.setVisible(false); 993 dlg.tfM01Racon.setText(""); 994 dlg.tfM01Racon.setVisible(false); 995 dlg.lM01Racon.setVisible(false); 996 setRacon(false); 997 setRaType(0); 998 dlg.cM01Fog.setSelected(false); 999 dlg.cM01Fog.setVisible(false); 1000 dlg.cbM01Fog.setVisible(false); 1001 setFogSound(0); 1002 dlg.tfM01FogGroup.setText(""); 1003 dlg.tfM01FogGroup.setVisible(false); 1004 dlg.lM01FogGroup.setVisible(false); 1005 dlg.tfM01FogPeriod.setText(""); 1006 dlg.tfM01FogPeriod.setVisible(false); 1007 dlg.lM01FogPeriod.setVisible(false); 1008 setFog(false); 1009 dlg.cM01Fired.setSelected(false); 1010 dlg.cM01Fired.setVisible(false); 1011 setFired(false); 1012 dlg.rbM01Fired1.setVisible(false); 1013 dlg.rbM01Fired1.setSelected(true); 1014 dlg.rbM01FiredN.setVisible(false); 1015 dlg.rbM01FiredN.setSelected(false); 1016 setSectored(false); 1017 dlg.cbM01Kennung.removeAllItems(); 1018 dlg.cbM01Kennung.setVisible(false); 1019 dlg.lM01Kennung.setVisible(false); 1020 setLightChar(""); 1021 dlg.tfM01Height.setText(""); 1022 dlg.tfM01Height.setVisible(false); 1023 dlg.lM01Height.setVisible(false); 1024 setHeight(""); 1025 dlg.tfM01Range.setText(""); 1026 dlg.tfM01Range.setVisible(false); 1027 dlg.lM01Range.setVisible(false); 1028 setRange(""); 1029 dlg.cbM01Colour.setVisible(false); 1030 dlg.lM01Colour.setVisible(false); 1031 setLightColour(""); 1032 dlg.cbM01Sector.setVisible(false); 1033 dlg.lM01Sector.setVisible(false); 1034 setSectorIndex(0); 1035 dlg.tfM01Group.setText(""); 1036 dlg.tfM01Group.setVisible(false); 1037 dlg.lM01Group.setVisible(false); 1038 setLightGroup(""); 1039 dlg.tfM01RepeatTime.setText(""); 1040 dlg.tfM01RepeatTime.setVisible(false); 1041 dlg.lM01RepeatTime.setVisible(false); 1042 setLightPeriod(""); 1043 dlg.tfM01Bearing.setText(""); 1044 dlg.tfM01Bearing.setVisible(false); 1045 dlg.lM01Bearing.setVisible(false); 1046 setBearing1(""); 1047 dlg.tfM02Bearing.setText(""); 1048 dlg.tfM02Bearing.setVisible(false); 1049 setBearing2(""); 1050 dlg.tfM01Radius.setText(""); 1051 dlg.tfM01Radius.setVisible(false); 1052 setRadius(""); 1053 1054 dlg.bM01Save.setEnabled(false); 1055 } 1056 1056 1057 1057 }
Note:
See TracChangeset
for help on using the changeset viewer.
