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
6d0d664e
Commit
6d0d664e
authored
Sep 10, 2026
by
Matthias Betz
Browse files
Merge remote-tracking branch 'remotes/origin/dev' into dev_baris_aabb_auto_mergeable
parents
a7ed4b64
cc4fe260
Pipeline
#12443
passed with stage
in 2 minutes and 42 seconds
Changes
133
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/gl/point.vert
0 → 100644
View file @
6d0d664e
#version 330 core
layout
(
location
=
0
)
in
vec3
aPos
;
layout
(
location
=
1
)
in
vec3
aColor
;
uniform
mat4
uMVP
;
out
vec3
vColorG
;
void
main
()
{
gl_Position
=
uMVP
*
vec4
(
aPos
,
1
.
0
);
vColorG
=
aColor
;
}
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/gl/scene.frag
0 → 100644
View file @
6d0d664e
#version 330 core
in
vec3
vColor
;
out
vec4
fragColor
;
void
main
()
{
fragColor
=
vec4
(
vColor
,
1
.
0
);
}
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/gl/scene.vert
0 → 100644
View file @
6d0d664e
#version 330 core
layout
(
location
=
0
)
in
vec3
aPos
;
layout
(
location
=
1
)
in
vec3
aColor
;
uniform
mat4
uMVP
;
out
vec3
vColor
;
void
main
()
{
gl_Position
=
uMVP
*
vec4
(
aPos
,
1
.
0
);
vColor
=
aColor
;
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/FloatListTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.Test
;
public
class
FloatListTest
{
@Test
public
void
growsBeyondInitialCapacityAndPreservesOrder
()
{
FloatList
list
=
new
FloatList
(
2
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
list
.
add
(
i
);
}
assertEquals
(
10
,
list
.
size
());
float
[]
expected
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
assertArrayEquals
(
expected
,
list
.
toArray
(),
0.0f
);
}
@Test
public
void
addThreeAddsAllInOrder
()
{
FloatList
list
=
new
FloatList
(
1
);
list
.
add
(
1
f
,
2
f
,
3
f
);
assertArrayEquals
(
new
float
[]{
1
,
2
,
3
},
list
.
toArray
(),
0.0f
);
}
@Test
public
void
clearResetsSizeAndArray
()
{
FloatList
list
=
new
FloatList
(
4
);
list
.
add
(
1
f
,
2
f
,
3
f
);
list
.
add
(
4
f
);
list
.
clear
();
assertEquals
(
0
,
list
.
size
());
assertEquals
(
0
,
list
.
toArray
().
length
);
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/IndexSetBuilderTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Predicate
;
import
org.junit.Test
;
public
class
IndexSetBuilderTest
{
@Test
public
void
includesOnlyTrianglesMatchingThePredicate
()
{
List
<
TriangleMeta
>
metas
=
Arrays
.
asList
(
new
TriangleMeta
(
0
,
null
,
1
,
false
),
new
TriangleMeta
(
1
,
null
,
2
,
false
),
new
TriangleMeta
(
2
,
null
,
1
,
false
));
Predicate
<
TriangleMeta
>
onlyGroup1
=
m
->
m
.
lod
()
==
1
;
int
[]
indices
=
IndexSetBuilder
.
build
(
metas
,
onlyGroup1
);
assertArrayEquals
(
new
int
[]{
0
,
1
,
2
,
6
,
7
,
8
},
indices
);
}
@Test
public
void
emptyWhenNothingMatches
()
{
List
<
TriangleMeta
>
metas
=
Arrays
.
asList
(
new
TriangleMeta
(
0
,
null
,
1
,
false
));
int
[]
indices
=
IndexSetBuilder
.
build
(
metas
,
m
->
false
);
assertArrayEquals
(
new
int
[]{},
indices
);
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/Mat4Test.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.Test
;
public
class
Mat4Test
{
@Test
public
void
identityTimesVectorIsUnchanged
()
{
float
[]
v
=
Mat4
.
transform
(
Mat4
.
identity
(),
2
,
3
,
4
,
1
);
assertArrayEquals
(
new
float
[]{
2
,
3
,
4
,
1
},
v
,
1
e
-
6
f
);
}
@Test
public
void
translationMovesPoint
()
{
float
[]
m
=
Mat4
.
translation
(
5
,
-
2
,
1
);
float
[]
v
=
Mat4
.
transform
(
m
,
1
,
1
,
1
,
1
);
assertArrayEquals
(
new
float
[]{
6
,
-
1
,
2
,
1
},
v
,
1
e
-
6
f
);
}
@Test
public
void
multiplyIsIdentityNeutral
()
{
float
[]
t
=
Mat4
.
translation
(
1
,
2
,
3
);
assertArrayEquals
(
t
,
Mat4
.
multiply
(
Mat4
.
identity
(),
t
),
1
e
-
6
f
);
assertArrayEquals
(
t
,
Mat4
.
multiply
(
t
,
Mat4
.
identity
()),
1
e
-
6
f
);
}
@Test
public
void
rotationZ90MapsXAxisToYAxis
()
{
float
[]
m
=
Mat4
.
rotationZ
((
float
)
(
Math
.
PI
/
2
));
float
[]
v
=
Mat4
.
transform
(
m
,
1
,
0
,
0
,
1
);
assertEquals
(
0
f
,
v
[
0
],
1
e
-
6
f
);
assertEquals
(
1
f
,
v
[
1
],
1
e
-
6
f
);
}
@Test
public
void
perspectiveHasExpectedDiagonalStructure
()
{
float
[]
p
=
Mat4
.
perspective
((
float
)
Math
.
toRadians
(
60
),
1.0f
,
1
f
,
100
f
);
float
f
=
(
float
)
(
1.0
/
Math
.
tan
(
Math
.
toRadians
(
60
)
/
2
));
assertEquals
(
f
,
p
[
0
],
1
e
-
5
f
);
assertEquals
(
f
,
p
[
5
],
1
e
-
5
f
);
assertEquals
(-
1
f
,
p
[
11
],
1
e
-
6
f
);
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/MeshAccumulatorTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
de.hft.stuttgart.citydoctor2.math.Triangle3d
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
org.junit.Test
;
public
class
MeshAccumulatorTest
{
@Test
public
void
emitsNineFloatsAndThreeIdsPerTriangleRecentered
()
{
MeshAccumulator
acc
=
new
MeshAccumulator
(
new
Vector3d
(
1
,
0
,
0
));
Triangle3d
t
=
new
Triangle3d
(
new
Vector3d
(
1
,
0
,
0
),
new
Vector3d
(
2
,
0
,
0
),
new
Vector3d
(
1
,
1
,
0
));
acc
.
addTriangle
(
t
,
7
,
0.5f
,
0.25f
,
0.125f
);
assertEquals
(
3
,
acc
.
vertexCount
());
assertArrayEquals
(
new
float
[]{
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
},
acc
.
positions
(),
1
e
-
6
f
);
assertArrayEquals
(
new
float
[]{
0.5f
,
0.25f
,
0.125f
,
0.5f
,
0.25f
,
0.125f
,
0.5f
,
0.25f
,
0.125f
},
acc
.
colors
(),
1
e
-
6
f
);
assertArrayEquals
(
new
int
[]{
7
,
7
,
7
},
acc
.
ids
());
}
@Test
public
void
accumulatesMultipleTriangles
()
{
MeshAccumulator
acc
=
new
MeshAccumulator
(
new
Vector3d
(
0
,
0
,
0
));
Triangle3d
t
=
new
Triangle3d
(
new
Vector3d
(
0
,
0
,
0
),
new
Vector3d
(
1
,
0
,
0
),
new
Vector3d
(
0
,
1
,
0
));
acc
.
addTriangle
(
t
,
1
,
1
,
1
,
1
);
acc
.
addTriangle
(
t
,
2
,
0
,
0
,
0
);
assertEquals
(
6
,
acc
.
vertexCount
());
assertEquals
(
18
,
acc
.
positions
().
length
);
assertArrayEquals
(
new
int
[]{
1
,
1
,
1
,
2
,
2
,
2
},
acc
.
ids
());
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/OrbitCameraTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Test
;
public
class
OrbitCameraTest
{
private
static
float
[]
ndc
(
OrbitCamera
cam
,
float
x
,
float
y
,
float
z
)
{
float
[]
clip
=
Mat4
.
transform
(
cam
.
viewProjection
(),
x
,
y
,
z
,
1
);
return
new
float
[]{
clip
[
0
]
/
clip
[
3
],
clip
[
1
]
/
clip
[
3
],
clip
[
2
]
/
clip
[
3
]};
}
@Test
public
void
focusPointProjectsToScreenCentre
()
{
OrbitCamera
cam
=
new
OrbitCamera
();
cam
.
setAspect
(
1.0f
);
cam
.
zoomOutForBoundingBox
(
50.0
);
float
[]
p
=
ndc
(
cam
,
0
,
0
,
0
);
assertEquals
(
0
f
,
p
[
0
],
1
e
-
4
f
);
assertEquals
(
0
f
,
p
[
1
],
1
e
-
4
f
);
assertTrue
(
"origin in front of camera (within clip)"
,
p
[
2
]
>
-
1
f
&&
p
[
2
]
<
1
f
);
}
@Test
public
void
zoomingKeepsFocusCentredButChangesDepth
()
{
OrbitCamera
cam
=
new
OrbitCamera
();
cam
.
setAspect
(
1.0f
);
cam
.
zoomOutForBoundingBox
(
50.0
);
float
depthBefore
=
ndc
(
cam
,
0
,
0
,
0
)[
2
];
cam
.
zoom
(
1.5
);
float
[]
p
=
ndc
(
cam
,
0
,
0
,
0
);
assertEquals
(
0
f
,
p
[
0
],
1
e
-
4
f
);
assertEquals
(
0
f
,
p
[
1
],
1
e
-
4
f
);
assertTrue
(
"depth changes when zooming"
,
Math
.
abs
(
p
[
2
]
-
depthBefore
)
>
1
e
-
4
f
);
}
@Test
public
void
resetRestoresInitialDistanceAndAngles
()
{
OrbitCamera
cam
=
new
OrbitCamera
();
cam
.
setAspect
(
1.0f
);
cam
.
orbit
(
40
,
25
);
cam
.
pan
(
10
,
-
5
);
cam
.
zoom
(
2.0
);
cam
.
reset
();
float
[]
before
=
cam
.
viewProjection
();
OrbitCamera
fresh
=
new
OrbitCamera
();
fresh
.
setAspect
(
1.0f
);
org
.
junit
.
Assert
.
assertArrayEquals
(
fresh
.
viewProjection
(),
before
,
1
e
-
5
f
);
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/PickRegistryTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
org.junit.Test
;
public
class
PickRegistryTest
{
@Test
public
void
assignsSequentialNonZeroIdsAndResolvesThem
()
{
PickRegistry
reg
=
new
PickRegistry
();
Object
a
=
"a"
;
Object
b
=
"b"
;
int
idA
=
reg
.
register
(
a
);
int
idB
=
reg
.
register
(
b
);
assertEquals
(
1
,
idA
);
assertEquals
(
2
,
idB
);
assertEquals
(
a
,
reg
.
resolve
(
idA
));
assertEquals
(
b
,
reg
.
resolve
(
idB
));
}
@Test
public
void
resolvesBackgroundAndOutOfRangeToNull
()
{
PickRegistry
reg
=
new
PickRegistry
();
reg
.
register
(
"a"
);
assertNull
(
reg
.
resolve
(
0
));
assertNull
(
reg
.
resolve
(
99
));
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/PickingCodecTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.Test
;
public
class
PickingCodecTest
{
@Test
public
void
roundTripsIdsThroughRgbBytes
()
{
int
[]
ids
=
{
1
,
255
,
256
,
65535
,
65536
,
16777215
};
for
(
int
id
:
ids
)
{
int
r
=
PickingCodec
.
red
(
id
);
int
g
=
PickingCodec
.
green
(
id
);
int
b
=
PickingCodec
.
blue
(
id
);
assertEquals
(
id
,
PickingCodec
.
decode
(
r
,
g
,
b
));
}
}
@Test
public
void
blackDecodesToZeroBackground
()
{
assertEquals
(
0
,
PickingCodec
.
decode
(
0
,
0
,
0
));
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/SceneBuilderTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javafx.scene.paint.Color
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
public
class
SceneBuilderTest
{
private
static
List
<
Polygon
>
polygons
;
@BeforeClass
public
static
void
loadFixture
()
throws
Exception
{
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
CityDoctorModel
model
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0001-T0001.gml"
,
config
);
polygons
=
new
ArrayList
<>();
model
.
getBuildings
().
forEach
(
b
->
{
for
(
Geometry
g
:
b
.
getGeometries
())
{
for
(
Polygon
p
:
g
.
getPolygons
())
{
if
(!
p
.
isLink
())
{
polygons
.
add
(
p
);
}
}
}
for
(
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BoundarySurface
bs
:
b
.
getBoundarySurfaces
())
{
for
(
Geometry
g
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
g
.
getPolygons
())
{
if
(!
p
.
isLink
())
{
polygons
.
add
(
p
);
}
}
}
}
});
assertTrue
(
"fixture should contain polygons"
,
!
polygons
.
isEmpty
());
}
@Test
public
void
buildsConsistentBufferLengths
()
{
SceneData
data
=
SceneBuilder
.
fromPolygons
(
polygons
,
Color
.
WHITE
);
int
vertices
=
data
.
positions
().
length
/
3
;
assertEquals
(
vertices
*
3
,
data
.
colors
().
length
);
assertEquals
(
vertices
,
data
.
ids
().
length
);
assertEquals
(
vertices
,
data
.
triangleCount
()
*
3
);
}
@Test
public
void
everyPolygonGetsAPickingIdResolvingToAPolygon
()
{
SceneData
data
=
SceneBuilder
.
fromPolygons
(
polygons
,
Color
.
WHITE
);
for
(
int
id
:
data
.
ids
())
{
assertTrue
(
data
.
pickRegistry
().
resolve
(
id
)
instanceof
Polygon
);
}
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/SceneDataTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
java.util.List
;
import
org.junit.Test
;
public
class
SceneDataTest
{
@Test
public
void
exposesItsBuffersAndRegistry
()
{
float
[]
pos
=
{
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
};
float
[]
col
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
int
[]
ids
=
{
1
,
1
,
1
};
PickRegistry
reg
=
new
PickRegistry
();
List
<
TriangleMeta
>
metas
=
List
.
of
(
new
TriangleMeta
(
0
,
null
,
2
,
false
));
SceneData
data
=
new
SceneData
(
pos
,
col
,
ids
,
metas
,
reg
,
new
double
[]{
5
,
6
,
7
});
assertSame
(
pos
,
data
.
positions
());
assertEquals
(
1
,
data
.
triangleMetas
().
size
());
assertEquals
(
6.0
,
data
.
center
()[
1
],
0.0
);
assertSame
(
reg
,
data
.
pickRegistry
());
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/test/java/de/hft/stuttgart/citydoctor2/gui/gl/ShadeColorTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.gui.gl
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
javafx.scene.paint.Color
;
import
org.junit.Test
;
public
class
ShadeColorTest
{
@Test
public
void
brightnessStaysWithinExpectedBand
()
{
// Shade brightness is acos(normal.AXIS)/PI * 0.6 + 0.3 -> always within [0.3, 0.9].
Vector3d
[]
normals
=
{
new
Vector3d
(
1
,
0
,
0
),
new
Vector3d
(
0
,
1
,
0
),
new
Vector3d
(
0
,
0
,
1
),
new
Vector3d
(-
1
,
0
,
0
),
new
Vector3d
(
0.3
,
-
0.7
,
0.5
)
};
for
(
Vector3d
n
:
normals
)
{
Color
c
=
ShadeColor
.
shade
(
n
.
normalize
(),
Color
.
WHITE
);
assertTrue
(
"brightness >= 0.3"
,
c
.
getBrightness
()
>=
0.3
-
1
e
-
6
);
assertTrue
(
"brightness <= 0.9"
,
c
.
getBrightness
()
<=
0.9
+
1
e
-
6
);
}
}
@Test
public
void
matchesLegacyFormulaForKnownNormal
()
{
Vector3d
axis
=
new
Vector3d
(
19
,
0.8
,
1.5
).
normalize
();
Vector3d
normal
=
new
Vector3d
(
0
,
0
,
1
).
normalize
();
double
cos
=
Math
.
max
(-
1.0
,
Math
.
min
(
1.0
,
normal
.
dot
(
axis
)));
double
shade
=
Math
.
acos
(
cos
)
/
Math
.
PI
*
0.6
+
0.3
;
Color
expected
=
Color
.
WHITE
.
deriveColor
(
0
,
1.0
,
shade
,
1.0
);
Color
actual
=
ShadeColor
.
shade
(
normal
,
Color
.
WHITE
);
assertEquals
(
expected
.
getRed
(),
actual
.
getRed
(),
1
e
-
9
);
assertEquals
(
expected
.
getGreen
(),
actual
.
getGreen
(),
1
e
-
9
);
assertEquals
(
expected
.
getBlue
(),
actual
.
getBlue
(),
1
e
-
9
);
}
}
CityDoctorParent/Extensions/CityDoctorHealer/pom.xml
View file @
6d0d664e
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
<version>
3.18.
1
</version>
<version>
3.18.
3
</version>
<relativePath>
../../pom.xml
</relativePath>
</parent>
<artifactId>
CityDoctorHealer
</artifactId>
...
...
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/connect/edge/CppTest.java
0 → 100644
View file @
6d0d664e
package
de.hft.stuttgart.citydoctor2.connect.edge
;
/**
* Marker interface for excluding testcases that use the deprecated connection to the C++ library.
* The tests are kept for the Java replacement library that is currently being developed.
*/
public
interface
CppTest
{
}
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/healer/Healer.java
View file @
6d0d664e
...
...
@@ -12,6 +12,9 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Objects
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityObjectCacheException
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.ade.ADEException
;
...
...
@@ -64,7 +67,7 @@ public class Healer {
private
Checker
checker
;
private
ModificationListener
l
;
private
HealingPlan
plan
;
private
CityObjectCache
cache
;
static
{
// CppInitializer.initCpp();
}
...
...
@@ -187,6 +190,12 @@ public class Healer {
}
};
}
if
(
checker
.
getModel
()
!=
null
){
cache
=
checker
.
getModel
().
getCache
();
}
else
{
//Stream healing is being used, use an unconnected cache
cache
=
new
UnconnectedCache
();
}
this
.
l
=
l
;
}
...
...
@@ -208,7 +217,12 @@ public class Healer {
}
public
void
healModel
(
CityDoctorModel
model
)
{
try
(
AutoCloseable
checkingContext
=
model
.
getCache
().
startCheckingMode
()){
model
.
createFeatureStream
().
forEach
(
this
::
healCityObject
);
}
catch
(
Exception
e
)
{
throw
new
CityObjectCacheException
(
"Healer critically failed during attempt to heal the model"
,
e
);
}
}
public
void
healCityObject
(
CityObject
co
)
{
...
...
@@ -282,9 +296,7 @@ public class Healer {
*
* @param aco the feature to write
* @return the byte array containing the feature
* @throws ADEException
* @throws CityGMLBuilderException
* @throws CityGMLWriteException
* @throws CityGMLWriteException if writing of the CityGML file fails
*/
private
byte
[]
writeCityGml
(
AbstractCityObject
aco
)
throws
CityGMLWriteException
{
CityModel
model
=
new
CityModel
();
...
...
@@ -348,6 +360,8 @@ public class Healer {
if
(
checker
.
getConfig
().
getParserConfiguration
().
useLowMemoryConsumption
())
{
co
.
clearMetaInformation
();
}
//Reinsert object into cache and release locks
cache
.
put
(
co
);
}
}
...
...
CityDoctorParent/Extensions/CityDoctorHealer/src/main/resources/log4j2.xml
0 → 100644
View file @
6d0d664e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configuration>
<Configuration
status=
"INFO"
>
<Appenders>
<Console
name=
"console"
target=
"SYSTEM_OUT"
>
<PatternLayout
pattern=
"[%-5level] %d{HH:mm:ss.SSS} %c{1} - %msg%n"
/>
</Console>
</Appenders>
<Loggers>
<Root
level=
"debug"
additivity=
"false"
>
<AppenderRef
ref=
"console"
/>
</Root>
<Logger
name=
"com.zaxxer.hikari"
level=
"INFO"
additivity=
"false"
>
<AppenderRef
ref=
"console"
/>
</Logger>
</Loggers>
</Configuration>
\ No newline at end of file
CityDoctorParent/Extensions/CityDoctorHealer/src/test/java/de/hft/stuttgart/citydoctor2/healing/HealMissingSolidTest.java
View file @
6d0d664e
...
...
@@ -29,6 +29,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.core.model.CityGMLVersion
;
import
org.citygml4j.core.model.core.AbstractThematicSurface
;
import
org.citygml4j.core.model.core.CityModel
;
import
org.junit.Rule
;
...
...
@@ -42,11 +43,13 @@ import de.hft.stuttgart.citydoctor2.check.Requirement;
import
de.hft.stuttgart.citydoctor2.check.RequirementConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
import
de.hft.stuttgart.citydoctor2.datastructure.Installation
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
...
...
@@ -55,14 +58,11 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.healer.Healer
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
public
class
HealMissingSolidTest
{
...
...
@@ -72,13 +72,8 @@ public class HealMissingSolidTest {
@Test
public
void
testCreateSolid
()
throws
CityDoctorWriteException
,
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
// edit @Numanoglu
CityDoctorModel
model
=
new
CityDoctorModel
(
config
.
getParserConfiguration
(),
new
File
(
"test"
),
new
UnconnectedCache
()
);
CityDoctorModel
model
=
new
CityDoctorModel
(
config
.
getParserConfiguration
(),
new
File
(
"test"
),
new
UnconnectedCache
());
model
.
setParsedCityGMLVersion
(
CityGMLVersion
.
v3_0
);
model
.
setCityModel
(
new
CityModel
());
Building
b
=
new
Building
();
model
.
addBuilding
(
b
);
...
...
CityDoctorParent/Extensions/CityDoctorHealer/src/test/java/de/hft/stuttgart/citydoctor2/healing/HealPlanarPolygonErrorTest.java
View file @
6d0d664e
...
...
@@ -7,6 +7,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.connect.edge.CppTest
;
import
org.junit.Assert
;
import
org.junit.Test
;
...
...
@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import
de.hft.stuttgart.citydoctor2.healer.Healer
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
org.junit.experimental.categories.Category
;
public
class
HealPlanarPolygonErrorTest
{
...
...
@@ -47,7 +49,6 @@ public class HealPlanarPolygonErrorTest {
Assert
.
assertTrue
(
geom
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
Healer
healer
=
new
Healer
(
c
);
healer
.
setNumberOfIterations
(
2
);
healer
.
healCityObject
(
model
.
getBuildings
().
toList
().
get
(
0
));
Assert
.
assertFalse
(
geom
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
...
...
@@ -55,6 +56,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category
(
CppTest
.
class
)
public
void
testNonplanarPolygon
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
...
...
@@ -160,6 +162,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category
(
CppTest
.
class
)
public
void
testNonplanarPolygon_Split
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
...
...
@@ -274,6 +277,7 @@ public class HealPlanarPolygonErrorTest {
}
@Test
@Category
(
CppTest
.
class
)
public
void
testNonplanarPolygon_Split2
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
...
...
CityDoctorParent/Extensions/CityDoctorHealer/src/test/java/de/hft/stuttgart/citydoctor2/healing/HealSolidNotClosedErrorTest.java
View file @
6d0d664e
...
...
@@ -4,8 +4,11 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
de.hft.stuttgart.citydoctor2.connect.edge.CppTest
;
import
org.citygml4j.xml.writer.CityGMLWriteException
;
import
org.junit.Assert
;
import
org.junit.Test
;
...
...
@@ -33,13 +36,16 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import
de.hft.stuttgart.citydoctor2.healer.Healer
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
org.junit.experimental.categories.Category
;
public
class
HealSolidNotClosedErrorTest
{
/**
* One polygon is split up in 3 but has not matching edges
*/
@Test
@Category
(
CppTest
.
class
)
public
void
testVertexCloseToEdge
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
//Angelika: als Test eingefügt
...
...
@@ -164,6 +170,7 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category
(
CppTest
.
class
)
public
void
testMissingPolygon
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
...
...
@@ -343,6 +350,7 @@ public class HealSolidNotClosedErrorTest {
}
@Test
@Category
(
CppTest
.
class
)
public
void
test2MissingPolygonsCpp
()
{
CppInitializer
.
initCpp
();
Building
b
=
new
Building
();
...
...
@@ -421,6 +429,8 @@ public class HealSolidNotClosedErrorTest {
assertEquals
(
ResultStatus
.
OK
,
cr
.
getResultStatus
());
}
/**
* Missing Polygon has a self intersection
* @throws IOException
...
...
@@ -431,24 +441,22 @@ public class HealSolidNotClosedErrorTest {
*/
@Test
public
void
testMissingPolygon2
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
{
String
path
=
"src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"
;
//bei diesem Modell stürzt die VM ab
//
String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0002.gml"; //bei diesem Modell stürzt die VM ab
// String path = "src/test/resources/SimpleSolid_SrefBS-GE-gml-SO-0002-T0001.gml"; //hier nur Fehlermeldung
String
path
=
"src/test/resources/SimpleSolid_SrefBS-GE-gml-LR-0004-T0005.gml"
;
// String path = "src/test/resources/SimpleSolid_SrefBS.gml";
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
CityDoctorModel
model
=
TestUtil
.
loadCityModel
(
path
,
config
);
Checker
c
=
new
Checker
(
config
,
model
);
c
.
runChecks
();
Geometry
geom
=
model
.
getBuildings
().
toList
().
get
(
0
).
getGeometries
().
get
(
0
);
geom
.
updateVertices
();
for
(
Vertex
v
:
geom
.
getVertices
())
{
v
.
setX
(
v
.
getX
()
-
10
);
v
.
setY
(
v
.
getY
()
-
10
);
}
Assert
.
assertTrue
(
geom
.
containsError
(
CheckId
.
C_GE_S_NOT_CLOSED
));
Healer
healer
=
new
Healer
(
c
);
//
healer.setNumberOfIterations(2);
healer
.
setNumberOfIterations
(
2
);
healer
.
healCityObject
(
model
.
getBuildings
().
toList
().
get
(
0
));
Assert
.
assertFalse
(
geom
.
containsError
(
CheckId
.
C_GE_S_NOT_CLOSED
));
...
...
Prev
1
2
3
4
5
6
7
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