Changeset 30269 in osm for applications
- Timestamp:
- 2014-02-09T19:58:46+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/jharbour/build.xml
r30184 r30269 9 9 10 10 <target name="compile" depends="init" description="compile the source " > 11 <javac srcdir="${src}" destdir="${build}"/>11 <javac includeantruntime="false" srcdir="${src}" destdir="${build}"/> 12 12 </target> 13 13 -
applications/editors/josm/plugins/smed2/jrender/build.xml
r30184 r30269 9 9 10 10 <target name="compile" depends="init" description="compile the source " > 11 <javac srcdir="${src}" destdir="${build}"/>11 <javac includeantruntime="false" srcdir="${src}" destdir="${build}"/> 12 12 </target> 13 13 -
applications/editors/josm/plugins/smed2/js57toosm/build.xml
r30190 r30269 9 9 10 10 <target name="compile" depends="init" description="compile the source " > 11 <javac srcdir="${src}" destdir="${build}"/>11 <javac includeantruntime="false" srcdir="${src}" destdir="${build}"/> 12 12 </target> 13 13 -
applications/editors/josm/plugins/smed2/js57toosm/src/js57toosm/Js57toosm.java
r30230 r30269 115 115 break; 116 116 case "FFPT": 117 name = (long) S57dat.getSubf(record, fields + pos, S57field.FFPT, S57subf.LNAM); 118 int rind = ((Long) S57dat.getSubf(S57subf.RIND)).intValue(); 119 map.newObj(name, rind); 117 S57dat.setField(record, fields + pos, S57field.FFPT, len); 118 do { 119 name = (long) S57dat.getSubf(S57subf.LNAM); 120 int rind = ((Long) S57dat.getSubf(S57subf.RIND)).intValue(); 121 S57dat.getSubf(S57subf.COMT); 122 map.newObj(name, rind); 123 } while (S57dat.more()); 120 124 break; 121 125 case "FSPT": … … 124 128 name = (Long) S57dat.getSubf(S57subf.NAME) << 16; 125 129 map.newPrim(name, (long) S57dat.getSubf(S57subf.ORNT), (long) S57dat.getSubf(S57subf.USAG)); 130 S57dat.getSubf(S57subf.MASK); 126 131 } while (S57dat.more()); 127 132 break; … … 153 158 int topi = ((Long) S57dat.getSubf(S57subf.TOPI)).intValue(); 154 159 map.addConn(name, topi); 160 S57dat.getSubf(S57subf.MASK); 155 161 } while (S57dat.more()); 156 162 break; … … 209 215 for (long id : map.index.keySet()) { 210 216 Feature feature = map.index.get(id); 211 if (feature.reln != Rflag.SLAVE) { 212 if (feature.geom.prim == Pflag.POINT) { 213 for (Prim prim : feature.geom.elems) { 214 long ref = prim.id; 215 Snode node = map.nodes.get(ref); 216 out.format(" <node id='%d' lat='%f' lon='%f' version='1'>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 217 String type = S57obj.stringType(feature.type); 218 out.format(" <tag k='seamark:type' v=\"%s\"/>%n", type); 219 if ((feature.type == Obj.SOUNDG) && (node.flg == S57map.Nflag.DPTH)) 220 out.format(" <tag k='seamark:sounding:depth' v='%.1f'/>%n", ((Dnode)node).val); 221 writeAtts(feature, type); 222 out.format(" </node>%n"); 223 map.nodes.remove(ref); 217 String type = S57obj.stringType(feature.type); 218 if (!type.isEmpty()) { 219 if (feature.reln == Rflag.MASTER) { 220 if (feature.geom.prim == Pflag.POINT) { 221 for (Prim prim : feature.geom.elems) { 222 long ref = prim.id; 223 Snode node; 224 while ((node = map.nodes.get(ref)) != null) { 225 out.format(" <node id='%d' lat='%.8f' lon='%.8f' version='1'>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 226 out.format(" <tag k='seamark:type' v=\"%s\"/>%n", type); 227 if ((feature.type == Obj.SOUNDG) && (node.flg == S57map.Nflag.DPTH)) 228 out.format(" <tag k='seamark:sounding:depth' v='%.1f'/>%n", ((Dnode) node).val); 229 writeAtts(feature, type); 230 out.format(" </node>%n"); 231 map.nodes.remove(ref++); 232 } 233 } 224 234 } 225 235 } … … 227 237 } 228 238 239 //int i = 256; 229 240 for (long id : map.index.keySet()) { 241 //if (i-- == 0) break; 230 242 Feature feature = map.index.get(id); 231 if (feature.reln != Rflag.SLAVE) { 232 if ((feature.geom.prim == Pflag.LINE) || ((feature.geom.prim == Pflag.AREA) && (feature.geom.outers == 1) && (feature.geom.inners == 0))) { 233 GeomIterator git = map.new GeomIterator(feature.geom); 234 while (git.hasMore()) { 235 git.getMore(); 236 while (git.hasNext()) { 237 long ref = git.nextRef(); 238 Snode node = map.nodes.get(ref); 239 if (node != null) { 240 out.format(" <node id='%d' lat='%f' lon='%f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 241 map.nodes.remove(ref); 243 String type = S57obj.stringType(feature.type); 244 if (!type.isEmpty()) { 245 if (feature.reln == Rflag.MASTER) { 246 if ((feature.geom.prim == Pflag.LINE) || ((feature.geom.prim == Pflag.AREA) && (feature.geom.outers == 1) && (feature.geom.inners == 0))) { 247 GeomIterator git = map.new GeomIterator(feature.geom); 248 while (git.hasMore()) { 249 git.getMore(); 250 while (git.hasNext()) { 251 long ref = git.nextRef(); 252 Snode node = map.nodes.get(ref); 253 if (node != null) { 254 out.format(" <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon)); 255 map.nodes.remove(ref); 256 } 242 257 } 243 258 } 259 git = map.new GeomIterator(feature.geom); 260 while (git.hasMore()) { 261 long way = git.getMore(); 262 out.format(" <way id='%d' version='1'>%n", -way); 263 while (git.hasNext()) { 264 long ref = git.nextRef(); 265 out.format(" <nd ref='%d'/>%n", -ref); 266 } 267 out.format(" <tag k='seamark:type' v=\"%s\"/>%n", type); 268 writeAtts(feature, type); 269 out.format(" </way>%n"); 270 } 271 } else if (feature.geom.prim == Pflag.AREA) { 272 244 273 } 245 git = map.new GeomIterator(feature.geom);246 while (git.hasMore()) {247 long way = git.getMore();248 out.format(" <way id='%d' version='1'>%n", -way);249 while (git.hasNext()) {250 long ref = git.nextRef();251 out.format(" <nd ref='%d'/>%n", -ref);252 }253 String type = S57obj.stringType(feature.type);254 out.format(" <tag k='seamark:type' v=\"%s\"/>%n", type);255 writeAtts(feature, type);256 out.format(" </way>%n");257 }258 } else if (feature.geom.prim == Pflag.AREA) {259 260 274 } 261 275 } … … 271 285 out.format(" <tag k='seamark:%s:%s' v=\"%s\"/>%n", type, attstr, valstr); 272 286 } 273 for (Reln rel : feature.rels) { 274 if (rel.reln == Rflag.SLAVE) { 275 Feature slave = map.index.get(rel.id); 276 type = S57obj.stringType(slave.type); 277 for (Map.Entry<Att, AttVal<?>> item : slave.atts.entrySet()) { 287 for (Obj obj : feature.objs.keySet()) { 288 ObjTab tab = feature.objs.get(obj); 289 for (int ix : tab.keySet()) { 290 type = S57obj.stringType(obj); 291 AttMap atts = tab.get(ix); 292 for (Map.Entry<Att, AttVal<?>> item : atts.entrySet()) { 278 293 String attstr = S57att.stringAttribute(item.getKey()); 279 294 String valstr = S57val.stringValue(item.getValue()); 280 if (!attstr.isEmpty() && !valstr.isEmpty()) 281 out.format(" <tag k='seamark:%s:%s' v=\"%s\"/>%n", type, attstr, valstr); 295 if (!attstr.isEmpty() && !valstr.isEmpty()) { 296 if ((ix == 0) && (tab.size() == 1)) { 297 out.format(" <tag k='seamark:%s:%s' v=\"%s\"/>%n", type, attstr, valstr); 298 } else { 299 out.format(" <tag k='seamark:%s:%d:%s' v=\"%s\"/>%n", type, ix + 1, attstr, valstr); 300 } 301 } 282 302 } 283 303 } 284 304 } 285 286 305 } 287 306 -
applications/editors/josm/plugins/smed2/src/panels/PanelMain.java
r30215 r30269 146 146 for (Obj obj : feature.objs.keySet()) { 147 147 decode.append("\t\t" + Messages.getString(obj.name()) + "\n"); 148 if (feature.objs.get(obj).size() != 0) {148 /* if (feature.aggr.objs.get(obj).size() != 0) { 149 149 for (AttMap atts : feature.objs.get(obj).values()) { 150 150 for (Att att : atts.keySet()) { … … 172 172 } 173 173 } 174 }174 */ } 175 175 } 176 176 -
applications/editors/josm/plugins/smed2/src/render/Renderer.java
r30232 r30269 81 81 82 82 public static void symbol(Feature feature, Symbol symbol) { 83 Point2D point = context.getPoint(feature. centre);83 Point2D point = context.getPoint(feature.geom.centre); 84 84 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), null, null); 85 85 } 86 86 public static void symbol(Feature feature, Symbol symbol, Scheme scheme) { 87 Point2D point = context.getPoint(feature. centre);87 Point2D point = context.getPoint(feature.geom.centre); 88 88 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), scheme, null); 89 89 } 90 90 public static void symbol(Feature feature, Symbol symbol, Delta delta) { 91 Point2D point = context.getPoint(feature. centre);91 Point2D point = context.getPoint(feature.geom.centre); 92 92 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), null, delta); 93 93 } 94 94 public static void symbol(Feature feature, Symbol symbol, Scheme scheme, Delta delta) { 95 Point2D point = context.getPoint(feature. centre);95 Point2D point = context.getPoint(feature.geom.centre); 96 96 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), scheme, delta); 97 97 } … … 334 334 circle.add(new Instr(Form.STRK, new BasicStroke(style.width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, style.dash, 0))); 335 335 circle.add(new Instr(Form.ELPS, new Ellipse2D.Double(-radius,-radius,radius*2,radius*2))); 336 Point2D point = context.getPoint(feature. centre);336 Point2D point = context.getPoint(feature.geom.centre); 337 337 Symbols.drawSymbol(g2, circle, 1, point.getX(), point.getY(), null, null); 338 338 } … … 345 345 switch (feature.geom.prim) { 346 346 case POINT: 347 point = context.getPoint(feature. centre);347 point = context.getPoint(feature.geom.centre); 348 348 g2.drawImage(image, new AffineTransformOp(AffineTransform.getScaleInstance(sScale, sScale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR), 349 349 (int)(point.getX() - (50 * sScale)), (int)(point.getY() - (50 * sScale))); … … 478 478 } 479 479 label.add(new Instr(Form.TEXT, new Caption(str, font, tc, new Delta(Handle.TL, AffineTransform.getTranslateInstance(tx, ty))))); 480 Point2D point = context.getPoint(feature. centre);480 Point2D point = context.getPoint(feature.geom.centre); 481 481 Symbols.drawSymbol(g2, label, sScale, point.getX(), point.getY(), null, delta); 482 482 } -
applications/editors/josm/plugins/smed2/src/render/Rules.java
r30215 r30269 193 193 break; 194 194 case FAIRWY: 195 if (feature. area > 2.0) {195 if (feature.geom.area > 2.0) { 196 196 if (Renderer.zoom < 16) 197 197 Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true))); … … 208 208 Renderer.symbol(feature, Areas.MarineFarm); 209 209 } 210 if ((feature. area > 0.2) || ((feature.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.area > 0.005) && (Renderer.zoom >= 16))) {210 if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) { 211 211 Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 })); 212 212 } … … 385 385 386 386 private static void cables(Feature feature) { 387 if ((Renderer.zoom >= 16) && (feature. length < 2)) {387 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) { 388 388 if (feature.type == Obj.CBLSUB) { 389 389 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Mline); … … 898 898 899 899 private static void pipelines(Feature feature) { 900 if ((Renderer.zoom >= 16) && (feature. length < 2)) {900 if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) { 901 901 if (feature.type == Obj.PIPSOL) { 902 902 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline); 903 903 } else if (feature.type == Obj.PIPOHD) { 904 904 Renderer.lineVector(feature, new LineStyle(Color.black, 8)); 905 AttMap atts = feature. objs.get(Obj.PIPOHD).get(0);905 AttMap atts = feature.atts; 906 906 double verclr = 0; 907 907 if (atts != null) { -
applications/editors/josm/plugins/smed2/src/s57/S57att.java
r30226 r30269 146 146 AttStr.put(Att.BUNVES, "availability"); AttStr.put(Att.CATBRT, "category"); AttStr.put(Att.CATBUN, "category"); AttStr.put(Att.CATCCL, "category"); 147 147 AttStr.put(Att.CATHBR, "category"); AttStr.put(Att.CATRFD, "category"); AttStr.put(Att.CATTML, "category"); AttStr.put(Att.COMCTN, "communication"); 148 AttStr.put(Att.HORCLL, "horizontal_clearance_length"); AttStr.put(Att.HORCLW, "horizontal_clearance_width"); AttStr.put(Att.TRSHGD, "goods"); AttStr.put(Att.UNLOCD, " locode");148 AttStr.put(Att.HORCLL, "horizontal_clearance_length"); AttStr.put(Att.HORCLW, "horizontal_clearance_width"); AttStr.put(Att.TRSHGD, "goods"); AttStr.put(Att.UNLOCD, ""); 149 149 AttStr.put(Att.CATGAG, "category"); AttStr.put(Att.HIGWAT, "high_value"); AttStr.put(Att.HIGNAM, "high_name"); AttStr.put(Att.LOWWAT, "low_value"); 150 150 AttStr.put(Att.LOWNAM, "low_name"); AttStr.put(Att.MEAWAT, "mean_value"); AttStr.put(Att.MEANAM, "mean_name"); AttStr.put(Att.OTHWAT, "local_value"); -
applications/editors/josm/plugins/smed2/src/s57/S57dat.java
r30215 r30269 173 173 174 174 public static boolean more() { 175 return ((offset < maxoff) && (buffer[offset +1] != 0x1e));175 return ((offset < maxoff) && (buffer[offset] != 0x1e)); 176 176 } 177 177 -
applications/editors/josm/plugins/smed2/src/s57/S57map.java
r30231 r30269 80 80 81 81 public enum Rflag { 82 UNKN, AGGR, MASTER, SLAVE , PEER82 UNKN, AGGR, MASTER, SLAVE 83 83 } 84 84 … … 92 92 } 93 93 94 public class RelTab extends ArrayList<Reln> { 95 public RelTab() { 96 super(); 97 } 98 } 99 100 public class ObjTab extends HashMap<Integer, AttMap> { 101 public ObjTab() { 102 super(); 103 } 104 } 105 106 public class ObjMap extends EnumMap<Obj, ObjTab> { 107 public ObjMap() { 108 super(Obj.class); 109 } 110 } 111 112 public class Aggr { 113 public RelTab rels; 114 public long par; 115 public Aggr() { 116 rels = new RelTab(); 117 par = 0; 118 } 119 } 120 94 121 public class AttMap extends HashMap<Att, AttVal<?>> { 95 122 public AttMap() { 96 123 super(); 97 }98 }99 100 public class RelTab extends ArrayList<Reln> {101 public RelTab() {102 super();103 }104 }105 106 public class ObjTab extends HashMap<Integer, AttMap> {107 public ObjTab() {108 super();109 }110 }111 112 public class ObjMap extends EnumMap<Obj, ObjTab> {113 public ObjMap() {114 super(Obj.class);115 124 } 116 125 } … … 177 186 public int inners; // Number of inners 178 187 public ArrayList<Comp> refs; // Ordered list of compounds 188 public double area; // Area of feature 189 public double length; // Length of feature 190 public Snode centre; // Centre of feature 179 191 public Geom(Pflag p) { 180 192 prim = p; … … 182 194 outers = inners = 0; 183 195 refs = new ArrayList<Comp>(); 196 area = 0; 197 length = 0; 198 centre = new Snode(); 184 199 } 185 200 } … … 190 205 public Obj type; // Feature type 191 206 public AttMap atts; // Feature attributes 192 public RelTab rels; // Related objects 193 public ObjMap objs; // Slave objects 194 public double area; // Area of feature 195 public double length; // Length of feature 196 public Snode centre; // Centre of feature 207 public Aggr aggr; // Related objects 208 public ObjMap objs; // Slave object attributes 197 209 198 210 Feature() { … … 201 213 type = Obj.C_AGGR; 202 214 atts = new AttMap(); 203 rels = new RelTab();215 aggr = new Aggr(); 204 216 objs = new ObjMap(); 205 area = 0;206 length = 0;207 centre = new Snode();208 217 } 209 218 } … … 249 258 feature.geom = new Geom(p); 250 259 feature.type = obj; 251 index.put(id, feature); 260 if (obj != Obj.UNKOBJ) { 261 index.put(id, feature); 262 } 252 263 } 253 264 … … 262 273 break; 263 274 case 3: 264 r = Rflag. PEER;275 r = Rflag.UNKN; 265 276 break; 266 277 } 267 feature. rels.add(new Reln(id, r));278 feature.aggr.rels.add(new Reln(id, r)); 268 279 } 269 280 … … 296 307 297 308 public void endFile() { 309 sortGeom(); 298 310 for (long id : index.keySet()) { 299 311 Feature feature = index.get(id); 300 for (Reln rel : feature.rels) { 301 Feature reln = index.get(rel.id); 302 reln.reln = rel.reln; 303 if (feature.reln == Rflag.UNKN) { 304 switch (rel.reln) { 312 for (Reln reln : feature.aggr.rels) { 313 Feature rel = index.get(reln.id); 314 if (cmpGeoms(feature.geom, rel.geom)) { 315 switch (reln.reln) { 305 316 case MASTER: 306 317 feature.reln = Rflag.AGGR; … … 308 319 case SLAVE: 309 320 feature.reln = Rflag.MASTER; 310 case PEER:311 feature.reln = Rflag.PEER;312 321 break; 313 322 default: 323 feature.reln = Rflag.UNKN; 314 324 break; 315 325 } 316 } 317 ObjTab tab = feature.objs.get(reln.type); 318 if (tab == null) { 319 tab = new ObjTab(); 320 feature.objs.put(reln.type, tab); 321 } 322 tab.put(tab.size(), reln.atts); 326 rel.reln = reln.reln; 327 } else { 328 reln.reln = Rflag.UNKN; 329 } 323 330 } 324 331 } … … 328 335 feature.reln = Rflag.MASTER; 329 336 } 330 if ((feature.type != Obj.UNKOBJ) && ( (feature.reln == Rflag.MASTER) || (feature.reln == Rflag.PEER))) {337 if ((feature.type != Obj.UNKOBJ) && (feature.reln == Rflag.MASTER)) { 331 338 if (features.get(feature.type) == null) { 332 339 features.put(feature.type, new ArrayList<Feature>()); … … 335 342 } 336 343 } 337 sortGeom(); 344 for (long id : index.keySet()) { 345 Feature feature = index.get(id); 346 for (Reln reln : feature.aggr.rels) { 347 Feature rel = index.get(reln.id); 348 if (rel.reln == Rflag.SLAVE) { 349 if (feature.objs.get(rel.type) == null) { 350 feature.objs.put(rel.type, new ObjTab()); 351 } 352 ObjTab tab = feature.objs.get(rel.type); 353 int ix = tab.size(); 354 tab.put(ix, rel.atts); 355 } 356 } 357 } 338 358 } 339 359 … … 401 421 items = new ObjTab(); 402 422 feature.objs.put(obj, items); 403 } 404 AttMap atts = items.get(idx); 405 if (atts == null) { 406 atts = new AttMap(); 407 items.put(idx, atts); 408 } 409 AttVal<?> attval = S57val.convertValue(val, att); 410 if (attval.val != null) 411 atts.put(att, attval); 423 Feature type = new Feature(); 424 type.reln = Rflag.SLAVE; 425 type.type = obj; 426 type.geom = feature.geom; 427 } 428 // AttMap atts = items.get(idx); 429 // if (atts == null) { 430 // atts = new AttMap(); 431 // items.put(idx, atts); 432 // } 433 // AttVal<?> attval = S57val.convertValue(val, att); 434 // if (attval.val != null) 435 // atts.put(att, attval); 412 436 } else { 413 437 if (subkeys[1].equals("type")) { 414 feature.type= S57obj.enumType(val);438 obj = S57obj.enumType(val); 415 439 if (feature.objs.get(feature.type) == null) { 416 440 feature.objs.put(feature.type, new ObjTab()); 441 Feature type = new Feature(); 442 type.reln = Rflag.MASTER; 443 type.type = obj; 444 type.geom = feature.geom; 417 445 } 418 446 } else { … … 435 463 node.flg = Nflag.ISOL; 436 464 } 437 feature. length = 0;438 feature. area = 0;465 feature.geom.length = 0; 466 feature.geom.area = 0; 439 467 break; 440 468 case LINE: … … 442 470 nodes.get(edge.first).flg = Nflag.CONN; 443 471 nodes.get(edge.last).flg = Nflag.CONN; 444 feature. length = calcLength(feature.geom);472 feature.geom.length = calcLength(feature.geom); 445 473 if (edge.first == edge.last) { 446 474 feature.geom.prim = Pflag.AREA; 447 feature. area = calcArea(feature.geom);475 feature.geom.area = calcArea(feature.geom); 448 476 } else { 449 feature. area = 0;477 feature.geom.area = 0; 450 478 } 451 479 break; … … 460 488 features.put(feature.type, new ArrayList<Feature>()); 461 489 } 462 feature.centre = findCentroid(feature);463 490 features.get(feature.type).add(feature); 491 feature.geom.centre = findCentroid(feature); 464 492 } 465 493 } … … 470 498 for (long id : index.keySet()) { 471 499 feature = index.get(id); 472 Geom geom = feature.geom; 473 Geom sort = new Geom(geom.prim); 500 Geom sort = new Geom(feature.geom.prim); 474 501 long first = 0; 475 502 long last = 0; 476 503 Comp comp = null; 477 504 boolean next = true; 478 if (( geom.prim == Pflag.LINE) || (geom.prim == Pflag.AREA)) {479 int sweep = geom.elems.size();480 while (! geom.elems.isEmpty()) {481 Prim prim = geom.elems.remove(0);505 if ((feature.geom.prim == Pflag.LINE) || (feature.geom.prim == Pflag.AREA)) { 506 int sweep = feature.geom.elems.size(); 507 while (!feature.geom.elems.isEmpty()) { 508 Prim prim = feature.geom.elems.remove(0); 482 509 Edge edge = edges.get(prim.id); 483 510 if (next == true) { … … 509 536 comp.size++; 510 537 } else { 511 geom.elems.add(prim);538 feature.geom.elems.add(prim); 512 539 } 513 540 } else { … … 521 548 comp.size++; 522 549 } else { 523 geom.elems.add(prim);550 feature.geom.elems.add(prim); 524 551 } 525 552 } … … 527 554 if (--sweep == 0) { 528 555 next = true; 529 sweep = geom.elems.size(); 530 } 556 sweep = feature.geom.elems.size(); 557 } 558 } 559 if ((sort.prim == Pflag.LINE) && (sort.outers == 1) && (sort.inners == 0) && (first == last)) { 560 sort.prim = Pflag.AREA; 531 561 } 532 562 feature.geom = sort; 533 563 } 534 if ( geom.prim == Pflag.AREA) {564 if (feature.geom.prim == Pflag.AREA) { 535 565 ArrayList<Prim> outers = new ArrayList<Prim>(); 536 566 ArrayList<Prim> inners = new ArrayList<Prim>(); … … 544 574 ArrayList<Prim> sorting = outers; 545 575 ArrayList<Prim> closed = null; 546 sort = new Geom( geom.prim);576 sort = new Geom(feature.geom.prim); 547 577 sort.outers = feature.geom.outers; 548 578 sort.inners = feature.geom.inners; … … 596 626 } 597 627 628 public boolean cmpGeoms (Geom g1, Geom g2) { 629 return ((g1.prim == g2.prim) && (g1.outers == g2.outers) && (g1.inners == g2.inners) && (g1.elems.size() == g2.elems.size())); 630 } 631 598 632 public class EdgeIterator { 599 633 Edge edge; … … 653 687 int cc, ec; 654 688 Comp comp; 689 long lastref; 655 690 656 691 public GeomIterator(Geom g) { … … 659 694 cc = ec = 0; 660 695 comp = null; 696 lastref = 0; 661 697 if ((geom.prim != Pflag.NOSP) && (geom.prim != Pflag.POINT)) { 662 698 it = geom.elems.listIterator(); … … 690 726 } 691 727 long ref = eit.nextRef(); 728 if (ref == lastref) { 729 ref = eit.nextRef(); 730 } 731 lastref = ref; 692 732 if (!eit.hasNext()) { 693 733 eit = null; -
applications/editors/josm/plugins/smed2/src/s57/S57obj.java
r30215 r30269 8 8 9 9 public enum Obj { 10 UNKOBJ, A DMARE, AIRARE, ACHBRT, ACHARE, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BERTHS, BRIDGE, BUISGL, BUAARE, BOYCAR, BOYINB,10 UNKOBJ, AIRARE, ACHBRT, ACHARE, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BERTHS, BRIDGE, BUISGL, BUAARE, BOYCAR, BOYINB, 11 11 BOYISD, BOYLAT, BOYSAW, BOYSPP, CBLARE, CBLOHD, CBLSUB, CANALS, CANBNK, CTSARE, CAUSWY, CTNARE, CHKPNT, CGUSTA, COALNE, CONZNE, 12 12 COSARE, CTRPNT, CONVYR, CRANES, CURENT, CUSZNE, DAMCON, DAYMAR, DWRTCL, DWRTPT, DEPARE, DEPCNT, DISMAR, DOCARE, DRGARE, DRYDOC, … … 25 25 static { 26 26 ObjS57.put(Obj.UNKOBJ,0); 27 ObjS57.put(Obj.A DMARE,1); ObjS57.put(Obj.AIRARE,2); ObjS57.put(Obj.ACHBRT,3); ObjS57.put(Obj.ACHARE,4); ObjS57.put(Obj.BCNCAR,5);27 ObjS57.put(Obj.AIRARE,2); ObjS57.put(Obj.ACHBRT,3); ObjS57.put(Obj.ACHARE,4); ObjS57.put(Obj.BCNCAR,5); 28 28 ObjS57.put(Obj.BCNISD,6); ObjS57.put(Obj.BCNLAT,7); ObjS57.put(Obj.BCNSAW,8); ObjS57.put(Obj.BCNSPP,9); ObjS57.put(Obj.BERTHS,10); 29 29 ObjS57.put(Obj.BRIDGE,11); ObjS57.put(Obj.BUISGL,12); ObjS57.put(Obj.BUAARE,13); ObjS57.put(Obj.BOYCAR,14); ObjS57.put(Obj.BOYINB,15); … … 88 88 private static final EnumMap<Obj, String> ObjStr = new EnumMap<Obj, String>(Obj.class); 89 89 static { 90 ObjStr.put(Obj.UNKOBJ, ""); ObjStr.put(Obj.A DMARE, "administrative_area"); ObjStr.put(Obj.AIRARE, "airfield"); ObjStr.put(Obj.ACHBRT, "anchor_berth");90 ObjStr.put(Obj.UNKOBJ, ""); ObjStr.put(Obj.AIRARE, "airfield"); ObjStr.put(Obj.ACHBRT, "anchor_berth"); 91 91 ObjStr.put(Obj.ACHARE, "anchorage"); ObjStr.put(Obj.BCNCAR, "beacon_cardinal"); ObjStr.put(Obj.BCNISD, "beacon_isolated_danger"); 92 92 ObjStr.put(Obj.BCNLAT, "beacon_lateral"); ObjStr.put(Obj.BCNSAW, "beacon_safe_water"); ObjStr.put(Obj.BCNSPP, "beacon_special_purpose"); … … 124 124 ObjStr.put(Obj.SMCFAC, "small_craft_facility"); ObjStr.put(Obj.SOUNDG, "sounding"); ObjStr.put(Obj.SPRING, "spring"); ObjStr.put(Obj.SQUARE, "square"); 125 125 ObjStr.put(Obj.STSLNE, "territorial_baseline"); ObjStr.put(Obj.SUBTLN, "submarine_transit_lane"); ObjStr.put(Obj.SWPARE, "swept_area"); 126 ObjStr.put(Obj.TESARE, "territorial_area"); ObjStr.put(Obj.TS_PRH, ""); ObjStr.put(Obj.TS_PNH, ""); ObjStr.put(Obj.TS_PAD, ""); ObjStr.put(Obj.TS_TIS, ""); 127 ObjStr.put(Obj.T_HMON, ""); ObjStr.put(Obj.T_NHMN, ""); ObjStr.put(Obj.T_TIMS, ""); ObjStr.put(Obj.TIDEWY, "tideway"); ObjStr.put(Obj.TOPMAR, "topmark"); 126 ObjStr.put(Obj.TESARE, "territorial_area"); ObjStr.put(Obj.TIDEWY, "tideway"); ObjStr.put(Obj.TOPMAR, "topmark"); 128 127 ObjStr.put(Obj.TSELNE, "separation_line"); ObjStr.put(Obj.TSSBND, "separation_boundary"); ObjStr.put(Obj.TSSCRS, "separation_crossing"); 129 128 ObjStr.put(Obj.TSSLPT, "separation_lane"); ObjStr.put(Obj.TSSRON, "separation_roundabout"); ObjStr.put(Obj.TSEZNE, "separation_zone"); ObjStr.put(Obj.TUNNEL, "tunnel"); … … 135 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"); 136 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"); 137 ObjStr.put(Obj.VEHTRF, "vehicle_transfer"); ObjStr.put(Obj.EXCNST, "exceptional_structure"); ObjStr.put(Obj.LG_SDM, ""); ObjStr.put(Obj.LG_VSP, "");136 ObjStr.put(Obj.VEHTRF, "vehicle_transfer"); ObjStr.put(Obj.EXCNST, "exceptional_structure"); 138 137 ObjStr.put(Obj.MPAARE, "protected_area"); ObjStr.put(Obj.LITMAJ, "light_major"); ObjStr.put(Obj.LITMIN, "light_minor"); ObjStr.put(Obj.M_COVR, "coverage"); 139 138 } -
applications/editors/josm/plugins/smed2/src/smed2/Smed2.java
r28648 r30269 1 /* Copyright 2013 Malcolm Herring 2 * 3 * This is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, version 3 of the License. 6 * 7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 8 */ 9 1 10 package smed2; 2 11
Note:
See TracChangeset
for help on using the changeset viewer.