Changeset 32911 in osm for applications/editors/josm/plugins/smed
- Timestamp:
- 2016-09-03T16:57:32+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/smed/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/src/panels/PanelSectors.java
r32767 r32911 278 278 } 279 279 280 public class ColourCellRenderer extends JPanel implements TableCellRenderer {280 public static class ColourCellRenderer extends JPanel implements TableCellRenderer { 281 281 private JLabel col1Label; 282 282 private JLabel col2Label; -
applications/editors/josm/plugins/smed/src/seamarks/SeaMark.java
r32767 r32911 58 58 private String name = ""; 59 59 60 @Override 60 61 public String getName() { 61 62 return name; 62 63 } 63 64 65 @Override 64 66 public void setName(String str) { 65 67 name = str.trim(); 66 68 repaint(); 67 69 } 68 70 69 71 public enum Obj { 70 72 UNKOBJ, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, … … 235 237 ROS_PCOM, ROS_COMB, ROS_FACS, ROS_TIME, ROS_PAIS, ROS_SAIS, ROS_VAIS, ROS_VANC, ROS_VASC, ROS_VAEC, ROS_VAWC, ROS_VAPL, ROS_VASL, ROS_VAID, ROS_VASW, ROS_VASP, ROS_VAWK 236 238 } 237 239 238 240 public static final EnumMap<Cat, String> CatSTR = new EnumMap<>(Cat.class); 239 241 static { … … 321 323 CatSTR.put(Cat.OFP_OIL, "oil"); 322 324 CatSTR.put(Cat.OFP_PRD, "production"); 323 CatSTR.put(Cat.OFP_OBS, "observation"); 325 CatSTR.put(Cat.OFP_OBS, "observation"); 324 326 CatSTR.put(Cat.OFP_ALP, "alp"); 325 327 CatSTR.put(Cat.OFP_SALM, "salm"); … … 374 376 CatSTR.put(Cat.ROS_VASW, "v-ais_safe_water"); 375 377 CatSTR.put(Cat.ROS_VASP, "v-ais_special_purpose"); 376 CatSTR.put(Cat.ROS_VAWK, "v-ais_wreck"); 378 CatSTR.put(Cat.ROS_VAWK, "v-ais_wreck"); 377 379 CatSTR.put(Cat.NTC_A1, "no_entry"); 378 380 CatSTR.put(Cat.NTC_A1a, "closed_area"); … … 519 521 520 522 public void setColour(Ent ent, Col col) { 521 if (ent == Ent.BODY) 523 if (ent == Ent.BODY) { 522 524 setObjColour(col); 523 else525 } else { 524 526 setTopColour(col); 527 } 525 528 } 526 529 527 530 public void setColour(Ent ent, int idx, Col col) { 528 if (ent == Ent.BODY) 531 if (ent == Ent.BODY) { 529 532 setObjColour(idx, col); 530 else533 } else { 531 534 setTopColour(idx, col); 535 } 532 536 } 533 537 534 538 public void addColour(Ent ent, int idx, Col col) { 535 if (ent == Ent.BODY) 539 if (ent == Ent.BODY) { 536 540 addObjColour(idx, col); 537 else541 } else { 538 542 addTopColour(idx, col); 543 } 539 544 } 540 545 541 546 public void subColour(Ent ent, int idx) { 542 if (ent == Ent.BODY) 547 if (ent == Ent.BODY) { 543 548 subObjColour(idx); 544 else549 } else { 545 550 subTopColour(idx); 551 } 546 552 } 547 553 … … 562 568 563 569 public void setObjColour(int i, Col col) { 564 if (i < bodyColour.size()) 570 if (i < bodyColour.size()) { 565 571 bodyColour.set(i, col); 572 } 566 573 repaint(); 567 574 } 568 575 569 576 public void addObjColour(int i, Col col) { 570 if (bodyColour.size() >= i) 577 if (bodyColour.size() >= i) { 571 578 bodyColour.add(i, col); 579 } 572 580 repaint(); 573 581 } … … 579 587 580 588 public void subObjColour(int i) { 581 if (bodyColour.size() > i) 589 if (bodyColour.size() > i) { 582 590 bodyColour.remove(i); 591 } 583 592 repaint(); 584 593 } … … 600 609 601 610 public void setTopColour(int i, Col col) { 602 if (topmarkColour.size() > i) 611 if (topmarkColour.size() > i) { 603 612 topmarkColour.set(i, col); 613 } 604 614 repaint(); 605 615 } 606 616 607 617 public void addTopColour(int i, Col col) { 608 if (topmarkColour.size() >= i) 618 if (topmarkColour.size() >= i) { 609 619 topmarkColour.add(i, col); 620 } 610 621 repaint(); 611 622 } … … 617 628 618 629 public void subTopColour(int i) { 619 if (topmarkColour.size() > i) 630 if (topmarkColour.size() > i) { 620 631 topmarkColour.remove(i); 632 } 621 633 repaint(); 622 634 } … … 746 758 747 759 public void setLightAtt(int att, int i, Object obj) { 748 if (sectors.size() == i) 760 if (sectors.size() == i) { 749 761 addLight(i); 750 if (sectors.size() > i) 762 } 763 if (sectors.size() > i) { 751 764 switch (att) { 752 765 case 4: … … 764 777 sectors.get(i)[att] = obj; 765 778 } 779 } 766 780 repaint(); 767 781 } … … 769 783 public void addLight(int i) { 770 784 if (sectors.size() >= i) { 771 if (sectors.size() == 0) 785 if (sectors.size() == 0) { 772 786 sectors.add(sector.clone()); 773 else787 } else { 774 788 sectors.add(i, sectors.get(0).clone()); 789 } 775 790 } 776 791 } … … 785 800 786 801 public void addLight() { 787 if (sectors.size() == 0) 802 if (sectors.size() == 0) { 788 803 sectors.add(sector.clone()); 789 else804 } else { 790 805 sectors.add(sectors.get(0).clone()); 806 } 791 807 } 792 808 793 809 public void delLight(int i) { 794 if (sectors.size() > i) 810 if (sectors.size() > i) { 795 811 sectors.remove(i); 812 } 796 813 repaint(); 797 814 } … … 827 844 828 845 public void setPattern(Ent ent, Pat pat) { 829 if (ent == Ent.BODY) 846 if (ent == Ent.BODY) { 830 847 setObjPattern(pat); 831 else848 } else { 832 849 setTopPattern(pat); 850 } 833 851 } 834 852 … … 1166 1184 1167 1185 public enum Fnc { 1168 UNKFNC, HMO, CSTM, HLTH, HOSP, POFF, HOTEL, RWSTA, POLICE, WPOL, PILO, PILL, BANK, DCHQ, TRNS, FACT, PWRS, ADMIN, EDUC, CHCH, CHPL,1169 TMPL, PGDA, SHSH, BTMP, MOSQ, MRBT, LOOK, COMS, TV, RADO, RADR, LSUP, MWAV, COOL, OBSV, TIMB, CLK, CTRL, AMOR, STAD, BUSS,1170 PRHB, RGLN, RSTN, RCMD, INFO1186 UNKFNC, HMO, CSTM, HLTH, HOSP, POFF, HOTEL, RWSTA, POLICE, WPOL, PILO, PILL, BANK, DCHQ, TRNS, FACT, PWRS, ADMIN, EDUC, CHCH, CHPL, 1187 TMPL, PGDA, SHSH, BTMP, MOSQ, MRBT, LOOK, COMS, TV, RADO, RADR, LSUP, MWAV, COOL, OBSV, TIMB, CLK, CTRL, AMOR, STAD, BUSS, 1188 PRHB, RGLN, RSTN, RCMD, INFO 1171 1189 } 1172 1190 … … 1323 1341 case BOYCAR: 1324 1342 case BOYLAT: 1325 if ((getCategory() != Cat.NOCAT) && (getShape() != Shp.UNKSHP)) 1343 if ((getCategory() != Cat.NOCAT) && (getShape() != Shp.UNKSHP)) { 1326 1344 tmp = true; 1345 } 1327 1346 break; 1328 1347 case BCNISD: … … 1332 1351 case BOYSAW: 1333 1352 case BOYSPP: 1334 if (getShape() != Shp.UNKSHP) 1353 if (getShape() != Shp.UNKSHP) { 1335 1354 tmp = true; 1355 } 1336 1356 break; 1337 1357 case FLTCAR: … … 1340 1360 case FLTSAW: 1341 1361 case FLTSPP: 1342 if (getObjColour(0) != Col.UNKCOL) 1362 if (getObjColour(0) != Col.UNKCOL) { 1343 1363 tmp = true; 1364 } 1344 1365 break; 1345 1366 case LITMAJ: … … 1357 1378 case RDOSTA: 1358 1379 case RADSTA: 1359 1380 tmp = true; 1360 1381 break; 1361 1382 case NOTMRK: 1362 if (getCategory() != Cat.NOCAT) 1383 if (getCategory() != Cat.NOCAT) { 1363 1384 tmp = true; 1385 } 1364 1386 case LNDMRK: 1365 if ((getCategory() != Cat.NOCAT) || (getFunc() != Fnc.UNKFNC)) 1387 if ((getCategory() != Cat.NOCAT) || (getFunc() != Fnc.UNKFNC)) { 1366 1388 tmp = true; 1389 } 1367 1390 break; 1368 1391 } … … 1422 1445 public String validDecimal(String str, float max) { 1423 1446 str = validDecimal(str); 1424 if (!(str.isEmpty()) && ( new Float(str) > max)) {1447 if (!(str.isEmpty()) && (Float.valueOf(str) > max)) { 1425 1448 PanelMain.messageBar.setText(Messages.getString("TooBig") + " (" + max + ")"); 1426 1449 return ""; … … 1434 1457 PanelMain.messageBar.setText(""); 1435 1458 String str = Main.pref.get("smedplugin.IALA"); 1436 if (str.equals("C")) 1459 if (str.equals("C")) { 1437 1460 setRegion(Reg.C); 1438 else if (str.equals("B"))1461 } else if (str.equals("B")) { 1439 1462 setRegion(Reg.B); 1440 else1463 } else { 1441 1464 setRegion(Reg.A); 1465 } 1442 1466 1443 1467 Map<String, String> keys = node.getKeys(); 1444 1468 1445 1469 str = ""; 1446 if (keys.containsKey("seamark:type")) 1470 if (keys.containsKey("seamark:type")) { 1447 1471 str = keys.get("seamark:type"); 1472 } 1448 1473 1449 1474 clrMark(); … … 1472 1497 setName(str); 1473 1498 } 1474 1499 1475 1500 for (Obj obj : ObjSTR.keySet()) { 1476 1501 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":category")) { … … 1499 1524 } 1500 1525 if (getShape() == Shp.UNKSHP) { 1501 if (EntMAP.get(getObject()) == Ent.BUOY) 1526 if (EntMAP.get(getObject()) == Ent.BUOY) { 1502 1527 setShape(Shp.BUOY); 1503 if (EntMAP.get(getObject()) == Ent.BEACON) 1528 } 1529 if (EntMAP.get(getObject()) == Ent.BEACON) { 1504 1530 setShape(Shp.BEACON); 1531 } 1505 1532 if (EntMAP.get(getObject()) == Ent.LFLOAT) 1506 if (getObject() == Obj.LITVES) 1533 if (getObject() == Obj.LITVES) { 1507 1534 setShape(Shp.SUPER); 1508 else1535 } else { 1509 1536 setShape(Shp.FLOAT); 1537 } 1510 1538 } 1511 1539 … … 1654 1682 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":system")) { 1655 1683 str = keys.get("seamark:" + ObjSTR.get(obj) + ":system"); 1656 if (str.equals("iala-a")) 1684 if (str.equals("iala-a")) { 1657 1685 setRegion(Reg.A); 1658 else if (str.equals("iala-b"))1686 } else if (str.equals("iala-b")) { 1659 1687 setRegion(Reg.B); 1660 else1688 } else { 1661 1689 setRegion(Reg.C); 1690 } 1662 1691 } else if (GrpMAP.get(object) == Grp.LAT) { 1663 1692 switch (getCategory()) { 1664 1693 case LAM_PORT: 1665 1694 if (getObjColour(0) == Col.RED) { 1666 if (getObjColour(1) == Col.WHITE) 1695 if (getObjColour(1) == Col.WHITE) { 1667 1696 setRegion(Reg.C); 1668 else1697 } else { 1669 1698 setRegion(Reg.A); 1670 } 1671 if (getObjColour(0) == Col.GREEN) 1699 } 1700 } 1701 if (getObjColour(0) == Col.GREEN) { 1672 1702 setRegion(Reg.B); 1703 } 1673 1704 break; 1674 1705 case LAM_PPORT: 1675 1706 if (getObjColour(0) == Col.RED) { 1676 if (getObjColour(3) == Col.GREEN) 1707 if (getObjColour(3) == Col.GREEN) { 1677 1708 setRegion(Reg.C); 1678 else1709 } else { 1679 1710 setRegion(Reg.B); 1680 } 1681 if (getObjColour(0) == Col.GREEN) 1711 } 1712 } 1713 if (getObjColour(0) == Col.GREEN) { 1682 1714 setRegion(Reg.A); 1715 } 1683 1716 break; 1684 1717 case LAM_STBD: 1685 1718 if (getObjColour(0) == Col.GREEN) { 1686 if (getObjColour(1) == Col.WHITE) 1719 if (getObjColour(1) == Col.WHITE) { 1687 1720 setRegion(Reg.C); 1688 else1721 } else { 1689 1722 setRegion(Reg.A); 1690 } 1691 if (getObjColour(0) == Col.RED) 1723 } 1724 } 1725 if (getObjColour(0) == Col.RED) { 1692 1726 setRegion(Reg.B); 1727 } 1693 1728 break; 1694 1729 case LAM_PSTBD: 1695 if (getObjColour(0) == Col.GREEN) 1730 if (getObjColour(0) == Col.GREEN) { 1696 1731 setRegion(Reg.B); 1732 } 1697 1733 if (getObjColour(0) == Col.RED) { 1698 if (getObjColour(3) == Col.GREEN) 1734 if (getObjColour(3) == Col.GREEN) { 1699 1735 setRegion(Reg.C); 1700 else1736 } else { 1701 1737 setRegion(Reg.A); 1738 } 1702 1739 } 1703 1740 break; … … 1743 1780 String strs[] = str.split(";"); 1744 1781 for (Col col : ColSTR.keySet()) 1745 if ((strs.length > 1) && ColSTR.get(col).equals(strs[1])) 1782 if ((strs.length > 1) && ColSTR.get(col).equals(strs[1])) { 1746 1783 setLightAtt(Att.ALT, i, col); 1784 } 1747 1785 str = strs[0]; 1748 1786 } 1749 1787 for (Col col : ColSTR.keySet()) 1750 if (ColSTR.get(col).equals(str)) 1788 if (ColSTR.get(col).equals(str)) { 1751 1789 setLightAtt(Att.COL, i, col); 1790 } 1752 1791 } 1753 1792 if (keys.containsKey("seamark:light" + secStr + ":character")) { … … 1758 1797 setLightAtt(Att.GRP, i, str.substring((i1+1), i2)); 1759 1798 str = str.substring(0, i1) + str.substring((i2+1), str.length()); 1760 1799 } 1761 1800 setLightAtt(Att.CHR, i, str); 1762 1801 } 1763 if (keys.containsKey("seamark:light" + secStr + ":group")) 1802 if (keys.containsKey("seamark:light" + secStr + ":group")) { 1764 1803 setLightAtt(Att.GRP, i, keys.get("seamark:light" + secStr + ":group")); 1765 if (keys.containsKey("seamark:light" + secStr + ":sequence")) 1804 } 1805 if (keys.containsKey("seamark:light" + secStr + ":sequence")) { 1766 1806 setLightAtt(Att.SEQ, i, keys.get("seamark:light" + secStr + ":sequence")); 1767 if (keys.containsKey("seamark:light" + secStr + ":period")) 1807 } 1808 if (keys.containsKey("seamark:light" + secStr + ":period")) { 1768 1809 setLightAtt(Att.PER, i, keys.get("seamark:light" + secStr + ":period")); 1810 } 1769 1811 if (keys.containsKey("seamark:light" + secStr + ":category")) { 1770 1812 str = keys.get("seamark:light" + secStr + ":category"); 1771 if (str.equals("vert")) 1813 if (str.equals("vert")) { 1772 1814 str = "vertical"; 1773 if (str.equals("horiz")) 1815 } 1816 if (str.equals("horiz")) { 1774 1817 str = "horizontal"; 1818 } 1775 1819 for (Lit lit : LitSTR.keySet()) 1776 if (LitSTR.get(lit).equals(str)) 1820 if (LitSTR.get(lit).equals(str)) { 1777 1821 setLightAtt(Att.LIT, i, lit); 1778 } 1779 if (keys.containsKey("seamark:light" + secStr + ":sector_start")) 1822 } 1823 } 1824 if (keys.containsKey("seamark:light" + secStr + ":sector_start")) { 1780 1825 setLightAtt(Att.BEG, i, keys.get("seamark:light" + secStr + ":sector_start")); 1781 if (keys.containsKey("seamark:light" + secStr + ":sector_end")) 1826 } 1827 if (keys.containsKey("seamark:light" + secStr + ":sector_end")) { 1782 1828 setLightAtt(Att.END, i, keys.get("seamark:light" + secStr + ":sector_end")); 1783 if (keys.containsKey("seamark:light" + secStr + ":radius")) 1829 } 1830 if (keys.containsKey("seamark:light" + secStr + ":radius")) { 1784 1831 setLightAtt(Att.RAD, i, keys.get("seamark:light" + secStr + ":radius")); 1785 if (keys.containsKey("seamark:light" + secStr + ":height")) 1832 } 1833 if (keys.containsKey("seamark:light" + secStr + ":height")) { 1786 1834 setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":height")); 1787 if (keys.containsKey("seamark:light" + secStr + ":range")) 1835 } 1836 if (keys.containsKey("seamark:light" + secStr + ":range")) { 1788 1837 setLightAtt(Att.RNG, i, keys.get("seamark:light" + secStr + ":range")); 1838 } 1789 1839 if (keys.containsKey("seamark:light" + secStr + ":visibility")) { 1790 1840 str = keys.get("seamark:light" + secStr + ":visibility"); 1791 1841 for (Vis vis : VisSTR.keySet()) 1792 if (VisSTR.get(vis).equals(str)) 1842 if (VisSTR.get(vis).equals(str)) { 1793 1843 setLightAtt(Att.VIS, i, vis); 1844 } 1794 1845 } 1795 1846 if (keys.containsKey("seamark:light" + secStr + ":exhibition")) { 1796 1847 str = keys.get("seamark:light" + secStr + ":exhibition"); 1797 1848 for (Exh exh : ExhSTR.keySet()) 1798 if (ExhSTR.get(exh).equals(str)) 1849 if (ExhSTR.get(exh).equals(str)) { 1799 1850 setLightAtt(Att.EXH, i, exh); 1800 } 1801 if (keys.containsKey("seamark:light" + secStr + ":orientation")) 1851 } 1852 } 1853 if (keys.containsKey("seamark:light" + secStr + ":orientation")) { 1802 1854 setLightAtt(Att.ORT, i, keys.get("seamark:light" + secStr + ":orientation")); 1803 if (keys.containsKey("seamark:light" + secStr + ":multiple")) 1855 } 1856 if (keys.containsKey("seamark:light" + secStr + ":multiple")) { 1804 1857 setLightAtt(Att.MLT, i, keys.get("seamark:light" + secStr + ":multiple")); 1805 1806 if (sectors.size() == i) 1807 break; 1858 } 1859 1860 if (sectors.size() == i) { 1861 break; 1862 } 1808 1863 } 1809 1864 … … 1954 2009 } 1955 2010 2011 @Override 1956 2012 public void paintComponent(Graphics g) { 1957 2013 super.paintComponent(g); 1958 2014 1959 2015 if (dlg.node == null) return; 1960 1961 Graphics2D g2 = (Graphics2D) g;1962 1963 String colStr;2016 2017 Graphics2D g2 = (Graphics2D) g; 2018 2019 String colStr; 1964 2020 String lblStr; 1965 2021 String imgStr = "/images/"; … … 2118 2174 break; 2119 2175 case LMK_TOWR: 2120 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) 2176 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) { 2121 2177 imgStr += "ChurchTower"; 2122 else2178 } else { 2123 2179 imgStr += "LandTower"; 2180 } 2124 2181 break; 2125 2182 case LMK_WNDM: … … 2130 2187 break; 2131 2188 case LMK_DOME: 2132 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) 2189 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) { 2133 2190 imgStr += "ChurchDome"; 2134 else2191 } else { 2135 2192 imgStr += "Dome"; 2193 } 2136 2194 break; 2137 2195 case LMK_SPIR: 2138 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) 2196 if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) { 2139 2197 imgStr += "ChurchSpire"; 2140 else2198 } else { 2141 2199 imgStr += "Spire"; 2200 } 2142 2201 break; 2143 2202 case LMK_MNRT: … … 2199 2258 break; 2200 2259 case OFSPLF: 2201 if (getCategory() == Cat.OFP_FPSO) 2260 if (getCategory() == Cat.OFP_FPSO) { 2202 2261 imgStr += "Storage"; 2203 else2262 } else { 2204 2263 imgStr += "Platform"; 2264 } 2205 2265 break; 2206 2266 case MORFAC: … … 2388 2448 2389 2449 for (int i = 1; i < sectors.size(); i++) { 2390 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);2391 g2.setStroke(new BasicStroke(6.0f));2392 if (!((String)getLightAtt(Att.BEG, i)).isEmpty() && !((String)getLightAtt(Att.END, i)).isEmpty()) {2450 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 2451 g2.setStroke(new BasicStroke(6.0f)); 2452 if (!((String)getLightAtt(Att.BEG, i)).isEmpty() && !((String)getLightAtt(Att.END, i)).isEmpty()) { 2393 2453 if (getLightAtt(Att.COL, i) != Col.UNKCOL) { 2394 2454 g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i))); … … 2405 2465 g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN)); 2406 2466 } 2407 } else if ((getLightAtt(Att.LIT, i) == Lit.DIR) && !((String)getLightAtt(Att.ORT, i)).isEmpty()) {2467 } else if ((getLightAtt(Att.LIT, i) == Lit.DIR) && !((String)getLightAtt(Att.ORT, i)).isEmpty()) { 2408 2468 if (getLightAtt(Att.COL, i) != Col.UNKCOL) { 2409 2469 g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i))); … … 2418 2478 g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN)); 2419 2479 } 2420 }2421 } 2422 g2.setPaint(Color.BLACK);2480 } 2481 } 2482 g2.setPaint(Color.BLACK); 2423 2483 if ((getLightAtt(Att.COL, 0) != Col.UNKCOL) || !(((String)getLightAtt(Att.CHR, 0)).isEmpty())) { 2424 2484 if (sectors.size() == 1) { … … 2451 2511 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")"; 2452 2512 } 2453 if (tmp != null) 2513 if (tmp != null) { 2454 2514 c += tmp; 2455 } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) 2515 } 2516 } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) { 2456 2517 c += "(" + (String) getLightAtt(Att.GRP, 0) + ")"; 2518 } 2457 2519 switch ((Col) getLightAtt(Att.COL, 0)) { 2458 2520 case WHITE: … … 2508 2570 } 2509 2571 tmp = (String) getLightAtt(Att.MLT, 0); 2510 if (!tmp.isEmpty()) 2572 if (!tmp.isEmpty()) { 2511 2573 c = tmp + c; 2574 } 2512 2575 if (getLightAtt(Att.LIT, 0) != Lit.UNKLIT) { 2513 2576 switch ((Lit)getLightAtt(Att.LIT, 0)) { … … 2516 2579 break; 2517 2580 case HORIZ: 2518 2519 2581 c += "(Horiz)"; 2582 break; 2520 2583 } 2521 2584 } 2522 2585 tmp = (String) getLightAtt(Att.PER, 0); 2523 if (!tmp.isEmpty()) 2586 if (!tmp.isEmpty()) { 2524 2587 c += " " + tmp + "s"; 2588 } 2525 2589 g2.drawString(c, 100, 70); 2526 2590 } … … 2529 2593 g2.drawImage(new ImageIcon(getClass().getResource("/images/Fog_Signal.png")).getImage(), 7, -15, null); 2530 2594 String str = ""; 2531 if (getFogSound() != Fog.FOGSIG) 2595 if (getFogSound() != Fog.FOGSIG) { 2532 2596 switch (getFogSound()) { 2533 2597 case HORN: … … 2553 2617 break; 2554 2618 } 2555 if (!getFogGroup().isEmpty()) 2619 } 2620 if (!getFogGroup().isEmpty()) { 2556 2621 str += ("(" + getFogGroup() + ")"); 2557 else2622 } else { 2558 2623 str += " "; 2559 if (!getFogPeriod().isEmpty()) 2624 } 2625 if (!getFogPeriod().isEmpty()) { 2560 2626 str += getFogPeriod() + "s"; 2627 } 2561 2628 g2.drawString(str, 0, 70); 2562 2629 } … … 2568 2635 g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null); 2569 2636 String str = ""; 2570 if (getRadar() == Rtb.RAMARK) 2637 if (getRadar() == Rtb.RAMARK) { 2571 2638 str += "Ramark"; 2572 else2639 } else { 2573 2640 str += "Racon"; 2574 if (!getRaconGroup().isEmpty()) 2641 } 2642 if (!getRaconGroup().isEmpty()) { 2575 2643 str += ("(" + getRaconGroup() + ")"); 2576 else2644 } else { 2577 2645 str += " "; 2578 if (!getRaconPeriod().isEmpty()) 2646 } 2647 if (!getRaconPeriod().isEmpty()) { 2579 2648 str += getRaconPeriod() + "s"; 2649 } 2580 2650 g2.drawString(str, 0, 50); 2581 2651 } … … 2589 2659 2590 2660 public void saveSign(OsmPrimitive node) { 2591 2661 2592 2662 if (getObject() != Obj.UNKOBJ) { 2593 2663 … … 2595 2665 2596 2666 for (String str : node.getKeys().keySet()) { 2597 if (str.trim().matches("^seamark:\\S+")) 2667 if (str.trim().matches("^seamark:\\S+")) { 2598 2668 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 2599 } 2600 2601 if (!getName().isEmpty()) 2669 } 2670 } 2671 2672 if (!getName().isEmpty()) { 2602 2673 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName())); 2674 } 2603 2675 2604 2676 String objStr = ObjSTR.get(object); … … 2608 2680 if (getShape() != Shp.FLOAT) { 2609 2681 String str = CatSTR.get(getCategory()); 2610 if (str != null) 2682 if (str != null) { 2611 2683 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 2612 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON)) 2684 } 2685 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON)) { 2613 2686 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape()))); 2687 } 2614 2688 } 2615 2689 … … 2656 2730 if (getTopmark() != Top.NOTOP) { 2657 2731 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark()))); 2658 if (getTopPattern() != Pat.NOPAT) 2732 if (getTopPattern() != Pat.NOPAT) { 2659 2733 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR.get(getTopPattern()))); 2734 } 2660 2735 if (getTopColour(0) != Col.UNKCOL) { 2661 2736 String str = ColSTR.get(getTopColour(0)); … … 2670 2745 String secStr = (i == 0) ? "" : (":" + Integer.toString(i)); 2671 2746 if (sectors.get(i)[0] != Col.UNKCOL) 2672 if ((sectors.get(i)[15] != Col.UNKCOL) && ((String)sectors.get(i)[1]).contains("Al")) 2747 if ((sectors.get(i)[15] != Col.UNKCOL) && ((String)sectors.get(i)[1]).contains("Al")) { 2673 2748 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", (ColSTR.get(sectors.get(i)[0])) + ";" + ColSTR.get(sectors.get(i)[15]))); 2674 else2749 } else { 2675 2750 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", ColSTR.get(sectors.get(i)[0]))); 2676 if (!((String) sectors.get(i)[1]).isEmpty()) 2751 } 2752 if (!((String) sectors.get(i)[1]).isEmpty()) { 2677 2753 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(i)[1])); 2678 else if (!((String) sectors.get(0)[1]).isEmpty())2754 } else if (!((String) sectors.get(0)[1]).isEmpty()) { 2679 2755 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(0)[1])); 2680 if (!((String) sectors.get(i)[2]).isEmpty()) 2756 } 2757 if (!((String) sectors.get(i)[2]).isEmpty()) { 2681 2758 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(i)[2])); 2682 else if (!((String) sectors.get(0)[2]).isEmpty())2759 } else if (!((String) sectors.get(0)[2]).isEmpty()) { 2683 2760 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(0)[2])); 2684 if (!((String) sectors.get(i)[3]).isEmpty()) 2761 } 2762 if (!((String) sectors.get(i)[3]).isEmpty()) { 2685 2763 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(i)[3])); 2686 else if (!((String) sectors.get(0)[3]).isEmpty())2764 } else if (!((String) sectors.get(0)[3]).isEmpty()) { 2687 2765 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(0)[3])); 2688 if (!((String) sectors.get(i)[4]).isEmpty()) 2766 } 2767 if (!((String) sectors.get(i)[4]).isEmpty()) { 2689 2768 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(i)[4])); 2690 else if (!((String) sectors.get(0)[4]).isEmpty())2769 } else if (!((String) sectors.get(0)[4]).isEmpty()) { 2691 2770 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(0)[4])); 2692 if (sectors.get(i)[5] != Lit.UNKLIT) 2771 } 2772 if (sectors.get(i)[5] != Lit.UNKLIT) { 2693 2773 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5]))); 2694 else if (sectors.get(0)[5] != Lit.UNKLIT)2774 } else if (sectors.get(0)[5] != Lit.UNKLIT) { 2695 2775 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(0)[5]))); 2696 if (!((String) sectors.get(i)[6]).isEmpty()) 2776 } 2777 if (!((String) sectors.get(i)[6]).isEmpty()) { 2697 2778 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String) sectors.get(i)[6])); 2698 if (!((String) sectors.get(i)[7]).isEmpty()) 2779 } 2780 if (!((String) sectors.get(i)[7]).isEmpty()) { 2699 2781 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String) sectors.get(i)[7])); 2700 if (!((String) sectors.get(i)[8]).isEmpty()) 2782 } 2783 if (!((String) sectors.get(i)[8]).isEmpty()) { 2701 2784 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(i)[8])); 2702 else if (!((String) sectors.get(0)[8]).isEmpty())2785 } else if (!((String) sectors.get(0)[8]).isEmpty()) { 2703 2786 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(0)[8])); 2704 if (!((String) sectors.get(i)[9]).isEmpty()) 2787 } 2788 if (!((String) sectors.get(i)[9]).isEmpty()) { 2705 2789 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(i)[9])); 2706 else if (!((String) sectors.get(0)[9]).isEmpty())2790 } else if (!((String) sectors.get(0)[9]).isEmpty()) { 2707 2791 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(0)[9])); 2708 if (!((String) sectors.get(i)[10]).isEmpty()) 2792 } 2793 if (!((String) sectors.get(i)[10]).isEmpty()) { 2709 2794 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(i)[10])); 2710 else if (!((String) sectors.get(0)[10]).isEmpty())2795 } else if (!((String) sectors.get(0)[10]).isEmpty()) { 2711 2796 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(0)[10])); 2712 if (sectors.get(i)[11] != Vis.UNKVIS) 2797 } 2798 if (sectors.get(i)[11] != Vis.UNKVIS) { 2713 2799 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11]))); 2714 else if (sectors.get(0)[11] != Vis.UNKVIS)2800 } else if (sectors.get(0)[11] != Vis.UNKVIS) { 2715 2801 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(0)[11]))); 2716 if (sectors.get(i)[12] != Exh.UNKEXH) 2802 } 2803 if (sectors.get(i)[12] != Exh.UNKEXH) { 2717 2804 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12]))); 2718 else if (sectors.get(0)[12] != Exh.UNKEXH)2805 } else if (sectors.get(0)[12] != Exh.UNKEXH) { 2719 2806 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(0)[12]))); 2720 if (!((String) sectors.get(i)[13]).isEmpty()) 2807 } 2808 if (!((String) sectors.get(i)[13]).isEmpty()) { 2721 2809 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String) sectors.get(i)[13])); 2722 if (!((String) sectors.get(i)[14]).isEmpty()) 2810 } 2811 if (!((String) sectors.get(i)[14]).isEmpty()) { 2723 2812 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(i)[14])); 2724 else if (!((String) sectors.get(0)[14]).isEmpty())2813 } else if (!((String) sectors.get(0)[14]).isEmpty()) { 2725 2814 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(0)[14])); 2815 } 2726 2816 } 2727 2817 2728 2818 if (getFogSound() != Fog.NOFOG) { 2729 if (getFogSound() == Fog.FOGSIG) 2819 if (getFogSound() == Fog.FOGSIG) { 2730 2820 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes")); 2731 else2821 } else { 2732 2822 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", FogSTR.get(getFogSound()))); 2823 } 2733 2824 if (!getFogGroup().isEmpty()) { 2734 2825 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup())); -
applications/editors/josm/plugins/smed/src/smed/Smed.java
r32767 r32911 10 10 11 11 SmedAction dialog = new SmedAction(); 12 12 13 13 public Smed(PluginInformation info) { 14 14 super(info); 15 15 MainMenu.add(Main.main.menu.toolsMenu, dialog); 16 16 } 17 17 18 @Override 18 19 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 19 20 if (newFrame == null) { -
applications/editors/josm/plugins/smed/src/smed/SmedAction.java
r32767 r32911 46 46 public void actionPerformed(ActionEvent arg0) { 47 47 SwingUtilities.invokeLater(new Runnable() { 48 @Override 48 49 public void run() { 49 if (!isOpen) 50 if (!isOpen) { 50 51 createFrame(); 51 else52 } else { 52 53 editFrame.toFront(); 54 } 53 55 isOpen = true; 54 56 } … … 60 62 editFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 61 63 editFrame.addWindowListener(new java.awt.event.WindowAdapter() { 64 @Override 62 65 public void windowClosing(java.awt.event.WindowEvent e) { 63 66 closeDialog(); … … 94 97 95 98 for (OsmPrimitive osm : selection) { 96 nextNode = (OsmPrimitive)osm;99 nextNode = osm; 97 100 if (selection.size() == 1) { 98 101 if (nextNode.compareTo(node) != 0) {
Note:
See TracChangeset
for help on using the changeset viewer.