Changeset 23239 in osm for applications
- Timestamp:
- 2010-09-17T13:19:54+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/toms/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java
r23224 r23239 124 124 public JLabel lM05Icon = null; // Fog 125 125 public JLabel lM06Icon = null; // Topmark 126 public JLabel lM01NameMark = null; 126 127 public JLabel lM01FireMark = null; 128 public JLabel lM01FogMark = null; 129 public JLabel lM01RadarMark = null; 127 130 private JLabel lM01TypeOfMark = null; 128 131 public JComboBox cbM01TypeOfMark = null; … … 512 515 513 516 lM01Icon = new JLabel(); 514 lM01Icon.setBounds(new Rectangle(2 10, 20, 150, 200));517 lM01Icon.setBounds(new Rectangle(220, 20, 150, 200)); 515 518 lM01Icon.setIcon(null); 516 519 lM01Icon.setText(""); //$NON-NLS-1$ 517 520 518 521 lM02Icon = new JLabel(); 519 lM02Icon.setBounds(new Rectangle(2 10, 20, 150, 200));522 lM02Icon.setBounds(new Rectangle(220, 20, 150, 200)); 520 523 lM02Icon.setIcon(null); 521 524 lM02Icon.setText(""); //$NON-NLS-1$ 522 525 523 526 lM03Icon = new JLabel(); 524 lM03Icon.setBounds(new Rectangle(2 10, -50, 150, 200));527 lM03Icon.setBounds(new Rectangle(220, -50, 150, 200)); 525 528 lM03Icon.setIcon(null); 526 529 lM03Icon.setText(""); //$NON-NLS-1$ 527 530 528 531 lM04Icon = new JLabel(); 529 lM04Icon.setBounds(new Rectangle(2 10, 20, 150, 200));532 lM04Icon.setBounds(new Rectangle(220, 20, 150, 200)); 530 533 lM04Icon.setIcon(null); 531 534 lM04Icon.setText(""); //$NON-NLS-1$ 532 535 533 536 lM05Icon = new JLabel(); 534 lM05Icon.setBounds(new Rectangle(2 10, 20, 150, 200));537 lM05Icon.setBounds(new Rectangle(220, 20, 150, 200)); 535 538 lM05Icon.setIcon(null); 536 539 lM05Icon.setText(""); //$NON-NLS-1$ 537 540 538 541 lM06Icon = new JLabel(); 539 lM06Icon.setBounds(new Rectangle(2 10, 20, 150, 200));542 lM06Icon.setBounds(new Rectangle(220, 20, 150, 200)); 540 543 lM06Icon.setIcon(null); 541 544 lM06Icon.setText(""); //$NON-NLS-1$ 542 545 543 546 lM01FireMark = new JLabel(); 544 lM01FireMark.setBounds(new Rectangle(3 00, 85, 95, 20));545 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 1 2)); //$NON-NLS-1$547 lM01FireMark.setBounds(new Rectangle(315, 85, 80, 20)); 548 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 10)); //$NON-NLS-1$ 546 549 lM01FireMark.setText(""); //$NON-NLS-1$ 550 551 lM01NameMark = new JLabel(); 552 lM01NameMark.setBounds(new Rectangle(315, 65, 80, 20)); 553 lM01NameMark.setFont(new Font("Dialog", Font.PLAIN, 10)); //$NON-NLS-1$ 554 lM01NameMark.setText(""); //$NON-NLS-1$ 555 556 lM01FogMark = new JLabel(); 557 lM01FogMark.setBounds(new Rectangle(220, 85, 70, 20)); 558 lM01FogMark.setFont(new Font("Dialog", Font.PLAIN, 10)); //$NON-NLS-1$ 559 lM01FogMark.setText(""); //$NON-NLS-1$ 560 561 lM01RadarMark = new JLabel(); 562 lM01RadarMark.setBounds(new Rectangle(230, 65, 70, 20)); 563 lM01RadarMark.setFont(new Font("Dialog", Font.PLAIN, 10)); //$NON-NLS-1$ 564 lM01RadarMark.setText(""); //$NON-NLS-1$ 547 565 548 566 lM01Head = new JLabel(); … … 741 759 pM01SeaMap.add(getTfM01Range(), null); 742 760 pM01SeaMap.add(lM01FireMark, null); 761 pM01SeaMap.add(lM01NameMark, null); 762 pM01SeaMap.add(lM01FogMark, null); 763 pM01SeaMap.add(lM01RadarMark, null); 743 764 pM01SeaMap.add(getBM01Save(), null); 744 765 pM01SeaMap.add(getSM01StatusBar(), null); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r23223 r23239 23 23 abstract public class Buoy extends SeaMark { 24 24 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 dlg.lM06Icon.setIcon(null); 502 503 dlg.rbM01RegionA.setSelected(!getRegion()); 504 dlg.rbM01RegionB.setSelected(getRegion()); 505 506 if (isValid()) { 507 dlg.bM01Save.setEnabled(true); 508 509 dlg.cM01TopMark.setSelected(hasTopMark()); 510 dlg.cM01Fired.setSelected(isFired()); 511 512 dlg.tfM01RepeatTime.setText(getLightPeriod()); 513 514 dlg.tfM01Name.setText(getName()); 515 dlg.tfM01Name.setEnabled(true); 516 517 if (hasRadar()) { 518 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 519 "/images/Radar_Reflector.png"))); 520 } 521 522 if (hasRacon()) { 523 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 524 "/images/Radar_Station.png"))); 525 dlg.cbM01Racon.setVisible(true); 526 if (getRaType() == RATYPE_RACON) { 527 dlg.lM01Racon.setVisible(true); 528 dlg.tfM01Racon.setVisible(true); 529 dlg.tfM01Racon.setEnabled(true); 530 } else { 531 dlg.lM01Racon.setVisible(false); 532 dlg.tfM01Racon.setVisible(false); 533 } 534 } else { 535 dlg.cbM01Racon.setVisible(false); 536 dlg.lM01Racon.setVisible(false); 537 dlg.tfM01Racon.setVisible(false); 538 } 539 540 if (hasFog()) { 541 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 542 "/images/Fog_Signal.png"))); 543 dlg.cbM01Fog.setVisible(true); 544 if (getFogSound() == 0) { 545 dlg.lM01FogGroup.setVisible(false); 546 dlg.tfM01FogGroup.setVisible(false); 547 dlg.lM01FogPeriod.setVisible(false); 548 dlg.tfM01FogPeriod.setVisible(false); 549 } else { 550 dlg.lM01FogGroup.setVisible(true); 551 dlg.tfM01FogGroup.setVisible(true); 552 dlg.lM01FogPeriod.setVisible(true); 553 dlg.tfM01FogPeriod.setVisible(true); 554 } 555 } else { 556 dlg.cbM01Fog.setVisible(false); 557 dlg.lM01FogGroup.setVisible(false); 558 dlg.tfM01FogGroup.setVisible(false); 559 dlg.lM01FogPeriod.setVisible(false); 560 dlg.tfM01FogPeriod.setVisible(false); 561 } 562 563 if (isFired()) { 564 String lp, c; 565 String tmp = null; 566 int i1; 567 568 String col = getLightColour(); 569 if (col.equals("W")) { 570 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 571 "/images/Light_White_120.png"))); 572 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT); 573 } else if (col.equals("R")) { 574 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 575 "/images/Light_Red_120.png"))); 576 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT); 577 } else if (col.equals("G")) { 578 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 579 "/images/Light_Green_120.png"))); 580 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT); 581 } else { 582 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 583 "/images/Light_Magenta_120.png"))); 584 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR); 585 } 586 587 c = getLightChar(); 588 if (c.contains("+")) { 589 i1 = c.indexOf("+"); 590 tmp = c.substring(i1, c.length()); 591 c = c.substring(0, i1); 592 if (!getLightGroup().isEmpty()) { 593 c = c + "(" + getLightGroup() + ")"; 594 } 595 if (tmp != null) 596 c = c + tmp; 597 } 598 dlg.cbM01Kennung.setSelectedItem(c); 599 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup() 600 .isEmpty()) 601 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) 602 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) { 603 c = c + "(" + getLightGroup() + ")"; 604 dlg.cbM01Kennung.setSelectedItem(c); 605 } 606 c = c + " " + getLightColour(); 607 lp = getLightPeriod(); 608 if (!lp.isEmpty()) 609 c = c + " " + lp + "s"; 610 dlg.lM01FireMark.setText(c); 611 dlg.cM01Fired.setVisible(true); 612 dlg.lM01Kennung.setVisible(true); 613 dlg.cbM01Kennung.setVisible(true); 614 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) { 615 dlg.tfM01Group.setVisible(false); 616 dlg.lM01Group.setVisible(false); 617 } else { 618 dlg.lM01Group.setVisible(true); 619 dlg.tfM01Group.setVisible(true); 620 } 621 dlg.tfM01Group.setText(getLightGroup()); 622 dlg.lM01RepeatTime.setVisible(true); 623 dlg.tfM01RepeatTime.setVisible(true); 624 if (isSectored()) { 625 dlg.rbM01Fired1.setSelected(false); 626 dlg.rbM01FiredN.setSelected(true); 627 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty())) 628 dlg.cbM01Kennung.setEnabled(false); 629 else 630 dlg.cbM01Kennung.setEnabled(true); 631 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 632 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty())) 633 dlg.tfM01Group.setEnabled(false); 634 else 635 dlg.tfM01Group.setEnabled(true); 636 dlg.tfM01Group.setText(getLightGroup()); 637 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty())) 638 dlg.tfM01RepeatTime.setEnabled(false); 639 else 640 dlg.tfM01RepeatTime.setEnabled(true); 641 dlg.tfM01RepeatTime.setText(getLightPeriod()); 642 if ((getSectorIndex() != 0) && (!Height[0].isEmpty())) 643 dlg.tfM01Height.setEnabled(false); 644 else 645 dlg.tfM01Height.setEnabled(true); 646 dlg.tfM01Height.setText(getHeight()); 647 if ((getSectorIndex() != 0) && (!Range[0].isEmpty())) 648 dlg.tfM01Range.setEnabled(false); 649 else 650 dlg.tfM01Range.setEnabled(true); 651 dlg.tfM01Range.setText(getRange()); 652 dlg.lM01Sector.setVisible(true); 653 dlg.cbM01Sector.setVisible(true); 654 if (getSectorIndex() == 0) { 655 dlg.lM01Colour.setVisible(false); 656 dlg.cbM01Colour.setVisible(false); 657 dlg.lM01Bearing.setVisible(false); 658 dlg.tfM01Bearing.setVisible(false); 659 dlg.tfM02Bearing.setVisible(false); 660 dlg.tfM01Radius.setVisible(false); 661 } else { 662 dlg.lM01Colour.setVisible(true); 663 dlg.cbM01Colour.setVisible(true); 664 dlg.lM01Bearing.setVisible(true); 665 dlg.tfM01Bearing.setVisible(true); 666 dlg.tfM01Bearing.setText(getBearing1()); 667 dlg.tfM02Bearing.setVisible(true); 668 dlg.tfM02Bearing.setText(getBearing2()); 669 dlg.tfM01Radius.setVisible(true); 670 dlg.tfM01Radius.setText(getRadius()); 671 } 672 } else { 673 dlg.rbM01FiredN.setSelected(false); 674 dlg.rbM01Fired1.setSelected(true); 675 dlg.cbM01Kennung.setEnabled(true); 676 dlg.tfM01Group.setEnabled(true); 677 dlg.tfM01RepeatTime.setEnabled(true); 678 dlg.tfM01Height.setEnabled(true); 679 dlg.tfM01Range.setEnabled(true); 680 dlg.lM01Colour.setVisible(true); 681 dlg.cbM01Colour.setVisible(true); 682 dlg.lM01Sector.setVisible(false); 683 dlg.cbM01Sector.setVisible(false); 684 dlg.lM01Bearing.setVisible(false); 685 dlg.tfM01Bearing.setVisible(false); 686 dlg.tfM02Bearing.setVisible(false); 687 dlg.tfM01Radius.setVisible(false); 688 } 689 } else { 690 dlg.lM01FireMark.setText(""); 691 dlg.rbM01Fired1.setVisible(false); 692 dlg.rbM01FiredN.setVisible(false); 693 dlg.cbM01Kennung.setVisible(false); 694 dlg.lM01Kennung.setVisible(false); 695 dlg.tfM01Height.setVisible(false); 696 dlg.lM01Height.setVisible(false); 697 dlg.tfM01Range.setVisible(false); 698 dlg.lM01Range.setVisible(false); 699 dlg.cbM01Colour.setVisible(false); 700 dlg.lM01Colour.setVisible(false); 701 dlg.cbM01Sector.setVisible(false); 702 dlg.lM01Sector.setVisible(false); 703 dlg.tfM01Group.setVisible(false); 704 dlg.lM01Group.setVisible(false); 705 dlg.tfM01RepeatTime.setVisible(false); 706 dlg.lM01RepeatTime.setVisible(false); 707 dlg.tfM01Bearing.setVisible(false); 708 dlg.lM01Bearing.setVisible(false); 709 dlg.tfM02Bearing.setVisible(false); 710 dlg.tfM01Radius.setVisible(false); 711 } 712 } else { 713 dlg.bM01Save.setEnabled(false); 714 dlg.tfM01Name.setEnabled(false); 715 dlg.cM01TopMark.setVisible(false); 716 dlg.cbM01TopMark.setVisible(false); 717 dlg.cM01Radar.setVisible(false); 718 dlg.cM01Racon.setVisible(false); 719 dlg.cbM01Racon.setVisible(false); 720 dlg.tfM01Racon.setVisible(false); 721 dlg.lM01Racon.setVisible(false); 722 dlg.cM01Fog.setVisible(false); 723 dlg.cbM01Fog.setVisible(false); 724 dlg.tfM01FogGroup.setVisible(false); 725 dlg.lM01FogGroup.setVisible(false); 726 dlg.tfM01FogPeriod.setVisible(false); 727 dlg.lM01FogPeriod.setVisible(false); 728 dlg.cM01Fired.setVisible(false); 729 dlg.rbM01Fired1.setVisible(false); 730 dlg.rbM01FiredN.setVisible(false); 731 dlg.cbM01Kennung.setVisible(false); 732 dlg.lM01Kennung.setVisible(false); 733 dlg.tfM01Height.setVisible(false); 734 dlg.lM01Height.setVisible(false); 735 dlg.tfM01Range.setVisible(false); 736 dlg.lM01Range.setVisible(false); 737 dlg.cbM01Colour.setVisible(false); 738 dlg.lM01Colour.setVisible(false); 739 dlg.cbM01Sector.setVisible(false); 740 dlg.lM01Sector.setVisible(false); 741 dlg.tfM01Group.setVisible(false); 742 dlg.lM01Group.setVisible(false); 743 dlg.tfM01RepeatTime.setVisible(false); 744 dlg.lM01RepeatTime.setVisible(false); 745 dlg.tfM01Bearing.setVisible(false); 746 dlg.lM01Bearing.setVisible(false); 747 dlg.tfM02Bearing.setVisible(false); 748 dlg.tfM01Radius.setVisible(false); 749 } 750 dlg.paintlock = false; 751 } 752 753 public void saveSign(String type) { 754 delSeaMarkKeys(Node); 755 756 String str = dlg.tfM01Name.getText(); 757 if (!str.isEmpty()) 758 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name", 759 str)); 760 Main.main.undoRedo 761 .add(new ChangePropertyCommand(Node, "seamark:type", type)); 762 } 763 764 protected void saveLightData() { 765 String colour; 766 if (dlg.cM01Fired.isSelected()) { 767 if (!(colour = LightColour[0]).isEmpty()) 768 if (colour.equals("R")) { 769 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 770 "seamark:light:colour", "red")); 771 } else if (colour.equals("G")) { 772 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 773 "seamark:light:colour", "green")); 774 } else if (colour.equals("W")) { 775 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 776 "seamark:light:colour", "white")); 777 } 778 779 if (!LightPeriod[0].isEmpty()) 780 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 781 "seamark:light:period", LightPeriod[0])); 782 783 if (!LightChar[0].isEmpty()) 784 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 785 "seamark:light:character", LightChar[0])); 786 787 if (!LightGroup[0].isEmpty()) 788 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 789 "seamark:light:group", LightGroup[0])); 790 791 if (!Height[0].isEmpty()) 792 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 793 "seamark:light:height", Height[0])); 794 795 if (!Range[0].isEmpty()) 796 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 797 "seamark:light:range", Range[0])); 798 799 for (int i = 1; i < 10; i++) { 800 if ((colour = LightColour[i]) != null) 801 if (colour.equals("R")) { 802 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 803 "seamark:light:" + i + ":colour", "red")); 804 if ((Bearing1[i] != null) && (Bearing2[i] != null) 805 && (Radius[i] != null)) 806 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 807 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 808 + Bearing2[i] + ":" + Radius[i])); 809 } else if (colour.equals("G")) { 810 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 811 "seamark:light:" + i + ":colour", "green")); 812 if ((Bearing1[i] != null) && (Bearing2[i] != null) 813 && (Radius[i] != null)) 814 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 815 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 816 + Bearing2[i] + ":" + Radius[i])); 817 } else if (colour.equals("W")) { 818 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 819 "seamark:light:" + i + ":colour", "white")); 820 if ((Bearing1[i] != null) && (Bearing2[i] != null) 821 && (Radius[i] != null)) 822 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 823 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 824 + Bearing2[i] + ":" + Radius[i])); 825 } 826 827 if (LightPeriod[i] != null) 828 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 829 "seamark:light:" + i + ":period", LightPeriod[i])); 830 831 if (LightChar[i] != null) 832 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 833 "seamark:light:" + i + ":character", LightChar[i])); 834 835 if (LightGroup[i] != null) 836 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 837 "seamark:light:" + i + ":group", LightGroup[i])); 838 839 if (Height[i] != null) 840 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 841 "seamark:light:" + i + ":height", Height[i])); 842 843 if (Range[i] != null) 844 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 845 "seamark:light:" + i + ":range", Range[i])); 846 847 if (Bearing1[i] != null) 848 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 849 "seamark:light:" + i + ":sector_start", Bearing1[i])); 850 851 if (Bearing2[i] != null) 852 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 853 "seamark:light:" + i + ":sector_end", Bearing2[i])); 854 } 855 } 856 } 857 858 protected void saveTopMarkData(String shape, String colour) { 859 if (dlg.cM01TopMark.isSelected()) { 860 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 861 "seamark:topmark:shape", shape)); 862 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 863 "seamark:topmark:colour", colour)); 864 } 865 } 866 867 protected void saveRadarFogData() { 868 if (hasRadar()) { 869 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 870 "seamark:radar_reflector", "yes")); 871 } 872 if (hasRacon()) { 873 switch (RaType) { 874 case RATYPE_RACON: 875 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 876 "seamark:radar_transponder:category", "racon")); 877 if (!getRaconGroup().isEmpty()) 878 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 879 "seamark:radar_transponder:group", getRaconGroup())); 880 break; 881 case RATYPE_RAMARK: 882 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 883 "seamark:radar_transponder:category", "ramark")); 884 break; 885 case RATYPE_LEADING: 886 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 887 "seamark:radar_transponder:category", "leading")); 888 break; 889 default: 890 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 891 "seamark:radar_transponder", "yes")); 892 } 893 } 894 if (hasFog()) { 895 if (getFogSound() == 0) { 896 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 897 "seamark:fog_signal", "yes")); 898 } else { 899 switch (getFogSound()) { 900 case FOG_HORN: 901 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 902 "seamark:fog_signal:category", "horn")); 903 break; 904 case FOG_SIREN: 905 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 906 "seamark:fog_signal:category", "siren")); 907 break; 908 case FOG_DIA: 909 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 910 "seamark:fog_signal:category", "diaphone")); 911 break; 912 case FOG_BELL: 913 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 914 "seamark:fog_signal:category", "bell")); 915 break; 916 case FOG_WHIS: 917 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 918 "seamark:fog_signal:category", "whistle")); 919 break; 920 case FOG_GONG: 921 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 922 "seamark:fog_signal:category", "gong")); 923 break; 924 case FOG_EXPLOS: 925 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 926 "seamark:fog_signal:category", "explosive")); 927 break; 928 } 929 if (!getFogGroup().isEmpty()) 930 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 931 "seamark:fog_signal:group", getFogGroup())); 932 if (!getFogPeriod().isEmpty()) 933 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 934 "seamark:fog_signal:period", getFogPeriod())); 935 } 936 } 937 } 938 939 public void refreshStyles() { 940 } 941 942 public void refreshLights() { 943 dlg.cbM01Kennung.removeAllItems(); 944 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 945 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$ 946 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 947 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 948 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$ 949 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$ 950 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 951 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 952 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$ 953 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 954 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$ 955 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$ 956 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$ 957 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 958 dlg.cbM01Kennung.setSelectedIndex(0); 959 } 960 961 public void resetMask() { 962 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 963 964 dlg.lM01Icon.setIcon(null); 965 dlg.lM02Icon.setIcon(null); 966 dlg.lM03Icon.setIcon(null); 967 dlg.lM04Icon.setIcon(null); 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 if (values.length > 1) 385 Bearing1[index] = values[1]; 386 if (values.length > 2) 387 Bearing2[index] = values[2]; 388 if (values.length > 3) 389 Radius[index] = values[3]; 390 } else { 391 index = 0; 392 } 393 if (index != 0) 394 setSectored(true); 395 if (key.equals("colour")) { 396 if (value.equals("red")) 397 LightColour[index] = "R"; 398 else if (value.equals("green")) 399 LightColour[index] = "G"; 400 else if (value.equals("white")) 401 LightColour[index] = "W"; 402 } else if (key.equals("character")) { 403 LightChar[index] = value; 404 } else if (key.equals("group")) { 405 LightGroup[index] = value; 406 } else if (key.equals("period")) { 407 LightPeriod[index] = value; 408 } else if (key.equals("height")) { 409 Height[index] = value; 410 } else if (key.equals("range")) { 411 Range[index] = value; 412 } 413 } 414 } 415 setSectorIndex(0); 416 dlg.cbM01Sector.setSelectedIndex(0); 417 dlg.cM01Fired.setSelected(isFired()); 418 dlg.rbM01Fired1.setSelected(!isSectored()); 419 dlg.rbM01FiredN.setSelected(isSectored()); 420 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 421 dlg.tfM01Height.setText(getHeight()); 422 dlg.tfM01Range.setText(getRange()); 423 dlg.tfM01Group.setText(getLightGroup()); 424 dlg.tfM01RepeatTime.setText(getLightPeriod()); 425 dlg.cbM01Colour.setSelectedItem(getLightColour()); 426 } 427 428 public void parseFogRadar(Map<String, String> k) { 429 String str; 430 setFog(false); 431 setRadar(false); 432 setRacon(false); 433 if (k.containsKey("seamark:fog_signal") 434 || k.containsKey("seamark:fog_signal:category") 435 || k.containsKey("seamark:fog_signal:group") 436 || k.containsKey("seamark:fog_signal:period")) { 437 setFog(true); 438 if (k.containsKey("seamark:fog_signal:category")) { 439 str = k.get("seamark:fog_signal:category"); 440 if (str.equals("horn")) 441 setFogSound(FOG_HORN); 442 else if (str.equals("siren")) 443 setFogSound(FOG_SIREN); 444 else if (str.equals("diaphone")) 445 setFogSound(FOG_DIA); 446 else if (str.equals("bell")) 447 setFogSound(FOG_BELL); 448 else if (str.equals("whis")) 449 setFogSound(FOG_WHIS); 450 else if (str.equals("gong")) 451 setFogSound(FOG_GONG); 452 else if (str.equals("explosive")) 453 setFogSound(FOG_EXPLOS); 454 else 455 setFogSound(UNKNOWN_FOG); 456 } 457 if (k.containsKey("seamark:fog_signal:group")) 458 setFogGroup(k.get("seamark:fog_signal:group")); 459 if (k.containsKey("seamark:fog_signal:period")) 460 setFogPeriod(k.get("seamark:fog_signal:period")); 461 } 462 dlg.cM01Fog.setSelected(hasFog()); 463 dlg.cbM01Fog.setSelectedIndex(getFogSound()); 464 dlg.tfM01FogGroup.setText(getFogGroup()); 465 dlg.tfM01FogPeriod.setText(getFogPeriod()); 466 467 if (k.containsKey("seamark:radar_transponder") 468 || k.containsKey("seamark:radar_transponder:category") 469 || k.containsKey("seamark:radar_transponder:group")) { 470 setRacon(true); 471 if (k.containsKey("seamark:radar_transponder:category")) { 472 str = k.get("seamark:radar_transponder:category"); 473 if (str.equals("racon")) 474 setRaType(RATYPE_RACON); 475 else if (str.equals("ramark")) 476 setRaType(RATYPE_RAMARK); 477 else if (str.equals("leading")) 478 setRaType(RATYPE_LEADING); 479 else 480 setRaType(UNKNOWN_RATYPE); 481 } 482 if (k.containsKey("seamark:radar_transponder:group")) 483 setRaconGroup(k.get("seamark:radar_transponder:group")); 484 } else if (k.containsKey("seamark:radar_reflector")) 485 setRadar(true); 486 dlg.cM01Radar.setSelected(hasRadar()); 487 dlg.cM01Racon.setSelected(hasRacon()); 488 dlg.cbM01Racon.setSelectedIndex(getRaType()); 489 dlg.tfM01Racon.setText(getRaconGroup()); 490 } 491 492 public void paintSign() { 493 494 if (dlg.paintlock) 495 return; 496 else 497 dlg.paintlock = true; 498 499 dlg.lM01Icon.setIcon(null); 500 dlg.lM02Icon.setIcon(null); 501 dlg.lM03Icon.setIcon(null); 502 dlg.lM04Icon.setIcon(null); 968 503 dlg.lM05Icon.setIcon(null); 969 504 dlg.lM06Icon.setIcon(null); 970 971 dlg.rbM01RegionA.setEnabled(false); 972 dlg.rbM01RegionB.setEnabled(false); 973 dlg.lM01FireMark.setText(""); 974 dlg.cbM01CatOfMark.removeAllItems(); 975 dlg.cbM01CatOfMark.setVisible(false); 976 dlg.lM01CatOfMark.setVisible(false); 977 setBuoyIndex(0); 978 dlg.cbM01StyleOfMark.removeAllItems(); 979 dlg.cbM01StyleOfMark.setVisible(false); 980 dlg.lM01StyleOfMark.setVisible(false); 981 setStyleIndex(0); 982 dlg.tfM01Name.setText(""); 983 dlg.tfM01Name.setEnabled(false); 984 setName(""); 985 dlg.cM01TopMark.setSelected(false); 986 dlg.cM01TopMark.setVisible(false); 987 dlg.cbM01TopMark.removeAllItems(); 988 dlg.cbM01TopMark.setVisible(false); 989 setTopMark(false); 990 dlg.cM01Radar.setSelected(false); 991 dlg.cM01Radar.setVisible(false); 992 setRadar(false); 993 dlg.cM01Racon.setSelected(false); 994 dlg.cM01Racon.setVisible(false); 995 dlg.cbM01Racon.setVisible(false); 996 dlg.tfM01Racon.setText(""); 997 dlg.tfM01Racon.setVisible(false); 998 dlg.lM01Racon.setVisible(false); 999 setRacon(false); 1000 setRaType(0); 1001 dlg.cM01Fog.setSelected(false); 1002 dlg.cM01Fog.setVisible(false); 1003 dlg.cbM01Fog.setVisible(false); 1004 setFogSound(0); 1005 dlg.tfM01FogGroup.setText(""); 1006 dlg.tfM01FogGroup.setVisible(false); 1007 dlg.lM01FogGroup.setVisible(false); 1008 dlg.tfM01FogPeriod.setText(""); 1009 dlg.tfM01FogPeriod.setVisible(false); 1010 dlg.lM01FogPeriod.setVisible(false); 1011 setFog(false); 1012 dlg.cM01Fired.setSelected(false); 1013 dlg.cM01Fired.setVisible(false); 1014 setFired(false); 1015 dlg.rbM01Fired1.setVisible(false); 1016 dlg.rbM01Fired1.setSelected(true); 1017 dlg.rbM01FiredN.setVisible(false); 1018 dlg.rbM01FiredN.setSelected(false); 1019 setSectored(false); 1020 dlg.cbM01Kennung.removeAllItems(); 1021 dlg.cbM01Kennung.setVisible(false); 1022 dlg.lM01Kennung.setVisible(false); 1023 setLightChar(""); 1024 dlg.tfM01Height.setText(""); 1025 dlg.tfM01Height.setVisible(false); 1026 dlg.lM01Height.setVisible(false); 1027 setHeight(""); 1028 dlg.tfM01Range.setText(""); 1029 dlg.tfM01Range.setVisible(false); 1030 dlg.lM01Range.setVisible(false); 1031 setRange(""); 1032 dlg.cbM01Colour.setVisible(false); 1033 dlg.lM01Colour.setVisible(false); 1034 setLightColour(""); 1035 dlg.cbM01Sector.setVisible(false); 1036 dlg.lM01Sector.setVisible(false); 1037 setSectorIndex(0); 1038 dlg.tfM01Group.setText(""); 1039 dlg.tfM01Group.setVisible(false); 1040 dlg.lM01Group.setVisible(false); 1041 setLightGroup(""); 1042 dlg.tfM01RepeatTime.setText(""); 1043 dlg.tfM01RepeatTime.setVisible(false); 1044 dlg.lM01RepeatTime.setVisible(false); 1045 setLightPeriod(""); 1046 dlg.tfM01Bearing.setText(""); 1047 dlg.tfM01Bearing.setVisible(false); 1048 dlg.lM01Bearing.setVisible(false); 1049 setBearing1(""); 1050 dlg.tfM02Bearing.setText(""); 1051 dlg.tfM02Bearing.setVisible(false); 1052 setBearing2(""); 1053 dlg.tfM01Radius.setText(""); 1054 dlg.tfM01Radius.setVisible(false); 1055 setRadius(""); 1056 1057 dlg.bM01Save.setEnabled(false); 1058 } 505 dlg.lM01NameMark.setText(""); 506 dlg.lM01FireMark.setText(""); 507 dlg.lM01FogMark.setText(""); 508 dlg.lM01RadarMark.setText(""); 509 510 dlg.rbM01RegionA.setSelected(!getRegion()); 511 dlg.rbM01RegionB.setSelected(getRegion()); 512 513 if (isValid()) { 514 dlg.lM01NameMark.setText(getName()); 515 516 dlg.bM01Save.setEnabled(true); 517 518 dlg.cM01TopMark.setSelected(hasTopMark()); 519 dlg.cM01Fired.setSelected(isFired()); 520 521 dlg.tfM01RepeatTime.setText(getLightPeriod()); 522 523 dlg.tfM01Name.setText(getName()); 524 dlg.tfM01Name.setEnabled(true); 525 526 if (hasRadar()) { 527 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 528 "/images/Radar_Reflector.png"))); 529 } 530 531 else if (hasRacon()) { 532 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 533 "/images/Radar_Station.png"))); 534 if (getRaType() != 0) { 535 String c = (String) dlg.cbM01Racon.getSelectedItem(); 536 if ((getRaType() == RATYPE_RACON) && !getRaconGroup().isEmpty()) 537 c += ("(" + getRaconGroup() + ")"); 538 dlg.lM01RadarMark.setText(c); 539 } 540 dlg.cbM01Racon.setVisible(true); 541 if (getRaType() == RATYPE_RACON) { 542 dlg.lM01Racon.setVisible(true); 543 dlg.tfM01Racon.setVisible(true); 544 dlg.tfM01Racon.setEnabled(true); 545 } else { 546 dlg.lM01Racon.setVisible(false); 547 dlg.tfM01Racon.setVisible(false); 548 } 549 } else { 550 dlg.cbM01Racon.setVisible(false); 551 dlg.lM01Racon.setVisible(false); 552 dlg.tfM01Racon.setVisible(false); 553 } 554 555 if (hasFog()) { 556 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 557 "/images/Fog_Signal.png"))); 558 if (getFogSound() != 0) { 559 String c = (String) dlg.cbM01Fog.getSelectedItem(); 560 if (!getFogGroup().isEmpty()) 561 c += ("(" + getFogGroup() + ")"); 562 if (!getFogPeriod().isEmpty()) 563 c += (" " + getFogPeriod() + "s"); 564 dlg.lM01FogMark.setText(c); 565 } 566 dlg.cbM01Fog.setVisible(true); 567 if (getFogSound() == 0) { 568 dlg.lM01FogGroup.setVisible(false); 569 dlg.tfM01FogGroup.setVisible(false); 570 dlg.lM01FogPeriod.setVisible(false); 571 dlg.tfM01FogPeriod.setVisible(false); 572 } else { 573 dlg.lM01FogGroup.setVisible(true); 574 dlg.tfM01FogGroup.setVisible(true); 575 dlg.lM01FogPeriod.setVisible(true); 576 dlg.tfM01FogPeriod.setVisible(true); 577 } 578 } else { 579 dlg.cbM01Fog.setVisible(false); 580 dlg.lM01FogGroup.setVisible(false); 581 dlg.tfM01FogGroup.setVisible(false); 582 dlg.lM01FogPeriod.setVisible(false); 583 dlg.tfM01FogPeriod.setVisible(false); 584 } 585 586 if (isFired()) { 587 String lp, c; 588 String tmp = null; 589 int i1; 590 591 String col = getLightColour(); 592 if (col.equals("W")) { 593 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 594 "/images/Light_White_120.png"))); 595 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT); 596 } else if (col.equals("R")) { 597 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 598 "/images/Light_Red_120.png"))); 599 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT); 600 } else if (col.equals("G")) { 601 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 602 "/images/Light_Green_120.png"))); 603 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT); 604 } else { 605 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 606 "/images/Light_Magenta_120.png"))); 607 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR); 608 } 609 610 c = getLightChar(); 611 if (c.contains("+")) { 612 i1 = c.indexOf("+"); 613 tmp = c.substring(i1, c.length()); 614 c = c.substring(0, i1); 615 if (!getLightGroup().isEmpty()) { 616 c = c + "(" + getLightGroup() + ")"; 617 } 618 if (tmp != null) 619 c = c + tmp; 620 } 621 dlg.cbM01Kennung.setSelectedItem(c); 622 if ((dlg.cbM01Kennung.getSelectedIndex() != 0) 623 && (!getLightGroup().isEmpty()) 624 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) 625 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) { 626 c = c + "(" + getLightGroup() + ")"; 627 dlg.cbM01Kennung.setSelectedItem(c); 628 } 629 c = c + " " + getLightColour(); 630 lp = getLightPeriod(); 631 if (!lp.isEmpty()) 632 c = c + " " + lp + "s"; 633 dlg.lM01FireMark.setText(c); 634 dlg.cM01Fired.setVisible(true); 635 dlg.lM01Kennung.setVisible(true); 636 dlg.cbM01Kennung.setVisible(true); 637 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) { 638 dlg.tfM01Group.setVisible(false); 639 dlg.lM01Group.setVisible(false); 640 } else { 641 dlg.lM01Group.setVisible(true); 642 dlg.tfM01Group.setVisible(true); 643 } 644 dlg.tfM01Group.setText(getLightGroup()); 645 dlg.lM01RepeatTime.setVisible(true); 646 dlg.tfM01RepeatTime.setVisible(true); 647 if (isSectored()) { 648 dlg.rbM01Fired1.setSelected(false); 649 dlg.rbM01FiredN.setSelected(true); 650 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty())) 651 dlg.cbM01Kennung.setEnabled(false); 652 else 653 dlg.cbM01Kennung.setEnabled(true); 654 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 655 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty())) 656 dlg.tfM01Group.setEnabled(false); 657 else 658 dlg.tfM01Group.setEnabled(true); 659 dlg.tfM01Group.setText(getLightGroup()); 660 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty())) 661 dlg.tfM01RepeatTime.setEnabled(false); 662 else 663 dlg.tfM01RepeatTime.setEnabled(true); 664 dlg.tfM01RepeatTime.setText(getLightPeriod()); 665 if ((getSectorIndex() != 0) && (!Height[0].isEmpty())) 666 dlg.tfM01Height.setEnabled(false); 667 else 668 dlg.tfM01Height.setEnabled(true); 669 dlg.tfM01Height.setText(getHeight()); 670 if ((getSectorIndex() != 0) && (!Range[0].isEmpty())) 671 dlg.tfM01Range.setEnabled(false); 672 else 673 dlg.tfM01Range.setEnabled(true); 674 dlg.tfM01Range.setText(getRange()); 675 dlg.lM01Sector.setVisible(true); 676 dlg.cbM01Sector.setVisible(true); 677 if (getSectorIndex() == 0) { 678 dlg.lM01Colour.setVisible(false); 679 dlg.cbM01Colour.setVisible(false); 680 dlg.lM01Bearing.setVisible(false); 681 dlg.tfM01Bearing.setVisible(false); 682 dlg.tfM02Bearing.setVisible(false); 683 dlg.tfM01Radius.setVisible(false); 684 } else { 685 dlg.lM01Colour.setVisible(true); 686 dlg.cbM01Colour.setVisible(true); 687 dlg.lM01Bearing.setVisible(true); 688 dlg.tfM01Bearing.setVisible(true); 689 dlg.tfM01Bearing.setText(getBearing1()); 690 dlg.tfM02Bearing.setVisible(true); 691 dlg.tfM02Bearing.setText(getBearing2()); 692 dlg.tfM01Radius.setVisible(true); 693 dlg.tfM01Radius.setText(getRadius()); 694 } 695 } else { 696 dlg.rbM01FiredN.setSelected(false); 697 dlg.rbM01Fired1.setSelected(true); 698 dlg.cbM01Kennung.setEnabled(true); 699 dlg.tfM01Group.setEnabled(true); 700 dlg.tfM01RepeatTime.setEnabled(true); 701 dlg.tfM01Height.setEnabled(true); 702 dlg.tfM01Range.setEnabled(true); 703 dlg.lM01Colour.setVisible(true); 704 dlg.cbM01Colour.setVisible(true); 705 dlg.lM01Sector.setVisible(false); 706 dlg.cbM01Sector.setVisible(false); 707 dlg.lM01Bearing.setVisible(false); 708 dlg.tfM01Bearing.setVisible(false); 709 dlg.tfM02Bearing.setVisible(false); 710 dlg.tfM01Radius.setVisible(false); 711 } 712 } else { 713 dlg.lM01FireMark.setText(""); 714 dlg.rbM01Fired1.setVisible(false); 715 dlg.rbM01FiredN.setVisible(false); 716 dlg.cbM01Kennung.setVisible(false); 717 dlg.lM01Kennung.setVisible(false); 718 dlg.tfM01Height.setVisible(false); 719 dlg.lM01Height.setVisible(false); 720 dlg.tfM01Range.setVisible(false); 721 dlg.lM01Range.setVisible(false); 722 dlg.cbM01Colour.setVisible(false); 723 dlg.lM01Colour.setVisible(false); 724 dlg.cbM01Sector.setVisible(false); 725 dlg.lM01Sector.setVisible(false); 726 dlg.tfM01Group.setVisible(false); 727 dlg.lM01Group.setVisible(false); 728 dlg.tfM01RepeatTime.setVisible(false); 729 dlg.lM01RepeatTime.setVisible(false); 730 dlg.tfM01Bearing.setVisible(false); 731 dlg.lM01Bearing.setVisible(false); 732 dlg.tfM02Bearing.setVisible(false); 733 dlg.tfM01Radius.setVisible(false); 734 } 735 } else { 736 dlg.bM01Save.setEnabled(false); 737 dlg.tfM01Name.setEnabled(false); 738 dlg.cM01TopMark.setVisible(false); 739 dlg.cbM01TopMark.setVisible(false); 740 dlg.cM01Radar.setVisible(false); 741 dlg.cM01Racon.setVisible(false); 742 dlg.cbM01Racon.setVisible(false); 743 dlg.tfM01Racon.setVisible(false); 744 dlg.lM01Racon.setVisible(false); 745 dlg.cM01Fog.setVisible(false); 746 dlg.cbM01Fog.setVisible(false); 747 dlg.tfM01FogGroup.setVisible(false); 748 dlg.lM01FogGroup.setVisible(false); 749 dlg.tfM01FogPeriod.setVisible(false); 750 dlg.lM01FogPeriod.setVisible(false); 751 dlg.cM01Fired.setVisible(false); 752 dlg.rbM01Fired1.setVisible(false); 753 dlg.rbM01FiredN.setVisible(false); 754 dlg.cbM01Kennung.setVisible(false); 755 dlg.lM01Kennung.setVisible(false); 756 dlg.tfM01Height.setVisible(false); 757 dlg.lM01Height.setVisible(false); 758 dlg.tfM01Range.setVisible(false); 759 dlg.lM01Range.setVisible(false); 760 dlg.cbM01Colour.setVisible(false); 761 dlg.lM01Colour.setVisible(false); 762 dlg.cbM01Sector.setVisible(false); 763 dlg.lM01Sector.setVisible(false); 764 dlg.tfM01Group.setVisible(false); 765 dlg.lM01Group.setVisible(false); 766 dlg.tfM01RepeatTime.setVisible(false); 767 dlg.lM01RepeatTime.setVisible(false); 768 dlg.tfM01Bearing.setVisible(false); 769 dlg.lM01Bearing.setVisible(false); 770 dlg.tfM02Bearing.setVisible(false); 771 dlg.tfM01Radius.setVisible(false); 772 } 773 dlg.paintlock = false; 774 } 775 776 public void saveSign(String type) { 777 delSeaMarkKeys(Node); 778 779 String str = dlg.tfM01Name.getText(); 780 if (!str.isEmpty()) 781 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name", 782 str)); 783 Main.main.undoRedo 784 .add(new ChangePropertyCommand(Node, "seamark:type", type)); 785 } 786 787 protected void saveLightData() { 788 String colour; 789 if (dlg.cM01Fired.isSelected()) { 790 if (!(colour = LightColour[0]).isEmpty()) 791 if (colour.equals("R")) { 792 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 793 "seamark:light:colour", "red")); 794 } else if (colour.equals("G")) { 795 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 796 "seamark:light:colour", "green")); 797 } else if (colour.equals("W")) { 798 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 799 "seamark:light:colour", "white")); 800 } 801 802 if (!LightPeriod[0].isEmpty()) 803 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 804 "seamark:light:period", LightPeriod[0])); 805 806 if (!LightChar[0].isEmpty()) 807 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 808 "seamark:light:character", LightChar[0])); 809 810 if (!LightGroup[0].isEmpty()) 811 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 812 "seamark:light:group", LightGroup[0])); 813 814 if (!Height[0].isEmpty()) 815 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 816 "seamark:light:height", Height[0])); 817 818 if (!Range[0].isEmpty()) 819 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 820 "seamark:light:range", Range[0])); 821 822 for (int i = 1; i < 10; i++) { 823 if ((colour = LightColour[i]) != null) 824 if (colour.equals("R")) { 825 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 826 "seamark:light:" + i + ":colour", "red")); 827 if ((Bearing1[i] != null) && (Bearing2[i] != null) 828 && (Radius[i] != null)) 829 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 830 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 831 + Bearing2[i] + ":" + Radius[i])); 832 } else if (colour.equals("G")) { 833 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 834 "seamark:light:" + i + ":colour", "green")); 835 if ((Bearing1[i] != null) && (Bearing2[i] != null) 836 && (Radius[i] != null)) 837 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 838 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 839 + Bearing2[i] + ":" + Radius[i])); 840 } else if (colour.equals("W")) { 841 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 842 "seamark:light:" + i + ":colour", "white")); 843 if ((Bearing1[i] != null) && (Bearing2[i] != null) 844 && (Radius[i] != null)) 845 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 846 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 847 + Bearing2[i] + ":" + Radius[i])); 848 } 849 850 if (LightPeriod[i] != null) 851 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 852 "seamark:light:" + i + ":period", LightPeriod[i])); 853 854 if (LightChar[i] != null) 855 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 856 "seamark:light:" + i + ":character", LightChar[i])); 857 858 if (LightGroup[i] != null) 859 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 860 "seamark:light:" + i + ":group", LightGroup[i])); 861 862 if (Height[i] != null) 863 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 864 "seamark:light:" + i + ":height", Height[i])); 865 866 if (Range[i] != null) 867 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 868 "seamark:light:" + i + ":range", Range[i])); 869 870 if (Bearing1[i] != null) 871 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 872 "seamark:light:" + i + ":sector_start", Bearing1[i])); 873 874 if (Bearing2[i] != null) 875 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 876 "seamark:light:" + i + ":sector_end", Bearing2[i])); 877 } 878 } 879 } 880 881 protected void saveTopMarkData(String shape, String colour) { 882 if (dlg.cM01TopMark.isSelected()) { 883 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 884 "seamark:topmark:shape", shape)); 885 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 886 "seamark:topmark:colour", colour)); 887 } 888 } 889 890 protected void saveRadarFogData() { 891 if (hasRadar()) { 892 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 893 "seamark:radar_reflector", "yes")); 894 } 895 if (hasRacon()) { 896 switch (RaType) { 897 case RATYPE_RACON: 898 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 899 "seamark:radar_transponder:category", "racon")); 900 if (!getRaconGroup().isEmpty()) 901 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 902 "seamark:radar_transponder:group", getRaconGroup())); 903 break; 904 case RATYPE_RAMARK: 905 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 906 "seamark:radar_transponder:category", "ramark")); 907 break; 908 case RATYPE_LEADING: 909 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 910 "seamark:radar_transponder:category", "leading")); 911 break; 912 default: 913 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 914 "seamark:radar_transponder", "yes")); 915 } 916 } 917 if (hasFog()) { 918 if (getFogSound() == 0) { 919 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 920 "seamark:fog_signal", "yes")); 921 } else { 922 switch (getFogSound()) { 923 case FOG_HORN: 924 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 925 "seamark:fog_signal:category", "horn")); 926 break; 927 case FOG_SIREN: 928 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 929 "seamark:fog_signal:category", "siren")); 930 break; 931 case FOG_DIA: 932 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 933 "seamark:fog_signal:category", "diaphone")); 934 break; 935 case FOG_BELL: 936 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 937 "seamark:fog_signal:category", "bell")); 938 break; 939 case FOG_WHIS: 940 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 941 "seamark:fog_signal:category", "whistle")); 942 break; 943 case FOG_GONG: 944 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 945 "seamark:fog_signal:category", "gong")); 946 break; 947 case FOG_EXPLOS: 948 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 949 "seamark:fog_signal:category", "explosive")); 950 break; 951 } 952 if (!getFogGroup().isEmpty()) 953 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 954 "seamark:fog_signal:group", getFogGroup())); 955 if (!getFogPeriod().isEmpty()) 956 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 957 "seamark:fog_signal:period", getFogPeriod())); 958 } 959 } 960 } 961 962 public void refreshStyles() { 963 } 964 965 public void refreshLights() { 966 dlg.cbM01Kennung.removeAllItems(); 967 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 968 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$ 969 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 970 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 971 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$ 972 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$ 973 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 974 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 975 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$ 976 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 977 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$ 978 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$ 979 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$ 980 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 981 dlg.cbM01Kennung.setSelectedIndex(0); 982 } 983 984 public void resetMask() { 985 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 986 987 dlg.lM01Icon.setIcon(null); 988 dlg.lM02Icon.setIcon(null); 989 dlg.lM03Icon.setIcon(null); 990 dlg.lM04Icon.setIcon(null); 991 dlg.lM05Icon.setIcon(null); 992 dlg.lM06Icon.setIcon(null); 993 994 dlg.rbM01RegionA.setEnabled(false); 995 dlg.rbM01RegionB.setEnabled(false); 996 dlg.lM01FireMark.setText(""); 997 dlg.cbM01CatOfMark.setVisible(false); 998 dlg.lM01CatOfMark.setVisible(false); 999 setBuoyIndex(0); 1000 dlg.cbM01StyleOfMark.setVisible(false); 1001 dlg.lM01StyleOfMark.setVisible(false); 1002 setStyleIndex(0); 1003 dlg.tfM01Name.setText(""); 1004 dlg.tfM01Name.setEnabled(false); 1005 setName(""); 1006 dlg.cM01TopMark.setSelected(false); 1007 dlg.cM01TopMark.setVisible(false); 1008 dlg.cbM01TopMark.setVisible(false); 1009 setTopMark(false); 1010 dlg.cM01Radar.setSelected(false); 1011 dlg.cM01Radar.setVisible(false); 1012 setRadar(false); 1013 dlg.cM01Racon.setSelected(false); 1014 dlg.cM01Racon.setVisible(false); 1015 dlg.cbM01Racon.setVisible(false); 1016 dlg.tfM01Racon.setText(""); 1017 dlg.tfM01Racon.setVisible(false); 1018 dlg.lM01Racon.setVisible(false); 1019 setRacon(false); 1020 setRaType(0); 1021 dlg.cM01Fog.setSelected(false); 1022 dlg.cM01Fog.setVisible(false); 1023 dlg.cbM01Fog.setVisible(false); 1024 setFogSound(0); 1025 dlg.tfM01FogGroup.setText(""); 1026 dlg.tfM01FogGroup.setVisible(false); 1027 dlg.lM01FogGroup.setVisible(false); 1028 dlg.tfM01FogPeriod.setText(""); 1029 dlg.tfM01FogPeriod.setVisible(false); 1030 dlg.lM01FogPeriod.setVisible(false); 1031 setFog(false); 1032 dlg.cM01Fired.setSelected(false); 1033 dlg.cM01Fired.setVisible(false); 1034 setFired(false); 1035 dlg.rbM01Fired1.setVisible(false); 1036 dlg.rbM01Fired1.setSelected(true); 1037 dlg.rbM01FiredN.setVisible(false); 1038 dlg.rbM01FiredN.setSelected(false); 1039 setSectored(false); 1040 dlg.cbM01Kennung.removeAllItems(); 1041 dlg.cbM01Kennung.setVisible(false); 1042 dlg.lM01Kennung.setVisible(false); 1043 setLightChar(""); 1044 dlg.tfM01Height.setText(""); 1045 dlg.tfM01Height.setVisible(false); 1046 dlg.lM01Height.setVisible(false); 1047 setHeight(""); 1048 dlg.tfM01Range.setText(""); 1049 dlg.tfM01Range.setVisible(false); 1050 dlg.lM01Range.setVisible(false); 1051 setRange(""); 1052 dlg.cbM01Colour.setVisible(false); 1053 dlg.lM01Colour.setVisible(false); 1054 setLightColour(""); 1055 dlg.cbM01Sector.setVisible(false); 1056 dlg.lM01Sector.setVisible(false); 1057 setSectorIndex(0); 1058 dlg.tfM01Group.setText(""); 1059 dlg.tfM01Group.setVisible(false); 1060 dlg.lM01Group.setVisible(false); 1061 setLightGroup(""); 1062 dlg.tfM01RepeatTime.setText(""); 1063 dlg.tfM01RepeatTime.setVisible(false); 1064 dlg.lM01RepeatTime.setVisible(false); 1065 setLightPeriod(""); 1066 dlg.tfM01Bearing.setText(""); 1067 dlg.tfM01Bearing.setVisible(false); 1068 dlg.lM01Bearing.setVisible(false); 1069 setBearing1(""); 1070 dlg.tfM02Bearing.setText(""); 1071 dlg.tfM02Bearing.setVisible(false); 1072 setBearing2(""); 1073 dlg.tfM01Radius.setText(""); 1074 dlg.tfM01Radius.setVisible(false); 1075 setRadius(""); 1076 1077 dlg.bM01Save.setEnabled(false); 1078 } 1059 1079 1060 1080 }
Note:
See TracChangeset
for help on using the changeset viewer.