Changeset 30283 in osm for applications/editors/josm
- Timestamp:
- 2014-02-15T16:22:45+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/js57toosm/src/js57toosm/Js57toosm.java
r30282 r30283 33 33 public static void main(String[] args) throws IOException { 34 34 35 in = new FileInputStream("/Users/mherring/boatsw/oseam/josm/plugins/smed2/js57toosm/tst.000"); 35 if (args.length < 1) { 36 System.err.println("Usage: java -jar js57toosm.jar S57_filename [types_filename]"); 37 System.exit(-1); 38 } 39 in = new FileInputStream(args[0]); 36 40 out = System.out; 41 ArrayList<Obj> types = new ArrayList<Obj>(); 42 if (args.length == 2) { 43 Scanner tin = new Scanner(new FileInputStream(args[1])); 44 while (tin.hasNext()) { 45 types.add(S57obj.enumType(tin.next())); 46 } 47 tin.close(); 48 } 49 37 50 map = new S57map(); 38 39 51 S57dat.rnum = 0; 40 52 … … 57 69 double minlat = 90, minlon = 180, maxlat = -90, maxlon = -180; 58 70 59 HashMap<Long, Boolean> done = new HashMap<Long, Boolean>();71 ArrayList<Long> done = new ArrayList<Long>(); 60 72 61 73 while (in.read(leader) == 24) { … … 221 233 Feature feature = map.index.get(id); 222 234 String type = S57obj.stringType(feature.type); 223 if (!type.isEmpty() ) {235 if (!type.isEmpty() && (types.isEmpty() || types.contains(feature.type))) { 224 236 if (feature.reln == Rflag.MASTER) { 225 237 if (feature.geom.prim == Pflag.POINT) { … … 228 240 Snode node; 229 241 while ((node = map.nodes.get(ref)) != null) { 230 if (!done.contains Key(ref)) {242 if (!done.contains(ref)) { 231 243 out.format(" <node id='%d' lat='%.8f' lon='%.8f' version='1'>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 232 244 out.format(" <tag k='seamark:type' v=\"%s\"/>%n", type); … … 235 247 writeAtts(feature, type); 236 248 out.format(" </node>%n"); 237 done. put(ref, true);249 done.add(ref); 238 250 } 239 251 ref++; … … 247 259 Feature feature = map.index.get(id); 248 260 String type = S57obj.stringType(feature.type); 249 if (!type.isEmpty() ) {261 if (!type.isEmpty() && (types.isEmpty() || types.contains(feature.type))) { 250 262 if (feature.reln == Rflag.MASTER) { 251 263 if (feature.geom.prim == Pflag.LINE) { … … 258 270 long ref = git.nextRef(); 259 271 Snode node = map.nodes.get(ref); 260 if (!done.contains Key(ref)) {272 if (!done.contains(ref)) { 261 273 out.format(" <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 262 done. put(ref, true);274 done.add(ref); 263 275 } 264 276 } … … 279 291 } 280 292 out.format(" </way>%n"); 281 done. put(way, true);293 done.add(way); 282 294 } 283 295 } else if (feature.geom.prim == Pflag.AREA) { … … 290 302 long ref = git.nextRef(); 291 303 Snode node = map.nodes.get(ref); 292 if (!done.contains Key(ref)) {304 if (!done.contains(ref)) { 293 305 out.format(" <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 294 done. put(ref, true);306 done.add(ref); 295 307 } 296 308 } … … 302 314 while (git.hasEdge()) { 303 315 long way = git.nextEdge(); 304 if (!done.contains Key(way)) {316 if (!done.contains(way)) { 305 317 out.format(" <way id='%d' version='1'>%n", -way); 306 318 while (git.hasNode()) { … … 309 321 } 310 322 out.format(" </way>%n"); 311 done. put(way, true);323 done.add(way); 312 324 } 313 325 } … … 317 329 git = map.new GeomIterator(feature.geom); 318 330 int outers = feature.geom.refs.get(0).size; 319 if (feature.geom.inners != 0){320 int x=0;321 }322 331 while (git.hasComp()) { 323 332 git.nextComp(); -
applications/editors/josm/plugins/smed2/src/s57/S57map.java
r30282 r30283 253 253 feature = new Feature(); 254 254 Obj obj = S57obj.decodeType(objl); 255 if (obj == Obj.C_AGGR) { 255 if (obj == Obj.BCNWTW) 256 obj = Obj.BCNLAT; 257 if (obj == Obj.BOYWTW) 258 obj = Obj.BOYLAT; 259 if (obj == Obj.C_AGGR) 256 260 feature.reln = Rflag.AGGR; 257 }258 261 feature.geom = new Geom(p); 259 262 feature.type = obj; -
applications/editors/josm/plugins/smed2/src/s57/S57obj.java
r30282 r30283 131 131 ObjStr.put(Obj.TS_FEB, "tidal_stream"); ObjStr.put(Obj.NOTMRK, "notice"); ObjStr.put(Obj.WTWAXS, "waterway_axis"); ObjStr.put(Obj.WTWPRF, "waterway_profile"); 132 132 ObjStr.put(Obj.BRGARE, "bridge_area"); ObjStr.put(Obj.BUNSTA, "bunker_station"); ObjStr.put(Obj.COMARE, "communication_area"); ObjStr.put(Obj.HRBBSN, "harbour_basin"); 133 ObjStr.put(Obj.LOKARE, "lock_area"); ObjStr.put(Obj.LKBSPT, "lock_basin_part"); ObjStr.put(Obj.PRTARE, "port_area"); ObjStr.put(Obj.BCNWTW, "beacon_ lateral");134 ObjStr.put(Obj.BOYWTW, "buoy_ lateral"); ObjStr.put(Obj.REFDMP, "refuse_dump"); ObjStr.put(Obj.RTPLPT, "route_planning_point"); ObjStr.put(Obj.TERMNL, "terminal");133 ObjStr.put(Obj.LOKARE, "lock_area"); ObjStr.put(Obj.LKBSPT, "lock_basin_part"); ObjStr.put(Obj.PRTARE, "port_area"); ObjStr.put(Obj.BCNWTW, "beacon_waterway"); 134 ObjStr.put(Obj.BOYWTW, "buoy_waterway"); ObjStr.put(Obj.REFDMP, "refuse_dump"); ObjStr.put(Obj.RTPLPT, "route_planning_point"); ObjStr.put(Obj.TERMNL, "terminal"); 135 135 ObjStr.put(Obj.TRNBSN, "turning_basin"); ObjStr.put(Obj.WTWARE, "waterway_area"); ObjStr.put(Obj.WTWGAG, "waterway_gauge"); ObjStr.put(Obj.TISDGE, "time_schedule"); 136 136 ObjStr.put(Obj.VEHTRF, "vehicle_transfer"); ObjStr.put(Obj.EXCNST, "exceptional_structure");
Note:
See TracChangeset
for help on using the changeset viewer.