Commit 81be0b1d authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev_GUI' into 'dev'

Open source release of CityDoctorGUI and other extensions.

See merge request !6
parents 12d96d95 5a4d0a74
Pipeline #10056 passed with stage
in 1 minute and 6 seconds
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
......@@ -48,16 +49,17 @@ public class Geometry extends GmlElement {
private static final String FAILED_REMOVING_POLYGON = "Removing polygon %s but polygon is not in geometry";
@Serial
private static final long serialVersionUID = 2539031030917731575L;
private static Random r = new Random();
private static final Random r = new Random();
private GeometryType type;
private Lod lod;
private final Lod lod;
private CityObject parent;
private List<Polygon> polygons = new ArrayList<>(2);
private final List<Polygon> polygons = new ArrayList<>(2);
private List<Edge> edges;
private Map<SerializablePair<Vertex, Vertex>, Edge> edgeMap;
private List<Vertex> vertices;
......@@ -153,7 +155,7 @@ public class Geometry extends GmlElement {
}
// only go to size -1 as ring should be closed
for (int i = 0; i < ring.getVertices().size() - 1; i++) {
Vertex v0 = ring.getVertices().get(i + 0);
Vertex v0 = ring.getVertices().get(i);
Vertex v1 = ring.getVertices().get(i + 1);
Edge tempEdge = new Edge(v0, v1);
Edge e = duplicacyMap.get(tempEdge);
......
......@@ -22,6 +22,8 @@ import de.hft.stuttgart.citydoctor2.check.Checkable;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial;
/**
* A general GML element that has a gml id
*
......@@ -30,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public abstract class GmlElement extends Checkable implements Copyable {
@Serial
private static final long serialVersionUID = -3242505393303017359L;
private GmlId gmlId;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -30,14 +31,15 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class GmlId implements Serializable {
@Serial
private static final long serialVersionUID = 4273817255150972966L;
/* prefixes for generation */
private static final String GENERAL_GEN = "CityDoctor_%d_%d";
private static final AtomicInteger ID_COUNTER = new AtomicInteger();
private String gmlString;
private boolean generated;
private final String gmlString;
private final boolean generated;
public GmlId(String gmlId) {
this(gmlId, false);
......@@ -85,13 +87,8 @@ public class GmlId implements Serializable {
return false;
}
if (gmlString == null) {
if (other.gmlString != null) {
return false;
}
} else if (!gmlString.equals(other.gmlString)) {
return false;
}
return true;
return other.gmlString == null;
} else return gmlString.equals(other.gmlString);
}
/**
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -41,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class Installation extends CityObject {
@Serial
private static final long serialVersionUID = 1576237433322680191L;
private List<BoundarySurface> boundarySurfaces = new ArrayList<>(4);
......
......@@ -29,6 +29,8 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial;
/**
* Represents a land use CityGML object.
*
......@@ -37,6 +39,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class LandObject extends CityObject {
@Serial
private static final long serialVersionUID = 1887455662411087326L;
private LandUse lu;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -38,12 +39,13 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class LinearRing extends GmlElement {
@Serial
private static final long serialVersionUID = -2488180830514940722L;
private LinearRingType type;
private Polygon parent;
private List<Vertex> vertices = new ArrayList<>();
private final List<Vertex> vertices = new ArrayList<>();
public enum LinearRingType {
EXTERIOR, INTERIOR
......@@ -130,7 +132,7 @@ public class LinearRing extends GmlElement {
public Vector3d calculateNormal() {
double[] coords = new double[3];
for (int i = 0; i < vertices.size() - 1; i++) {
Vertex current = vertices.get(i + 0);
Vertex current = vertices.get(i);
Vertex next = vertices.get(i + 1);
coords[0] += (current.getZ() + next.getZ()) * (current.getY() - next.getY());
coords[1] += (current.getX() + next.getX()) * (current.getZ() - next.getZ());
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.List;
import java.util.Map;
......@@ -39,6 +40,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class LinkedPolygon extends Polygon {
@Serial
private static final long serialVersionUID = -4897578390280277931L;
private Geometry parent;
......
......@@ -28,7 +28,7 @@ public enum Lod {
LOD0(0), LOD1(1), LOD2(2), LOD3(3), LOD4(4);
private int rank;
private final int rank;
private Lod(int rank) {
this.rank = rank;
......
......@@ -30,6 +30,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial;
/**
* Represents an Opening suchs a window or Door in a surface of a feature.
* Contains a reference to the boundary surface where this opening is embedded
......@@ -40,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class Opening extends CityObject {
@Serial
private static final long serialVersionUID = 6409303152284607944L;
private BoundarySurface partOf;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.List;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
......@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.tesselation.TesselatedPolygon;
*/
public abstract class Polygon extends GmlElement {
@Serial
private static final long serialVersionUID = -613942946364706513L;
public abstract Vector3d calculateNormalNormalized();
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -33,11 +34,12 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class ReliefObject extends CityObject {
@Serial
private static final long serialVersionUID = -9162169874426519903L;
private ReliefFeature feature;
private final ReliefFeature feature;
private List<TinObject> components = new ArrayList<>();
private final List<TinObject> components = new ArrayList<>();
public ReliefObject(ReliefFeature feature) {
this.feature = feature;
......
......@@ -26,6 +26,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
*/
public enum SurfaceFeatureType {
BUILDING, BRIDGE, TUNNEL;
BUILDING, BRIDGE, TUNNEL
}
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -38,9 +39,10 @@ public class TinObject extends CityObject {
private static final Logger logger = LogManager.getLogger(TinObject.class);
@Serial
private static final long serialVersionUID = 1910744427384724422L;
private TINRelief gmlRelief;
private final TINRelief gmlRelief;
public TinObject(TINRelief gmlRelief) {
this.gmlRelief = gmlRelief;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -46,6 +47,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class TransportationObject extends CityObject {
@Serial
private static final long serialVersionUID = -2698907271726700390L;
public enum TransportationType {
......@@ -53,8 +55,8 @@ public class TransportationObject extends CityObject {
}
private AbstractCityObject ato;
private List<TransportationObject> composesOf = new ArrayList<>(1);
private TransportationType type;
private final List<TransportationObject> composesOf = new ArrayList<>(1);
private final TransportationType type;
public TransportationObject(TransportationType type) {
this.type = type;
......@@ -234,11 +236,7 @@ public class TransportationObject extends CityObject {
@Override
public void unsetGmlGeometries() {
switch (type) {
case ROAD:
case TRACK:
case RAILWAY:
case SQUARE:
case TRANSPORTATION_COMPLEX:
case ROAD, TRACK, RAILWAY, SQUARE,TRANSPORTATION_COMPLEX:
AbstractTransportationSpace tc = (AbstractTransportationSpace) ato;
tc.getDeprecatedProperties().setLod1MultiSurface(null);
tc.setLod2MultiSurface(null);
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.Collections;
import org.citygml4j.core.model.core.AbstractCityObject;
......@@ -45,6 +46,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class Vegetation extends CityObject {
@Serial
private static final long serialVersionUID = -5136358065541704146L;
public enum VegetationType {
......@@ -52,7 +54,7 @@ public class Vegetation extends CityObject {
}
private AbstractVegetationObject citygmlVegetation;
private VegetationType type;
private final VegetationType type;
public Vegetation(VegetationType type) {
this.type = type;
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
......@@ -36,6 +37,7 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
*/
public class Vertex extends Vector3d implements Copyable {
@Serial
private static final long serialVersionUID = -5525361920397934892L;
private List<SerializablePair<Geometry, HashSet<LinearRing>>> adjacentRings = new ArrayList<>(2);
......
......@@ -18,6 +18,7 @@
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
......@@ -41,10 +42,11 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
public class WaterObject extends CityObject {
@Serial
private static final long serialVersionUID = -3821060595086337424L;
private WaterBody gmlWater;
private List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
......
......@@ -18,8 +18,11 @@
*/
package de.hft.stuttgart.citydoctor2.exceptions;
import java.io.Serial;
public class CityDoctorWriteException extends Exception {
@Serial
private static final long serialVersionUID = 2902212162405599516L;
public CityDoctorWriteException() {
......
......@@ -114,14 +114,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private static final Logger logger = LogManager.getLogger(Citygml3FeatureMapper.class);
private CityDoctorModel model;
private final CityDoctorModel model;
private Map<String, ConcretePolygon> polygonMap = new HashMap<>();
private List<ResolvableReference> references = new ArrayList<>();
private Map<Vertex, Vertex> vertexMap = new HashMap<>();
private ParserConfiguration config;
private final ParserConfiguration config;
private double neighborDistance;
private final double neighborDistance;
public Citygml3FeatureMapper(ParserConfiguration config, Path path) {
this.config = config;
......
......@@ -46,12 +46,12 @@ public class Citygml3GeometryMapper extends GeometryWalker {
private static final Logger logger = LogManager.getLogger(Citygml3GeometryMapper.class);
private List<ConcretePolygon> polygons = new ArrayList<>();
private final List<ConcretePolygon> polygons = new ArrayList<>();
private LinearRing currentRing = null;
private ParserConfiguration config;
private ProjCoordinate p1 = new ProjCoordinate();
private ProjCoordinate p2 = new ProjCoordinate();
private Map<Vertex, Vertex> vertexMap;
private final ParserConfiguration config;
private final ProjCoordinate p1 = new ProjCoordinate();
private final ProjCoordinate p2 = new ProjCoordinate();
private final Map<Vertex, Vertex> vertexMap;
public Citygml3GeometryMapper(ParserConfiguration config, Map<Vertex, Vertex> vertices) {
this.config = config;
......@@ -62,7 +62,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public void visit(Polygon polygon) {
parsePolygon(polygon.getId(), polygon.getExterior(), polygon.getInterior());
if (polygon.getExterior() == null) {
System.out.println("No exterior: " + polygon.getId());
logger.warn(String.format("No exterior: %s" ,polygon.getId()));
}
}
......@@ -132,7 +132,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
logger.warn("The number of coordinates for linear ring {} do not result in fully 3D points", id);
}
for (int i = 0; i < coordinates.size(); i = i + 3) {
double x = coordinates.get(i + 0);
double x = coordinates.get(i);
double y = coordinates.get(i + 1);
double z = coordinates.get(i + 2);
createVertex(x, y, z);
......
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