Changeset 26555 in osm for applications/editors
- Timestamp:
- 2011-08-22T09:22:57+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java
r26554 r26555 18 18 import oseam.seamarks.SeaMark.Col; 19 19 import oseam.seamarks.SeaMark.Ent; 20 import oseam.seamarks.SeaMark.Pat; 20 21 import oseam.seamarks.SeaMark.Shp; 21 22 import oseam.seamarks.SeaMark.Obj; … … 32 33 private ActionListener alCat = new ActionListener() { 33 34 public void actionPerformed(java.awt.event.ActionEvent e) { 35 Shp shp = Shp.UNKNOWN; 36 if (dlg.mark != null) 37 shp = dlg.mark.getShape(); 34 38 if (northButton.isSelected()) { 35 39 dlg.mark.setCategory(Cat.CARD_NORTH); 36 40 dlg.mark.setColour(Ent.BODY, Col.BLACK); 37 41 dlg.mark.addColour(Ent.BODY, Col.YELLOW); 42 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ); 43 if (shapes.containsKey(shp)) { 44 shapes.get(shp).doClick(); 45 } else { 46 clearSelections(); 47 dlg.mark.setShape(Shp.UNKNOWN); 48 } 38 49 northButton.setBorderPainted(true); 39 50 } else { … … 44 55 dlg.mark.setColour(Ent.BODY, Col.YELLOW); 45 56 dlg.mark.addColour(Ent.BODY, Col.BLACK); 57 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ); 58 if (shapes.containsKey(shp)) { 59 shapes.get(shp).doClick(); 60 } else { 61 clearSelections(); 62 dlg.mark.setShape(Shp.UNKNOWN); 63 } 46 64 southButton.setBorderPainted(true); 47 65 } else { … … 53 71 dlg.mark.addColour(Ent.BODY, Col.YELLOW); 54 72 dlg.mark.addColour(Ent.BODY, Col.BLACK); 73 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ); 74 if (shapes.containsKey(shp)) { 75 shapes.get(shp).doClick(); 76 } else { 77 clearSelections(); 78 dlg.mark.setShape(Shp.UNKNOWN); 79 } 55 80 eastButton.setBorderPainted(true); 56 81 } else { … … 62 87 dlg.mark.addColour(Ent.BODY, Col.BLACK); 63 88 dlg.mark.addColour(Ent.BODY, Col.YELLOW); 89 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ); 90 if (shapes.containsKey(shp)) { 91 shapes.get(shp).doClick(); 92 } else { 93 clearSelections(); 94 dlg.mark.setShape(Shp.UNKNOWN); 95 } 64 96 westButton.setBorderPainted(true); 65 97 } else { … … 70 102 dlg.mark.addColour(Ent.BODY, Col.RED); 71 103 dlg.mark.addColour(Ent.BODY, Col.BLACK); 104 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ); 105 if (shapes.containsKey(shp)) { 106 shapes.get(shp).doClick(); 107 } else { 108 clearSelections(); 109 dlg.mark.setShape(Shp.UNKNOWN); 110 } 72 111 isolButton.setBorderPainted(true); 73 112 } else { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r26553 r26555 50 50 } 51 51 52 public static final EnumMap<Obj, String> Obj MAP= new EnumMap<Obj, String>(Obj.class);52 public static final EnumMap<Obj, String> ObjSTR = new EnumMap<Obj, String>(Obj.class); 53 53 static { 54 Obj MAP.put(Obj.BCNCAR, "beacon_cardinal");55 Obj MAP.put(Obj.BCNISD, "beacon_isolated_danger");56 Obj MAP.put(Obj.BCNLAT, "beacon_lateral");57 Obj MAP.put(Obj.BCNSAW, "beacon_safe_water");58 Obj MAP.put(Obj.BCNSPP, "beacon_special_purpose");59 Obj MAP.put(Obj.BOYCAR, "buoy_cardinal");60 Obj MAP.put(Obj.BOYISD, "buoy_isolated_danger");61 Obj MAP.put(Obj.BOYLAT, "buoy_lateral");62 Obj MAP.put(Obj.BOYSAW, "buoy_safe_water");63 Obj MAP.put(Obj.BOYSPP, "buoy_special_purpose");64 Obj MAP.put(Obj.FLTCAR, "light_float");65 Obj MAP.put(Obj.FLTLAT, "light_float");66 Obj MAP.put(Obj.FLTSAW, "light_float");67 Obj MAP.put(Obj.FLTSPP, "light_float");68 Obj MAP.put(Obj.LITMAJ, "light_major");69 Obj MAP.put(Obj.LITMIN, "light_minor");70 Obj MAP.put(Obj.LITFLT, "light_float");71 Obj MAP.put(Obj.LITVES, "light_vessel");72 Obj MAP.put(Obj.LNDMRK, "landmark");73 Obj MAP.put(Obj.MORFAC, "mooring");74 Obj MAP.put(Obj.SIGSTA, "signal_station_warning");75 Obj MAP.put(Obj.SIGSTA, "signal_station_traffic");54 ObjSTR.put(Obj.BCNCAR, "beacon_cardinal"); 55 ObjSTR.put(Obj.BCNISD, "beacon_isolated_danger"); 56 ObjSTR.put(Obj.BCNLAT, "beacon_lateral"); 57 ObjSTR.put(Obj.BCNSAW, "beacon_safe_water"); 58 ObjSTR.put(Obj.BCNSPP, "beacon_special_purpose"); 59 ObjSTR.put(Obj.BOYCAR, "buoy_cardinal"); 60 ObjSTR.put(Obj.BOYISD, "buoy_isolated_danger"); 61 ObjSTR.put(Obj.BOYLAT, "buoy_lateral"); 62 ObjSTR.put(Obj.BOYSAW, "buoy_safe_water"); 63 ObjSTR.put(Obj.BOYSPP, "buoy_special_purpose"); 64 ObjSTR.put(Obj.FLTCAR, "light_float"); 65 ObjSTR.put(Obj.FLTLAT, "light_float"); 66 ObjSTR.put(Obj.FLTSAW, "light_float"); 67 ObjSTR.put(Obj.FLTSPP, "light_float"); 68 ObjSTR.put(Obj.LITMAJ, "light_major"); 69 ObjSTR.put(Obj.LITMIN, "light_minor"); 70 ObjSTR.put(Obj.LITFLT, "light_float"); 71 ObjSTR.put(Obj.LITVES, "light_vessel"); 72 ObjSTR.put(Obj.LNDMRK, "landmark"); 73 ObjSTR.put(Obj.MORFAC, "mooring"); 74 ObjSTR.put(Obj.SIGSTA, "signal_station_warning"); 75 ObjSTR.put(Obj.SIGSTA, "signal_station_traffic"); 76 76 } 77 77 … … 141 141 } 142 142 143 public static final EnumMap<Cat, String> Cat MAP= new EnumMap<Cat, String>(Cat.class);143 public static final EnumMap<Cat, String> CatSTR = new EnumMap<Cat, String>(Cat.class); 144 144 static { 145 Cat MAP.put(Cat.LAT_PORT, "port");146 Cat MAP.put(Cat.LAT_STBD, "starboard");147 Cat MAP.put(Cat.LAT_PREF_PORT, "preferred_channel_port");148 Cat MAP.put(Cat.LAT_PREF_STBD, "preferred_channel_starboard");149 Cat MAP.put(Cat.CARD_NORTH, "north");150 Cat MAP.put(Cat.CARD_EAST, "east");151 Cat MAP.put(Cat.CARD_SOUTH, "south");152 Cat MAP.put(Cat.CARD_WEST, "west");153 Cat MAP.put(Cat.MOORING_BUOY, "mooring_buoy");145 CatSTR.put(Cat.LAT_PORT, "port"); 146 CatSTR.put(Cat.LAT_STBD, "starboard"); 147 CatSTR.put(Cat.LAT_PREF_PORT, "preferred_channel_port"); 148 CatSTR.put(Cat.LAT_PREF_STBD, "preferred_channel_starboard"); 149 CatSTR.put(Cat.CARD_NORTH, "north"); 150 CatSTR.put(Cat.CARD_EAST, "east"); 151 CatSTR.put(Cat.CARD_SOUTH, "south"); 152 CatSTR.put(Cat.CARD_WEST, "west"); 153 CatSTR.put(Cat.MOORING_BUOY, "mooring_buoy"); 154 154 } 155 155 … … 168 168 } 169 169 170 public static final EnumMap<Shp, String> Shp MAP= new EnumMap<Shp, String>(Shp.class);170 public static final EnumMap<Shp, String> ShpSTR = new EnumMap<Shp, String>(Shp.class); 171 171 static { 172 Shp MAP.put(Shp.PILLAR, "pillar");173 Shp MAP.put(Shp.SPAR, "spar");174 Shp MAP.put(Shp.CAN, "can");175 Shp MAP.put(Shp.CONE, "conical");176 Shp MAP.put(Shp.SPHERE, "spherical");177 Shp MAP.put(Shp.BARREL, "barrel");178 Shp MAP.put(Shp.FLOAT, "float");179 Shp MAP.put(Shp.SUPER, "super-buoy");180 Shp MAP.put(Shp.BUOYANT, "buoyant");181 Shp MAP.put(Shp.CAIRN, "cairn");182 Shp MAP.put(Shp.PILE, "pile");183 Shp MAP.put(Shp.LATTICE, "lattice");184 Shp MAP.put(Shp.TOWER, "tower");185 Shp MAP.put(Shp.STAKE, "stake");186 Shp MAP.put(Shp.PERCH, "perch");172 ShpSTR.put(Shp.PILLAR, "pillar"); 173 ShpSTR.put(Shp.SPAR, "spar"); 174 ShpSTR.put(Shp.CAN, "can"); 175 ShpSTR.put(Shp.CONE, "conical"); 176 ShpSTR.put(Shp.SPHERE, "spherical"); 177 ShpSTR.put(Shp.BARREL, "barrel"); 178 ShpSTR.put(Shp.FLOAT, "float"); 179 ShpSTR.put(Shp.SUPER, "super-buoy"); 180 ShpSTR.put(Shp.BUOYANT, "buoyant"); 181 ShpSTR.put(Shp.CAIRN, "cairn"); 182 ShpSTR.put(Shp.PILE, "pile"); 183 ShpSTR.put(Shp.LATTICE, "lattice"); 184 ShpSTR.put(Shp.TOWER, "tower"); 185 ShpSTR.put(Shp.STAKE, "stake"); 186 ShpSTR.put(Shp.PERCH, "perch"); 187 187 } 188 188 … … 201 201 } 202 202 203 public static final EnumMap<Col, String> Col MAP= new EnumMap<Col, String>(Col.class);203 public static final EnumMap<Col, String> ColSTR = new EnumMap<Col, String>(Col.class); 204 204 static { 205 Col MAP.put(Col.WHITE, "white");206 Col MAP.put(Col.RED, "red");207 Col MAP.put(Col.ORANGE, "orange");208 Col MAP.put(Col.AMBER, "amber");209 Col MAP.put(Col.YELLOW, "yellow");210 Col MAP.put(Col.GREEN, "green");211 Col MAP.put(Col.BLUE, "blue");212 Col MAP.put(Col.VIOLET, "violet");213 Col MAP.put(Col.BLACK, "black");205 ColSTR.put(Col.WHITE, "white"); 206 ColSTR.put(Col.RED, "red"); 207 ColSTR.put(Col.ORANGE, "orange"); 208 ColSTR.put(Col.AMBER, "amber"); 209 ColSTR.put(Col.YELLOW, "yellow"); 210 ColSTR.put(Col.GREEN, "green"); 211 ColSTR.put(Col.BLUE, "blue"); 212 ColSTR.put(Col.VIOLET, "violet"); 213 ColSTR.put(Col.BLACK, "black"); 214 214 } 215 215 … … 381 381 } 382 382 383 public static final EnumMap<Top, String> Top MAP= new EnumMap<Top, String>(Top.class);383 public static final EnumMap<Top, String> TopSTR = new EnumMap<Top, String>(Top.class); 384 384 static { 385 Top MAP.put(Top.CAN, "cylinder");386 Top MAP.put(Top.CONE, "cylinder");387 Top MAP.put(Top.SPHERE, "SPHERE");388 Top MAP.put(Top.X_SHAPE, "X-SHAPE");389 Top MAP.put(Top.NORTH, "2 cones up");390 Top MAP.put(Top.SOUTH, "2 cones down");391 Top MAP.put(Top.EAST, "2 cones base together");392 Top MAP.put(Top.WEST, "2 cones points together");393 Top MAP.put(Top.SPHERES2, "2 spheres");385 TopSTR.put(Top.CAN, "cylinder"); 386 TopSTR.put(Top.CONE, "cylinder"); 387 TopSTR.put(Top.SPHERE, "SPHERE"); 388 TopSTR.put(Top.X_SHAPE, "X-SHAPE"); 389 TopSTR.put(Top.NORTH, "2 cones up"); 390 TopSTR.put(Top.SOUTH, "2 cones down"); 391 TopSTR.put(Top.EAST, "2 cones base together"); 392 TopSTR.put(Top.WEST, "2 cones points together"); 393 TopSTR.put(Top.SPHERES2, "2 spheres"); 394 394 } 395 395 … … 412 412 } 413 413 414 public static final EnumMap<Day, String> Day MAP= new EnumMap<Day, String>(Day.class);414 public static final EnumMap<Day, String> DaySTR = new EnumMap<Day, String>(Day.class); 415 415 static { 416 Day MAP.put(Day.BOARD, "board");417 Day MAP.put(Day.DIAMOND, "diamond");418 Day MAP.put(Day.CIRCLE, "circle");419 Day MAP.put(Day.TRIANGLE, "triangle, point up");420 Day MAP.put(Day.TRIANGLE_INV, "triangle, point down");421 Day MAP.put(Day.SQUARE, "square");416 DaySTR.put(Day.BOARD, "board"); 417 DaySTR.put(Day.DIAMOND, "diamond"); 418 DaySTR.put(Day.CIRCLE, "circle"); 419 DaySTR.put(Day.TRIANGLE, "triangle, point up"); 420 DaySTR.put(Day.TRIANGLE_INV, "triangle, point down"); 421 DaySTR.put(Day.SQUARE, "square"); 422 422 } 423 423 … … 540 540 541 541 setObject(Obj.UNKNOWN); 542 for (Obj obj : Obj MAP.keySet()) {543 if (Obj MAP.get(obj).equals(str)) {542 for (Obj obj : ObjSTR.keySet()) { 543 if (ObjSTR.get(obj).equals(str)) { 544 544 setObject(obj); 545 545 } … … 554 554 555 555 setName(""); 556 for (Obj obj : Obj MAP.keySet()) {557 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":name")) {558 str = keys.get("seamark:" + Obj MAP.get(obj) + ":name");556 for (Obj obj : ObjSTR.keySet()) { 557 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":name")) { 558 str = keys.get("seamark:" + ObjSTR.get(obj) + ":name"); 559 559 setName(str); 560 560 } … … 571 571 } 572 572 573 for (Obj obj : Obj MAP.keySet()) {574 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":category")) {575 str = keys.get("seamark:" + Obj MAP.get(obj) + ":category");573 for (Obj obj : ObjSTR.keySet()) { 574 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":category")) { 575 str = keys.get("seamark:" + ObjSTR.get(obj) + ":category"); 576 576 setCategory(Cat.UNKNOWN); 577 for (Cat cat : Cat MAP.keySet()) {578 if (Cat MAP.get(cat).equals(str)) {577 for (Cat cat : CatSTR.keySet()) { 578 if (CatSTR.get(cat).equals(str)) { 579 579 setCategory(cat); 580 580 } … … 583 583 } 584 584 585 for (Obj obj : Obj MAP.keySet()) {586 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":shape")) {587 str = keys.get("seamark:" + Obj MAP.get(obj) + ":shape");585 for (Obj obj : ObjSTR.keySet()) { 586 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":shape")) { 587 str = keys.get("seamark:" + ObjSTR.get(obj) + ":shape"); 588 588 setShape(Shp.UNKNOWN); 589 for (Shp shp : Shp MAP.keySet()) {590 if (Shp MAP.get(shp).equals(str)) {589 for (Shp shp : ShpSTR.keySet()) { 590 if (ShpSTR.get(shp).equals(str)) { 591 591 setShape(shp); 592 592 } … … 603 603 } 604 604 605 for (Obj obj : Obj MAP.keySet()) {606 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":colour")) {607 str = keys.get("seamark:" + Obj MAP.get(obj) + ":colour");605 for (Obj obj : ObjSTR.keySet()) { 606 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour")) { 607 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour"); 608 608 bodyColour.clear(); 609 609 for (String item : str.split(";")) { 610 for (Col col : Col MAP.keySet()) {611 if (Col MAP.get(col).equals(item)) {610 for (Col col : ColSTR.keySet()) { 611 if (ColSTR.get(col).equals(item)) { 612 612 bodyColour.add(col); 613 613 } … … 617 617 } 618 618 619 for (Obj obj : Obj MAP.keySet()) {620 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":colour_pattern")) {621 str = keys.get("seamark:" + Obj MAP.get(obj) + ":colour_pattern");619 for (Obj obj : ObjSTR.keySet()) { 620 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":colour_pattern")) { 621 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour_pattern"); 622 622 setPattern(Ent.BODY, Pat.NONE); 623 623 for (Pat pat : PatMAP.keySet()) { … … 629 629 } 630 630 631 for (Obj obj : Obj MAP.keySet()) {632 if (keys.containsKey("seamark:" + Obj MAP.get(obj) + ":system")) {633 str = keys.get("seamark:" + Obj MAP.get(obj) + ":system");631 for (Obj obj : ObjSTR.keySet()) { 632 if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":system")) { 633 str = keys.get("seamark:" + ObjSTR.get(obj) + ":system"); 634 634 if (str.equals("iala-a")) 635 635 setRegion(Reg.A); … … 710 710 break; 711 711 case CAR: 712 dlg.panelMain.hazButton.doClick(); 713 switch (getCategory()) { 714 case CARD_NORTH: 715 dlg.panelMain.panelHaz.northButton.doClick(); 716 break; 717 case CARD_SOUTH: 718 dlg.panelMain.panelHaz.southButton.doClick(); 719 break; 720 case CARD_EAST: 721 dlg.panelMain.panelHaz.eastButton.doClick(); 722 break; 723 case CARD_WEST: 724 dlg.panelMain.panelHaz.westButton.doClick(); 725 break; 726 } 727 break; 712 728 case ISD: 713 729 dlg.panelMain.hazButton.doClick(); 730 dlg.panelMain.panelHaz.isolButton.doClick(); 714 731 break; 715 732 case SPP: … … 767 784 case BLACK: 768 785 dlg.panelMain.hazButton.doClick(); 786 switch (getColour(Ent.FLOAT, 1)) { 787 case YELLOW: 788 if (getColour(Ent.FLOAT, 2) == Col.BLACK) 789 dlg.panelMain.panelHaz.eastButton.doClick(); 790 else 791 dlg.panelMain.panelHaz.northButton.doClick(); 792 break; 793 case RED: 794 dlg.panelMain.panelHaz.isolButton.doClick(); 795 break; 796 } 769 797 break; 770 798 case YELLOW: 771 if (getColour(Ent.FLOAT, 1) == Col.BLACK) 799 if (getColour(Ent.FLOAT, 1) == Col.BLACK) { 772 800 dlg.panelMain.hazButton.doClick(); 773 else 801 if (getColour(Ent.FLOAT, 2) == Col.YELLOW) 802 dlg.panelMain.panelHaz.westButton.doClick(); 803 else 804 dlg.panelMain.panelHaz.southButton.doClick(); 805 } else { 774 806 dlg.panelMain.specButton.doClick(); 807 } 775 808 break; 776 809 } … … 896 929 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName())); 897 930 898 String objStr = Obj MAP.get(object);931 String objStr = ObjSTR.get(object); 899 932 if (objStr != null) { 900 933 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr)); 901 934 902 935 if (getShape() != Shp.FLOAT) { 903 String str = Cat MAP.get(category);936 String str = CatSTR.get(category); 904 937 if (str != null) 905 938 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 906 939 if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON)) 907 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", Shp MAP.get(getShape())));940 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape()))); 908 941 } 909 942 910 943 if ((getColour(Ent.BODY, 0) != Col.UNKNOWN) && getShape() != Shp.PERCH) { 911 String str = Col MAP.get(getColour(Ent.BODY, 0));944 String str = ColSTR.get(getColour(Ent.BODY, 0)); 912 945 for (int i = 1; bodyColour.size() > i; i++) { 913 str += (";" + Col MAP.get(getColour(Ent.BODY, i)));946 str += (";" + ColSTR.get(getColour(Ent.BODY, i))); 914 947 } 915 948 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str));
Note:
See TracChangeset
for help on using the changeset viewer.