Commit b8bac3e6 authored by Luna Riegel's avatar Luna Riegel
Browse files

Merge branch 'dev' into 'master'

CityDoctor Version 3.18.2

See merge request !40
parents 947020ff 4b27a7e4
Pipeline #12385 passed with stage
in 2 minutes and 4 seconds
...@@ -24,16 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError; ...@@ -24,16 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException; import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException;
import de.hft.stuttgart.citydoctor2.checks.Checks; import de.hft.stuttgart.citydoctor2.checks.Checks;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel; import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.Tunnel;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
/** /**
* *
......
...@@ -285,7 +285,6 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -285,7 +285,6 @@ public class PdfStreamReporter implements StreamReporter {
tSection.setHeadlineColor(OK_COLOR); tSection.setHeadlineColor(OK_COLOR);
} }
writeErrorForCityObject(co, tSection); writeErrorForCityObject(co, tSection);
TransportationObject to = (TransportationObject) co;
} }
private void reportVegetation(CityObject co, boolean hasError) { private void reportVegetation(CityObject co, boolean hasError) {
...@@ -389,25 +388,6 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -389,25 +388,6 @@ public class PdfStreamReporter implements StreamReporter {
} }
} }
private void writeCheckResultForTransportationObject(TransportationObject to, Section root) {
Map<CheckId, CheckResult> results = to.getAllCheckResults();
writeCheckResults(results.values(), root);
for (Geometry geom : to.getGeometries()) {
writeCheckResultForGeometry(geom, root);
}
}
private void writeCheckResultForBuildingPart(BuildingPart bp, Section root) {
Map<CheckId, CheckResult> results = bp.getAllCheckResults();
writeCheckResults(results.values(), root);
for (Geometry geom : bp.getGeometries()) {
writeCheckResultForGeometry(geom, root);
}
for (BoundarySurface bs : bp.getBoundarySurfaces()) {
writeCheckResultForBoundarySurface(bs, root);
}
}
private void writeCheckResultForAbstractBuilding(AbstractBuilding ab, Section root) { private void writeCheckResultForAbstractBuilding(AbstractBuilding ab, Section root) {
Map<CheckId, CheckResult> results = ab.getAllCheckResults(); Map<CheckId, CheckResult> results = ab.getAllCheckResults();
writeCheckResults(results.values(), root); writeCheckResults(results.values(), root);
...@@ -714,24 +694,6 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -714,24 +694,6 @@ public class PdfStreamReporter implements StreamReporter {
report.save(outFile); report.save(outFile);
} }
private void countFinishedReportBuildings() {
for (Section s : buildings.getSubSections()) {
if (!s.hasErrors()) {
numOkBuildings++;
// building has no errors, no table
continue;
}
numErrorBuildings++;
Table t = new Table(2);
t.setTableColumnWidth(75, 25);
t.setTitle("Error", "Count");
for (Entry<String, AtomicInteger> e : s.getStats().getErrorCounts().entrySet()) {
t.addRow(e.getKey(), e.getValue().toString());
}
s.addTable(1, t);
}
}
@Override @Override
public void reportGlobalError(CheckError err) { public void reportGlobalError(CheckError err) {
AtomicInteger errorCount = errorStatistics.computeIfAbsent(err.getErrorId(), k -> new AtomicInteger(0)); AtomicInteger errorCount = errorStatistics.computeIfAbsent(err.getErrorId(), k -> new AtomicInteger(0));
......
...@@ -18,6 +18,22 @@ ...@@ -18,6 +18,22 @@
*/ */
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import de.hft.stuttgart.citydoctor2.CityDoctorValidation; import de.hft.stuttgart.citydoctor2.CityDoctorValidation;
import de.hft.stuttgart.citydoctor2.checkresult.CheckReport; import de.hft.stuttgart.citydoctor2.checkresult.CheckReport;
import de.hft.stuttgart.citydoctor2.checkresult.GlobalErrorStatistics; import de.hft.stuttgart.citydoctor2.checkresult.GlobalErrorStatistics;
...@@ -31,160 +47,165 @@ import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException; ...@@ -31,160 +47,165 @@ import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser; import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException; import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/** /**
* @author Matthias Betz * @author Matthias Betz
*/ */
public class CheckerTest { public class CheckerTest {
@Rule @Rule
public TemporaryFolder folder = new TemporaryFolder(); public TemporaryFolder folder = new TemporaryFolder();
@Test @Test
public void testSchematron() throws CityGmlParseException, InvalidGmlFileException { public void testSchematron() throws CityGmlParseException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig(); ValidationConfiguration config = ValidationConfiguration.loadStandardValidationConfig();
config.getRequirements().get(Requirement.R_SE_BS_ROOF_UNFRAGMENTED.toString()).setEnabled(false); config.getRequirements().get(Requirement.R_SE_BS_ROOF_UNFRAGMENTED.toString()).setEnabled(false);
config.setSchematronFilePathInGlobalParameters("src/test/resources/schematronTest.xml"); config.setSchematronFilePathInGlobalParameters("src/test/resources/schematronTest.xml");
CityDoctorModel model = CityGmlParser.parseCityGmlFile( CityDoctorModel model = CityGmlParser.parseCityGmlFile(
"src/test/resources/SimpleSolid_SrefBS_SchematronTest.gml", config.getParserConfiguration()); "src/test/resources/SimpleSolid_SrefBS_SchematronTest.gml", config.getParserConfiguration());
Checker checker = new Checker(config, model); Checker checker = new Checker(config, model);
checker.runChecks(); checker.runChecks();
for (Building b : model.getBuildings().toList()) { for (Building b : model.getBuildings().toList()) {
if (b.getGmlId().getGmlString().equals("_Simple_BD.1")) { if (b.getGmlId().getGmlString().equals("_Simple_BD.1")) {
assertTrue(b.containsAnyError()); assertTrue(b.containsAnyError());
} else { } else {
assertFalse(b.containsAnyError()); assertFalse(b.containsAnyError());
} }
} }
assertFalse(model.getGlobalErrors().isEmpty()); assertFalse(model.getGlobalErrors().isEmpty());
} }
@Test @Test
public void testChecker() throws CityGmlParseException, IOException, InvalidGmlFileException, CityDoctorWriteException { public void testChecker()
throws CityGmlParseException, IOException, InvalidGmlFileException, CityDoctorWriteException {
File f = folder.newFile();
File f2 = folder.newFile(); File f = folder.newFile();
try { File f2 = folder.newFile();
String[] args = new String[6]; try {
args[0] = "-in"; String[] args = new String[6];
args[1] = "src/test/resources/QA-CS-CONCOMP.gml"; args[0] = "-in";
args[2] = "-xmlReport"; args[1] = "src/test/resources/QA-CS-CONCOMP.gml";
args[3] = f.getAbsolutePath(); args[2] = "-xmlReport";
args[4] = "-pdfReport"; args[3] = f.getAbsolutePath();
args[5] = f2.getAbsolutePath(); args[4] = "-pdfReport";
CityDoctorValidation.main(args); args[5] = f2.getAbsolutePath();
assertTrue(f.exists()); CityDoctorValidation.main(args);
assertTrue(f2.exists()); assertTrue(f.exists());
} finally { assertTrue(f2.exists());
f.delete(); } finally {
f2.delete(); f.delete();
} f2.delete();
} }
}
@Test
public void testStreaming() throws CityGmlParseException, IOException, InvalidGmlFileException, CityDoctorWriteException { @Test
File f = folder.newFile(); public void testStreaming()
File f2 = folder.newFile(); throws CityGmlParseException, IOException, InvalidGmlFileException, CityDoctorWriteException {
File f3 = folder.newFile(); File f = folder.newFile();
try { File f2 = folder.newFile();
String[] args = new String[10]; File f3 = folder.newFile();
args[0] = "-in"; try {
args[1] = "src/test/resources/testarea.gml"; String[] args = new String[10];
args[2] = "-config"; args[0] = "-in";
args[3] = "src/test/resources/testConfigWithStreaming.yml"; args[1] = "src/test/resources/testarea.gml";
args[4] = "-pdfReport"; args[2] = "-config";
args[5] = f.getAbsolutePath(); args[3] = "src/test/resources/testConfigWithStreaming.yml";
args[6] = "-xmlReport"; args[4] = "-pdfReport";
args[7] = f2.getAbsolutePath(); args[5] = f.getAbsolutePath();
args[8] = "-out"; args[6] = "-xmlReport";
args[9] = f3.getAbsolutePath(); args[7] = f2.getAbsolutePath();
CityDoctorValidation.main(args); args[8] = "-out";
assertTrue(f.exists()); args[9] = f3.getAbsolutePath();
assertTrue(f2.exists()); CityDoctorValidation.main(args);
assertTrue(f3.exists()); assertTrue(f.exists());
} finally { assertTrue(f2.exists());
f.delete(); assertTrue(f3.exists());
f2.delete(); } finally {
f3.delete(); f.delete();
} f2.delete();
} f3.delete();
}
@Test }
public void testReportCreation() throws IOException, CityGmlParseException, InvalidGmlFileException {
Path tmpDir = null; @Test
try { public void testStreamingWithXMLValidation() throws CityGmlParseException, IOException, InvalidGmlFileException,
tmpDir = Files.createTempDirectory("testTmp"); CityDoctorWriteException, CheckReportParseException {
tmpDir.toFile().deleteOnExit(); File f2 = folder.newFile();
Path xmlPath = tmpDir.resolve("report.xml"); try {
Path pdfPath = tmpDir.resolve("report.pdf"); String[] args = new String[6];
File features = new File("src/test/resources/feature_types.gml"); args[0] = "-in";
CityDoctorModel model = CityGmlParser.nestedCityGmlFileParse( args[1] = "src/test/resources/SimpleSolid_SrefBS_XMLInvalid.gml";
features.toString(), new ParserConfiguration(8, false)); args[2] = "-config";
assertNotNull(model); args[3] = "src/test/resources/testConfigWithStreamingWithValidation.yml";
Checker checker = new Checker(model); args[4] = "-xmlReport";
checker.runChecks(); args[5] = f2.getAbsolutePath();
checker.writeXmlReport(xmlPath.toString()); CityDoctorValidation.main(args);
checker.writePdfReport(pdfPath.toString()); assertTrue(f2.exists());
assertTrue(Files.exists(xmlPath)); CheckReport checkReport = CheckReport.load(f2.toPath());
assertTrue(Files.exists(pdfPath)); assertEquals(1, checkReport.getValidationResults().getGlobalErrors().size());
try { } finally {
CheckReport report = CheckReport.load(xmlPath.toString()); f2.delete();
assertNotNull(report); }
}
GlobalStatistics globalStatistics = report.getGlobalStatistics();
assertNotNull(globalStatistics); @Test
public void testReportCreation() throws IOException, CityGmlParseException, InvalidGmlFileException {
ModelStatistics modelStats = globalStatistics.getModelStats(); Path tmpDir = null;
assertNotNull(modelStats); try {
assertEquals(1, modelStats.getNumBuildings()); tmpDir = Files.createTempDirectory("testTmp");
assertEquals(1, modelStats.getNumVegetation()); tmpDir.toFile().deleteOnExit();
assertEquals(1, modelStats.getNumTransportation()); Path xmlPath = tmpDir.resolve("report.xml");
assertEquals(1, modelStats.getNumTunnelObjects()); Path pdfPath = tmpDir.resolve("report.pdf");
assertEquals(1, modelStats.getNumBridgeObjects()); File features = new File("src/test/resources/feature_types.gml");
assertEquals(1, modelStats.getNumWaterObjects()); CityDoctorModel model = CityGmlParser.nestedCityGmlFileParse(features.toString(),
assertEquals(1, modelStats.getNumLandObjects()); new ParserConfiguration(8, false));
assertEquals(1, modelStats.getNumCityFurniture()); assertNotNull(model);
assertEquals(1, modelStats.getNumGenericCityObjects()); Checker checker = new Checker(model);
checker.runChecks();
GlobalErrorStatistics globError = globalStatistics.getGlobalErrorStats(); checker.writeXmlReport(xmlPath.toString());
assertNotNull(globError); checker.writePdfReport(pdfPath.toString());
assertEquals(0, globError.getNumErrorBuildings()); assertTrue(Files.exists(xmlPath));
assertEquals(0, globError.getNumErrorVegetation()); assertTrue(Files.exists(pdfPath));
assertEquals(0, globError.getNumErrorTransportation()); try {
assertEquals(0, globError.getNumErrorTunnelObjects()); CheckReport report = CheckReport.load(xmlPath.toString());
assertEquals(0, globError.getNumErrorBridgeObjects()); assertNotNull(report);
assertEquals(0, globError.getNumErrorWaterObjects());
assertEquals(0, globError.getNumErrorLandObjects()); GlobalStatistics globalStatistics = report.getGlobalStatistics();
assertEquals(1, globError.getNumErrorCityFurniture()); assertNotNull(globalStatistics);
assertEquals(1, globError.getNumErrorGenericCityObjects());
ModelStatistics modelStats = globalStatistics.getModelStats();
assertNotNull(modelStats);
} catch (CheckReportParseException e) { assertEquals(1, modelStats.getNumBuildings());
fail("Report should be valid file"); assertEquals(1, modelStats.getNumVegetation());
} assertEquals(1, modelStats.getNumTransportation());
assertEquals(1, modelStats.getNumTunnelObjects());
assertEquals(1, modelStats.getNumBridgeObjects());
} finally { assertEquals(1, modelStats.getNumWaterObjects());
if (tmpDir != null) { assertEquals(1, modelStats.getNumLandObjects());
FileUtils.deleteDirectory(tmpDir.toFile()); assertEquals(1, modelStats.getNumCityFurniture());
} assertEquals(1, modelStats.getNumGenericCityObjects());
}
} GlobalErrorStatistics globError = globalStatistics.getGlobalErrorStats();
assertNotNull(globError);
assertEquals(0, globError.getNumErrorBuildings());
assertEquals(0, globError.getNumErrorVegetation());
assertEquals(0, globError.getNumErrorTransportation());
assertEquals(0, globError.getNumErrorTunnelObjects());
assertEquals(0, globError.getNumErrorBridgeObjects());
assertEquals(0, globError.getNumErrorWaterObjects());
assertEquals(0, globError.getNumErrorLandObjects());
assertEquals(1, globError.getNumErrorCityFurniture());
assertEquals(1, globError.getNumErrorGenericCityObjects());
} catch (CheckReportParseException e) {
fail("Report should be valid file");
}
} finally {
if (tmpDir != null) {
FileUtils.deleteDirectory(tmpDir.toFile());
}
}
}
} }
...@@ -39,7 +39,7 @@ public class FilterTest { ...@@ -39,7 +39,7 @@ public class FilterTest {
@Test @Test
public void testFilterExclude() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testFilterExclude() throws CityGmlParseException, IOException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration ValidationConfiguration config = ValidationConfiguration
.loadValidationConfig("src/test/resources/testConfigWithExclude.yml"); .loadValidationConfigFile("src/test/resources/testConfigWithExclude.yml");
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/testarea.gml", CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/testarea.gml",
new ParserConfiguration(8, false)); new ParserConfiguration(8, false));
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
...@@ -59,7 +59,7 @@ public class FilterTest { ...@@ -59,7 +59,7 @@ public class FilterTest {
@Test @Test
public void testFilterInclude() throws CityGmlParseException, IOException, InvalidGmlFileException { public void testFilterInclude() throws CityGmlParseException, IOException, InvalidGmlFileException {
ValidationConfiguration config = ValidationConfiguration ValidationConfiguration config = ValidationConfiguration
.loadValidationConfig("src/test/resources/testConfigWithInclude.yml"); .loadValidationConfigFile("src/test/resources/testConfigWithInclude.yml");
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/testarea.gml", CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/testarea.gml",
new ParserConfiguration(8, false)); new ParserConfiguration(8, false));
Checker c = new Checker(config, model); Checker c = new Checker(config, model);
......
...@@ -37,7 +37,7 @@ public class ValidationConfigurationTest { ...@@ -37,7 +37,7 @@ public class ValidationConfigurationTest {
@Test @Test
public void testLoadingConfig() throws FileNotFoundException { public void testLoadingConfig() throws FileNotFoundException {
String file = "src/test/resources/testConfig.yml"; String file = "src/test/resources/testConfig.yml";
ValidationConfiguration config = ValidationConfiguration.loadValidationConfig(file); ValidationConfiguration config = ValidationConfiguration.loadValidationConfigFile(file);
assertEquals(8, config.getNumberOfRoundingPlaces()); assertEquals(8, config.getNumberOfRoundingPlaces());
assertTrue(config.getRequirements().containsKey(RequirementId.R_GE_R_TOO_FEW_POINTS.toString())); assertTrue(config.getRequirements().containsKey(RequirementId.R_GE_R_TOO_FEW_POINTS.toString()));
assertFalse(config.getRequirements().get(RequirementId.R_GE_P_NON_PLANAR.toString()).isEnabled()); assertFalse(config.getRequirements().get(RequirementId.R_GE_P_NON_PLANAR.toString()).isEnabled());
...@@ -47,7 +47,7 @@ public class ValidationConfigurationTest { ...@@ -47,7 +47,7 @@ public class ValidationConfigurationTest {
@Test @Test
public void testLoadingConfigWithFilter() throws FileNotFoundException { public void testLoadingConfigWithFilter() throws FileNotFoundException {
String file = "src/test/resources/testConfigWithFilter.yml"; String file = "src/test/resources/testConfigWithFilter.yml";
ValidationConfiguration config = ValidationConfiguration.loadValidationConfig(file); ValidationConfiguration config = ValidationConfiguration.loadValidationConfigFile(file);
assertEquals(8, config.getNumberOfRoundingPlaces()); assertEquals(8, config.getNumberOfRoundingPlaces());
assertTrue(config.getRequirements().containsKey(RequirementId.R_GE_R_TOO_FEW_POINTS.toString())); assertTrue(config.getRequirements().containsKey(RequirementId.R_GE_R_TOO_FEW_POINTS.toString()));
assertFalse(config.getRequirements().get(RequirementId.R_GE_P_NON_PLANAR.toString()).isEnabled()); assertFalse(config.getRequirements().get(RequirementId.R_GE_P_NON_PLANAR.toString()).isEnabled());
...@@ -76,7 +76,7 @@ public class ValidationConfigurationTest { ...@@ -76,7 +76,7 @@ public class ValidationConfigurationTest {
String file = "src/test/resources/testConfigVulnerability.yml"; String file = "src/test/resources/testConfigVulnerability.yml";
ValidationConfiguration config = null; ValidationConfiguration config = null;
try { try {
config = ValidationConfiguration.loadValidationConfig(file); config = ValidationConfiguration.loadValidationConfigFile(file);
assertNotNull(config); assertNotNull(config);
fail("Config with Vulnerability should not be successfully loaded"); fail("Config with Vulnerability should not be successfully loaded");
} catch (FileNotFoundException e){ } catch (FileNotFoundException e){
......
...@@ -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);
......
<?xml version="1.0" encoding="utf-8"?>
<core:CityModel xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd">
<!--
Einfaches Gebäude mit Grundriss 3m x 5m und Satteldach, Traufhöhe 3m, Firsthöhe 4,5m
Modelliert mit Begrenzungsflächen (eine Dachfläche, 4 Wandflächen, 1 Grundfläche),
die Gebäudegeometrie als Solid, der auf die Polygone der Begrenzungsflächen referenziert.
Fehler in der Reihenfolge der Attribute.
CityGML 2.0
Gebäudevolumen: 56,25 m3
12.12.2025
Author: V. Coors, HFT Stuttgart
Lizenz:
-->
<core:cityObjectMember>
<bldg:Building gml:id="_Simple_BD.1">
<gen:stringAttribute name="averageStoreyHeight">
<gen:value>2.5</gen:value>
</gen:stringAttribute>
<gml:name>falsche Reihenfolge</gml:name>
<bldg:lod2Solid>
<gml:Solid>
<gml:exterior>
<gml:CompositeSurface>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.1"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.2"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.3"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.4"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.5"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.6"/>
<gml:surfaceMember xlink:href="#_Simple_BD.1_PG.7"/>
</gml:CompositeSurface>
</gml:exterior>
</gml:Solid>
</bldg:lod2Solid>
<bldg:boundedBy>
<bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_1">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.2">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.2_LR.1">
<gml:posList srsDimension="3">
13.0 15.0 0.0
13.0 15.0 3.0
13.0 10.0 3.0
13.0 10.0 0.0
13.0 15.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_2">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.3">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.3_LR.1">
<gml:posList srsDimension="3">
10.0 15.0 0.0
10.0 15.0 3.0
11.5 15.0 4.5
13.0 15.0 3.0
13.0 15.0 0.0
10.0 15.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_3">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.4">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.4_LR.1">
<gml:posList srsDimension="3">
10.0 10.0 3.0
10.0 15.0 3.0
10.0 15.0 0.0
10.0 10.0 0.0
10.0 10.0 3.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_4">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.5">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.5_LR.1">
<gml:posList srsDimension="3">
13.0 10.0 0.0
13.0 10.0 3.0
11.5 10.0 4.5
10.0 10.0 3.0
10.0 10.0 0.0
13.0 10.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:RoofSurface gml:id="_Simple_BD.1_RoofSurface_1">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.6">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.6_LR.1">
<gml:posList srsDimension="3">
10.0 10.0 3.0
11.5 10.0 4.5
11.5 15.0 4.5
10.0 15.0 3.0
10.0 10.0 3.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.7">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.7_LR.1">
<gml:posList srsDimension="3">
11.5 10.0 4.5
13.0 10.0 3.0
13.0 15.0 3.0
11.5 15.0 4.5
11.5 10.0 4.5
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:RoofSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:GroundSurface gml:id="_Simple_BD.1_GroundSurface_1">
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="_Simple_BD.1_PG.1">
<gml:exterior>
<gml:LinearRing gml:id="_Simple_BD.1_PG.1_LR.1">
<gml:posList srsDimension="3">
10.0 10.0 0.0
10.0 15.0 0.0
13.0 15.0 0.0
13.0 10.0 0.0
10.0 10.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:GroundSurface>
</bldg:boundedBy>
</bldg:Building>
</core:cityObjectMember>
</core:CityModel>
\ No newline at end of file
globalParameters:
numberOfRoundingPlaces: 8
schematronFilePath: src/test/resources/schematronTest.xml
useStreaming: true
xmlValidation: true
requirements:
R_GE_R_TOO_FEW_POINTS:
enabled: true
R_GE_R_NOT_CLOSED:
enabled: true
R_GE_R_CONSECUTIVE_POINTS_SAME:
enabled: true
R_GE_R_SELF_INTERSECTION:
enabled: true
R_GE_S_MULTIPLE_CONNECTED_COMPONENTS:
enabled: true
R_GE_P_INTERIOR_DISCONNECTED:
enabled: true
R_GE_P_INTERSECTING_RINGS:
enabled: true
R_GE_P_NON_PLANAR:
enabled: false
parameters:
# one of ("distance", "angle", "both")
type: distance
distanceTolerance: 0.01
angleTolerance: 0.1
R_GE_P_HOLE_OUTSIDE:
enabled: true
R_GE_P_ORIENTATION_RINGS_SAME:
enabled: true
R_GE_P_INNER_RINGS_NESTED:
enabled: true
R_GE_S_TOO_FEW_POLYGONS:
enabled: true
R_GE_S_NOT_CLOSED:
enabled: true
R_GE_S_NON_MANIFOLD_EDGE:
enabled: true
R_GE_S_POLYGON_WRONG_ORIENTATION:
enabled: true
R_GE_S_ALL_POLYGONS_WRONG_ORIENTATION:
enabled: true
R_GE_S_NON_MANIFOLD_VERTEX:
enabled: true
R_GE_S_SELF_INTERSECTION:
enabled: true
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorAutoPro</artifactId> <artifactId>CityDoctorAutoPro</artifactId>
......
...@@ -362,7 +362,7 @@ public class AutoProWindow extends JDialog implements ItemListener { ...@@ -362,7 +362,7 @@ public class AutoProWindow extends JDialog implements ItemListener {
*/ */
private void startCppAutoProMethods() throws FileNotFoundException { private void startCppAutoProMethods() throws FileNotFoundException {
List<Building> buildings = this.model.getBuildings(); List<Building> buildings = this.model.getBuildings().toList();
List<Geometry> geometryList = getAllGeometriesOfSelectedBuildings(buildings); List<Geometry> geometryList = getAllGeometriesOfSelectedBuildings(buildings);
setBuildingsToOrigin(geometryList); setBuildingsToOrigin(geometryList);
...@@ -525,12 +525,12 @@ public class AutoProWindow extends JDialog implements ItemListener { ...@@ -525,12 +525,12 @@ public class AutoProWindow extends JDialog implements ItemListener {
Building building = part.getParent(); Building building = part.getParent();
building.getBuildingParts().remove(part); building.getBuildingParts().remove(part);
if (building.getBuildingParts().isEmpty() && building.getGeometries().isEmpty()) { if (building.getBuildingParts().isEmpty() && building.getGeometries().isEmpty()) {
model.getBuildings().remove(building); model.getBuildings().toList().remove(building);
} }
} else if (parent instanceof Building && parent.getGeometries().isEmpty()) { } else if (parent instanceof Building && parent.getGeometries().isEmpty()) {
Building building = (Building) parent; Building building = (Building) parent;
if (building.getBuildingParts().isEmpty()) { if (building.getBuildingParts().isEmpty()) {
model.getBuildings().remove(building); model.getBuildings().toList().remove(building);
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.18.1</version> <version>3.18.2</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<artifactId>CityDoctorGUI</artifactId> <artifactId>CityDoctorGUI</artifactId>
......
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Path; import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
...@@ -11,14 +13,12 @@ import java.util.List; ...@@ -11,14 +13,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import de.hft.stuttgart.citydoctor2.parser.ProgressListener;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox; import javafx.scene.control.ButtonType;
import javafx.scene.control.ProgressIndicator; import javafx.scene.control.Hyperlink;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.stage.DirectoryChooser; import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -32,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.check.Unit; ...@@ -32,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.check.Unit;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.checks.Checks; import de.hft.stuttgart.citydoctor2.checks.Checks;
import de.hft.stuttgart.citydoctor2.gui.tree.TreeRequirement; import de.hft.stuttgart.citydoctor2.gui.tree.TreeRequirement;
import de.hft.stuttgart.citydoctor2.parser.ProgressListener;
import de.hft.stuttgart.citydoctor2.utils.Localization; import de.hft.stuttgart.citydoctor2.utils.Localization;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.event.Event; import javafx.event.Event;
...@@ -39,6 +40,7 @@ import javafx.fxml.FXML; ...@@ -39,6 +40,7 @@ import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar; import javafx.scene.control.ProgressBar;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
...@@ -119,6 +121,18 @@ public class CheckDialog { ...@@ -119,6 +121,18 @@ public class CheckDialog {
@FXML @FXML
private Button selectBtn; private Button selectBtn;
@FXML
private Button selectAllGCBtn;
@FXML
private Button selectNoneGCBtn;
@FXML
private Button selectAllSCBtn;
@FXML
private Button selectNoneSCBtn;
@FXML @FXML
private TextField schematronField; private TextField schematronField;
...@@ -140,6 +154,12 @@ public class CheckDialog { ...@@ -140,6 +154,12 @@ public class CheckDialog {
@FXML @FXML
private Label schematronFileLabel; private Label schematronFileLabel;
@FXML
private Label checkDescriptionsLabel;
@FXML
private Hyperlink homepageHyperlink;
@FXML @FXML
private CheckBox streamCheckOption; private CheckBox streamCheckOption;
@FXML @FXML
...@@ -160,6 +180,7 @@ public class CheckDialog { ...@@ -160,6 +180,7 @@ public class CheckDialog {
private CityDoctorController controller; private CityDoctorController controller;
private FilterPane filterPane; private FilterPane filterPane;
private MainWindow window; private MainWindow window;
private IndeterminateSpinnerDialog waitingDialog;
public CheckDialog(MainWindow window, Window parent, CityDoctorController controller) throws IOException { public CheckDialog(MainWindow window, Window parent, CityDoctorController controller) throws IOException {
this.window = window; this.window = window;
...@@ -197,9 +218,15 @@ public class CheckDialog { ...@@ -197,9 +218,15 @@ public class CheckDialog {
geometricChecksLabel.setText(Localization.getText("CheckDialog.geometricChecksLabel")); geometricChecksLabel.setText(Localization.getText("CheckDialog.geometricChecksLabel"));
semanticChecksLabel.setText(Localization.getText("CheckDialog.semanticChecksLabel")); semanticChecksLabel.setText(Localization.getText("CheckDialog.semanticChecksLabel"));
schematronFileLabel.setText(Localization.getText("CheckDialog.schematronFileLabel")); schematronFileLabel.setText(Localization.getText("CheckDialog.schematronFileLabel"));
checkDescriptionsLabel.setText(Localization.getText("CheckDialog.checkDescriptionsLabel"));
homepageHyperlink.setText(Localization.getText("CheckDialog.clickHereToOpen"));
selectBtn.setText(Localization.getText("CheckDialog.selectBtn")); selectBtn.setText(Localization.getText("CheckDialog.selectBtn"));
checkBtn.setText(Localization.getText("CheckDialog.checkBtn")); checkBtn.setText(Localization.getText("CheckDialog.checkBtn"));
cancelBtn.setText(Localization.getText("CheckDialog.cancelBtn")); cancelBtn.setText(Localization.getText("CheckDialog.cancelBtn"));
selectAllGCBtn.setText(Localization.getText("CheckDialog.selectAllChecksBtn"));
selectNoneGCBtn.setText(Localization.getText("CheckDialog.unselectAllChecksBtn"));
selectAllSCBtn.setText(Localization.getText("CheckDialog.selectAllChecksBtn"));
selectNoneSCBtn.setText(Localization.getText("CheckDialog.unselectAllChecksBtn"));
List<TableColumn<GlobalParameter, ?>> columns = globalParametersTable.getColumns(); List<TableColumn<GlobalParameter, ?>> columns = globalParametersTable.getColumns();
TableColumn<GlobalParameter, String> nameCol = new TableColumn<>(NAME); TableColumn<GlobalParameter, String> nameCol = new TableColumn<>(NAME);
...@@ -256,7 +283,60 @@ public class CheckDialog { ...@@ -256,7 +283,60 @@ public class CheckDialog {
}); });
schematronField.setText(ValidationConfiguration.CHECK_FOR_SOLID_XML); schematronField.setText(ValidationConfiguration.CHECK_FOR_SOLID_XML);
}
String configString = Settings.get(Settings.CONFIG);
if (configString != null) {
try {
applyConfig(ValidationConfiguration.loadValidationConfigFromString(configString));
} catch (IOException e) {
// failed to read config, ignore as default values are still available
}
}
selectAllGCBtn.setOnAction(ae ->
geometricTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(true)));
selectNoneGCBtn.setOnAction(ae ->
geometricTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(false)));
selectAllSCBtn.setOnAction(ae ->
semanticTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(true)));
selectNoneSCBtn.setOnAction(ae ->
semanticTable.getRoot().getChildren().forEach(item -> item.getValue().setEnabled(false)));
try {
homepageHyperlink.setTooltip(new Tooltip(Localization.getText("CheckDialog.homepageHyperlink")));
final URI hpUrl = new URI(Localization.getText("CheckDialog.homepageHyperlink"));
homepageHyperlink.setOnAction(event -> {
try {
Desktop.getDesktop().browse(hpUrl);
} catch (IOException e) {
homepageHyperlink.setText("[Hyperlink blocked]");
Alert alert = new Alert(Alert.AlertType.ERROR,
"Opening of hyperlink was blocked by the system, URL has been copied to Clipboard",
ButtonType.OK);
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent content = new ClipboardContent();
content.putString(hpUrl.toString());
cb.setContent(content);
alert.showAndWait();
}
});
} catch (URISyntaxException e) {
//Should never actually occur
homepageHyperlink.setText("[Hyperlink missing/invalid]");
}
try{
waitingDialog = new IndeterminateSpinnerDialog(window.getMainStage(),"Schematron still running, please wait");
} catch (IOException e) {
logger.error("Failed to load IndeterminateSpinnerDialog");
}
}
private void setupValueColumns(List<TableColumn<GlobalParameter, ?>> columns) { private void setupValueColumns(List<TableColumn<GlobalParameter, ?>> columns) {
TableColumn<GlobalParameter, String> valueCol = new TableColumn<>(VALUE); TableColumn<GlobalParameter, String> valueCol = new TableColumn<>(VALUE);
...@@ -319,7 +399,7 @@ public class CheckDialog { ...@@ -319,7 +399,7 @@ public class CheckDialog {
if (f != null) { if (f != null) {
Settings.set(Settings.LAST_OPEN_FOLDER, f.getParent()); Settings.set(Settings.LAST_OPEN_FOLDER, f.getParent());
try { try {
ValidationConfiguration config = ValidationConfiguration.loadValidationConfig(f.getAbsolutePath()); ValidationConfiguration config = ValidationConfiguration.loadValidationConfigFile(f.getAbsolutePath());
applyConfig(config); applyConfig(config);
} catch (IOException e) { } catch (IOException e) {
window.showExceptionDialog(e); window.showExceptionDialog(e);
...@@ -440,9 +520,15 @@ public class CheckDialog { ...@@ -440,9 +520,15 @@ public class CheckDialog {
private void setupCheckButton() { private void setupCheckButton() {
checkBtn.setOnAction(ea -> { checkBtn.setOnAction(ea -> {
ValidationConfiguration config = createConfig();
checkBtn.setDisable(true); checkBtn.setDisable(true);
cancelBtn.setDisable(true); cancelBtn.setDisable(true);
ValidationConfiguration config = createConfig();
try {
String configString = config.saveAsString();
Settings.set(Settings.CONFIG, configString);
} catch (IOException e) {
// failed to save config, ignore
}
stage.setOnCloseRequest(Event::consume); stage.setOnCloseRequest(Event::consume);
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
...@@ -454,7 +540,12 @@ public class CheckDialog { ...@@ -454,7 +540,12 @@ public class CheckDialog {
ProgressListener l = new ProgressListener() { ProgressListener l = new ProgressListener() {
@Override @Override
public void updateProgress(float state) { public void updateProgress(float state) {
Platform.runLater(() -> progress.setProgress(state)); Platform.runLater(() -> {
progress.setProgress(state);
if (state < 0 ){
waitingDialog.show();
}
});
} }
}; };
controller.startChecks(config, l); controller.startChecks(config, l);
...@@ -476,6 +567,7 @@ public class CheckDialog { ...@@ -476,6 +567,7 @@ public class CheckDialog {
Platform.runLater(() -> { Platform.runLater(() -> {
checkBtn.setDisable(false); checkBtn.setDisable(false);
cancelBtn.setDisable(false); cancelBtn.setDisable(false);
waitingDialog.hide();
stage.setOnCloseRequest(null); stage.setOnCloseRequest(null);
stage.close(); stage.close();
}); });
......
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.CityModel;
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.ErrorId; import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.check.error.SchematronError;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache; import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import de.hft.stuttgart.citydoctor2.datastructure.*; import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractRoom;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeConstructiveElement;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingUnit;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.FeatureType;
import de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.Storey;
import de.hft.stuttgart.citydoctor2.datastructure.TopLevelTransportFeature;
import de.hft.stuttgart.citydoctor2.datastructure.TrafficAreaObject;
import de.hft.stuttgart.citydoctor2.datastructure.TrafficSpaceObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportSection;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationSpace;
import de.hft.stuttgart.citydoctor2.datastructure.Tunnel;
import de.hft.stuttgart.citydoctor2.datastructure.TunnelConstructiveElement;
import de.hft.stuttgart.citydoctor2.datastructure.TunnelPart;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException; import de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException;
import de.hft.stuttgart.citydoctor2.gui.table.ErrorStat; import de.hft.stuttgart.citydoctor2.gui.table.ErrorStat;
import de.hft.stuttgart.citydoctor2.gui.tree.*; import de.hft.stuttgart.citydoctor2.gui.tree.AddMoreButtonRunnable;
import de.hft.stuttgart.citydoctor2.gui.tree.ButtonRenderable;
import de.hft.stuttgart.citydoctor2.gui.tree.Renderable;
import de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectGroupNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectGroupNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.GeometryNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.GeometryNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.OpeningNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.OpeningNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.TopLevelCityObjectNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.TopLevelCityObjectNode;
import de.hft.stuttgart.citydoctor2.mapper.citygml3.GMLValidationHandler; import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.*; import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.parser.ProgressListener;
import de.hft.stuttgart.citydoctor2.utils.Localization; import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.quality.adapter.types.ErrorAdapter;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.chart.XYChart.Data; import javafx.scene.chart.XYChart.Data;
import javafx.scene.chart.XYChart.Series; import javafx.scene.chart.XYChart.Series;
...@@ -29,18 +81,6 @@ import javafx.scene.control.TreeView; ...@@ -29,18 +81,6 @@ import javafx.scene.control.TreeView;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.FileChooser.ExtensionFilter; import javafx.stage.FileChooser.ExtensionFilter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.CityModel;
import org.xml.sax.SAXParseException;
import java.io.File;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
public class CityDoctorController { public class CityDoctorController {
...@@ -98,40 +138,14 @@ public class CityDoctorController { ...@@ -98,40 +138,14 @@ public class CityDoctorController {
}); });
currentChecker = null; currentChecker = null;
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory); currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory);
GMLValidationHandler handler = null; model = CityGmlParser.parseCityGmlFile(path, currentConfig, l);
List<String> validationIssues = new ArrayList<>();
if (useValidation) {
handler = new GMLValidationHandler() {
@Override
public void error(SAXParseException exception) {
if (exception.getLineNumber() >= 0) {
String s = "In line " + exception.getLineNumber() + ":";
validationIssues.add(s);
}
validationIssues.add(exception.getMessage());
}
@Override
public void warning(SAXParseException exception) {
error(exception);
}
@Override
public void fatalError(SAXParseException exception) {
error(exception);
}
};
}
model = CityGmlParser.parseCityGmlFile(path, currentConfig, l, handler);
if (!validationIssues.isEmpty()) {
StringJoiner sj = new StringJoiner("\n");
validationIssues.stream().forEach(sj::add);
throw new InvalidGmlFileException(sj.toString());
}
mainWindow.getClickHandler().setConfig(currentConfig); mainWindow.getClickHandler().setConfig(currentConfig);
sourceFile = path; sourceFile = path;
renderer.reset(); renderer.reset();
Platform.runLater(() -> { Platform.runLater(() -> {
// show errors that occured during parsing
updateGlobalErrors();
mainWindow.addFileNameToTitle(path); mainWindow.addFileNameToTitle(path);
mainWindow.getCheckButton().setDisable(false); mainWindow.getCheckButton().setDisable(false);
mainWindow.getLod1Btn().setDisable(false); mainWindow.getLod1Btn().setDisable(false);
...@@ -1099,6 +1113,11 @@ public class CityDoctorController { ...@@ -1099,6 +1113,11 @@ public class CityDoctorController {
for (CheckError e : model.getGlobalErrors()) { for (CheckError e : model.getGlobalErrors()) {
e.accept(globErrVisitor); e.accept(globErrVisitor);
} }
if (model.getGlobalErrors().isEmpty()) {
mainWindow.getGlobalErrorsLabel().setStyle("-fx-text-fill: black;");
} else {
mainWindow.getGlobalErrorsLabel().setStyle("-fx-text-fill: red;");
}
} }
void updateFeatureTrees() { void updateFeatureTrees() {
...@@ -1233,6 +1252,7 @@ public class CityDoctorController { ...@@ -1233,6 +1252,7 @@ public class CityDoctorController {
case LAND -> filterLandTree(searchString); case LAND -> filterLandTree(searchString);
case CITY_FURNITURE -> filterCityFurnitureTree(searchString); case CITY_FURNITURE -> filterCityFurnitureTree(searchString);
case OTHER_CITY_OBJECT -> filterOtherCityObjectsTree(searchString); case OTHER_CITY_OBJECT -> filterOtherCityObjectsTree(searchString);
default -> throw new IllegalArgumentException("selected tab is unknown: " + selectedTab);
} }
...@@ -1359,7 +1379,9 @@ public class CityDoctorController { ...@@ -1359,7 +1379,9 @@ public class CityDoctorController {
if (model == null) { if (model == null) {
return; return;
} }
buildTrees(); mainWindow.rebuildErrorFilterTrees();
// buildTrees();
} }
public Series<String, Number> createErrorSeries() { public Series<String, Number> createErrorSeries() {
...@@ -1394,7 +1416,8 @@ public class CityDoctorController { ...@@ -1394,7 +1416,8 @@ public class CityDoctorController {
List<GmlId> idList = model.getBuildingIds(); List<GmlId> idList = model.getBuildingIds();
foundBuildings.removeIf(gmlId -> (!idList.contains(gmlId))); foundBuildings.removeIf(gmlId -> (!idList.contains(gmlId)));
Supplier<Stream<Building>> supply = () -> model.getCache().getStream(foundBuildings).map(co -> (Building) co); //Supplier<Stream<Building>> supply = () -> model.getCache().getStream(foundBuildings).map(co -> (Building) co);
Supplier<Stream<Building>> supply = () -> model.getCache().getAll(foundBuildings).stream().map(co -> (Building) co);
buildBuildingTreeFromList(supply, root); buildBuildingTreeFromList(supply, root);
updateTree(root); updateTree(root);
addMoreButtonForBuildings(buildingsView, root, buildingChunkNr, supply, foundBuildings.size()); addMoreButtonForBuildings(buildingsView, root, buildingChunkNr, supply, foundBuildings.size());
...@@ -1639,6 +1662,8 @@ public class CityDoctorController { ...@@ -1639,6 +1662,8 @@ public class CityDoctorController {
public void errorFilterIndexChanged(Number newV) { public void errorFilterIndexChanged(Number newV) {
mainWindow.getMeshGroup().getChildren().clear(); mainWindow.getMeshGroup().getChildren().clear();
mainWindow.unselectEverything(); mainWindow.unselectEverything();
mainWindow.resetSearchBar();
renderer.clearCurrentRender();
if (newV.intValue() == 0) { // Error filter was set to "All" if (newV.intValue() == 0) { // Error filter was set to "All"
buildTrees(); buildTrees();
updateFeatureTrees(); updateFeatureTrees();
......
...@@ -42,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError; ...@@ -42,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError;
import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError; import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError;
import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError; import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError;
import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError; import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
import de.hft.stuttgart.citydoctor2.check.error.XMLValidationError;
public class GlobalErrorVisitor implements ErrorVisitor { public class GlobalErrorVisitor implements ErrorVisitor {
...@@ -221,5 +222,11 @@ public class GlobalErrorVisitor implements ErrorVisitor { ...@@ -221,5 +222,11 @@ public class GlobalErrorVisitor implements ErrorVisitor {
@Override @Override
public void visit(SolidError err) { public void visit(SolidError err) {
} }
@Override
public void visit(XMLValidationError err) {
mainWindow.getGlobalErrorsView().getItems().add(err.getErrorId().getIdString()
+ " - " + err.getMessage());
}
} }
package de.hft.stuttgart.citydoctor2.gui;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import java.io.IOException;
public class IndeterminateSpinnerDialog {
private Stage stage;
@FXML
private Label messageLbl;
public IndeterminateSpinnerDialog(Window parent, String message) throws IOException {
FXMLLoader loader = new FXMLLoader(LoadingInfoDialog.class.getResource("IndeterminateSpinnerDialog.fxml"));
loader.setController(this);
VBox box = loader.load();
stage = new Stage(StageStyle.UNDECORATED);
Scene scene = new Scene(box);
scene.setFill(null);
stage.setScene(scene);
stage.initOwner(parent);
stage.initModality(Modality.APPLICATION_MODAL);
messageLbl.setText(message);
}
public void changeMessage(String message){
messageLbl.setText(message);
}
public void show() {
stage.show();
}
public void hide() {
stage.hide();
}
}
...@@ -45,6 +45,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError; ...@@ -45,6 +45,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError;
import de.hft.stuttgart.citydoctor2.check.error.DegeneratedRingError; import de.hft.stuttgart.citydoctor2.check.error.DegeneratedRingError;
import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError; import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError;
import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError; import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
import de.hft.stuttgart.citydoctor2.check.error.XMLValidationError;
import de.hft.stuttgart.citydoctor2.datastructure.Edge; import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
...@@ -295,4 +296,9 @@ public class ListErrorVisitor implements ErrorVisitor { ...@@ -295,4 +296,9 @@ public class ListErrorVisitor implements ErrorVisitor {
public void visit(SolidError err) { public void visit(SolidError err) {
// nothing to display // nothing to display
} }
@Override
public void visit(XMLValidationError err) {
// nothing to display
}
} }
...@@ -208,6 +208,8 @@ public class MainWindow extends Application { ...@@ -208,6 +208,8 @@ public class MainWindow extends Application {
@FXML @FXML
private Label availableLabel; private Label availableLabel;
private Label globalErrorsLabel;
private Image north; private Image north;
private Image northFlip; private Image northFlip;
...@@ -310,9 +312,6 @@ public class MainWindow extends Application { ...@@ -310,9 +312,6 @@ public class MainWindow extends Application {
ViewRegistration.registerView(valView); ViewRegistration.registerView(valView);
setupViews(valView); setupViews(valView);
createLanguageSelector();
setLabelsInCorrectLanguage();
Scene scene = new Scene(bp, 1280, 800); Scene scene = new Scene(bp, 1280, 800);
createDropTarget(scene, valView); createDropTarget(scene, valView);
String version = Localization.getText(Localization.VERSION); String version = Localization.getText(Localization.VERSION);
...@@ -544,6 +543,9 @@ public class MainWindow extends Application { ...@@ -544,6 +543,9 @@ public class MainWindow extends Application {
setupSearchButtons(); setupSearchButtons();
setupShowCityComboBox(); setupShowCityComboBox();
createLanguageSelector();
setLabelsInCorrectLanguage();
detailsTabPane.getSelectionModel().selectedIndexProperty() detailsTabPane.getSelectionModel().selectedIndexProperty()
.addListener((ov, oldI, newI) -> Platform.runLater(() -> { .addListener((ov, oldI, newI) -> Platform.runLater(() -> {
...@@ -553,6 +555,11 @@ public class MainWindow extends Application { ...@@ -553,6 +555,11 @@ public class MainWindow extends Application {
errorView.getSelectionModel().getSelectedItem().getValue().visit(renderer); errorView.getSelectionModel().getSelectedItem().getValue().visit(renderer);
} }
})); }));
// setup label of the global error tab for color changes
globalErrorsLabel = new Label(globalErrorsTab.getText());
globalErrorsTab.setGraphic(globalErrorsLabel);
globalErrorsTab.setText("");
} }
private void setupShowCityComboBox() { private void setupShowCityComboBox() {
...@@ -585,6 +592,10 @@ public class MainWindow extends Application { ...@@ -585,6 +592,10 @@ public class MainWindow extends Application {
showCityObjectsCombo.getSelectionModel().selectedIndexProperty().addListener(filterChangeListener); showCityObjectsCombo.getSelectionModel().selectedIndexProperty().addListener(filterChangeListener);
} }
public void rebuildErrorFilterTrees(){
controller.errorFilterIndexChanged(showCityObjectsCombo.getSelectionModel().getSelectedIndex());
}
private ChangeListener<Number> setupFilterSelectionListener() { private ChangeListener<Number> setupFilterSelectionListener() {
return (obs, oldV, newV) -> controller.errorFilterIndexChanged(newV); return (obs, oldV, newV) -> controller.errorFilterIndexChanged(newV);
} }
...@@ -1190,4 +1201,8 @@ public class MainWindow extends Application { ...@@ -1190,4 +1201,8 @@ public class MainWindow extends Application {
public FeatureType getSelectedTab() { public FeatureType getSelectedTab() {
return selectedTab; return selectedTab;
} }
public Label getGlobalErrorsLabel() {
return globalErrorsLabel;
}
} }
...@@ -6,6 +6,7 @@ import java.io.File; ...@@ -6,6 +6,7 @@ import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Properties; import java.util.Properties;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -22,6 +23,7 @@ public class Settings { ...@@ -22,6 +23,7 @@ public class Settings {
public static final String FRAME_X = "frameX"; public static final String FRAME_X = "frameX";
public static final String FRAME_Y = "frameY"; public static final String FRAME_Y = "frameY";
public static final String LANGUAGE = "language"; public static final String LANGUAGE = "language";
public static final String CONFIG = "config";
private static Properties props; private static Properties props;
...@@ -30,14 +32,14 @@ public class Settings { ...@@ -30,14 +32,14 @@ public class Settings {
File propFile = new File("GUISettings.properties"); File propFile = new File("GUISettings.properties");
if (propFile.exists()) { if (propFile.exists()) {
try (BufferedReader bis = new BufferedReader(new FileReader(propFile))) { try (BufferedReader bis = new BufferedReader(new FileReader(propFile, StandardCharsets.UTF_8))) {
props.load(bis); props.load(bis);
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to load settings", e); logger.error("Failed to load settings", e);
} }
} }
Runtime.getRuntime().addShutdownHook(new Thread(() -> { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(propFile))) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(propFile, StandardCharsets.UTF_8))) {
props.store(bw, "GUI configuration"); props.store(bw, "GUI configuration");
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to save settings", e); logger.error("Failed to save settings", e);
......
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