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
/CityDoctorParent/.idea/.gitignore
/CityDoctorParent/.idea/compiler.xml
/CityDoctorParent/.idea/encodings.xml
/CityDoctorParent/.idea/jarRepositories.xml
/CityDoctorParent/.idea/misc.xml
/CityDoctorParent/.idea/vcs.xml
...@@ -4,7 +4,7 @@ image: maven:3.8.6-eclipse-temurin-17 ...@@ -4,7 +4,7 @@ image: maven:3.8.6-eclipse-temurin-17
build: build:
script: script:
- cd CityDoctorParent - cd CityDoctorParent
- mvn verify - mvn verify -U
artifacts: artifacts:
when: always when: always
reports: reports:
......
...@@ -303,3 +303,8 @@ gradle-app.setting ...@@ -303,3 +303,8 @@ gradle-app.setting
*.hprof *.hprof
# End of https://www.toptal.com/developers/gitignore/api/gradle # End of https://www.toptal.com/developers/gitignore/api/gradle
/CityDoctorWebService/CityDoctorWebService.iml
/Extensions/CityDoctorWebService/CityDoctorWebService.iml
/.idea/codeStyles/codeStyleConfig.xml
/GUISettings.properties
/.idea/inspectionProfiles/Project_Default.xml
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://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>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
......
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
*/ */
package de.hft.stuttgart.citydoctor2.checkresult.utility; package de.hft.stuttgart.citydoctor2.checkresult.utility;
import java.io.Serial;
public class CheckReportParseException extends Exception { public class CheckReportParseException extends Exception {
@Serial
private static final long serialVersionUID = 6043371305010386110L; private static final long serialVersionUID = 6043371305010386110L;
public CheckReportParseException() { public CheckReportParseException() {
......
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
*/ */
package de.hft.stuttgart.citydoctor2.checkresult.utility; package de.hft.stuttgart.citydoctor2.checkresult.utility;
import java.io.Serial;
public class CheckReportWriteException extends Exception { public class CheckReportWriteException extends Exception {
@Serial
private static final long serialVersionUID = 1769358555887675233L; private static final long serialVersionUID = 1769358555887675233L;
public CheckReportWriteException() { public CheckReportWriteException() {
......
...@@ -34,7 +34,7 @@ public class IndentationXmlStreamWriter implements XMLStreamWriter { ...@@ -34,7 +34,7 @@ public class IndentationXmlStreamWriter implements XMLStreamWriter {
private static final String INDENTATION = " "; private static final String INDENTATION = " ";
private XMLStreamWriter writer; private final XMLStreamWriter writer;
private int depth = -1; private int depth = -1;
boolean sameElement = true; boolean sameElement = true;
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://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>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
...@@ -25,8 +26,8 @@ import java.util.Set; ...@@ -25,8 +26,8 @@ import java.util.Set;
public class BaseEntity { public class BaseEntity {
private List<BaseEntity> parents = new ArrayList<>(2); private final List<BaseEntity> parents = new ArrayList<>(2);
private List<BaseEntity> children = new ArrayList<>(2); private final List<BaseEntity> children = new ArrayList<>(2);
public void addChild(BaseEntity e) { public void addChild(BaseEntity e) {
children.add(e); children.add(e);
......
...@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge; ...@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge;
public class Box2d { public class Box2d {
private Point2d mMin; private final Point2d mMin;
private Point2d mMax; private final Point2d mMax;
public Box2d(Point2d min, Point2d max) { public Box2d(Point2d min, Point2d max) {
mMin = min; mMin = min;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -30,7 +31,7 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d; ...@@ -30,7 +31,7 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class CDPolygonNs extends PolygonNs { public class CDPolygonNs extends PolygonNs {
private List<List<HalfEdge>> innerHalfEdges = new ArrayList<>(); private final List<List<HalfEdge>> innerHalfEdges = new ArrayList<>();
public static CDPolygonNs of(Polygon p, Map<Vector3d, Coordinate3d> pointMap) { public static CDPolygonNs of(Polygon p, Map<Vector3d, Coordinate3d> pointMap) {
List<List<Coordinate3d>> loopCoordinates = new ArrayList<>(); List<List<Coordinate3d>> loopCoordinates = new ArrayList<>();
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
...@@ -25,7 +26,7 @@ import java.util.Set; ...@@ -25,7 +26,7 @@ import java.util.Set;
public class Coordinate3d extends BaseEntity { public class Coordinate3d extends BaseEntity {
private Point3d point; private final Point3d point;
public Coordinate3d(Point3d point) { public Coordinate3d(Point3d point) {
this.point = point; this.point = point;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -25,8 +26,8 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon; ...@@ -25,8 +26,8 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
public class EdgePolygon extends BaseEntity { public class EdgePolygon extends BaseEntity {
private Polygon original; private final Polygon original;
private List<HalfEdge> halfEdges; private final List<HalfEdge> halfEdges;
public EdgePolygon(List<HalfEdge> halfEdges, Polygon original) { public EdgePolygon(List<HalfEdge> halfEdges, Polygon original) {
for (HalfEdge he : halfEdges) { for (HalfEdge he : halfEdges) {
...@@ -80,12 +81,6 @@ public class EdgePolygon extends BaseEntity { ...@@ -80,12 +81,6 @@ public class EdgePolygon extends BaseEntity {
for (HalfEdge he : halfEdges) { for (HalfEdge he : halfEdges) {
coords.add(he.getStart()); coords.add(he.getStart());
} }
// HalfEdge firstHE = Objects.requireNonNull(getFirstHalfEdge());
// HalfEdge currHE = firstHE;
// do {
// coords.add(currHE.getStart());
// currHE = currHE.getNext();
// } while (currHE != firstHE);
return coords; return coords;
} }
...@@ -97,15 +92,13 @@ public class EdgePolygon extends BaseEntity { ...@@ -97,15 +92,13 @@ public class EdgePolygon extends BaseEntity {
} }
/** /**
* Test whether the given point is lying in- or outside of the non self * Test whether the given point is lying inside the non-self-
* intersecting, planar polygon. It's believed, that point and polygon are lying * intersecting, planar polygon. It's believed, that point and polygon are lying
* in the same plane. <br> * in the same plane. <br>
* <br> * <br>
* It's assumed, that the polygon is non self intersecting and planar. * It's assumed, that the polygon is non-self-intersecting and planar, and that the point is
* Additionally it is assumed, that the point and the polygon lying in the same * lying in the same plane. The given point is projected on the plane of the polygon. If the point is lying on an edge
* plane. The given point is projected on the plane of the polygon. If the point * of the polygon, it is considered to be inside.
* is lying on an edge of the polygon it's supposed that the point is inside of
* the polygon
* *
* @param rcPoint The point that should be checked * @param rcPoint The point that should be checked
* *
......
...@@ -18,26 +18,27 @@ ...@@ -18,26 +18,27 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.Comparator; import java.util.Comparator;
public class Global { public class Global {
private static final double DBL_EPSILON = 2.2204460492503131e-16; private static final double DBL_EPSILON = 2.2204460492503131e-16;
private static double mZeroAngleCosinus = 1.0e-9; private static final double M_ZERO_ANGLE_COSINE = 1.0e-9;
private static double mTolVectorsParallel = 1e-9; private static final double M_TOL_VECTORS_PARALLEL = 1e-9;
private static double mHighAccuracyTol = DBL_EPSILON * 5; private static final double M_HIGH_ACCURACY_TOL = DBL_EPSILON * 5;
private static double mTolPointsEqual = 1e-3; private static final double M_TOL_POINTS_EQUAL = 1e-3;
private Global() { private Global() {
} }
public static double getTolPointsEquals() { public static double getTolPointsEquals() {
return mTolPointsEqual; return M_TOL_POINTS_EQUAL;
} }
public static double getHighAccuracyTolerance() { public static double getHighAccuracyTolerance() {
return mHighAccuracyTol; return M_HIGH_ACCURACY_TOL;
} }
public static Comparator<Double> getDoubleTolCompare(double epsilon) { public static Comparator<Double> getDoubleTolCompare(double epsilon) {
...@@ -50,12 +51,10 @@ public class Global { ...@@ -50,12 +51,10 @@ public class Global {
}; };
} }
public static double getZeroAngleCosinus() { public static double getZeroAngleCosine() { return M_ZERO_ANGLE_COSINE; }
return mZeroAngleCosinus;
}
public static double getTolVectorsParallel() { public static double getTolVectorsParallel() {
return mTolVectorsParallel; return M_TOL_VECTORS_PARALLEL;
} }
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class GmBoundedStraight2d extends GmStraight2d { public class GmBoundedStraight2d extends GmStraight2d {
private double length; private double length;
...@@ -54,10 +55,7 @@ public class GmBoundedStraight2d extends GmStraight2d { ...@@ -54,10 +55,7 @@ public class GmBoundedStraight2d extends GmStraight2d {
parameter = length; parameter = length;
} }
if (0 <= parameter && parameter <= length) { return 0 <= parameter && parameter <= length;
return true;
}
return false;
} }
public double getLength() { public double getLength() {
......
...@@ -18,29 +18,31 @@ ...@@ -18,29 +18,31 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class GmPlane { public class GmPlane {
private Point3d x0; private final Point3d x0;
private UnitVector3d r1; private final UnitVector3d r1;
private UnitVector3d r2; private final UnitVector3d r2;
private UnitVector3d n; private final UnitVector3d n;
private double d; private final double d;
public GmPlane(Point3d point, UnitVector3d normalVector) { public GmPlane(Point3d point, UnitVector3d normalVector) {
x0 = point; x0 = point;
n = normalVector; n = normalVector;
d = new Vector3d(point).dot(n); d = new Vector3d(point).dot(n);
r1 = UnitVector3d.of(n.getZ(), n.getX(), n.getY()); UnitVector3d r = UnitVector3d.of(n.getZ(), n.getX(), n.getY());
r2 = n.cross(r1).toUnitVector(); r2 = n.cross(r).toUnitVector();
// r1 ist nicht in allen Faellen rechtwinklig zur Flaechennormalen // r is not always perpendicular to the plane's normal vector,
// daher nochmal eine neu Berechnung; // recalculate using r2
// ---------------------------------------------------------------- // ----------------------------------------------------------------
r1 = n.cross(r2).toUnitVector(); r1 = n.cross(r2).toUnitVector();
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class GmStraight { public class GmStraight {
private Point3d org; private final Point3d org;
private UnitVector3d dir; private final UnitVector3d dir;
public GmStraight(Point3d org, Vector3d dir) { public GmStraight(Point3d org, Vector3d dir) {
this.org = org; this.org = org;
...@@ -54,7 +55,7 @@ public class GmStraight { ...@@ -54,7 +55,7 @@ public class GmStraight {
return dir; return dir;
} }
public boolean isColinear(GmStraight straight2, double angleEpsilon, double epsilon) { public boolean isCollinear(GmStraight straight2, double angleEpsilon, double epsilon) {
UnitVector3d rDir1 = getDir(); UnitVector3d rDir1 = getDir();
UnitVector3d rDir2 = straight2.getDir(); UnitVector3d rDir2 = straight2.getDir();
...@@ -74,11 +75,7 @@ public class GmStraight { ...@@ -74,11 +75,7 @@ public class GmStraight {
Point3d rOrigin2 = straight2.getOrigin(); Point3d rOrigin2 = straight2.getOrigin();
Point3d foot2 = project(rOrigin2).getPoint(); Point3d foot2 = project(rOrigin2).getPoint();
if ((foot2.minus(rOrigin2)).getLength() > epsilon) { return ((foot2.minus(rOrigin2)).getLength() <= epsilon);
return false;
}
return true;
} }
public Point3d getOrigin() { public Point3d getOrigin() {
......
...@@ -18,10 +18,12 @@ ...@@ -18,10 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class GmStraight2d { public class GmStraight2d {
private Point2d origin; private final Point2d origin;
private UnitVector2d direction; private final UnitVector2d direction;
public GmStraight2d(Point2d org, UnitVector2d dir) { public GmStraight2d(Point2d org, UnitVector2d dir) {
this.direction = dir; this.direction = dir;
...@@ -39,14 +41,13 @@ public class GmStraight2d { ...@@ -39,14 +41,13 @@ public class GmStraight2d {
} }
/** /**
* Just intersects two GmStraights2d. * Intersects this straight with another straight.
*
* <br> * <br>
* <br> * <br>
* If the two straights are parallel the method will return false, so the user * If the two straights are parallel, areParallel in the returned IntersectionResult will be true.
* has to determine, if the straight are just parallel or identical * This method will not differentiate between parallel and identical straights.
* *
* @param other First Straight * @param other the other straight
* *
* @return intersection result * @return intersection result
*/ */
...@@ -60,7 +61,7 @@ public class GmStraight2d { ...@@ -60,7 +61,7 @@ public class GmStraight2d {
Vector2d r2Perpendicular = r2.getPerpendicularVector(); Vector2d r2Perpendicular = r2.getPerpendicularVector();
double diff = r1.dot(r2Perpendicular); double diff = r1.dot(r2Perpendicular);
if (Math.abs(diff) < Global.getZeroAngleCosinus()) { if (Math.abs(diff) < Global.getZeroAngleCosine()) {
return GmStraight2dIntersectionResult.parallel(this, other); return GmStraight2dIntersectionResult.parallel(this, other);
} else { } else {
double invR1DotPerpR2 = 1.0 / diff; double invR1DotPerpR2 = 1.0 / diff;
......
...@@ -18,15 +18,9 @@ ...@@ -18,15 +18,9 @@
*/ */
package de.hft.stuttgart.citydoctor2.edge; package de.hft.stuttgart.citydoctor2.edge;
public class GmStraight2dIntersectionResult {
private double paramHE; public record GmStraight2dIntersectionResult(double paramHE, double paramInt, GmStraight2d straightHE,
private double paramInt; GmStraight2d straightInt, boolean areParallel) {
private GmStraight2d straightHE;
private GmStraight2d straightInt;
private boolean areParallel;
public static GmStraight2dIntersectionResult parallel(GmStraight2d s1, GmStraight2d s2) { public static GmStraight2dIntersectionResult parallel(GmStraight2d s1, GmStraight2d s2) {
return new GmStraight2dIntersectionResult(0, 0, s1, s2, true); return new GmStraight2dIntersectionResult(0, 0, s1, s2, true);
...@@ -37,33 +31,5 @@ public class GmStraight2dIntersectionResult { ...@@ -37,33 +31,5 @@ public class GmStraight2dIntersectionResult {
return new GmStraight2dIntersectionResult(paramHE, paramInt, straightHE, straightInt, false); return new GmStraight2dIntersectionResult(paramHE, paramInt, straightHE, straightInt, false);
} }
private GmStraight2dIntersectionResult(double paramHE, double paramInt, GmStraight2d straightHE,
GmStraight2d straightInt, boolean areParallel) {
this.paramHE = paramHE;
this.paramInt = paramInt;
this.straightHE = straightHE;
this.straightInt = straightInt;
this.areParallel = areParallel;
}
public double getParamHE() {
return paramHE;
}
public double getParamInt() {
return paramInt;
}
public GmStraight2d getStraightHE() {
return straightHE;
}
public GmStraight2d getStraightInt() {
return straightInt;
}
public boolean areParallel() {
return areParallel;
}
} }
...@@ -108,7 +108,7 @@ public class HalfEdge extends BaseEntity { ...@@ -108,7 +108,7 @@ public class HalfEdge extends BaseEntity {
HalfEdge pNextPartner = this.partner; HalfEdge pNextPartner = this.partner;
while (pNextPartner != this) { while (pNextPartner != this) {
if (pNextPartner == partner) { if (pNextPartner == partner) {
logger.debug("(HalfEdge " + partner + " already exits in chain"); logger.debug(String.format("(HalfEdge %s already exits in chain", partner));
return; return;
} }
pNextPartner = pNextPartner.partner; pNextPartner = pNextPartner.partner;
...@@ -141,7 +141,7 @@ public class HalfEdge extends BaseEntity { ...@@ -141,7 +141,7 @@ public class HalfEdge extends BaseEntity {
pPreviousPartner.partner = this; pPreviousPartner.partner = this;
this.partner = partner; this.partner = partner;
} else { } else {
/** /*
* TODO : das riecht nach einer Ringverzeigerung : 3 Polygonraender treffen auf * TODO : das riecht nach einer Ringverzeigerung : 3 Polygonraender treffen auf
* einander * einander
*/ */
......
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