Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
1745865f
Commit
1745865f
authored
Aug 08, 2024
by
Riegel
Browse files
Code cleaning Ref
#69
parent
5a6f4b46
Changes
163
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/MeshSurfaceUtils.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
public
class
MeshSurfaceUtils
{
public
static
List
<
PolygonPolygonIntersection
>
selfIntersects
(
MeshSurface
ms
,
double
epsilon
,
double
angleEpsilon
)
{
Objects
.
requireNonNull
(
ms
);
List
<
CDPolygonNs
>
polygons
=
ms
.
getPolygons
();
List
<
PolygonPolygonIntersection
>
intersections
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
polygons
.
size
()
-
1
;
i
++)
{
EdgePolygon
p1
=
polygons
.
get
(
i
);
for
(
int
j
=
i
+
1
;
j
<
polygons
.
size
();
j
++)
{
EdgePolygon
p2
=
polygons
.
get
(
j
);
List
<
PolygonPolygonIntersection
>
result
=
IntersectPlanarPolygons
.
intersectPolygons
(
p1
,
p2
,
epsilon
,
angleEpsilon
);
intersections
.
addAll
(
result
);
}
}
return
intersections
;
}
private
MeshSurfaceUtils
()
{
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
public
class
MeshSurfaceUtils
{
public
static
List
<
PolygonPolygonIntersection
>
selfIntersects
(
MeshSurface
ms
,
double
epsilon
,
double
angleEpsilon
)
{
Objects
.
requireNonNull
(
ms
);
List
<
CDPolygonNs
>
polygons
=
ms
.
polygons
();
List
<
PolygonPolygonIntersection
>
intersections
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
polygons
.
size
()
-
1
;
i
++)
{
EdgePolygon
p1
=
polygons
.
get
(
i
);
for
(
int
j
=
i
+
1
;
j
<
polygons
.
size
();
j
++)
{
EdgePolygon
p2
=
polygons
.
get
(
j
);
List
<
PolygonPolygonIntersection
>
result
=
IntersectPlanarPolygons
.
intersectPolygons
(
p1
,
p2
,
epsilon
,
angleEpsilon
);
intersections
.
addAll
(
result
);
}
}
return
intersections
;
}
private
MeshSurfaceUtils
()
{
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Point2d.java
View file @
1745865f
...
...
@@ -20,8 +20,8 @@ package de.hft.stuttgart.citydoctor2.edge;
public
class
Point2d
{
private
double
x
;
private
double
y
;
private
final
double
x
;
private
final
double
y
;
public
Point2d
(
double
x
,
double
y
)
{
this
.
x
=
x
;
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Point3d.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Point3d
{
private
double
x
;
private
double
y
;
private
double
z
;
public
Point3d
(
double
x
,
double
y
,
double
z
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
z
=
z
;
}
public
Point3d
(
double
[]
values
)
{
this
(
values
[
0
],
values
[
1
],
values
[
2
]);
}
public
Point3d
(
Point3d
p
)
{
this
(
p
.
getX
(),
p
.
getY
(),
p
.
getZ
());
}
public
boolean
isAlmostEqual
(
Point3d
origin
,
double
eps
)
{
Vector3d
vec
=
minus
(
origin
);
double
localEps
=
eps
*
eps
;
if
(
localEps
<
Global
.
getHighAccuracyTolerance
())
{
localEps
=
Global
.
getHighAccuracyTolerance
();
}
return
vec
.
getLength2
()
<
localEps
;
}
public
Vector3d
minus
(
Point3d
org
)
{
return
new
Vector3d
(
x
-
org
.
getX
(),
y
-
org
.
getY
(),
z
-
org
.
getZ
());
}
public
Point3d
plus
(
Vector3d
v
)
{
return
new
Point3d
(
x
+
v
.
getX
(),
y
+
v
.
getY
(),
z
+
v
.
getZ
());
}
public
double
getX
()
{
return
x
;
}
public
double
getY
()
{
return
y
;
}
public
double
getZ
()
{
return
z
;
}
public
Point3d
plus
(
Point3d
point
)
{
return
new
Point3d
(
x
+
point
.
getX
(),
y
+
point
.
getY
(),
z
+
point
.
getZ
());
}
public
Point3d
div
(
double
d
)
{
return
new
Point3d
(
x
/
d
,
y
/
d
,
z
/
d
);
}
@Override
public
String
toString
()
{
return
"Point3d [x="
+
x
+
", y="
+
y
+
", z="
+
z
+
"]"
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
long
temp
;
temp
=
Double
.
doubleToLongBits
(
x
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
y
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
z
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
Point3d
other
=
(
Point3d
)
obj
;
if
(
Double
.
doubleToLongBits
(
x
)
!=
Double
.
doubleToLongBits
(
other
.
x
))
return
false
;
if
(
Double
.
doubleToLongBits
(
y
)
!=
Double
.
doubleToLongBits
(
other
.
y
))
return
false
;
if
(
Double
.
doubleToLongBits
(
z
)
!=
Double
.
doubleToLongBits
(
other
.
z
))
return
false
;
return
true
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Point3d
{
private
final
double
x
;
private
final
double
y
;
private
final
double
z
;
public
Point3d
(
double
x
,
double
y
,
double
z
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
z
=
z
;
}
public
Point3d
(
double
[]
values
)
{
this
(
values
[
0
],
values
[
1
],
values
[
2
]);
}
public
Point3d
(
Point3d
p
)
{
this
(
p
.
getX
(),
p
.
getY
(),
p
.
getZ
());
}
public
boolean
isAlmostEqual
(
Point3d
origin
,
double
eps
)
{
Vector3d
vec
=
minus
(
origin
);
double
localEps
=
eps
*
eps
;
if
(
localEps
<
Global
.
getHighAccuracyTolerance
())
{
localEps
=
Global
.
getHighAccuracyTolerance
();
}
return
vec
.
getLength2
()
<
localEps
;
}
public
Vector3d
minus
(
Point3d
org
)
{
return
new
Vector3d
(
x
-
org
.
getX
(),
y
-
org
.
getY
(),
z
-
org
.
getZ
());
}
public
Point3d
plus
(
Vector3d
v
)
{
return
new
Point3d
(
x
+
v
.
getX
(),
y
+
v
.
getY
(),
z
+
v
.
getZ
());
}
public
double
getX
()
{
return
x
;
}
public
double
getY
()
{
return
y
;
}
public
double
getZ
()
{
return
z
;
}
public
Point3d
plus
(
Point3d
point
)
{
return
new
Point3d
(
x
+
point
.
getX
(),
y
+
point
.
getY
(),
z
+
point
.
getZ
());
}
public
Point3d
div
(
double
d
)
{
return
new
Point3d
(
x
/
d
,
y
/
d
,
z
/
d
);
}
@Override
public
String
toString
()
{
return
"Point3d [x="
+
x
+
", y="
+
y
+
", z="
+
z
+
"]"
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
long
temp
;
temp
=
Double
.
doubleToLongBits
(
x
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
y
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
z
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
Point3d
other
=
(
Point3d
)
obj
;
if
(
Double
.
doubleToLongBits
(
x
)
!=
Double
.
doubleToLongBits
(
other
.
x
))
return
false
;
if
(
Double
.
doubleToLongBits
(
y
)
!=
Double
.
doubleToLongBits
(
other
.
y
))
return
false
;
if
(
Double
.
doubleToLongBits
(
z
)
!=
Double
.
doubleToLongBits
(
other
.
z
))
return
false
;
return
true
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLine2d.java
View file @
1745865f
...
...
@@ -23,7 +23,7 @@ import java.util.List;
public
class
PolyLine2d
extends
BaseEntity
{
private
PolyLineSegment2d
mpFirst
;
private
final
PolyLineSegment2d
mpFirst
;
private
PolyLineSegment2d
mpLast
;
public
PolyLine2d
(
PolyLineSegment2d
pStart
)
{
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLineSegment.java
View file @
1745865f
...
...
@@ -25,8 +25,8 @@ public class PolyLineSegment extends BaseEntity {
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
PolyLineSegment
.
class
);
private
Coordinate3d
mpStart
;
private
Coordinate3d
mpEnd
;
private
final
Coordinate3d
mpStart
;
private
final
Coordinate3d
mpEnd
;
private
PolyLineSegment
mpNext
;
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Polygon2d.java
View file @
1745865f
...
...
@@ -104,16 +104,14 @@ public class Polygon2d extends BaseEntity {
point
=
halfEdge
.
getStart
().
getPoint
();
lowerU
=
(
point
.
getX
()
<
lowerU
)
?
point
.
getX
()
:
lowerU
;
lowerV
=
(
point
.
getY
()
<
lowerV
)
?
point
.
getY
()
:
lowerV
;
lowerU
=
Math
.
min
(
point
.
getX
()
,
lowerU
)
;
lowerV
=
Math
.
min
(
point
.
getY
()
,
lowerV
)
;
upperU
=
(
point
.
getX
()
>
upperU
)
?
point
.
getX
()
:
upperU
;
upperV
=
(
point
.
getY
()
>
upperV
)
?
point
.
getY
()
:
upperV
;
upperU
=
Math
.
max
(
point
.
getX
()
,
upperU
)
;
upperV
=
Math
.
max
(
point
.
getY
()
,
upperV
)
;
}
Box2d
box
=
new
Box2d
(
new
Point2d
(
lowerU
,
lowerV
),
new
Point2d
(
upperU
,
upperV
));
return
box
;
return
new
Box2d
(
new
Point2d
(
lowerU
,
lowerV
),
new
Point2d
(
upperU
,
upperV
));
}
public
static
void
connectHalfEdges
(
List
<
HalfEdge2d
>
rHalfEdges
)
{
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Polygon2dPolygon2dInt.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Polygon2dPolygon2dInt
{
private
Polygon2d
mcpPolygon1
;
private
Polygon2d
mcpPolygon2
;
private
PolyLine2d
line
;
private
IntersectionType
intType
;
public
Polygon2dPolygon2dInt
(
Polygon2d
mcpPolygon1
,
Polygon2d
mcpPolygon2
,
PolyLine2d
line
,
IntersectionType
intType
)
{
this
.
mcpPolygon1
=
mcpPolygon1
;
this
.
mcpPolygon2
=
mcpPolygon2
;
this
.
line
=
line
;
this
.
intType
=
intType
;
}
public
PolyLine2d
getPolyLine2d
()
{
return
line
;
}
public
IntersectionType
getIntType
()
{
return
intType
;
}
public
Polygon2d
getPolygon1
()
{
return
mcpPolygon1
;
}
public
Polygon2d
getPolygon2
()
{
return
mcpPolygon2
;
}
@Override
public
String
toString
()
{
return
"Polygon2dPolygon2dInt [mcpPolygon1="
+
mcpPolygon1
+
", mcpPolygon2="
+
mcpPolygon2
+
", line="
+
line
+
", intType="
+
intType
+
"]"
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Polygon2dPolygon2dInt
{
private
final
Polygon2d
mcpPolygon1
;
private
final
Polygon2d
mcpPolygon2
;
private
final
PolyLine2d
line
;
private
final
IntersectionType
intType
;
public
Polygon2dPolygon2dInt
(
Polygon2d
mcpPolygon1
,
Polygon2d
mcpPolygon2
,
PolyLine2d
line
,
IntersectionType
intType
)
{
this
.
mcpPolygon1
=
mcpPolygon1
;
this
.
mcpPolygon2
=
mcpPolygon2
;
this
.
line
=
line
;
this
.
intType
=
intType
;
}
public
PolyLine2d
getPolyLine2d
()
{
return
line
;
}
public
IntersectionType
getIntType
()
{
return
intType
;
}
public
Polygon2d
getPolygon1
()
{
return
mcpPolygon1
;
}
public
Polygon2d
getPolygon2
()
{
return
mcpPolygon2
;
}
@Override
public
String
toString
()
{
return
"Polygon2dPolygon2dInt [mcpPolygon1="
+
mcpPolygon1
+
", mcpPolygon2="
+
mcpPolygon2
+
", line="
+
line
+
", intType="
+
intType
+
"]"
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolygonPolygonIntersection.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
PolygonPolygonIntersection
{
private
EdgePolygon
p1
;
private
EdgePolygon
p2
;
private
PolyLine
polyLine
;
private
IntersectionType
type
;
public
PolygonPolygonIntersection
(
EdgePolygon
p1
,
EdgePolygon
p2
,
PolyLine
polyLine
,
IntersectionType
type
)
{
this
.
p1
=
p1
;
this
.
p2
=
p2
;
this
.
polyLine
=
polyLine
;
this
.
type
=
type
;
}
public
PolygonPolygonIntersection
(
EdgePolygon
p1
,
EdgePolygon
p2
,
PolyLine
polyLine
)
{
this
(
p1
,
p2
,
polyLine
,
IntersectionType
.
NORMAL_INTERSECTION
);
}
public
PolyLine
getPolyLine
()
{
return
polyLine
;
}
public
IntersectionType
getIntersectionType
()
{
return
type
;
}
public
EdgePolygon
getPolygon1
()
{
return
p1
;
}
public
EdgePolygon
getPolygon2
()
{
return
p2
;
}
@Override
public
String
toString
()
{
return
"PolygonPolygonIntersection [p1="
+
p1
+
", p2="
+
p2
+
", polyLine="
+
polyLine
+
", type="
+
type
+
"]"
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
PolygonPolygonIntersection
{
private
final
EdgePolygon
p1
;
private
final
EdgePolygon
p2
;
private
final
PolyLine
polyLine
;
private
final
IntersectionType
type
;
public
PolygonPolygonIntersection
(
EdgePolygon
p1
,
EdgePolygon
p2
,
PolyLine
polyLine
,
IntersectionType
type
)
{
this
.
p1
=
p1
;
this
.
p2
=
p2
;
this
.
polyLine
=
polyLine
;
this
.
type
=
type
;
}
public
PolygonPolygonIntersection
(
EdgePolygon
p1
,
EdgePolygon
p2
,
PolyLine
polyLine
)
{
this
(
p1
,
p2
,
polyLine
,
IntersectionType
.
NORMAL_INTERSECTION
);
}
public
PolyLine
getPolyLine
()
{
return
polyLine
;
}
public
IntersectionType
getIntersectionType
()
{
return
type
;
}
public
EdgePolygon
getPolygon1
()
{
return
p1
;
}
public
EdgePolygon
getPolygon2
()
{
return
p2
;
}
@Override
public
String
toString
()
{
return
"PolygonPolygonIntersection [p1="
+
p1
+
", p2="
+
p2
+
", polyLine="
+
polyLine
+
", type="
+
type
+
"]"
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/ProjectedPoint3d.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
ProjectedPoint3d
{
private
Point3d
point
;
private
double
parameter
;
public
ProjectedPoint3d
(
Point3d
point
,
double
d
)
{
this
.
point
=
point
;
this
.
parameter
=
d
;
}
public
Point3d
getPoint
()
{
return
point
;
}
public
double
getParameter
()
{
return
parameter
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
ProjectedPoint3d
{
private
final
Point3d
point
;
private
final
double
parameter
;
public
ProjectedPoint3d
(
Point3d
point
,
double
d
)
{
this
.
point
=
point
;
this
.
parameter
=
d
;
}
public
Point3d
getPoint
()
{
return
point
;
}
public
double
getParameter
()
{
return
parameter
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/UnitVector3d.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
UnitVector3d
extends
Vector3d
{
public
static
UnitVector3d
of
(
Vector3d
vec
)
{
UnitVector3d
unitVec
=
new
UnitVector3d
(
vec
.
getX
(),
vec
.
getY
(),
vec
.
getZ
());
unitVec
.
normalize
();
return
unitVec
;
}
public
static
UnitVector3d
of
(
double
x
,
double
y
,
double
z
)
{
double
length
=
Math
.
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
return
new
UnitVector3d
(
x
/
length
,
y
/
length
,
z
/
length
);
}
private
UnitVector3d
(
double
x
,
double
y
,
double
z
)
{
super
(
x
,
y
,
z
);
}
public
double
dot
(
UnitVector3d
other
)
{
double
scalar
=
getX
()
*
other
.
getX
()
+
getY
()
*
other
.
getY
()
+
getZ
()
*
other
.
getZ
();
if
(
scalar
>
1.0
)
{
return
1.0
;
}
if
(
scalar
<
-
1.0
)
{
return
-
1.0
;
}
return
scalar
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
UnitVector3d
extends
Vector3d
{
public
static
UnitVector3d
of
(
Vector3d
vec
)
{
UnitVector3d
unitVec
=
new
UnitVector3d
(
vec
.
getX
(),
vec
.
getY
(),
vec
.
getZ
());
unitVec
.
normalize
();
return
unitVec
;
}
public
static
UnitVector3d
of
(
double
x
,
double
y
,
double
z
)
{
double
length
=
Math
.
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
return
new
UnitVector3d
(
x
/
length
,
y
/
length
,
z
/
length
);
}
private
UnitVector3d
(
double
x
,
double
y
,
double
z
)
{
super
(
x
,
y
,
z
);
}
public
double
dot
(
UnitVector3d
other
)
{
double
scalar
=
getX
()
*
other
.
getX
()
+
getY
()
*
other
.
getY
()
+
getZ
()
*
other
.
getZ
();
return
(
scalar
>=
0
)
?
Math
.
min
(
scalar
,
1.0
)
:
Math
.
max
(
scalar
,
-
1.0
);
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Vector2d.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Vector2d
{
private
double
x
;
private
double
y
;
public
Vector2d
(
double
x
,
double
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
}
public
Vector2d
getPerpendicularVector
()
{
return
new
Vector2d
(
y
,
-
x
);
}
public
double
dot
(
Vector2d
other
)
{
return
(
getX
()
*
other
.
getX
()
+
getY
()
*
other
.
getY
());
}
public
Vector2d
mult
(
double
scalar
)
{
return
new
Vector2d
(
x
*
scalar
,
y
*
scalar
);
}
public
double
getX
()
{
return
x
;
}
public
double
getY
()
{
return
y
;
}
public
UnitVector2d
normalize
()
{
return
UnitVector2d
.
convertFrom
(
this
);
}
public
double
getLength
()
{
return
Math
.
sqrt
(
getLength2
());
}
public
double
getLength2
()
{
return
x
*
x
+
y
*
y
;
}
@Override
public
String
toString
()
{
return
"Vector2d [x="
+
x
+
", y="
+
y
+
"]"
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
Vector2d
{
private
final
double
x
;
private
final
double
y
;
public
Vector2d
(
double
x
,
double
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
}
@SuppressWarnings
(
"SuspiciousNameCombination"
)
public
Vector2d
getPerpendicularVector
()
{
return
new
Vector2d
(
y
,
-
x
);
}
public
double
dot
(
Vector2d
other
)
{
return
(
getX
()
*
other
.
getX
()
+
getY
()
*
other
.
getY
());
}
public
Vector2d
mult
(
double
scalar
)
{
return
new
Vector2d
(
x
*
scalar
,
y
*
scalar
);
}
public
double
getX
()
{
return
x
;
}
public
double
getY
()
{
return
y
;
}
public
UnitVector2d
normalize
()
{
return
UnitVector2d
.
convertFrom
(
this
);
}
public
double
getLength
()
{
return
Math
.
sqrt
(
getLength2
());
}
public
double
getLength2
()
{
return
x
*
x
+
y
*
y
;
}
@Override
public
String
toString
()
{
return
"Vector2d [x="
+
x
+
", y="
+
y
+
"]"
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Vector3d.java
View file @
1745865f
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
import
java.util.Arrays
;
public
class
Vector3d
{
private
double
[]
val
=
new
double
[
3
];
public
Vector3d
(
double
x
,
double
y
,
double
z
)
{
val
[
0
]
=
x
;
val
[
1
]
=
y
;
val
[
2
]
=
z
;
}
public
Vector3d
(
Point3d
point
)
{
this
(
point
.
getX
(),
point
.
getY
(),
point
.
getZ
());
}
public
double
getLength
()
{
double
value
=
val
[
0
]
*
val
[
0
]
+
val
[
1
]
*
val
[
1
]
+
val
[
2
]
*
val
[
2
];
return
Math
.
sqrt
(
value
);
}
public
void
normalize
()
{
double
length
=
getLength
();
if
(
length
<
Global
.
getHighAccuracyTolerance
())
{
val
[
0
]
=
0
;
val
[
1
]
=
0
;
val
[
2
]
=
0
;
}
else
{
val
[
0
]
=
val
[
0
]
/=
length
;
val
[
1
]
=
val
[
1
]
/=
length
;
val
[
2
]
=
val
[
2
]
/=
length
;
}
}
public
Vector3d
cross
(
Vector3d
crV2
)
{
return
new
Vector3d
(
getY
()
*
crV2
.
getZ
()
-
crV2
.
getY
()
*
getZ
(),
getZ
()
*
crV2
.
getX
()
-
crV2
.
getZ
()
*
getX
(),
getX
()
*
crV2
.
getY
()
-
crV2
.
getX
()
*
getY
());
}
public
UnitVector3d
toUnitVector
()
{
return
UnitVector3d
.
of
(
this
);
}
public
Vector3d
mult
(
double
d
)
{
return
new
Vector3d
(
val
[
0
]
*
d
,
val
[
1
]
*
d
,
val
[
2
]
*
d
);
}
public
Vector3d
plus
(
Vector3d
other
)
{
return
new
Vector3d
(
getX
()
+
other
.
getX
(),
getY
()
+
other
.
getY
(),
getZ
()
+
other
.
getZ
());
}
public
double
getX
()
{
return
val
[
0
];
}
public
double
getY
()
{
return
val
[
1
];
}
public
double
getZ
()
{
return
val
[
2
];
}
public
double
getLength2
()
{
return
val
[
0
]
*
val
[
0
]
+
val
[
1
]
*
val
[
1
]
+
val
[
2
]
*
val
[
2
];
}
public
double
dot
(
Vector3d
crVector
)
{
return
this
.
val
[
0
]
*
crVector
.
getX
()
+
this
.
val
[
1
]
*
crVector
.
getY
()
+
this
.
val
[
2
]
*
crVector
.
getZ
();
}
public
static
boolean
areParallel
(
Vector3d
crV1
,
Vector3d
crV2
,
double
angleEpsilon
)
{
return
Math
.
abs
((
crV1
.
dot
(
crV2
))
-
(
crV1
.
getLength
()
*
crV2
.
getLength
()))
<
angleEpsilon
;
}
public
static
boolean
areAntiParallel
(
Vector3d
crV1
,
Vector3d
crV2
,
double
angleEpsilon
)
{
return
Math
.
abs
((
crV1
.
dot
(
crV2
))
+
(
crV1
.
getLength
()
*
crV2
.
getLength
()))
<
angleEpsilon
;
}
public
static
boolean
areAntiParallel
(
Vector3d
rDir1
,
Vector3d
rDir2
)
{
return
areAntiParallel
(
rDir1
,
rDir2
,
Global
.
getTolVectorsParallel
());
}
public
static
boolean
areParallel
(
Vector3d
rDir1
,
Vector3d
rDir2
)
{
return
areParallel
(
rDir1
,
rDir2
,
Global
.
getTolVectorsParallel
());
}
public
double
[]
toArray
()
{
return
Arrays
.
copyOf
(
val
,
3
);
}
@Override
public
String
toString
()
{
return
"Vector3d [val="
+
Arrays
.
toString
(
val
)
+
"]"
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
import
java.util.Arrays
;
public
class
Vector3d
{
private
final
double
[]
val
=
new
double
[
3
];
public
Vector3d
(
double
x
,
double
y
,
double
z
)
{
val
[
0
]
=
x
;
val
[
1
]
=
y
;
val
[
2
]
=
z
;
}
public
Vector3d
(
Point3d
point
)
{
this
(
point
.
getX
(),
point
.
getY
(),
point
.
getZ
());
}
public
double
getLength
()
{
double
value
=
val
[
0
]
*
val
[
0
]
+
val
[
1
]
*
val
[
1
]
+
val
[
2
]
*
val
[
2
];
return
Math
.
sqrt
(
value
);
}
public
void
normalize
()
{
double
length
=
getLength
();
if
(
length
<
Global
.
getHighAccuracyTolerance
())
{
val
[
0
]
=
0
;
val
[
1
]
=
0
;
val
[
2
]
=
0
;
}
else
{
val
[
0
]
/=
length
;
val
[
1
]
/=
length
;
val
[
2
]
/=
length
;
}
}
public
Vector3d
cross
(
Vector3d
crV2
)
{
return
new
Vector3d
(
getY
()
*
crV2
.
getZ
()
-
crV2
.
getY
()
*
getZ
(),
getZ
()
*
crV2
.
getX
()
-
crV2
.
getZ
()
*
getX
(),
getX
()
*
crV2
.
getY
()
-
crV2
.
getX
()
*
getY
());
}
public
UnitVector3d
toUnitVector
()
{
return
UnitVector3d
.
of
(
this
);
}
public
Vector3d
mult
(
double
d
)
{
return
new
Vector3d
(
val
[
0
]
*
d
,
val
[
1
]
*
d
,
val
[
2
]
*
d
);
}
public
Vector3d
plus
(
Vector3d
other
)
{
return
new
Vector3d
(
getX
()
+
other
.
getX
(),
getY
()
+
other
.
getY
(),
getZ
()
+
other
.
getZ
());
}
public
double
getX
()
{
return
val
[
0
];
}
public
double
getY
()
{
return
val
[
1
];
}
public
double
getZ
()
{
return
val
[
2
];
}
public
double
getLength2
()
{
return
val
[
0
]
*
val
[
0
]
+
val
[
1
]
*
val
[
1
]
+
val
[
2
]
*
val
[
2
];
}
public
double
dot
(
Vector3d
crVector
)
{
return
this
.
val
[
0
]
*
crVector
.
getX
()
+
this
.
val
[
1
]
*
crVector
.
getY
()
+
this
.
val
[
2
]
*
crVector
.
getZ
();
}
public
static
boolean
areParallel
(
Vector3d
crV1
,
Vector3d
crV2
,
double
angleEpsilon
)
{
return
Math
.
abs
((
crV1
.
dot
(
crV2
))
-
(
crV1
.
getLength
()
*
crV2
.
getLength
()))
<
angleEpsilon
;
}
public
static
boolean
areAntiParallel
(
Vector3d
crV1
,
Vector3d
crV2
,
double
angleEpsilon
)
{
return
Math
.
abs
((
crV1
.
dot
(
crV2
))
+
(
crV1
.
getLength
()
*
crV2
.
getLength
()))
<
angleEpsilon
;
}
public
static
boolean
areAntiParallel
(
Vector3d
rDir1
,
Vector3d
rDir2
)
{
return
areAntiParallel
(
rDir1
,
rDir2
,
Global
.
getTolVectorsParallel
());
}
public
static
boolean
areParallel
(
Vector3d
rDir1
,
Vector3d
rDir2
)
{
return
areParallel
(
rDir1
,
rDir2
,
Global
.
getTolVectorsParallel
());
}
public
double
[]
toArray
()
{
return
Arrays
.
copyOf
(
val
,
3
);
}
@Override
public
String
toString
()
{
return
"Vector3d [val="
+
Arrays
.
toString
(
val
)
+
"]"
;
}
}
CityDoctorParent/CityDoctorEdge/src/test/java/de/hft/stuttgart/citydoctor2/edge/IntersectionErrorsTest.java
View file @
1745865f
...
...
@@ -103,11 +103,11 @@ public class IntersectionErrorsTest {
}
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
CityDoctorParent/CityDoctorEdge/src/test/java/de/hft/stuttgart/citydoctor2/edge/MeshSurfaceUtilsTest.java
View file @
1745865f
...
...
@@ -77,7 +77,7 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v1
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
polygons
.
get
(
0
);
List
<
Coordinate3d
>
coordinates
=
edgePoly1
.
getCoordinates
();
...
...
@@ -147,7 +147,7 @@ public class MeshSurfaceUtilsTest {
List
<
Coordinate3d
>
coordChildren
=
firstHalfEdge
.
getChildren
(
Coordinate3d
.
class
);
assertEquals
(
2
,
coordChildren
.
size
());
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
assertNotNull
(
intersectPolygons
);
...
...
@@ -195,11 +195,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
assertNotNull
(
intersectPolygons
);
...
...
@@ -248,11 +248,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -311,11 +311,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v2
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -375,11 +375,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -429,11 +429,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -482,11 +482,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
DebugUtils
.
printGeoknechtPolygon
(
edgePoly1
,
edgePoly2
);
...
...
@@ -543,11 +543,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -596,11 +596,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v4
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
DebugUtils
.
printGeoknechtPolygon
(
edgePoly1
,
edgePoly2
);
...
...
@@ -652,11 +652,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -706,11 +706,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -760,11 +760,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -810,11 +810,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -866,11 +866,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -922,11 +922,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -978,11 +978,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v6
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -1049,11 +1049,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v5
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -1110,11 +1110,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v11
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -1173,11 +1173,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v11
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
@@ -1238,11 +1238,11 @@ public class MeshSurfaceUtilsTest {
ext
.
addVertex
(
v5
);
MeshSurface
meshSurface
=
MeshSurface
.
of
(
geom
);
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
getP
olygons
();
List
<
CDPolygonNs
>
polygons
=
meshSurface
.
p
olygons
();
assertEquals
(
2
,
polygons
.
size
());
CDPolygonNs
edgePoly1
=
meshSurface
.
getP
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
getP
olygons
().
get
(
1
);
CDPolygonNs
edgePoly1
=
meshSurface
.
p
olygons
().
get
(
0
);
CDPolygonNs
edgePoly2
=
meshSurface
.
p
olygons
().
get
(
1
);
List
<
PolygonPolygonIntersection
>
intersectPolygons
=
IntersectPlanarPolygons
.
intersectPolygons
(
edgePoly1
,
edgePoly2
,
0.000001
,
0.001
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Check.java
View file @
1745865f
...
...
@@ -67,7 +67,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
*/
public
abstract
class
Check
{
private
List
<
Class
<
Checkable
>>
applicableToClasses
=
new
ArrayList
<>(
2
);
private
final
List
<
Class
<
Checkable
>>
applicableToClasses
=
new
ArrayList
<>(
2
);
@SuppressWarnings
(
"unchecked"
)
protected
Check
()
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/CheckError.java
View file @
1745865f
...
...
@@ -39,7 +39,7 @@ public interface CheckError extends Serializable {
*
* @return the error type
*/
public
ErrorType
getType
();
public
ErrorType
getType
();
/**
* Getter for the error id
...
...
@@ -79,7 +79,7 @@ public interface CheckError extends Serializable {
* implementor of the error decides which information is written into the report
* or shown on the GUI.
*
* @param report
* @param report
the ErrorReport.
*/
public
void
report
(
ErrorReport
report
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/CheckId.java
View file @
1745865f
...
...
@@ -18,12 +18,14 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serial
;
import
java.io.Serializable
;
public
class
CheckId
implements
Serializable
{
public
record
CheckId
(
String
name
)
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
6267337828874296004L
;
public
static
final
CheckId
C_GE_R_TOO_FEW_POINTS
=
new
CheckId
(
"C_GE_R_TOO_FEW_POINTS"
);
public
static
final
CheckId
C_GE_R_NOT_CLOSED
=
new
CheckId
(
"C_GE_R_NOT_CLOSED"
);
public
static
final
CheckId
C_GE_S_MULTIPLE_CONNECTED_COMPONENTS
=
new
CheckId
(
...
...
@@ -54,24 +56,7 @@ public class CheckId implements Serializable {
public
static
final
CheckId
C_GE_S_NOT_CLOSED
=
new
CheckId
(
"C_GE_S_NOT_CLOSED"
);
public
static
final
CheckId
C_GE_P_ORIENTATION_RINGS_SAME
=
new
CheckId
(
"C_GE_P_ORIENTATION_RINGS_SAME"
);
public
static
final
CheckId
C_SE_POLYGON_WITHOUT_SURFACE
=
new
CheckId
(
"C_SE_POLYGON_WITHOUT_SURFACE"
);
private
String
name
;
public
CheckId
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/CheckResult.java
View file @
1745865f
...
...
@@ -18,6 +18,7 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serial
;
import
java.io.Serializable
;
/**
...
...
@@ -29,6 +30,7 @@ import java.io.Serializable;
*/
public
class
CheckResult
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
8775678793477525693L
;
private
final
CheckId
id
;
...
...
@@ -38,7 +40,7 @@ public class CheckResult implements Serializable {
/**
* Constructor for this container
*
* @param
c
the check which produced this result
* @param
id
the check which produced this result
* @param s the status of the result
* @param err an optional error object
*/
...
...
@@ -66,15 +68,7 @@ public class CheckResult implements Serializable {
@Override
public
String
toString
()
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"CheckResult [id="
);
builder
.
append
(
id
);
builder
.
append
(
", status="
);
builder
.
append
(
status
);
builder
.
append
(
", error="
);
builder
.
append
(
err
);
builder
.
append
(
"]"
);
return
builder
.
toString
();
return
String
.
format
(
"CheckResult [id=%s, status=%s, error=%s]"
,
id
,
status
,
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java
View file @
1745865f
...
...
@@ -18,6 +18,7 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -36,11 +37,12 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
*/
public
abstract
class
Checkable
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
1707871839265057882L
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Checkable
.
class
);
private
Map
<
CheckId
,
CheckResult
>
checkResults
=
new
HashMap
<>();
private
final
Map
<
CheckId
,
CheckResult
>
checkResults
=
new
HashMap
<>();
private
boolean
isValidated
=
false
;
protected
void
setValidated
(
boolean
validated
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/DefaultParameter.java
View file @
1745865f
...
...
@@ -18,6 +18,7 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serial
;
import
java.io.Serializable
;
/**
...
...
@@ -30,11 +31,12 @@ import java.io.Serializable;
*/
public
class
DefaultParameter
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
4587211298078974066L
;
private
String
name
;
private
String
value
;
private
Unit
unitType
;
private
final
String
name
;
private
final
String
value
;
private
final
Unit
unitType
;
public
DefaultParameter
(
String
name
,
String
defaultValue
,
Unit
unitType
)
{
this
.
name
=
name
;
...
...
Prev
1
2
3
4
5
6
…
9
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment