Ignore:
Timestamp:
2009-10-11T18:22:56+02:00 (15 years ago)
Author:
stoecker
Message:

fixed josm 3574

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

Legend:

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

    r17722 r18088  
    88import javax.swing.JPanel;
    99
     10import org.openstreetmap.josm.Main;
    1011import org.openstreetmap.josm.command.Command;
     12import org.openstreetmap.josm.data.osm.BackreferencedDataSet;
    1113import org.openstreetmap.josm.data.osm.Node;
    1214import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    5658    /** Whether the test is run on a partial selection data */
    5759    protected boolean partialSelection;
    58    
     60
    5961    /** the progress monitor to use */
    6062    protected ProgressMonitor progressMonitor;
     63
     64    /**
     65     * the data structure with child->parent references
     66     */
     67    protected BackreferencedDataSet backreferenceDataSet;
    6168
    6269    /**
     
    93100     */
    94101    public void startTest(ProgressMonitor progressMonitor) {
    95         if (progressMonitor == null) {
    96                 this.progressMonitor = NullProgressMonitor.INSTANCE;
    97         } else {
    98                 this.progressMonitor = progressMonitor;
    99         }
    100         this.progressMonitor.beginTask(tr("Running test {0}", name));
    101         errors = new ArrayList<TestError>(30);
     102        backreferenceDataSet = new BackreferencedDataSet(Main.main.getCurrentDataSet());
     103        backreferenceDataSet.build();
     104        if (progressMonitor == null) {
     105                this.progressMonitor = NullProgressMonitor.INSTANCE;
     106        } else {
     107                this.progressMonitor = progressMonitor;
     108        }
     109        this.progressMonitor.beginTask(tr("Running test {0}", name));
     110        errors = new ArrayList<TestError>(30);
    102111    }
    103112
     
    125134     */
    126135    public void endTest() {
    127         progressMonitor.finishTask();
    128         progressMonitor = null;
     136        progressMonitor.finishTask();
     137        progressMonitor = null;
     138        backreferenceDataSet = null;
    129139    }
    130140
     
    137147    public void visit(Collection<OsmPrimitive> selection)
    138148    {
    139         progressMonitor.setTicksCount(selection.size());
     149        progressMonitor.setTicksCount(selection.size());
    140150        for (OsmPrimitive p : selection) {
    141151            if( p.isUsable() )
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnclosedWays.java

    r17722 r18088  
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1212import org.openstreetmap.josm.data.osm.OsmUtils;
     13import org.openstreetmap.josm.data.osm.Relation;
    1314import org.openstreetmap.josm.data.osm.Way;
    1415import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    3637    @Override
    3738    public void startTest(ProgressMonitor monitor) {
    38         super.startTest(monitor);
     39        super.startTest(monitor);
    3940        _errorWays = new Bag<Way, Way>();
    4041    }
     
    108109        if (type != null && !w.isClosed())
    109110        {
     111            for (OsmPrimitive parent: this.backreferenceDataSet.getParents(w)) {
     112                if (parent instanceof Relation && "multipolygon".equals(parent.get("type")))
     113                    return;
     114            }
    110115            Node f = w.getNode(0);
    111116            Node l = w.getNode(w.getNodesCount() - 1);
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java

    r17722 r18088  
    9090                    if( !hasName && !isRoundabout)
    9191                        errors.add( new TestError(this, Severity.WARNING, tr("Unnamed ways"), UNNAMED_WAY, w) );
    92                     else if(isRoundabout)
     92                    else if(isRoundabout)
    9393                        errors.add( new TestError(this, Severity.WARNING, tr("Unnamed junction"), UNNAMED_JUNCTION, w) );
    9494                }
     
    115115    public void startTest(ProgressMonitor monitor)
    116116    {
    117         super.startTest(monitor);
     117        super.startTest(monitor);
    118118        multipolygonways = new LinkedList<Way>();
    119119        for (final Relation r : Main.main.getCurrentDataSet().relations)
Note: See TracChangeset for help on using the changeset viewer.