Changeset 33663 in osm for applications/editors
- Timestamp:
- 2017-09-24T23:25:03+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileTHF.java
r33659 r33663 12 12 import java.util.Objects; 13 13 14 import org.openstreetmap.josm.actions.SimplifyWayAction; 15 import org.openstreetmap.josm.command.SequenceCommand; 14 16 import org.openstreetmap.josm.data.osm.DataSet; 15 17 import org.openstreetmap.josm.tools.Logging; … … 491 493 lot.fill(ds); 492 494 } 495 ds.getWays().forEach(w -> { 496 SequenceCommand command = SimplifyWayAction.simplifyWay(w, 0.25); 497 if (command != null) { 498 command.executeCommand(); 499 } 500 }); 493 501 return this; 494 502 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileVEC.java
r33662 r33663 22 22 import org.openstreetmap.josm.data.osm.Node; 23 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 import org.openstreetmap.josm.data.osm.Relation; 25 import org.openstreetmap.josm.data.osm.RelationMember; 24 26 import org.openstreetmap.josm.data.osm.Way; 25 27 import org.openstreetmap.josm.data.projection.Projection; … … 571 573 if (rel.scdRef instanceof McdConstructionRelationDef) { 572 574 McdConstructionRelationDef crd = (McdConstructionRelationDef) rel.scdRef; 573 assert crd.kind == kind; 574 assert crd.nAttributes == 0; 575 } 576 for (VecBlock<?> e : rel.elements) { 577 if (klass.isInstance(e)) { 578 list.add((T) e); 575 if (crd.kind == kind) { 576 assert crd.nAttributes == 0; 577 for (VecBlock<?> e : rel.elements) { 578 if (klass.isInstance(e)) { 579 list.add((T) e); 580 } 581 } 579 582 } 580 583 } … … 642 645 List<RelationBlock> constructionRelations, List<RelationBlock> semanticRelations) { 643 646 assert constructionRelations.size() >= 1 : constructionRelations; 644 // TODO 645 return null; 647 List<FaceBlock> faces = extract(FaceBlock.class, constructionRelations, RelationKind.IS_MADE_OF); 648 assert faces.size() >= 1; 649 if (faces.size() == 1) { 650 return addPrimitiveAndTags(ds, obj, faceToOsmPrimitive(ds, proj, faces.get(0))); 651 } else { 652 Relation r = new Relation(); 653 r.put("type", "multipolygon"); 654 for (FaceBlock face : faces) { 655 r.addMember(new RelationMember("outer", faceToOsmPrimitive(ds, proj, face))); 656 } 657 return addPrimitiveAndTags(ds, obj, r); 658 } 659 } 660 661 private static OsmPrimitive faceToOsmPrimitive(DataSet ds, Projection proj, FaceBlock face) { 662 List<ArcBlock> leftArcs = extract(ArcBlock.class, face.getConstructionRelations(), RelationKind.HAS_FOR_LEFT_FACE); 663 List<ArcBlock> rightArcs = extract(ArcBlock.class, face.getConstructionRelations(), RelationKind.HAS_FOR_RIGHT_FACE); 664 assert leftArcs.size() >= 1 || rightArcs.size() >= 1; 665 if ((leftArcs.size() == 1 && rightArcs.isEmpty()) || (leftArcs.isEmpty() && rightArcs.size() == 1)) { 666 Way w = new Way(); 667 ArcBlock ab = (leftArcs.isEmpty() ? rightArcs : leftArcs).get(0); 668 for (EastNorth en : ab.points) { 669 w.addNode(getNodeAt(ds, proj, en)); 670 } 671 return w; 672 } else { 673 // TODO 674 return new Way(); 675 } 646 676 } 647 677 -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/pci/EdigeoPciReader.java
r33662 r33663 41 41 EdigeoFileVEC.addObjectPostProcessor("19", "boundary=administrative;admin_level=8"); // Municipality limit trigger 42 42 EdigeoFileVEC.addObjectPostProcessor("21", "highway=road"); // Path 43 EdigeoFileVEC.addObjectPostProcessor("33", "barrier=wall;bridge=yes"); // bridge parapet 44 EdigeoFileVEC.addObjectPostProcessor("34", "landuse=reservoir;natural=water;water=reservoir"); // reservoir, lake 43 45 EdigeoFileVEC.addObjectPostProcessor("39", "barrier=wall"); // Common wall 44 46 EdigeoFileVEC.addObjectPostProcessor("40", "barrier=wall"); // Non-adjacent wall 45 47 EdigeoFileVEC.addObjectPostProcessor("45", "barrier=hedge"); // Common hedge 46 48 EdigeoFileVEC.addObjectPostProcessor("46", "barrier=hedge"); // Non-adjacent hedge 49 EdigeoFileVEC.addObjectPostProcessor("65", "leisure=swimming_pool;access=private"); // Swimming pool 47 50 48 51 EdigeoFileVEC.addObjectPostProcessor((o, p) -> { … … 57 60 p.remove(t); 58 61 } 59 p.put("name", sb.toString() );62 p.put("name", sb.toString().replaceAll(" ", " ").replaceAll(" ", " ")); 60 63 }, "TEX_id"); 61 64 … … 76 79 } 77 80 }, o -> o.hasScdIdentifier("ZONCOMMUNI_id")); 81 82 EdigeoFileVEC.addObjectPostProcessor((o, p) -> { 83 p.put("boundary", "administrative"); 84 p.put("admin_level", "8"); 85 p.put("ref:INSEE", "XX"+p.get("IDU_id")); // TODO: find department number 86 p.put("name", p.get("TEX2_id")); // TODO: lowercase 87 p.remove("IDU_id"); 88 p.remove("TEX2_id"); 89 }, o -> o.hasScdIdentifier("COMMUNE_id")); 90 91 EdigeoFileVEC.addObjectPostProcessor((o, p) -> { 92 p.put("boundary", "cadastral"); 93 p.put("ref", p.get("IDU_id")); 94 p.remove("IDU_id"); 95 }, o -> o.hasScdIdentifier("SECTION_id") || o.hasScdIdentifier("SUBDSECT_id") || o.hasScdIdentifier("PARCELLE_id")); 96 97 EdigeoFileVEC.addObjectPostProcessor((o, p) -> p.put("wall", "no"), "DUR_id", "02"); 98 EdigeoFileVEC.addObjectPostProcessor((o, p) -> { 99 p.put("building", "yes"); 100 p.remove("DUR_id"); 101 }, o -> o.hasScdIdentifier("BATIMENT_id")); 78 102 } 79 103
Note:
See TracChangeset
for help on using the changeset viewer.