Commit b75c2602 authored by Riegel's avatar Riegel
Browse files

Merge branch 'refs/heads/dev' into dev_zip_files

# Conflicts:
#	CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java
#	CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
#	CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
#	CityDoctorParent/Extensions/CityDoctorGUI/pom.xml
#	CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/MainToolBar.fxml
#	CityDoctorParent/Extensions/CityDoctorHealer/pom.xml
#	CityDoctorParent/pom.xml
2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Pipeline #10991 passed with stage
in 1 minute and 24 seconds
Showing with 1274 additions and 1226 deletions
+1274 -1226
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
......
...@@ -29,7 +29,6 @@ public class Vector2d { ...@@ -29,7 +29,6 @@ public class Vector2d {
this.y = y; this.y = y;
} }
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() { public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x); return new Vector2d(y, -x);
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
...@@ -102,7 +104,8 @@ ...@@ -102,7 +104,8 @@
<prefix>git</prefix> <prefix>git</prefix>
<verbose>false</verbose> <verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile> <generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename> <generateGitPropertiesFilename>
${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<gitDescribe> <gitDescribe>
<skip>false</skip> <skip>false</skip>
<always>false</always> <always>false</always>
......
...@@ -60,10 +60,8 @@ import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError; ...@@ -60,10 +60,8 @@ import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
@SuppressWarnings("unused")
public interface HealingMethod { public interface HealingMethod {
public HealingID getID(); public HealingID getID();
default boolean visit(CheckError e, ModificationListener l) { default boolean visit(CheckError e, ModificationListener l) {
......
...@@ -130,6 +130,9 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -130,6 +130,9 @@ public abstract class AbstractFurniture extends CityObject {
parent = co; parent = co;
} }
public CityObject getParent() {
return parent;
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
......
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.List;
import org.citygml4j.core.model.core.ImplicitGeometry;
import de.hft.stuttgart.citydoctor2.check.Check; import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId; import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.math.TransformationMatrix; import de.hft.stuttgart.citydoctor2.math.TransformationMatrix;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.ImplicitGeometry;
import java.io.Serial;
import java.util.List;
/** /**
* Datastructure for representation and resolving of implicit geometries * Datastructure for representation and resolving of implicit geometries
...@@ -18,7 +17,6 @@ import java.util.List; ...@@ -18,7 +17,6 @@ import java.util.List;
*/ */
public class ImplicitGeometryHolder extends Geometry { public class ImplicitGeometryHolder extends Geometry {
private static final Logger logger = LogManager.getLogger(ImplicitGeometryHolder.class);
@Serial @Serial
private static final long serialVersionUID = -8938931081577196349L; private static final long serialVersionUID = -8938931081577196349L;
......
...@@ -16,7 +16,8 @@ import java.util.Map; ...@@ -16,7 +16,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
* Reference object for handling of implicit geometries with a library object contained in an external file * Reference object for handling of implicit geometries with a library object
* contained in an external file
* *
* @author Riegel * @author Riegel
*/ */
...@@ -25,6 +26,7 @@ public class LibraryObject extends Geometry { ...@@ -25,6 +26,7 @@ public class LibraryObject extends Geometry {
private static final Logger logger = LogManager.getLogger(LibraryObject.class); private static final Logger logger = LogManager.getLogger(LibraryObject.class);
@Serial @Serial
private static final long serialVersionUID = -50293435187454911L; private static final long serialVersionUID = -50293435187454911L;
private static Map<String, LibraryObject> libraryObjects = new ConcurrentHashMap<>(); private static Map<String, LibraryObject> libraryObjects = new ConcurrentHashMap<>();
public static LibraryObject of(Path path, ParserConfiguration config) { public static LibraryObject of(Path path, ParserConfiguration config) {
......
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.Serial; import java.io.Serial;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -15,7 +11,6 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -15,7 +11,6 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class RelativeGeometry extends Geometry { public class RelativeGeometry extends Geometry {
private static final Logger logger = LogManager.getLogger(RelativeGeometry.class);
@Serial @Serial
private static final long serialVersionUID = -686112245455298977L; private static final long serialVersionUID = -686112245455298977L;
...@@ -32,10 +27,7 @@ public class RelativeGeometry extends Geometry { ...@@ -32,10 +27,7 @@ public class RelativeGeometry extends Geometry {
return relGeo; return relGeo;
} }
private RelativeGeometry(GeometryType type, Lod lod) { private RelativeGeometry(GeometryType type, Lod lod) {
super(type, lod); super(type, lod);
} }
} }
...@@ -68,6 +68,8 @@ public class TunnelConstructiveElement extends CityObject { ...@@ -68,6 +68,8 @@ public class TunnelConstructiveElement extends CityObject {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config); MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(geom, ms); setMultiSurfaceAccordingToLod(geom, ms);
break; break;
case COMPOSITE_SURFACE:
throw new IllegalStateException("Tunnel constructive element cannot have a composite surface geometry");
} }
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
......
...@@ -131,8 +131,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -131,8 +131,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
gco.setGmlObject(gos); gco.setGmlObject(gos);
GeometryProperty<?> agLod1 = gos.getDeprecatedProperties().getLod1Geometry(); GeometryProperty<?> agLod1 = gos.getDeprecatedProperties().getLod1Geometry();
GeometryProperty<?> agLod4 = gos.getDeprecatedProperties().getLod4Geometry(); GeometryProperty<?> agLod4 = gos.getDeprecatedProperties().getLod4Geometry();
if (agLod1 != null && agLod1.getObject() != null && if (agLod1 != null && agLod1.getObject() != null && agLod1.getObject() instanceof MultiSurface ms) {
agLod1.getObject() instanceof MultiSurface ms) {
gco.addGeometry(parseMultiSurface(ms, Lod.LOD1)); gco.addGeometry(parseMultiSurface(ms, Lod.LOD1));
} }
if (agLod4 != null && agLod4.getObject() != null) { if (agLod4 != null && agLod4.getObject() != null) {
...@@ -221,10 +220,14 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -221,10 +220,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
veg.setGmlObject(solitaryVegetationObject); veg.setGmlObject(solitaryVegetationObject);
mapAbstractVegetationObject(solitaryVegetationObject, veg); mapAbstractVegetationObject(solitaryVegetationObject, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1, veg); parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1,
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2, veg); veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3, veg); parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2,
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4, veg); veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3,
veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4,
veg);
finishCityObjectConstruction(veg); finishCityObjectConstruction(veg);
model.addVegetation(veg); model.addVegetation(veg);
...@@ -264,7 +267,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -264,7 +267,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
public void visit(Bridge bridge) { public void visit(Bridge bridge) {
BridgeObject bo = new BridgeObject(bridge); BridgeObject bo = new BridgeObject(bridge);
// parse deprecated geometries // parse deprecated geometries
parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod1MultiSurface(), Lod.LOD1, bo); parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod1MultiSurface(), Lod.LOD1, bo);
parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, bo); parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, bo);
...@@ -409,24 +411,11 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -409,24 +411,11 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface(gmlTunnel.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdTunnel); parseAndAddMultiSurface(gmlTunnel.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdTunnel);
parseAndAddSolid(gmlTunnel.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdTunnel); parseAndAddSolid(gmlTunnel.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdTunnel);
for (TunnelInstallationProperty tiProp : gmlTunnel.getTunnelInstallations()) { parseTunnelInstallations(gmlTunnel, cdTunnel);
var gmlTi = tiProp.getObject(); parseHollowSpaces(gmlTunnel, cdTunnel);
if (gmlTi == null) { parseTunnelFurniture(gmlTunnel, cdTunnel);
// ignore empty properties parseTunnelConstructiveElements(gmlTunnel, cdTunnel);
continue; parseTunnelBoundarySurfaces(gmlTunnel);
}
Installation ti = mapTunnelInstallation(gmlTi);
cdTunnel.addTunnelInstallation(ti);
}
for (HollowSpaceProperty thProp : gmlTunnel.getHollowSpaces()) {
var gmlTh = thProp.getObject();
if (gmlTh == null) {
continue;
}
TunnelHollow br = mapTunnelHollow(gmlTh);
cdTunnel.addTunnelHollow(br);
}
for (Installation ti : cdTunnel.getTunnelInstallations()) { for (Installation ti : cdTunnel.getTunnelInstallations()) {
updateEdgesAndVertices(ti); updateEdgesAndVertices(ti);
for (BoundarySurface bs : ti.getBoundarySurfaces()) { for (BoundarySurface bs : ti.getBoundarySurfaces()) {
...@@ -436,24 +425,14 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -436,24 +425,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
} }
for (TunnelFurnitureProperty tfProp : gmlTunnel.getTunnelFurniture()) {
var gmlTf = tfProp.getObject();
if (gmlTf == null) {
continue;
}
TunnelFurniture tf = mapTunnelFurniture(gmlTf);
cdTunnel.addTunnelFurniture(tf);
}
for (TunnelConstructiveElementProperty teProp : gmlTunnel.getTunnelConstructiveElements()) {
var gmlTc = teProp.getObject(); cdTunnel.unsetGmlGeometries();
if (gmlTc == null) { resolveAndClearReferences();
continue; updateEdgesAndVertices(cdTunnel);
}
TunnelConstructiveElement tc = mapTunnelConstructiveElement(gmlTc);
cdTunnel.addTunnelConstructiveElement(tc);
} }
private void parseTunnelBoundarySurfaces(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel) {
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlTunnel.getBoundaries()) { for (AbstractSpaceBoundaryProperty surfaceProp : gmlTunnel.getBoundaries()) {
if (!surfaceProp.isSetObject()) { if (!surfaceProp.isSetObject()) {
...@@ -468,11 +447,51 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -468,11 +447,51 @@ public class Citygml3FeatureMapper extends ObjectWalker {
updateEdgesAndVertices(o); updateEdgesAndVertices(o);
} }
} }
}
private void parseTunnelConstructiveElements(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) {
for (TunnelConstructiveElementProperty teProp : gmlTunnel.getTunnelConstructiveElements()) {
var gmlTc = teProp.getObject();
if (gmlTc == null) {
continue;
}
TunnelConstructiveElement tc = mapTunnelConstructiveElement(gmlTc);
cdTunnel.addTunnelConstructiveElement(tc);
}
}
cdTunnel.unsetGmlGeometries(); private void parseTunnelFurniture(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) {
resolveAndClearReferences(); for (TunnelFurnitureProperty tfProp : gmlTunnel.getTunnelFurniture()) {
updateEdgesAndVertices(cdTunnel); var gmlTf = tfProp.getObject();
if (gmlTf == null) {
continue;
}
TunnelFurniture tf = mapTunnelFurniture(gmlTf);
cdTunnel.addTunnelFurniture(tf);
}
}
private void parseHollowSpaces(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) {
for (HollowSpaceProperty thProp : gmlTunnel.getHollowSpaces()) {
var gmlTh = thProp.getObject();
if (gmlTh == null) {
continue;
}
TunnelHollow br = mapTunnelHollow(gmlTh);
cdTunnel.addTunnelHollow(br);
}
}
private void parseTunnelInstallations(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) {
for (TunnelInstallationProperty tiProp : gmlTunnel.getTunnelInstallations()) {
var gmlTi = tiProp.getObject();
if (gmlTi == null) {
// ignore empty properties
continue;
}
Installation ti = mapTunnelInstallation(gmlTi);
cdTunnel.addTunnelInstallation(ti);
}
} }
private Installation mapTunnelInstallation(TunnelInstallation gmlTi) { private Installation mapTunnelInstallation(TunnelInstallation gmlTi) {
...@@ -577,7 +596,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -577,7 +596,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
return tf; return tf;
} }
private TunnelConstructiveElement mapTunnelConstructiveElement(org.citygml4j.core.model.tunnel.TunnelConstructiveElement gmlTe) { private TunnelConstructiveElement mapTunnelConstructiveElement(
org.citygml4j.core.model.tunnel.TunnelConstructiveElement gmlTe) {
TunnelConstructiveElement te = new TunnelConstructiveElement(gmlTe); TunnelConstructiveElement te = new TunnelConstructiveElement(gmlTe);
mapAbstractOccupiedSpace(gmlTe, te); mapAbstractOccupiedSpace(gmlTe, te);
te.unsetGmlGeometries(); te.unsetGmlGeometries();
...@@ -611,7 +631,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -611,7 +631,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void mapConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) { private void mapConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele,
BridgeConstructiveElement bce) {
mapAbstractConstructiveElement(ele, bce); mapAbstractConstructiveElement(ele, bce);
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
...@@ -627,7 +648,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -627,7 +648,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) { private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele,
BridgeConstructiveElement bce) {
mapAbstractOccupiedSpace(ele, bce); mapAbstractOccupiedSpace(ele, bce);
} }
...@@ -792,7 +814,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -792,7 +814,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co) { private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co) {
for (int i = 1; i <= 3; i++) { for (int i = 1; i <= 3; i++) {
if (aos.getImplicitRepresentation(i) == null) { if (aos.getImplicitRepresentation(i) == null) {
...@@ -806,10 +827,10 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -806,10 +827,10 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} else if (aos.getImplicitRepresentation(i).getHref() != null) { } else if (aos.getImplicitRepresentation(i).getHref() != null) {
// Hrefs of ImplicitGeometries point to its RelativeGeometry. // Hrefs of ImplicitGeometries point to its RelativeGeometry.
// Can be ignored for CD since the Href is only used for repeating the RelativeGeometry at different LODs // Can be ignored for CD since the Href is only used for repeating the
// RelativeGeometry at different LODs
} }
} }
} }
...@@ -862,8 +883,20 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -862,8 +883,20 @@ public class Citygml3FeatureMapper extends ObjectWalker {
Geometry geom = ref.geometry(); Geometry geom = ref.geometry();
CompositeCollection comp = compositeMap.get(href); CompositeCollection comp = compositeMap.get(href);
if (comp != null) { if (comp != null) {
// composite collection, add each containing polygon to the geometry
comp.getCompositeMembers().forEach(geom::addPolygon); comp.getCompositeMembers().forEach(geom::addPolygon);
} else { } else {
handlePolygonReference(href, geom);
}
}
// clear storage for polygons and vertices
references = new ArrayList<>();
vertexMap = new HashMap<>();
polygonMap = new HashMap<>();
}
private void handlePolygonReference(String href, Geometry geom) {
ConcretePolygon concPoly = polygonMap.get(href); ConcretePolygon concPoly = polygonMap.get(href);
if (concPoly == null) { if (concPoly == null) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
...@@ -880,14 +913,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -880,14 +913,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
geom.addPolygon(lPoly); geom.addPolygon(lPoly);
} }
} }
}
// clear storage for polygons and vertices
// probably faster than .clear() ?
references = new ArrayList<>();
vertexMap = new HashMap<>();
polygonMap = new HashMap<>();
}
private void readAbstractBuilding(org.citygml4j.core.model.building.AbstractBuilding gmlAb, private void readAbstractBuilding(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) { AbstractBuilding cdBuilding) {
...@@ -899,25 +924,47 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -899,25 +924,47 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface(gmlAb.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdBuilding); parseAndAddMultiSurface(gmlAb.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdBuilding);
parseAndAddSolid(gmlAb.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdBuilding); parseAndAddSolid(gmlAb.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdBuilding);
for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) { parseBuildingInstallations(gmlAb, cdBuilding);
var gmlBi = biProp.getObject(); parseBuildingRooms(gmlAb, cdBuilding);
if (gmlBi == null) { parseBuildingSubdivisions(gmlAb, cdBuilding);
// ignore empty properties parseBoundarySurfaces(gmlAb, cdBuilding);
parseBuildingFurniture(gmlAb, cdBuilding);
}
private void parseBuildingFurniture(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
for (BuildingFurnitureProperty bfProp : gmlAb.getBuildingFurniture()) {
var gmlBf = bfProp.getObject();
if (gmlBf == null) {
continue; continue;
} }
Installation bi = mapBuildingInstallation(gmlBi); BuildingRoomFurniture bf = mapBuildingFurniture(gmlBf);
cdBuilding.addBuildingInstallation(bi); cdBuilding.addBuildingRoomFurniture(bf);
}
} }
for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) { private void parseBoundarySurfaces(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
var gmlBr = brProp.getObject(); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
if (gmlBr == null) { for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue; continue;
} }
BuildingRoom br = mapBuildingRoom(gmlBr); AbstractSpaceBoundary surface = surfaceProp.getObject();
cdBuilding.addBuildingRoom(br); surface.accept(surfaceMapper);
} }
updatePartOfSurface(cdBuilding, surfaceMapper);
cdBuilding.unsetGmlGeometries();
resolveAndClearReferences();
updateEdgesAndVertices(cdBuilding);
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
updateEdgesAndVertices(bs);
for (Opening o : bs.getOpenings()) {
updateEdgesAndVertices(o);
}
}
}
private void parseBuildingSubdivisions(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
for (AbstractBuildingSubdivisionProperty abs : gmlAb.getBuildingSubdivisions()) { for (AbstractBuildingSubdivisionProperty abs : gmlAb.getBuildingSubdivisions()) {
var gmlABS = abs.getObject(); var gmlABS = abs.getObject();
if (gmlABS == null) { if (gmlABS == null) {
...@@ -931,25 +978,28 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -931,25 +978,28 @@ public class Citygml3FeatureMapper extends ObjectWalker {
cdBuilding.addBuildingUnit(bu); cdBuilding.addBuildingUnit(bu);
} }
} }
}
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); private void parseBuildingRooms(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) { for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) {
if (!surfaceProp.isSetObject()) { var gmlBr = brProp.getObject();
if (gmlBr == null) {
continue; continue;
} }
AbstractSpaceBoundary surface = surfaceProp.getObject(); BuildingRoom br = mapBuildingRoom(gmlBr);
surface.accept(surfaceMapper); cdBuilding.addBuildingRoom(br);
}
} }
updatePartOfSurface(cdBuilding, surfaceMapper);
cdBuilding.unsetGmlGeometries(); private void parseBuildingInstallations(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
resolveAndClearReferences(); for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) {
updateEdgesAndVertices(cdBuilding); var gmlBi = biProp.getObject();
for (BoundarySurface bs : surfaceMapper.getSurfaces()) { if (gmlBi == null) {
updateEdgesAndVertices(bs); // ignore empty properties
for (Opening o : bs.getOpenings()) { continue;
updateEdgesAndVertices(o);
} }
Installation bi = mapBuildingInstallation(gmlBi);
cdBuilding.addBuildingInstallation(bi);
} }
for (Installation bi : cdBuilding.getBuildingInstallations()) { for (Installation bi : cdBuilding.getBuildingInstallations()) {
updateEdgesAndVertices(bi); updateEdgesAndVertices(bi);
...@@ -960,14 +1010,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -960,14 +1010,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
} }
for (BuildingFurnitureProperty bfProp : gmlAb.getBuildingFurniture()) {
var gmlBf = bfProp.getObject();
if (gmlBf == null) {
continue;
}
BuildingRoomFurniture bf = mapBuildingFurniture(gmlBf);
cdBuilding.addBuildingRoomFurniture(bf);
}
} }
private BuildingRoom mapBuildingRoom(org.citygml4j.core.model.building.BuildingRoom gmlBr) { private BuildingRoom mapBuildingRoom(org.citygml4j.core.model.building.BuildingRoom gmlBr) {
...@@ -1009,7 +1051,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1009,7 +1051,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
br.addFurnitureRef(bfProp); br.addFurnitureRef(bfProp);
} }
return br; return br;
} }
......
...@@ -59,7 +59,7 @@ public class Citygml3GeometryMapper extends GeometryWalker { ...@@ -59,7 +59,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public void visit(Polygon polygon) { public void visit(Polygon polygon) {
parsePolygon(polygon.getId(), polygon.getExterior(), polygon.getInterior()); parsePolygon(polygon.getId(), polygon.getExterior(), polygon.getInterior());
if (polygon.getExterior() == null) { if (polygon.getExterior() == null) {
logger.warn(String.format("No exterior: %s", polygon.getId())); logger.warn("No exterior: {}", polygon.getId());
} }
} }
......
...@@ -87,12 +87,27 @@ public class ProjectionAxis { ...@@ -87,12 +87,27 @@ public class ProjectionAxis {
this.axis = axis; this.axis = axis;
} }
/**
* This will write the two coordinates determined in this projection axis into a
* given array at the startIndex location. The array has to have at least a
* length of startIndex + 1.
*
* @param v the vector from which the coordinates are taken.
* @param array the array that is written to.
* @param startIndex the start location in the array.
*/
public void writeCoordinatesOfVectorInArray(Vector3d v, double[] array, int startIndex) {
array[startIndex] = v.getCoordinate(axis[0]);
array[startIndex + 1] = v.getCoordinate(axis[1]);
}
public Vector2d project(Vector3d v) { public Vector2d project(Vector3d v) {
return new Vector2d(v.getCoordinate(axis[0]), v.getCoordinate(axis[1])); return new Vector2d(v.getCoordinate(axis[0]), v.getCoordinate(axis[1]));
} }
/** /**
* calculates the missing coordinate for 3d vector from the plane and this axis. * calculates the missing coordinate for 3d vector from the plane and this axis.
*
* @return the projected 3d point. * @return the projected 3d point.
*/ */
public Vector3d projectToPlane(Plane plane, Vector2d v) { public Vector3d projectToPlane(Plane plane, Vector2d v) {
...@@ -101,6 +116,7 @@ public class ProjectionAxis { ...@@ -101,6 +116,7 @@ public class ProjectionAxis {
/** /**
* calculates the missing coordinate for 3d vector from the plane and this axis. * calculates the missing coordinate for 3d vector from the plane and this axis.
*
* @return the projected 3d point. * @return the projected 3d point.
*/ */
public Vector3d projectToPlane(Plane plane, double vectorX, double vectorY) { public Vector3d projectToPlane(Plane plane, double vectorX, double vectorY) {
......
...@@ -6,10 +6,8 @@ import java.util.List; ...@@ -6,10 +6,8 @@ import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Polygon2d; import de.hft.stuttgart.citydoctor2.math.ProjectionAxis;
import de.hft.stuttgart.citydoctor2.math.Ring2d;
import de.hft.stuttgart.citydoctor2.math.Triangle3d; import de.hft.stuttgart.citydoctor2.math.Triangle3d;
import de.hft.stuttgart.citydoctor2.math.Vector2d;
import earcut4j.Earcut; import earcut4j.Earcut;
/** /**
...@@ -35,8 +33,8 @@ public class EarcutTesselator { ...@@ -35,8 +33,8 @@ public class EarcutTesselator {
} }
} }
// collect vertices // collect vertices
// project polygon to 2D space as library is buggy for more than 2 dimensions // find most dominant projection axis for 2d projection
Polygon2d projectedPolygon = Polygon2d.withProjection(p); ProjectionAxis axis = ProjectionAxis.of(p);
double[] vertices = new double[nrOfVertices * 2]; double[] vertices = new double[nrOfVertices * 2];
List<Vertex> vertexObjects = new ArrayList<>(); List<Vertex> vertexObjects = new ArrayList<>();
...@@ -45,9 +43,10 @@ public class EarcutTesselator { ...@@ -45,9 +43,10 @@ public class EarcutTesselator {
addVerticesToList(innerRing, vertexObjects); addVerticesToList(innerRing, vertexObjects);
} }
int start = addRingToArray(projectedPolygon.getExterior(), vertices, 0); // write the vector data according to the projection axis into the array
for (Ring2d innerRing : projectedPolygon.getInteriorRings()) { int start = addRingToArray(p.getExteriorRing(), vertices, 0, axis);
start = addRingToArray(innerRing, vertices, start); for (LinearRing innerRing : p.getInnerRings()) {
start = addRingToArray(innerRing, vertices, start, axis);
} }
// triangulation // triangulation
...@@ -73,12 +72,12 @@ public class EarcutTesselator { ...@@ -73,12 +72,12 @@ public class EarcutTesselator {
} }
} }
private static int addRingToArray(Ring2d ring, double[] vertices, int start) { private static int addRingToArray(LinearRing ring, double[] vertices, int start, ProjectionAxis axis) {
List<Vector2d> ringVertices = ring.getVertices(); List<Vertex> ringVertices = ring.getVertices();
for (int i = 0; i < ringVertices.size() - 1; i++) { for (int i = 0; i < ringVertices.size() - 1; i++) {
Vector2d v = ringVertices.get(i); Vertex v = ringVertices.get(i);
vertices[start++] = v.getX(); axis.writeCoordinatesOfVectorInArray(v, vertices, start);
vertices[start++] = v.getY(); start = start + 2;
} }
return start; return start;
} }
......
...@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.core.AbstractCityObjectProperty; import org.citygml4j.core.model.core.AbstractCityObjectProperty;
import org.citygml4j.core.model.core.AbstractFeatureProperty; import org.citygml4j.core.model.core.AbstractFeatureProperty;
import org.citygml4j.core.model.core.CityModel; import org.citygml4j.core.model.core.CityModel;
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
......
...@@ -426,6 +426,7 @@ public class Checker { ...@@ -426,6 +426,7 @@ public class Checker {
} }
} }
@SuppressWarnings("resource")
public static SvrlContentHandler executeSchematronValidationIfAvailable(ValidationConfiguration config, public static SvrlContentHandler executeSchematronValidationIfAvailable(ValidationConfiguration config,
InputStream in) { InputStream in) {
if (config.getSchematronFilePath() != null && !config.getSchematronFilePath().isEmpty()) { if (config.getSchematronFilePath() != null && !config.getSchematronFilePath().isEmpty()) {
......
...@@ -65,23 +65,19 @@ public class SvrlContentHandler implements ContentHandler { ...@@ -65,23 +65,19 @@ public class SvrlContentHandler implements ContentHandler {
public void setDocumentLocator(Locator locator) { public void setDocumentLocator(Locator locator) {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void endDocument() throws SAXException { public void endDocument() throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void startPrefixMapping(String prefix, String uri) throws SAXException { public void startPrefixMapping(String prefix, String uri) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void endPrefixMapping(String prefix) throws SAXException { public void endPrefixMapping(String prefix) throws SAXException {
// not needed // not needed
...@@ -133,17 +129,14 @@ public class SvrlContentHandler implements ContentHandler { ...@@ -133,17 +129,14 @@ public class SvrlContentHandler implements ContentHandler {
buffer.append(ch, start, length); buffer.append(ch, start, length);
} }
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void processingInstruction(String target, String data) throws SAXException { public void processingInstruction(String target, String data) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void skippedEntity(String name) throws SAXException { public void skippedEntity(String name) throws SAXException {
// not needed // not needed
......
...@@ -76,7 +76,6 @@ public class SolidSelfIntCheck extends Check { ...@@ -76,7 +76,6 @@ public class SolidSelfIntCheck extends Check {
} }
CheckResult cr; CheckResult cr;
List<PolygonIntersection> intersections = SelfIntersectionUtil.calculateSolidSelfIntersection(g); List<PolygonIntersection> intersections = SelfIntersectionUtil.calculateSolidSelfIntersection(g);
// List<PolygonIntersection> intersections = SelfIntersectionUtil.doesSolidSelfIntersect2(g);
if (intersections.isEmpty()) { if (intersections.isEmpty()) {
cr = new CheckResult(this, ResultStatus.OK, null); cr = new CheckResult(this, ResultStatus.OK, null);
} else { } else {
......
...@@ -36,7 +36,6 @@ public class SolidSelfIntCheckFalsePositiveBigMeshTest { ...@@ -36,7 +36,6 @@ public class SolidSelfIntCheckFalsePositiveBigMeshTest {
Checker c = new Checker(config, m); Checker c = new Checker(config, m);
c.runChecks(); c.runChecks();
Building building = m.getBuildings().get(0); Building building = m.getBuildings().get(0);
System.out.println(building.containsAnyError());
/* /*
* The examples have no actual self-intersections, but can contain other actual model defects. * The examples have no actual self-intersections, but can contain other actual model defects.
* If an error is detected, it is thus required to check if the * If an error is detected, it is thus required to check if the
......
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