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