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"?>
<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>
<parent>
<groupId>de.hft.stuttgart</groupId>
......
<?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>
<parent>
<groupId>de.hft.stuttgart</groupId>
......
......@@ -29,7 +29,6 @@ public class Vector2d {
this.y = y;
}
@SuppressWarnings("SuspiciousNameCombination")
public Vector2d getPerpendicularVector() {
return new Vector2d(y, -x);
}
......
<?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>
<parent>
<groupId>de.hft.stuttgart</groupId>
......@@ -102,7 +104,8 @@
<prefix>git</prefix>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<generateGitPropertiesFilename>
${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<gitDescribe>
<skip>false</skip>
<always>false</always>
......
......@@ -60,10 +60,8 @@ import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
* @author Matthias Betz
*
*/
@SuppressWarnings("unused")
public interface HealingMethod {
public HealingID getID();
default boolean visit(CheckError e, ModificationListener l) {
......
......@@ -130,6 +130,9 @@ public abstract class AbstractFurniture extends CityObject {
parent = co;
}
public CityObject getParent() {
return parent;
}
@Override
public void unsetGmlGeometries() {
......
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.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
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
......@@ -18,7 +17,6 @@ import java.util.List;
*/
public class ImplicitGeometryHolder extends Geometry {
private static final Logger logger = LogManager.getLogger(ImplicitGeometryHolder.class);
@Serial
private static final long serialVersionUID = -8938931081577196349L;
......
......@@ -16,7 +16,8 @@ import java.util.Map;
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
*/
......@@ -25,6 +26,7 @@ public class LibraryObject extends Geometry {
private static final Logger logger = LogManager.getLogger(LibraryObject.class);
@Serial
private static final long serialVersionUID = -50293435187454911L;
private static Map<String, LibraryObject> libraryObjects = new ConcurrentHashMap<>();
public static LibraryObject of(Path path, ParserConfiguration config) {
......
package de.hft.stuttgart.citydoctor2.datastructure;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.Serial;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......@@ -15,7 +11,6 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class RelativeGeometry extends Geometry {
private static final Logger logger = LogManager.getLogger(RelativeGeometry.class);
@Serial
private static final long serialVersionUID = -686112245455298977L;
......@@ -32,10 +27,7 @@ public class RelativeGeometry extends Geometry {
return relGeo;
}
private RelativeGeometry(GeometryType type, Lod lod) {
super(type, lod);
}
}
......@@ -68,6 +68,8 @@ public class TunnelConstructiveElement extends CityObject {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(geom, ms);
break;
case COMPOSITE_SURFACE:
throw new IllegalStateException("Tunnel constructive element cannot have a composite surface geometry");
}
}
for (BoundarySurface bs : boundarySurfaceList) {
......
......@@ -131,8 +131,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
gco.setGmlObject(gos);
GeometryProperty<?> agLod1 = gos.getDeprecatedProperties().getLod1Geometry();
GeometryProperty<?> agLod4 = gos.getDeprecatedProperties().getLod4Geometry();
if (agLod1 != null && agLod1.getObject() != null &&
agLod1.getObject() instanceof MultiSurface ms) {
if (agLod1 != null && agLod1.getObject() != null && agLod1.getObject() instanceof MultiSurface ms) {
gco.addGeometry(parseMultiSurface(ms, Lod.LOD1));
}
if (agLod4 != null && agLod4.getObject() != null) {
......@@ -221,10 +220,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
veg.setGmlObject(solitaryVegetationObject);
mapAbstractVegetationObject(solitaryVegetationObject, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1,
veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2,
veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3,
veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4,
veg);
finishCityObjectConstruction(veg);
model.addVegetation(veg);
......@@ -264,7 +267,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
public void visit(Bridge bridge) {
BridgeObject bo = new BridgeObject(bridge);
// parse deprecated geometries
parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod1MultiSurface(), Lod.LOD1, bo);
parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, bo);
......@@ -409,24 +411,11 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface(gmlTunnel.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdTunnel);
parseAndAddSolid(gmlTunnel.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdTunnel);
for (TunnelInstallationProperty tiProp : gmlTunnel.getTunnelInstallations()) {
var gmlTi = tiProp.getObject();
if (gmlTi == null) {
// ignore empty properties
continue;
}
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);
}
parseTunnelInstallations(gmlTunnel, cdTunnel);
parseHollowSpaces(gmlTunnel, cdTunnel);
parseTunnelFurniture(gmlTunnel, cdTunnel);
parseTunnelConstructiveElements(gmlTunnel, cdTunnel);
parseTunnelBoundarySurfaces(gmlTunnel);
for (Installation ti : cdTunnel.getTunnelInstallations()) {
updateEdgesAndVertices(ti);
for (BoundarySurface bs : ti.getBoundarySurfaces()) {
......@@ -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();
if (gmlTc == null) {
continue;
}
TunnelConstructiveElement tc = mapTunnelConstructiveElement(gmlTc);
cdTunnel.addTunnelConstructiveElement(tc);
cdTunnel.unsetGmlGeometries();
resolveAndClearReferences();
updateEdgesAndVertices(cdTunnel);
}
private void parseTunnelBoundarySurfaces(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel) {
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlTunnel.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
......@@ -468,11 +447,51 @@ public class Citygml3FeatureMapper extends ObjectWalker {
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();
resolveAndClearReferences();
updateEdgesAndVertices(cdTunnel);
private void parseTunnelFurniture(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) {
for (TunnelFurnitureProperty tfProp : gmlTunnel.getTunnelFurniture()) {
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) {
......@@ -577,7 +596,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
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);
mapAbstractOccupiedSpace(gmlTe, te);
te.unsetGmlGeometries();
......@@ -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);
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
......@@ -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);
}
......@@ -792,7 +814,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co) {
for (int i = 1; i <= 3; i++) {
if (aos.getImplicitRepresentation(i) == null) {
......@@ -806,10 +827,10 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
} else if (aos.getImplicitRepresentation(i).getHref() != null) {
// 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 {
Geometry geom = ref.geometry();
CompositeCollection comp = compositeMap.get(href);
if (comp != null) {
// composite collection, add each containing polygon to the geometry
comp.getCompositeMembers().forEach(geom::addPolygon);
} 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);
if (concPoly == null) {
if (logger.isWarnEnabled()) {
......@@ -880,14 +913,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
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,
AbstractBuilding cdBuilding) {
......@@ -899,25 +924,47 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface(gmlAb.getDeprecatedProperties().getLod4MultiSurface(), Lod.LOD4, cdBuilding);
parseAndAddSolid(gmlAb.getDeprecatedProperties().getLod4Solid(), Lod.LOD4, cdBuilding);
for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) {
var gmlBi = biProp.getObject();
if (gmlBi == null) {
// ignore empty properties
parseBuildingInstallations(gmlAb, cdBuilding);
parseBuildingRooms(gmlAb, cdBuilding);
parseBuildingSubdivisions(gmlAb, cdBuilding);
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;
}
Installation bi = mapBuildingInstallation(gmlBi);
cdBuilding.addBuildingInstallation(bi);
BuildingRoomFurniture bf = mapBuildingFurniture(gmlBf);
cdBuilding.addBuildingRoomFurniture(bf);
}
}
for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) {
var gmlBr = brProp.getObject();
if (gmlBr == null) {
private void parseBoundarySurfaces(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue;
}
BuildingRoom br = mapBuildingRoom(gmlBr);
cdBuilding.addBuildingRoom(br);
AbstractSpaceBoundary surface = surfaceProp.getObject();
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()) {
var gmlABS = abs.getObject();
if (gmlABS == null) {
......@@ -931,25 +978,28 @@ public class Citygml3FeatureMapper extends ObjectWalker {
cdBuilding.addBuildingUnit(bu);
}
}
}
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
private void parseBuildingRooms(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) {
var gmlBr = brProp.getObject();
if (gmlBr == null) {
continue;
}
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
BuildingRoom br = mapBuildingRoom(gmlBr);
cdBuilding.addBuildingRoom(br);
}
}
updatePartOfSurface(cdBuilding, surfaceMapper);
cdBuilding.unsetGmlGeometries();
resolveAndClearReferences();
updateEdgesAndVertices(cdBuilding);
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
updateEdgesAndVertices(bs);
for (Opening o : bs.getOpenings()) {
updateEdgesAndVertices(o);
private void parseBuildingInstallations(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) {
for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) {
var gmlBi = biProp.getObject();
if (gmlBi == null) {
// ignore empty properties
continue;
}
Installation bi = mapBuildingInstallation(gmlBi);
cdBuilding.addBuildingInstallation(bi);
}
for (Installation bi : cdBuilding.getBuildingInstallations()) {
updateEdgesAndVertices(bi);
......@@ -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) {
......@@ -1009,7 +1051,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
br.addFurnitureRef(bfProp);
}
return br;
}
......
......@@ -59,7 +59,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public void visit(Polygon polygon) {
parsePolygon(polygon.getId(), polygon.getExterior(), polygon.getInterior());
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 {
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) {
return new Vector2d(v.getCoordinate(axis[0]), v.getCoordinate(axis[1]));
}
/**
* calculates the missing coordinate for 3d vector from the plane and this axis.
*
* @return the projected 3d point.
*/
public Vector3d projectToPlane(Plane plane, Vector2d v) {
......@@ -101,6 +116,7 @@ public class ProjectionAxis {
/**
* calculates the missing coordinate for 3d vector from the plane and this axis.
*
* @return the projected 3d point.
*/
public Vector3d projectToPlane(Plane plane, double vectorX, double vectorY) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Polygon2d;
import de.hft.stuttgart.citydoctor2.math.Ring2d;
import de.hft.stuttgart.citydoctor2.math.ProjectionAxis;
import de.hft.stuttgart.citydoctor2.math.Triangle3d;
import de.hft.stuttgart.citydoctor2.math.Vector2d;
import earcut4j.Earcut;
/**
......@@ -35,8 +33,8 @@ public class EarcutTesselator {
}
}
// collect vertices
// project polygon to 2D space as library is buggy for more than 2 dimensions
Polygon2d projectedPolygon = Polygon2d.withProjection(p);
// find most dominant projection axis for 2d projection
ProjectionAxis axis = ProjectionAxis.of(p);
double[] vertices = new double[nrOfVertices * 2];
List<Vertex> vertexObjects = new ArrayList<>();
......@@ -45,9 +43,10 @@ public class EarcutTesselator {
addVerticesToList(innerRing, vertexObjects);
}
int start = addRingToArray(projectedPolygon.getExterior(), vertices, 0);
for (Ring2d innerRing : projectedPolygon.getInteriorRings()) {
start = addRingToArray(innerRing, vertices, start);
// write the vector data according to the projection axis into the array
int start = addRingToArray(p.getExteriorRing(), vertices, 0, axis);
for (LinearRing innerRing : p.getInnerRings()) {
start = addRingToArray(innerRing, vertices, start, axis);
}
// triangulation
......@@ -73,12 +72,12 @@ public class EarcutTesselator {
}
}
private static int addRingToArray(Ring2d ring, double[] vertices, int start) {
List<Vector2d> ringVertices = ring.getVertices();
private static int addRingToArray(LinearRing ring, double[] vertices, int start, ProjectionAxis axis) {
List<Vertex> ringVertices = ring.getVertices();
for (int i = 0; i < ringVertices.size() - 1; i++) {
Vector2d v = ringVertices.get(i);
vertices[start++] = v.getX();
vertices[start++] = v.getY();
Vertex v = ringVertices.get(i);
axis.writeCoordinatesOfVectorInArray(v, vertices, start);
start = start + 2;
}
return start;
}
......
......@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.LogManager;
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.AbstractFeatureProperty;
import org.citygml4j.core.model.core.CityModel;
......
<?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>
<parent>
<groupId>de.hft.stuttgart</groupId>
......
......@@ -426,6 +426,7 @@ public class Checker {
}
}
@SuppressWarnings("resource")
public static SvrlContentHandler executeSchematronValidationIfAvailable(ValidationConfiguration config,
InputStream in) {
if (config.getSchematronFilePath() != null && !config.getSchematronFilePath().isEmpty()) {
......
......@@ -65,23 +65,19 @@ public class SvrlContentHandler implements ContentHandler {
public void setDocumentLocator(Locator locator) {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void startDocument() throws SAXException {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void endDocument() throws SAXException {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void endPrefixMapping(String prefix) throws SAXException {
// not needed
......@@ -133,17 +129,14 @@ public class SvrlContentHandler implements ContentHandler {
buffer.append(ch, start, length);
}
}
@SuppressWarnings("RedundantThrows")
@Override
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void processingInstruction(String target, String data) throws SAXException {
// not needed
}
@SuppressWarnings("RedundantThrows")
@Override
public void skippedEntity(String name) throws SAXException {
// not needed
......
......@@ -76,7 +76,6 @@ public class SolidSelfIntCheck extends Check {
}
CheckResult cr;
List<PolygonIntersection> intersections = SelfIntersectionUtil.calculateSolidSelfIntersection(g);
// List<PolygonIntersection> intersections = SelfIntersectionUtil.doesSolidSelfIntersect2(g);
if (intersections.isEmpty()) {
cr = new CheckResult(this, ResultStatus.OK, null);
} else {
......
......@@ -36,7 +36,6 @@ public class SolidSelfIntCheckFalsePositiveBigMeshTest {
Checker c = new Checker(config, m);
c.runChecks();
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.
* 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