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

replace copy mechanism

logo now in jar, extracted when needed to temp dir
change version to 3.10
parent 3d26f0e9
Pipeline #5579 failed with stage
in 39 seconds
......@@ -5,7 +5,7 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.10.0-SNAPSHOT</version>
<version>3.10.0</version>
</parent>
<artifactId>CityDoctorCheckResult</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.10.0-SNAPSHOT</version>
<version>3.10.0</version>
</parent>
<artifactId>CityDoctorEdge</artifactId>
......
......@@ -24,13 +24,15 @@ import java.util.Map;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.MovedRing;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class CDPolygonNs extends PolygonNs {
private List<List<HalfEdge>> innerHalfEdges = new ArrayList<>();
public static CDPolygonNs of(Polygon p, Map<Vertex, Coordinate3d> pointMap) {
public static CDPolygonNs of(Polygon p, Map<Vector3d, Coordinate3d> pointMap) {
List<List<Coordinate3d>> loopCoordinates = new ArrayList<>();
List<Coordinate3d> edgeExtRing = createCoordinatesFromRing(pointMap, p.getExteriorRing().getVertices());
loopCoordinates.add(edgeExtRing);
......@@ -49,6 +51,25 @@ public class CDPolygonNs extends PolygonNs {
return new CDPolygonNs(halfEdges, p);
}
public static CDPolygonNs of(MovedPolygon mp, Map<Vector3d, Coordinate3d> pointMap) {
List<List<Coordinate3d>> loopCoordinates = new ArrayList<>();
List<Coordinate3d> edgeExtRing = createCoordinatesFromRing(pointMap, mp.getExteriorRing().getVertices());
loopCoordinates.add(edgeExtRing);
for (MovedRing innerRing : mp.getInnerRings()) {
List<Coordinate3d> edgeInnerRing = createCoordinatesFromRing(pointMap, innerRing.getVertices());
loopCoordinates.add(edgeInnerRing);
}
List<List<HalfEdge>> halfEdges = new ArrayList<>();
for (List<Coordinate3d> ringCoordinates : loopCoordinates) {
List<HalfEdge> currHeList = createHalfEdgesFromCoordinates(ringCoordinates);
halfEdges.add(currHeList);
}
return new CDPolygonNs(halfEdges, mp.getOriginal());
}
private static List<HalfEdge> createHalfEdgesFromCoordinates(List<Coordinate3d> ringCoordinates) {
List<HalfEdge> currHeList = new ArrayList<>();
HalfEdge prevHalfEdge = null;
......@@ -75,11 +96,11 @@ public class CDPolygonNs extends PolygonNs {
return currHeList;
}
private static List<Coordinate3d> createCoordinatesFromRing(Map<Vertex, Coordinate3d> pointMap,
List<Vertex> vertices) {
private static List<Coordinate3d> createCoordinatesFromRing(Map<Vector3d, Coordinate3d> pointMap,
List<? extends Vector3d> vertices) {
List<Coordinate3d> edgeRing = new ArrayList<>();
for (int i = 0; i < vertices.size() - 1; i++) {
Vertex v = vertices.get(i);
Vector3d v = vertices.get(i);
Coordinate3d c = pointMap.computeIfAbsent(v, key -> new Coordinate3d(key.getX(), key.getY(), key.getZ()));
edgeRing.add(c);
}
......
......@@ -108,6 +108,22 @@ public class DebugUtils {
}
}
public static void printGeoknechtPolygon(EdgePolygon... polys) {
Locale.setDefault(Locale.US);
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(30);
for (EdgePolygon poly : polys) {
List<Coordinate3d> coordinates = poly.getCoordinates();
System.out.print("polygon(");
for (Coordinate3d coord : coordinates) {
Point3d point = coord.getPoint();
writeGeoknechtPoint(nf, point);
}
writeGeoknechtPoint(nf, coordinates.get(0).getPoint());
System.out.println(")");
}
}
private static void writeGeoknechtPoint(NumberFormat nf, Point3d point) {
System.out.print(nf.format(point.getX()));
System.out.print("|");
......@@ -167,4 +183,26 @@ public class DebugUtils {
return coordVarName;
}
public static void printPolygon3d(EdgePolygon polygon1, EdgePolygon polygon2) {
Locale.setDefault(Locale.US);
Map<Point3d, String> pointMap = new IdentityHashMap<>();
int startCounter = 1;
startCounter = printPolygon3d(polygon1, pointMap, startCounter);
printPolygon3d(polygon2, pointMap, startCounter);
}
private static int printPolygon3d(EdgePolygon p, Map<Point3d, String> pointMap, int startCounter) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(30);
int counter = polygon3dCounter.getAndIncrement();
int listCounter = coordListCounter.getAndIncrement();
int firstListCounter = listCounter;
HalfEdge firstHalfEdge = p.getFirstHalfEdge();
int[] counterArr = new int[] {startCounter};
System.out.println("Coordinate3dList coords" + firstListCounter + ";");
writeRing(pointMap, nf, listCounter, firstHalfEdge, counterArr);
System.out.println("CDPolygonNs* p" + counter + " = new CDPolygonNs(coords" + firstListCounter + ");");
return counterArr[0];
}
}
......@@ -20,7 +20,6 @@ package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
......@@ -78,12 +77,15 @@ public class EdgePolygon extends BaseEntity {
public List<Coordinate3d> getCoordinates() {
List<Coordinate3d> coords = new ArrayList<>();
HalfEdge firstHE = Objects.requireNonNull(getFirstHalfEdge());
HalfEdge currHE = firstHE;
do {
coords.add(currHE.getStart());
currHE = currHE.getNext();
} while (currHE != firstHE);
for (HalfEdge he : halfEdges) {
coords.add(he.getStart());
}
// HalfEdge firstHE = Objects.requireNonNull(getFirstHalfEdge());
// HalfEdge currHE = firstHE;
// do {
// coords.add(currHE.getStart());
// currHE = currHE.getNext();
// } while (currHE != firstHE);
return coords;
}
......
......@@ -26,7 +26,7 @@ public class Global {
private static double mZeroAngleCosinus = 1.0e-9;
private static double mTolVectorsParallel = 1e-9;
private static double mHighAccuracyTol = DBL_EPSILON * 100;
private static double mHighAccuracyTol = DBL_EPSILON * 5;
private static double mTolPointsEqual = 1e-3;
private Global() {
......
......@@ -147,4 +147,8 @@ public class GmPlane {
return new Polygon2d(halfedges);
}
public Point3d getPoint() {
return x0;
}
}
......
......@@ -32,9 +32,9 @@ public class GmStraight2dIntersectionResult {
return new GmStraight2dIntersectionResult(0, 0, s1, s2, true);
}
public static GmStraight2dIntersectionResult intersecting(double rParam1, double rParam2, GmStraight2d s1,
GmStraight2d s2) {
return new GmStraight2dIntersectionResult(rParam1, rParam2, s1, s2, false);
public static GmStraight2dIntersectionResult intersecting(double paramHE, double paramInt, GmStraight2d straightHE,
GmStraight2d straightInt) {
return new GmStraight2dIntersectionResult(paramHE, paramInt, straightHE, straightInt, false);
}
private GmStraight2dIntersectionResult(double paramHE, double paramInt, GmStraight2d straightHE,
......
......@@ -118,6 +118,7 @@ public class IntersectPlanarPolygons {
for (HalfEdge he : polyHEs) {
// only check half edges with partners. NOTE: we are just looking
// for half edges, shared by both polygons!
if (he.getPartner() != null) {
Point3d start = he.getStart().getPoint();
Point3d end = he.getEnd().getPoint();
......@@ -154,8 +155,8 @@ public class IntersectPlanarPolygons {
/**
*
* This method checks if the point is a border point of one of the polygons,
* which should be intersected. If this check is successfull, the method tries
* to find the same point in the other polygon.
* which should be intersected. If this check is successful, the method tries to
* find the same point in the other polygon.
*
* <br>
* Equality in this case means, both polygons sharing the same instance of
......@@ -193,6 +194,25 @@ public class IntersectPlanarPolygons {
return bothPolygonsSharingThisPoint;
}
/**
*
* This method does pretty the same stuff like calculateIntersectionIntervals(),
* with the exception, that the straight and the half edges of the polygon will
* be projected on the plane of the polygon, so the calculation of the
* intersection will be reduced to a 2d problem.
*
* The intersection intervals contains pairs of parameters from the intersection
* straight. If an intersection between the straight and the polygon contains
* only a point, the according interval will contain the same parameter twice
*
* @param p A polygon
*
* @param intersectingStraight The straight, that should be intersected with the
* given polygon
*
* @return rIntersectionIntervals A list parameter intervals, where the straight
* is intersecting the polygon
*/
private static List<Interval> calculateIntersectionIntervals2d(EdgePolygon p, EdgePolygon cpPolygon1,
EdgePolygon cpPolygon2, GmStraight intersectingStraight, double epsilon, double angleEpsilon) {
List<Interval> intersectionIntervals = new ArrayList<>();
......@@ -241,11 +261,11 @@ public class IntersectPlanarPolygons {
}
// The current HalfEdge shares a point with the other polygon and is not
// collinear with the intersection straight. Hence, there is now way, that
// collinear with the intersection straight. Hence, there is no way, that
// this HalfEdge can intersect the other one, because both are planar.
// if (currHESharesAPntWithTheOtherPolygon) {
// continue;
// }
if (currHESharesAPntWithTheOtherPolygon) {
continue;
}
// project straight on plane
GmBoundedStraight2d heStraight2d = polyPlane.projectOn2dStraight(heStraight);
......@@ -386,8 +406,8 @@ public class IntersectPlanarPolygons {
}
/**
* Util method. Checks if the given parameter hase been allready inserted as
* intersction parameter. If this is true, the parameter will be added as
* Util method. Checks if the given parameter has already been inserted as
* intersection parameter. If this is true, the parameter will be added as
* intersected polygon corner point. Otherwise it's just a normal intersection
* parameter till now.
*
......@@ -401,7 +421,7 @@ public class IntersectPlanarPolygons {
private static void assignParameterToCorrectList(double param, TreeSet<Double> intersectionValues,
TreeSet<Double> intersectedPolygonPoints) {
if (!intersectionValues.add(param)) {
// value is allready present ==> this must be a point of the polygon
// value is already present ==> this must be a point of the polygon
// note, it's assumed, that the polygon do not intersect itself
intersectedPolygonPoints.add(param);
}
......@@ -557,6 +577,14 @@ public class IntersectPlanarPolygons {
Polygon2d poly2d1 = new Polygon2dNs(poly2dCoords1, true);
Polygon2d poly2d2 = new Polygon2dNs(poly2dCoords2, true);
List<HalfEdge2d> halfEdges = poly2d1.getHalfEdges();
for (HalfEdge2d he : halfEdges) {
if (he.getPartner() == null) {
}
}
halfEdges = poly2d2.getHalfEdges();
List<PolygonPolygonIntersection> result = new ArrayList<>();
List<Polygon2dPolygon2dInt> ppi2ds = IntersectPolygon2d.getIntersections(poly2d1, poly2d2, epsilon);
for (Polygon2dPolygon2dInt ppi2d : ppi2ds) {
......
......@@ -233,7 +233,8 @@ public class IntersectPolygon2d {
}
private static void checkForDoubleUsedPoints(List<PolyLine2d> orIntPolyLines) {
for (PolyLine2d currPolyLine : orIntPolyLines) {
for (int i = 0; i < orIntPolyLines.size(); i++) {
PolyLine2d currPolyLine = orIntPolyLines.get(i);
List<PolyLineSegment2d> segs = currPolyLine.getSegments();
if (2 == segs.size()) {
PolyLine2d newPolyLine = new PolyLine2d(segs.get(0).getStart(), segs.get(0).getEnd());
......
......@@ -19,13 +19,14 @@
package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.MovedPolygon;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class MeshSurface {
......@@ -34,19 +35,12 @@ public class MeshSurface {
public static MeshSurface of(Geometry geom) {
List<CDPolygonNs> polygonList = new ArrayList<>();
Map<Vertex, Coordinate3d> pointMap = new IdentityHashMap<>();
Map<Vector3d, Coordinate3d> pointMap = new HashMap<>();
Vector3d moveBy = geom.calculateBoundingBox().getBox()[0];
for (Polygon p : geom.getPolygons()) {
CDPolygonNs poly = CDPolygonNs.of(p, pointMap);
MovedPolygon mp = MovedPolygon.ofPolygon(p, moveBy);
CDPolygonNs poly = CDPolygonNs.of(mp, pointMap);
polygonList.add(poly);
// HalfEdge firstHalfEdge = poly.getFirstHalfEdge();
// System.out.println();
// System.out.println(firstHalfEdge.getStart());
// System.out.println(firstHalfEdge.getEnd());
// HalfEdge next = firstHalfEdge.getNext();
// while (next != firstHalfEdge) {
// System.out.println(next.getEnd());
// next = next.getNext();
// }
}
return new MeshSurface(polygonList);
}
......
......@@ -81,4 +81,36 @@ public class Point3d {
return "Point3d [x=" + x + ", y=" + y + ", z=" + z + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(x);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(y);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(z);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point3d other = (Point3d) obj;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
return false;
if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
return false;
if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z))
return false;
return true;
}
}
......
......@@ -159,4 +159,9 @@ public class PolyLine2d extends BaseEntity {
return pRightLine;
}
@Override
public String toString() {
return "PolyLine2d [mpFirst=" + mpFirst + ", mpLast=" + mpLast + "]";
}
}
......@@ -48,4 +48,10 @@ public class Polygon2dPolygon2dInt {
public Polygon2d getPolygon2() {
return mcpPolygon2;
}
@Override
public String toString() {
return "Polygon2dPolygon2dInt [mcpPolygon1=" + mcpPolygon1 + ", mcpPolygon2=" + mcpPolygon2 + ", line=" + line
+ ", intType=" + intType + "]";
}
}
......
......@@ -142,7 +142,8 @@ public class MeshSurfaceUtilsTest {
assertEquals(2, coordChildren.size());
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -193,7 +194,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -246,7 +248,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertEquals(1, intersectPolygons.size());
PolygonPolygonIntersection in = intersectPolygons.get(0);
......@@ -265,6 +268,69 @@ public class MeshSurfaceUtilsTest {
assertEquals(IntersectionType.PARTIALLY_EMBEDDED_POLYGON, in.getIntersectionType());
}
@Test
public void testIntersectionTwoPolygonsOneSharedEdgeIntersectionPolygonPlanar2() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1);
Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing ext = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(ext);
Vertex v1 = new Vertex(0, 0, 0);
Vertex v2 = new Vertex(6, 0, 0);
Vertex v3 = new Vertex(6, 6, 0);
Vertex v4 = new Vertex(0, 6, 0);
ext.addVertex(v1);
ext.addVertex(v2);
ext.addVertex(v3);
ext.addVertex(v4);
ext.addVertex(v1);
Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
ext = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(ext);
Vertex v5 = new Vertex(10, 0, 0);
Vertex v6 = new Vertex(10, 10, 0);
Vertex v7 = new Vertex(-2, 10, 0);
Vertex v8 = new Vertex(-2, 3, 0);
ext.addVertex(v2);
ext.addVertex(v5);
ext.addVertex(v6);
ext.addVertex(v7);
ext.addVertex(v8);
ext.addVertex(v3);
ext.addVertex(v2);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertEquals(1, intersectPolygons.size());
PolygonPolygonIntersection in = intersectPolygons.get(0);
assertEquals(IntersectionType.PARTIALLY_EMBEDDED_POLYGON, in.getIntersectionType());
PolyLine polyLine = in.getPolyLine();
PolyLineSegment firstSegment = polyLine.getFirstSegment();
Point3d start = firstSegment.getStart().getPoint();
assertEquals(2, start.getX(), 0.0000001);
assertEquals(6, start.getY(), 0.0000001);
assertEquals(0, start.getZ(), 0.0000001);
intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly2, edgePoly1, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertEquals(1, intersectPolygons.size());
in = intersectPolygons.get(0);
assertEquals(IntersectionType.PARTIALLY_EMBEDDED_POLYGON, in.getIntersectionType());
}
@Test
public void testIntersectionTwoPolygonsOneSharedEdgeCloseEdgePlanar() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1);
......@@ -309,7 +375,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -362,7 +429,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -414,7 +482,10 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertFalse(intersectPolygons.isEmpty());
for (PolygonPolygonIntersection in : intersectPolygons) {
......@@ -472,7 +543,63 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly2, edgePoly1, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
}
@Test
public void testIntersectionTwoPolygonsTouchingInOnePointNoIntersectionNotPlanar2() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1);
Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing ext = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(ext);
Vertex v0 = new Vertex(3514751.69, 5405877.02, 252.68);
Vertex v1 = new Vertex(3514747.236, 5405875.302, 257.195);
Vertex v2 = new Vertex(3514746.319, 5405873.509, 257.394);
Vertex v3 = new Vertex(3514744.883, 5405872.908, 258.825);
Vertex v4 = new Vertex(3514747.48, 5405866.99, 252.68);
ext.addVertex(v0);
ext.addVertex(v1);
ext.addVertex(v2);
ext.addVertex(v3);
ext.addVertex(v4);
ext.addVertex(v0);
Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
ext = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(ext);
Vertex v5 = new Vertex(3514731.94, 5405873.52, 252.68);
Vertex v6 = new Vertex(3514731.94, 5405873.52, 234.54);
Vertex v7 = new Vertex(3514747.48, 5405866.99, 234.54);
ext.addVertex(v4);
ext.addVertex(v5);
ext.addVertex(v6);
ext.addVertex(v7);
ext.addVertex(v4);
MeshSurface meshSurface = MeshSurface.of(geom);
List<CDPolygonNs> polygons = meshSurface.getPolygons();
assertEquals(2, polygons.size());
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
DebugUtils.printGeoknechtPolygon(edgePoly1, edgePoly2);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -525,7 +652,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -578,7 +706,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -631,7 +760,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -680,7 +810,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertFalse(intersectPolygons.isEmpty());
for (PolygonPolygonIntersection in : intersectPolygons) {
......@@ -735,7 +866,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertFalse(intersectPolygons.isEmpty());
for (PolygonPolygonIntersection in : intersectPolygons) {
......@@ -790,7 +922,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertFalse(intersectPolygons.isEmpty());
for (PolygonPolygonIntersection in : intersectPolygons) {
......@@ -845,7 +978,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertFalse(intersectPolygons.isEmpty());
for (PolygonPolygonIntersection in : intersectPolygons) {
......@@ -915,7 +1049,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -975,7 +1110,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -1037,7 +1173,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......@@ -1101,7 +1238,8 @@ public class MeshSurfaceUtilsTest {
CDPolygonNs edgePoly1 = meshSurface.getPolygons().get(0);
CDPolygonNs edgePoly2 = meshSurface.getPolygons().get(1);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1, edgePoly2, 0.000001, 0.001);
List<PolygonPolygonIntersection> intersectPolygons = IntersectPlanarPolygons.intersectPolygons(edgePoly1,
edgePoly2, 0.000001, 0.001);
assertNotNull(intersectPolygons);
assertTrue(intersectPolygons.isEmpty());
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.10.0-SNAPSHOT</version>
<version>3.10.0</version>
</parent>
<properties>
......
......@@ -84,7 +84,7 @@ public class Requirement implements Serializable {
R_SE_BS_ROOF_UNFRAGMENTED.parameters = Collections.unmodifiableList(defaultParameters);
defaultParameters = new ArrayList<>();
defaultParameters.add(new DefaultParameter(DEGENERATED_RING_TOLERANCE, "0.01", Unit.METER));
defaultParameters.add(new DefaultParameter(DEGENERATED_RING_TOLERANCE, "0", Unit.METER));
R_GE_R_SELF_INTERSECTION.parameters = Collections.unmodifiableList(defaultParameters);
}
......
......@@ -96,7 +96,7 @@ public class NonPlanarPolygonDistancePlaneError implements CheckError {
@Override
public String toString() {
return "DistanceError [p=" + p + ", distance=" + distance + ", v=" + v + ", plane=" + plane + "]";
return "NonPlanarPolygonDistancePlaneError [p=" + p + ", distance=" + distance + ", v=" + v + ", plane=" + plane + "]";
}
@Override
......
......@@ -35,6 +35,8 @@ import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
/**
* Container for attributes of an abstract building. It can be a Building or
......@@ -279,4 +281,25 @@ public abstract class AbstractBuilding extends CityObject {
bs.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
handler.addInstance(buildingInstallations);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractBuilding originalAb = (AbstractBuilding) original;
for (BoundarySurface originalBs : originalAb.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
for (BuildingInstallation originalBi : originalAb.buildingInstallations) {
buildingInstallations.add(handler.getCopyInstance(originalBi));
}
ab = originalAb.ab;
}
}
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