Changeset 23193 in osm for applications/editors/josm/plugins/toms/src/toms/seamarks/buoys
- Timestamp:
- 2010-09-15T19:01:04+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/toms/src/toms/seamarks/buoys
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java
r23176 r23193 23 23 abstract public class Buoy extends SeaMark { 24 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 25 public abstract void setLightColour(); 26 27 /** 28 * private Variablen 29 */ 30 31 private int BuoyIndex = 0; 32 33 public int getBuoyIndex() { 34 return BuoyIndex; 35 } 36 37 public void setBuoyIndex(int buoyIndex) { 38 BuoyIndex = buoyIndex; 39 } 40 41 private int StyleIndex = 0; 42 43 public int getStyleIndex() { 44 return StyleIndex; 45 } 46 47 public void setStyleIndex(int styleIndex) { 48 StyleIndex = styleIndex; 49 } 50 51 private boolean Region = false; 52 53 public boolean getRegion() { 54 return Region; 55 } 56 57 public void setRegion(boolean region) { 58 Region = region; 59 } 60 61 private boolean Radar = false; 62 63 public boolean hasRadar() { 64 return Radar; 65 } 66 67 public void setRadar(boolean radar) { 68 Radar = radar; 69 } 70 71 private boolean Racon = false; 72 73 public boolean hasRacon() { 74 return Racon; 75 } 76 77 public void setRacon(boolean racon) { 78 Racon = racon; 79 } 80 81 private int RaType = 0; 82 83 public int getRaType() { 84 return RaType; 85 } 86 87 public void setRaType(int type) { 88 RaType = type; 89 } 90 91 private String RaconGroup = ""; 92 93 public String getRaconGroup() { 94 return RaconGroup; 95 } 96 97 public void setRaconGroup(String raconGroup) { 98 RaconGroup = raconGroup; 99 } 100 101 private boolean Fog = false; 102 103 public boolean hasFog() { 104 return Fog; 105 } 106 107 public void setFog(boolean fog) { 108 Fog = fog; 109 } 110 111 private int FogSound = 0; 112 113 public int getFogSound() { 114 return FogSound; 115 } 116 117 public void setFogSound(int sound) { 118 FogSound = sound; 119 } 120 121 private String FogGroup = ""; 122 123 public String getFogGroup() { 124 return FogGroup; 125 } 126 127 public void setFogGroup(String group) { 128 FogGroup = group; 129 } 130 131 private String FogPeriod = ""; 132 133 public String getFogPeriod() { 134 return FogPeriod; 135 } 136 137 public void setFogPeriod(String period) { 138 FogPeriod = period; 139 } 140 141 private boolean Fired = false; 142 143 public boolean isFired() { 144 return Fired; 145 } 146 147 public void setFired(boolean fired) { 148 Fired = fired; 149 } 150 151 private boolean Sectored = false; 152 153 public boolean isSectored() { 154 return Sectored; 155 } 156 157 public void setSectored(boolean sectored) { 158 Sectored = sectored; 159 } 160 161 private int SectorIndex = 0; 162 163 public int getSectorIndex() { 164 return SectorIndex; 165 } 166 167 public void setSectorIndex(int sector) { 168 SectorIndex = sector; 169 } 170 171 private String[] LightChar = new String[10]; 172 173 public String getLightChar() { 174 if (LightChar[SectorIndex] == null) 175 return (LightChar[0]); 176 return LightChar[SectorIndex]; 177 } 178 179 public void setLightChar(String lightChar) { 180 if (SectorIndex == 0) 181 LightChar = new String[10]; 182 LightChar[SectorIndex] = lightChar; 183 } 184 185 private String[] LightColour = new String[10]; 186 187 public String getLightColour() { 188 if (LightColour[SectorIndex] == null) 189 return (LightColour[0]); 190 return LightColour[SectorIndex]; 191 } 192 193 public void setLightColour(String lightColour) { 194 if (SectorIndex == 0) 195 LightColour = new String[10]; 196 LightColour[SectorIndex] = lightColour; 197 } 198 199 private String[] LightGroup = new String[10]; 200 201 public String getLightGroup() { 202 if (LightGroup[SectorIndex] == null) 203 return (LightGroup[0]); 204 return LightGroup[SectorIndex]; 205 } 206 207 public void setLightGroup(String lightGroup) { 208 if (SectorIndex == 0) 209 LightGroup = new String[10]; 210 LightGroup[SectorIndex] = lightGroup; 211 } 212 213 protected void setLightGroup(Map<String, String> k) { 214 String s = ""; 215 if (k.containsKey("seamark:light:group")) { 216 s = k.get("seamark:light:group"); 217 setLightGroup(s); 218 } 219 } 220 221 private String[] Height = new String[10]; 222 223 public String getHeight() { 224 if (Height[SectorIndex] == null) 225 return (Height[0]); 226 return Height[SectorIndex]; 227 } 228 229 public void setHeight(String height) { 230 if (SectorIndex == 0) 231 Height = new String[10]; 232 Height[SectorIndex] = height; 233 } 234 235 private String[] Range = new String[10]; 236 237 public String getRange() { 238 if (Range[SectorIndex] == null) 239 return (Range[0]); 240 return Range[SectorIndex]; 241 } 242 243 public void setRange(String range) { 244 if (SectorIndex == 0) 245 Range = new String[10]; 246 Range[SectorIndex] = range; 247 } 248 249 private String[] Bearing1 = new String[10]; 250 251 public String getBearing1() { 252 if (Bearing1[SectorIndex] == null) 253 return (Bearing1[0]); 254 return Bearing1[SectorIndex]; 255 } 256 257 public void setBearing1(String bearing) { 258 if (SectorIndex == 0) 259 Bearing1 = new String[10]; 260 Bearing1[SectorIndex] = bearing; 261 } 262 263 private String[] Bearing2 = new String[10]; 264 265 public String getBearing2() { 266 if (Bearing2[SectorIndex] == null) 267 return (Bearing2[0]); 268 return Bearing2[SectorIndex]; 269 } 270 271 public void setBearing2(String bearing) { 272 if (SectorIndex == 0) 273 Bearing2 = new String[10]; 274 Bearing2[SectorIndex] = bearing; 275 } 276 277 private String[] Radius = new String[10]; 278 279 public String getRadius() { 280 if (Radius[SectorIndex] == null) 281 return (Radius[0]); 282 return Radius[SectorIndex]; 283 } 284 285 public void setRadius(String radius) { 286 if (SectorIndex == 0) 287 Radius = new String[10]; 288 Radius[SectorIndex] = radius; 289 } 290 291 private String[] LightPeriod = new String[10]; 292 293 public String getLightPeriod() { 294 if (LightPeriod[SectorIndex] == null) 295 return (LightPeriod[0]); 296 return LightPeriod[SectorIndex]; 297 } 298 299 public void setLightPeriod(String lightPeriod) { 300 String regex = "^[\\d\\s.]+$"; 301 302 if (!lightPeriod.isEmpty()) { 303 304 Pattern pat = Pattern.compile(regex); 305 Matcher matcher = pat.matcher(lightPeriod); 306 307 if (matcher.find()) { 308 setErrMsg(null); 309 } else { 310 setErrMsg("Must be a number"); 311 lightPeriod = ""; 312 dlg.tfM01RepeatTime.requestFocus(); 313 } 314 } 315 if (SectorIndex == 0) 316 LightPeriod = new String[10]; 317 LightPeriod[SectorIndex] = lightPeriod; 318 } 319 320 private Node Node = null; 321 322 public Node getNode() { 323 return Node; 324 } 325 326 public void setNode(Node node) { 327 Node = node; 328 } 329 330 private boolean TopMark = false; 331 332 public boolean hasTopMark() { 333 return TopMark; 334 } 335 336 public void setTopMark(boolean topMark) { 337 TopMark = topMark; 338 /* 339 * if (dlg.cM01TopMark == null) { return; } 340 */ 341 dlg.cM01TopMark.setSelected(topMark); 342 } 343 344 protected SmpDialogAction dlg = null; // hier wird der Dialog referenziert 345 346 public SmpDialogAction getDlg() { 347 return dlg; 348 } 349 350 public void setDlg(SmpDialogAction dlg) { 351 this.dlg = dlg; 352 } 353 354 protected Buoy(SmpDialogAction dia) { 355 dlg = dia; 356 } 357 358 public boolean isValid() { 359 return false; 360 } 361 362 public void parseLights(Map<String, String> k) { 363 setFired(false); 364 setSectored(false); 365 Iterator it = k.entrySet().iterator(); 366 while (it.hasNext()) { 367 Map.Entry entry = (Map.Entry) it.next(); 368 String key = (String) entry.getKey(); 369 String value = ((String) entry.getValue()).trim(); 370 if (key.contains("seamark:light:")) { 371 setFired(true); 372 int index = 0; 373 key = key.substring(14); 374 if (key.matches("^\\d:.*")) { 375 index = key.charAt(0) - '0'; 376 key = key.substring(2); 377 } else if (key.matches("^\\d$")) { 378 index = key.charAt(0) - '0'; 379 String values[] = value.split(":"); 380 if (values[0].equals("red")) 381 LightColour[index] = "R"; 382 else if (values[0].equals("green")) 383 LightColour[index] = "G"; 384 else if (values[0].equals("white")) 385 LightColour[index] = "W"; 386 Bearing1[index] = values[1]; 387 Bearing2[index] = values[2]; 388 Radius[index] = values[3]; 389 } else { 390 index = 0; 391 } 392 if (index != 0) 393 setSectored(true); 394 if (key.equals("colour")) { 395 if (value.equals("red")) 396 LightColour[index] = "R"; 397 else if (value.equals("green")) 398 LightColour[index] = "G"; 399 else if (value.equals("white")) 400 LightColour[index] = "W"; 401 } else if (key.equals("character")) { 402 LightChar[index] = value; 403 } else if (key.equals("group")) { 404 LightGroup[index] = value; 405 } else if (key.equals("period")) { 406 LightPeriod[index] = value; 407 } else if (key.equals("height")) { 408 Height[index] = value; 409 } else if (key.equals("range")) { 410 Range[index] = value; 411 } 412 } 413 } 414 setSectorIndex(0); 415 dlg.cbM01Sector.setSelectedIndex(0); 416 dlg.cM01Fired.setSelected(isFired()); 417 dlg.rbM01Fired1.setSelected(!isSectored()); 418 dlg.rbM01FiredN.setSelected(isSectored()); 419 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 420 dlg.tfM01Height.setText(getHeight()); 421 dlg.tfM01Range.setText(getRange()); 422 dlg.tfM01Group.setText(getLightGroup()); 423 dlg.tfM01RepeatTime.setText(getLightPeriod()); 424 dlg.cbM01Colour.setSelectedItem(getLightColour()); 425 } 426 427 public void parseFogRadar(Map<String, String> k) { 428 String str; 429 setFog(false); 430 setRadar(false); 431 setRacon(false); 432 if (k.containsKey("seamark:fog_signal") 433 || k.containsKey("seamark:fog_signal:category") 434 || k.containsKey("seamark:fog_signal:group") 435 || k.containsKey("seamark:fog_signal:period")) { 436 setFog(true); 437 if (k.containsKey("seamark:fog_signal:category")) { 438 str = k.get("seamark:fog_signal:category"); 439 if (str.equals("horn")) 440 setFogSound(FOG_HORN); 441 else if (str.equals("siren")) 442 setFogSound(FOG_SIREN); 443 else if (str.equals("diaphone")) 444 setFogSound(FOG_DIA); 445 else if (str.equals("bell")) 446 setFogSound(FOG_BELL); 447 else if (str.equals("whis")) 448 setFogSound(FOG_WHIS); 449 else if (str.equals("gong")) 450 setFogSound(FOG_GONG); 451 else if (str.equals("explosive")) 452 setFogSound(FOG_EXPLOS); 453 else 454 setFogSound(UNKNOWN_FOG); 455 } 456 if (k.containsKey("seamark:fog_signal:group")) 457 setFogGroup(k.get("seamark:fog_signal:group")); 458 if (k.containsKey("seamark:fog_signal:period")) 459 setFogPeriod(k.get("seamark:fog_signal:period")); 460 } 461 dlg.cM01Fog.setSelected(hasFog()); 462 dlg.cbM01Fog.setSelectedIndex(getFogSound()); 463 dlg.tfM01FogGroup.setText(getFogGroup()); 464 dlg.tfM01FogPeriod.setText(getFogPeriod()); 465 466 if (k.containsKey("seamark:radar_transponder") 467 || k.containsKey("seamark:radar_transponder:category") 468 || k.containsKey("seamark:radar_transponder:group")) { 469 setRacon(true); 470 if (k.containsKey("seamark:radar_transponder:category")) { 471 str = k.get("seamark:radar_transponder:category"); 472 if (str.equals("racon")) 473 setRaType(RATYPE_RACON); 474 else if (str.equals("ramark")) 475 setRaType(RATYPE_RAMARK); 476 else if (str.equals("leading")) 477 setRaType(RATYPE_LEADING); 478 else 479 setRaType(UNKNOWN_RATYPE); 480 } 481 if (k.containsKey("seamark:radar_transponder:group")) 482 setRaconGroup(k.get("seamark:radar_transponder:group")); 483 } else if (k.containsKey("seamark:radar_reflector")) 484 setRadar(true); 485 dlg.cM01Radar.setSelected(hasRadar()); 486 dlg.cM01Racon.setSelected(hasRacon()); 487 dlg.cbM01Racon.setSelectedIndex(getRaType()); 488 dlg.tfM01Racon.setText(getRaconGroup()); 489 } 490 491 public void paintSign() { 492 493 if (dlg.paintlock) 494 return; 495 else 496 dlg.paintlock = true; 497 498 dlg.lM01Icon.setIcon(null); 499 dlg.lM02Icon.setIcon(null); 500 dlg.lM03Icon.setIcon(null); 501 dlg.lM04Icon.setIcon(null); 502 dlg.lM05Icon.setIcon(null); 503 504 dlg.rbM01RegionA.setSelected(!getRegion()); 505 dlg.rbM01RegionB.setSelected(getRegion()); 506 507 if (isValid()) { 508 dlg.bM01Save.setEnabled(true); 509 510 dlg.cM01TopMark.setSelected(hasTopMark()); 511 dlg.cM01Fired.setSelected(isFired()); 512 513 dlg.tfM01RepeatTime.setText(getLightPeriod()); 514 515 dlg.tfM01Name.setText(getName()); 516 dlg.tfM01Name.setEnabled(true); 517 518 if (hasRadar()) { 519 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 520 "/images/Radar_Reflector.png"))); 521 } 522 523 if (hasRacon()) { 524 dlg.lM04Icon.setIcon(new ImageIcon(getClass().getResource( 525 "/images/Radar_Station.png"))); 526 dlg.cbM01Racon.setVisible(true); 527 if (getRaType() == RATYPE_RACON) { 528 dlg.lM01Racon.setVisible(true); 529 dlg.tfM01Racon.setVisible(true); 530 dlg.tfM01Racon.setEnabled(true); 531 } else { 532 dlg.lM01Racon.setVisible(false); 533 dlg.tfM01Racon.setVisible(false); 534 } 535 } else { 536 dlg.cbM01Racon.setVisible(false); 537 dlg.lM01Racon.setVisible(false); 538 dlg.tfM01Racon.setVisible(false); 539 } 540 541 if (hasFog()) { 542 dlg.lM05Icon.setIcon(new ImageIcon(getClass().getResource( 543 "/images/Fog_Signal.png"))); 544 dlg.cbM01Fog.setVisible(true); 545 if (getFogSound() == 0) { 546 dlg.lM01FogGroup.setVisible(false); 547 dlg.tfM01FogGroup.setVisible(false); 548 dlg.lM01FogPeriod.setVisible(false); 549 dlg.tfM01FogPeriod.setVisible(false); 550 } else { 551 dlg.lM01FogGroup.setVisible(true); 552 dlg.tfM01FogGroup.setVisible(true); 553 dlg.lM01FogPeriod.setVisible(true); 554 dlg.tfM01FogPeriod.setVisible(true); 555 } 556 } else { 557 dlg.cbM01Fog.setVisible(false); 558 dlg.lM01FogGroup.setVisible(false); 559 dlg.tfM01FogGroup.setVisible(false); 560 dlg.lM01FogPeriod.setVisible(false); 561 dlg.tfM01FogPeriod.setVisible(false); 562 } 563 564 if (isFired()) { 565 String lp, c; 566 String tmp = null; 567 int i1; 568 569 String col = getLightColour(); 570 if (col.equals("W")) { 571 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 572 "/images/Light_White_120.png"))); 573 dlg.cbM01Colour.setSelectedIndex(WHITE_LIGHT); 574 } else if (col.equals("R")) { 575 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 576 "/images/Light_Red_120.png"))); 577 dlg.cbM01Colour.setSelectedIndex(RED_LIGHT); 578 } else if (col.equals("G")) { 579 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 580 "/images/Light_Green_120.png"))); 581 dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT); 582 } else { 583 dlg.lM02Icon.setIcon(new ImageIcon(getClass().getResource( 584 "/images/Light_Magenta_120.png"))); 585 dlg.cbM01Colour.setSelectedIndex(UNKNOWN_COLOUR); 586 } 587 588 c = getLightChar(); 589 if (c.contains("+")) { 590 i1 = c.indexOf("+"); 591 tmp = c.substring(i1, c.length()); 592 c = c.substring(0, i1); 593 if (!getLightGroup().isEmpty()) { 594 c = c + "(" + getLightGroup() + ")"; 595 } 596 if (tmp != null) 597 c = c + tmp; 598 } 599 dlg.cbM01Kennung.setSelectedItem(c); 600 if (((dlg.cbM01Kennung.getSelectedIndex() == 0) && !getLightGroup() 601 .isEmpty()) 602 || (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) 603 && !(((String) dlg.cbM01Kennung.getSelectedItem()).contains("+"))) { 604 c = c + "(" + getLightGroup() + ")"; 605 dlg.cbM01Kennung.setSelectedItem(c); 606 } 607 c = c + " " + getLightColour(); 608 lp = getLightPeriod(); 609 if (!lp.isEmpty()) 610 c = c + " " + lp + "s"; 611 dlg.lM01FireMark.setText(c); 612 dlg.cM01Fired.setVisible(true); 613 dlg.lM01Kennung.setVisible(true); 614 dlg.cbM01Kennung.setVisible(true); 615 if (((String) dlg.cbM01Kennung.getSelectedItem()).contains("(")) { 616 dlg.tfM01Group.setVisible(false); 617 dlg.lM01Group.setVisible(false); 618 } else { 619 dlg.lM01Group.setVisible(true); 620 dlg.tfM01Group.setVisible(true); 621 } 622 dlg.tfM01Group.setText(getLightGroup()); 623 dlg.lM01RepeatTime.setVisible(true); 624 dlg.tfM01RepeatTime.setVisible(true); 625 if (isSectored()) { 626 dlg.rbM01Fired1.setSelected(false); 627 dlg.rbM01FiredN.setSelected(true); 628 if ((getSectorIndex() != 0) && (!LightChar[0].isEmpty())) 629 dlg.cbM01Kennung.setEnabled(false); 630 else 631 dlg.cbM01Kennung.setEnabled(true); 632 dlg.cbM01Kennung.setSelectedItem(getLightChar()); 633 if ((getSectorIndex() != 0) && (!LightGroup[0].isEmpty())) 634 dlg.tfM01Group.setEnabled(false); 635 else 636 dlg.tfM01Group.setEnabled(true); 637 dlg.tfM01Group.setText(getLightGroup()); 638 if ((getSectorIndex() != 0) && (!LightPeriod[0].isEmpty())) 639 dlg.tfM01RepeatTime.setEnabled(false); 640 else 641 dlg.tfM01RepeatTime.setEnabled(true); 642 dlg.tfM01RepeatTime.setText(getLightPeriod()); 643 if ((getSectorIndex() != 0) && (!Height[0].isEmpty())) 644 dlg.tfM01Height.setEnabled(false); 645 else 646 dlg.tfM01Height.setEnabled(true); 647 dlg.tfM01Height.setText(getHeight()); 648 if ((getSectorIndex() != 0) && (!Range[0].isEmpty())) 649 dlg.tfM01Range.setEnabled(false); 650 else 651 dlg.tfM01Range.setEnabled(true); 652 dlg.tfM01Range.setText(getRange()); 653 dlg.lM01Sector.setVisible(true); 654 dlg.cbM01Sector.setVisible(true); 655 if (getSectorIndex() == 0) { 656 dlg.lM01Colour.setVisible(false); 657 dlg.cbM01Colour.setVisible(false); 658 dlg.lM01Bearing.setVisible(false); 659 dlg.tfM01Bearing.setVisible(false); 660 dlg.tfM02Bearing.setVisible(false); 661 dlg.tfM01Radius.setVisible(false); 662 } else { 663 dlg.lM01Colour.setVisible(true); 664 dlg.cbM01Colour.setVisible(true); 665 dlg.lM01Bearing.setVisible(true); 666 dlg.tfM01Bearing.setVisible(true); 667 dlg.tfM01Bearing.setText(getBearing1()); 668 dlg.tfM02Bearing.setVisible(true); 669 dlg.tfM02Bearing.setText(getBearing2()); 670 dlg.tfM01Radius.setVisible(true); 671 dlg.tfM01Radius.setText(getRadius()); 672 } 673 } else { 674 dlg.rbM01FiredN.setSelected(false); 675 dlg.rbM01Fired1.setSelected(true); 676 dlg.cbM01Kennung.setEnabled(true); 677 dlg.tfM01Group.setEnabled(true); 678 dlg.tfM01RepeatTime.setEnabled(true); 679 dlg.tfM01Height.setEnabled(true); 680 dlg.tfM01Range.setEnabled(true); 681 dlg.lM01Colour.setVisible(true); 682 dlg.cbM01Colour.setVisible(true); 683 dlg.lM01Sector.setVisible(false); 684 dlg.cbM01Sector.setVisible(false); 685 dlg.lM01Bearing.setVisible(false); 686 dlg.tfM01Bearing.setVisible(false); 687 dlg.tfM02Bearing.setVisible(false); 688 dlg.tfM01Radius.setVisible(false); 689 } 690 } else { 691 dlg.lM01FireMark.setText(""); 692 dlg.rbM01Fired1.setVisible(false); 693 dlg.rbM01FiredN.setVisible(false); 694 dlg.cbM01Kennung.setVisible(false); 695 dlg.lM01Kennung.setVisible(false); 696 dlg.tfM01Height.setVisible(false); 697 dlg.lM01Height.setVisible(false); 698 dlg.tfM01Range.setVisible(false); 699 dlg.lM01Range.setVisible(false); 700 dlg.cbM01Colour.setVisible(false); 701 dlg.lM01Colour.setVisible(false); 702 dlg.cbM01Sector.setVisible(false); 703 dlg.lM01Sector.setVisible(false); 704 dlg.tfM01Group.setVisible(false); 705 dlg.lM01Group.setVisible(false); 706 dlg.tfM01RepeatTime.setVisible(false); 707 dlg.lM01RepeatTime.setVisible(false); 708 dlg.tfM01Bearing.setVisible(false); 709 dlg.lM01Bearing.setVisible(false); 710 dlg.tfM02Bearing.setVisible(false); 711 dlg.tfM01Radius.setVisible(false); 712 } 713 } else { 714 dlg.bM01Save.setEnabled(false); 715 dlg.tfM01Name.setEnabled(false); 716 dlg.cM01TopMark.setVisible(false); 717 dlg.cbM01TopMark.setVisible(false); 718 dlg.cM01Radar.setVisible(false); 719 dlg.cM01Racon.setVisible(false); 720 dlg.cbM01Racon.setVisible(false); 721 dlg.tfM01Racon.setVisible(false); 722 dlg.lM01Racon.setVisible(false); 723 dlg.cM01Fog.setVisible(false); 724 dlg.cbM01Fog.setVisible(false); 725 dlg.tfM01FogGroup.setVisible(false); 726 dlg.lM01FogGroup.setVisible(false); 727 dlg.tfM01FogPeriod.setVisible(false); 728 dlg.lM01FogPeriod.setVisible(false); 729 dlg.cM01Fired.setVisible(false); 730 dlg.rbM01Fired1.setVisible(false); 731 dlg.rbM01FiredN.setVisible(false); 732 dlg.cbM01Kennung.setVisible(false); 733 dlg.lM01Kennung.setVisible(false); 734 dlg.tfM01Height.setVisible(false); 735 dlg.lM01Height.setVisible(false); 736 dlg.tfM01Range.setVisible(false); 737 dlg.lM01Range.setVisible(false); 738 dlg.cbM01Colour.setVisible(false); 739 dlg.lM01Colour.setVisible(false); 740 dlg.cbM01Sector.setVisible(false); 741 dlg.lM01Sector.setVisible(false); 742 dlg.tfM01Group.setVisible(false); 743 dlg.lM01Group.setVisible(false); 744 dlg.tfM01RepeatTime.setVisible(false); 745 dlg.lM01RepeatTime.setVisible(false); 746 dlg.tfM01Bearing.setVisible(false); 747 dlg.lM01Bearing.setVisible(false); 748 dlg.tfM02Bearing.setVisible(false); 749 dlg.tfM01Radius.setVisible(false); 750 } 751 dlg.paintlock = false; 752 } 753 754 public void saveSign(String type) { 755 delSeaMarkKeys(Node); 756 757 String str = dlg.tfM01Name.getText(); 758 if (!str.isEmpty()) 759 Main.main.undoRedo.add(new ChangePropertyCommand(Node, "seamark:name", 760 str)); 761 Main.main.undoRedo 762 .add(new ChangePropertyCommand(Node, "seamark:type", type)); 763 } 764 765 protected void saveLightData() { 766 String colour; 767 if (dlg.cM01Fired.isSelected()) { 768 if (!(colour = LightColour[0]).isEmpty()) 769 if (colour.equals("R")) { 770 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 771 "seamark:light:colour", "red")); 772 } else if (colour.equals("G")) { 773 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 774 "seamark:light:colour", "green")); 775 } else if (colour.equals("W")) { 776 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 777 "seamark:light:colour", "white")); 778 } 779 780 if (!LightPeriod[0].isEmpty()) 781 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 782 "seamark:light:period", LightPeriod[0])); 783 784 if (!LightChar[0].isEmpty()) 785 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 786 "seamark:light:character", LightChar[0])); 787 788 if (!LightGroup[0].isEmpty()) 789 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 790 "seamark:light:group", LightGroup[0])); 791 792 if (!Height[0].isEmpty()) 793 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 794 "seamark:light:height", Height[0])); 795 796 if (!Range[0].isEmpty()) 797 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 798 "seamark:light:range", Range[0])); 799 800 for (int i = 1; i < 10; i++) { 801 if ((colour = LightColour[i]) != null) 802 if (colour.equals("R")) { 803 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 804 "seamark:light:" + i + ":colour", "red")); 805 if ((Bearing1[i] != null) && (Bearing2[i] != null) 806 && (Radius[i] != null)) 807 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 808 "seamark:light:" + i, "red:" + Bearing1[i] + ":" 809 + Bearing2[i] + ":" + Radius[i])); 810 } else if (colour.equals("G")) { 811 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 812 "seamark:light:" + i + ":colour", "green")); 813 if ((Bearing1[i] != null) && (Bearing2[i] != null) 814 && (Radius[i] != null)) 815 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 816 "seamark:light:" + i, "green:" + Bearing1[i] + ":" 817 + Bearing2[i] + ":" + Radius[i])); 818 } else if (colour.equals("W")) { 819 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 820 "seamark:light:" + i + ":colour", "white")); 821 if ((Bearing1[i] != null) && (Bearing2[i] != null) 822 && (Radius[i] != null)) 823 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 824 "seamark:light:" + i, "white:" + Bearing1[i] + ":" 825 + Bearing2[i] + ":" + Radius[i])); 826 } 827 828 if (LightPeriod[i] != null) 829 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 830 "seamark:light:" + i + ":period", LightPeriod[i])); 831 832 if (LightChar[i] != null) 833 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 834 "seamark:light:" + i + ":character", LightChar[i])); 835 836 if (LightGroup[i] != null) 837 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 838 "seamark:light:" + i + ":group", LightGroup[i])); 839 840 if (Height[i] != null) 841 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 842 "seamark:light:" + i + ":height", Height[i])); 843 844 if (Range[i] != null) 845 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 846 "seamark:light:" + i + ":range", Range[i])); 847 848 if (Bearing1[i] != null) 849 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 850 "seamark:light:" + i + ":sector_start", Bearing1[i])); 851 852 if (Bearing2[i] != null) 853 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 854 "seamark:light:" + i + ":sector_end", Bearing2[i])); 855 } 856 } 857 } 858 859 protected void saveTopMarkData(String shape, String colour) { 860 if (dlg.cM01TopMark.isSelected()) { 861 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 862 "seamark:topmark:shape", shape)); 863 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 864 "seamark:topmark:colour", colour)); 865 } 866 } 867 868 protected void saveRadarFogData() { 869 if (hasRadar()) { 870 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 871 "seamark:radar_reflector", "yes")); 872 } 873 if (hasRacon()) { 874 switch (RaType) { 875 case RATYPE_RACON: 876 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 877 "seamark:radar_transponder:category", "racon")); 878 if (!getRaconGroup().isEmpty()) 879 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 880 "seamark:radar_transponder:group", getRaconGroup())); 881 break; 882 case RATYPE_RAMARK: 883 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 884 "seamark:radar_transponder:category", "ramark")); 885 break; 886 case RATYPE_LEADING: 887 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 888 "seamark:radar_transponder:category", "leading")); 889 break; 890 default: 891 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 892 "seamark:radar_transponder", "yes")); 893 } 894 } 895 if (hasFog()) { 896 if (getFogSound() == 0) { 897 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 898 "seamark:fog_signal", "yes")); 899 } else { 900 switch (getFogSound()) { 901 case FOG_HORN: 902 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 903 "seamark:fog_signal:category", "horn")); 904 break; 905 case FOG_SIREN: 906 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 907 "seamark:fog_signal:category", "siren")); 908 break; 909 case FOG_DIA: 910 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 911 "seamark:fog_signal:category", "diaphone")); 912 break; 913 case FOG_BELL: 914 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 915 "seamark:fog_signal:category", "bell")); 916 break; 917 case FOG_WHIS: 918 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 919 "seamark:fog_signal:category", "whistle")); 920 break; 921 case FOG_GONG: 922 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 923 "seamark:fog_signal:category", "gong")); 924 break; 925 case FOG_EXPLOS: 926 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 927 "seamark:fog_signal:category", "explosive")); 928 break; 929 } 930 if (!getFogGroup().isEmpty()) 931 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 932 "seamark:fog_signal:group", getFogGroup())); 933 if (!getFogPeriod().isEmpty()) 934 Main.main.undoRedo.add(new ChangePropertyCommand(Node, 935 "seamark:fog_signal:period", getFogPeriod())); 936 } 937 } 938 } 939 940 public void refreshStyles() { 941 } 942 943 public void refreshLights() { 944 dlg.cbM01Kennung.removeAllItems(); 945 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 946 dlg.cbM01Kennung.addItem("Fl"); //$NON-NLS-1$ 947 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 948 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 949 dlg.cbM01Kennung.addItem("F"); //$NON-NLS-1$ 950 dlg.cbM01Kennung.addItem("FFl"); //$NON-NLS-1$ 951 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 952 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 953 dlg.cbM01Kennung.addItem("IQ"); //$NON-NLS-1$ 954 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 955 dlg.cbM01Kennung.addItem("IVQ"); //$NON-NLS-1$ 956 dlg.cbM01Kennung.addItem("UQ"); //$NON-NLS-1$ 957 dlg.cbM01Kennung.addItem("IUQ"); //$NON-NLS-1$ 958 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 959 dlg.cbM01Kennung.setSelectedIndex(0); 960 } 961 962 public void resetMask() { 963 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); 964 965 dlg.lM01Icon.setIcon(null); 966 dlg.lM02Icon.setIcon(null); 967 dlg.lM03Icon.setIcon(null); 968 dlg.lM04Icon.setIcon(null); 969 970 dlg.rbM01RegionA.setEnabled(false); 971 dlg.rbM01RegionB.setEnabled(false); 972 dlg.lM01FireMark.setText(""); 973 dlg.cbM01CatOfMark.removeAllItems(); 974 dlg.cbM01CatOfMark.setVisible(false); 975 dlg.lM01CatOfMark.setVisible(false); 976 setBuoyIndex(0); 977 dlg.cbM01StyleOfMark.removeAllItems(); 978 dlg.cbM01StyleOfMark.setVisible(false); 979 dlg.lM01StyleOfMark.setVisible(false); 980 setStyleIndex(0); 981 dlg.tfM01Name.setText(""); 982 dlg.tfM01Name.setEnabled(false); 983 setName(""); 984 dlg.cM01TopMark.setSelected(false); 985 dlg.cM01TopMark.setVisible(false); 986 dlg.cbM01TopMark.removeAllItems(); 987 dlg.cbM01TopMark.setVisible(false); 988 setTopMark(false); 989 dlg.cM01Radar.setSelected(false); 990 dlg.cM01Radar.setVisible(false); 991 setRadar(false); 992 dlg.cM01Racon.setSelected(false); 993 dlg.cM01Racon.setVisible(false); 994 dlg.cbM01Racon.setVisible(false); 995 dlg.tfM01Racon.setText(""); 996 dlg.tfM01Racon.setVisible(false); 997 dlg.lM01Racon.setVisible(false); 998 setRacon(false); 999 setRaType(0); 1000 dlg.cM01Fog.setSelected(false); 1001 dlg.cM01Fog.setVisible(false); 1002 dlg.cbM01Fog.setVisible(false); 1003 setFogSound(0); 1004 dlg.tfM01FogGroup.setText(""); 1005 dlg.tfM01FogGroup.setVisible(false); 1006 dlg.lM01FogGroup.setVisible(false); 1007 dlg.tfM01FogPeriod.setText(""); 1008 dlg.tfM01FogPeriod.setVisible(false); 1009 dlg.lM01FogPeriod.setVisible(false); 1010 setFog(false); 1011 dlg.cM01Fired.setSelected(false); 1012 dlg.cM01Fired.setVisible(false); 1013 setFired(false); 1014 dlg.rbM01Fired1.setVisible(false); 1015 dlg.rbM01Fired1.setSelected(true); 1016 dlg.rbM01FiredN.setVisible(false); 1017 dlg.rbM01FiredN.setSelected(false); 1018 setSectored(false); 1019 dlg.cbM01Kennung.removeAllItems(); 1020 dlg.cbM01Kennung.setVisible(false); 1021 dlg.lM01Kennung.setVisible(false); 1022 setLightChar(""); 1023 dlg.tfM01Height.setText(""); 1024 dlg.tfM01Height.setVisible(false); 1025 dlg.lM01Height.setVisible(false); 1026 setHeight(""); 1027 dlg.tfM01Range.setText(""); 1028 dlg.tfM01Range.setVisible(false); 1029 dlg.lM01Range.setVisible(false); 1030 setRange(""); 1031 dlg.cbM01Colour.setVisible(false); 1032 dlg.lM01Colour.setVisible(false); 1033 setLightColour(""); 1034 dlg.cbM01Sector.setVisible(false); 1035 dlg.lM01Sector.setVisible(false); 1036 setSectorIndex(0); 1037 dlg.tfM01Group.setText(""); 1038 dlg.tfM01Group.setVisible(false); 1039 dlg.lM01Group.setVisible(false); 1040 setLightGroup(""); 1041 dlg.tfM01RepeatTime.setText(""); 1042 dlg.tfM01RepeatTime.setVisible(false); 1043 dlg.lM01RepeatTime.setVisible(false); 1044 setLightPeriod(""); 1045 dlg.tfM01Bearing.setText(""); 1046 dlg.tfM01Bearing.setVisible(false); 1047 dlg.lM01Bearing.setVisible(false); 1048 setBearing1(""); 1049 dlg.tfM02Bearing.setText(""); 1050 dlg.tfM02Bearing.setVisible(false); 1051 setBearing2(""); 1052 dlg.tfM01Radius.setText(""); 1053 dlg.tfM01Radius.setVisible(false); 1054 setRadius(""); 1055 1056 dlg.bM01Save.setEnabled(false); 1057 } 1058 1058 1059 1059 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java
r23179 r23193 18 18 public class BuoyCard extends Buoy { 19 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 20 public BuoyCard(SmpDialogAction dia, Node node) { 21 super(dia); 22 23 String str; 24 Map<String, String> keys; 25 keys = node.getKeys(); 26 setNode(node); 27 28 resetMask(); 29 dlg.cbM01CatOfMark.removeAllItems(); 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.158")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.159")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.160")); //$NON-NLS-1$ 34 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.161")); //$NON-NLS-1$ 35 36 dlg.cbM01CatOfMark.setEnabled(true); 37 dlg.cbM01CatOfMark.setVisible(true); 38 dlg.lM01CatOfMark.setVisible(true); 39 40 dlg.cbM01StyleOfMark.removeAllItems(); 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.setVisible(true); 48 dlg.lM01StyleOfMark.setVisible(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL); 51 52 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 53 if (keys.containsKey("name")) //$NON-NLS-1$ 54 setName(keys.get("name")); //$NON-NLS-1$ 55 56 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_cardinal:name")) //$NON-NLS-1$ 60 setName(keys.get("seamark:buoy_cardinal:name")); //$NON-NLS-1$ 61 else if (keys.containsKey("seamark:beacon_cardinal:name")) //$NON-NLS-1$ 62 setName(keys.get("seamark:beacon_cardinal:name")); //$NON-NLS-1$ 63 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 65 66 String cat = ""; //$NON-NLS-1$ 67 String col = ""; //$NON-NLS-1$ 68 69 if (keys.containsKey("seamark:buoy_cardinal:category")) //$NON-NLS-1$ 70 cat = keys.get("seamark:buoy_cardinal:category"); //$NON-NLS-1$ 71 else if (keys.containsKey("seamark:beacon_cardinal:category")) //$NON-NLS-1$ 72 cat = keys.get("seamark:beacon_cardinal:category"); //$NON-NLS-1$ 73 74 if (keys.containsKey("seamark:buoy_cardinal:colour")) //$NON-NLS-1$ 75 col = keys.get("seamark:buoy_cardinal:colour"); //$NON-NLS-1$ 76 else if (keys.containsKey("seamark:beacon_cardinal:colour")) //$NON-NLS-1$ 77 col = keys.get("seamark:beacon_cardinal:colour"); //$NON-NLS-1$ 78 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 79 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 80 81 if (cat.isEmpty()) { //$NON-NLS-1$ 82 if (col.equals("black;yellow")) { //$NON-NLS-1$ 83 setBuoyIndex(CARD_NORTH); 84 setColour(BLACK_YELLOW); 85 } else if (col.equals("black;yellow;black")) { //$NON-NLS-1$ 86 setBuoyIndex(CARD_EAST); 87 setColour(BLACK_YELLOW_BLACK); 88 } else if (col.equals("yellow;black")) { //$NON-NLS-1$ 89 setBuoyIndex(CARD_SOUTH); 90 setColour(YELLOW_BLACK); 91 } else if (col.equals("yellow;black;yellow")) { //$NON-NLS-1$ 92 setBuoyIndex(CARD_WEST); 93 setColour(YELLOW_BLACK_YELLOW); 94 } 95 } else if (cat.equals("north")) { //$NON-NLS-1$ 96 setBuoyIndex(CARD_NORTH); 97 setColour(BLACK_YELLOW); 98 } else if (cat.equals("east")) { //$NON-NLS-1$ 99 setBuoyIndex(CARD_EAST); 100 setColour(BLACK_YELLOW_BLACK); 101 } else if (cat.equals("south")) { //$NON-NLS-1$ 102 setBuoyIndex(CARD_SOUTH); 103 setColour(YELLOW_BLACK); 104 } else if (cat.equals("west")) { //$NON-NLS-1$ 105 setBuoyIndex(CARD_WEST); 106 setColour(YELLOW_BLACK_YELLOW); 107 } 108 109 if (keys.containsKey("seamark:buoy_cardinal:shape")) { //$NON-NLS-1$ 110 str = keys.get("seamark:buoy_cardinal:shape"); //$NON-NLS-1$ 111 112 if (str.equals("pillar")) //$NON-NLS-1$ 113 setStyleIndex(CARD_PILLAR); 114 else if (str.equals("spar")) //$NON-NLS-1$ 115 setStyleIndex(CARD_SPAR); 116 } else if (keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$ 117 if (keys.containsKey("seamark:beacon_cardinal:shape")) { //$NON-NLS-1$ 118 str = keys.get("seamark:beacon_cardinal:shape"); //$NON-NLS-1$ 119 120 if (str.equals("tower")) //$NON-NLS-1$ 121 setStyleIndex(CARD_TOWER); 122 else 123 setStyleIndex(CARD_BEACON); 124 } else 125 setStyleIndex(CARD_BEACON); 126 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 127 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 128 setStyleIndex(CARD_FLOAT); 129 } 130 131 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 132 setStyleIndex(0); 133 134 refreshLights(); 135 parseLights(keys); 136 parseFogRadar(keys); 137 138 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 139 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 140 dlg.tfM01Name.setText(getName()); 141 dlg.cM01TopMark.setSelected(hasTopMark()); 142 } 143 144 public void refreshLights() { 145 int type = getBuoyIndex(); 146 147 dlg.cbM01Kennung.removeAllItems(); 148 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 149 dlg.cbM01Kennung.setSelectedIndex(0); 150 151 switch (type) { 152 case SeaMark.CARD_NORTH: 153 dlg.cbM01Kennung.addItem("Q"); //$NON-NLS-1$ 154 dlg.cbM01Kennung.addItem("VQ"); //$NON-NLS-1$ 155 break; 156 157 case SeaMark.CARD_EAST: 158 dlg.cbM01Kennung.addItem("Q(3)"); //$NON-NLS-1$ 159 dlg.cbM01Kennung.addItem("VQ(3)"); //$NON-NLS-1$ 160 break; 161 162 case SeaMark.CARD_SOUTH: 163 dlg.cbM01Kennung.addItem("Q(6)+LFl"); //$NON-NLS-1$ 164 dlg.cbM01Kennung.addItem("VQ(6)+LFl"); //$NON-NLS-1$ 165 break; 166 167 case SeaMark.CARD_WEST: 168 dlg.cbM01Kennung.addItem("Q(9)"); //$NON-NLS-1$ 169 dlg.cbM01Kennung.addItem("VQ(9)"); //$NON-NLS-1$ 170 break; 171 172 default: 173 } 174 175 } 176 177 public boolean isValid() { 178 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 179 } 180 181 public void paintSign() { 182 if (dlg.paintlock) 183 return; 184 super.paintSign(); 185 186 dlg.sM01StatusBar.setText(getErrMsg()); 187 188 if (isValid()) { 189 dlg.tfM01Name.setEnabled(true); 190 dlg.tfM01Name.setText(getName()); 191 dlg.cM01TopMark.setSelected(true); 192 dlg.cM01TopMark.setVisible(true); 193 dlg.cM01TopMark.setEnabled(false); 194 dlg.cM01Radar.setVisible(true); 195 dlg.cM01Racon.setVisible(true); 196 dlg.cM01Fog.setVisible(true); 197 dlg.cM01Fired.setEnabled(true); 198 dlg.cM01Fired.setVisible(true); 199 dlg.cbM01Colour.setVisible(false); 200 dlg.lM01Colour.setVisible(false); 201 dlg.rbM01Fired1.setVisible(false); 202 dlg.rbM01FiredN.setVisible(false); 203 dlg.lM01Height.setVisible(false); 204 dlg.tfM01Height.setVisible(false); 205 dlg.lM01Range.setVisible(false); 206 dlg.tfM01Range.setVisible(false); 207 208 if (isFired()) { 209 switch (getStyleIndex()) { 210 case LAT_BEACON: 211 case LAT_TOWER: 212 dlg.rbM01Fired1.setVisible(true); 213 dlg.rbM01FiredN.setVisible(true); 214 dlg.lM01Height.setVisible(true); 215 dlg.tfM01Height.setVisible(true); 216 dlg.lM01Range.setVisible(true); 217 dlg.tfM01Range.setVisible(true); 218 break; 219 case LAT_FLOAT: 220 dlg.lM01Height.setVisible(true); 221 dlg.tfM01Height.setVisible(true); 222 dlg.lM01Range.setVisible(true); 223 dlg.tfM01Range.setVisible(true); 224 break; 225 default: 226 } 227 } 228 String image = "/images/Cardinal"; //$NON-NLS-1$ 229 230 switch (getStyleIndex()) { 231 case SeaMark.CARD_PILLAR: 232 image += "_Pillar"; //$NON-NLS-1$ 233 break; 234 235 case SeaMark.CARD_SPAR: 236 image += "_Spar"; //$NON-NLS-1$ 237 break; 238 239 case SeaMark.CARD_BEACON: 240 image += "_Beacon"; //$NON-NLS-1$ 241 break; 242 243 case SeaMark.CARD_TOWER: 244 image += "_Tower"; //$NON-NLS-1$ 245 break; 246 247 case SeaMark.CARD_FLOAT: 248 image += "_Float"; //$NON-NLS-1$ 249 break; 250 251 default: 252 return; 253 } 254 255 switch (getBuoyIndex()) { 256 case CARD_NORTH: 257 image += "_North"; //$NON-NLS-1$ 258 break; 259 case CARD_EAST: 260 image += "_East"; //$NON-NLS-1$ 261 break; 262 case CARD_SOUTH: 263 image += "_South"; //$NON-NLS-1$ 264 break; 265 case CARD_WEST: 266 image += "_West"; //$NON-NLS-1$ 267 break; 268 default: 269 return; 270 } 271 272 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 273 image += ".png"; //$NON-NLS-1$ 274 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 275 276 } else 277 dlg.lM01Icon.setIcon(null); 278 } 279 } 280 281 public void setLightColour() { 282 super.setLightColour("W"); //$NON-NLS-1$ 283 } 284 285 public void saveSign() { 286 Node node = getNode(); 287 if (node == null) { 288 return; 289 } 290 291 String shape = ""; //$NON-NLS-1$ 292 293 switch (getStyleIndex()) { 294 case CARD_PILLAR: 295 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 296 Main.main.undoRedo.add(new ChangePropertyCommand(node, 297 "seamark:buoy_cardinal:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 298 break; 299 case CARD_SPAR: 300 super.saveSign("buoy_cardinal"); //$NON-NLS-1$ 301 Main.main.undoRedo.add(new ChangePropertyCommand(node, 302 "seamark:buoy_cardinal:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 303 break; 304 case CARD_BEACON: 305 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 306 break; 307 case CARD_TOWER: 308 super.saveSign("beacon_cardinal"); //$NON-NLS-1$ 309 Main.main.undoRedo.add(new ChangePropertyCommand(node, 310 "seamark:beacon_cardinal:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 311 break; 312 case CARD_FLOAT: 313 super.saveSign("light_float"); //$NON-NLS-1$ 314 break; 315 default: 316 } 317 318 switch (getStyleIndex()) { 319 case CARD_PILLAR: 320 case CARD_SPAR: 321 switch (getBuoyIndex()) { 322 case SeaMark.CARD_NORTH: 323 Main.main.undoRedo.add(new ChangePropertyCommand(node, 324 "seamark:buoy_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 325 Main.main.undoRedo.add(new ChangePropertyCommand(node, 326 "seamark:buoy_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 327 shape = "2 cones up"; //$NON-NLS-1$ 328 break; 329 330 case SeaMark.CARD_EAST: 331 Main.main.undoRedo.add(new ChangePropertyCommand(node, 332 "seamark:buoy_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 333 Main.main.undoRedo.add(new ChangePropertyCommand(node, 334 "seamark:buoy_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 335 shape = "2 cones base together"; //$NON-NLS-1$ 336 break; 337 338 case SeaMark.CARD_SOUTH: 339 Main.main.undoRedo.add(new ChangePropertyCommand(node, 340 "seamark:buoy_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 341 Main.main.undoRedo.add(new ChangePropertyCommand(node, 342 "seamark:buoy_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 343 shape = "2 cones down"; //$NON-NLS-1$ 344 break; 345 346 case SeaMark.CARD_WEST: 347 Main.main.undoRedo.add(new ChangePropertyCommand(node, 348 "seamark:buoy_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 349 Main.main.undoRedo.add(new ChangePropertyCommand(node, 350 "seamark:buoy_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 351 shape = "2 cones point together"; //$NON-NLS-1$ 352 break; 353 } 354 Main.main.undoRedo.add(new ChangePropertyCommand(node, 355 "seamark:buoy_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 356 break; 357 case CARD_BEACON: 358 case CARD_TOWER: 359 switch (getBuoyIndex()) { 360 case SeaMark.CARD_NORTH: 361 Main.main.undoRedo.add(new ChangePropertyCommand(node, 362 "seamark:beacon_cardinal:category", "north")); //$NON-NLS-1$ //$NON-NLS-2$ 363 Main.main.undoRedo.add(new ChangePropertyCommand(node, 364 "seamark:beacon_cardinal:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 365 shape = "2 cones up"; //$NON-NLS-1$ 366 break; 367 368 case SeaMark.CARD_EAST: 369 Main.main.undoRedo.add(new ChangePropertyCommand(node, 370 "seamark:beacon_cardinal:category", "east")); //$NON-NLS-1$ //$NON-NLS-2$ 371 Main.main.undoRedo.add(new ChangePropertyCommand(node, 372 "seamark:beacon_cardinal:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 373 shape = "2 cones base together"; //$NON-NLS-1$ 374 break; 375 376 case SeaMark.CARD_SOUTH: 377 Main.main.undoRedo.add(new ChangePropertyCommand(node, 378 "seamark:beacon_cardinal:category", "south")); //$NON-NLS-1$ //$NON-NLS-2$ 379 Main.main.undoRedo.add(new ChangePropertyCommand(node, 380 "seamark:beacon_cardinal:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 381 shape = "2 cones down"; //$NON-NLS-1$ 382 break; 383 384 case SeaMark.CARD_WEST: 385 Main.main.undoRedo.add(new ChangePropertyCommand(node, 386 "seamark:beacon_cardinal:category", "west")); //$NON-NLS-1$ //$NON-NLS-2$ 387 Main.main.undoRedo.add(new ChangePropertyCommand(node, 388 "seamark:beacon_cardinal:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 389 shape = "2 cones point together"; //$NON-NLS-1$ 390 break; 391 } 392 Main.main.undoRedo.add(new ChangePropertyCommand(node, 393 "seamark:beacon_cardinal:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 394 break; 395 case CARD_FLOAT: 396 switch (getBuoyIndex()) { 397 case SeaMark.CARD_NORTH: 398 Main.main.undoRedo.add(new ChangePropertyCommand(node, 399 "seamark:light_float:colour", "black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 400 shape = "2 cones up"; //$NON-NLS-1$ 401 break; 402 403 case SeaMark.CARD_EAST: 404 Main.main.undoRedo.add(new ChangePropertyCommand(node, 405 "seamark:light_float:colour", "black;yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 406 shape = "2 cones base together"; //$NON-NLS-1$ 407 break; 408 409 case SeaMark.CARD_SOUTH: 410 Main.main.undoRedo.add(new ChangePropertyCommand(node, 411 "seamark:light_float:colour", "yellow;black")); //$NON-NLS-1$ //$NON-NLS-2$ 412 shape = "2 cones down"; //$NON-NLS-1$ 413 break; 414 415 case SeaMark.CARD_WEST: 416 Main.main.undoRedo.add(new ChangePropertyCommand(node, 417 "seamark:light_float:colour", "yellow;black;yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 418 shape = "2 cones point together"; //$NON-NLS-1$ 419 break; 420 } 421 Main.main.undoRedo.add(new ChangePropertyCommand(node, 422 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 423 break; 424 } 425 saveTopMarkData(shape, "black"); //$NON-NLS-1$ 426 saveLightData(); //$NON-NLS-1$ 427 saveRadarFogData(); 428 } 429 429 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java
r23179 r23193 17 17 18 18 public class BuoyIsol extends Buoy { 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 19 public BuoyIsol(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(ISOLATED_DANGER); 42 setColour(SeaMark.BLACK_RED_BLACK); 43 setLightColour("W"); //$NON-NLS-1$ 44 setTopMark(true); 45 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 46 47 if (keys.containsKey("name")) //$NON-NLS-1$ 48 setName(keys.get("name")); //$NON-NLS-1$ 49 50 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 51 setName(keys.get("seamark:name")); //$NON-NLS-1$ 52 53 if (keys.containsKey("seamark:buoy_isolated_danger:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:buoy_isolated_danger:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:beacon_isolated_danger:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:beacon_isolated_danger:name")); //$NON-NLS-1$ 57 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 58 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:buoy_isolated_danger:shape")) { //$NON-NLS-1$ 61 str = keys.get("seamark:buoy_isolated_danger:shape"); //$NON-NLS-1$ 62 63 if (str.equals("pillar")) //$NON-NLS-1$ 64 setStyleIndex(ISOL_PILLAR); 65 else if (str.equals("spar")) //$NON-NLS-1$ 66 setStyleIndex(ISOL_SPAR); 67 } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$ 68 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) { //$NON-NLS-1$ 69 str = keys.get("seamark:beacon_isolated_danger:shape"); //$NON-NLS-1$ 70 71 if (str.equals("tower")) //$NON-NLS-1$ 72 setStyleIndex(ISOL_TOWER); 73 else 74 setStyleIndex(ISOL_BEACON); 75 } else 76 setStyleIndex(ISOL_BEACON); 77 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 78 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 79 setStyleIndex(CARD_FLOAT); 80 } 81 82 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 83 setStyleIndex(0); 84 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 85 86 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 87 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 88 setTopMark(true); 89 } 90 91 refreshLights(); 92 parseLights(keys); 93 parseFogRadar(keys); 94 95 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 96 dlg.tfM01Name.setText(getName()); 97 dlg.cM01TopMark.setSelected(hasTopMark()); 98 } 99 100 public void refreshLights() { 101 dlg.cbM01Kennung.removeAllItems(); 102 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 103 dlg.cbM01Kennung.addItem("Fl(2)"); //$NON-NLS-1$ 104 dlg.cbM01Kennung.setSelectedIndex(0); 105 } 106 107 public boolean isValid() { 108 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 109 } 110 111 public void paintSign() { 112 if (dlg.paintlock) 113 return; 114 115 super.paintSign(); 116 117 dlg.sM01StatusBar.setText(getErrMsg()); 118 119 if (isValid()) { 120 dlg.tfM01Name.setEnabled(true); 121 dlg.tfM01Name.setText(getName()); 122 dlg.cM01TopMark.setVisible(true); 123 dlg.cM01Radar.setVisible(true); 124 dlg.cM01Racon.setVisible(true); 125 dlg.cM01Fog.setVisible(true); 126 dlg.cM01Fired.setVisible(true); 127 dlg.cbM01Colour.setVisible(false); 128 dlg.lM01Colour.setVisible(false); 129 dlg.rbM01Fired1.setVisible(false); 130 dlg.rbM01FiredN.setVisible(false); 131 dlg.lM01Height.setVisible(false); 132 dlg.tfM01Height.setVisible(false); 133 dlg.lM01Range.setVisible(false); 134 dlg.tfM01Range.setVisible(false); 135 136 if (isFired()) { 137 switch (getStyleIndex()) { 138 case SPEC_FLOAT: 139 dlg.lM01Height.setVisible(true); 140 dlg.tfM01Height.setVisible(true); 141 dlg.lM01Range.setVisible(true); 142 dlg.tfM01Range.setVisible(true); 143 break; 144 case SPEC_BEACON: 145 case SPEC_TOWER: 146 dlg.rbM01Fired1.setVisible(true); 147 dlg.rbM01FiredN.setVisible(true); 148 dlg.lM01Height.setVisible(true); 149 dlg.tfM01Height.setVisible(true); 150 dlg.lM01Range.setVisible(true); 151 dlg.tfM01Range.setVisible(true); 152 break; 153 default: 154 } 155 } 156 157 String image = "/images/Cardinal"; //$NON-NLS-1$ 158 159 switch (getStyleIndex()) { 160 case ISOL_PILLAR: 161 image += "_Pillar_Single"; //$NON-NLS-1$ 162 break; 163 case ISOL_SPAR: 164 image += "_Spar_Single"; //$NON-NLS-1$ 165 break; 166 case ISOL_BEACON: 167 image += "_Beacon_Single"; //$NON-NLS-1$ 168 break; 169 case ISOL_TOWER: 170 image += "_Tower_Single"; //$NON-NLS-1$ 171 break; 172 case ISOL_FLOAT: 173 image += "_Float_Single"; //$NON-NLS-1$ 174 break; 175 default: 176 } 177 178 if (!image.equals("/images/Cardinal")) { //$NON-NLS-1$ 179 image += ".png"; //$NON-NLS-1$ 180 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 181 } else 182 dlg.lM01Icon.setIcon(null); 183 } else { 184 dlg.tfM01Name.setEnabled(false); 185 dlg.tfM01Name.setText(""); //$NON-NLS-1$ 186 dlg.cM01TopMark.setVisible(false); 187 dlg.cM01Radar.setVisible(false); 188 dlg.cM01Racon.setVisible(false); 189 dlg.cM01Fog.setVisible(false); 190 dlg.cM01Fired.setVisible(false); 191 } 192 } 193 194 public void saveSign() { 195 Node node = getNode(); 196 197 if (node == null) { 198 return; 199 } 200 201 switch (getStyleIndex()) { 202 case ISOL_PILLAR: 203 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 204 Main.main.undoRedo.add(new ChangePropertyCommand(node, 205 "seamark:buoy_isolated_danger:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 206 break; 207 case ISOL_SPAR: 208 super.saveSign("buoy_isolated_danger"); //$NON-NLS-1$ 209 Main.main.undoRedo.add(new ChangePropertyCommand(node, 210 "seamark:buoy_isolated_danger:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 211 break; 212 case ISOL_BEACON: 213 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 214 break; 215 case ISOL_TOWER: 216 super.saveSign("beacon_isolated_danger"); //$NON-NLS-1$ 217 Main.main.undoRedo.add(new ChangePropertyCommand(node, 218 "seamark:beacon_isolated_danger:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 219 break; 220 case ISOL_FLOAT: 221 super.saveSign("light_float"); //$NON-NLS-1$ 222 break; 223 default: 224 } 225 226 switch (getStyleIndex()) { 227 case ISOL_PILLAR: 228 case ISOL_SPAR: 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:buoy_isolated_danger:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 231 Main.main.undoRedo.add(new ChangePropertyCommand(node, 232 "seamark:buoy_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 233 break; 234 case ISOL_BEACON: 235 case ISOL_TOWER: 236 Main.main.undoRedo 237 .add(new ChangePropertyCommand(node, 238 "seamark:beacon_isolated_danger:colour_pattern", //$NON-NLS-1$ 239 "horizontal stripes")); //$NON-NLS-1$ 240 Main.main.undoRedo.add(new ChangePropertyCommand(node, 241 "seamark:beacon_isolated_danger:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 242 break; 243 case ISOL_FLOAT: 244 Main.main.undoRedo.add(new ChangePropertyCommand(node, 245 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 246 Main.main.undoRedo.add(new ChangePropertyCommand(node, 247 "seamark:light_float:colour", "black;red;black")); //$NON-NLS-1$ //$NON-NLS-2$ 248 break; 249 } 250 251 saveTopMarkData("2 spheres", "black"); //$NON-NLS-1$ //$NON-NLS-2$ 252 saveLightData(); //$NON-NLS-1$ 253 saveRadarFogData(); 254 255 } 256 257 public void setLightColour() { 258 super.setLightColour("W"); //$NON-NLS-1$ 259 } 260 260 261 261 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java
r23179 r23193 16 16 17 17 public class BuoyLat extends Buoy { 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 18 public BuoyLat(SmpDialogAction dia, Node node) { 19 super(dia); 20 21 String str; 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 26 resetMask(); 27 28 dlg.cbM01CatOfMark.removeAllItems(); 29 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$ 30 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$ 31 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$ 32 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$ 33 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$ 34 35 dlg.rbM01RegionA.setEnabled(true); 36 dlg.rbM01RegionB.setEnabled(true); 37 dlg.cbM01CatOfMark.setEnabled(true); 38 dlg.cbM01CatOfMark.setVisible(true); 39 dlg.lM01CatOfMark.setVisible(true); 40 41 dlg.cbM01StyleOfMark.removeAllItems(); 42 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 43 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 44 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 45 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 46 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 47 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 48 dlg.cbM01StyleOfMark.setEnabled(true); 49 50 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL); 51 52 if (keys.containsKey("name")) //$NON-NLS-1$ 53 setName(keys.get("name")); //$NON-NLS-1$ 54 55 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:name")); //$NON-NLS-1$ 57 58 if (keys.containsKey("seamark:buoy_lateral:name")) //$NON-NLS-1$ 59 setName(keys.get("seamark:buoy_lateral:name")); //$NON-NLS-1$ 60 else if (keys.containsKey("seamark:beacon_lateral:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:beacon_lateral:name")); //$NON-NLS-1$ 62 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 63 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 64 65 String cat = ""; //$NON-NLS-1$ 66 String col = ""; //$NON-NLS-1$ 67 String top = ""; //$NON-NLS-1$ 68 69 if (getStyleIndex() != LAT_PERCH) { 70 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 71 top = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 72 setTopMark(true); 73 } 74 if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 75 setTopMark(true); 76 } 77 } 78 79 if (keys.containsKey("seamark:buoy_lateral:colour")) //$NON-NLS-1$ 80 col = keys.get("seamark:buoy_lateral:colour"); //$NON-NLS-1$ 81 else if (keys.containsKey("seamark:beacon_lateral:colour")) //$NON-NLS-1$ 82 col = keys.get("seamark:beacon_lateral:colour"); //$NON-NLS-1$ 83 else if (keys.containsKey("seamark:light_float:colour")) //$NON-NLS-1$ 84 col = keys.get("seamark:light_float:colour"); //$NON-NLS-1$ 85 86 if (keys.containsKey("seamark:buoy_lateral:category")) //$NON-NLS-1$ 87 cat = keys.get("seamark:buoy_lateral:category"); //$NON-NLS-1$ 88 else if (keys.containsKey("seamark:beacon_lateral:category")) //$NON-NLS-1$ 89 cat = keys.get("seamark:beacon_lateral:category"); //$NON-NLS-1$ 90 91 if (cat.isEmpty()) { //$NON-NLS-1$ 92 if (col.equals("red")) { //$NON-NLS-1$ 93 setColour(RED); 94 if (top.equals("cylinder")) { //$NON-NLS-1$ 95 setBuoyIndex(PORT_HAND); 96 setRegion(IALA_A); 97 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 98 setBuoyIndex(STARBOARD_HAND); 99 setRegion(IALA_B); 100 } else { 101 if (getRegion() == IALA_A) 102 setBuoyIndex(PORT_HAND); 103 else 104 setBuoyIndex(STARBOARD_HAND); 105 } 106 } else if (col.equals("green")) { //$NON-NLS-1$ 107 setColour(GREEN); 108 if (top.equals("cone, point up")) { //$NON-NLS-1$ 109 setBuoyIndex(STARBOARD_HAND); 110 setRegion(IALA_A); 111 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 112 setBuoyIndex(PORT_HAND); 113 setRegion(IALA_B); 114 } else { 115 if (getRegion() == IALA_A) 116 setBuoyIndex(STARBOARD_HAND); 117 else 118 setBuoyIndex(PORT_HAND); 119 } 120 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 121 setColour(RED_GREEN_RED); 122 if (top.equals("cylinder")) { //$NON-NLS-1$ 123 setBuoyIndex(PREF_PORT_HAND); 124 setRegion(IALA_A); 125 } else if (top.equals("cone, point up")) { //$NON-NLS-1$ 126 setBuoyIndex(PREF_STARBOARD_HAND); 127 setRegion(IALA_B); 128 } else { 129 if (getRegion() == IALA_A) 130 setBuoyIndex(PREF_PORT_HAND); 131 else 132 setBuoyIndex(PREF_STARBOARD_HAND); 133 } 134 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 135 setColour(GREEN_RED_GREEN); 136 if (top.equals("cone, point up")) { //$NON-NLS-1$ 137 setBuoyIndex(PREF_STARBOARD_HAND); 138 setRegion(IALA_A); 139 } else if (top.equals("cylinder")) { //$NON-NLS-1$ 140 setBuoyIndex(PREF_PORT_HAND); 141 setRegion(IALA_B); 142 } else { 143 if (getRegion() == IALA_A) 144 setBuoyIndex(PREF_STARBOARD_HAND); 145 else 146 setBuoyIndex(PREF_PORT_HAND); 147 } 148 } 149 } else if (cat.equals("port")) { //$NON-NLS-1$ 150 151 setBuoyIndex(PORT_HAND); 152 153 if (col.equals("red")) { //$NON-NLS-1$ 154 setRegion(IALA_A); 155 setColour(RED); 156 } else if (col.equals("green")) { //$NON-NLS-1$ 157 setRegion(IALA_B); 158 setColour(GREEN); 159 } else { 160 if (getRegion() == IALA_A) 161 setColour(RED); 162 else 163 setColour(GREEN); 164 } 165 } else if (cat.equals("starboard")) { //$NON-NLS-1$ 166 167 setBuoyIndex(STARBOARD_HAND); 168 169 if (col.equals("green")) { //$NON-NLS-1$ 170 setRegion(IALA_A); 171 setColour(GREEN); 172 } else if (col.equals("red")) { //$NON-NLS-1$ 173 setRegion(IALA_B); 174 setColour(RED); 175 } else { 176 if (getRegion() == IALA_A) 177 setColour(GREEN); 178 else 179 setColour(RED); 180 } 181 } else if (cat.equals("preferred_channel_port")) { //$NON-NLS-1$ 182 183 setBuoyIndex(PREF_PORT_HAND); 184 185 if (col.equals("red;green;red")) { //$NON-NLS-1$ 186 setRegion(IALA_A); 187 setColour(RED_GREEN_RED); 188 } else if (col.equals("green;red;green")) { //$NON-NLS-1$ 189 setRegion(IALA_B); 190 setColour(GREEN_RED_GREEN); 191 } else { 192 if (getRegion() == IALA_A) 193 setColour(RED_GREEN_RED); 194 else 195 setColour(GREEN_RED_GREEN); 196 } 197 198 } else if (cat.equals("preferred_channel_starboard")) { //$NON-NLS-1$ 199 200 setBuoyIndex(PREF_STARBOARD_HAND); 201 202 if (col.equals("green;red;green")) { //$NON-NLS-1$ 203 setRegion(IALA_A); 204 setColour(GREEN_RED_GREEN); 205 } else if (col.equals("red;green;red")) { //$NON-NLS-1$ 206 setRegion(IALA_B); 207 setColour(RED_GREEN_RED); 208 } else { 209 if (getRegion() == IALA_A) 210 setColour(GREEN_RED_GREEN); 211 else 212 setColour(RED_GREEN_RED); 213 } 214 } 215 216 if (keys.containsKey("seamark:buoy_lateral:shape")) { //$NON-NLS-1$ 217 str = keys.get("seamark:buoy_lateral:shape"); //$NON-NLS-1$ 218 219 switch (getBuoyIndex()) { 220 case PORT_HAND: 221 if (str.equals("can")) //$NON-NLS-1$ 222 setStyleIndex(LAT_CAN); 223 else if (str.equals("pillar")) //$NON-NLS-1$ 224 setStyleIndex(LAT_PILLAR); 225 else if (str.equals("spar")) //$NON-NLS-1$ 226 setStyleIndex(LAT_SPAR); 227 break; 228 229 case PREF_PORT_HAND: 230 if (str.equals("can")) //$NON-NLS-1$ 231 setStyleIndex(LAT_CAN); 232 else if (str.equals("pillar")) //$NON-NLS-1$ 233 setStyleIndex(LAT_PILLAR); 234 else if (str.equals("spar")) //$NON-NLS-1$ 235 setStyleIndex(LAT_SPAR); 236 break; 237 238 case STARBOARD_HAND: 239 if (str.equals("conical")) //$NON-NLS-1$ 240 setStyleIndex(LAT_CONE); 241 else if (str.equals("pillar")) //$NON-NLS-1$ 242 setStyleIndex(LAT_PILLAR); 243 else if (str.equals("spar")) //$NON-NLS-1$ 244 setStyleIndex(LAT_SPAR); 245 break; 246 247 case PREF_STARBOARD_HAND: 248 if (str.equals("conical")) //$NON-NLS-1$ 249 setStyleIndex(LAT_CONE); 250 else if (str.equals("pillar")) //$NON-NLS-1$ 251 setStyleIndex(LAT_PILLAR); 252 else if (str.equals("spar")) //$NON-NLS-1$ 253 setStyleIndex(LAT_SPAR); 254 break; 255 } 256 } else if (keys.containsKey("seamark:beacon_lateral:shape")) { //$NON-NLS-1$ 257 str = keys.get("seamark:beacon_lateral:shape"); //$NON-NLS-1$ 258 if (str.equals("tower")) //$NON-NLS-1$ 259 setStyleIndex(LAT_TOWER); 260 else if (str.equals("perch")) //$NON-NLS-1$ 261 setStyleIndex(LAT_PERCH); 262 else 263 setStyleIndex(LAT_BEACON); 264 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 265 && (keys.get("seamark:type").equals("beacon_lateral"))) { //$NON-NLS-1$ //$NON-NLS-2$ 266 setStyleIndex(LAT_BEACON); 267 } else if (keys.containsKey("seamark:type") //$NON-NLS-1$ 268 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 269 setStyleIndex(LAT_FLOAT); 270 } 271 272 refreshStyles(); 273 refreshLights(); 274 setLightColour(); 275 parseLights(keys); 276 parseFogRadar(keys); 277 278 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 279 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 280 dlg.tfM01Name.setText(getName()); 281 dlg.cM01TopMark.setSelected(hasTopMark()); 282 } 283 284 public void refreshStyles() { 285 int type = getBuoyIndex(); 286 int style = getStyleIndex(); 287 288 dlg.cbM01StyleOfMark.removeAllItems(); 289 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.213")); //$NON-NLS-1$ 290 291 switch (type) { 292 case PORT_HAND: 293 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 294 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 295 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 296 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 297 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 298 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 299 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 300 break; 301 302 case STARBOARD_HAND: 303 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 304 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 305 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 306 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 307 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 308 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 309 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.10")); //$NON-NLS-1$ 310 break; 311 312 case PREF_PORT_HAND: 313 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 314 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 315 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 316 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 317 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 318 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 319 break; 320 321 case PREF_STARBOARD_HAND: 322 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 323 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 324 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 325 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 326 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 327 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 328 break; 329 330 default: 331 } 332 333 if (style >= dlg.cbM01StyleOfMark.getItemCount()) 334 style = 0; 335 setStyleIndex(style); 336 dlg.cbM01StyleOfMark.setSelectedIndex(style); 337 dlg.cbM01StyleOfMark.setVisible(true); 338 dlg.lM01StyleOfMark.setVisible(true); 339 } 340 341 public boolean isValid() { 342 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 343 } 344 345 public void paintSign() { 346 if (dlg.paintlock) 347 return; 348 super.paintSign(); 349 350 dlg.sM01StatusBar.setText(getErrMsg()); 351 352 if (isValid()) { 353 dlg.tfM01Name.setEnabled(true); 354 dlg.tfM01Name.setText(getName()); 355 356 int cat = getBuoyIndex(); 357 boolean region = getRegion(); 358 int style = getStyleIndex(); 359 360 if (style == LAT_PERCH) { 361 dlg.cM01TopMark.setVisible(false); 362 dlg.cM01TopMark.setSelected(false); 363 dlg.cM01Radar.setVisible(false); 364 dlg.cM01Racon.setVisible(false); 365 dlg.cM01Fog.setVisible(false); 366 dlg.cM01Fired.setVisible(false); 367 dlg.cM01Fired.setSelected(false); 368 } else { 369 dlg.cM01TopMark.setEnabled(true); 370 dlg.cM01TopMark.setVisible(true); 371 dlg.cM01Radar.setVisible(true); 372 dlg.cM01Racon.setVisible(true); 373 dlg.cM01Fog.setVisible(true); 374 dlg.cM01Fired.setVisible(true); 375 dlg.cM01Fired.setEnabled(true); 376 dlg.cM01TopMark.setEnabled(true); 377 } 378 dlg.cbM01Colour.setVisible(false); 379 dlg.lM01Colour.setVisible(false); 380 dlg.rbM01Fired1.setVisible(false); 381 dlg.rbM01FiredN.setVisible(false); 382 dlg.lM01Height.setVisible(false); 383 dlg.tfM01Height.setVisible(false); 384 dlg.lM01Range.setVisible(false); 385 dlg.tfM01Range.setVisible(false); 386 387 if (isFired()) { 388 switch (style) { 389 case LAT_BEACON: 390 case LAT_TOWER: 391 dlg.rbM01Fired1.setVisible(true); 392 dlg.rbM01FiredN.setVisible(true); 393 dlg.lM01Height.setVisible(true); 394 dlg.tfM01Height.setVisible(true); 395 dlg.lM01Range.setVisible(true); 396 dlg.tfM01Range.setVisible(true); 397 break; 398 case LAT_FLOAT: 399 dlg.lM01Height.setVisible(true); 400 dlg.tfM01Height.setVisible(true); 401 dlg.lM01Range.setVisible(true); 402 dlg.tfM01Range.setVisible(true); 403 break; 404 default: 405 } 406 } 407 String image = "/images/Lateral"; //$NON-NLS-1$ 408 409 switch (getBuoyIndex()) { 410 case PORT_HAND: 411 if (region == IALA_A) 412 switch (style) { 413 case LAT_CAN: 414 image += "_Can_Red"; //$NON-NLS-1$ 415 break; 416 case LAT_PILLAR: 417 image += "_Pillar_Red"; //$NON-NLS-1$ 418 break; 419 case LAT_SPAR: 420 image += "_Spar_Red"; //$NON-NLS-1$ 421 break; 422 case LAT_BEACON: 423 image += "_Beacon_Red"; //$NON-NLS-1$ 424 break; 425 case LAT_TOWER: 426 image += "_Tower_Red"; //$NON-NLS-1$ 427 break; 428 case LAT_FLOAT: 429 image += "_Float_Red"; //$NON-NLS-1$ 430 break; 431 case LAT_PERCH: 432 image += "_Perch_Port"; //$NON-NLS-1$ 433 break; 434 default: 435 } 436 else 437 switch (style) { 438 case LAT_CAN: 439 image += "_Can_Green"; //$NON-NLS-1$ 440 break; 441 case LAT_PILLAR: 442 image += "_Pillar_Green"; //$NON-NLS-1$ 443 break; 444 case LAT_SPAR: 445 image += "_Spar_Green"; //$NON-NLS-1$ 446 break; 447 case LAT_BEACON: 448 image += "_Beacon_Green"; //$NON-NLS-1$ 449 break; 450 case LAT_TOWER: 451 image += "_Tower_Green"; //$NON-NLS-1$ 452 break; 453 case LAT_FLOAT: 454 image += "_Float_Green"; //$NON-NLS-1$ 455 break; 456 case LAT_PERCH: 457 image += "_Perch_Port"; //$NON-NLS-1$ 458 break; 459 default: 460 } 461 break; 462 463 case STARBOARD_HAND: 464 if (region == IALA_A) 465 switch (style) { 466 case LAT_CONE: 467 image += "_Cone_Green"; //$NON-NLS-1$ 468 break; 469 case LAT_PILLAR: 470 image += "_Pillar_Green"; //$NON-NLS-1$ 471 break; 472 case LAT_SPAR: 473 image += "_Spar_Green"; //$NON-NLS-1$ 474 break; 475 case LAT_BEACON: 476 image += "_Beacon_Green"; //$NON-NLS-1$ 477 break; 478 case LAT_TOWER: 479 image += "_Tower_Green"; //$NON-NLS-1$ 480 break; 481 case LAT_FLOAT: 482 image += "_Float_Green"; //$NON-NLS-1$ 483 break; 484 case LAT_PERCH: 485 image += "_Perch_Starboard"; //$NON-NLS-1$ 486 break; 487 default: 488 } 489 else 490 switch (style) { 491 case LAT_CONE: 492 image += "_Cone_Red"; //$NON-NLS-1$ 493 break; 494 case LAT_PILLAR: 495 image += "_Pillar_Red"; //$NON-NLS-1$ 496 break; 497 case LAT_SPAR: 498 image += "_Spar_Red"; //$NON-NLS-1$ 499 break; 500 case LAT_BEACON: 501 image += "_Beacon_Red"; //$NON-NLS-1$ 502 break; 503 case LAT_TOWER: 504 image += "_Tower_Red"; //$NON-NLS-1$ 505 break; 506 case LAT_FLOAT: 507 image += "_Float_Red"; //$NON-NLS-1$ 508 break; 509 case LAT_PERCH: 510 image += "_Perch_Starboard"; //$NON-NLS-1$ 511 break; 512 default: 513 } 514 break; 515 516 case PREF_PORT_HAND: 517 if (region == IALA_A) 518 switch (style) { 519 case LAT_CAN: 520 image += "_Can_Red_Green_Red"; //$NON-NLS-1$ 521 break; 522 case LAT_PILLAR: 523 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 524 break; 525 case LAT_SPAR: 526 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 527 break; 528 case LAT_BEACON: 529 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 530 break; 531 case LAT_TOWER: 532 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 533 break; 534 case LAT_FLOAT: 535 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 536 break; 537 default: 538 } 539 else 540 switch (style) { 541 case LAT_CAN: 542 image += "_Can_Green_Red_Green"; //$NON-NLS-1$ 543 break; 544 case LAT_PILLAR: 545 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 546 break; 547 case LAT_SPAR: 548 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 549 break; 550 case LAT_BEACON: 551 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 552 break; 553 case LAT_TOWER: 554 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 555 break; 556 case LAT_FLOAT: 557 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 558 break; 559 default: 560 } 561 break; 562 563 case PREF_STARBOARD_HAND: 564 if (region == IALA_A) 565 switch (style) { 566 case LAT_CONE: 567 image += "_Cone_Green_Red_Green"; //$NON-NLS-1$ 568 break; 569 case LAT_PILLAR: 570 image += "_Pillar_Green_Red_Green"; //$NON-NLS-1$ 571 break; 572 case LAT_SPAR: 573 image += "_Spar_Green_Red_Green"; //$NON-NLS-1$ 574 break; 575 case LAT_BEACON: 576 image += "_Beacon_Green_Red_Green"; //$NON-NLS-1$ 577 break; 578 case LAT_TOWER: 579 image += "_Tower_Green_Red_Green"; //$NON-NLS-1$ 580 break; 581 case LAT_FLOAT: 582 image += "_Float_Green_Red_Green"; //$NON-NLS-1$ 583 break; 584 default: 585 } 586 else 587 switch (style) { 588 case LAT_CONE: 589 image += "_Cone_Red_Green_Red"; //$NON-NLS-1$ 590 break; 591 case LAT_PILLAR: 592 image += "_Pillar_Red_Green_Red"; //$NON-NLS-1$ 593 break; 594 case LAT_SPAR: 595 image += "_Spar_Red_Green_Red"; //$NON-NLS-1$ 596 break; 597 case LAT_BEACON: 598 image += "_Beacon_Red_Green_Red"; //$NON-NLS-1$ 599 break; 600 case LAT_TOWER: 601 image += "_Tower_Red_Green_Red"; //$NON-NLS-1$ 602 break; 603 case LAT_FLOAT: 604 image += "_Float_Red_Green_Red"; //$NON-NLS-1$ 605 break; 606 default: 607 } 608 break; 609 610 default: 611 } 612 613 if (!image.equals("/images/Lateral")) { //$NON-NLS-1$ 614 615 if (hasTopMark()) { 616 if (cat == PORT_HAND || cat == PREF_PORT_HAND) 617 image += "_Can"; //$NON-NLS-1$ 618 else 619 image += "_Cone"; //$NON-NLS-1$ 620 } 621 image += ".png"; //$NON-NLS-1$ 622 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 623 624 if (hasRadar()) { 625 dlg.lM03Icon.setIcon(new ImageIcon(getClass().getResource( 626 "/images/Radar_Reflector.png"))); //$NON-NLS-1$ 627 } 628 629 } else 630 dlg.lM01Icon.setIcon(null); 631 } 632 } 633 634 public void saveSign() { 635 Node node = getNode(); 636 637 if (node == null) { 638 return; 639 } 640 641 int cat = getBuoyIndex(); 642 String shape = ""; //$NON-NLS-1$ 643 String colour = ""; //$NON-NLS-1$ 644 645 switch (cat) { 646 647 case PORT_HAND: 648 switch (getStyleIndex()) { 649 case LAT_CAN: 650 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 651 Main.main.undoRedo.add(new ChangePropertyCommand(node, 652 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 653 break; 654 case LAT_PILLAR: 655 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 656 Main.main.undoRedo.add(new ChangePropertyCommand(node, 657 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 658 break; 659 case LAT_SPAR: 660 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 661 Main.main.undoRedo.add(new ChangePropertyCommand(node, 662 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 663 break; 664 case LAT_BEACON: 665 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 666 break; 667 case LAT_TOWER: 668 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 669 Main.main.undoRedo.add(new ChangePropertyCommand(node, 670 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 671 break; 672 case LAT_FLOAT: 673 super.saveSign("light_float"); //$NON-NLS-1$ 674 break; 675 case LAT_PERCH: 676 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 677 Main.main.undoRedo.add(new ChangePropertyCommand(node, 678 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 679 break; 680 default: 681 } 682 switch (getStyleIndex()) { 683 case LAT_CAN: 684 case LAT_PILLAR: 685 case LAT_SPAR: 686 Main.main.undoRedo.add(new ChangePropertyCommand(node, 687 "seamark:buoy_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 688 if (getRegion() == IALA_A) { 689 Main.main.undoRedo.add(new ChangePropertyCommand(node, 690 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 691 colour = "red"; //$NON-NLS-1$ 692 } else { 693 Main.main.undoRedo.add(new ChangePropertyCommand(node, 694 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 695 colour = "green"; //$NON-NLS-1$ 696 } 697 break; 698 case LAT_PERCH: 699 Main.main.undoRedo.add(new ChangePropertyCommand(node, 700 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 701 break; 702 case LAT_BEACON: 703 case LAT_TOWER: 704 Main.main.undoRedo.add(new ChangePropertyCommand(node, 705 "seamark:beacon_lateral:category", "port")); //$NON-NLS-1$ //$NON-NLS-2$ 706 if (getRegion() == IALA_A) { 707 Main.main.undoRedo.add(new ChangePropertyCommand(node, 708 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 709 colour = "red"; //$NON-NLS-1$ 710 } else { 711 Main.main.undoRedo.add(new ChangePropertyCommand(node, 712 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 713 colour = "green"; //$NON-NLS-1$ 714 } 715 break; 716 case LAT_FLOAT: 717 if (getRegion() == IALA_A) { 718 Main.main.undoRedo.add(new ChangePropertyCommand(node, 719 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 720 colour = "red"; //$NON-NLS-1$ 721 } else { 722 Main.main.undoRedo.add(new ChangePropertyCommand(node, 723 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 724 colour = "green"; //$NON-NLS-1$ 725 } 726 break; 727 } 728 shape = "cylinder"; //$NON-NLS-1$ 729 break; 730 731 case PREF_PORT_HAND: 732 switch (getStyleIndex()) { 733 case LAT_CAN: 734 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 735 Main.main.undoRedo.add(new ChangePropertyCommand(node, 736 "seamark:buoy_lateral:shape", "can")); //$NON-NLS-1$ //$NON-NLS-2$ 737 break; 738 case LAT_PILLAR: 739 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 740 Main.main.undoRedo.add(new ChangePropertyCommand(node, 741 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 742 break; 743 case LAT_SPAR: 744 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 745 Main.main.undoRedo.add(new ChangePropertyCommand(node, 746 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 747 break; 748 case LAT_BEACON: 749 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 750 break; 751 case LAT_TOWER: 752 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 753 Main.main.undoRedo.add(new ChangePropertyCommand(node, 754 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 755 break; 756 case LAT_FLOAT: 757 super.saveSign("light_float"); //$NON-NLS-1$ 758 break; 759 default: 760 } 761 switch (getStyleIndex()) { 762 case LAT_CAN: 763 case LAT_PILLAR: 764 case LAT_SPAR: 765 Main.main.undoRedo.add(new ChangePropertyCommand(node, 766 "seamark:buoy_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 767 Main.main.undoRedo.add(new ChangePropertyCommand(node, 768 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 769 if (getRegion() == IALA_A) { 770 Main.main.undoRedo.add(new ChangePropertyCommand(node, 771 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 772 colour = "red"; //$NON-NLS-1$ 773 } else { 774 Main.main.undoRedo.add(new ChangePropertyCommand(node, 775 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 776 colour = "green"; //$NON-NLS-1$ 777 } 778 break; 779 case LAT_BEACON: 780 case LAT_TOWER: 781 Main.main.undoRedo.add(new ChangePropertyCommand(node, 782 "seamark:beacon_lateral:category", "preferred_channel_port")); //$NON-NLS-1$ //$NON-NLS-2$ 783 Main.main.undoRedo.add(new ChangePropertyCommand(node, 784 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 785 if (getRegion() == IALA_A) { 786 Main.main.undoRedo.add(new ChangePropertyCommand(node, 787 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 788 colour = "red"; //$NON-NLS-1$ 789 } else { 790 Main.main.undoRedo.add(new ChangePropertyCommand(node, 791 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 792 colour = "green"; //$NON-NLS-1$ 793 } 794 break; 795 case LAT_FLOAT: 796 Main.main.undoRedo.add(new ChangePropertyCommand(node, 797 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 798 if (getRegion() == IALA_A) { 799 Main.main.undoRedo.add(new ChangePropertyCommand(node, 800 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 801 colour = "red"; //$NON-NLS-1$ 802 } else { 803 Main.main.undoRedo.add(new ChangePropertyCommand(node, 804 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 805 colour = "green"; //$NON-NLS-1$ 806 } 807 break; 808 } 809 shape = "cylinder"; //$NON-NLS-1$ 810 break; 811 812 case STARBOARD_HAND: 813 switch (getStyleIndex()) { 814 case LAT_CONE: 815 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 816 Main.main.undoRedo.add(new ChangePropertyCommand(node, 817 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 818 break; 819 case LAT_PILLAR: 820 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 821 Main.main.undoRedo.add(new ChangePropertyCommand(node, 822 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 823 break; 824 case LAT_SPAR: 825 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 826 Main.main.undoRedo.add(new ChangePropertyCommand(node, 827 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 828 break; 829 case LAT_BEACON: 830 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 831 Main.main.undoRedo.add(new ChangePropertyCommand(node, 832 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 833 break; 834 case LAT_TOWER: 835 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 836 Main.main.undoRedo.add(new ChangePropertyCommand(node, 837 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 838 break; 839 case LAT_FLOAT: 840 super.saveSign("light_float"); //$NON-NLS-1$ 841 break; 842 case LAT_PERCH: 843 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 844 Main.main.undoRedo.add(new ChangePropertyCommand(node, 845 "seamark:beacon_lateral:shape", "perch")); //$NON-NLS-1$ //$NON-NLS-2$ 846 break; 847 default: 848 } 849 switch (getStyleIndex()) { 850 case LAT_CAN: 851 case LAT_PILLAR: 852 case LAT_SPAR: 853 Main.main.undoRedo.add(new ChangePropertyCommand(node, 854 "seamark:buoy_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 855 if (getRegion() == IALA_A) { 856 Main.main.undoRedo.add(new ChangePropertyCommand(node, 857 "seamark:buoy_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 858 colour = "green"; //$NON-NLS-1$ 859 } else { 860 Main.main.undoRedo.add(new ChangePropertyCommand(node, 861 "seamark:buoy_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 862 colour = "red"; //$NON-NLS-1$ 863 } 864 break; 865 case LAT_BEACON: 866 case LAT_TOWER: 867 Main.main.undoRedo.add(new ChangePropertyCommand(node, 868 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 869 if (getRegion() == IALA_A) { 870 Main.main.undoRedo.add(new ChangePropertyCommand(node, 871 "seamark:beacon_lateral:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 872 colour = "green"; //$NON-NLS-1$ 873 } else { 874 Main.main.undoRedo.add(new ChangePropertyCommand(node, 875 "seamark:beacon_lateral:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 876 colour = "red"; //$NON-NLS-1$ 877 } 878 break; 879 case LAT_FLOAT: 880 if (getRegion() == IALA_A) { 881 Main.main.undoRedo.add(new ChangePropertyCommand(node, 882 "seamark:light_float:colour", "green")); //$NON-NLS-1$ //$NON-NLS-2$ 883 colour = "green"; //$NON-NLS-1$ 884 } else { 885 Main.main.undoRedo.add(new ChangePropertyCommand(node, 886 "seamark:light_float:colour", "red")); //$NON-NLS-1$ //$NON-NLS-2$ 887 colour = "red"; //$NON-NLS-1$ 888 } 889 break; 890 case LAT_PERCH: 891 Main.main.undoRedo.add(new ChangePropertyCommand(node, 892 "seamark:beacon_lateral:category", "starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 893 break; 894 } 895 shape = "cone, point up"; //$NON-NLS-1$ 896 break; 897 898 case PREF_STARBOARD_HAND: 899 switch (getStyleIndex()) { 900 case LAT_CONE: 901 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 902 Main.main.undoRedo.add(new ChangePropertyCommand(node, 903 "seamark:buoy_lateral:shape", "conical")); //$NON-NLS-1$ //$NON-NLS-2$ 904 break; 905 case LAT_PILLAR: 906 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 907 Main.main.undoRedo.add(new ChangePropertyCommand(node, 908 "seamark:buoy_lateral:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 909 break; 910 case LAT_SPAR: 911 super.saveSign("buoy_lateral"); //$NON-NLS-1$ 912 Main.main.undoRedo.add(new ChangePropertyCommand(node, 913 "seamark:buoy_lateral:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 914 break; 915 case LAT_BEACON: 916 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 917 Main.main.undoRedo.add(new ChangePropertyCommand(node, 918 "seamark:beacon_lateral:shape", "stake")); //$NON-NLS-1$ //$NON-NLS-2$ 919 break; 920 case LAT_TOWER: 921 super.saveSign("beacon_lateral"); //$NON-NLS-1$ 922 Main.main.undoRedo.add(new ChangePropertyCommand(node, 923 "seamark:beacon_lateral:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 924 break; 925 case LAT_FLOAT: 926 super.saveSign("light_float"); //$NON-NLS-1$ 927 break; 928 default: 929 } 930 switch (getStyleIndex()) { 931 case LAT_CAN: 932 case LAT_PILLAR: 933 case LAT_SPAR: 934 Main.main.undoRedo.add(new ChangePropertyCommand(node, 935 "seamark:buoy_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 936 Main.main.undoRedo.add(new ChangePropertyCommand(node, 937 "seamark:buoy_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 938 if (getRegion() == IALA_A) { 939 Main.main.undoRedo.add(new ChangePropertyCommand(node, 940 "seamark:buoy_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 941 colour = "green"; //$NON-NLS-1$ 942 } else { 943 Main.main.undoRedo.add(new ChangePropertyCommand(node, 944 "seamark:buoy_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 945 colour = "red"; //$NON-NLS-1$ 946 } 947 break; 948 case LAT_BEACON: 949 case LAT_TOWER: 950 Main.main.undoRedo.add(new ChangePropertyCommand(node, 951 "seamark:beacon_lateral:category", "preferred_channel_starboard")); //$NON-NLS-1$ //$NON-NLS-2$ 952 Main.main.undoRedo.add(new ChangePropertyCommand(node, 953 "seamark:beacon_lateral:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 954 if (getRegion() == IALA_A) { 955 Main.main.undoRedo.add(new ChangePropertyCommand(node, 956 "seamark:beacon_lateral:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 957 colour = "green"; //$NON-NLS-1$ 958 } else { 959 Main.main.undoRedo.add(new ChangePropertyCommand(node, 960 "seamark:beacon_lateral:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 961 colour = "red"; //$NON-NLS-1$ 962 } 963 break; 964 case LAT_FLOAT: 965 Main.main.undoRedo.add(new ChangePropertyCommand(node, 966 "seamark:light_float:colour_pattern", "horizontal stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 967 if (getRegion() == IALA_A) { 968 Main.main.undoRedo.add(new ChangePropertyCommand(node, 969 "seamark:light_float:colour", "green;red;green")); //$NON-NLS-1$ //$NON-NLS-2$ 970 colour = "green"; //$NON-NLS-1$ 971 } else { 972 Main.main.undoRedo.add(new ChangePropertyCommand(node, 973 "seamark:light_float:colour", "red;green;red")); //$NON-NLS-1$ //$NON-NLS-2$ 974 colour = "red"; //$NON-NLS-1$ 975 } 976 break; 977 } 978 shape = "cone, point up"; //$NON-NLS-1$ 979 break; 980 981 default: 982 } 983 saveTopMarkData(shape, colour); 984 saveLightData(); 985 saveRadarFogData(); 986 987 Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 988 } 989 990 public void setLightColour() { 991 if (getRegion() == IALA_A) { 992 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 993 super.setLightColour("R"); //$NON-NLS-1$ 994 else 995 super.setLightColour("G"); //$NON-NLS-1$ 996 } else { 997 if (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND) 998 super.setLightColour("G"); //$NON-NLS-1$ 999 else 1000 super.setLightColour("R"); //$NON-NLS-1$ 1001 } 1002 } 1003 1004 public void setLightColour(String str) { 1005 int cat = getBuoyIndex(); 1006 1007 if (str == null) { 1008 return; 1009 } 1010 1011 switch (cat) { 1012 case PORT_HAND: 1013 case PREF_PORT_HAND: 1014 if (getRegion() == IALA_A) { 1015 if (str.equals("red")) { //$NON-NLS-1$ 1016 setFired(true); 1017 super.setLightColour("R"); //$NON-NLS-1$ 1018 } else { 1019 super.setLightColour(""); //$NON-NLS-1$ 1020 } 1021 } else { 1022 if (str.equals("green")) { //$NON-NLS-1$ 1023 setFired(true); 1024 super.setLightColour("G"); //$NON-NLS-1$ 1025 } else { 1026 super.setLightColour(""); //$NON-NLS-1$ 1027 } 1028 } 1029 break; 1030 1031 case STARBOARD_HAND: 1032 case PREF_STARBOARD_HAND: 1033 if (getRegion() == IALA_A) { 1034 if (str.equals("green")) { //$NON-NLS-1$ 1035 setFired(true); 1036 super.setLightColour("G"); //$NON-NLS-1$ 1037 } else { 1038 super.setLightColour(""); //$NON-NLS-1$ 1039 } 1040 } else { 1041 if (str.equals("red")) { //$NON-NLS-1$ 1042 setFired(true); 1043 super.setLightColour("R"); //$NON-NLS-1$ 1044 } else { 1045 super.setLightColour(""); //$NON-NLS-1$ 1046 } 1047 } 1048 break; 1049 default: 1050 } 1051 } 1052 1052 1053 1053 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java
r23174 r23193 17 17 18 18 public class BuoyNota extends Buoy { 19 20 19 public BuoyNota(SmpDialogAction dia, Node node) { 20 super(dia); 21 21 22 23 24 22 Map<String, String> keys; 23 keys = node.getKeys(); 24 setNode(node); 25 25 26 26 resetMask(); 27 27 28 28 dlg.cbM01TypeOfMark.setSelectedIndex(LIGHT); 29 29 30 31 32 30 dlg.cbM01CatOfMark.setEnabled(true); 31 dlg.cbM01CatOfMark.setVisible(true); 32 dlg.lM01CatOfMark.setVisible(true); 33 33 34 35 36 37 38 39 34 dlg.cbM01CatOfMark.removeAllItems(); 35 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$ 36 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.206")); //$NON-NLS-1$ 37 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.207")); //$NON-NLS-1$ 38 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.208")); //$NON-NLS-1$ 39 dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.209")); //$NON-NLS-1$ 40 40 41 41 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 42 42 43 44 43 if (keys.containsKey("name")) //$NON-NLS-1$ 44 setName(keys.get("name")); //$NON-NLS-1$ 45 45 46 47 46 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 47 setName(keys.get("seamark:name")); //$NON-NLS-1$ 48 48 49 50 51 52 53 54 55 56 49 if (keys.containsKey("seamark:landmark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:landmark:name")); //$NON-NLS-1$ 51 else if (keys.containsKey("seamark:light_major:name")) //$NON-NLS-1$ 52 setName(keys.get("seamark:light_major:name")); //$NON-NLS-1$ 53 else if (keys.containsKey("seamark:light_minor:name")) //$NON-NLS-1$ 54 setName(keys.get("seamark:light_minor:name")); //$NON-NLS-1$ 55 else if (keys.containsKey("seamark:light_vessel:name")) //$NON-NLS-1$ 56 setName(keys.get("seamark:light_vessel:name")); //$NON-NLS-1$ 57 57 58 59 60 61 62 63 64 65 66 67 68 58 if (keys.containsKey("seamark:type")) { //$NON-NLS-1$ 59 String type = keys.get("seamark:type"); //$NON-NLS-1$ 60 if (type.equals("landmark")) 61 setBuoyIndex(LIGHT_HOUSE); 62 else if (type.equals("light_major")) 63 setBuoyIndex(LIGHT_MAJOR); 64 else if (type.equals("light_minor")) 65 setBuoyIndex(LIGHT_MINOR); 66 else if (type.equals("light_vessel")) 67 setBuoyIndex(LIGHT_VESSEL); 68 } 69 69 70 71 72 73 74 70 refreshLights(); 71 parseLights(keys); 72 parseFogRadar(keys); 73 setTopMark(false); 74 setFired(true); 75 75 76 77 78 79 80 76 dlg.cbM01CatOfMark.setSelectedIndex(getBuoyIndex()); 77 dlg.tfM01Name.setText(getName()); 78 dlg.cM01Fired.setEnabled(false); 79 dlg.cM01Fired.setSelected(true); 80 } 81 81 82 83 84 82 public boolean isValid() { 83 return (getBuoyIndex() > 0); 84 } 85 85 86 87 88 89 86 public void paintSign() { 87 if (dlg.paintlock) 88 return; 89 super.paintSign(); 90 90 91 91 dlg.sM01StatusBar.setText(getErrMsg()); 92 92 93 94 95 96 93 if (isValid()) { 94 dlg.cM01Radar.setVisible(true); 95 dlg.cM01Racon.setVisible(true); 96 dlg.cM01Fog.setVisible(true); 97 97 98 99 100 101 102 103 98 dlg.rbM01Fired1.setVisible(true); 99 dlg.rbM01FiredN.setVisible(true); 100 dlg.lM01Height.setVisible(true); 101 dlg.tfM01Height.setVisible(true); 102 dlg.lM01Range.setVisible(true); 103 dlg.tfM01Range.setVisible(true); 104 104 105 106 107 108 109 105 switch (getBuoyIndex()) { 106 case SeaMark.LIGHT_HOUSE: 107 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 108 "/images/Light_House.png"))); //$NON-NLS-1$ 109 break; 110 110 111 112 113 114 111 case SeaMark.LIGHT_MAJOR: 112 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 113 "/images/Light_Major.png"))); //$NON-NLS-1$ 114 break; 115 115 116 117 118 119 116 case SeaMark.LIGHT_MINOR: 117 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 118 "/images/Light_Minor.png"))); //$NON-NLS-1$ 119 break; 120 120 121 122 123 124 121 case SeaMark.LIGHT_VESSEL: 122 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource( 123 "/images/Major_Float.png"))); //$NON-NLS-1$ 124 break; 125 125 126 127 128 129 126 default: 127 } 128 } 129 } 130 130 131 132 131 public void saveSign() { 132 Node node = getNode(); 133 133 134 135 136 134 if (node == null) { 135 return; 136 } 137 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 138 switch (getBuoyIndex()) { 139 case LIGHT_HOUSE: 140 super.saveSign("landmark"); //$NON-NLS-1$ 141 break; 142 case LIGHT_MAJOR: 143 super.saveSign("light_major"); //$NON-NLS-1$ 144 break; 145 case LIGHT_MINOR: 146 super.saveSign("light_minor"); //$NON-NLS-1$ 147 break; 148 case LIGHT_VESSEL: 149 super.saveSign("light_vessel"); //$NON-NLS-1$ 150 break; 151 default: 152 } 153 saveLightData(); //$NON-NLS-1$ 154 saveRadarFogData(); 155 } 156 156 157 158 157 public void setLightColour() { 158 } 159 159 160 160 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java
r23179 r23193 17 17 18 18 public class BuoySaw extends Buoy { 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 19 public BuoySaw(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.setVisible(true); 39 dlg.lM01StyleOfMark.setVisible(true); 40 41 setBuoyIndex(SAFE_WATER); 42 setColour(SeaMark.RED_WHITE); 43 setLightColour("W"); //$NON-NLS-1$ 44 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 45 46 if (keys.containsKey("name")) //$NON-NLS-1$ 47 setName(keys.get("name")); //$NON-NLS-1$ 48 49 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 50 setName(keys.get("seamark:name")); //$NON-NLS-1$ 51 52 if (keys.containsKey("seamark:buoy_safe_water:name")) //$NON-NLS-1$ 53 setName(keys.get("seamark:buoy_safe_water:name")); //$NON-NLS-1$ 54 else if (keys.containsKey("seamark:beacon_safe_water:name")) //$NON-NLS-1$ 55 setName(keys.get("seamark:beacon_safe_water:name")); //$NON-NLS-1$ 56 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 57 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 58 59 if (keys.containsKey("seamark:buoy_safe_water:shape")) { //$NON-NLS-1$ 60 str = keys.get("seamark:buoy_safe_water:shape"); //$NON-NLS-1$ 61 62 if (str.equals("pillar")) //$NON-NLS-1$ 63 setStyleIndex(SAFE_PILLAR); 64 else if (str.equals("spar")) //$NON-NLS-1$ 65 setStyleIndex(SAFE_SPAR); 66 else if (str.equals("sphere")) //$NON-NLS-1$ 67 setStyleIndex(SAFE_SPHERE); 68 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 69 && (keys.get("seamark:type").equals("light_float"))) { //$NON-NLS-1$ //$NON-NLS-2$ 70 setStyleIndex(SAFE_FLOAT); 71 } else if ((keys.containsKey("seamark:type")) //$NON-NLS-1$ 72 && (keys.get("seamark:type").equals("beacon_safe_water"))) { //$NON-NLS-1$ //$NON-NLS-2$ 73 setStyleIndex(SAFE_BEACON); 74 } 75 76 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 77 setStyleIndex(0); 78 79 if (keys.containsKey("seamark:topmark:shape") //$NON-NLS-1$ 80 || keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$ 81 setTopMark(true); 82 } 83 84 refreshLights(); 85 parseLights(keys); 86 parseFogRadar(keys); 87 88 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 89 dlg.tfM01Name.setText(getName()); 90 dlg.cM01TopMark.setSelected(hasTopMark()); 91 } 92 93 public void refreshLights() { 94 dlg.cbM01Kennung.removeAllItems(); 95 dlg.cbM01Kennung.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 96 dlg.cbM01Kennung.addItem("Iso"); //$NON-NLS-1$ 97 dlg.cbM01Kennung.addItem("Oc"); //$NON-NLS-1$ 98 dlg.cbM01Kennung.addItem("LFl"); //$NON-NLS-1$ 99 dlg.cbM01Kennung.addItem("Mo"); //$NON-NLS-1$ 100 dlg.cbM01Kennung.setSelectedIndex(0); 101 } 102 103 public boolean isValid() { 104 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 105 } 106 107 public void paintSign() { 108 if (dlg.paintlock) 109 return; 110 super.paintSign(); 111 112 dlg.sM01StatusBar.setText(getErrMsg()); 113 114 if (isValid()) { 115 dlg.tfM01Name.setEnabled(true); 116 dlg.tfM01Name.setText(getName()); 117 dlg.cM01TopMark.setEnabled(true); 118 dlg.cM01TopMark.setVisible(true); 119 dlg.cM01Radar.setVisible(true); 120 dlg.cM01Racon.setVisible(true); 121 dlg.cM01Fog.setVisible(true); 122 dlg.cM01Fired.setVisible(true); 123 dlg.cM01Fired.setEnabled(true); 124 dlg.cbM01Colour.setVisible(false); 125 dlg.lM01Colour.setVisible(false); 126 dlg.rbM01Fired1.setVisible(false); 127 dlg.rbM01FiredN.setVisible(false); 128 dlg.lM01Height.setVisible(false); 129 dlg.tfM01Height.setVisible(false); 130 dlg.lM01Range.setVisible(false); 131 dlg.tfM01Range.setVisible(false); 132 133 if (isFired()) { 134 switch (getStyleIndex()) { 135 case SPEC_FLOAT: 136 dlg.lM01Height.setVisible(true); 137 dlg.tfM01Height.setVisible(true); 138 dlg.lM01Range.setVisible(true); 139 dlg.tfM01Range.setVisible(true); 140 break; 141 case SPEC_BEACON: 142 case SPEC_TOWER: 143 dlg.rbM01Fired1.setVisible(true); 144 dlg.rbM01FiredN.setVisible(true); 145 dlg.lM01Height.setVisible(true); 146 dlg.tfM01Height.setVisible(true); 147 dlg.lM01Range.setVisible(true); 148 dlg.tfM01Range.setVisible(true); 149 break; 150 default: 151 } 152 } 153 154 String image = "/images/Safe_Water"; //$NON-NLS-1$ 155 156 switch (getStyleIndex()) { 157 case SAFE_PILLAR: 158 image += "_Pillar"; //$NON-NLS-1$ 159 break; 160 case SAFE_SPAR: 161 image += "_Spar"; //$NON-NLS-1$ 162 break; 163 case SAFE_SPHERE: 164 image += "_Sphere"; //$NON-NLS-1$ 165 break; 166 case SAFE_BEACON: 167 image += "_Beacon"; //$NON-NLS-1$ 168 break; 169 case SAFE_FLOAT: 170 image += "_Float"; //$NON-NLS-1$ 171 break; 172 default: 173 } 174 175 if (!image.equals("/images/Safe_Water")) { //$NON-NLS-1$ 176 if (hasTopMark()) 177 image += "_Sphere"; //$NON-NLS-1$ 178 image += ".png"; //$NON-NLS-1$ 179 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 180 } else 181 dlg.lM01Icon.setIcon(null); 182 } 183 } 184 185 public void saveSign() { 186 Node node = getNode(); 187 188 if (node == null) { 189 return; 190 } 191 192 switch (getStyleIndex()) { 193 case SAFE_PILLAR: 194 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 195 Main.main.undoRedo.add(new ChangePropertyCommand(node, 196 "seamark:buoy_safe_water:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 197 break; 198 case SAFE_SPAR: 199 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 200 Main.main.undoRedo.add(new ChangePropertyCommand(node, 201 "seamark:buoy_safe_water:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 202 break; 203 case SAFE_SPHERE: 204 super.saveSign("buoy_safe_water"); //$NON-NLS-1$ 205 Main.main.undoRedo.add(new ChangePropertyCommand(node, 206 "seamark:buoy_safe_water:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 207 break; 208 case SAFE_BEACON: 209 super.saveSign("beacon_safe_water"); //$NON-NLS-1$ 210 break; 211 case SAFE_FLOAT: 212 super.saveSign("light_float"); //$NON-NLS-1$ 213 break; 214 default: 215 } 216 217 switch (getStyleIndex()) { 218 case SAFE_PILLAR: 219 case SAFE_SPAR: 220 case SAFE_SPHERE: 221 Main.main.undoRedo.add(new ChangePropertyCommand(node, 222 "seamark:buoy_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 223 Main.main.undoRedo.add(new ChangePropertyCommand(node, 224 "seamark:buoy_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 225 break; 226 case SAFE_BEACON: 227 Main.main.undoRedo.add(new ChangePropertyCommand(node, 228 "seamark:beacon_safe_water:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 229 Main.main.undoRedo.add(new ChangePropertyCommand(node, 230 "seamark:beacon_safe_water:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 231 break; 232 case SAFE_FLOAT: 233 Main.main.undoRedo.add(new ChangePropertyCommand(node, 234 "seamark:light_float:colour_pattern", "vertical stripes")); //$NON-NLS-1$ //$NON-NLS-2$ 235 Main.main.undoRedo.add(new ChangePropertyCommand(node, 236 "seamark:light_float:colour", "red;white")); //$NON-NLS-1$ //$NON-NLS-2$ 237 break; 238 default: 239 } 240 saveTopMarkData("spherical", "red"); //$NON-NLS-1$ //$NON-NLS-2$ 241 saveLightData(); //$NON-NLS-1$ 242 saveRadarFogData(); 243 } 244 245 public void setLightColour() { 246 super.setLightColour("W"); //$NON-NLS-1$ 247 } 248 248 249 249 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java
r23179 r23193 17 17 18 18 public class BuoySpec extends Buoy { 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 // 237 // 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 19 public BuoySpec(SmpDialogAction dia, Node node) { 20 super(dia); 21 22 String str; 23 Map<String, String> keys; 24 keys = node.getKeys(); 25 setNode(node); 26 27 resetMask(); 28 29 dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE); 30 31 dlg.cbM01StyleOfMark.removeAllItems(); 32 dlg.cbM01StyleOfMark.addItem(Messages.getString("SmpDialogAction.212")); //$NON-NLS-1$ 33 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.01")); //$NON-NLS-1$ 34 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.02")); //$NON-NLS-1$ 35 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.03")); //$NON-NLS-1$ 36 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.04")); //$NON-NLS-1$ 37 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.05")); //$NON-NLS-1$ 38 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.06")); //$NON-NLS-1$ 39 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$ 40 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.08")); //$NON-NLS-1$ 41 dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.09")); //$NON-NLS-1$ 42 dlg.cbM01StyleOfMark.setVisible(true); 43 dlg.lM01StyleOfMark.setVisible(true); 44 45 dlg.cbM01TopMark.removeAllItems(); 46 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212")); 47 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$ 48 dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$ 49 50 dlg.cM01TopMark.setEnabled(true); 51 52 setBuoyIndex(SPECIAL_PURPOSE); 53 setColour(SeaMark.YELLOW); 54 setLightColour("W"); //$NON-NLS-1$ 55 setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$ 56 57 if (keys.containsKey("name")) //$NON-NLS-1$ 58 setName(keys.get("name")); //$NON-NLS-1$ 59 60 if (keys.containsKey("seamark:name")) //$NON-NLS-1$ 61 setName(keys.get("seamark:name")); //$NON-NLS-1$ 62 63 if (keys.containsKey("seamark:buoy_special_purpose:name")) //$NON-NLS-1$ 64 setName(keys.get("seamark:buoy_special_purpose:name")); //$NON-NLS-1$ 65 else if (keys.containsKey("seamark:beacon_special_purpose:name")) //$NON-NLS-1$ 66 setName(keys.get("seamark:beacon_special_purpose:name")); //$NON-NLS-1$ 67 else if (keys.containsKey("seamark:light_float:name")) //$NON-NLS-1$ 68 setName(keys.get("seamark:light_float:name")); //$NON-NLS-1$ 69 70 if (keys.containsKey("seamark:buoy_special_purpose:shape")) { //$NON-NLS-1$ 71 str = keys.get("seamark:buoy_special_purpose:shape"); //$NON-NLS-1$ 72 73 if (str.equals("pillar")) //$NON-NLS-1$ 74 setStyleIndex(SPEC_PILLAR); 75 else if (str.equals("can")) //$NON-NLS-1$ 76 setStyleIndex(SPEC_CAN); 77 else if (str.equals("conical")) //$NON-NLS-1$ 78 setStyleIndex(SPEC_CONE); 79 else if (str.equals("spar")) //$NON-NLS-1$ 80 setStyleIndex(SPEC_SPAR); 81 else if (str.equals("sphere")) //$NON-NLS-1$ 82 setStyleIndex(SPEC_SPHERE); 83 else if (str.equals("barrel")) //$NON-NLS-1$ 84 setStyleIndex(SPEC_BARREL); 85 } 86 87 if (keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 88 str = keys.get("seamark:beacon_special_purpose:shape"); //$NON-NLS-1$ 89 if (str.equals("tower")) //$NON-NLS-1$ 90 setStyleIndex(SPEC_TOWER); 91 else 92 setStyleIndex(SPEC_BEACON); 93 } 94 95 if (keys.containsKey("seamark:light_float:colour")) { 96 setStyleIndex(SPEC_FLOAT); 97 } 98 99 if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals( //$NON-NLS-1$ //$NON-NLS-2$ 100 "beacon_special_purpose")) //$NON-NLS-1$ 101 || keys.containsKey("seamark:beacon_special_purpose:colour") //$NON-NLS-1$ 102 || keys.containsKey("seamark:beacon_special_purpose:shape")) { //$NON-NLS-1$ 103 if (keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$ 104 && keys.get("seamark:beacon_special_purpose:shape").equals("tower")) //$NON-NLS-1$ //$NON-NLS-2$ 105 setStyleIndex(SPEC_TOWER); 106 else 107 setStyleIndex(SPEC_BEACON); 108 } else if (keys.containsKey("seamark:light_float:colour") //$NON-NLS-1$ 109 && keys.get("seamark:light_float:colour").equals("yellow")) //$NON-NLS-1$ //$NON-NLS-2$ 110 setStyleIndex(SPEC_FLOAT); 111 112 if (getStyleIndex() >= dlg.cbM01StyleOfMark.getItemCount()) 113 setStyleIndex(0); 114 115 keys = node.getKeys(); 116 if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$ 117 str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$ 118 119 if (str.equals("x-shape")) { //$NON-NLS-1$ 120 setTopMark(true); 121 } 122 } 123 124 refreshLights(); 125 parseLights(keys); 126 parseFogRadar(keys); 127 128 dlg.cbM01StyleOfMark.setSelectedIndex(getStyleIndex()); 129 dlg.tfM01Name.setText(getName()); 130 dlg.cM01TopMark.setSelected(hasTopMark()); 131 } 132 133 public void setStyleIndex(int styleIndex) { 134 super.setStyleIndex(styleIndex); 135 if (styleIndex == SPEC_BARREL) { 136 dlg.cM01Fired.setSelected(false); 137 dlg.cM01Fired.setEnabled(false); 138 dlg.cM01TopMark.setEnabled(true); 139 } else { 140 dlg.cM01Fired.setEnabled(true); 141 dlg.cM01TopMark.setEnabled(true); 142 } 143 } 144 145 public boolean isValid() { 146 return (getBuoyIndex() > 0) && (getStyleIndex() > 0); 147 } 148 149 public void paintSign() { 150 if (dlg.paintlock) 151 return; 152 super.paintSign(); 153 154 dlg.sM01StatusBar.setText(getErrMsg()); 155 156 if (isValid()) { 157 dlg.tfM01Name.setEnabled(true); 158 dlg.tfM01Name.setText(getName()); 159 dlg.cM01Radar.setVisible(true); 160 dlg.cM01Racon.setVisible(true); 161 dlg.cM01TopMark.setEnabled(true); 162 dlg.cM01TopMark.setVisible(true); 163 if (hasTopMark()) { 164 dlg.cbM01TopMark.setEnabled(true); 165 dlg.cbM01TopMark.setVisible(true); 166 } else { 167 dlg.cbM01TopMark.setVisible(false); 168 } 169 dlg.cM01Fog.setVisible(true); 170 dlg.cM01Fired.setVisible(true); 171 dlg.cM01Fired.setEnabled(true); 172 dlg.cbM01Colour.setVisible(false); 173 dlg.lM01Colour.setVisible(false); 174 dlg.rbM01Fired1.setVisible(false); 175 dlg.rbM01FiredN.setVisible(false); 176 dlg.lM01Height.setVisible(false); 177 dlg.tfM01Height.setVisible(false); 178 dlg.lM01Range.setVisible(false); 179 dlg.tfM01Range.setVisible(false); 180 181 if (isFired()) { 182 switch (getStyleIndex()) { 183 case SPEC_FLOAT: 184 dlg.lM01Height.setVisible(true); 185 dlg.tfM01Height.setVisible(true); 186 dlg.lM01Range.setVisible(true); 187 dlg.tfM01Range.setVisible(true); 188 break; 189 case SPEC_BEACON: 190 case SPEC_TOWER: 191 dlg.rbM01Fired1.setVisible(true); 192 dlg.rbM01FiredN.setVisible(true); 193 dlg.lM01Height.setVisible(true); 194 dlg.tfM01Height.setVisible(true); 195 dlg.lM01Range.setVisible(true); 196 dlg.tfM01Range.setVisible(true); 197 break; 198 default: 199 } 200 } 201 202 String image = "/images/Special_Purpose"; //$NON-NLS-1$ 203 204 switch (getStyleIndex()) { 205 case SPEC_PILLAR: 206 image += "_Pillar"; //$NON-NLS-1$ 207 break; 208 case SPEC_CAN: 209 image += "_Can"; //$NON-NLS-1$ 210 break; 211 case SPEC_CONE: 212 image += "_Cone"; //$NON-NLS-1$ 213 break; 214 case SPEC_SPAR: 215 image += "_Spar"; //$NON-NLS-1$ 216 break; 217 case SPEC_SPHERE: 218 image += "_Sphere"; //$NON-NLS-1$ 219 break; 220 case SPEC_BARREL: 221 image += "_Barrel"; //$NON-NLS-1$ 222 break; 223 case SPEC_FLOAT: 224 image += "_Float"; //$NON-NLS-1$ 225 break; 226 case SPEC_BEACON: 227 image += "_Beacon"; //$NON-NLS-1$ 228 break; 229 case SPEC_TOWER: 230 image += "_Tower"; //$NON-NLS-1$ 231 break; 232 default: 233 } 234 235 if (!image.equals("/images/Special_Purpose")) { //$NON-NLS-1$ 236 // if (hasTopMark()) 237 // image += "_CrossY"; //$NON-NLS-1$ 238 image += ".png"; //$NON-NLS-1$ 239 dlg.lM01Icon.setIcon(new ImageIcon(getClass().getResource(image))); 240 } else 241 dlg.lM01Icon.setIcon(null); 242 } 243 } 244 245 public void saveSign() { 246 Node node = getNode(); 247 248 if (node == null) { 249 return; 250 } 251 252 switch (getStyleIndex()) { 253 case SPEC_PILLAR: 254 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 255 Main.main.undoRedo.add(new ChangePropertyCommand(node, 256 "seamark:buoy_special_purpose:shape", "pillar")); //$NON-NLS-1$ //$NON-NLS-2$ 257 Main.main.undoRedo.add(new ChangePropertyCommand(node, 258 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 259 break; 260 case SPEC_SPAR: 261 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 262 Main.main.undoRedo.add(new ChangePropertyCommand(node, 263 "seamark:buoy_special_purpose:shape", "spar")); //$NON-NLS-1$ //$NON-NLS-2$ 264 Main.main.undoRedo.add(new ChangePropertyCommand(node, 265 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 266 break; 267 case SPEC_SPHERE: 268 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 269 Main.main.undoRedo.add(new ChangePropertyCommand(node, 270 "seamark:buoy_special_purpose:shape", "sphere")); //$NON-NLS-1$ //$NON-NLS-2$ 271 Main.main.undoRedo.add(new ChangePropertyCommand(node, 272 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 273 break; 274 case SPEC_BARREL: 275 super.saveSign("buoy_special_purpose"); //$NON-NLS-1$ 276 Main.main.undoRedo.add(new ChangePropertyCommand(node, 277 "seamark:buoy_special_purpose:shape", "barrel")); //$NON-NLS-1$ //$NON-NLS-2$ 278 Main.main.undoRedo.add(new ChangePropertyCommand(node, 279 "seamark:buoy_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 280 break; 281 case SPEC_FLOAT: 282 super.saveSign("light_float"); //$NON-NLS-1$ 283 Main.main.undoRedo.add(new ChangePropertyCommand(node, 284 "seamark:light_float:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 285 break; 286 case SPEC_BEACON: 287 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 288 Main.main.undoRedo.add(new ChangePropertyCommand(node, 289 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 290 break; 291 case SPEC_TOWER: 292 super.saveSign("beacon_special_purpose"); //$NON-NLS-1$ 293 Main.main.undoRedo.add(new ChangePropertyCommand(node, 294 "seamark:beacon_special_purpose:shape", "tower")); //$NON-NLS-1$ //$NON-NLS-2$ 295 Main.main.undoRedo.add(new ChangePropertyCommand(node, 296 "seamark:beacon_special_purpose:colour", "yellow")); //$NON-NLS-1$ //$NON-NLS-2$ 297 break; 298 default: 299 } 300 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$ 301 saveLightData(); //$NON-NLS-1$ 302 saveRadarFogData(); 303 } 304 305 public void setLightColour() { 306 super.setLightColour("W"); //$NON-NLS-1$ 307 } 308 308 309 309 } -
applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java
r23047 r23193 11 11 12 12 public class BuoyUkn extends Buoy { 13 14 15 16 17 18 19 20 21 13 public BuoyUkn(SmpDialogAction dia, String Msg) { 14 super(dia); 15 resetMask(); 16 dlg.cbM01TypeOfMark.setSelectedIndex(0); 17 dlg.cbM01CatOfMark.removeAllItems(); 18 dlg.cbM01CatOfMark.setEnabled(false); 19 dlg.tfM01Name.setText(getName()); 20 setErrMsg(Msg); 21 } 22 22 23 24 25 23 public void paintSign() { 24 if (dlg.paintlock) return; 25 super.paintSign(); 26 26 27 28 27 if (getErrMsg() != null) 28 dlg.sM01StatusBar.setText(getErrMsg()); 29 29 30 31 30 setErrMsg(null); 31 } 32 32 33 34 35 33 public void setLightColour() { 34 super.setLightColour(""); 35 } 36 36 37 38 37 public void saveSign() { 38 } 39 39 }
Note:
See TracChangeset
for help on using the changeset viewer.