Commit 8536ec35 authored by Matthias Betz's avatar Matthias Betz
Browse files

move adjacency info to geometry to allow better serialization

parent 5df59c7a
Pipeline #12311 passed with stage
in 2 minutes and 17 seconds
...@@ -18,6 +18,16 @@ ...@@ -18,6 +18,16 @@
*/ */
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import de.hft.stuttgart.citydoctor2.check.CheckableVisitor; import de.hft.stuttgart.citydoctor2.check.CheckableVisitor;
import de.hft.stuttgart.citydoctor2.math.Triangle3d; import de.hft.stuttgart.citydoctor2.math.Triangle3d;
import de.hft.stuttgart.citydoctor2.math.Vector3d; import de.hft.stuttgart.citydoctor2.math.Vector3d;
...@@ -26,11 +36,6 @@ import de.hft.stuttgart.citydoctor2.utils.BoundingBoxCalculator; ...@@ -26,11 +36,6 @@ import de.hft.stuttgart.citydoctor2.utils.BoundingBoxCalculator;
import de.hft.stuttgart.citydoctor2.utils.SerializablePair; import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.util.*;
/** /**
* Representation of a geometry containing the polygons and edges * Representation of a geometry containing the polygons and edges
* *
...@@ -55,9 +60,11 @@ public class Geometry extends GmlElement { ...@@ -55,9 +60,11 @@ public class Geometry extends GmlElement {
private CityObject parent; private CityObject parent;
private final List<Polygon> polygons = new ArrayList<>(2); private final List<Polygon> polygons = new ArrayList<>(2);
private transient List<Edge> edges; private List<Edge> edges;
private transient Map<SerializablePair<Vertex, Vertex>, Edge> edgeMap; private Map<SerializablePair<Vertex, Vertex>, Edge> edgeMap;
private transient List<Vertex> vertices; private List<Vertex> vertices;
private Map<Vertex, Set<LinearRing>> adjacentRingsOfVertices = new HashMap<>();
private Orientation orientation; private Orientation orientation;
public Geometry(GeometryType type, Lod lod, Orientation orientation) { public Geometry(GeometryType type, Lod lod, Orientation orientation) {
...@@ -69,6 +76,15 @@ public class Geometry extends GmlElement { ...@@ -69,6 +76,15 @@ public class Geometry extends GmlElement {
this.orientation = orientation; this.orientation = orientation;
} }
public Set<LinearRing> getAdjacentRingsOfVertex(Vertex v) {
return adjacentRingsOfVertices.compute(v, (vertex, set) -> {
if (set == null) {
return new HashSet<>(4);
}
return set;
});
}
public Orientation getOrientation() { public Orientation getOrientation() {
return orientation; return orientation;
} }
...@@ -346,18 +362,9 @@ public class Geometry extends GmlElement { ...@@ -346,18 +362,9 @@ public class Geometry extends GmlElement {
return false; return false;
} }
@Serial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
edges = new ArrayList<>();
edgeMap = new HashMap<>();
}
public void clearMetaData() { public void clearMetaData() {
if (vertices != null) { if (vertices != null) {
for (Vertex v : vertices) { adjacentRingsOfVertices = new HashMap<>();
v.clearAdjacentRings();
}
vertices = null; vertices = null;
} }
edges = null; edges = null;
......
...@@ -18,16 +18,12 @@ ...@@ -18,16 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
/** /**
* Contains the vertex information of a point in a linear ring * Contains the vertex information of a point in a linear ring
...@@ -39,7 +35,6 @@ public class Vertex extends Vector3d { ...@@ -39,7 +35,6 @@ public class Vertex extends Vector3d {
@Serial @Serial
private static final long serialVersionUID = -5525361920397934892L; private static final long serialVersionUID = -5525361920397934892L;
private transient List<SerializablePair<Geometry, HashSet<LinearRing>>> adjacentRings = new ArrayList<>(2);
public Vertex(double x, double y, double z) { public Vertex(double x, double y, double z) {
super(x, y, z); super(x, y, z);
...@@ -49,58 +44,16 @@ public class Vertex extends Vector3d { ...@@ -49,58 +44,16 @@ public class Vertex extends Vector3d {
super(vec); super(vec);
} }
private Set<LinearRing> getAdjacentRingsWithoutNeighbor(Geometry geom) {
for (SerializablePair<Geometry, HashSet<LinearRing>> adjacency : adjacentRings) {
if (adjacency.getValue0() == geom) {
return adjacency.getValue1();
}
}
throw new IllegalStateException("Requested adjacent rings with Geometry not containing this vertex");
}
public Set<LinearRing> getAdjacentRings(Geometry geom) { public Set<LinearRing> getAdjacentRings(Geometry geom) {
return getAdjacentRingsWithoutNeighbor(geom); return geom.getAdjacentRingsOfVertex(this);
} }
void addAdjacentRing(LinearRing ring, Geometry geom) { void addAdjacentRing(LinearRing ring, Geometry geom) {
findAdjacentRingsForGeometry(geom).add(ring); getAdjacentRings(geom).add(ring);
}
private Set<LinearRing> findAdjacentRingsForGeometry(Geometry geom) {
HashSet<LinearRing> adjacendRingsSet = null;
for (SerializablePair<Geometry, HashSet<LinearRing>> adjacency : adjacentRings) {
if (adjacency.getValue0() == geom) {
adjacendRingsSet = adjacency.getValue1();
}
}
if (adjacendRingsSet == null) {
adjacendRingsSet = new HashSet<>(4);
adjacentRings.add(new SerializablePair<>(geom, adjacendRingsSet));
}
return adjacendRingsSet;
}
private Set<Polygon> getAdjacentPolygonsWithoutNeighbor(Geometry geom) {
for (SerializablePair<Geometry, HashSet<LinearRing>> adjacency : adjacentRings) {
if (adjacency.getValue0() == geom) {
Set<Polygon> polygons = new HashSet<>();
for (LinearRing lr : adjacency.getValue1()) {
polygons.add(lr.getParent());
}
return polygons;
}
}
throw new IllegalStateException("Requested adjacent polygons with Geometry not containing this vertex");
}
@Serial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
clearAdjacentRings();
} }
public Set<Polygon> getAdjacentPolygons(Geometry geom) { public Set<Polygon> getAdjacentPolygons(Geometry geom) {
return getAdjacentPolygonsWithoutNeighbor(geom); return getAdjacentRings(geom).stream().map(r -> r.getParent()).collect(Collectors.toCollection(HashSet::new));
} }
@Override @Override
...@@ -127,21 +80,11 @@ public class Vertex extends Vector3d { ...@@ -127,21 +80,11 @@ public class Vertex extends Vector3d {
} }
public void clearAdjacentRings(Geometry geometry) { public void clearAdjacentRings(Geometry geometry) {
if (adjacentRings == null) { getAdjacentRings(geometry).clear();
return;
}
findAdjacentRingsForGeometry(geometry).clear();
} }
void removeAdjacency(LinearRing lr, Geometry geom) { void removeAdjacency(LinearRing lr, Geometry geom) {
findAdjacentRingsForGeometry(geom).remove(lr); getAdjacentRings(geom).remove(lr);
}
/**
* Remove all adjacent rings from this vertex, ignoring geometry association
*/
void clearAdjacentRings() {
adjacentRings = new ArrayList<>(2);
} }
} }
...@@ -52,12 +52,12 @@ public class BuildingTest { ...@@ -52,12 +52,12 @@ public class BuildingTest {
Vertex v2 = new Vertex(2, 0, 0); Vertex v2 = new Vertex(2, 0, 0);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
ConcretePolygon p = new ConcretePolygon(); ConcretePolygon p = new ConcretePolygon();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0, Orientation.OUTWARD);
geom.addPolygon(p);
p.setExteriorRing(lr); p.setExteriorRing(lr);
lr.addVertex(v1); lr.addVertex(v1);
lr.addVertex(v2); lr.addVertex(v2);
lr.addVertex(v1); lr.addVertex(v1);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0, Orientation.OUTWARD);
geom.addPolygon(p);
geom.updateEdgesAndVertices(); geom.updateEdgesAndVertices();
b.addGeometry(geom); b.addGeometry(geom);
......
...@@ -105,9 +105,9 @@ public class GeometryTest { ...@@ -105,9 +105,9 @@ public class GeometryTest {
ConcretePolygon p = new ConcretePolygon(); ConcretePolygon p = new ConcretePolygon();
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
geom.addPolygon(p);
lr.addVertex(new Vertex(0, 0, 0)); lr.addVertex(new Vertex(0, 0, 0));
geom.addPolygon(p);
p.setPartOfSurface(bs); p.setPartOfSurface(bs);
p.setPartOfInstallation(bi); p.setPartOfInstallation(bi);
...@@ -139,9 +139,9 @@ public class GeometryTest { ...@@ -139,9 +139,9 @@ public class GeometryTest {
ConcretePolygon p = new ConcretePolygon(); ConcretePolygon p = new ConcretePolygon();
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
geom.addPolygon(p);
lr.addVertex(new Vertex(0, 0, 0)); lr.addVertex(new Vertex(0, 0, 0));
geom.addPolygon(p);
p.setPartOfSurface(bs); p.setPartOfSurface(bs);
bs.addGeometry(geom); bs.addGeometry(geom);
...@@ -165,10 +165,10 @@ public class GeometryTest { ...@@ -165,10 +165,10 @@ public class GeometryTest {
ConcretePolygon p = new ConcretePolygon(); ConcretePolygon p = new ConcretePolygon();
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
geom.addPolygon(p);
lr.addVertex(new Vertex(0, 0, 0)); lr.addVertex(new Vertex(0, 0, 0));
bs.addGeometry(geom); bs.addGeometry(geom);
geom.addPolygon(p);
p.setPartOfSurface(bs); p.setPartOfSurface(bs);
p.setPartOfInstallation(bi); p.setPartOfInstallation(bi);
......
...@@ -22,6 +22,7 @@ import static org.junit.Assert.*; ...@@ -22,6 +22,7 @@ import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.math.UnitVector3d; import de.hft.stuttgart.citydoctor2.math.UnitVector3d;
import de.hft.stuttgart.citydoctor2.math.Vector3d; import de.hft.stuttgart.citydoctor2.math.Vector3d;
...@@ -35,7 +36,9 @@ public class LinearRingTest { ...@@ -35,7 +36,9 @@ public class LinearRingTest {
@Test @Test
public void testIsPointInside1() { public void testIsPointInside1() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
......
...@@ -62,20 +62,4 @@ public class VertexTest { ...@@ -62,20 +62,4 @@ public class VertexTest {
assertEquals(1, adjacentRings.size()); assertEquals(1, adjacentRings.size());
assertTrue(adjacentRings.contains(lr)); assertTrue(adjacentRings.contains(lr));
} }
@Test(expected = IllegalStateException.class)
public void testGetAdjacentRingsGeometryNotContainingVertex() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1, Orientation.OUTWARD);
Polygon p = new ConcretePolygon();
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr);
Vertex v0 = new Vertex(0, 0, 0);
lr.addVertex(v0);
v0.getAdjacentRings(geom);
}
} }
...@@ -45,7 +45,9 @@ public class DuplicatePointsCheckTest { ...@@ -45,7 +45,9 @@ public class DuplicatePointsCheckTest {
@Test @Test
public void testCheckOK() { public void testCheckOK() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
...@@ -67,7 +69,9 @@ public class DuplicatePointsCheckTest { ...@@ -67,7 +69,9 @@ public class DuplicatePointsCheckTest {
@Test @Test
public void testCheckConsecutivePointSame() { public void testCheckConsecutivePointSame() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
p.setExteriorRing(lr); p.setExteriorRing(lr);
......
...@@ -49,13 +49,13 @@ public class PlanarCheckTest { ...@@ -49,13 +49,13 @@ public class PlanarCheckTest {
Vertex v3 = new Vertex(1, 0, 0); Vertex v3 = new Vertex(1, 0, 0);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p);
p.setExteriorRing(lr); p.setExteriorRing(lr);
lr.addVertex(v0); lr.addVertex(v0);
lr.addVertex(v1); lr.addVertex(v1);
lr.addVertex(v2); lr.addVertex(v2);
lr.addVertex(v3); lr.addVertex(v3);
lr.addVertex(v0); lr.addVertex(v0);
geom.addPolygon(p);
PlanarCheck c = new PlanarCheck(); PlanarCheck c = new PlanarCheck();
c.check(p); c.check(p);
assertTrue(p.getCheckResult(c).getResultStatus() == ResultStatus.OK); assertTrue(p.getCheckResult(c).getResultStatus() == ResultStatus.OK);
...@@ -70,6 +70,7 @@ public class PlanarCheckTest { ...@@ -70,6 +70,7 @@ public class PlanarCheckTest {
Vertex v3 = new Vertex(1, 1, 0); Vertex v3 = new Vertex(1, 1, 0);
LinearRing lr = new LinearRing(LinearRingType.EXTERIOR); LinearRing lr = new LinearRing(LinearRingType.EXTERIOR);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p);
p.setExteriorRing(lr); p.setExteriorRing(lr);
lr.addVertex(v0); lr.addVertex(v0);
lr.addVertex(v1); lr.addVertex(v1);
...@@ -77,7 +78,6 @@ public class PlanarCheckTest { ...@@ -77,7 +78,6 @@ public class PlanarCheckTest {
lr.addVertex(v3); lr.addVertex(v3);
lr.addVertex(v0); lr.addVertex(v0);
lr.setParent(p); lr.setParent(p);
geom.addPolygon(p);
PlanarCheck c = new PlanarCheck(); PlanarCheck c = new PlanarCheck();
c.check(p); c.check(p);
assertTrue(p.getCheckResult(c).getResultStatus() == ResultStatus.ERROR); assertTrue(p.getCheckResult(c).getResultStatus() == ResultStatus.ERROR);
......
...@@ -57,7 +57,9 @@ public class SelfIntersectionUtilTest { ...@@ -57,7 +57,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -71,6 +73,7 @@ public class SelfIntersectionUtilTest { ...@@ -71,6 +73,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(10, 10, 1); Vertex v5 = new Vertex(10, 10, 1);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -90,7 +93,9 @@ public class SelfIntersectionUtilTest { ...@@ -90,7 +93,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -104,6 +109,7 @@ public class SelfIntersectionUtilTest { ...@@ -104,6 +109,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(10, 10, -1); Vertex v5 = new Vertex(10, 10, -1);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -123,7 +129,9 @@ public class SelfIntersectionUtilTest { ...@@ -123,7 +129,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -137,6 +145,7 @@ public class SelfIntersectionUtilTest { ...@@ -137,6 +145,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(7, 7, -5); Vertex v5 = new Vertex(7, 7, -5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -159,7 +168,9 @@ public class SelfIntersectionUtilTest { ...@@ -159,7 +168,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -173,6 +184,7 @@ public class SelfIntersectionUtilTest { ...@@ -173,6 +184,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(10, 10, 0); Vertex v5 = new Vertex(10, 10, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -192,7 +204,9 @@ public class SelfIntersectionUtilTest { ...@@ -192,7 +204,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -206,6 +220,7 @@ public class SelfIntersectionUtilTest { ...@@ -206,6 +220,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(7, 7, -5); Vertex v5 = new Vertex(7, 7, -5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -233,7 +248,9 @@ public class SelfIntersectionUtilTest { ...@@ -233,7 +248,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -247,6 +264,7 @@ public class SelfIntersectionUtilTest { ...@@ -247,6 +264,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(7, 7, -5); Vertex v5 = new Vertex(7, 7, -5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -276,7 +294,9 @@ public class SelfIntersectionUtilTest { ...@@ -276,7 +294,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -292,6 +312,7 @@ public class SelfIntersectionUtilTest { ...@@ -292,6 +312,7 @@ public class SelfIntersectionUtilTest {
Vertex v7 = new Vertex(9, 2, -3); Vertex v7 = new Vertex(9, 2, -3);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -331,7 +352,9 @@ public class SelfIntersectionUtilTest { ...@@ -331,7 +352,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -359,6 +382,7 @@ public class SelfIntersectionUtilTest { ...@@ -359,6 +382,7 @@ public class SelfIntersectionUtilTest {
Vertex v7 = new Vertex(9, 2, -3); Vertex v7 = new Vertex(9, 2, -3);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -406,7 +430,9 @@ public class SelfIntersectionUtilTest { ...@@ -406,7 +430,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -434,6 +460,7 @@ public class SelfIntersectionUtilTest { ...@@ -434,6 +460,7 @@ public class SelfIntersectionUtilTest {
Vertex v7 = new Vertex(9, 2, -3); Vertex v7 = new Vertex(9, 2, -3);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
...@@ -465,7 +492,9 @@ public class SelfIntersectionUtilTest { ...@@ -465,7 +492,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -479,6 +508,7 @@ public class SelfIntersectionUtilTest { ...@@ -479,6 +508,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(10, 10, 0); Vertex v5 = new Vertex(10, 10, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -497,7 +527,9 @@ public class SelfIntersectionUtilTest { ...@@ -497,7 +527,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -511,6 +543,7 @@ public class SelfIntersectionUtilTest { ...@@ -511,6 +543,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(9, 10, 0); Vertex v5 = new Vertex(9, 10, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -529,7 +562,9 @@ public class SelfIntersectionUtilTest { ...@@ -529,7 +562,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 0); Vertex v2 = new Vertex(10, 10, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -543,6 +578,7 @@ public class SelfIntersectionUtilTest { ...@@ -543,6 +578,7 @@ public class SelfIntersectionUtilTest {
Vertex v5 = new Vertex(10, 11, 0); Vertex v5 = new Vertex(10, 11, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -561,7 +597,9 @@ public class SelfIntersectionUtilTest { ...@@ -561,7 +597,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 10, 10); Vertex v2 = new Vertex(10, 10, 10);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -576,6 +614,7 @@ public class SelfIntersectionUtilTest { ...@@ -576,6 +614,7 @@ public class SelfIntersectionUtilTest {
Vertex v6 = new Vertex(8, 5, 5); Vertex v6 = new Vertex(8, 5, 5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -600,7 +639,9 @@ public class SelfIntersectionUtilTest { ...@@ -600,7 +639,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 0, 0); Vertex v1 = new Vertex(10, 0, 0);
Vertex v2 = new Vertex(10, 0, 10); Vertex v2 = new Vertex(10, 0, 10);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -615,6 +656,7 @@ public class SelfIntersectionUtilTest { ...@@ -615,6 +656,7 @@ public class SelfIntersectionUtilTest {
Vertex v6 = new Vertex(8, 0, 5); Vertex v6 = new Vertex(8, 0, 5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -639,7 +681,9 @@ public class SelfIntersectionUtilTest { ...@@ -639,7 +681,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(0, 10, 0); Vertex v1 = new Vertex(0, 10, 0);
Vertex v2 = new Vertex(0, 10, 10); Vertex v2 = new Vertex(0, 10, 10);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -654,6 +698,7 @@ public class SelfIntersectionUtilTest { ...@@ -654,6 +698,7 @@ public class SelfIntersectionUtilTest {
Vertex v6 = new Vertex(0, 8, 5); Vertex v6 = new Vertex(0, 8, 5);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -678,7 +723,9 @@ public class SelfIntersectionUtilTest { ...@@ -678,7 +723,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 10, 0); Vertex v1 = new Vertex(10, 10, 0);
Vertex v2 = new Vertex(10, 0, 0); Vertex v2 = new Vertex(10, 0, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -693,6 +740,7 @@ public class SelfIntersectionUtilTest { ...@@ -693,6 +740,7 @@ public class SelfIntersectionUtilTest {
Vertex v6 = new Vertex(8, 2, 0); Vertex v6 = new Vertex(8, 2, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
...@@ -737,7 +785,9 @@ public class SelfIntersectionUtilTest { ...@@ -737,7 +785,9 @@ public class SelfIntersectionUtilTest {
Vertex v1 = new Vertex(10, 10, 0); Vertex v1 = new Vertex(10, 10, 0);
Vertex v2 = new Vertex(10, 0, 0); Vertex v2 = new Vertex(10, 0, 0);
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
Polygon p1 = new ConcretePolygon(); Polygon p1 = new ConcretePolygon();
geom.addPolygon(p1);
LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r1 = new LinearRing(LinearRingType.EXTERIOR);
p1.setExteriorRing(r1); p1.setExteriorRing(r1);
...@@ -752,6 +802,7 @@ public class SelfIntersectionUtilTest { ...@@ -752,6 +802,7 @@ public class SelfIntersectionUtilTest {
Vertex v6 = new Vertex(8, 2, 0); Vertex v6 = new Vertex(8, 2, 0);
Polygon p2 = new ConcretePolygon(); Polygon p2 = new ConcretePolygon();
geom.addPolygon(p2);
LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR); LinearRing r2 = new LinearRing(LinearRingType.EXTERIOR);
p2.setExteriorRing(r2); p2.setExteriorRing(r2);
r2.addVertex(v3); r2.addVertex(v3);
......
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