org.openstreetmap.josm.data.validation
Class OsmValidator

java.lang.Object
  extended by org.openstreetmap.josm.data.validation.OsmValidator
All Implemented Interfaces:
MapView.LayerChangeListener

public class OsmValidator
extends java.lang.Object
implements MapView.LayerChangeListener

A OSM data validator


Field Summary
static java.lang.Class<Test>[] allAvailableTests
          All available tests TODO: is there any way to find out automatically all available tests?
static ValidatorLayer errorLayer
           
static double griddetail
          Grid detail, multiplier of east,north values for valuable cell sizing
static java.util.Collection<java.lang.String> ignoredErrors
           
 
Constructor Summary
OsmValidator()
           
 
Method Summary
 void activeLayerChange(Layer oldLayer, Layer newLayer)
          Notifies this listener that the active layer has changed.
static void addIgnoredError(java.lang.String s)
           
private static void applyPrefs(java.util.Map<java.lang.String,Test> tests, boolean beforeUpload)
           
private  void checkValidatorDir()
          Check if plugin directory exists (store ignored errors file)
static java.lang.Class<Test>[] getAllAvailableTests()
          Gets the list of all available test classes
static java.util.Map<java.lang.String,Test> getAllTestsMap()
          Gets a map from simple names to all tests.
static java.util.Collection<Test> getEnabledTests(boolean beforeUpload)
           
static java.util.Collection<Test> getTests()
           
static java.lang.String getValidatorDir()
          Returns the plugin's directory of the plugin
static boolean hasIgnoredError(java.lang.String s)
           
static void initializeErrorLayer()
           
 void initializeGridDetail()
          Initialize grid details based on current projection system.
static void initializeTests(java.util.Collection<Test> allTests)
          Initializes all tests
 void layerAdded(Layer newLayer)
          Notifies this listener that a layer has been added.
 void layerRemoved(Layer oldLayer)
          Notifies this listener that a layer has been removed.
private  void loadIgnoredErrors()
           
static void saveIgnoredErrors()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorLayer

public static ValidatorLayer errorLayer

griddetail

public static double griddetail
Grid detail, multiplier of east,north values for valuable cell sizing


ignoredErrors

public static final java.util.Collection<java.lang.String> ignoredErrors

allAvailableTests

public static java.lang.Class<Test>[] allAvailableTests
All available tests TODO: is there any way to find out automatically all available tests?

Constructor Detail

OsmValidator

public OsmValidator()
Method Detail

getValidatorDir

public static java.lang.String getValidatorDir()
Returns the plugin's directory of the plugin

Returns:
The directory of the plugin

checkValidatorDir

private void checkValidatorDir()
Check if plugin directory exists (store ignored errors file)


loadIgnoredErrors

private void loadIgnoredErrors()

addIgnoredError

public static void addIgnoredError(java.lang.String s)

hasIgnoredError

public static boolean hasIgnoredError(java.lang.String s)

saveIgnoredErrors

public static void saveIgnoredErrors()

initializeErrorLayer

public static void initializeErrorLayer()

getAllTestsMap

public static java.util.Map<java.lang.String,Test> getAllTestsMap()
Gets a map from simple names to all tests.


applyPrefs

private static void applyPrefs(java.util.Map<java.lang.String,Test> tests,
                               boolean beforeUpload)

getTests

public static java.util.Collection<Test> getTests()

getEnabledTests

public static java.util.Collection<Test> getEnabledTests(boolean beforeUpload)

getAllAvailableTests

public static java.lang.Class<Test>[] getAllAvailableTests()
Gets the list of all available test classes

Returns:
An array of the test classes

initializeGridDetail

public void initializeGridDetail()
Initialize grid details based on current projection system. Values based on the original value fixed for EPSG:4326 (10000) using heuristics (that is, test&error until most bugs were discovered while keeping the processing time reasonable)


initializeTests

public static void initializeTests(java.util.Collection<Test> allTests)
Initializes all tests

Parameters:
allTests - The tests to initialize

activeLayerChange

public void activeLayerChange(Layer oldLayer,
                              Layer newLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that the active layer has changed.

Specified by:
activeLayerChange in interface MapView.LayerChangeListener
Parameters:
oldLayer - The previous active layer
newLayer - The new activer layer

layerAdded

public void layerAdded(Layer newLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that a layer has been added.

Specified by:
layerAdded in interface MapView.LayerChangeListener
Parameters:
newLayer - The new added layer

layerRemoved

public void layerRemoved(Layer oldLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that a layer has been removed.

Specified by:
layerRemoved in interface MapView.LayerChangeListener
Parameters:
oldLayer - The old removed layer


JOSM