Commit 297334ab authored by Matthias Betz's avatar Matthias Betz
Browse files

Add design spec for OpenGL 3D view



Replaces the JavaFX SubScene/MeshView rendering with an OpenGL viewport
(openglfx-jogl, GL 3.3 core), single global VBO, GPU color-picking, and
baked fake shading. Windows/Linux targets; JavaFX 3D path removed.

Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
parents 5c2847ef bd40b396
...@@ -29,6 +29,8 @@ import java.io.IOException; ...@@ -29,6 +29,8 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.core.AbstractThematicSurface; import org.citygml4j.core.model.core.AbstractThematicSurface;
import org.citygml4j.core.model.core.CityModel; import org.citygml4j.core.model.core.CityModel;
import org.junit.Rule; import org.junit.Rule;
...@@ -55,6 +57,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon; ...@@ -55,6 +57,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException; import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
...@@ -69,13 +72,14 @@ public class HealMissingSolidTest { ...@@ -69,13 +72,14 @@ public class HealMissingSolidTest {
@Test @Test
public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException { public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = new CityDoctorModel(config.getParserConfiguration(), new File("test")); CityDoctorModel model = new CityDoctorModel(config.getParserConfiguration(), new File("test"), new UnconnectedCache());
model.setParsedCityGMLVersion(CityGMLVersion.v3_0);
model.setCityModel(new CityModel()); model.setCityModel(new CityModel());
Building b = new Building(); Building b = new Building();
model.addBuilding(b); model.addBuilding(b);
b.setGmlObject(new org.citygml4j.core.model.building.Building()); b.setGmlObject(new org.citygml4j.core.model.building.Building());
Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2); Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
ConcretePolygon p1 = new ConcretePolygon(); ConcretePolygon p1 = new ConcretePolygon();
LinearRing ext1 = createTestRing(); LinearRing ext1 = createTestRing();
...@@ -84,7 +88,7 @@ public class HealMissingSolidTest { ...@@ -84,7 +88,7 @@ public class HealMissingSolidTest {
BoundarySurface bs1 = new BoundarySurface(mock(AbstractThematicSurface.class)); BoundarySurface bs1 = new BoundarySurface(mock(AbstractThematicSurface.class));
b.addBoundarySurface(bs1); b.addBoundarySurface(bs1);
Geometry geom2 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2); Geometry geom2 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
bs1.addGeometry(geom2); bs1.addGeometry(geom2);
ConcretePolygon p2 = new ConcretePolygon(); ConcretePolygon p2 = new ConcretePolygon();
LinearRing ext2 = createTestRing(); LinearRing ext2 = createTestRing();
...@@ -95,7 +99,7 @@ public class HealMissingSolidTest { ...@@ -95,7 +99,7 @@ public class HealMissingSolidTest {
Installation bi = new Installation(); Installation bi = new Installation();
b.addBuildingInstallation(bi); b.addBuildingInstallation(bi);
Geometry geom3 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2); Geometry geom3 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
bi.addGeometry(geom3); bi.addGeometry(geom3);
ConcretePolygon p3 = new ConcretePolygon(); ConcretePolygon p3 = new ConcretePolygon();
LinearRing ext3 = createTestRing(); LinearRing ext3 = createTestRing();
...@@ -104,7 +108,7 @@ public class HealMissingSolidTest { ...@@ -104,7 +108,7 @@ public class HealMissingSolidTest {
BoundarySurface bs2 = new BoundarySurface(mock(AbstractThematicSurface.class)); BoundarySurface bs2 = new BoundarySurface(mock(AbstractThematicSurface.class));
bi.addBoundarySurface(bs2); bi.addBoundarySurface(bs2);
Geometry geom4 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2); Geometry geom4 = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
bs2.addGeometry(geom4); bs2.addGeometry(geom4);
ConcretePolygon p4 = new ConcretePolygon(); ConcretePolygon p4 = new ConcretePolygon();
LinearRing ext4 = createTestRing(); LinearRing ext4 = createTestRing();
...@@ -137,7 +141,7 @@ public class HealMissingSolidTest { ...@@ -137,7 +141,7 @@ public class HealMissingSolidTest {
model.saveAs(createSolidFile.toString(), false); model.saveAs(createSolidFile.toString(), false);
CityDoctorModel parsedModel = CityGmlParser.parseCityGmlFile(createSolidFile.toString(), config.getParserConfiguration()); CityDoctorModel parsedModel = CityGmlParser.parseCityGmlFile(createSolidFile.toString(), config.getParserConfiguration());
Building building = parsedModel.getBuildings().get(0); Building building = parsedModel.getBuildings().toList().get(0);
assertEquals(1, building.getGeometries().size()); assertEquals(1, building.getGeometries().size());
Geometry geometry2 = building.getGeometries().get(0); Geometry geometry2 = building.getGeometries().get(0);
assertEquals(GeometryType.SOLID, geometry2.getType()); assertEquals(GeometryType.SOLID, geometry2.getType());
...@@ -161,7 +165,7 @@ public class HealMissingSolidTest { ...@@ -161,7 +165,7 @@ public class HealMissingSolidTest {
new RequirementConfiguration(false)); new RequirementConfiguration(false));
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/SimpleSolid_SrefBS_withoutSolid.gml", CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/SimpleSolid_SrefBS_withoutSolid.gml",
config.getParserConfiguration()); config.getParserConfiguration());
Building b = model.getBuildings().get(0); Building b = model.getBuildings().toList().get(0);
assertTrue(b.getGeometries().isEmpty()); assertTrue(b.getGeometries().isEmpty());
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
......
...@@ -25,11 +25,11 @@ public class HealNonManifoldEdgeErrorTest { ...@@ -25,11 +25,11 @@ public class HealNonManifoldEdgeErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NON_MANIFOLD_EDGE));
} }
......
...@@ -7,6 +7,7 @@ import java.io.IOException; ...@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
...@@ -27,9 +28,11 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType; ...@@ -27,9 +28,11 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealPlanarPolygonErrorTest { public class HealPlanarPolygonErrorTest {
...@@ -42,22 +45,22 @@ public class HealPlanarPolygonErrorTest { ...@@ -42,22 +45,22 @@ public class HealPlanarPolygonErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertTrue(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(2); healer.healCityObject(model.getBuildings().toList().get(0));
healer.healCityObject(model.getBuildings().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR)); Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon() { public void testNonplanarPolygon() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
...@@ -159,10 +162,11 @@ public class HealPlanarPolygonErrorTest { ...@@ -159,10 +162,11 @@ public class HealPlanarPolygonErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split() { public void testNonplanarPolygon_Split() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
...@@ -273,10 +277,11 @@ public class HealPlanarPolygonErrorTest { ...@@ -273,10 +277,11 @@ public class HealPlanarPolygonErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split2() { public void testNonplanarPolygon_Split2() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
......
...@@ -35,11 +35,11 @@ public class HealPolygonWithoutSurfaceTest { ...@@ -35,11 +35,11 @@ public class HealPolygonWithoutSurfaceTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building building = model.getBuildings().get(0); Building building = model.getBuildings().toList().get(0);
Assert.assertTrue(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertTrue(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
...@@ -49,7 +49,7 @@ public class HealPolygonWithoutSurfaceTest { ...@@ -49,7 +49,7 @@ public class HealPolygonWithoutSurfaceTest {
CityDoctorModel loadedModel = TestUtil.loadCityModel(outputFile.toString(), config); CityDoctorModel loadedModel = TestUtil.loadCityModel(outputFile.toString(), config);
c = new Checker(config, loadedModel); c = new Checker(config, loadedModel);
c.runChecks(); c.runChecks();
building = loadedModel.getBuildings().get(0); building = loadedModel.getBuildings().toList().get(0);
Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE)); Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
} }
......
...@@ -41,11 +41,11 @@ public class HealPolygonWrongOrientationErrorTest { ...@@ -41,11 +41,11 @@ public class HealPolygonWrongOrientationErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_POLYGON_WRONG_ORIENTATION));
} }
......
...@@ -25,11 +25,11 @@ public class HealRingNotClosedErrorTest { ...@@ -25,11 +25,11 @@ public class HealRingNotClosedErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_NOT_CLOSED)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_NOT_CLOSED));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_NOT_CLOSED)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_NOT_CLOSED));
} }
......
...@@ -27,6 +27,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType; ...@@ -27,6 +27,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
...@@ -35,7 +36,7 @@ public class HealRingSelfIntErrorTest { ...@@ -35,7 +36,7 @@ public class HealRingSelfIntErrorTest {
@Test @Test
public void testIntersectingEdges1() { public void testIntersectingEdges1() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p); geom.addPolygon(p);
...@@ -92,7 +93,7 @@ public class HealRingSelfIntErrorTest { ...@@ -92,7 +93,7 @@ public class HealRingSelfIntErrorTest {
@Test @Test
public void testDuplicatePoint1() { public void testDuplicatePoint1() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p); geom.addPolygon(p);
...@@ -137,7 +138,7 @@ public class HealRingSelfIntErrorTest { ...@@ -137,7 +138,7 @@ public class HealRingSelfIntErrorTest {
@Test @Test
public void testDuplicatePoint2() { public void testDuplicatePoint2() {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD1, Orientation.OUTWARD);
Polygon p = new ConcretePolygon(); Polygon p = new ConcretePolygon();
geom.addPolygon(p); geom.addPolygon(p);
...@@ -189,11 +190,11 @@ public class HealRingSelfIntErrorTest { ...@@ -189,11 +190,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
...@@ -207,11 +208,11 @@ public class HealRingSelfIntErrorTest { ...@@ -207,11 +208,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
...@@ -227,11 +228,11 @@ public class HealRingSelfIntErrorTest { ...@@ -227,11 +228,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertTrue(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION)); Assert.assertFalse(geom.containsError(CheckId.C_GE_R_SELF_INTERSECTION));
} }
......
...@@ -26,11 +26,11 @@ public class HealSameOrientationErrorTest { ...@@ -26,11 +26,11 @@ public class HealSameOrientationErrorTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME)); Assert.assertTrue(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME)); Assert.assertFalse(geom.containsError(CheckId.C_GE_P_ORIENTATION_RINGS_SAME));
} }
......
...@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals; ...@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.citygml4j.xml.writer.CityGMLWriteException; import org.citygml4j.xml.writer.CityGMLWriteException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
...@@ -29,20 +32,24 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType; ...@@ -29,20 +32,24 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.healer.Healer; import de.hft.stuttgart.citydoctor2.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealSolidNotClosedErrorTest { public class HealSolidNotClosedErrorTest {
/** /**
* One polygon is split up in 3 but has not matching edges * One polygon is split up in 3 but has not matching edges
*/ */
@Test @Test
@Category(CppTest.class)
public void testVertexCloseToEdge() { public void testVertexCloseToEdge() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); //Angelika: als Test eingefügt Building b = new Building(); //Angelika: als Test eingefügt
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0); //Original Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0, Orientation.OUTWARD); //Original
// Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); //Angelika: Test // Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); //Angelika: Test
b.addGeometry(geom); //Angelika: als Test eingefügt b.addGeometry(geom); //Angelika: als Test eingefügt
...@@ -163,10 +170,11 @@ public class HealSolidNotClosedErrorTest { ...@@ -163,10 +170,11 @@ public class HealSolidNotClosedErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void testMissingPolygon() { public void testMissingPolygon() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
...@@ -255,7 +263,7 @@ public class HealSolidNotClosedErrorTest { ...@@ -255,7 +263,7 @@ public class HealSolidNotClosedErrorTest {
@Test @Test
public void test2MissingPolygons() { public void test2MissingPolygons() {
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
...@@ -342,10 +350,11 @@ public class HealSolidNotClosedErrorTest { ...@@ -342,10 +350,11 @@ public class HealSolidNotClosedErrorTest {
} }
@Test @Test
@Category(CppTest.class)
public void test2MissingPolygonsCpp() { public void test2MissingPolygonsCpp() {
CppInitializer.initCpp(); CppInitializer.initCpp();
Building b = new Building(); Building b = new Building();
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD2, Orientation.OUTWARD);
b.addGeometry(geom); b.addGeometry(geom);
Vertex v0 = new Vertex(0, 0, 0); Vertex v0 = new Vertex(0, 0, 0);
...@@ -419,7 +428,9 @@ public class HealSolidNotClosedErrorTest { ...@@ -419,7 +428,9 @@ public class HealSolidNotClosedErrorTest {
assertNotNull(cr); assertNotNull(cr);
assertEquals(ResultStatus.OK, cr.getResultStatus()); assertEquals(ResultStatus.OK, cr.getResultStatus());
} }
/** /**
* Missing Polygon has a self intersection * Missing Polygon has a self intersection
* @throws IOException * @throws IOException
...@@ -430,25 +441,23 @@ public class HealSolidNotClosedErrorTest { ...@@ -430,25 +441,23 @@ public class HealSolidNotClosedErrorTest {
*/ */
@Test @Test
public void testMissingPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testMissingPolygon2() throws CityGmlParseException, IOException, InvalidGmlFileException {
String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"; //bei diesem Modell stürzt die VM ab // String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"; //bei diesem Modell stürzt die VM ab
// String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml"; //hier nur Fehlermeldung // String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml"; //hier nur Fehlermeldung
String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0004-T0005.gml";
// String path = "src/test/resources/SimpleSolid_SrefBS.gml";
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = TestUtil.loadCityModel(path, config); CityDoctorModel model = TestUtil.loadCityModel(path, config);
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
geom.updateVertices();
for (Vertex v : geom.getVertices()) {
v.setX(v.getX() - 10);
v.setY(v.getY() - 10);
}
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NOT_CLOSED)); Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
Healer healer = new Healer(c); Healer healer = new Healer(c);
//healer.setNumberOfIterations(2); healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED)); Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
} }
......
...@@ -27,11 +27,11 @@ public class HealTooFewPointsTest { ...@@ -27,11 +27,11 @@ public class HealTooFewPointsTest {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
assertTrue(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS)); assertTrue(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS));
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
assertFalse(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS)); assertFalse(geom.containsError(CheckId.C_GE_R_TOO_FEW_POINTS));
} }
......
...@@ -45,7 +45,7 @@ public class TestHealer { ...@@ -45,7 +45,7 @@ public class TestHealer {
c.runChecks(); c.runChecks();
Building b = null; Building b = null;
for (Building building : model.getBuildings()) { for (Building building : model.getBuildings().toList()) {
if (building.getGmlId().getGmlString().equals("DEBE08YYF0004KZs")) { if (building.getGmlId().getGmlString().equals("DEBE08YYF0004KZs")) {
b = building; b = building;
break; break;
...@@ -125,8 +125,8 @@ public class TestHealer { ...@@ -125,8 +125,8 @@ public class TestHealer {
c.runChecks(); c.runChecks();
Healer healer = new Healer(c); Healer healer = new Healer(c);
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
...@@ -150,15 +150,14 @@ public class TestHealer { ...@@ -150,15 +150,14 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building b = model.getBuildings().toList().get(0);
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = b.getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(33); healer.healCityObject(b);
healer.healCityObject(model.getBuildings().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
} }
@Test @Test
...@@ -171,10 +170,10 @@ public class TestHealer { ...@@ -171,10 +170,10 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
...@@ -190,11 +189,10 @@ public class TestHealer { ...@@ -190,11 +189,10 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(83); healer.healCityObject(model.getBuildings().toList().get(0));
healer.healCityObject(model.getBuildings().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
...@@ -210,11 +208,10 @@ public class TestHealer { ...@@ -210,11 +208,10 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(165); healer.healCityObject(model.getBuildings().toList().get(0));
healer.healCityObject(model.getBuildings().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
...@@ -241,7 +238,7 @@ public class TestHealer { ...@@ -241,7 +238,7 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Building b = model.getBuildings().get(0); Building b = model.getBuildings().toList().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.healCityObject(b); healer.healCityObject(b);
c.runChecks(); c.runChecks();
...@@ -261,11 +258,10 @@ public class TestHealer { ...@@ -261,11 +258,10 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(45); healer.healCityObject(model.getBuildings().toList().get(0));
healer.healCityObject(model.getBuildings().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
...@@ -282,7 +278,6 @@ public class TestHealer { ...@@ -282,7 +278,6 @@ public class TestHealer {
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(45);
healer.healModel(model); healer.healModel(model);
} }
...@@ -297,10 +292,10 @@ public class TestHealer { ...@@ -297,10 +292,10 @@ public class TestHealer {
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
c.runChecks(); c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0); Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Healer healer = new Healer(c); Healer healer = new Healer(c);
healer.setNumberOfIterations(100);
healer.healCityObject(model.getBuildings().get(0)); healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks(); c.runChecks();
assertFalse(geom.containsAnyError()); assertFalse(geom.containsAnyError());
......
...@@ -31,22 +31,22 @@ public class TestUtil { ...@@ -31,22 +31,22 @@ public class TestUtil {
} }
public static CityDoctorModel loadCityModel(String path, ValidationConfiguration config) throws CityGmlParseException, IOException, InvalidGmlFileException { public static CityDoctorModel loadCityModel(String path, ValidationConfiguration config) throws CityGmlParseException, IOException, InvalidGmlFileException {
return CityGmlParser.parseCityGmlFile(path, config.getParserConfiguration()); return CityGmlParser.nestedCityGmlFileParse(path, config.getParserConfiguration());
} }
public static Polygon getPolygonById(String gmlId, CityDoctorModel model) { public static Polygon getPolygonById(String gmlId, CityDoctorModel model) {
if (gmlId == null) { if (gmlId == null) {
return null; return null;
} }
Polygon result = getPolygonById(gmlId, model.getBuildings()); Polygon result = getPolygonById(gmlId, model.getBuildings().toList());
if (result != null) { if (result != null) {
return result; return result;
} }
result = getPolygonById(gmlId, model.getVegetation()); result = getPolygonById(gmlId, model.getVegetation().toList());
if (result != null) { if (result != null) {
return result; return result;
} }
return getPolygonById(gmlId, model.getTransportation()); return getPolygonById(gmlId, model.getTransportation().toList());
} }
private static Polygon getPolygonById(String gmlId, List<? extends CityObject> features) { private static Polygon getPolygonById(String gmlId, List<? extends CityObject> features) {
...@@ -85,17 +85,17 @@ public class TestUtil { ...@@ -85,17 +85,17 @@ public class TestUtil {
if (featureId == null) { if (featureId == null) {
return null; return null;
} }
for (CityObject co : model.getBuildings()) { for (CityObject co : model.getBuildings().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) { if (featureId.equals(co.getGmlId().getGmlString())) {
return co; return co;
} }
} }
for (CityObject co : model.getTransportation()) { for (CityObject co : model.getTransportation().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) { if (featureId.equals(co.getGmlId().getGmlString())) {
return co; return co;
} }
} }
for (CityObject co : model.getVegetation()) { for (CityObject co : model.getVegetation().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) { if (featureId.equals(co.getGmlId().getGmlString())) {
return co; return co;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.16.0</version> <version>3.18.3</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorHealerGUI</artifactId> <artifactId>CityDoctorHealerGUI</artifactId>
...@@ -22,18 +22,18 @@ ...@@ -22,18 +22,18 @@
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorHealer</artifactId> <artifactId>CityDoctorHealer</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorAutoPro</artifactId> <artifactId>CityDoctorAutoPro</artifactId>
</dependency> -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -2,35 +2,33 @@ package de.hft.stuttgart.citydoctor2.healer.gui; ...@@ -2,35 +2,33 @@ package de.hft.stuttgart.citydoctor2.healer.gui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import de.hft.stuttgart.citydoctor2.check.Check; import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId; import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.RequirementType;
import de.hft.stuttgart.citydoctor2.check.Checker; import de.hft.stuttgart.citydoctor2.check.Checker;
import de.hft.stuttgart.citydoctor2.check.Requirement; import de.hft.stuttgart.citydoctor2.check.Requirement;
import de.hft.stuttgart.citydoctor2.check.RequirementType;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding; import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface; import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.Building; import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart; import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel; import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject; import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon; import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry; import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType; import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId; import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon; import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Opening; import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.gui.AutoProWindow;
import de.hft.stuttgart.citydoctor2.gui.HighlightController; import de.hft.stuttgart.citydoctor2.gui.HighlightController;
import de.hft.stuttgart.citydoctor2.gui.ListErrorVisitor; import de.hft.stuttgart.citydoctor2.gui.ListErrorVisitor;
import de.hft.stuttgart.citydoctor2.gui.TriangulatedGeometry; import de.hft.stuttgart.citydoctor2.gui.TriangulatedGeometry;
...@@ -85,10 +83,10 @@ public class HealerController { ...@@ -85,10 +83,10 @@ public class HealerController {
if (model == null) { if (model == null) {
return; return;
} }
model.createFeatureStream().forEach(CityObject::prepareForChecking); // model.createFeatureStream().forEach(CityObject::prepareForChecking);
AutoProWindow window = new AutoProWindow(model); // AutoProWindow window = new AutoProWindow(model);
window.setLocationRelativeTo(null); // window.setLocationRelativeTo(null);
window.setVisible(true); // window.setVisible(true);
} }
public void setCurrentModel(CityDoctorModel model) { public void setCurrentModel(CityDoctorModel model) {
...@@ -537,60 +535,44 @@ public class HealerController { ...@@ -537,60 +535,44 @@ public class HealerController {
} }
public void injectSolid(boolean useBs, boolean useBi, boolean useLod2, boolean useLod3, boolean useLod4) { public void injectSolid(boolean useBs, boolean useBi, boolean useLod2, boolean useLod3, boolean useLod4) {
if (model == null || currentFeature == null) { // if (model == null || currentFeature == null) {
return; // return;
} // }
CityObject oldFeature = currentFeature; model.getBuildings().forEach(b -> {
currentFeature.prepareForChecking(); // collect polygons
if (currentFeature instanceof BoundarySurface) { Map<Lod, List<Polygon>> availablePolygons = new EnumMap<>(Lod.class);
BoundarySurface surface = (BoundarySurface) currentFeature; Map<Lod, Set<Polygon>> existingPolygons = new EnumMap<>(Lod.class);
currentFeature = surface.getParent(); collectPolygons(useBs, useBi, availablePolygons, existingPolygons, b);
} if (useLod2) {
if (!(currentFeature instanceof Building)) { insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD2);
return; }
} if (useLod3) {
// collect polygons insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD3);
Map<Lod, List<Polygon>> availablePolygons = new EnumMap<>(Lod.class); }
Map<Lod, Set<Polygon>> existingPolygons = new EnumMap<>(Lod.class); if (useLod4) {
Building b = (Building) currentFeature; insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD4);
collectPolygons(useBs, useBi, availablePolygons, existingPolygons, b); }
if (useLod2) { for (BuildingPart part : b.getBuildingParts()) {
insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD2); // collect polygons
} availablePolygons = new EnumMap<>(Lod.class);
if (useLod3) { existingPolygons = new EnumMap<>(Lod.class);
insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD3); collectPolygons(useBs, useBi, availablePolygons, existingPolygons, part);
} if (useLod2) {
if (useLod4) { insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD2);
insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD4); }
} if (useLod3) {
nextFeature = null; insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD3);
nextGeometry = null; }
Lod lod = currentGeometry.getLod(); if (useLod4) {
GeometryType type = GeometryType.SOLID; insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD4);
currentGeometry = Objects.requireNonNull(currentFeature.getGeometry(type, lod)); }
checker.executeChecksForCheckable(currentFeature); }
healerView.getNextErrorList().getItems().clear(); });
healerView.getNextMeshGroup().getChildren().clear();
updateCurrentErrors();
currentTriangulatedGeometry = TriangulatedGeometry.of(currentGeometry);
currentErrorVisitor.setGeometry(currentTriangulatedGeometry);
currentTriangulatedGeometry.setCullFace(culling);
currentTriangulatedGeometry.setDrawMode(drawMode);
healerView.zoomOutForBoundingBox(currentGeometry.calculateBoundingBox());
healerView.getCurrentMeshGroup().getChildren().clear();
healerView.getCurrentMeshGroup().getChildren().addAll(currentTriangulatedGeometry.getMeshes());
healerView.getNextStepBtn().setDisable(false);
healerView.getHealCompleteBtn().setDisable(false);
healerView.getAcceptBtn().setDisable(true);
healerView.getCancelBtn().setDisable(true);
healerView.getSolidInjectorBtn().setDisable(true);
currentFeature = oldFeature;
} }
private void collectPolygons(boolean useBs, boolean useBi, Map<Lod, List<Polygon>> availablePolygons, private void collectPolygons(boolean useBs, boolean useBi, Map<Lod, List<Polygon>> availablePolygons,
Map<Lod, Set<Polygon>> existingPolygons, Building b) { Map<Lod, Set<Polygon>> existingPolygons, AbstractBuilding b) {
if (useBs) { if (useBs) {
collectPolygons(availablePolygons, b.getBoundarySurfaces()); collectPolygons(availablePolygons, b.getBoundarySurfaces());
} }
...@@ -603,18 +585,18 @@ public class HealerController { ...@@ -603,18 +585,18 @@ public class HealerController {
collectPolygons(availablePolygons, bi.getBoundarySurfaces()); collectPolygons(availablePolygons, bi.getBoundarySurfaces());
} }
} }
for (Geometry geom : b.getGeometries()) { // for (Geometry geom : b.getGeometries()) {
Set<Polygon> polygons = existingPolygons.computeIfAbsent(geom.getLod(), l -> new HashSet<>()); // Set<Polygon> polygons = existingPolygons.computeIfAbsent(geom.getLod(), l -> new HashSet<>());
polygons.addAll(geom.getPolygons()); // polygons.addAll(geom.getPolygons());
} // }
} }
private void insertSolidGeometry(Map<Lod, List<Polygon>> availablePolygons, Building b, private void insertSolidGeometry(Map<Lod, List<Polygon>> availablePolygons, AbstractBuilding b,
Map<Lod, Set<Polygon>> existingPolygons, Lod lod) { Map<Lod, Set<Polygon>> existingPolygons, Lod lod) {
List<Polygon> newPolygons = availablePolygons.get(lod); List<Polygon> newPolygons = availablePolygons.get(lod);
if (newPolygons != null) { if (newPolygons != null) {
// found polygons to be added // found polygons to be added
Geometry newGeometry = new Geometry(GeometryType.SOLID, lod); Geometry newGeometry = new Geometry(GeometryType.SOLID, lod, Orientation.OUTWARD);
Set<Polygon> polygons = existingPolygons.get(lod); Set<Polygon> polygons = existingPolygons.get(lod);
if (polygons != null) { if (polygons != null) {
// add existing polygons // add existing polygons
...@@ -688,9 +670,7 @@ public class HealerController { ...@@ -688,9 +670,7 @@ public class HealerController {
// triangle area is too small, ignore // triangle area is too small, ignore
return; return;
} }
for (Building b : model.getBuildings()) { model.getBuildings().forEach(building -> MeshGenerator.replaceGeometryWithMeshedGeometry(building, area));
MeshGenerator.replaceGeometryWithMeshedGeometry(b, area);
}
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// no real number was inserted, do nothing // no real number was inserted, do nothing
} }
......
...@@ -74,6 +74,7 @@ public class HealerToolbar { ...@@ -74,6 +74,7 @@ public class HealerToolbar {
saveBtn.setDisable(true); saveBtn.setDisable(true);
saveImage.setImage(new Image(MainWindow.class.getResourceAsStream("icons/save.png"))); saveImage.setImage(new Image(MainWindow.class.getResourceAsStream("icons/save.png")));
simplyBtn.setOnAction(ae -> controller.showSimplyfication()); simplyBtn.setOnAction(ae -> controller.showSimplyfication());
simplyBtn.setDisable(true);
} }
public HBox getToolBar() { public HBox getToolBar() {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configuration>
<Configuration status="INFO">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%-5level] %d{HH:mm:ss.SSS} %c{1} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="debug" additivity="false">
<AppenderRef ref="console" />
</Root>
<Logger name="com.zaxxer.hikari" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
</Loggers>
</Configuration>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.16.0</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorHealerGenetic</artifactId> <artifactId>CityDoctorHealerGenetic</artifactId>
......
...@@ -329,7 +329,7 @@ public class GeneticsGUI extends View { ...@@ -329,7 +329,7 @@ public class GeneticsGUI extends View {
parserConfig); parserConfig);
currentChecker = new Checker(model1); currentChecker = new Checker(model1);
currentChecker.runChecks(); currentChecker.runChecks();
Building building = model1.getBuildings().get(0); Building building = model1.getBuildings().findFirst().get();
currentGeometry = building.getGeometries().get(0); currentGeometry = building.getGeometries().get(0);
currentFeature = building; currentFeature = building;
showCurrentGeometry(); showCurrentGeometry();
......
...@@ -36,10 +36,8 @@ import java.util.Map.Entry; ...@@ -36,10 +36,8 @@ import java.util.Map.Entry;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import org.junit.Test;
import Jama.EigenvalueDecomposition; import Jama.EigenvalueDecomposition;
import de.hft.stuttgart.citydoctor2.check.AbstractCheck; import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.Checker; import de.hft.stuttgart.citydoctor2.check.Checker;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
...@@ -66,9 +64,9 @@ public class NonPlanarGenetic { ...@@ -66,9 +64,9 @@ public class NonPlanarGenetic {
private static final int ERROR_PENALTY = 100000; private static final int ERROR_PENALTY = 100000;
private Random r = new Random(); private Random r = new Random();
private Map<Integer, List<Long>> durationMap = new HashMap<>(); private Map<Integer, List<Long>> durationMap = new HashMap<>();
@Test //@Test
public void findVerticesForNonPlanarTest() throws CityGmlParseException, InvalidGmlFileException, IOException { public void findVerticesForNonPlanarTest() throws CityGmlParseException, InvalidGmlFileException, IOException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
config.setNumberOfRoundingPlacesInGlobalParameters(8); config.setNumberOfRoundingPlacesInGlobalParameters(8);
...@@ -448,7 +446,7 @@ public class NonPlanarGenetic { ...@@ -448,7 +446,7 @@ public class NonPlanarGenetic {
private Polygon findPolygonInFeature(CityObject copy, Polygon polygon) { private Polygon findPolygonInFeature(CityObject copy, Polygon polygon) {
Polygon[] result = new Polygon[1]; Polygon[] result = new Polygon[1];
copy.accept(new AbstractCheck() { copy.accept(new CheckableUtilsVisitor() {
@Override @Override
public void check(Polygon p) { public void check(Polygon p) {
......
localhost:5432:*:postgres:admin
\ No newline at end of file
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