Changeset 28314 in osm for applications/editors


Ignore:
Timestamp:
2012-04-18T19:40:13+02:00 (12 years ago)
Author:
donvip
Message:

[josm_opendata] Paris: Mobiliers sur voie publique

Location:
applications/editors/josm/plugins/opendata/modules/fr.paris/src/org/openstreetmap/josm/plugins/opendata/modules/fr/paris
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/modules/fr.paris/src/org/openstreetmap/josm/plugins/opendata/modules/fr/paris/ParisModule.java

    r28152 r28314  
    1919import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleInformation;
    2020import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.environnement.ArbresRemarquablesHandler;
     21import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.environnement.MobilierVoiePubliqueHandler;
    2122import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.urbanisme.EclairagePublicHandler;
    2223import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.urbanisme.SanisettesHandler;
     
    3233        //handlers.add(ElectriciteHandler.class); // Disabled (useless for OSM)
    3334        handlers.add(EclairagePublicHandler.class);
     35        handlers.add(MobilierVoiePubliqueHandler.class);
    3436    }
    3537}
  • applications/editors/josm/plugins/opendata/modules/fr.paris/src/org/openstreetmap/josm/plugins/opendata/modules/fr/paris/datasets/urbanisme/EclairagePublicHandler.java

    r28152 r28314  
    1616package org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.urbanisme;
    1717
    18 import java.nio.charset.Charset;
    19 import java.util.ArrayList;
    20 import java.util.HashMap;
    21 import java.util.List;
    22 import java.util.Map;
    2318import java.util.Set;
    2419
    25 import org.openstreetmap.josm.data.coor.EastNorth;
    2620import org.openstreetmap.josm.data.osm.DataSet;
    2721import org.openstreetmap.josm.data.osm.Node;
    2822import org.openstreetmap.josm.data.osm.OsmPrimitive;
    29 import org.openstreetmap.josm.data.osm.Way;
    30 import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchShpHandler;
    3123import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.ParisDataSetHandler;
     24import org.openstreetmap.josm.plugins.opendata.modules.fr.paris.datasets.ParisShpHandler;
    3225import org.openstreetmap.josm.tools.Geometry;
    3326
     
    5245        }
    5346       
    54         private class InternalShpHandler extends FrenchShpHandler {
     47        private final class InternalShpHandler extends ParisShpHandler {
    5548               
    56                 private final Map<String, Node> nodes = new HashMap<String, Node>();
    57                
    58                 public InternalShpHandler() {
    59                         setDbfCharset(Charset.forName(CP850));
    60                 }
    61                
    62                 private Node getNode(EastNorth en, String key) {
    63                         Node n = nodes.get(key);
    64                         /*if (n == null) {
    65                                 for (Node node : nodes.values()) {
    66                                         if (node.getEastNorth().equalsEpsilon(en, 0.0000001)) {
    67                                                 return node;
    68                                         }
    69                                 }
    70                         }*/
    71                         return n;
    72                 }
    73                
    74                 private Node createOrGetNode(DataSet ds, EastNorth en) {
    75                         String key = en.getX()+"/"+en.getY();
    76                         Node n = getNode(en, key);
    77                         if (n == null) {
    78                                 n = new Node(en);
    79                                 nodes.put(key, n);
    80                                 ds.addPrimitive(n);
    81                         }
    82                         return n;
    83                 }
    84 
    8549                @Override
    8650                public void notifyFeatureParsed(Object feature, DataSet result, Set<OsmPrimitive> featurePrimitives) {
    87                         OsmPrimitive dataPrimitive = null;
    88                         Way closedWay = null;
    89                         List<Way> ways = new ArrayList<Way>();
    90                         List<Node> nodes = new ArrayList<Node>();
    91                         for (OsmPrimitive p : featurePrimitives) {
    92                                 if (p.hasKeys()) {
    93                                         dataPrimitive = p;
    94                                 }
    95                                 if (p instanceof Way) {
    96                                         Way w = (Way) p;
    97                                         ways.add(w);
    98                                         if (w.isClosed()) {
    99                                                 closedWay = w;
    100                                         }
    101                                 } else if (p instanceof Node) {
    102                                         nodes.add((Node) p);
    103                                 }
    104                         }
     51                        initFeaturesPrimitives(featurePrimitives);
    10552                        if (dataPrimitive == null) {
    10653                                System.err.println("Found no primitive with tags");
     
    11764                                        System.err.println("Found 2 street lamps at the same position with different types: '"+centroid.get("lamp_model:fr")+"' and '"+dataPrimitive.get("Libelle")+"'.");
    11865                                }
    119                                 for (Way w : ways) {
    120                                         w.setNodes(null);
    121                                         result.removePrimitive(w);
    122                                 }
    123                                 for (Node n : nodes) {
    124                                         result.removePrimitive(n);
    125                                 }
     66                                removePrimitives(result);
    12667                               
    12768                                if (centroid.get("lamp_model:fr") != null) {
Note: See TracChangeset for help on using the changeset viewer.