Changeset 13598 in osm for applications


Ignore:
Timestamp:
2009-02-08T16:06:16+01:00 (15 years ago)
Author:
stoecker
Message:

some minor updates

Location:
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnclosedWays.java

    r13497 r13598  
    88import java.util.List;
    99
    10 import org.openstreetmap.josm.data.coor.LatLon;
     10import org.openstreetmap.josm.data.osm.Node;
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1212import org.openstreetmap.josm.data.osm.OsmUtils;
     
    103103            set(true, 1130, marktr("area"));
    104104
    105         if (type != null) {
    106             LatLon s = w.nodes.get(0).coor;
    107             LatLon e = w.nodes.get(w.nodes.size() - 1).coor;
    108             /* take unclosed ways with end-to-end-distance below 10 km */
    109             if (s != e && (force || s.greatCircleDistance(e) < 10000)) {
     105        if (type != null && !w.isClosed())
     106        {
     107            Node f = w.nodes.get(0);
     108            Node l = w.nodes.get(w.nodes.size() - 1);
     109            if(force || f.coor.greatCircleDistance(l.coor) < 10000)
     110            {
    110111                List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
    111112                List<OsmPrimitive> highlight = new ArrayList<OsmPrimitive>();
    112113                primitives.add(w);
    113                 // The important parts of an unclosed way are the first and 
     114                // The important parts of an unclosed way are the first and
    114115                // the last node which should be connected, therefore we highlight them
    115                 highlight.add(w.nodes.get(0));
    116                 highlight.add(w.nodes.get(w.nodes.size() - 1));
     116                highlight.add(f);
     117                highlight.add(l);
    117118                errors.add(new TestError(this, Severity.WARNING, tr("Unclosed way"), type, etype, mode, primitives,
    118119                        highlight));
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java

    r13497 r13598  
    8383            for(MyWaySegment s : ways)
    8484            {
    85                 if(!s.highway && s.nearby(en, mindist))
     85                if(!s.highway && s.nearby(en, mindist) && !s.isArea())
    8686                    map.put(en, s.w);
    8787            }
     
    9191            for(MyWaySegment s : ways)
    9292            {
    93                 if(s.nearby(en, mindist))
     93                if(s.nearby(en, mindist) && !s.isArea())
    9494                    map.put(en, s.w);
    9595            }
     
    166166            return !w.nodes.contains(n)
    167167            && line.ptSegDist(n.eastNorth.east(), n.eastNorth.north()) < dist;
     168        }
     169       
     170        public boolean isArea() {
     171            return w.get("landuse") != null
     172                || w.get("leisure") != null
     173                || w.get("building") != null;
    168174        }
    169175    }
Note: See TracChangeset for help on using the changeset viewer.