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
d7629865
Commit
d7629865
authored
Oct 08, 2026
by
Numanoglu
Browse files
debugging sweep on real gml wip
parent
aeae0705
Pipeline
#12499
passed with stage
in 2 minutes and 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorHealer/src/test/java/de/hft/stuttgart/citydoctor2/healing/SweepUtilitiesRealGmlTest.java
View file @
d7629865
package
de.hft.stuttgart.citydoctor2.healing
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.IOException
;
...
...
@@ -13,6 +12,13 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.logging.log4j.Level
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.core.LoggerContext
;
import
org.apache.logging.log4j.core.config.Configuration
;
import
org.apache.logging.log4j.core.config.LoggerConfig
;
import
org.junit.AfterClass
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -57,6 +63,41 @@ public class SweepUtilitiesRealGmlTest {
private
static
final
String
PLANAR_DISTANCE_TOLERANCE
=
"0.01"
;
private
static
final
String
PLANAR_CHECK_TYPE
=
PlanarCheck
.
DISTANCE
;
private
static
final
boolean
PRINT_EACH_RELEVANT_SWEEP_VERTEX
=
true
;
private
static
final
int
MAX_HEAL_ITERATIONS
=
30
;
private
static
final
String
[]
QUIET_LOGGERS
=
{
"de.hft.stuttgart.citydoctor2.check.Checker"
,
"de.hft.stuttgart.citydoctor2.check.Checkable"
,
"de.hft.stuttgart.citydoctor2.parser.ImplicitGeometryHolder"
,
"com.zaxxer.hikari"
};
private
static
final
Map
<
String
,
LoggerConfig
>
ORIGINAL_LOGGER_CONFIGS
=
new
HashMap
<>();
@BeforeClass
public
static
void
quietNoisyRealGmlLoggers
()
{
LoggerContext
context
=
(
LoggerContext
)
LogManager
.
getContext
(
false
);
Configuration
configuration
=
context
.
getConfiguration
();
for
(
String
loggerName
:
QUIET_LOGGERS
)
{
LoggerConfig
ownConfig
=
configuration
.
getLoggers
().
get
(
loggerName
);
if
(
ownConfig
!=
null
)
{
ORIGINAL_LOGGER_CONFIGS
.
put
(
loggerName
,
ownConfig
);
}
LoggerConfig
quietConfig
=
new
LoggerConfig
(
loggerName
,
Level
.
WARN
,
true
);
configuration
.
addLogger
(
loggerName
,
quietConfig
);
}
context
.
updateLoggers
();
}
@AfterClass
public
static
void
restoreNoisyRealGmlLoggers
()
{
LoggerContext
context
=
(
LoggerContext
)
LogManager
.
getContext
(
false
);
Configuration
configuration
=
context
.
getConfiguration
();
for
(
String
loggerName
:
QUIET_LOGGERS
)
{
LoggerConfig
originalConfig
=
ORIGINAL_LOGGER_CONFIGS
.
get
(
loggerName
);
if
(
originalConfig
!=
null
)
{
configuration
.
addLogger
(
loggerName
,
originalConfig
);
}
else
{
configuration
.
removeLogger
(
loggerName
);
}
}
context
.
updateLoggers
();
}
/**
* Reales ganzes CityGML:NpR1 . Der Test lädt die Datei über den
...
...
@@ -68,6 +109,13 @@ public class SweepUtilitiesRealGmlTest {
checkRealGmlAndTrySweepHealing
(
"src/test/resources/sweep/non-planar-distance-plane/NP_R_1.gml"
);
}
@Test
public
void
reportsAndTriesSweepForLoD21005WithVal3dityErrors
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
{
checkRealGmlAndTrySweepHealing
(
"src/test/resources/sweep/non-planar-distance-plane/LoD2_10_05_mit_val3dity_volumenfehlern.gml"
);
}
private
void
checkRealGmlAndTrySweepHealing
(
String
path
)
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
{
String
fileName
=
Path
.
of
(
path
).
getFileName
().
toString
();
...
...
@@ -101,34 +149,54 @@ public class SweepUtilitiesRealGmlTest {
int
healedCount
=
0
;
int
unhealedCount
=
0
;
for
(
int
i
=
0
;
i
<
errors
.
size
();
i
++)
{
NonPlanarPolygonDistancePlaneError
error
=
errors
.
get
(
i
);
SweepUtilities
utilities
=
new
SweepUtilities
(
error
,
POINT_ON_PLANE_TOLERANCE
,
SWEEP_EDGE_AND_ANGLE_TOLERANCE
);
for
(
int
i
=
0
;
i
<
MAX_HEAL_ITERATIONS
;
i
++)
{
List
<
CheckError
>
currentRawErrors
=
collectErrors
(
model
);
List
<
NonPlanarPolygonDistancePlaneError
>
currentDistancePlaneErrors
=
collectUniqueDistancePlaneErrors
(
currentRawErrors
);
if
(
currentDistancePlaneErrors
.
isEmpty
())
{
break
;
}
NonPlanarPolygonDistancePlaneError
error
=
currentDistancePlaneErrors
.
get
(
0
);
int
distancePlaneBefore
=
currentDistancePlaneErrors
.
size
();
System
.
out
.
println
();
System
.
out
.
println
(
"Fehler "
+
(
i
+
1
)
+
" von "
+
errors
.
size
()
+
" in Datei "
+
fileName
);
System
.
out
.
println
(
"Heiliteration "
+
(
i
+
1
)
+
" in Datei "
+
fileName
);
System
.
out
.
println
(
"DistancePlane-Fazetten vor der Heilung: "
+
distancePlaneBefore
);
printErrorSummary
(
error
);
SweepUtilities
utilities
=
new
SweepUtilities
(
error
,
POINT_ON_PLANE_TOLERANCE
,
SWEEP_EDGE_AND_ANGLE_TOLERANCE
);
utilities
.
initialize
();
printSweepVertexSummary
(
utilities
.
getSweepVertices
());
boolean
calculated
=
utilities
.
calculate
();
System
.
out
.
println
(
"calculate(): "
+
calculated
);
String
healingMethod
;
boolean
methodSucceeded
;
if
(
calculated
)
{
utilities
.
doHeal
();
boolean
polygonPlanarAfterHealing
=
isPolygonPlanar
(
error
.
getPolygon
());
System
.
out
.
println
(
"PlanarCheck nach doHeal() für diese Fazette: "
+
polygonPlanarAfterHealing
);
assertTrue
(
"Die aktuell geheilte Fazette muss nach doHeal() planar sein."
,
polygonPlanarAfterHealing
);
recheckWholeModel
(
checker
,
model
);
int
remainingDistancePlaneFacets
=
printModelErrorSummaryAfterHealing
(
model
);
assertEquals
(
"Nach doHeal() und erneutem Checker-Lauf dürfen keine DistancePlane-Fazetten übrig sein."
,
0
,
remainingDistancePlaneFacets
);
if
(
polygonPlanarAfterHealing
)
{
healedCount
++;
}
else
{
unhealedCount
++;
}
healingMethod
=
"SweepUtilities"
;
methodSucceeded
=
true
;
}
else
{
HealPlanarPolygonError
fallback
=
new
HealPlanarPolygonError
();
methodSucceeded
=
fallback
.
visit
(
error
,
null
);
healingMethod
=
"Alte Heal-Methode als Fallback"
;
}
System
.
out
.
println
(
"Erfolgreiche Heilmethode: "
+
(
methodSucceeded
?
healingMethod
:
"keine"
));
if
(!
methodSucceeded
)
{
unhealedCount
++;
break
;
}
boolean
polygonPlanarAfterHealing
=
isPolygonPlanar
(
error
.
getPolygon
());
System
.
out
.
println
(
"PlanarCheck nach Heilmethode für diese Fazette: "
+
polygonPlanarAfterHealing
);
recheckWholeModel
(
checker
,
model
);
int
distancePlaneAfter
=
printModelErrorSummaryAfterHealing
(
model
);
System
.
out
.
println
(
"DistancePlane-Fazetten vorher -> nachher: "
+
distancePlaneBefore
+
" -> "
+
distancePlaneAfter
);
if
(
distancePlaneAfter
<=
distancePlaneBefore
)
{
healedCount
++;
}
else
{
unhealedCount
++;
}
...
...
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