Commit 97a65114 authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev' into 'master'

Version 3.15.0

See merge request !8
parents 99c8f6a8 5950ea5f
Pipeline #10106 passed with stage
in 3 minutes and 15 seconds
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
public class PolyLine2d extends BaseEntity { public class PolyLine2d extends BaseEntity {
private PolyLineSegment2d mpFirst; private final PolyLineSegment2d mpFirst;
private PolyLineSegment2d mpLast; private PolyLineSegment2d mpLast;
public PolyLine2d(PolyLineSegment2d pStart) { public PolyLine2d(PolyLineSegment2d pStart) {
......
...@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity { ...@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity {
private static final Logger logger = LogManager.getLogger(PolyLineSegment.class); private static final Logger logger = LogManager.getLogger(PolyLineSegment.class);
private Coordinate3d mpStart; private final Coordinate3d mpStart;
private Coordinate3d mpEnd; private final Coordinate3d mpEnd;
private PolyLineSegment mpNext; private PolyLineSegment mpNext;
......
...@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity { ...@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity {
point = halfEdge.getStart().getPoint(); point = halfEdge.getStart().getPoint();
lowerU = (point.getX() < lowerU) ? point.getX() : lowerU; lowerU = Math.min(point.getX(), lowerU);
lowerV = (point.getY() < lowerV) ? point.getY() : lowerV; lowerV = Math.min(point.getY(), lowerV);
upperU = (point.getX() > upperU) ? point.getX() : upperU; upperU = Math.max(point.getX(), upperU);
upperV = (point.getY() > upperV) ? point.getY() : upperV; upperV = Math.max(point.getY(), upperV);
} }
Box2d box = new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV)); return new Box2d(new Point2d(lowerU, lowerV), new Point2d(upperU, upperV));
return box;
} }
public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) { public static void connectHalfEdges(List<HalfEdge2d> rHalfEdges) {
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Polygon2dPolygon2dInt { public class Polygon2dPolygon2dInt {
private Polygon2d mcpPolygon1; private final Polygon2d mcpPolygon1;
private Polygon2d mcpPolygon2; private final Polygon2d mcpPolygon2;
private PolyLine2d line; private final PolyLine2d line;
private IntersectionType intType; private final IntersectionType intType;
public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line, public Polygon2dPolygon2dInt(Polygon2d mcpPolygon1, Polygon2d mcpPolygon2, PolyLine2d line,
IntersectionType intType) { IntersectionType intType) {
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class PolygonPolygonIntersection { public class PolygonPolygonIntersection {
private EdgePolygon p1; private final EdgePolygon p1;
private EdgePolygon p2; private final EdgePolygon p2;
private PolyLine polyLine; private final PolyLine polyLine;
private IntersectionType type; private final IntersectionType type;
public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) { public PolygonPolygonIntersection(EdgePolygon p1, EdgePolygon p2, PolyLine polyLine, IntersectionType type) {
this.p1 = p1; this.p1 = p1;
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class ProjectedPoint3d { public class ProjectedPoint3d {
private Point3d point; private final Point3d point;
private double parameter; private final double parameter;
public ProjectedPoint3d(Point3d point, double d) { public ProjectedPoint3d(Point3d point, double d) {
this.point = point; this.point = point;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class UnitVector3d extends Vector3d { public class UnitVector3d extends Vector3d {
public static UnitVector3d of(Vector3d vec) { public static UnitVector3d of(Vector3d vec) {
...@@ -37,13 +38,7 @@ public class UnitVector3d extends Vector3d { ...@@ -37,13 +38,7 @@ public class UnitVector3d extends Vector3d {
public double dot(UnitVector3d other) { public double dot(UnitVector3d other) {
double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); double scalar = getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
if (scalar > 1.0) { return (scalar >= 0) ? Math.min(scalar, 1.0) : Math.max(scalar, -1.0);
return 1.0;
}
if (scalar < -1.0) {
return -1.0;
}
return scalar;
} }
......
...@@ -18,16 +18,18 @@ ...@@ -18,16 +18,18 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class Vector2d { public class Vector2d {
private double x; private final double x;
private double y; private final double y;
public Vector2d(double x, double y) { public Vector2d(double x, double y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() { public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x); return new Vector2d(y, -x);
} }
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.Arrays; import java.util.Arrays;
public class Vector3d { public class Vector3d {
private double[] val = new double[3]; private final double[] val = new double[3];
public Vector3d(double x, double y, double z) { public Vector3d(double x, double y, double z) {
val[0] = x; val[0] = x;
...@@ -46,9 +47,9 @@ public class Vector3d { ...@@ -46,9 +47,9 @@ public class Vector3d {
val[1] = 0; val[1] = 0;
val[2] = 0; val[2] = 0;
} else { } else {
val[0] = val[0] /= length; val[0] /= length;
val[1] = val[1] /= length; val[1] /= length;
val[2] = val[2] /= length; val[2] /= length;
} }
} }
......
...@@ -103,11 +103,11 @@ public class IntersectionErrorsTest { ...@@ -103,11 +103,11 @@ public class IntersectionErrorsTest {
} }
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001); List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
......
...@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest { ...@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v1); ext.addVertex(v1);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = polygons.get(0); CDPolygonNs edgePoly1 = polygons.get(0);
List<Coordinate3d> coordinates = edgePoly1.getCoordinates(); List<Coordinate3d> coordinates = edgePoly1.getCoordinates();
...@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest { ...@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest {
List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class); List<Coordinate3d> coordChildren = firstHalfEdge.getChildren(Coordinate3d.class);
assertEquals(2, coordChildren.size()); assertEquals(2, coordChildren.size());
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons); assertNotNull(intersectPolygons);
...@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest { ...@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons); assertNotNull(intersectPolygons);
...@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest { ...@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest { ...@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v2); ext.addVertex(v2);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest { ...@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest { ...@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest { ...@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2); DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
...@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest { ...@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest { ...@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v4); ext.addVertex(v4);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2); DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
...@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest { ...@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest { ...@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest { ...@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest { ...@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest { ...@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest { ...@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest { ...@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v6); ext.addVertex(v6);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5); ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11); ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v11); ext.addVertex(v11);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
...@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest { ...@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest {
ext.addVertex(v5); ext.addVertex(v5);
MeshSurface meshSurface = MeshSurface.of(geom); MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons(); List<CDPolygonNs> polygons = meshSurface.polygons();
assertEquals(2, polygons.size()); assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0); CDPolygonNs edgePoly1 = meshSurface.polygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1); CDPolygonNs edgePoly2 = meshSurface.polygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001); edgePoly2, 0.000001, 0.001);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.14.1</version> <version>3.15.0</version>
</parent> </parent>
<properties> <properties>
<versionString>${project.version}-${git.commit.id.abbrev}</versionString> <versionString>${project.version}-${git.commit.id.abbrev}</versionString>
......
...@@ -67,7 +67,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -67,7 +67,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
*/ */
public abstract class Check { public abstract class Check {
private List<Class<Checkable>> applicableToClasses = new ArrayList<>(2); private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected Check() { protected Check() {
......
...@@ -79,7 +79,7 @@ public interface CheckError extends Serializable { ...@@ -79,7 +79,7 @@ public interface CheckError extends Serializable {
* implementor of the error decides which information is written into the report * implementor of the error decides which information is written into the report
* or shown on the GUI. * or shown on the GUI.
* *
* @param report * @param report the ErrorReport.
*/ */
public void report(ErrorReport report); public void report(ErrorReport report);
......
...@@ -18,10 +18,12 @@ ...@@ -18,10 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
public class CheckId implements Serializable { public record CheckId(String name) implements Serializable {
@Serial
private static final long serialVersionUID = -6267337828874296004L; 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_TOO_FEW_POINTS = new CheckId("C_GE_R_TOO_FEW_POINTS");
...@@ -55,23 +57,6 @@ public class CheckId implements Serializable { ...@@ -55,23 +57,6 @@ public class CheckId implements Serializable {
public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME"); public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME");
public static final CheckId C_SE_POLYGON_WITHOUT_SURFACE = new CheckId("C_SE_POLYGON_WITHOUT_SURFACE"); public static final CheckId C_SE_POLYGON_WITHOUT_SURFACE = new CheckId("C_SE_POLYGON_WITHOUT_SURFACE");
private String name;
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;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -83,11 +68,8 @@ public class CheckId implements Serializable { ...@@ -83,11 +68,8 @@ public class CheckId implements Serializable {
return false; return false;
CheckId other = (CheckId) obj; CheckId other = (CheckId) obj;
if (name == null) { if (name == null) {
if (other.name != null) return other.name == null;
return false; } else return name.equals(other.name);
} else if (!name.equals(other.name))
return false;
return true;
} }
@Override @Override
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -29,6 +30,7 @@ import java.io.Serializable; ...@@ -29,6 +30,7 @@ import java.io.Serializable;
*/ */
public class CheckResult implements Serializable { public class CheckResult implements Serializable {
@Serial
private static final long serialVersionUID = -8775678793477525693L; private static final long serialVersionUID = -8775678793477525693L;
private final CheckId id; private final CheckId id;
...@@ -38,7 +40,7 @@ public class CheckResult implements Serializable { ...@@ -38,7 +40,7 @@ public class CheckResult implements Serializable {
/** /**
* Constructor for this container * Constructor for this container
* *
* @param c the check which produced this result * @param id the check which produced this result
* @param s the status of the result * @param s the status of the result
* @param err an optional error object * @param err an optional error object
*/ */
...@@ -66,15 +68,7 @@ public class CheckResult implements Serializable { ...@@ -66,15 +68,7 @@ public class CheckResult implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return String.format("CheckResult [id=%s, status=%s, error=%s]", id, status, err);
builder.append("CheckResult [id=");
builder.append(id);
builder.append(", status=");
builder.append(status);
builder.append(", error=");
builder.append(err);
builder.append("]");
return builder.toString();
} }
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -36,11 +37,12 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlId; ...@@ -36,11 +37,12 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
*/ */
public abstract class Checkable implements Serializable { public abstract class Checkable implements Serializable {
@Serial
private static final long serialVersionUID = -1707871839265057882L; private static final long serialVersionUID = -1707871839265057882L;
private static final Logger logger = LogManager.getLogger(Checkable.class); private static final Logger logger = LogManager.getLogger(Checkable.class);
private Map<CheckId, CheckResult> checkResults = new HashMap<>(); private final Map<CheckId, CheckResult> checkResults = new HashMap<>();
private boolean isValidated = false; private boolean isValidated = false;
protected void setValidated(boolean validated) { protected void setValidated(boolean validated) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -30,11 +31,12 @@ import java.io.Serializable; ...@@ -30,11 +31,12 @@ import java.io.Serializable;
*/ */
public class DefaultParameter implements Serializable { public class DefaultParameter implements Serializable {
@Serial
private static final long serialVersionUID = -4587211298078974066L; private static final long serialVersionUID = -4587211298078974066L;
private String name; private final String name;
private String value; private final String value;
private Unit unitType; private final Unit unitType;
public DefaultParameter(String name, String defaultValue, Unit unitType) { public DefaultParameter(String name, String defaultValue, Unit unitType) {
this.name = name; this.name = name;
...@@ -71,13 +73,7 @@ public class DefaultParameter implements Serializable { ...@@ -71,13 +73,7 @@ public class DefaultParameter implements Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); return "DefaultParameter [name=" + name + ", value=" + value + "]";
builder.append("DefaultParameter [name=");
builder.append(name);
builder.append(", value=");
builder.append(value);
builder.append("]");
return builder.toString();
} }
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -27,8 +28,9 @@ import java.io.Serializable; ...@@ -27,8 +28,9 @@ import java.io.Serializable;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
public class ErrorId implements Serializable { public record ErrorId(String name) implements Serializable {
@Serial
private static final long serialVersionUID = -2598466667746276560L; private static final long serialVersionUID = -2598466667746276560L;
public static final ErrorId DEPENDENCIES_NOT_MET = new ErrorId("Dependencies_not_met"); public static final ErrorId DEPENDENCIES_NOT_MET = new ErrorId("Dependencies_not_met");
...@@ -65,11 +67,8 @@ public class ErrorId implements Serializable { ...@@ -65,11 +67,8 @@ public class ErrorId implements Serializable {
public static final ErrorId GE_P_DEGENERATED_RING = new ErrorId("GE_P_DEGENERATED_POLYGON"); public static final ErrorId GE_P_DEGENERATED_RING = new ErrorId("GE_P_DEGENERATED_POLYGON");
public static final ErrorId SE_POLYGON_WITHOUT_SURFACE = new ErrorId("SE_POLYGON_WITHOUT_SURFACE"); public static final ErrorId SE_POLYGON_WITHOUT_SURFACE = new ErrorId("SE_POLYGON_WITHOUT_SURFACE");
private String name;
public ErrorId(String name) {
this.name = name;
}
@Override @Override
public int hashCode() { public int hashCode() {
...@@ -89,11 +88,8 @@ public class ErrorId implements Serializable { ...@@ -89,11 +88,8 @@ public class ErrorId implements Serializable {
return false; return false;
ErrorId other = (ErrorId) obj; ErrorId other = (ErrorId) obj;
if (name == null) { if (name == null) {
if (other.name != null) return other.name == null;
return false; } else return name.equals(other.name);
} else if (!name.equals(other.name))
return false;
return true;
} }
@Override @Override
......
...@@ -18,52 +18,17 @@ ...@@ -18,52 +18,17 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.math.Triangle3d; import de.hft.stuttgart.citydoctor2.math.Triangle3d;
public class GeometrySelfIntersection implements Serializable { public record GeometrySelfIntersection(Polygon p1, Polygon p2, Triangle3d t1, Triangle3d t2) implements Serializable {
@Serial
private static final long serialVersionUID = -6308847898942670140L; private static final long serialVersionUID = -6308847898942670140L;
private Polygon p1;
private Polygon p2;
private Triangle3d t1;
private Triangle3d t2;
public GeometrySelfIntersection(Polygon p1, Polygon p2, Triangle3d t1, Triangle3d t2) {
super();
this.p1 = p1;
this.p2 = p2;
this.t1 = t1;
this.t2 = t2;
}
public Polygon getP1() {
return p1;
}
public void setP1(Polygon p1) {
this.p1 = p1;
}
public Polygon getP2() {
return p2;
}
public void setP2(Polygon p2) {
this.p2 = p2;
}
public Triangle3d getT1() {
return t1;
}
public Triangle3d getT2() {
return t2;
}
@Override @Override
public String toString() { public String toString() {
......
Supports Markdown
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