Changeset 30285 in osm for applications/editors/josm/plugins/smed2/src/s57/S57map.java
- Timestamp:
- 2014-02-17T14:27:01+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57map.java
r30284 r30285 1 /* Copyright 201 3Malcolm Herring1 /* Copyright 2014 Malcolm Herring 2 2 * 3 3 * This is free software: you can redistribute it and/or modify … … 93 93 94 94 public enum Rflag { 95 UNKN, AGGR,MASTER, SLAVE95 UNKN, MASTER, SLAVE 96 96 } 97 97 … … 120 120 public ObjMap() { 121 121 super(Obj.class); 122 }123 }124 125 public class Aggr {126 public RelTab rels;127 public long par;128 public Aggr() {129 rels = new RelTab();130 par = 0;131 122 } 132 123 } … … 218 209 public Obj type; // Feature type 219 210 public AttMap atts; // Feature attributes 220 public Aggr aggr;// Related objects211 public RelTab rels; // Related objects 221 212 public ObjMap objs; // Slave object attributes 222 213 … … 224 215 reln = Rflag.UNKN; 225 216 geom = new Geom(Pflag.NOSP); 226 type = Obj. C_AGGR;217 type = Obj.UNKOBJ; 227 218 atts = new AttMap(); 228 aggr = new Aggr();219 rels = new RelTab(); 229 220 objs = new ObjMap(); 230 221 } … … 271 262 obj = Obj.BOYLAT; 272 263 if (obj == Obj.C_AGGR) 273 feature.reln = Rflag. AGGR;264 feature.reln = Rflag.UNKN; 274 265 feature.geom = new Geom(p); 275 266 feature.type = obj; … … 280 271 281 272 public void newObj(long id, int rind) { 282 Rflag r = Rflag. AGGR;273 Rflag r = Rflag.UNKN; 283 274 switch (rind) { 284 275 case 1: … … 292 283 break; 293 284 } 294 feature. aggr.rels.add(new Reln(id, r));285 feature.rels.add(new Reln(id, r)); 295 286 } 296 287 … … 354 345 for (long id : index.keySet()) { 355 346 Feature feature = index.get(id); 356 for (Reln reln : feature. aggr.rels) {347 for (Reln reln : feature.rels) { 357 348 Feature rel = index.get(reln.id); 358 349 if (cmpGeoms(feature.geom, rel.geom)) { 359 350 switch (reln.reln) { 360 case MASTER:361 feature.reln = Rflag.AGGR;362 break;363 351 case SLAVE: 364 352 feature.reln = Rflag.MASTER; … … 388 376 for (long id : index.keySet()) { 389 377 Feature feature = index.get(id); 390 for (Reln reln : feature. aggr.rels) {378 for (Reln reln : feature.rels) { 391 379 Feature rel = index.get(reln.id); 392 380 if (rel.reln == Rflag.SLAVE) { … … 408 396 nodes.put(id, node); 409 397 feature = new Feature(); 410 feature.reln = Rflag. AGGR;398 feature.reln = Rflag.UNKN; 411 399 feature.geom.prim = Pflag.POINT; 412 400 feature.geom.elems.add(new Prim(id)); … … 416 404 public void addEdge(long id) { 417 405 feature = new Feature(); 418 feature.reln = Rflag. AGGR;406 feature.reln = Rflag.UNKN; 419 407 feature.geom.prim = Pflag.LINE; 420 408 feature.geom.elems.add(new Prim(id)); … … 436 424 public void addArea(long id) { 437 425 feature = new Feature(); 438 feature.reln = Rflag. AGGR;426 feature.reln = Rflag.UNKN; 439 427 feature.geom.prim = Pflag.AREA; 440 428 feature.geom.elems.add(new Prim(id)); … … 447 435 448 436 public void addTag(String key, String val) { 437 feature.reln = Rflag.MASTER; 449 438 String subkeys[] = key.split(":"); 450 439 if ((subkeys.length > 1) && subkeys[0].equals("seamark")) { … … 461 450 att = S57att.enumAttribute(subkeys[2], obj); 462 451 } 463 ObjTab items = feature.objs.get(obj); 464 if (items == null) { 465 items = new ObjTab(); 466 feature.objs.put(obj, items); 467 Feature type = new Feature(); 468 type.reln = Rflag.SLAVE; 469 type.type = obj; 470 type.geom = feature.geom; 471 } 472 // AttMap atts = items.get(idx); 473 // if (atts == null) { 474 // atts = new AttMap(); 475 // items.put(idx, atts); 476 // } 477 // AttVal<?> attval = S57val.convertValue(val, att); 478 // if (attval.val != null) 479 // atts.put(att, attval); 452 ObjTab objs = feature.objs.get(obj); 453 if (objs == null) { 454 objs = new ObjTab(); 455 feature.objs.put(obj, objs); 456 } 457 AttMap atts = objs.get(idx); 458 if (atts == null) { 459 atts = new AttMap(); 460 objs.put(idx, atts); 461 } 462 AttVal<?> attval = S57val.convertValue(val, att); 463 if (attval.val != null) 464 atts.put(att, attval); 480 465 } else { 481 466 if (subkeys[1].equals("type")) { 482 467 obj = S57obj.enumType(val); 483 if (feature.objs.get(feature.type) == null) { 484 feature.objs.put(feature.type, new ObjTab()); 485 Feature type = new Feature(); 486 type.reln = Rflag.MASTER; 487 type.type = obj; 488 type.geom = feature.geom; 468 feature.type = obj; 469 ObjTab objs = feature.objs.get(obj); 470 if (objs == null) { 471 objs = new ObjTab(); 472 feature.objs.put(obj, objs); 473 } 474 AttMap atts = objs.get(0); 475 if (atts == null) { 476 atts = new AttMap(); 477 objs.put(0, atts); 489 478 } 490 479 } else {
Note:
See TracChangeset
for help on using the changeset viewer.