Commit a0ff9ed7 authored by Matthias Betz's avatar Matthias Betz
Browse files

Added check plugin system

parent 0a7d6299
Pipeline #1380 passed with stage
in 2 minutes and 13 seconds
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -61,10 +63,19 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
*/
public abstract class Check {
private CheckId id;
private List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
public Check(CheckId id) {
this.id = id;
@SuppressWarnings("unchecked")
public Check() {
Method[] declaredMethods = getClass().getDeclaredMethods();
for (Method m : declaredMethods) {
if ("check".equals(m.getName())) {
Class<?>[] parameterTypes = m.getParameterTypes();
if (parameterTypes.length == 1 && Checkable.class.isAssignableFrom(parameterTypes[0])) {
applicableToClasses.add((Class<Checkable>) parameterTypes[0]);
}
}
}
}
/**
......@@ -72,7 +83,9 @@ public abstract class Check {
*
* @return a list of classes which the check applies to
*/
public abstract List<Class<? extends Checkable>> getApplicableToClasses();
public List<Class<Checkable>> getApplicableToClasses() {
return applicableToClasses;
}
/**
* A list of dependencies which the check depends on. Each of those dependencies
......@@ -90,9 +103,7 @@ public abstract class Check {
*
* @return the check id.
*/
public CheckId getCheckId() {
return id;
}
public abstract CheckId getCheckId();
/**
* Getter for the check type.
......@@ -123,10 +134,10 @@ public abstract class Check {
boolean hasError = c.containsError(dependencyCheck);
if (hasError) {
// check whether a result was already inserted
if (!c.hasDependencyNotMetError(id)) {
if (!c.hasDependencyNotMetError(getCheckId())) {
// insert dependency error
CheckError err = new DependenciesNotMetError(dependencyCheck);
CheckResult cr = new CheckResult(this.id, ResultStatus.DEPENDENCIES_NOT_MET, err);
CheckResult cr = new CheckResult(getCheckId(), ResultStatus.DEPENDENCIES_NOT_MET, err);
c.addCheckResult(cr);
}
return false;
......@@ -306,7 +317,7 @@ public abstract class Check {
@Override
public String toString() {
return "Check [id=" + id + "]";
return "Check [id=" + getCheckId() + "]";
}
/**
......
......@@ -19,7 +19,6 @@
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serializable;
import java.util.Objects;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
......@@ -32,56 +31,29 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
* @author Matthias Betz
*
*/
public abstract class CheckError implements Serializable {
public interface CheckError extends Serializable {
private static final long serialVersionUID = -4428235366383090704L;
private ErrorType type;
private ErrorId id;
private GmlElement feature;
/**
* Necessary information for every error type needs to be provided in this
* constructor.
*
* @param id the error id (not null)
* @param type the error type (not null)
* @param feature element in which the error occurred
*/
public CheckError(ErrorId id, ErrorType type, GmlElement feature) {
Objects.requireNonNull(id, "id may not be null");
Objects.requireNonNull(type, "type may not be null");
this.type = type;
this.id = id;
this.feature = feature;
}
/**
* Getter for the error type
*
* @return the error type
*/
public ErrorType getType() {
return type;
}
public ErrorType getType();
/**
* Getter for the error id
*
* @return the error id
*/
public ErrorId getErrorId() {
return id;
}
public ErrorId getErrorId();
/**
* The gml feature in which the error occured
*
* @return the gml feature
*/
public GmlElement getFeature() {
return feature;
}
public GmlElement getFeature();
/**
* A general visitor will have a look at this error. Visitor pattern.
......@@ -89,7 +61,7 @@ public abstract class CheckError implements Serializable {
* @param errorVisitor the visitor, call {@link ErrorVisitor#visit(CheckError)})
* on this.
*/
public abstract void accept(ErrorVisitor errorVisitor);
public void accept(ErrorVisitor errorVisitor);
/**
* Visitor pattern for the healing methods. Call
......@@ -100,7 +72,7 @@ public abstract class CheckError implements Serializable {
* @param l a modification listener when a healing method changes something
* @return true if the healing method changed something in the model
*/
public abstract boolean accept(HealingMethod method, ModificationListener l);
public boolean accept(HealingMethod method, ModificationListener l);
/**
* This method functions as interface to various reporting places. The
......@@ -109,6 +81,6 @@ public abstract class CheckError implements Serializable {
*
* @param report
*/
public abstract void report(ErrorReport report);
public void report(ErrorReport report);
}
......@@ -9,7 +9,7 @@
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY); without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
......@@ -18,57 +18,81 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
import java.io.Serializable;
public enum CheckId {
public class CheckId implements Serializable {
C_GE_R_TOO_FEW_POINTS("C_GE_R_TOO_FEW_POINTS"), C_GE_R_NOT_CLOSED("C_GE_R_NOT_CLOSED"),
C_GE_S_MULTIPLE_CONNECTED_COMPONENTS("C_GE_S_MULTIPLE_CONNECTED_COMPONENTS"),
C_GE_R_DUPLICATE_POINT("C_GE_R_DUPLICATE_POINT"), C_GE_R_SELF_INTERSECTION("C_GE_R_SELF_INTERSECTION"),
C_GE_P_INTERIOR_DISCONNECTED("C_GE_P_INTERIOR_DISCONNECTED"),
C_GE_P_INTERSECTING_RINGS("C_GE_P_INTERSECTING_RINGS"), C_GE_P_NON_PLANAR("C_GE_P_NON_PLANAR"),
C_GE_S_TOO_FEW_POLYGONS("C_GE_S_TOO_FEW_POLYGONS"), NULL_AREA("C_GE_R_NULL_AREA"),
C_GE_S_NOT_CLOSED("C_GE_S_NOT_CLOSED"), C_GE_S_NON_MANIFOLD_EDGE("C_GE_S_NON_MANIFOLD_EDGE"),
C_GE_S_POLYGON_WRONG_ORIENTATION("C_GE_S_POLYGON_WRONG_ORIENTATION"),
C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION("C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION"),
C_GE_S_NON_MANIFOLD_VERTEX("C_GE_S_NON_MANIFOLD_VERTEX"), C_GE_S_SELF_INTERSECTION("C_GE_S_SELF_INTERSECTION"),
C_GE_P_HOLE_OUTSIDE("C_GE_P_HOLE_OUTSIDE"), C_GE_P_ORIENTATION_RINGS_SAME("C_GE_P_ORIENTATION_RINGS_SAME"),
C_GE_P_INNER_RINGS_NESTED("C_GE_P_INNER_RINGS_NESTED"), IS_CEILING("IS_CEILING"),
C_SEM_F_MISSING_ID("C_SEM_F_MISSING_ID"), C_SEM_BS_NOT_CEILING("C_SEM_BS_NOT_CEILING"),
C_SEM_BS_NOT_FLOOR("C_SEM_BS_NOT_FLOOR"), C_SEM_BS_NOT_GROUND("C_SEM_BS_NOT_GROUND"),
C_SEM_BS_GROUND_NOT_FRAGMENTED("C_SEM_BS_GROUND_NOT_FRAGMENTED"), C_SEM_BS_IS_WALL("C_SEM_BS_IS_WALL"),
C_SEM_SCHEMATRON("C_SEM_SCHEMATRON"), C_SEM_BS_ROOF_NOT_FRAGMENTED("C_SEM_BS_ROOF_NOT_FRAGMENTED");
private static final long serialVersionUID = -6267337828874296004L;
public static final CheckId C_GE_R_TOO_FEW_POINTS = new CheckId("C_GE_R_TOO_FEW_POINTS");
public static final CheckId C_GE_R_NOT_CLOSED = new CheckId("C_GE_R_NOT_CLOSED");
public static final CheckId C_GE_S_MULTIPLE_CONNECTED_COMPONENTS = new CheckId(
"C_GE_S_MULTIPLE_CONNECTED_COMPONENTS");
public static final CheckId C_GE_R_DUPLICATE_POINT = new CheckId("C_GE_R_DUPLICATE_POINT");
public static final CheckId C_GE_R_SELF_INTERSECTION = new CheckId("C_GE_R_SELF_INTERSECTION");
public static final CheckId C_GE_P_INTERIOR_DISCONNECTED = new CheckId("C_GE_P_INTERIOR_DISCONNECTED");
public static final CheckId C_GE_P_INTERSECTING_RINGS = new CheckId("C_GE_P_INTERSECTING_RINGS");
public static final CheckId C_GE_P_NON_PLANAR = new CheckId("C_GE_P_NON_PLANAR");
public static final CheckId C_GE_S_TOO_FEW_POLYGONS = new CheckId("C_GE_S_TOO_FEW_POLYGONS");
public static final CheckId C_GE_R_NULL_AREA = new CheckId("C_GE_R_NULL_AREA");
public static final CheckId C_GE_S_NON_MANIFOLD_EDGE = new CheckId("C_GE_S_NON_MANIFOLD_EDGE");
public static final CheckId C_GE_S_POLYGON_WRONG_ORIENTATION = new CheckId("C_GE_S_POLYGON_WRONG_ORIENTATION");
public static final CheckId C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION = new CheckId(
"C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION");
public static final CheckId C_GE_S_NON_MANIFOLD_VERTEX = new CheckId("C_GE_S_NON_MANIFOLD_VERTEX");
public static final CheckId C_GE_S_SELF_INTERSECTION = new CheckId("C_GE_S_SELF_INTERSECTION");
public static final CheckId C_GE_P_HOLE_OUTSIDE = new CheckId("C_GE_P_HOLE_OUTSIDE");
public static final CheckId IS_CEILING = new CheckId("IS_CEILING");
public static final CheckId C_GE_P_INNER_RINGS_NESTED = new CheckId("C_GE_P_INNER_RINGS_NESTED");
public static final CheckId C_SEM_BS_NOT_CEILING = new CheckId("C_SEM_BS_NOT_CEILING");
public static final CheckId C_SEM_BS_NOT_FLOOR = new CheckId("C_SEM_BS_NOT_FLOOR");
public static final CheckId C_SEM_BS_NOT_GROUND = new CheckId("C_SEM_BS_NOT_GROUND");
public static final CheckId C_SEM_F_MISSING_ID = new CheckId("C_SEM_F_MISSING_ID");
public static final CheckId C_SEM_BS_GROUND_NOT_FRAGMENTED = new CheckId("C_SEM_BS_GROUND_NOT_FRAGMENTED");
public static final CheckId C_SEM_BS_IS_WALL = new CheckId("C_SEM_BS_IS_WALL");
public static final CheckId C_SEM_SCHEMATRON = new CheckId("C_SEM_SCHEMATRON");
public static final CheckId C_SEM_BS_ROOF_NOT_FRAGMENTED = new CheckId("C_SEM_BS_ROOF_NOT_FRAGMENTED");
public static final CheckId C_GE_S_NOT_CLOSED = new CheckId("C_GE_S_NOT_CLOSED");
public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME");
private String name;
private static final Map<String, CheckId> ENUM_MAP;
static {
Map<String, CheckId> map = new TreeMap<>();
for (CheckId instance : CheckId.values()) {
map.put(instance.toString().toUpperCase(), instance);
}
ENUM_MAP = Collections.unmodifiableMap(map);
public CheckId(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
private String id;
private CheckId(String id) {
this.id = id;
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CheckId other = (CheckId) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return id;
return name;
}
/**
* Converts a String to a check id if possible.
*
* @param checkName the string representation of a check
* @return the check id or null if not found.
*/
public static CheckId getIdForName(String checkName) {
return ENUM_MAP.get(checkName.toUpperCase());
}
}
......@@ -19,7 +19,7 @@
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serializable;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -40,7 +40,7 @@ public abstract class Checkable implements Serializable {
private static final Logger logger = LogManager.getLogger(Checkable.class);
private EnumMap<CheckId, CheckResult> checkResults = new EnumMap<>(CheckId.class);
private Map<CheckId, CheckResult> checkResults = new HashMap<>();
private boolean isValidated = false;
protected void setValidated(boolean validated) {
......
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serializable;
/**
* The error ids of all checks and their respective name, which is used in
* reports and GUI
......@@ -25,30 +27,75 @@ package de.hft.stuttgart.citydoctor2.check;
* @author Matthias Betz
*
*/
public enum ErrorId {
DEPENDENCIES_NOT_MET("Dependencies_not_met"), UNKNOWN_ERROR("Unknown_error"), GE_R_NOT_CLOSED("GE_R_NOT_CLOSED"),
GE_S_MULTIPLE_CONNECTED_COMPONENTS("GE_S_MULTIPLE_CONNECTED_COMPONENTS"),
GE_R_CONSECUTIVE_POINTS_SAME("GE_R_CONSECUTIVE_POINTS_SAME"), GE_R_SELF_INTERSECTION("GE_R_SELF_INTERSECTION"),
GE_S_POLYGON_WRONG_ORIENTATION("GE_S_POLYGON_WRONG_ORIENTATION"),
GE_S_ALL_POLYGONS_WRONG_ORIENTATION("GE_S_ALL_POLYGONS_WRONG_ORIENTATION"), GE_P_HOLE_OUTSIDE("GE_P_HOLE_OUTSIDE"),
GE_P_INTERIOR_DISCONNECTED("GE_P_INTERIOR_DISCONNECTED"), GE_S_NON_MANIFOLD_VERTEX("GE_S_NON_MANIFOLD_VERTEX"),
GE_P_INNER_RINGS_NESTED("GE_P_INNER_RINGS_NESTED"), GE_R_NULL_AREA("GE_R_NULL_AREA"),
GE_R_TOO_FEW_POINTS("GE_R_TOO_FEW_POINTS"), GE_S_NON_MANIFOLD_EDGE("GE_S_NON_MANIFOLD_EDGE"),
GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION("GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION"),
GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE("GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"),
GE_P_ORIENTATION_RINGS_SAME("GE_P_ORIENTATION_RINGS_SAME"), GE_P_INTERSECTING_RINGS("GE_P_INTERSECTION_RINGS"),
GE_S_NOT_CLOSED("GE_S_NOT_CLOSED"), GE_S_SELF_INTERSECTION("GE_S_SELF_INTERSECTION"),
GE_S_TOO_FEW_POLYGONS("GE_S_TOO_FEW_POLYGONS"), SEM_F_MISSING_ID("SEM_F_MISSING_GML_ID"),
SEM_BS_NOT_CEILING("SEM_BS_NOT_CEILING"), SEM_BS_NOT_WALL("SEM_BS_NOT_WALL"), SEM_BS_NOT_FLOOR("SEM_BS_NOT_FLOOR"),
SEM_BS_NOT_GROUND("SEM_BS_NOT_GROUND"), SEM_SCHEMATRON_ERROR("SEM_SCHEMATRON_ERROR"), SEM_BS_UNFRAGMENTED("SEM_BS_UNFRAGMENTED"), GE_P_TINY_EDGE("GE_P_TINY_EDGE");
public class ErrorId implements Serializable {
private static final long serialVersionUID = -2598466667746276560L;
public static final ErrorId DEPENDENCIES_NOT_MET = new ErrorId("Dependencies_not_met");
public static final ErrorId UNKNOWN_ERROR = new ErrorId("Unknown_error");
public static final ErrorId GE_R_NOT_CLOSED = new ErrorId("GE_R_NOT_CLOSED");
public static final ErrorId GE_S_MULTIPLE_CONNECTED_COMPONENTS = new ErrorId("GE_S_MULTIPLE_CONNECTED_COMPONENTS");
public static final ErrorId GE_R_CONSECUTIVE_POINTS_SAME = new ErrorId("GE_R_CONSECUTIVE_POINTS_SAME");
public static final ErrorId GE_R_SELF_INTERSECTION = new ErrorId("GE_R_SELF_INTERSECTION");
public static final ErrorId GE_S_POLYGON_WRONG_ORIENTATION = new ErrorId("GE_S_POLYGON_WRONG_ORIENTATION");
public static final ErrorId GE_S_ALL_POLYGONS_WRONG_ORIENTATION = new ErrorId(
"GE_S_ALL_POLYGONS_WRONG_ORIENTATION");
public static final ErrorId GE_P_HOLE_OUTSIDE = new ErrorId("GE_P_HOLE_OUTSIDE");
public static final ErrorId GE_P_INTERIOR_DISCONNECTED = new ErrorId("GE_P_INTERIOR_DISCONNECTED");
public static final ErrorId GE_S_NON_MANIFOLD_VERTEX = new ErrorId("GE_S_NON_MANIFOLD_VERTEX");
public static final ErrorId GE_P_INNER_RINGS_NESTED = new ErrorId("GE_P_INNER_RINGS_NESTED");
public static final ErrorId GE_R_NULL_AREA = new ErrorId("GE_R_NULL_AREA");
public static final ErrorId GE_R_TOO_FEW_POINTS = new ErrorId("GE_R_TOO_FEW_POINTS");
public static final ErrorId GE_S_NON_MANIFOLD_EDGE = new ErrorId("GE_S_NON_MANIFOLD_EDGE");
public static final ErrorId GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION = new ErrorId(
"GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION");
public static final ErrorId GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE = new ErrorId(
"GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE");
public static final ErrorId GE_P_INTERSECTING_RINGS = new ErrorId("GE_P_INTERSECTING_RINGS");
public static final ErrorId GE_S_SELF_INTERSECTION = new ErrorId("GE_S_SELF_INTERSECTION");
public static final ErrorId GE_P_ORIENTATION_RINGS_SAME = new ErrorId("GE_P_ORIENTATION_RINGS_SAME");
public static final ErrorId GE_S_NOT_CLOSED = new ErrorId("GE_S_NOT_CLOSED");
public static final ErrorId GE_S_TOO_FEW_POLYGONS = new ErrorId("GE_S_TOO_FEW_POLYGONS");
public static final ErrorId SEM_F_MISSING_ID = new ErrorId("SEM_F_MISSING_ID");
public static final ErrorId SEM_BS_NOT_CEILING = new ErrorId("SEM_BS_NOT_CEILING");
public static final ErrorId SEM_BS_NOT_WALL = new ErrorId("SEM_BS_NOT_WALL");
public static final ErrorId SEM_BS_NOT_FLOOR = new ErrorId("SEM_BS_NOT_FLOOR");
public static final ErrorId SEM_BS_NOT_GROUND = new ErrorId("SEM_BS_NOT_GROUND");
public static final ErrorId SEM_SCHEMATRON_ERROR = new ErrorId("SEM_SCHEMATRON_ERROR");
public static final ErrorId SEM_BS_UNFRAGMENTED = new ErrorId("SEM_BS_UNFRAGMENTED");
public static final ErrorId GE_P_TINY_EDGE = new ErrorId("GE_P_TINY_EDGE");
private String name;
private ErrorId(String name) {
public ErrorId(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ErrorId other = (ErrorId) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return name;
......
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
/**
* Error when all polygons are oriented wrong.
......@@ -33,14 +34,13 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
* @author Matthias Betz
*
*/
public class AllPolygonsWrongOrientationError extends CheckError {
public class AllPolygonsWrongOrientationError implements CheckError {
private static final long serialVersionUID = 2263993313732858840L;
private Geometry geom;
public AllPolygonsWrongOrientationError(Geometry geom) {
super(ErrorId.GE_S_ALL_POLYGONS_WRONG_ORIENTATION, ErrorType.ERROR, geom);
this.geom = geom;
}
......@@ -68,4 +68,19 @@ public class AllPolygonsWrongOrientationError extends CheckError {
report.add(geom);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_S_ALL_POLYGONS_WRONG_ORIENTATION;
}
@Override
public GmlElement getFeature() {
return getGeometry();
}
}
......@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
......@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
* @author Matthias Betz
*
*/
public class ConsecutivePointSameError extends CheckError {
public class ConsecutivePointSameError implements CheckError {
private static final long serialVersionUID = -6355935751554777494L;
......@@ -44,7 +45,6 @@ public class ConsecutivePointSameError extends CheckError {
private Vertex p2;
public ConsecutivePointSameError(LinearRing lr, Vertex p1, Vertex p2) {
super(ErrorId.GE_R_CONSECUTIVE_POINTS_SAME, ErrorType.ERROR, lr);
this.lr = lr;
this.p1 = p1;
this.p2 = p2;
......@@ -83,4 +83,19 @@ public class ConsecutivePointSameError extends CheckError {
report.add("duplicate point 1", p1);
report.add("duplicate point 2", p2);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_R_CONSECUTIVE_POINTS_SAME;
}
@Override
public GmlElement getFeature() {
return getRing();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
/**
* When a check checks if it can be executed but one or more dependency has
......@@ -36,14 +37,13 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
* @author Matthias Betz
*
*/
public class DependenciesNotMetError extends CheckError {
public class DependenciesNotMetError implements CheckError {
private static final long serialVersionUID = -851655185949574160L;
private CheckId dependency;
public DependenciesNotMetError(CheckId dependency) {
super(ErrorId.DEPENDENCIES_NOT_MET, ErrorType.ERROR, null);
this.dependency = dependency;
}
......@@ -70,4 +70,19 @@ public class DependenciesNotMetError extends CheckError {
public void report(ErrorReport report) {
report.add("dependency", dependency.toString());
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.DEPENDENCIES_NOT_MET;
}
@Override
public GmlElement getFeature() {
return null;
}
}
......@@ -28,6 +28,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
......@@ -37,7 +38,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class MultipleConnectedComponentsError extends CheckError {
public class MultipleConnectedComponentsError implements CheckError {
private static final long serialVersionUID = 2152069835068857036L;
......@@ -45,7 +46,6 @@ public class MultipleConnectedComponentsError extends CheckError {
private List<List<Polygon>> components;
public MultipleConnectedComponentsError(Geometry geom, List<List<Polygon>> components) {
super(ErrorId.GE_S_MULTIPLE_CONNECTED_COMPONENTS, ErrorType.ERROR, geom);
this.geom = geom;
this.components = components;
}
......@@ -81,4 +81,19 @@ public class MultipleConnectedComponentsError extends CheckError {
public String toString() {
return "MultipleConnectedComponentsError [geom=" + geom + ", components=" + components + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_S_MULTIPLE_CONNECTED_COMPONENTS;
}
@Override
public GmlElement getFeature() {
return getGeometry();
}
}
......@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
......@@ -34,7 +35,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class NestedRingError extends CheckError {
public class NestedRingError implements CheckError {
private static final long serialVersionUID = -3396113374745830193L;
......@@ -43,7 +44,6 @@ public class NestedRingError extends CheckError {
private LinearRing withinRing;
public NestedRingError(Polygon p, LinearRing innerRing, LinearRing withinRing) {
super(ErrorId.GE_P_INNER_RINGS_NESTED, ErrorType.ERROR, p);
this.p = p;
this.innerRing = innerRing;
this.withinRing = withinRing;
......@@ -81,4 +81,19 @@ public class NestedRingError extends CheckError {
public String toString() {
return "NestedRingError [p=" + p + ", innerRing=" + innerRing + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_P_INNER_RINGS_NESTED;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -29,6 +29,7 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
/**
* If an edge is an edge in 3 or more polygons this error is created.
......@@ -36,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
* @author Matthias Betz
*
*/
public class NonManifoldEdgeError extends CheckError {
public class NonManifoldEdgeError implements CheckError {
private static final long serialVersionUID = -6742948557014332402L;
......@@ -44,7 +45,6 @@ public class NonManifoldEdgeError extends CheckError {
private Geometry geom;
public NonManifoldEdgeError(Geometry geom, List<Edge> edges) {
super(ErrorId.GE_S_NON_MANIFOLD_EDGE, ErrorType.ERROR, geom);
this.edges = edges;
this.geom = geom;
}
......@@ -79,4 +79,19 @@ public class NonManifoldEdgeError extends CheckError {
public String toString() {
return "ManifoldEdgeError [edges=" + edges + ", geom=" + geom + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_S_NON_MANIFOLD_EDGE;
}
@Override
public GmlElement getFeature() {
return getGeometry();
}
}
......@@ -28,6 +28,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
......@@ -38,7 +39,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
* @author Matthias Betz
*
*/
public class NonManifoldVertexError extends CheckError {
public class NonManifoldVertexError implements CheckError {
private static final long serialVersionUID = -3915669943428175777L;
......@@ -47,7 +48,6 @@ public class NonManifoldVertexError extends CheckError {
private Vertex v;
public NonManifoldVertexError(Geometry geom, List<List<Polygon>> components, Vertex v) {
super(ErrorId.GE_S_NON_MANIFOLD_VERTEX, ErrorType.ERROR, geom);
this.geom = geom;
this.components = components;
this.v = v;
......@@ -94,4 +94,19 @@ public class NonManifoldVertexError extends CheckError {
return "NonManifoldVertexError [components=" + components + ", geom=" + geom + ", v=" + v + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_S_NON_MANIFOLD_VERTEX;
}
@Override
public GmlElement getFeature() {
return getGeometry();
}
}
......@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Plane;
......@@ -37,7 +38,7 @@ import de.hft.stuttgart.citydoctor2.utils.Localization;
* @author Matthias Betz
*
*/
public class NonPlanarPolygonDistancePlaneError extends CheckError {
public class NonPlanarPolygonDistancePlaneError implements CheckError {
private static final long serialVersionUID = -3504364055236383519L;
......@@ -47,7 +48,6 @@ public class NonPlanarPolygonDistancePlaneError extends CheckError {
private Plane plane;
public NonPlanarPolygonDistancePlaneError(Polygon p, double distance, Vertex v, Plane plane) {
super(ErrorId.GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE, ErrorType.ERROR, p);
this.p = p;
this.distance = distance;
this.v = v;
......@@ -91,4 +91,19 @@ public class NonPlanarPolygonDistancePlaneError extends CheckError {
public String toString() {
return "DistanceError [p=" + p + ", distance=" + distance + ", v=" + v + ", plane=" + plane + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
......@@ -34,7 +35,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class NonPlanarPolygonNormalsDeviation extends CheckError {
public class NonPlanarPolygonNormalsDeviation implements CheckError {
private static final long serialVersionUID = 69073161885265794L;
......@@ -42,7 +43,6 @@ public class NonPlanarPolygonNormalsDeviation extends CheckError {
private double deviation;
public NonPlanarPolygonNormalsDeviation(Polygon p, double deviation) {
super(ErrorId.GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION, ErrorType.ERROR, p);
this.p = p;
this.deviation = deviation;
}
......@@ -75,4 +75,19 @@ public class NonPlanarPolygonNormalsDeviation extends CheckError {
public String toString() {
return "NormalDeviationError [p=" + p + ", deviation=" + deviation + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
......@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class NotCeilingError extends CheckError {
public class NotCeilingError implements CheckError {
private static final long serialVersionUID = 6725904270389419696L;
......@@ -43,7 +44,6 @@ public class NotCeilingError extends CheckError {
private Polygon p;
public NotCeilingError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_CEILING, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
......@@ -72,4 +72,19 @@ public class NotCeilingError extends CheckError {
report.add(surface);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.SEM_BS_NOT_CEILING;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
......@@ -34,7 +35,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class NotFloorError extends CheckError {
public class NotFloorError implements CheckError {
private static final long serialVersionUID = -3193557053834977449L;
......@@ -42,7 +43,6 @@ public class NotFloorError extends CheckError {
private Polygon p;
public NotFloorError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_FLOOR, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
......@@ -70,4 +70,19 @@ public class NotFloorError extends CheckError {
report.add(p);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.SEM_BS_NOT_FLOOR;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
......@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
* @author Matthias Betz
*
*/
public class NotGroundError extends CheckError {
public class NotGroundError implements CheckError {
private static final long serialVersionUID = 8793224454858861221L;
......@@ -43,7 +44,6 @@ public class NotGroundError extends CheckError {
private Polygon p;
public NotGroundError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_GROUND, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
......@@ -72,4 +72,19 @@ public class NotGroundError extends CheckError {
report.add(surface);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.SEM_BS_NOT_GROUND;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
......@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d;
* @author Matthias Betz
*
*/
public class NotWallError extends CheckError {
public class NotWallError implements CheckError {
private static final long serialVersionUID = 406429139625558232L;
......@@ -44,7 +45,6 @@ public class NotWallError extends CheckError {
private Vector3d normal;
public NotWallError(BoundarySurface bs, Polygon p, Vector3d normal) {
super(ErrorId.SEM_BS_NOT_WALL, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
this.normal = normal;
......@@ -75,4 +75,19 @@ public class NotWallError extends CheckError {
report.add("normal", normal);
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.SEM_BS_NOT_WALL;
}
@Override
public GmlElement getFeature() {
return getPolygon();
}
}
......@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
/**
......@@ -33,14 +34,13 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
* @author Matthias Betz
*
*/
public class NullAreaError extends CheckError {
public class NullAreaError implements CheckError {
private static final long serialVersionUID = 1358910429039553687L;
private LinearRing lr;
public NullAreaError(LinearRing lr) {
super(ErrorId.GE_R_NULL_AREA, ErrorType.ERROR, lr);
this.lr = lr;
}
......@@ -67,4 +67,19 @@ public class NullAreaError extends CheckError {
public String toString() {
return "NullAreaError [lr=" + lr + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_R_NULL_AREA;
}
@Override
public GmlElement getFeature() {
return getRing();
}
}
......@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
......@@ -36,7 +37,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
* @author Matthias Betz
*
*/
public class PointTouchesEdgeError extends CheckError {
public class PointTouchesEdgeError implements CheckError {
private static final long serialVersionUID = 3277456707271748954L;
......@@ -45,7 +46,6 @@ public class PointTouchesEdgeError extends CheckError {
private Vertex v;
public PointTouchesEdgeError(LinearRing lr, Edge e, Vertex v) {
super(ErrorId.GE_R_SELF_INTERSECTION, ErrorType.ERROR, lr);
this.lr = lr;
this.e = e;
this.v = v;
......@@ -86,4 +86,19 @@ public class PointTouchesEdgeError extends CheckError {
return "PointTouchesEdgeError [lr=" + lr + ", e=" + e + ", v=" + v + "]";
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ErrorId.GE_R_SELF_INTERSECTION;
}
@Override
public GmlElement getFeature() {
return getRing();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment