Changeset 25145 in osm for applications/editors/josm/plugins
- Timestamp:
- 2011-01-25T13:34:14+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/build.xml
r24778 r25145 28 28 ** 29 29 --> 30 <project name=" SeaMapEditor" basedir=".">30 <project name="smed" basedir="."> 31 31 32 32 <!-- enter the SVN commit message --> -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
r24931 r25145 33 33 Selection = newSelection; 34 34 35 // System.out.println("hello");36 35 for (OsmPrimitive osm : Selection) { 37 36 if (osm instanceof Node) { … … 41 40 node = nextNode; 42 41 mark = new SeaMark(dlg); 42 mark.parseMark(node); 43 43 } 44 44 } else … … 57 57 public OSeaMAction(SmedPluginManager mngr) { 58 58 59 // System.out.println("hello"); 59 60 dlg = this; 60 61 manager = mngr; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r24981 r25145 9 9 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.osm.Node; 11 12 import org.openstreetmap.josm.command.ChangePropertyCommand; 12 13 … … 18 19 public OSeaMAction dlg = null; 19 20 21 public SeaMark(OSeaMAction dia) { 22 dlg = dia; 23 } 24 20 25 public enum Reg { 21 26 A, B … … 598 603 private boolean paintlock = false; 599 604 600 public SeaMark(OSeaMAction dia) { 601 dlg = dia; 602 dlg.mark = this; 605 public void parseMark(Node node) { 603 606 region = Main.pref.get("tomsplugin.IALA").equals("A") ? Reg.A : Reg.B; 604 607 paintlock = true; … … 609 612 String str = ""; 610 613 611 Map<String, String> keys = dlg.node.getKeys();614 Map<String, String> keys = node.getKeys(); 612 615 613 616 if (keys.containsKey("seamark:type")) … … 1066 1069 } 1067 1070 1068 public void saveSign( ) {1071 public void saveSign(Node node) { 1069 1072 1070 1073 Main.pref.put("tomsplugin.IALA", getRegion() == Reg.A ? "A" : "B"); 1071 1074 1072 for (String str : dlg.node.getKeys().keySet()) {1075 for (String str : node.getKeys().keySet()) { 1073 1076 if (str.contains("seamark")) 1074 1077 if (!str.equals("seamark")) { 1075 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, str, null));1078 Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null)); 1076 1079 } 1077 1080 } 1078 1081 if (!name.isEmpty()) 1079 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:name", name));1082 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", name)); 1080 1083 1081 1084 String objStr = objects.get(object); 1082 1085 if (objStr != null) { 1083 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:type", objStr));1086 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:type", objStr)); 1084 1087 1085 1088 String str = categories.get(category); 1086 1089 if (str != null) 1087 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:" + objStr + ":category", str));1088 1089 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:" + objStr + ":shape", shapes.get(shape)));1090 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str)); 1091 1092 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", shapes.get(shape))); 1090 1093 1091 1094 str = colours.get(bodyColour); 1092 1095 if (str != null) 1093 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:" + objStr + ":colour", str));1096 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour", str)); 1094 1097 1095 1098 switch (bodyColour) { … … 1101 1104 case YELLOW_BLACK_YELLOW: 1102 1105 case BLACK_RED_BLACK: 1103 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:" + objStr + ":colour_pattern", "horizontal stripes"));1106 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", "horizontal stripes")); 1104 1107 break; 1105 1108 case RED_WHITE: 1106 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:" + objStr + ":colour_pattern", "vertical stripes"));1109 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", "vertical stripes")); 1107 1110 break; 1108 1111 } … … 1111 1114 String str = tops.get(topShape); 1112 1115 if (str != null) { 1113 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:topmark:shape", str));1116 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", str)); 1114 1117 1115 1118 str = colours.get(topColour); 1116 1119 if (str != null) 1117 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:topmark:colour", str));1120 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour", str)); 1118 1121 } 1119 1122 1120 1123 str = days.get(dayShape); 1121 1124 if (str != null) { 1122 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:daymark:shape", str));1125 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:daymark:shape", str)); 1123 1126 1124 1127 str = colours.get(dayColour); 1125 1128 if (str != null) 1126 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:daymark:colour", str));1129 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:daymark:colour", str)); 1127 1130 } 1128 1131 … … 1131 1134 if ((colour = lightColour[0]) != Col.UNKNOWN) 1132 1135 if (colour == Col.RED) { 1133 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:colour", "red"));1136 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "red")); 1134 1137 } else if (colour.equals("G")) { 1135 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:colour", "green"));1138 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "green")); 1136 1139 } else if (colour.equals("W")) { 1137 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:colour", "white"));1140 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "white")); 1138 1141 } 1139 1142 if (!LightPeriod[0].isEmpty()) 1140 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:period", LightPeriod[0]));1143 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0])); 1141 1144 if (!LightChar[0].isEmpty()) 1142 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:character", LightChar[0]));1145 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:character", LightChar[0])); 1143 1146 if (!LightGroup[0].isEmpty()) 1144 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:group", LightGroup[0]));1147 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:group", LightGroup[0])); 1145 1148 if (!Height[0].isEmpty()) 1146 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:height", Height[0]));1149 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:height", Height[0])); 1147 1150 if (!Range[0].isEmpty()) 1148 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:range", Range[0]));1151 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:range", Range[0])); 1149 1152 for (int i = 1; i < 10; i++) { 1150 1153 if ((colour = lightColour[i]) != Col.UNKNOWN) 1151 1154 if (colour.equals("R")) { 1152 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":colour", "red"));1155 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red")); 1153 1156 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 1154 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i, "red:" + Bearing1[i] + ":"1157 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "red:" + Bearing1[i] + ":" 1155 1158 + Bearing2[i] + ":" + Radius[i])); 1156 1159 } else if (colour.equals("G")) { 1157 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":colour", "green"));1160 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "green")); 1158 1161 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 1159 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i, "green:" + Bearing1[i] + ":"1162 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] + ":" 1160 1163 + Bearing2[i] + ":" + Radius[i])); 1161 1164 } else if (colour.equals("W")) { 1162 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":colour", "white"));1165 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white")); 1163 1166 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null)) 1164 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i, "white:" + Bearing1[i] + ":"1167 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "white:" + Bearing1[i] + ":" 1165 1168 + Bearing2[i] + ":" + Radius[i])); 1166 1169 } 1167 1170 if (LightPeriod[i] != null) 1168 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":period", LightPeriod[i]));1171 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":period", LightPeriod[i])); 1169 1172 if (LightChar[i] != null) 1170 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":character", LightChar[i]));1173 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":character", LightChar[i])); 1171 1174 if (LightGroup[i] != null) 1172 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":group", LightGroup[i]));1175 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":group", LightGroup[i])); 1173 1176 if (Height[i] != null) 1174 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":height", Height[i]));1177 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":height", Height[i])); 1175 1178 if (Range[i] != null) 1176 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":range", Range[i]));1179 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":range", Range[i])); 1177 1180 if (Bearing1[i] != null) 1178 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":sector_start", Bearing1[i]));1181 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_start", Bearing1[i])); 1179 1182 if (Bearing2[i] != null) 1180 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:light:" + i + ":sector_end", Bearing2[i]));1183 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_end", Bearing2[i])); 1181 1184 } 1182 1185 } 1183 1186 if (hasRadar()) { 1184 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_reflector", "yes"));1187 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes")); 1185 1188 } 1186 1189 if (hasRacon()) { 1187 1190 switch (RaType) { 1188 1191 case RACON: 1189 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_transponder:category", "racon"));1192 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", "racon")); 1190 1193 if (!getRaconGroup().isEmpty()) 1191 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_transponder:group", getRaconGroup()));1194 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:group", getRaconGroup())); 1192 1195 break; 1193 1196 case RAMARK: 1194 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_transponder:category", "ramark"));1197 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", "ramark")); 1195 1198 break; 1196 1199 case LEADING: 1197 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_transponder:category", "leading"));1200 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", "leading")); 1198 1201 break; 1199 1202 default: 1200 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:radar_transponder", "yes"));1203 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder", "yes")); 1201 1204 } 1202 1205 } … … 1204 1207 switch (getFogSound()) { 1205 1208 case HORN: 1206 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "horn"));1209 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "horn")); 1207 1210 break; 1208 1211 case SIREN: 1209 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "siren"));1212 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "siren")); 1210 1213 break; 1211 1214 case DIA: 1212 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "diaphone"));1215 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "diaphone")); 1213 1216 break; 1214 1217 case BELL: 1215 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "bell"));1218 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "bell")); 1216 1219 break; 1217 1220 case WHIS: 1218 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "whistle"));1221 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "whistle")); 1219 1222 break; 1220 1223 case GONG: 1221 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "gong"));1224 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "gong")); 1222 1225 break; 1223 1226 case EXPLOS: 1224 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:category", "explosive"));1227 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", "explosive")); 1225 1228 break; 1226 1229 default: 1227 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal", "yes"));1230 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes")); 1228 1231 } 1229 1232 if (!getFogGroup().isEmpty()) 1230 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:group", getFogGroup()));1233 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup())); 1231 1234 if (!getFogPeriod().isEmpty()) 1232 Main.main.undoRedo.add(new ChangePropertyCommand( dlg.node, "seamark:fog_signal:period", getFogPeriod()));1235 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:period", getFogPeriod())); 1233 1236 } 1234 1237 }
Note:
See TracChangeset
for help on using the changeset viewer.