Changeset 27095 in osm for applications/editors/josm/plugins/smed
- Timestamp:
- 2011-11-20T11:07:30+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r27094 r27095 23 23 } 24 24 25 public static final EnumMap<Reg, String> RegSTR = new EnumMap<Reg, String>(Reg.class); 25 public static final EnumMap<Reg, String> RegSTR = new EnumMap<Reg, String>( 26 Reg.class); 26 27 static { 27 28 RegSTR.put(Reg.A, "iala-a"); … … 31 32 RegSTR.put(Reg.X, "other"); 32 33 } 33 34 34 35 private Reg region = Reg.A; 35 36 … … 53 54 54 55 public enum Obj { 55 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, 56 FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP, LITMAJ, LITMIN, LITFLT, LITVES, 57 LITHSE, LNDMRK, MORFAC, SISTAW, SISTAT 58 } 59 60 public static final EnumMap<Obj, String> ObjSTR = new EnumMap<Obj, String>(Obj.class); 56 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP, LITMAJ, LITMIN, LITFLT, LITVES, LITHSE, LNDMRK, MORFAC, SISTAW, SISTAT 57 } 58 59 public static final EnumMap<Obj, String> ObjSTR = new EnumMap<Obj, String>( 60 Obj.class); 61 61 static { 62 62 ObjSTR.put(Obj.BCNCAR, "beacon_cardinal"); … … 100 100 } 101 101 102 public static final EnumMap<Obj, Ent> EntMAP = new EnumMap<Obj, Ent>(Obj.class); 102 public static final EnumMap<Obj, Ent> EntMAP = new EnumMap<Obj, Ent>( 103 Obj.class); 103 104 static { 104 105 EntMAP.put(Obj.BCNCAR, Ent.BEACON); … … 132 133 } 133 134 134 public static final EnumMap<Obj, Grp> GrpMAP = new EnumMap<Obj, Grp>(Obj.class); 135 public static final EnumMap<Obj, Grp> GrpMAP = new EnumMap<Obj, Grp>( 136 Obj.class); 135 137 static { 136 138 GrpMAP.put(Obj.UNKNOWN, Grp.NUL); … … 162 164 163 165 public enum Cat { 164 NONE, LAM_PORT, LAM_STBD, LAM_PPORT, LAM_PSTBD, CAM_NORTH, CAM_EAST, CAM_SOUTH, CAM_WEST, 165 ACH_URST, ACH_DEEP, ACH_TANK, ACH_EXPL, ACH_QUAR, ACH_SPLN, ACH_SCAN, ACH_SCMO, ACH_T24H, ACH_TLIM, 166 SPM_UNKN, SPM_WARN, SPM_CHBF, SPM_YCHT, SPM_CABL, SPM_OFAL, SPM_ODAS, SPM_RECN, SPM_MOOR, SPM_LNBY, 167 SPM_LDNG, SPM_NOTC, SPM_TSS, SPM_FOUL, SPM_DIVE, SPM_FRRY, 168 SPM_ANCH, MOR_DLPN, MOR_DDPN, MOR_BLRD, MOR_WALL, MOR_POST, MOR_CHWR, MOR_BUOY, 169 SIS_PTCL, SIS_PTED, SIS_IPT, SIS_BRTH, SIS_DOCK, SIS_LOCK, SIS_FBAR, SIS_BRDG, SIS_DRDG, SIS_TRFC, 170 SIS_DNGR, SIS_OBST, SIS_CABL, SIS_MILY, SIS_DSTR, SIS_WTHR, SIS_STRM, SIS_ICE, SIS_TIME, SIS_TIDE, 171 SIS_TSTM, SIS_TGAG, SIS_TSCL, SIS_DIVE, SIS_LGAG, LIT_DIRF, LIT_LEDG, 172 LMK_CHMY, LMK_CARN, LMK_DSHA, LMK_FLGS, LMK_FLRS, LMK_MNMT, LMK_RADM, LMK_TOWR, LMK_WNDM, LMK_WTRT 173 } 174 175 public static final EnumMap<Cat, String> CatSTR = new EnumMap<Cat, String>(Cat.class); 166 NONE, LAM_PORT, LAM_STBD, LAM_PPORT, LAM_PSTBD, CAM_NORTH, CAM_EAST, CAM_SOUTH, CAM_WEST, ACH_URST, ACH_DEEP, ACH_TANK, ACH_EXPL, ACH_QUAR, ACH_SPLN, ACH_SCAN, ACH_SCMO, ACH_T24H, ACH_TLIM, SPM_UNKN, SPM_WARN, SPM_CHBF, SPM_YCHT, SPM_CABL, SPM_OFAL, SPM_ODAS, SPM_RECN, SPM_MOOR, SPM_LNBY, SPM_LDNG, SPM_NOTC, SPM_TSS, SPM_FOUL, SPM_DIVE, SPM_FRRY, SPM_ANCH, MOR_DLPN, MOR_DDPN, MOR_BLRD, MOR_WALL, MOR_POST, MOR_CHWR, MOR_BUOY, SIS_PTCL, SIS_PTED, SIS_IPT, SIS_BRTH, SIS_DOCK, SIS_LOCK, SIS_FBAR, SIS_BRDG, SIS_DRDG, SIS_TRFC, SIS_DNGR, SIS_OBST, SIS_CABL, SIS_MILY, SIS_DSTR, SIS_WTHR, SIS_STRM, SIS_ICE, SIS_TIME, SIS_TIDE, SIS_TSTM, SIS_TGAG, SIS_TSCL, SIS_DIVE, SIS_LGAG, LIT_DIRF, LIT_LEDG, LMK_CHMY, LMK_CARN, LMK_DSHA, LMK_FLGS, LMK_FLRS, LMK_MNMT, LMK_RADM, LMK_TOWR, LMK_WNDM, LMK_WTRT 167 } 168 169 public static final EnumMap<Cat, String> CatSTR = new EnumMap<Cat, String>( 170 Cat.class); 176 171 static { 177 172 CatSTR.put(Cat.LAM_PORT, "port"); … … 255 250 256 251 public enum Shp { 257 UNKNOWN, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, 258 BUOYANT, CAIRN, PILE, LATTICE, TOWER, STAKE, POLE, POST, PERCH, BUOY, BEACON259 } 260 261 public static final EnumMap<Shp, String> ShpSTR = new EnumMap<Shp, String>(Shp.class);252 UNKNOWN, PILLAR, SPAR, CAN, CONE, SPHERE, BARREL, FLOAT, SUPER, BUOYANT, CAIRN, PILE, LATTICE, TOWER, STAKE, POLE, POST, PERCH, BUOY, BEACON 253 } 254 255 public static final EnumMap<Shp, String> ShpSTR = new EnumMap<Shp, String>( 256 Shp.class); 262 257 static { 263 258 ShpSTR.put(Shp.PILLAR, "pillar"); … … 292 287 } 293 288 294 public static final EnumMap<Col, Color> ColMAP = new EnumMap<Col, Color>(Col.class); 289 public static final EnumMap<Col, Color> ColMAP = new EnumMap<Col, Color>( 290 Col.class); 295 291 static { 296 292 ColMAP.put(Col.UNKNOWN, new Color(0xc0c0c0)); … … 310 306 } 311 307 312 public static final EnumMap<Col, String> ColSTR = new EnumMap<Col, String>(Col.class); 308 public static final EnumMap<Col, String> ColSTR = new EnumMap<Col, String>( 309 Col.class); 313 310 static { 314 311 ColSTR.put(Col.WHITE, "white"); … … 333 330 return getTopColour(idx); 334 331 } 335 332 336 333 public void setColour(Ent ent, Col col) { 337 334 if (ent == Ent.BODY) … … 340 337 setTopColour(col); 341 338 } 342 339 343 340 public void setColour(Ent ent, int idx, Col col) { 344 341 if (ent == Ent.BODY) … … 347 344 setTopColour(idx, col); 348 345 } 349 346 350 347 public void addColour(Ent ent, int idx, Col col) { 351 348 if (ent == Ent.BODY) … … 354 351 addTopColour(idx, col); 355 352 } 356 353 357 354 public void subColour(Ent ent, int idx) { 358 355 if (ent == Ent.BODY) … … 361 358 subTopColour(idx); 362 359 } 363 360 364 361 private ArrayList<Col> bodyColour = new ArrayList<Col>(); 365 362 366 363 public Col getObjColour(int i) { 367 364 if (i < bodyColour.size()) … … 394 391 bodyColour.remove(i); 395 392 } 396 393 397 394 private ArrayList<Col> topmarkColour = new ArrayList<Col>(); 398 395 399 396 public Col getTopColour(int i) { 400 397 if (i < topmarkColour.size()) … … 427 424 topmarkColour.remove(i); 428 425 } 429 426 430 427 public enum Chr { 431 UNKNOWN, FIXED, FLASH, LFLASH, QUICK, VQUICK, UQUICK, ISOPHASED, OCCULTING, 432 MORSE, ALTERNATING, IQUICK, IVQUICK, IUQUICK 428 UNKNOWN, FIXED, FLASH, LFLASH, QUICK, VQUICK, UQUICK, ISOPHASED, OCCULTING, MORSE, ALTERNATING, IQUICK, IVQUICK, IUQUICK 433 429 } 434 430 … … 469 465 } 470 466 471 public static final EnumMap<Vis, String> VisSTR = new EnumMap<Vis, String>(Vis.class); 467 public static final EnumMap<Vis, String> VisSTR = new EnumMap<Vis, String>( 468 Vis.class); 472 469 static { 473 470 VisSTR.put(Vis.UNKNOWN, ""); … … 481 478 VisSTR.put(Vis.PARTOBS, "part_obscured"); 482 479 } 483 480 484 481 public enum Lit { 485 UNKNOWN, VERT, HORIZ, DIR, UPPER, LOWER, LEAD, REAR, FRONT, 486 AERO, AIROBS, FOGDET, FLOOD, STRIP, SUBS, SPOT, MOIRE, EMERG, BEAR487 } 488 489 public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>(Lit.class);482 UNKNOWN, VERT, HORIZ, DIR, UPPER, LOWER, LEAD, REAR, FRONT, AERO, AIROBS, FOGDET, FLOOD, STRIP, SUBS, SPOT, MOIRE, EMERG, BEAR 483 } 484 485 public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>( 486 Lit.class); 490 487 static { 491 488 LitSTR.put(Lit.UNKNOWN, ""); … … 510 507 } 511 508 512 public enum Exh { UNKNOWN, H24, DAY, NIGHT, FOG } 513 514 public static final EnumMap<Exh, String> ExhSTR = new EnumMap<Exh, String>(Exh.class); 509 public enum Exh { 510 UNKNOWN, H24, DAY, NIGHT, FOG 511 } 512 513 public static final EnumMap<Exh, String> ExhSTR = new EnumMap<Exh, String>( 514 Exh.class); 515 515 static { 516 516 ExhSTR.put(Exh.UNKNOWN, ""); … … 520 520 ExhSTR.put(Exh.FOG, "fog"); 521 521 } 522 523 public enum Att { COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT, MLT } 524 525 public Object[] sector = {Col.UNKNOWN, "", "", "", "", Lit.UNKNOWN, "", "", "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, "", "" }; 526 522 523 public enum Att { 524 COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT, MLT 525 } 526 527 public Object[] sector = { Col.UNKNOWN, "", "", "", "", Lit.UNKNOWN, "", "", 528 "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, "", "" }; 529 527 530 private ArrayList<Object[]> sectors = new ArrayList<Object[]>(); 528 531 529 532 public int getSectorCount() { 530 533 return sectors.size(); 531 534 } 532 535 533 536 public Object getLightAtt(Att att, int i) { 534 537 return getLightAtt(att.ordinal(), i); 535 538 } 539 536 540 public Object getLightAtt(int att, int i) { 537 541 if (i < sectors.size()) … … 577 581 } 578 582 579 public static final EnumMap<Pat, String> PatSTR = new EnumMap<Pat, String>(Pat.class); 583 public static final EnumMap<Pat, String> PatSTR = new EnumMap<Pat, String>( 584 Pat.class); 580 585 static { 581 586 PatSTR.put(Pat.HORIZ, "horizontal"); … … 592 597 return getTopPattern(); 593 598 } 594 599 595 600 public void setPattern(Ent ent, Pat pat) { 596 601 if (ent == Ent.BODY) … … 599 604 setTopPattern(pat); 600 605 } 601 606 602 607 private Pat bodyPattern = Pat.NONE; 603 608 … … 624 629 } 625 630 626 public static final EnumMap<Top, String> TopSTR = new EnumMap<Top, String>(Top.class); 631 public static final EnumMap<Top, String> TopSTR = new EnumMap<Top, String>( 632 Top.class); 627 633 static { 628 634 TopSTR.put(Top.CAN, "cylinder"); … … 657 663 } 658 664 659 public static final EnumMap<Rtb, String> RtbSTR = new EnumMap<Rtb, String>(Rtb.class); 665 public static final EnumMap<Rtb, String> RtbSTR = new EnumMap<Rtb, String>( 666 Rtb.class); 660 667 static { 661 668 RtbSTR.put(Rtb.RACON, "racon"); … … 738 745 } 739 746 740 public static final EnumMap<Fog, String> FogSTR = new EnumMap<Fog, String>(Fog.class); 747 public static final EnumMap<Fog, String> FogSTR = new EnumMap<Fog, String>( 748 Fog.class); 741 749 static { 742 750 FogSTR.put(Fog.UNKNOWN, "yes"); … … 804 812 } 805 813 806 public static final EnumMap<Sts, String> StsSTR = new EnumMap<Sts, String>(Sts.class); 814 public static final EnumMap<Sts, String> StsSTR = new EnumMap<Sts, String>( 815 Sts.class); 807 816 static { 808 817 StsSTR.put(Sts.PERM, "permanent"); … … 840 849 } 841 850 842 public static final EnumMap<Cns, String> CnsSTR = new EnumMap<Cns, String>(Cns.class); 851 public static final EnumMap<Cns, String> CnsSTR = new EnumMap<Cns, String>( 852 Cns.class); 843 853 static { 844 854 CnsSTR.put(Cns.BRICK, "masonry"); … … 867 877 } 868 878 869 public static final EnumMap<Con, String> ConSTR = new EnumMap<Con, String>(Con.class); 879 public static final EnumMap<Con, String> ConSTR = new EnumMap<Con, String>( 880 Con.class); 870 881 static { 871 882 ConSTR.put(Con.CONSP, "conspicuous"); … … 1011 1022 dlg.panelMain.saveButton.setEnabled(true); 1012 1023 Ent ent = EntMAP.get(getObject()); 1013 dlg.panelMain.topButton.setEnabled((ent == Ent.BUOY) || (ent == Ent.BEACON) || (ent == Ent.FLOAT)); 1024 dlg.panelMain.topButton.setEnabled((ent == Ent.BUOY) 1025 || (ent == Ent.BEACON) || (ent == Ent.FLOAT)); 1014 1026 dlg.panelMain.fogButton.setEnabled(true); 1015 1027 dlg.panelMain.radButton.setEnabled(true); … … 1047 1059 paintSign(); 1048 1060 } 1049 1061 1050 1062 public String validDecimal(String str) { 1051 1063 str = str.trim().replace(',', '.'); … … 1169 1181 } 1170 1182 } 1171 1183 1172 1184 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":height")) { 1173 1185 setHeight(keys.get("seamark:" + ObjSTR.get(obj) + ":height")); … … 1195 1207 setCategory(Cat.LAM_PORT); 1196 1208 } 1197 } else if ((getObjColour(1) == Col.GREEN) && (getObjColour(2) == Col.RED)) { 1209 } else if ((getObjColour(1) == Col.GREEN) 1210 && (getObjColour(2) == Col.RED)) { 1198 1211 setObject(Obj.FLTLAT); 1199 1212 if (getRegion() == Reg.B) { … … 1202 1215 setCategory(Cat.LAM_PPORT); 1203 1216 } 1204 } else if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.RED)) { 1217 } else if ((getObjColour(1) == Col.WHITE) 1218 && (getObjColour(2) == Col.RED)) { 1205 1219 setObject(Obj.FLTLAT); 1206 1220 setCategory(Cat.LAM_PORT); … … 1218 1232 setCategory(Cat.LAM_STBD); 1219 1233 } 1220 } else if ((getObjColour(1) == Col.RED) && (getObjColour(2) == Col.GREEN)) { 1234 } else if ((getObjColour(1) == Col.RED) 1235 && (getObjColour(2) == Col.GREEN)) { 1221 1236 setObject(Obj.FLTLAT); 1222 1237 if (getRegion() == Reg.B) { … … 1225 1240 setCategory(Cat.LAM_PSTBD); 1226 1241 } 1227 } else if ((getObjColour(1) == Col.WHITE) && (getObjColour(2) == Col.GREEN)) { 1242 } else if ((getObjColour(1) == Col.WHITE) 1243 && (getObjColour(2) == Col.GREEN)) { 1228 1244 setObject(Obj.FLTLAT); 1229 1245 setCategory(Cat.LAM_STBD); … … 1349 1365 } 1350 1366 } 1351 1367 1352 1368 sectors.clear(); 1353 1369 sectors.add(sector.clone()); … … 1361 1377 } 1362 1378 if (keys.containsKey("seamark:light" + secStr + ":character")) 1363 setLightAtt(Att.CHR, i, keys.get("seamark:light" + secStr + ":character")); 1379 setLightAtt(Att.CHR, i, 1380 keys.get("seamark:light" + secStr + ":character")); 1364 1381 if (keys.containsKey("seamark:light" + secStr + ":group")) 1365 1382 setLightAtt(Att.GRP, i, keys.get("seamark:light" + secStr + ":group")); 1366 1383 if (keys.containsKey("seamark:light" + secStr + ":sequence")) 1367 setLightAtt(Att.SEQ, i, keys.get("seamark:light" + secStr + ":sequence")); 1384 setLightAtt(Att.SEQ, i, 1385 keys.get("seamark:light" + secStr + ":sequence")); 1368 1386 if (keys.containsKey("seamark:light" + secStr + ":period")) 1369 1387 setLightAtt(Att.PER, i, keys.get("seamark:light" + secStr + ":period")); … … 1375 1393 } 1376 1394 if (keys.containsKey("seamark:light" + secStr + ":sector_start")) 1377 setLightAtt(Att.BEG, i, keys.get("seamark:light" + secStr + ":sector_start")); 1395 setLightAtt(Att.BEG, i, 1396 keys.get("seamark:light" + secStr + ":sector_start")); 1378 1397 if (keys.containsKey("seamark:light" + secStr + ":sector_end")) 1379 setLightAtt(Att.END, i, keys.get("seamark:light" + secStr + ":sector_end")); 1398 setLightAtt(Att.END, i, 1399 keys.get("seamark:light" + secStr + ":sector_end")); 1380 1400 if (keys.containsKey("seamark:light" + secStr + ":radius")) 1381 1401 setLightAtt(Att.RAD, i, keys.get("seamark:light" + secStr + ":radius")); … … 1386 1406 if (keys.containsKey("seamark:light" + secStr + ":visibility")) { 1387 1407 str = keys.get("seamark:light" + secStr + ":visibility"); 1388 for (Vis vis : VisSTR.keySet())1389 if (VisSTR.get(vis).equals(str))1390 setLightAtt(Att.VIS, i, vis);1408 for (Vis vis : VisSTR.keySet()) 1409 if (VisSTR.get(vis).equals(str)) 1410 setLightAtt(Att.VIS, i, vis); 1391 1411 } 1392 1412 if (keys.containsKey("seamark:light" + secStr + ":exhibition")) { … … 1397 1417 } 1398 1418 if (keys.containsKey("seamark:light" + secStr + ":orientation")) 1399 setLightAtt(Att.ORT, i, keys.get("seamark:light" + secStr + ":orientation")); 1419 setLightAtt(Att.ORT, i, 1420 keys.get("seamark:light" + secStr + ":orientation")); 1400 1421 if (keys.containsKey("seamark:light" + secStr + ":multiple")) 1401 setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":multiple")); 1422 setLightAtt(Att.HGT, i, 1423 keys.get("seamark:light" + secStr + ":multiple")); 1402 1424 if (sectors.size() == i) 1403 1425 break; … … 1667 1689 System.out.println("Missing image: " + imgStr); 1668 1690 } else { 1669 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 1691 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass() 1692 .getResource(imgStr))); 1670 1693 dlg.panelMain.colLabel.setText(lblStr); 1671 1694 } 1672 1695 } else { 1673 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(colStr))); 1696 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource( 1697 colStr))); 1674 1698 } 1675 1699 } else { … … 1739 1763 System.out.println("Missing image: " + imgStr); 1740 1764 } else { 1741 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 1765 dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource( 1766 imgStr))); 1742 1767 } 1743 1768 } else { … … 1848 1873 return; 1849 1874 } else { 1850 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr))); 1875 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource( 1876 imgStr))); 1851 1877 } 1852 1878 } else { 1853 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(colStr))); 1879 dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource( 1880 colStr))); 1854 1881 } 1855 1882 } else { … … 1858 1885 1859 1886 if (getFogSound() != Fog.NONE) { 1860 dlg.panelMain.fogIcon.setIcon(new ImageIcon(getClass().getResource("/images/Fog_Signal.png"))); 1887 dlg.panelMain.fogIcon.setIcon(new ImageIcon(getClass().getResource( 1888 "/images/Fog_Signal.png"))); 1861 1889 String str = ""; 1862 1890 if (getFogSound() != Fog.UNKNOWN) … … 1892 1920 dlg.panelMain.fogLabel.setText(str); 1893 1921 } 1894 1922 1895 1923 if (RaType != Rtb.NONE) { 1896 1924 if (getRadar() == Rtb.REFLECTOR) { 1897 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png"))); 1925 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource( 1926 "/images/Radar_Reflector_355.png"))); 1898 1927 } else { 1899 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Station.png"))); 1928 dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource( 1929 "/images/Radar_Station.png"))); 1900 1930 String str = ""; 1901 1931 if (getRadar() == Rtb.RAMARK) … … 1912 1942 } 1913 1943 } 1914 1944 1915 1945 if (getLightAtt(Att.COL, 0) != Col.UNKNOWN) { 1916 1946 if (sectors.size() == 1) { 1917 1947 switch ((Col) getLightAtt(Att.COL, 0)) { 1918 1948 case RED: 1919 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Red_120.png"))); 1949 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource( 1950 "/images/Light_Red_120.png"))); 1920 1951 break; 1921 1952 case GREEN: 1922 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Green_120.png"))); 1953 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource( 1954 "/images/Light_Green_120.png"))); 1923 1955 break; 1924 1956 case WHITE: 1925 1957 case YELLOW: 1926 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_White_120.png"))); 1958 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource( 1959 "/images/Light_White_120.png"))); 1927 1960 break; 1928 1961 default: 1929 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png"))); 1930 } 1931 } 1932 String c = (String)getLightAtt(Att.CHR, 0); 1962 dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource( 1963 "/images/Light_Magenta_120.png"))); 1964 } 1965 } 1966 String c = (String) getLightAtt(Att.CHR, 0); 1933 1967 String tmp = ""; 1934 1968 if (c.contains("+")) { … … 1936 1970 tmp = c.substring(i1, c.length()); 1937 1971 c = c.substring(0, i1); 1938 if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) {1939 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";1972 if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) { 1973 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")"; 1940 1974 } 1941 1975 if (tmp != null) 1942 1976 c += tmp; 1943 } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty())1944 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";1945 switch ((Col) getLightAtt(Att.COL, 0)) {1977 } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) 1978 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")"; 1979 switch ((Col) getLightAtt(Att.COL, 0)) { 1946 1980 case RED: 1947 1981 c += " R"; … … 1963 1997 break; 1964 1998 } 1965 tmp = (String) getLightAtt(Att.PER, 0);1999 tmp = (String) getLightAtt(Att.PER, 0); 1966 2000 if (!tmp.isEmpty()) 1967 2001 c += " " + tmp + "s"; 1968 2002 dlg.panelMain.litLabel.setText(c); 1969 2003 } 1970 2004 1971 2005 paintlock = false; 1972 2006 } … … 1976 2010 if (getObject() != Obj.UNKNOWN) { 1977 2011 1978 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A")); 2012 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" 2013 : (getRegion() == Reg.B ? "B" : "A")); 1979 2014 1980 2015 for (String str : node.getKeys().keySet()) { … … 1984 2019 1985 2020 if (!getName().isEmpty()) 1986 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName())); 2021 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", 2022 getName())); 1987 2023 1988 2024 String objStr = ObjSTR.get(object); 1989 2025 if (objStr != null) { 1990 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr)); 2026 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", 2027 objStr)); 1991 2028 1992 2029 if (getShape() != Shp.FLOAT) { 1993 2030 String str = CatSTR.get(getCategory()); 1994 2031 if (str != null) 1995 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 2032 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2033 + objStr + ":category", str)); 1996 2034 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON)) 1997 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape()))); 2035 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2036 + objStr + ":shape", ShpSTR.get(getShape()))); 1998 2037 } 1999 2038 … … 2003 2042 str += (";" + ColSTR.get(getObjColour(i))); 2004 2043 } 2005 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str)); 2044 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2045 + objStr + ":colour", str)); 2006 2046 } 2007 2047 2008 2048 if (getObjPattern() != Pat.NONE) { 2009 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatSTR 2010 .get(getObjPattern()))); 2011 } 2012 2013 if ((GrpMAP.get(object) == Grp.LAT) && (getShape() != Shp.PERCH) || (getObject() == Obj.FLTLAT)) { 2049 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2050 + objStr + ":colour_pattern", PatSTR.get(getObjPattern()))); 2051 } 2052 2053 if ((GrpMAP.get(object) == Grp.LAT) && (getShape() != Shp.PERCH) 2054 || (getObject() == Obj.FLTLAT)) { 2014 2055 switch (region) { 2015 2056 case A: 2016 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-a")); 2057 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2058 + objStr + ":system", "iala-a")); 2017 2059 break; 2018 2060 case B: 2019 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-b")); 2061 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2062 + objStr + ":system", "iala-b")); 2020 2063 break; 2021 2064 case C: 2022 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "other")); 2065 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2066 + objStr + ":system", "other")); 2023 2067 break; 2024 2068 } 2025 2069 } 2026 2070 if (!getHeight().isEmpty()) { 2027 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + "height", getHeight())); 2071 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2072 + objStr + "height", getHeight())); 2028 2073 } 2029 2074 if (!getElevation().isEmpty()) { 2030 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + "elevation", getElevation())); 2075 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" 2076 + objStr + "elevation", getElevation())); 2031 2077 } 2032 2078 } 2033 2079 if (getTopmark() != Top.NONE) { 2034 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark()))); 2080 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2081 "seamark:topmark:shape", TopSTR.get(getTopmark()))); 2035 2082 if (getTopPattern() != Pat.NONE) 2036 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR2037 .get(getTopPattern())));2083 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2084 "seamark:topmark:colour_pattern", PatSTR.get(getTopPattern()))); 2038 2085 if (getTopColour(0) != Col.UNKNOWN) { 2039 2086 String str = ColSTR.get(getTopColour(0)); … … 2041 2088 str += (";" + ColSTR.get(getTopColour(i))); 2042 2089 } 2043 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour", str)); 2044 } 2045 } 2046 2090 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2091 "seamark:topmark:colour", str)); 2092 } 2093 } 2094 2047 2095 for (int i = 0; i < sectors.size(); i++) { 2048 2096 String secStr = (i == 0) ? "" : (":" + Integer.toString(i)); 2049 2097 if (sectors.get(i)[0] != Col.UNKNOWN) 2050 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", ColSTR.get(sectors.get(i)[0]))); 2051 if (!((String)sectors.get(i)[1]).isEmpty()) 2052 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String)sectors.get(i)[1])); 2053 if (!((String)sectors.get(i)[2]).isEmpty()) 2054 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String)sectors.get(i)[2])); 2055 if (!((String)sectors.get(i)[3]).isEmpty()) 2056 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String)sectors.get(i)[3])); 2057 if (!((String)sectors.get(i)[4]).isEmpty()) 2058 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String)sectors.get(i)[4])); 2098 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2099 "seamark:light" + secStr + ":colour", 2100 ColSTR.get(sectors.get(i)[0]))); 2101 if (!((String) sectors.get(i)[1]).isEmpty()) 2102 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2103 "seamark:light" + secStr + ":character", 2104 (String) sectors.get(i)[1])); 2105 if (!((String) sectors.get(i)[2]).isEmpty()) 2106 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2107 "seamark:light" + secStr + ":group", (String) sectors.get(i)[2])); 2108 if (!((String) sectors.get(i)[3]).isEmpty()) 2109 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2110 "seamark:light" + secStr + ":sequence", 2111 (String) sectors.get(i)[3])); 2112 if (!((String) sectors.get(i)[4]).isEmpty()) 2113 Main.main.undoRedo 2114 .add(new ChangePropertyCommand(node, "seamark:light" + secStr 2115 + ":period", (String) sectors.get(i)[4])); 2059 2116 if (sectors.get(i)[5] != Lit.UNKNOWN) 2060 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5]))); 2061 if (!((String)sectors.get(i)[6]).isEmpty()) 2062 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String)sectors.get(i)[6])); 2063 if (!((String)sectors.get(i)[7]).isEmpty()) 2064 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String)sectors.get(i)[7])); 2065 if (!((String)sectors.get(i)[8]).isEmpty()) 2066 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String)sectors.get(i)[8])); 2067 if (!((String)sectors.get(i)[9]).isEmpty()) 2068 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String)sectors.get(i)[9])); 2069 if (!((String)sectors.get(i)[10]).isEmpty()) 2070 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String)sectors.get(i)[10])); 2117 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2118 "seamark:light" + secStr + ":category", 2119 LitSTR.get(sectors.get(i)[5]))); 2120 if (!((String) sectors.get(i)[6]).isEmpty()) 2121 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2122 "seamark:light" + secStr + ":sector_start", (String) sectors 2123 .get(i)[6])); 2124 if (!((String) sectors.get(i)[7]).isEmpty()) 2125 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2126 "seamark:light" + secStr + ":sector_end", 2127 (String) sectors.get(i)[7])); 2128 if (!((String) sectors.get(i)[8]).isEmpty()) 2129 Main.main.undoRedo 2130 .add(new ChangePropertyCommand(node, "seamark:light" + secStr 2131 + ":radius", (String) sectors.get(i)[8])); 2132 if (!((String) sectors.get(i)[9]).isEmpty()) 2133 Main.main.undoRedo 2134 .add(new ChangePropertyCommand(node, "seamark:light" + secStr 2135 + ":height", (String) sectors.get(i)[9])); 2136 if (!((String) sectors.get(i)[10]).isEmpty()) 2137 Main.main.undoRedo 2138 .add(new ChangePropertyCommand(node, "seamark:light" + secStr 2139 + ":range", (String) sectors.get(i)[10])); 2071 2140 if (sectors.get(i)[11] != Vis.UNKNOWN) 2072 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11]))); 2141 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2142 "seamark:light" + secStr + ":visibility", VisSTR.get(sectors 2143 .get(i)[11]))); 2073 2144 if (sectors.get(i)[12] != Exh.UNKNOWN) 2074 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12]))); 2075 if (!((String)sectors.get(i)[13]).isEmpty()) 2076 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String)sectors.get(i)[13])); 2077 if (!((String)sectors.get(i)[14]).isEmpty()) 2078 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String)sectors.get(i)[14])); 2079 } 2080 2145 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2146 "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors 2147 .get(i)[12]))); 2148 if (!((String) sectors.get(i)[13]).isEmpty()) 2149 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2150 "seamark:light" + secStr + ":orientation", (String) sectors 2151 .get(i)[13])); 2152 if (!((String) sectors.get(i)[14]).isEmpty()) 2153 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2154 "seamark:light" + secStr + ":multiple", 2155 (String) sectors.get(i)[14])); 2156 } 2157 2081 2158 if (getFogSound() != Fog.NONE) { 2082 2159 if (getFogSound() == Fog.UNKNOWN) 2083 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes")); 2160 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2161 "seamark:fog_signal", "yes")); 2084 2162 else 2085 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", FogSTR.get(getFogSound()))); 2163 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2164 "seamark:fog_signal:category", FogSTR.get(getFogSound()))); 2086 2165 if (!getFogGroup().isEmpty()) { 2087 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup())); 2166 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2167 "seamark:fog_signal:group", getFogGroup())); 2088 2168 } 2089 2169 if (!getFogPeriod().isEmpty()) { 2090 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:period", getFogPeriod())); 2170 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2171 "seamark:fog_signal:period", getFogPeriod())); 2091 2172 } 2092 2173 if (!getFogSequence().isEmpty()) { 2093 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:sequence", getFogSequence())); 2174 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2175 "seamark:fog_signal:sequence", getFogSequence())); 2094 2176 } 2095 2177 if (!getFogRange().isEmpty()) { 2096 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:range", getFogRange())); 2097 } 2098 } 2099 2178 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2179 "seamark:fog_signal:range", getFogRange())); 2180 } 2181 } 2182 2100 2183 if (RaType != Rtb.NONE) { 2101 2184 if (getRadar() == Rtb.REFLECTOR) { 2102 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes")); 2185 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2186 "seamark:radar_reflector", "yes")); 2103 2187 } else { 2104 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", RtbSTR.get(getRadar()))); 2188 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2189 "seamark:radar_transponder:category", RtbSTR.get(getRadar()))); 2105 2190 if (!getRaconGroup().isEmpty()) { 2106 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:group", getRaconGroup())); 2191 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2192 "seamark:radar_transponder:group", getRaconGroup())); 2107 2193 } 2108 2194 if (!getRaconPeriod().isEmpty()) { 2109 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:period", getRaconPeriod())); 2195 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2196 "seamark:radar_transponder:period", getRaconPeriod())); 2110 2197 } 2111 2198 if (!getRaconSequence().isEmpty()) { 2112 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sequence", getRaconSequence())); 2199 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2200 "seamark:radar_transponder:sequence", getRaconSequence())); 2113 2201 } 2114 2202 if (!getRaconRange().isEmpty()) { 2115 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:range", getRaconRange())); 2203 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2204 "seamark:radar_transponder:range", getRaconRange())); 2116 2205 } 2117 2206 if ((!getRaconSector1().isEmpty()) && (!getRaconSector2().isEmpty())) { 2118 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_start", getRaconSector1())); 2119 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_end", getRaconSector2())); 2207 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2208 "seamark:radar_transponder:sector_start", getRaconSector1())); 2209 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2210 "seamark:radar_transponder:sector_end", getRaconSector2())); 2120 2211 } 2121 2212 } … … 2123 2214 2124 2215 if (!getInfo().isEmpty()) { 2125 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:information", getInfo())); 2216 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2217 "seamark:information", getInfo())); 2126 2218 } 2127 2219 if (!getSource().isEmpty()) { 2128 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:source", getSource())); 2220 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2221 "seamark:source", getSource())); 2129 2222 } 2130 2223 if (getStatus() != Sts.UNKNOWN) { 2131 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:status", StsSTR.get(getStatus()))); 2224 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2225 "seamark:status", StsSTR.get(getStatus()))); 2132 2226 } 2133 2227 if (getConstr() != Cns.UNKNOWN) { 2134 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:construction", CnsSTR.get(getConstr()))); 2228 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2229 "seamark:construction", CnsSTR.get(getConstr()))); 2135 2230 } 2136 2231 if (getConsp() != Con.UNKNOWN) { 2137 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:conspicuity", ConSTR.get(getConsp()))); 2232 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2233 "seamark:conspicuity", ConSTR.get(getConsp()))); 2138 2234 } 2139 2235 if (getRefl() != Con.UNKNOWN) { 2140 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reflectivity", ConSTR.get(getRefl()))); 2236 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2237 "seamark:reflectivity", ConSTR.get(getRefl()))); 2141 2238 } 2142 2239 if (!getRef().isEmpty()) { 2143 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:reference", getRef())); 2240 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2241 "seamark:reference", getRef())); 2144 2242 } 2145 2243 if (!getLightRef().isEmpty()) { 2146 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:reference", getLightRef())); 2244 Main.main.undoRedo.add(new ChangePropertyCommand(node, 2245 "seamark:light:reference", getLightRef())); 2147 2246 } 2148 2247 if (!getFixme().isEmpty()) { 2149 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fixme", getFixme())); 2248 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fixme", 2249 getFixme())); 2150 2250 } 2151 2251 }
Note:
See TracChangeset
for help on using the changeset viewer.