Commit 5d40c7b6 authored by Matthias Betz's avatar Matthias Betz
Browse files

CityDoctor2 validation open source release

parents
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check;
/**
* Status of the result of a check.
*
* @author Matthias Betz
*
*/
public enum ResultStatus {
OK, ERROR, DEPENDENCIES_NOT_MET, WARNING
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check;
/**
* A unit description. Used in the parameters of a check to specify what type of
* value is required.
*
* @author Matthias Betz
*
*/
public enum Unit {
KWH("kWh"), METER("m"), SQUARE_METER("m²"), CUBIC_METER("m³"), RADIAN("Radian"), NONE(""), DEGREE("Degree");
private String representation;
private Unit(String rep) {
representation = rep;
}
public String getRepresentation() {
return representation;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Geometry;
/**
* Error when all polygons are oriented wrong.
*
* @author Matthias Betz
*
*/
public class AllPolygonsWrongOrientationError extends 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;
}
public Geometry getGeometry() {
return geom;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "AllPolygonsWrongOrientationError [geom=" + geom + "]";
}
@Override
public void report(ErrorReport report) {
report.add(geom);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
/**
* When two points are too close to each other and are consecutive in a linear
* ring, this error is created.
*
* @author Matthias Betz
*
*/
public class ConsecutivePointSameError extends CheckError {
private static final long serialVersionUID = -6355935751554777494L;
private LinearRing lr;
private Vertex p1;
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;
}
public LinearRing getRing() {
return lr;
}
public Vertex getVertex1() {
return p1;
}
public Vertex getVertex2() {
return p2;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "ConsecutivePointSameError [lr=" + lr + ", p1=" + p1 + ", p2=" + p2 + "]";
}
@Override
public void report(ErrorReport report) {
report.add(lr);
report.add("duplicate point 1", p1);
report.add("duplicate point 2", p2);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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;
/**
* When a check checks if it can be executed but one or more dependency has
* found an error this check can also not be executed. This error is created in
* such a case, listing the checkId of the dependency which found an error or
* was also not executed.
*
* @author Matthias Betz
*
*/
public class DependenciesNotMetError extends 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;
}
public CheckId getDependency() {
return dependency;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "DependenciesNotMetError [dependency=" + dependency + "]";
}
@Override
public void report(ErrorReport report) {
report.add("dependency", dependency.toString());
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Plane;
import de.hft.stuttgart.citydoctor2.utils.Localization;
/**
* Error object for planarity errors containing the polygon, the regression
* plane and the distance to the plane.
*
* @author Matthias Betz
*
*/
public class DistanceError extends CheckError {
private static final long serialVersionUID = -3504364055236383519L;
private Polygon p;
private double distance;
private Vertex v;
private Plane plane;
public DistanceError(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;
this.plane = plane;
}
public Plane getPlane() {
return plane;
}
public Polygon getPolygon() {
return p;
}
public double getDistance() {
return distance;
}
public Vertex getVertex() {
return v;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add(v);
report.add(Localization.getText("DistanceError.distanceFromPlane"), distance);
}
@Override
public String toString() {
return "DistanceError [p=" + p + ", distance=" + distance + ", v=" + v + ", plane=" + plane + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
/**
* When a point is repeated in a linear ring, but is not consecutive. This
* results in a self intersection of the ring and this error object is created.
*
* @author Matthias Betz
*
*/
public class DuplicatePointError extends CheckError {
private static final long serialVersionUID = 7208982075173209953L;
private LinearRing r;
private Vertex v1;
private Vertex v2;
public DuplicatePointError(LinearRing r, Vertex v1, Vertex v2) {
super(ErrorId.GE_R_SELF_INTERSECTION, ErrorType.ERROR, r);
this.r = r;
this.v1 = v1;
this.v2 = v2;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
public LinearRing getRing() {
return r;
}
public Vertex getVertex1() {
return v1;
}
public Vertex getVertex2() {
return v2;
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(r);
report.add("duplicate point 1", v1);
report.add("duplicate point 2", v2);
}
@Override
public String toString() {
return "DuplicatePointError [r=" + r + ", v1=" + v1 + ", v2=" + v2 + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
/**
* When two edges of the same linear ring are intersecting with each other this
* error object is created.
*
* @author Matthias Betz
*
*/
public class EdgeIntersectionError extends CheckError {
private static final long serialVersionUID = 4923311259469198172L;
private Edge e1;
private Edge e2;
private Vector3d intersection;
private LinearRing lr;
public EdgeIntersectionError(LinearRing lr, Edge e1, Edge e2, Vector3d intersection) {
super(ErrorId.GE_R_SELF_INTERSECTION, ErrorType.ERROR, lr);
if (e1 == null || e2 == null || lr == null || intersection == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
this.e1 = e1;
this.e2 = e2;
this.intersection = intersection;
this.lr = lr;
}
public LinearRing getRing() {
return lr;
}
public Edge getEdge1() {
return e1;
}
public Edge getEdge2() {
return e2;
}
public Vector3d getIntersection() {
return intersection;
}
@Override
public void report(ErrorReport report) {
report.add("type", "edge intersection");
report.add(lr);
report.add(e1);
report.add(e2);
report.add("intersection point", intersection);
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "EdgeIntersectionError [e1=" + e1 + ", e2=" + e2 + ", intersection=" + intersection + ", lr=" + lr + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* When an interior ring is completely outside the exterior ring this error is
* created.
*
* @author Matthias Betz
*
*/
public class HoleOutsideError extends CheckError {
private static final long serialVersionUID = -4522153084655775231L;
private List<LinearRing> holesOutside;
private Polygon p;
public HoleOutsideError(Polygon p, List<LinearRing> holesOutside) {
super(ErrorId.GE_P_HOLE_OUTSIDE, ErrorType.ERROR, p);
this.p = p;
this.holesOutside = holesOutside;
}
public Polygon getPolygon() {
return p;
}
public List<LinearRing> getHolesOutside() {
return holesOutside;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(p);
for (LinearRing lr : holesOutside) {
report.add(lr);
}
}
@Override
public String toString() {
return "HoleOutsideError [holesOutside=" + holesOutside + ", p=" + p + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* If the holes in a polygon split the interior area into two distinct areas
* this error is created.
*
* @author Matthias Betz
*
*/
public class InteriorDisconnectedError extends CheckError {
private static final long serialVersionUID = 511849016699842395L;
private Polygon p;
private List<LinearRing> connectedRings;
public InteriorDisconnectedError(Polygon p, List<LinearRing> connectedRings) {
super(ErrorId.GE_P_INTERIOR_DISCONNECTED, ErrorType.ERROR, p);
this.p = p;
this.connectedRings = connectedRings;
}
public Polygon getPolygon() {
return p;
}
public List<LinearRing> getConnectedRings() {
return connectedRings;
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add("connected rings", "");
for (LinearRing lr : connectedRings) {
report.add(lr);
}
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "InteriorDisconnectedError [p=" + p + ", connectedRings=" + connectedRings + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
/**
* If an edge is an edge in 3 or more polygons this error is created.
*
* @author Matthias Betz
*
*/
public class ManifoldEdgeError extends CheckError {
private static final long serialVersionUID = -6742948557014332402L;
private List<Edge> edges;
private Geometry geom;
public ManifoldEdgeError(Geometry geom, List<Edge> edges) {
super(ErrorId.GE_S_NON_MANIFOLD_EDGE, ErrorType.ERROR, geom);
this.edges = edges;
this.geom = geom;
}
public List<Edge> getEdges() {
return edges;
}
public Geometry getGeometry() {
return geom;
}
@Override
public void report(ErrorReport report) {
report.add(geom);
for (Edge e : edges) {
report.add(e);
}
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "ManifoldEdgeError [edges=" + edges + ", geom=" + geom + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* When a geometry contains two or more not connected geometries, this error is
* created.
*
* @author Matthias Betz
*
*/
public class MultipleConnectedComponentsError extends CheckError {
private static final long serialVersionUID = 2152069835068857036L;
private Geometry geom;
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;
}
public Geometry getGeometry() {
return geom;
}
public List<List<Polygon>> getComponents() {
return components;
}
@Override
public void report(ErrorReport report) {
report.add(geom);
for (int i = 0; i < components.size(); i++) {
List<Polygon> polygons = components.get(i);
report.addPolygons("component nr: " + (i + 1), polygons);
}
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "MultipleConnectedComponentsError [geom=" + geom + ", components=" + components + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* If an inner ring is with in the boundaries of another, this error is created.
*
* @author Matthias Betz
*
*/
public class NestedRingError extends CheckError {
private static final long serialVersionUID = -3396113374745830193L;
private Polygon p;
private LinearRing innerRing;
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;
}
public Polygon getPolygon() {
return p;
}
public LinearRing getInnerRing() {
return innerRing;
}
public LinearRing getWithinRing() {
return withinRing;
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add(innerRing);
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "NestedRingError [p=" + p + ", innerRing=" + innerRing + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
/**
* A vertex which is contained in multiple polygons which are not connected via
* edges.
*
* @author Matthias Betz
*
*/
public class NonManifoldVertexError extends CheckError {
private static final long serialVersionUID = -3915669943428175777L;
private List<List<Polygon>> components;
private Geometry geom;
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;
}
public List<List<Polygon>> getComponents() {
return components;
}
public Geometry getGeometry() {
return geom;
}
public Vertex getVertex() {
return v;
}
@Override
public void report(ErrorReport report) {
report.add(geom);
report.add(v);
for (int i = 0; i < components.size(); i++) {
List<Polygon> polygons = components.get(i);
report.add("component nr: ", i);
for (Polygon p : polygons) {
report.add(p);
}
}
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "NonManifoldVertexError [components=" + components + ", geom=" + geom + ", v=" + v + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.Polygon;
/**
* When the normal of the triangles created from the triangulation of the
* polygon have a too large angle between them, this error is created.
*
* @author Matthias Betz
*
*/
public class NormalDeviationError extends CheckError {
private static final long serialVersionUID = 69073161885265794L;
private Polygon p;
private double deviation;
public NormalDeviationError(Polygon p, double deviation) {
super(ErrorId.GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION, ErrorType.ERROR, p);
this.p = p;
this.deviation = deviation;
}
public Polygon getPolygon() {
return p;
}
public double getDeviation() {
return deviation;
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add("normal deviation (in rad)", deviation);
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "NormalDeviationError [p=" + p + ", deviation=" + deviation + "]";
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* If a boundary surface is infact not a ceiling even though it was defined as
* one.
*
* @author Matthias Betz
*
*/
public class NotCeilingError extends CheckError {
private static final long serialVersionUID = 6725904270389419696L;
private BoundarySurface surface;
private Polygon p;
public NotCeilingError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_CEILING, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
public BoundarySurface getSurface() {
return surface;
}
public Polygon getPolygon() {
return p;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add(surface);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* When a boundary surface is not a floor even though it was defined as one.
*
* @author Matthias Betz
*
*/
public class NotFloorError extends CheckError {
private static final long serialVersionUID = -3193557053834977449L;
private BoundarySurface surface;
private Polygon p;
public NotFloorError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_FLOOR, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
public BoundarySurface getSurface() {
return surface;
}
public Polygon getPolygon() {
return p;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(p);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
/**
* If a boundary surface is not a ground surface even though it was defined as
* one.
*
* @author Matthias Betz
*
*/
public class NotGroundError extends CheckError {
private static final long serialVersionUID = 8793224454858861221L;
private BoundarySurface surface;
private Polygon p;
public NotGroundError(BoundarySurface bs, Polygon p) {
super(ErrorId.SEM_BS_NOT_GROUND, ErrorType.WARNING, bs);
surface = bs;
this.p = p;
}
public BoundarySurface getSurface() {
return surface;
}
public Polygon getPolygon() {
return p;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(p);
report.add(surface);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
/**
* if a boundary surface is not a wall even though it was defined as one.
*
* @author Matthias Betz
*
*/
public class NotWallError extends CheckError {
private static final long serialVersionUID = 406429139625558232L;
private BoundarySurface surface;
private Polygon p;
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;
}
public BoundarySurface getSurface() {
return surface;
}
public Polygon getPolygon() {
return p;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add(surface);
report.add(p);
report.add("normal", normal);
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
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.LinearRing;
/**
* When a linear ring has a near zero area this error is created.
*
* @author Matthias Betz
*
*/
public class NullAreaError extends 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;
}
public LinearRing getRing() {
return lr;
}
@Override
public void report(ErrorReport report) {
report.add(lr);
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public String toString() {
return "NullAreaError [lr=" + lr + "]";
}
}
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