Changeset 5828 in josm for trunk/src/org


Ignore:
Timestamp:
2013-04-06T13:39:18+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #8580 - validator offers to fix empty new relations (by deleting them)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r5655 r5828  
    1313import java.util.Set;
    1414
     15import org.openstreetmap.josm.command.Command;
     16import org.openstreetmap.josm.command.DeleteCommand;
    1517import org.openstreetmap.josm.data.osm.Node;
    1618import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    211213        }
    212214    }
     215
     216    /* (non-Javadoc)
     217     * @see org.openstreetmap.josm.data.validation.Test#fixError(org.openstreetmap.josm.data.validation.TestError)
     218     */
     219    @Override
     220    public Command fixError(TestError testError) {
     221        if (isFixable(testError)) {
     222            return new DeleteCommand(testError.getPrimitives());
     223        }
     224        return null;
     225    }
     226
     227    /* (non-Javadoc)
     228     * @see org.openstreetmap.josm.data.validation.Test#isFixable(org.openstreetmap.josm.data.validation.TestError)
     229     */
     230    @Override
     231    public boolean isFixable(TestError testError) {
     232        return testError.getCode() == RELATION_EMPTY && testError.getPrimitives().iterator().next().isNew();
     233    }
    213234}
Note: See TracChangeset for help on using the changeset viewer.