Changeset 2623 in osm for applications/editors/josm


Ignore:
Timestamp:
2007-04-22T14:56:56+02:00 (18 years ago)
Author:
frsantos
Message:

Fix detection of orphaned segments when there is selected data

File:
1 edited

Legend:

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

    r2591 r2623  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
    5 import java.util.HashSet;
    6 import java.util.Set;
     5import java.util.*;
    76
    8 import org.openstreetmap.josm.data.osm.Segment;
    9 import org.openstreetmap.josm.data.osm.Way;
     7import org.openstreetmap.josm.Main;
     8import org.openstreetmap.josm.data.osm.*;
    109import org.openstreetmap.josm.plugins.validator.Severity;
    1110import org.openstreetmap.josm.plugins.validator.Test;
     
    4847        }
    4948
     49    @Override
     50    public void visit(Collection<OsmPrimitive> selection)
     51    {
     52        // If there is a partial selection, it may be false positives if a
     53        // segment is selected, but not the container way. So, in this
     54        // case, we must visit all ways, selected or not.
     55
     56        for (OsmPrimitive p : selection)
     57        {
     58            if( !p.deleted )
     59            {
     60                if( !partialSelection || p instanceof Segment )
     61                    p.visit(this);
     62            }
     63        }
     64       
     65        if( partialSelection )
     66        {
     67            for( Way w : Main.ds.ways)
     68                visit(w);
     69        }
     70    }
     71   
    5072        @Override
    5173        public void visit(Segment s)
    5274        {
     75       
    5376                segments.add(s);
    5477        }
Note: See TracChangeset for help on using the changeset viewer.