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;
import java.util.ArrayList;
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.CityModel;
import org.junit.Rule;
......@@ -55,6 +57,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
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.healer.Healer;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
......@@ -69,13 +72,14 @@ public class HealMissingSolidTest {
@Test
public void testCreateSolid() throws CityDoctorWriteException, IOException, CityGmlParseException, InvalidGmlFileException {
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());
Building b = new Building();
model.addBuilding(b);
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);
ConcretePolygon p1 = new ConcretePolygon();
LinearRing ext1 = createTestRing();
......@@ -84,7 +88,7 @@ public class HealMissingSolidTest {
BoundarySurface bs1 = new BoundarySurface(mock(AbstractThematicSurface.class));
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);
ConcretePolygon p2 = new ConcretePolygon();
LinearRing ext2 = createTestRing();
......@@ -95,7 +99,7 @@ public class HealMissingSolidTest {
Installation bi = new Installation();
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);
ConcretePolygon p3 = new ConcretePolygon();
LinearRing ext3 = createTestRing();
......@@ -104,7 +108,7 @@ public class HealMissingSolidTest {
BoundarySurface bs2 = new BoundarySurface(mock(AbstractThematicSurface.class));
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);
ConcretePolygon p4 = new ConcretePolygon();
LinearRing ext4 = createTestRing();
......@@ -137,7 +141,7 @@ public class HealMissingSolidTest {
model.saveAs(createSolidFile.toString(), false);
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());
Geometry geometry2 = building.getGeometries().get(0);
assertEquals(GeometryType.SOLID, geometry2.getType());
......@@ -161,7 +165,7 @@ public class HealMissingSolidTest {
new RequirementConfiguration(false));
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/SimpleSolid_SrefBS_withoutSolid.gml",
config.getParserConfiguration());
Building b = model.getBuildings().get(0);
Building b = model.getBuildings().toList().get(0);
assertTrue(b.getGeometries().isEmpty());
Checker c = new Checker(config, model);
c.runChecks();
......
......@@ -25,11 +25,11 @@ public class HealNonManifoldEdgeErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import de.hft.stuttgart.citydoctor2.connect.edge.CppTest;
import org.junit.Assert;
import org.junit.Test;
......@@ -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.Polygon;
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.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealPlanarPolygonErrorTest {
......@@ -42,22 +45,22 @@ public class HealPlanarPolygonErrorTest {
Checker c = new Checker(config, model);
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));
Healer healer = new Healer(c);
healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_P_NON_PLANAR));
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon() {
CppInitializer.initCpp();
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);
Vertex v0 = new Vertex(0, 0, 0);
......@@ -159,10 +162,11 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split() {
CppInitializer.initCpp();
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);
Vertex v0 = new Vertex(0, 0, 0);
......@@ -273,10 +277,11 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category(CppTest.class)
public void testNonplanarPolygon_Split2() {
CppInitializer.initCpp();
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);
Vertex v0 = new Vertex(0, 0, 0);
......
......@@ -35,11 +35,11 @@ public class HealPolygonWithoutSurfaceTest {
Checker c = new Checker(config, model);
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));
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));
......@@ -49,7 +49,7 @@ public class HealPolygonWithoutSurfaceTest {
CityDoctorModel loadedModel = TestUtil.loadCityModel(outputFile.toString(), config);
c = new Checker(config, loadedModel);
c.runChecks();
building = loadedModel.getBuildings().get(0);
building = loadedModel.getBuildings().toList().get(0);
Assert.assertFalse(building.containsError(CheckId.C_SE_POLYGON_WITHOUT_SURFACE));
}
......
......@@ -41,11 +41,11 @@ public class HealPolygonWrongOrientationErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -25,11 +25,11 @@ public class HealRingNotClosedErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -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.Polygon;
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.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
......@@ -35,7 +36,7 @@ public class HealRingSelfIntErrorTest {
@Test
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();
geom.addPolygon(p);
......@@ -92,7 +93,7 @@ public class HealRingSelfIntErrorTest {
@Test
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();
geom.addPolygon(p);
......@@ -137,7 +138,7 @@ public class HealRingSelfIntErrorTest {
@Test
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();
geom.addPolygon(p);
......@@ -189,11 +190,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......@@ -207,11 +208,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......@@ -227,11 +228,11 @@ public class HealRingSelfIntErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -26,11 +26,11 @@ public class HealSameOrientationErrorTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
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.junit.Assert;
import org.junit.Test;
......@@ -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.Polygon;
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.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import org.junit.experimental.categories.Category;
public class HealSolidNotClosedErrorTest {
/**
* One polygon is split up in 3 but has not matching edges
*/
@Test
@Category(CppTest.class)
public void testVertexCloseToEdge() {
CppInitializer.initCpp();
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
b.addGeometry(geom); //Angelika: als Test eingefügt
......@@ -163,10 +170,11 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category(CppTest.class)
public void testMissingPolygon() {
CppInitializer.initCpp();
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);
Vertex v0 = new Vertex(0, 0, 0);
......@@ -255,7 +263,7 @@ public class HealSolidNotClosedErrorTest {
@Test
public void test2MissingPolygons() {
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);
Vertex v0 = new Vertex(0, 0, 0);
......@@ -342,10 +350,11 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category(CppTest.class)
public void test2MissingPolygonsCpp() {
CppInitializer.initCpp();
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);
Vertex v0 = new Vertex(0, 0, 0);
......@@ -420,6 +429,8 @@ public class HealSolidNotClosedErrorTest {
assertEquals(ResultStatus.OK, cr.getResultStatus());
}
/**
* Missing Polygon has a self intersection
* @throws IOException
......@@ -430,25 +441,23 @@ public class HealSolidNotClosedErrorTest {
*/
@Test
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-LR-0004-T0005.gml";
// String path = "src/test/resources/SimpleSolid_SrefBS.gml";
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
CityDoctorModel model = TestUtil.loadCityModel(path, config);
Checker c = new Checker(config, model);
c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0);
geom.updateVertices();
for (Vertex v : geom.getVertices()) {
v.setX(v.getX() - 10);
v.setY(v.getY() - 10);
}
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
Assert.assertTrue(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
Healer healer = new Healer(c);
//healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().get(0));
healer.setNumberOfIterations(2);
healer.healCityObject(model.getBuildings().toList().get(0));
Assert.assertFalse(geom.containsError(CheckId.C_GE_S_NOT_CLOSED));
}
......
......@@ -27,11 +27,11 @@ public class HealTooFewPointsTest {
Checker c = new Checker(config, model);
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));
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));
}
......
......@@ -45,7 +45,7 @@ public class TestHealer {
c.runChecks();
Building b = null;
for (Building building : model.getBuildings()) {
for (Building building : model.getBuildings().toList()) {
if (building.getGmlId().getGmlString().equals("DEBE08YYF0004KZs")) {
b = building;
break;
......@@ -125,8 +125,8 @@ public class TestHealer {
c.runChecks();
Healer healer = new Healer(c);
Geometry geom = model.getBuildings().get(0).getGeometries().get(0);
healer.healCityObject(model.getBuildings().get(0));
Geometry geom = model.getBuildings().toList().get(0).getGeometries().get(0);
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......@@ -150,15 +150,14 @@ public class TestHealer {
Checker c = new Checker(config, model);
c.runChecks();
Geometry geom = model.getBuildings().get(0).getGeometries().get(0);
Building b = model.getBuildings().toList().get(0);
Geometry geom = b.getGeometries().get(0);
Healer healer = new Healer(c);
healer.setNumberOfIterations(33);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(b);
c.runChecks();
assertFalse(geom.containsAnyError());
}
@Test
......@@ -171,10 +170,10 @@ public class TestHealer {
Checker c = new Checker(config, model);
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.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......@@ -190,11 +189,10 @@ public class TestHealer {
Checker c = new Checker(config, model);
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.setNumberOfIterations(83);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......@@ -210,11 +208,10 @@ public class TestHealer {
Checker c = new Checker(config, model);
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.setNumberOfIterations(165);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......@@ -241,7 +238,7 @@ public class TestHealer {
Checker c = new Checker(config, model);
c.runChecks();
Building b = model.getBuildings().get(0);
Building b = model.getBuildings().toList().get(0);
Healer healer = new Healer(c);
healer.healCityObject(b);
c.runChecks();
......@@ -261,11 +258,10 @@ public class TestHealer {
Checker c = new Checker(config, model);
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.setNumberOfIterations(45);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......@@ -282,7 +278,6 @@ public class TestHealer {
Healer healer = new Healer(c);
healer.setNumberOfIterations(45);
healer.healModel(model);
}
......@@ -297,10 +292,10 @@ public class TestHealer {
Checker c = new Checker(config, model);
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.setNumberOfIterations(100);
healer.healCityObject(model.getBuildings().get(0));
healer.healCityObject(model.getBuildings().toList().get(0));
c.runChecks();
assertFalse(geom.containsAnyError());
......
......@@ -31,22 +31,22 @@ public class TestUtil {
}
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) {
if (gmlId == null) {
return null;
}
Polygon result = getPolygonById(gmlId, model.getBuildings());
Polygon result = getPolygonById(gmlId, model.getBuildings().toList());
if (result != null) {
return result;
}
result = getPolygonById(gmlId, model.getVegetation());
result = getPolygonById(gmlId, model.getVegetation().toList());
if (result != null) {
return result;
}
return getPolygonById(gmlId, model.getTransportation());
return getPolygonById(gmlId, model.getTransportation().toList());
}
private static Polygon getPolygonById(String gmlId, List<? extends CityObject> features) {
......@@ -85,17 +85,17 @@ public class TestUtil {
if (featureId == null) {
return null;
}
for (CityObject co : model.getBuildings()) {
for (CityObject co : model.getBuildings().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) {
return co;
}
}
for (CityObject co : model.getTransportation()) {
for (CityObject co : model.getTransportation().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) {
return co;
}
}
for (CityObject co : model.getVegetation()) {
for (CityObject co : model.getVegetation().toList()) {
if (featureId.equals(co.getGmlId().getGmlString())) {
return co;
}
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.16.0</version>
<version>3.18.3</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CityDoctorHealerGUI</artifactId>
......@@ -22,10 +22,10 @@
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorHealer</artifactId>
</dependency>
<dependency>
<!-- <dependency>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorAutoPro</artifactId>
</dependency>
</dependency> -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
......
......@@ -2,35 +2,33 @@ package de.hft.stuttgart.citydoctor2.healer.gui;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.CheckError;
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.Requirement;
import de.hft.stuttgart.citydoctor2.check.RequirementType;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
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.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
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.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
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.ListErrorVisitor;
import de.hft.stuttgart.citydoctor2.gui.TriangulatedGeometry;
......@@ -85,10 +83,10 @@ public class HealerController {
if (model == null) {
return;
}
model.createFeatureStream().forEach(CityObject::prepareForChecking);
AutoProWindow window = new AutoProWindow(model);
window.setLocationRelativeTo(null);
window.setVisible(true);
// model.createFeatureStream().forEach(CityObject::prepareForChecking);
// AutoProWindow window = new AutoProWindow(model);
// window.setLocationRelativeTo(null);
// window.setVisible(true);
}
public void setCurrentModel(CityDoctorModel model) {
......@@ -537,22 +535,13 @@ public class HealerController {
}
public void injectSolid(boolean useBs, boolean useBi, boolean useLod2, boolean useLod3, boolean useLod4) {
if (model == null || currentFeature == null) {
return;
}
CityObject oldFeature = currentFeature;
currentFeature.prepareForChecking();
if (currentFeature instanceof BoundarySurface) {
BoundarySurface surface = (BoundarySurface) currentFeature;
currentFeature = surface.getParent();
}
if (!(currentFeature instanceof Building)) {
return;
}
// if (model == null || currentFeature == null) {
// return;
// }
model.getBuildings().forEach(b -> {
// collect polygons
Map<Lod, List<Polygon>> availablePolygons = new EnumMap<>(Lod.class);
Map<Lod, Set<Polygon>> existingPolygons = new EnumMap<>(Lod.class);
Building b = (Building) currentFeature;
collectPolygons(useBs, useBi, availablePolygons, existingPolygons, b);
if (useLod2) {
insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD2);
......@@ -563,34 +552,27 @@ public class HealerController {
if (useLod4) {
insertSolidGeometry(availablePolygons, b, existingPolygons, Lod.LOD4);
}
nextFeature = null;
nextGeometry = null;
Lod lod = currentGeometry.getLod();
GeometryType type = GeometryType.SOLID;
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());
for (BuildingPart part : b.getBuildingParts()) {
// collect polygons
availablePolygons = new EnumMap<>(Lod.class);
existingPolygons = new EnumMap<>(Lod.class);
collectPolygons(useBs, useBi, availablePolygons, existingPolygons, part);
if (useLod2) {
insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD2);
}
if (useLod3) {
insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD3);
}
if (useLod4) {
insertSolidGeometry(availablePolygons, part, existingPolygons, Lod.LOD4);
}
}
});
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,
Map<Lod, Set<Polygon>> existingPolygons, Building b) {
Map<Lod, Set<Polygon>> existingPolygons, AbstractBuilding b) {
if (useBs) {
collectPolygons(availablePolygons, b.getBoundarySurfaces());
}
......@@ -603,18 +585,18 @@ public class HealerController {
collectPolygons(availablePolygons, bi.getBoundarySurfaces());
}
}
for (Geometry geom : b.getGeometries()) {
Set<Polygon> polygons = existingPolygons.computeIfAbsent(geom.getLod(), l -> new HashSet<>());
polygons.addAll(geom.getPolygons());
}
// for (Geometry geom : b.getGeometries()) {
// Set<Polygon> polygons = existingPolygons.computeIfAbsent(geom.getLod(), l -> new HashSet<>());
// 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) {
List<Polygon> newPolygons = availablePolygons.get(lod);
if (newPolygons != null) {
// 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);
if (polygons != null) {
// add existing polygons
......@@ -688,9 +670,7 @@ public class HealerController {
// triangle area is too small, ignore
return;
}
for (Building b : model.getBuildings()) {
MeshGenerator.replaceGeometryWithMeshedGeometry(b, area);
}
model.getBuildings().forEach(building -> MeshGenerator.replaceGeometryWithMeshedGeometry(building, area));
} catch (NumberFormatException e) {
// no real number was inserted, do nothing
}
......
......@@ -74,6 +74,7 @@ public class HealerToolbar {
saveBtn.setDisable(true);
saveImage.setImage(new Image(MainWindow.class.getResourceAsStream("icons/save.png")));
simplyBtn.setOnAction(ae -> controller.showSimplyfication());
simplyBtn.setDisable(true);
}
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 @@
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.16.0</version>
<version>3.18.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CityDoctorHealerGenetic</artifactId>
......
......@@ -329,7 +329,7 @@ public class GeneticsGUI extends View {
parserConfig);
currentChecker = new Checker(model1);
currentChecker.runChecks();
Building building = model1.getBuildings().get(0);
Building building = model1.getBuildings().findFirst().get();
currentGeometry = building.getGeometries().get(0);
currentFeature = building;
showCurrentGeometry();
......
......@@ -36,10 +36,8 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import org.junit.Test;
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.Checker;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
......@@ -68,7 +66,7 @@ public class NonPlanarGenetic {
private Map<Integer, List<Long>> durationMap = new HashMap<>();
@Test
//@Test
public void findVerticesForNonPlanarTest() throws CityGmlParseException, InvalidGmlFileException, IOException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
config.setNumberOfRoundingPlacesInGlobalParameters(8);
......@@ -448,7 +446,7 @@ public class NonPlanarGenetic {
private Polygon findPolygonInFeature(CityObject copy, Polygon polygon) {
Polygon[] result = new Polygon[1];
copy.accept(new AbstractCheck() {
copy.accept(new CheckableUtilsVisitor() {
@Override
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