Changeset 26552 in osm for applications
- Timestamp:
- 2011-08-20T20:56:18+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r26549 r26552 18 18 import oseam.seamarks.SeaMark.Cat; 19 19 import oseam.seamarks.SeaMark.Col; 20 import oseam.seamarks.SeaMark.Pat; 20 21 import oseam.seamarks.SeaMark.Ent; 21 22 import oseam.seamarks.SeaMark.Shp; … … 144 145 } 145 146 if (safeWaterButton.isSelected()) { 147 dlg.mark.setCategory(Cat.UNKNOWN); 148 dlg.mark.setColour(Ent.BODY, Col.RED); 149 dlg.mark.addColour(Ent.BODY, Col.WHITE); 150 dlg.mark.setPattern(Ent.BODY, Pat.VERT); 146 151 if (panelSaw.shapes.containsKey(shp)) { 147 152 panelSaw.shapes.get(shp).doClick(); … … 150 155 dlg.mark.setShape(Shp.UNKNOWN); 151 156 } 152 dlg.mark.setColour(Ent.BODY, Col.RED);153 dlg.mark.addColour(Ent.BODY, Col.WHITE);154 157 safeWaterButton.setBorderPainted(true); 155 158 panelSaw.setVisible(true); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r26547 r26552 249 249 }; 250 250 saveButton.addActionListener(alSave); 251 this.clearSelections(); 251 252 } 252 253 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r26549 r26552 102 102 button.setBorderPainted(false); 103 103 } 104 dlg.mark.paintSign(); 104 if (dlg.mark != null) 105 dlg.mark.paintSign(); 105 106 } 106 107 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSaw.java
r26423 r26552 40 40 button.setBorderPainted(false); 41 41 } 42 dlg.mark.paintSign(); 42 if (dlg.mark != null) 43 dlg.mark.paintSign(); 43 44 } 44 45 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r26549 r26552 102 102 button.setBorderPainted(false); 103 103 } 104 dlg.mark.paintSign(); 104 if (dlg.mark != null) 105 dlg.mark.paintSign(); 105 106 } 106 107 }; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r26550 r26552 52 52 public static final EnumMap<Obj, String> ObjMAP = new EnumMap<Obj, String>(Obj.class); 53 53 static { 54 ObjMAP.put(Obj.UNKNOWN, "");55 54 ObjMAP.put(Obj.BCNCAR, "beacon_cardinal"); 56 55 ObjMAP.put(Obj.BCNISD, "beacon_isolated_danger"); … … 144 143 public static final EnumMap<Cat, String> CatMAP = new EnumMap<Cat, String>(Cat.class); 145 144 static { 146 CatMAP.put(Cat.UNKNOWN, "");147 145 CatMAP.put(Cat.LAT_PORT, "port"); 148 146 CatMAP.put(Cat.LAT_STBD, "starboard"); … … 172 170 public static final EnumMap<Shp, String> ShpMAP = new EnumMap<Shp, String>(Shp.class); 173 171 static { 174 ShpMAP.put(Shp.UNKNOWN, "");175 172 ShpMAP.put(Shp.PILLAR, "pillar"); 176 173 ShpMAP.put(Shp.SPAR, "spar"); … … 203 200 public static final EnumMap<Col, String> ColMAP = new EnumMap<Col, String>(Col.class); 204 201 static { 205 ColMAP.put(Col.UNKNOWN, "");206 202 ColMAP.put(Col.WHITE, "white"); 207 203 ColMAP.put(Col.RED, "red"); … … 335 331 public static final EnumMap<Pat, String> PatMAP = new EnumMap<Pat, String>(Pat.class); 336 332 static { 337 PatMAP.put(Pat.NONE, "");338 333 PatMAP.put(Pat.HORIZ, "horizontal_stripes"); 339 334 PatMAP.put(Pat.VERT, "vertical_stripes"); … … 385 380 public static final EnumMap<Top, String> TopMAP = new EnumMap<Top, String>(Top.class); 386 381 static { 387 TopMAP.put(Top.NONE, "");388 382 TopMAP.put(Top.CAN, "cylinder"); 389 383 TopMAP.put(Top.CONE, "cylinder"); … … 417 411 public static final EnumMap<Day, String> DayMAP = new EnumMap<Day, String>(Day.class); 418 412 static { 419 DayMAP.put(Day.NONE, "");420 413 DayMAP.put(Day.BOARD, "board"); 421 414 DayMAP.put(Day.DIAMOND, "diamond"); … … 638 631 else if (str.equals("iala-b")) 639 632 setRegion(Reg.B); 640 else setRegion(Reg.C); 633 else 634 setRegion(Reg.C); 641 635 } else if (GrpMAP.get(object) == Grp.LAT) { 642 636 if (getCategory() != Cat.UNKNOWN) { … … 707 701 dlg.panelMain.chanButton.doClick(); 708 702 if (getColour(Ent.FLOAT, 1) == Col.WHITE) 709 dlg.panelMain.panelChan.safeWaterButton.doClick(); 703 if (getColour(Ent.FLOAT, 2) == Col.RED) { 704 dlg.panelMain.panelChan.portButton.doClick(); 705 setRegion(Reg.C); 706 } else 707 dlg.panelMain.panelChan.safeWaterButton.doClick(); 710 708 else if (getColour(Ent.FLOAT, 1) == Col.GREEN) 711 709 if (getRegion().equals("B")) … … 847 845 public void saveSign(Node node) { 848 846 849 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A")); 850 851 for (String str : node.getKeys().keySet()) { 852 if (str.trim().matches("^seamark:\\S+")) 853 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 854 } 855 856 if (!getName().isEmpty()) 857 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName())); 858 859 String objStr = ObjMAP.get(object); 860 if (objStr != null) { 861 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr)); 862 863 String str = CatMAP.get(category); 864 if (str != null) 865 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 866 867 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpMAP.get(shape))); 868 869 if (getColour(Ent.BODY, 0) != Col.UNKNOWN) { 870 str = ColMAP.get(getColour(Ent.BODY, 0)); 871 for (int i = 1; bodyColour.size() > i; i++) { 872 str += (";" + ColMAP.get(getColour(Ent.BODY, i))); 847 if (getObject() != Obj.UNKNOWN) { 848 849 Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A")); 850 851 for (String str : node.getKeys().keySet()) { 852 if (str.trim().matches("^seamark:\\S+")) 853 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 854 } 855 856 if (!getName().isEmpty()) 857 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName())); 858 859 String objStr = ObjMAP.get(object); 860 if (objStr != null) { 861 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr)); 862 863 if (getShape() != Shp.FLOAT) { 864 String str = CatMAP.get(category); 865 if (str != null) 866 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 867 if (getShape() != Shp.BEACON) 868 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpMAP.get(getShape()))); 873 869 } 874 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str)); 875 } 876 877 if (getPattern(Ent.BODY) != Pat.NONE) { 878 str = PatMAP.get(getPattern(Ent.BODY)); 879 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", str)); 880 } 881 882 if (GrpMAP.get(object) == Grp.LAT) { 883 switch (region) { 884 case A: 885 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-a")); 886 break; 887 case B: 888 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-b")); 889 break; 890 case C: 891 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "other")); 892 break; 870 871 if ((getColour(Ent.BODY, 0) != Col.UNKNOWN) && getShape() != Shp.PERCH) { 872 String str = ColMAP.get(getColour(Ent.BODY, 0)); 873 for (int i = 1; bodyColour.size() > i; i++) { 874 str += (";" + ColMAP.get(getColour(Ent.BODY, i))); 875 } 876 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str)); 893 877 } 894 } 895 896 /* 897 * switch (bodyColour) { case RED_GREEN_RED: case GREEN_RED_GREEN: case 898 * BLACK_YELLOW: case BLACK_YELLOW_BLACK: case YELLOW_BLACK: case 899 * YELLOW_BLACK_YELLOW: case BLACK_RED_BLACK: Main.main.undoRedo.add(new 900 * ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", 901 * "horizontal stripes")); break; case RED_WHITE: 902 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + 903 * objStr + ":colour_pattern", "vertical stripes")); break; } 904 */} 905 906 /* 907 * String str = TopMAP.get(topShape); if (str != null) { 908 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 909 * "seamark:topmark:shape", str)); 910 * 911 * str = ColMAP.get(topColour); if (str != null) Main.main.undoRedo.add(new 912 * ChangePropertyCommand(node, "seamark:topmark:colour", str)); } 913 * 914 * str = DayMAP.get(dayShape); if (str != null) { Main.main.undoRedo.add(new 915 * ChangePropertyCommand(node, "seamark:daymark:shape", str)); 916 * 917 * str = ColMAP.get(dayColour); if (str != null) Main.main.undoRedo.add(new 918 * ChangePropertyCommand(node, "seamark:daymark:colour", str)); } /* Col 919 * colour; if (isFired()) { if ((colour = lightColour[0]) != Col.UNKNOWN) if 920 * (colour == Col.RED) { Main.main.undoRedo.add(new 921 * ChangePropertyCommand(node, "seamark:light:colour", "red")); } else if 922 * (colour.equals("G")) { Main.main.undoRedo.add(new 923 * ChangePropertyCommand(node, "seamark:light:colour", "green")); } else if 924 * (colour.equals("W")) { Main.main.undoRedo.add(new 925 * ChangePropertyCommand(node, "seamark:light:colour", "white")); } if 926 * (!LightPeriod[0].isEmpty()) Main.main.undoRedo.add(new 927 * ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0])); if 928 * (!LightChar[0].isEmpty()) Main.main.undoRedo.add(new 929 * ChangePropertyCommand(node, "seamark:light:character", LightChar[0])); if 930 * (!LightGroup[0].isEmpty()) Main.main.undoRedo.add(new 931 * ChangePropertyCommand(node, "seamark:light:group", LightGroup[0])); if 932 * (!Height[0].isEmpty()) Main.main.undoRedo.add(new 933 * ChangePropertyCommand(node, "seamark:light:height", Height[0])); if 934 * (!Range[0].isEmpty()) Main.main.undoRedo.add(new 935 * ChangePropertyCommand(node, "seamark:light:range", Range[0])); for (int i 936 * = 1; i < 10; i++) { if ((colour = lightColour[i]) != Col.UNKNOWN) // if 937 * (colour.equals("R")) { // Main.main.undoRedo.add(new 938 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red")); // 939 * if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != 940 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node, 941 * "seamark:light:" + i, "red:" + Bearing1[i] + ":" // + Bearing2[i] + ":" + 942 * Radius[i])); // } else if (colour.equals("G")) { // 943 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 944 * i + ":colour", "green")); // if ((Bearing1[i] != null) && (Bearing2[i] != 945 * null) && (Radius[i] != null)) // Main.main.undoRedo.add(new 946 * ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] 947 * + ":" // + Bearing2[i] + ":" + Radius[i])); // } else if 948 * (colour.equals("W")) { // Main.main.undoRedo.add(new 949 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white")); 950 * // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != 951 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node, 952 * "seamark:light:" + i, "white:" + Bearing1[i] + ":" // + Bearing2[i] + ":" 953 * + Radius[i])); // } if (LightPeriod[i] != null) 954 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 955 * i + ":period", LightPeriod[i])); if (LightChar[i] != null) 956 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 957 * i + ":character", LightChar[i])); if (LightGroup[i] != null) 958 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 959 * i + ":group", LightGroup[i])); if (Height[i] != null) 960 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 961 * i + ":height", Height[i])); if (Range[i] != null) 962 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 963 * i + ":range", Range[i])); if (Bearing1[i] != null) 964 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 965 * i + ":sector_start", Bearing1[i])); if (Bearing2[i] != null) 966 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + 967 * i + ":sector_end", Bearing2[i])); } } 968 */ 969 /* 970 * if (hasRadar()) { Main.main.undoRedo.add(new ChangePropertyCommand(node, 971 * "seamark:radar_reflector", "yes")); } if (hasRacon()) { switch (RaType) { 972 * case RACON: Main.main.undoRedo.add(new ChangePropertyCommand(node, 973 * "seamark:radar_transponder:category", "racon")); if 974 * (!getRaconGroup().isEmpty()) Main.main.undoRedo.add(new 975 * ChangePropertyCommand(node, "seamark:radar_transponder:group", 976 * getRaconGroup())); break; case RAMARK: Main.main.undoRedo.add(new 977 * ChangePropertyCommand(node, "seamark:radar_transponder:category", 978 * "ramark")); break; case LEADING: Main.main.undoRedo.add(new 979 * ChangePropertyCommand(node, "seamark:radar_transponder:category", 980 * "leading")); break; default: Main.main.undoRedo.add(new 981 * ChangePropertyCommand(node, "seamark:radar_transponder", "yes")); } } if 982 * (hasFog()) { switch (getFogSound()) { case HORN: 983 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 984 * "seamark:fog_signal:category", "horn")); break; case SIREN: 985 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 986 * "seamark:fog_signal:category", "siren")); break; case DIA: 987 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 988 * "seamark:fog_signal:category", "diaphone")); break; case BELL: 989 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 990 * "seamark:fog_signal:category", "bell")); break; case WHIS: 991 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 992 * "seamark:fog_signal:category", "whistle")); break; case GONG: 993 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 994 * "seamark:fog_signal:category", "gong")); break; case EXPLOS: 995 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 996 * "seamark:fog_signal:category", "explosive")); break; default: 997 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 998 * "seamark:fog_signal", "yes")); } if (!getFogGroup().isEmpty()) 999 * Main.main.undoRedo.add(new ChangePropertyCommand(node, 1000 * "seamark:fog_signal:group", getFogGroup())); if 1001 * (!getFogPeriod().isEmpty()) Main.main.undoRedo.add(new 1002 * ChangePropertyCommand(node, "seamark:fog_signal:period", 1003 * getFogPeriod())); } 1004 */} 878 879 if (getPattern(Ent.BODY) != Pat.NONE) { 880 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatMAP.get(getPattern(Ent.BODY)))); 881 } 882 883 if (((GrpMAP.get(object) == Grp.LAT) && getShape() != Shp.PERCH) || getShape() == Shp.FLOAT) { 884 switch (region) { 885 case A: 886 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-a")); 887 break; 888 case B: 889 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "iala-b")); 890 break; 891 case C: 892 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":system", "other")); 893 break; 894 } 895 } 896 } 897 } 898 } 1005 899 1006 900 }
Note:
See TracChangeset
for help on using the changeset viewer.