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) {
......
...@@ -129,7 +129,10 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -129,7 +129,10 @@ public abstract class AbstractFurniture extends CityObject {
public void setParent(CityObject co) { public void setParent(CityObject co) {
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,16 +16,18 @@ import java.util.Map; ...@@ -16,16 +16,18 @@ 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
*/ */
public class LibraryObject extends Geometry { 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) {
if (libraryObjects.containsKey(path.toString())) { if (libraryObjects.containsKey(path.toString())) {
......
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,27 +11,23 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -15,27 +11,23 @@ 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;
private static Map<Geometry, RelativeGeometry> relativeGeometries = new ConcurrentHashMap<>();
private static Map<Geometry, RelativeGeometry> relativeGeometries = new ConcurrentHashMap<>();
public static RelativeGeometry of(Geometry geom) {
public static RelativeGeometry of(Geometry geom) { if (relativeGeometries.containsKey(geom)) {
if (relativeGeometries.containsKey(geom)) { return relativeGeometries.get(geom);
return relativeGeometries.get(geom); }
} RelativeGeometry relGeo = new RelativeGeometry(geom.getType(), geom.getLod());
RelativeGeometry relGeo = new RelativeGeometry(geom.getType(), geom.getLod()); geom.getPolygons().forEach(relGeo::addPolygon);
geom.getPolygons().forEach(relGeo::addPolygon); relGeo.updateEdgesAndVertices();
relGeo.updateEdgesAndVertices(); relativeGeometries.put(geom, relGeo);
relativeGeometries.put(geom, relGeo); return relGeo;
return relGeo; }
}
private RelativeGeometry(GeometryType type, Lod lod) {
super(type, lod);
private RelativeGeometry(GeometryType type, Lod 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) {
......
...@@ -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());
} }
} }
......
...@@ -34,7 +34,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex; ...@@ -34,7 +34,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
* *
*/ */
public class ProjectionAxis { public class ProjectionAxis {
private static final String DIVISOR_IS_0 = "Divisor is 0"; private static final String DIVISOR_IS_0 = "Divisor is 0";
private final int[] axis; private final int[] axis;
...@@ -87,20 +87,36 @@ public class ProjectionAxis { ...@@ -87,20 +87,36 @@ 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) {
return projectToPlane(plane, v.getX(), v.getY()); return projectToPlane(plane, v.getX(), v.getY());
} }
/** /**
* 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>
...@@ -65,11 +65,11 @@ ...@@ -65,11 +65,11 @@
<groupId>net.sf.saxon</groupId> <groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId> <artifactId>Saxon-HE</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<resources> <resources>
<resource> <resource>
......
...@@ -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