Changeset 23073 in osm for applications/editors/josm
- Timestamp:
- 2010-09-08T13:52:26+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java
r23072 r23073 1016 1016 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1017 1017 cbM01Racon.removeAllItems(); 1018 cbM01Racon.addItem(" Not Set");1018 cbM01Racon.addItem("Any"); 1019 1019 cbM01Racon.addItem("Racon"); 1020 1020 cbM01Racon.addItem("Ramark"); … … 1066 1066 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$ 1067 1067 cbM01Fog.removeAllItems(); 1068 cbM01Fog.addItem(" Not Set");1068 cbM01Fog.addItem("Any"); 1069 1069 cbM01Fog.addItem("Horn"); 1070 1070 cbM01Fog.addItem("Siren"); … … 1077 1077 public void actionPerformed(ActionEvent e) { 1078 1078 if (cbM01Fog.getSelectedIndex() > 0) 1079 buoy.setFogSound( (String) cbM01Fog.getSelectedItem());1079 buoy.setFogSound(cbM01Fog.getSelectedIndex()); 1080 1080 else 1081 buoy.setFogSound( "");1081 buoy.setFogSound(0); 1082 1082 buoy.paintSign(); 1083 1083 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/SeaMark.java
r23058 r23073 107 107 108 108 /** 109 * Radar Beacons - correspond to Ratyp 109 * Radar Beacons - correspond to Ratyp Index 110 110 */ 111 111 … … 116 116 117 117 /** 118 * Fog Signals - correspond to FogSound Index 119 */ 120 121 public final static int UNKNOWN_FOG = 0; 122 public final static int FOG_HORN = 1; 123 public final static int FOG_SIREN = 2; 124 public final static int FOG_DIA = 3; 125 public final static int FOG_BELL = 4; 126 public final static int FOG_WHIS = 5; 127 public final static int FOG_GONG = 6; 128 public final static int FOG_EXPLOS = 7; 129 130 /** 118 131 * Variables 119 132 */ -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r23072 r23073 107 107 } 108 108 109 private String FogSound = "";110 111 public StringgetFogSound() {109 private int FogSound = 0; 110 111 public int getFogSound() { 112 112 return FogSound; 113 113 } 114 114 115 public void setFogSound( StringfogSound) {115 public void setFogSound(int fogSound) { 116 116 FogSound = fogSound; 117 117 } … … 124 124 125 125 public void setFogGroup(String fogGroup) { 126 Fog Sound= fogGroup;126 FogGroup = fogGroup; 127 127 } 128 128 … … 290 290 protected Buoy(SmpDialogAction dia) { 291 291 dlg = dia; 292 } 293 294 public boolean isValid() { 295 return false; 292 296 } 293 297 … … 305 309 dlg.rbM01RegionB.setSelected(getRegion()); 306 310 307 dlg.cM01TopMark.setSelected(hasTopMark()); 308 dlg.cM01Fired.setSelected(isFired()); 309 310 dlg.tfM01RepeatTime.setText(LightPeriod); 311 312 dlg.tfM01Name.setText(getName()); 313 314 if (hasRadar()) { 315 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 316 "/images/Radar_Reflector.png"))); 317 } 318 319 if (hasRacon()) { 320 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 321 "/images/Radar_Station.png"))); 322 dlg.cbM01Racon.setVisible(true); 323 if (getRaType() == RATYP_RACON) { 324 dlg.lM01Racon.setVisible(true); 325 dlg.tfM01Racon.setVisible(true); 326 dlg.tfM01Racon.setEnabled(true); 311 if (isValid()) { 312 dlg.bM01Save.setEnabled(true); 313 314 dlg.cM01TopMark.setSelected(hasTopMark()); 315 dlg.cM01Fired.setSelected(isFired()); 316 317 dlg.tfM01RepeatTime.setText(LightPeriod); 318 319 dlg.tfM01Name.setText(getName()); 320 321 if (hasRadar()) { 322 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 323 "/images/Radar_Reflector.png"))); 324 } 325 326 if (hasRacon()) { 327 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 328 "/images/Radar_Station.png"))); 329 dlg.cbM01Racon.setVisible(true); 330 if (getRaType() == RATYP_RACON) { 331 dlg.lM01Racon.setVisible(true); 332 dlg.tfM01Racon.setVisible(true); 333 dlg.tfM01Racon.setEnabled(true); 334 } else { 335 dlg.lM01Racon.setVisible(false); 336 dlg.tfM01Racon.setVisible(false); 337 } 327 338 } else { 339 dlg.cbM01Racon.setVisible(false); 328 340 dlg.lM01Racon.setVisible(false); 329 341 dlg.tfM01Racon.setVisible(false); 330 342 } 331 } else { 332 dlg.cbM01Racon.setVisible(false); 333 dlg.lM01Racon.setVisible(false); 334 dlg.tfM01Racon.setVisible(false); 335 } 336 337 if (hasFog()) { 338 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 339 "/images/Fog_Signal.png"))); 340 dlg.cbM01Fog.setVisible(true); 341 if (getFogSound().equals("")) { 343 344 if (hasFog()) { 345 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 346 "/images/Fog_Signal.png"))); 347 dlg.cbM01Fog.setVisible(true); 348 if (getFogSound() == 0) { 349 dlg.lM01FogGroup.setVisible(false); 350 dlg.tfM01FogGroup.setVisible(false); 351 dlg.lM01FogPeriod.setVisible(false); 352 dlg.tfM01FogPeriod.setVisible(false); 353 } else { 354 dlg.lM01FogGroup.setVisible(true); 355 dlg.tfM01FogGroup.setVisible(true); 356 dlg.lM01FogPeriod.setVisible(true); 357 dlg.tfM01FogPeriod.setVisible(true); 358 } 359 } else { 360 dlg.cbM01Fog.setVisible(false); 342 361 dlg.lM01FogGroup.setVisible(false); 343 362 dlg.tfM01FogGroup.setVisible(false); 344 363 dlg.lM01FogPeriod.setVisible(false); 345 364 dlg.tfM01FogPeriod.setVisible(false); 365 } 366 367 if (isFired()) { 368 String lp, c; 369 String tmp = null; 370 int i1; 371 372 String col = getLightColour(); 373 if (col.equals("W")) 374 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 375 "/images/Light_White_120.png"))); 376 else if (col.equals("R")) 377 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 378 "/images/Light_Red_120.png"))); 379 else if (col.equals("G")) 380 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 381 "/images/Light_Green_120.png"))); 382 else 383 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 384 "/images/Light_Magenta_120.png"))); 385 386 dlg.cbM01Kennung.setEnabled(true); 387 388 c = getLightChar(); 389 if (dlg.cbM01Kennung.getSelectedIndex() == 0) 390 dlg.tfM01RepeatTime.setEnabled(false); 391 else 392 dlg.tfM01RepeatTime.setEnabled(true); 393 394 if (c.contains("+")) { 395 i1 = c.indexOf("+"); 396 tmp = c.substring(i1, c.length()); 397 c = c.substring(0, i1); 398 } 399 400 if (getLightGroup() != "") 401 c = c + "(" + getLightGroup() + ")"; 402 if (tmp != null) 403 c = c + tmp; 404 405 c = c + " " + getLightColour(); 406 lp = getLightPeriod(); 407 if (lp != "" && lp != " ") 408 c = c + " " + lp + "s"; 409 dlg.lM01FireMark.setText(c); 346 410 } else { 347 dlg.lM01FogGroup.setVisible(true); 348 dlg.tfM01FogGroup.setVisible(true); 349 dlg.lM01FogPeriod.setVisible(true); 350 dlg.tfM01FogPeriod.setVisible(true); 411 dlg.tfM01RepeatTime.setEnabled(false); 412 dlg.cbM01Kennung.setEnabled(false); 413 dlg.lM01FireMark.setText(""); 351 414 } 352 415 } else { 416 dlg.bM01Save.setEnabled(false); 417 dlg.cM01TopMark.setVisible(false); 418 dlg.cbM01TopMark.setVisible(false); 419 dlg.cM01Radar.setVisible(false); 420 dlg.cM01Racon.setVisible(false); 421 dlg.cbM01Racon.setVisible(false); 422 dlg.tfM01Racon.setVisible(false); 423 dlg.lM01Racon.setVisible(false); 424 dlg.cM01Fog.setVisible(false); 353 425 dlg.cbM01Fog.setVisible(false); 426 dlg.tfM01FogGroup.setVisible(false); 354 427 dlg.lM01FogGroup.setVisible(false); 355 dlg.tfM01Fog Group.setVisible(false);428 dlg.tfM01FogPeriod.setVisible(false); 356 429 dlg.lM01FogPeriod.setVisible(false); 357 dlg.tfM01FogPeriod.setVisible(false); 358 } 359 360 if (isFired()) { 361 String lp, c; 362 String tmp = null; 363 int i1; 364 365 String col = getLightColour(); 366 if (col.equals("W")) 367 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 368 "/images/Light_White_120.png"))); 369 else if (col.equals("R")) 370 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 371 "/images/Light_Red_120.png"))); 372 else if (col.equals("G")) 373 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 374 "/images/Light_Green_120.png"))); 375 else 376 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 377 "/images/Light_Magenta_120.png"))); 378 379 dlg.cbM01Kennung.setEnabled(true); 380 381 c = getLightChar(); 382 if (dlg.cbM01Kennung.getSelectedIndex() == 0) 383 dlg.tfM01RepeatTime.setEnabled(false); 384 else 385 dlg.tfM01RepeatTime.setEnabled(true); 386 387 if (c.contains("+")) { 388 i1 = c.indexOf("+"); 389 tmp = c.substring(i1, c.length()); 390 c = c.substring(0, i1); 391 } 392 393 if (getLightGroup() != "") 394 c = c + "(" + getLightGroup() + ")"; 395 if (tmp != null) 396 c = c + tmp; 397 398 c = c + " " + getLightColour(); 399 lp = getLightPeriod(); 400 if (lp != "" && lp != " ") 401 c = c + " " + lp + "s"; 402 dlg.lM01FireMark.setText(c); 403 } else { 404 dlg.tfM01RepeatTime.setEnabled(false); 405 dlg.cbM01Kennung.setEnabled(false); 406 dlg.lM01FireMark.setText(""); 430 dlg.cM01Fired.setVisible(false); 431 dlg.rbM01Fired1.setVisible(false); 432 dlg.rbM01FiredN.setVisible(false); 433 dlg.cbM01Kennung.setVisible(false); 434 dlg.lM01Kennung.setVisible(false); 435 dlg.tfM01Height.setVisible(false); 436 dlg.lM01Height.setVisible(false); 437 dlg.tfM01Range.setVisible(false); 438 dlg.lM01Range.setVisible(false); 439 dlg.cbM01Colour.setVisible(false); 440 dlg.lM01Colour.setVisible(false); 441 dlg.cbM01Sector.setVisible(false); 442 dlg.lM01Sector.setVisible(false); 443 dlg.tfM01Group.setVisible(false); 444 dlg.lM01Group.setVisible(false); 445 dlg.tfM01RepeatTime.setVisible(false); 446 dlg.lM01RepeatTime.setVisible(false); 447 dlg.tfM01Bearing.setVisible(false); 448 dlg.lM01Bearing.setVisible(false); 449 dlg.tfM02Bearing.setVisible(false); 450 dlg.tfM01Radius.setVisible(false); 407 451 } 408 452 } … … 450 494 "seamark:light:group", LightGroup)); 451 495 } 452 453 496 } 454 497 … … 460 503 "seamark:topmark:colour", colour)); 461 504 } 462 463 } 505 } 506 507 protected void saveRadarFogData() { 508 if (hasRadar()) { 509 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 510 "seamark:radar_reflector", "yes")); 511 } 512 if (hasRacon()) { 513 switch (RaType) { 514 case RATYP_RACON: 515 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 516 "seamark:radar_transponder:category", "racon")); 517 if (!getRaconGroup().equals("")) 518 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 519 "seamark:radar_transponder:group", getRaconGroup())); 520 break; 521 case RATYP_RAMARK: 522 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 523 "seamark:radar_transponder:category", "ramark")); 524 break; 525 case RATYP_LEADING: 526 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 527 "seamark:radar_transponder:category", "leading")); 528 break; 529 default: 530 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 531 "seamark:radar_transponder", "yes")); 532 } 533 } 534 if (hasFog()) { 535 if (FogSound == 0) { 536 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 537 "seamark:fog_signal", "yes")); 538 } else { 539 switch (FogSound) { 540 case FOG_HORN: 541 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 542 "seamark:fog_signal:category", "horn")); 543 break; 544 case FOG_SIREN: 545 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 546 "seamark:fog_signal:category", "siren")); 547 break; 548 case FOG_DIA: 549 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 550 "seamark:fog_signal:category", "diaphone")); 551 break; 552 case FOG_BELL: 553 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 554 "seamark:fog_signal:category", "bell")); 555 break; 556 case FOG_WHIS: 557 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 558 "seamark:fog_signal:category", "whistle")); 559 break; 560 case FOG_GONG: 561 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 562 "seamark:fog_signal:category", "gong")); 563 break; 564 case FOG_EXPLOS: 565 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 566 "seamark:fog_signal:category", "explosive")); 567 break; 568 } 569 if (!getFogGroup().equals("")) 570 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 571 "seamark:fog_group:group", getFogGroup())); 572 if (!getFogPeriod().equals("")) 573 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 574 "seamark:fog_period:group", getFogPeriod())); 575 } 576 } 577 } 578 579 public final static int FOG_HORN = 1; 580 public final static int FOG_SIREN = 2; 581 public final static int FOG_DIA = 3; 582 public final static int FOG_BELL = 4; 583 public final static int FOG_WHIS = 5; 584 public final static int FOG_GONG = 6; 585 public final static int FOG_EXPLOS = 7; 464 586 465 587 public void refreshStyles() { … … 507 629 dlg.cM01Fog.setVisible(false); 508 630 dlg.cbM01Fog.setVisible(false); 509 setFogSound( "");631 setFogSound(0); 510 632 dlg.tfM01FogGroup.setText(""); 511 633 dlg.tfM01FogGroup.setVisible(false); -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java
r23061 r23073 185 185 } 186 186 187 } 188 189 public boolean isValid() { 190 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 187 191 } 188 192 … … 408 412 saveTopMarkData(shape, "black"); 409 413 saveLightData("white"); 410 414 saveRadarFogData(); 411 415 } 412 416 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java
r23061 r23073 102 102 } 103 103 } 104 105 public boolean isValid() { 106 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 107 } 104 108 105 109 public void paintSign() { 106 110 if (dlg.paintlock) 107 111 return; 112 108 113 super.paintSign(); 109 114 110 115 dlg.sM01StatusBar.setText(getErrMsg()); 111 116 112 if ( (getBuoyIndex() > 0) && (getStyleIndex() > 0)) {117 if (isValid()) { 113 118 dlg.tfM01Name.setEnabled(true); 114 119 dlg.tfM01Name.setText(getName()); 115 dlg.cM01TopMark.setEnabled(false);116 120 dlg.cM01TopMark.setVisible(true); 117 dlg.cM01Radar.setEnabled(true);118 121 dlg.cM01Radar.setVisible(true); 119 dlg.cM01Racon.setEnabled(true);120 122 dlg.cM01Racon.setVisible(true); 121 dlg.cM01Fog.setEnabled(true);122 123 dlg.cM01Fog.setVisible(true); 123 124 124 dlg.cM01Fired.setVisible(true); 125 dlg.cM01Fired.setEnabled(true); 126 125 127 126 String image = "/images/Cardinal"; 128 127 … … 151 150 } else 152 151 dlg.lM01Icon.setIcon(null); 152 } else { 153 dlg.tfM01Name.setEnabled(false); 154 dlg.tfM01Name.setText(""); 155 dlg.cM01TopMark.setVisible(false); 156 dlg.cM01Radar.setVisible(false); 157 dlg.cM01Racon.setVisible(false); 158 dlg.cM01Fog.setVisible(false); 159 dlg.cM01Fired.setVisible(false); 153 160 } 154 161 } … … 212 219 213 220 saveTopMarkData("2 spheres", "black"); 214 215 221 saveLightData("white"); 222 saveRadarFogData(); 216 223 217 224 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java
r23066 r23073 345 345 } 346 346 347 public boolean isValid() { 348 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 349 } 350 347 351 public void paintSign() { 348 352 if (dlg.paintlock) … … 957 961 default: 958 962 } 959 960 963 saveTopMarkData(shape, colour); 961 964 saveLightData(colour); 965 saveRadarFogData(); 962 966 963 967 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java
r23061 r23073 43 43 setTopMark(false); 44 44 paintSign(); 45 } 46 47 public boolean isValid() { 48 return (getBuoyIndex() > 0); 45 49 } 46 50 … … 106 110 default: 107 111 } 108 109 112 saveLightData("white"); 113 saveRadarFogData(); 110 114 } 111 115 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java
r23061 r23073 102 102 } 103 103 104 public boolean isValid() { 105 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 106 } 107 104 108 public void paintSign() { 105 109 if (dlg.paintlock) … … 212 216 default: 213 217 } 214 215 218 saveTopMarkData("spherical", "red"); 216 217 219 saveLightData("white"); 218 220 saveRadarFogData(); 219 221 } 220 222 -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java
r23061 r23073 136 136 } 137 137 138 public boolean isValid() { 139 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 140 } 141 138 142 public void paintSign() { 139 143 if (dlg.paintlock) … … 258 262 default: 259 263 } 260 261 264 saveTopMarkData("x-shape", "yellow"); 262 263 265 saveLightData("white"); 264 266 saveRadarFogData(); 265 267 } 266 268
Note:
See TracChangeset
for help on using the changeset viewer.