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
82888d4b
Commit
82888d4b
authored
Dec 12, 2025
by
Matthias Betz
Browse files
Merge branch 'dev' of transfer.hft-stuttgart.de:citydoctor/citydoctor2 into dev
parents
b7b0e6e6
46fcd030
Changes
2
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
82888d4b
...
@@ -23,6 +23,8 @@ import java.util.ArrayList;
...
@@ -23,6 +23,8 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.StringJoiner
;
import
java.util.function.Function
;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
...
@@ -172,10 +174,13 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -172,10 +174,13 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
final
Path
directory
;
private
final
Path
directory
;
private
final
double
neighborDistance
;
private
final
double
neighborDistance
;
private
Map
<
String
,
ConcretePolygon
>
polygonMap
=
new
HashMap
<>();
private
Map
<
String
,
ConcretePolygon
>
polygonMap
=
new
HashMap
<>();
private
Map
<
String
,
CompositeCollection
>
compositeMap
=
new
HashMap
<>();
private
Map
<
String
,
CompositeCollection
>
compositeMap
=
new
HashMap
<>();
;
private
List
<
ResolvableReference
>
references
=
new
ArrayList
<>();
private
List
<
ResolvableReference
>
references
=
new
ArrayList
<>();
private
Map
<
Vertex
,
Vertex
>
vertexMap
=
new
HashMap
<>();
private
Map
<
Vertex
,
Vertex
>
vertexMap
=
new
HashMap
<>();
private
Map
<
String
,
List
<
GmlId
>>
unresolvedPolyRefIDMap
=
new
HashMap
<>();
private
Map
<
String
,
GmlId
>
parsedPolygonsIdMap
=
new
HashMap
<>();
public
Citygml3FeatureMapper
(
ParserConfiguration
config
,
Path
path
,
boolean
unconnected
)
{
public
Citygml3FeatureMapper
(
ParserConfiguration
config
,
Path
path
,
boolean
unconnected
)
{
this
.
config
=
config
;
this
.
config
=
config
;
this
.
directory
=
path
.
getParent
();
this
.
directory
=
path
.
getParent
();
...
@@ -197,6 +202,37 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -197,6 +202,37 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
}
public
void
checkUnresolvedReferences
()
{
if
(
unresolvedPolyRefIDMap
.
isEmpty
())
{
return
;
}
boolean
xLinkGlobalError
=
false
;
List
<
String
>
crossRefs
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
GmlId
>>
entry
:
unresolvedPolyRefIDMap
.
entrySet
())
{
String
id
=
entry
.
getKey
();
boolean
emptyCrossFeatureReference
=
parsedPolygonsIdMap
.
containsKey
(
id
);
xLinkGlobalError
=
xLinkGlobalError
||
emptyCrossFeatureReference
;
if
(
emptyCrossFeatureReference
)
{
List
<
GmlId
>
gmlIds
=
entry
.
getValue
();
StringJoiner
joiner
=
new
StringJoiner
(
", "
);
gmlIds
.
forEach
(
gmlId
->
joiner
.
add
(
gmlId
.
toString
()));
GmlId
crossFeatureId
=
parsedPolygonsIdMap
.
get
(
id
);
//TODO: Localize String
logger
.
warn
(
"Polygon {} of Feature {} is being referenced in other Features: {}"
,
id
,
crossFeatureId
,
joiner
);
crossRefs
.
add
(
id
);
}
}
if
(
xLinkGlobalError
)
{
//TODO: Localize String
logger
.
warn
(
"Model has Features containing cross-feature references without their own copies of the referenced polygons"
);
}
crossRefs
.
forEach
(
unresolvedPolyRefIDMap:
:
remove
);
if
(!
unresolvedPolyRefIDMap
.
isEmpty
())
{
logger
.
warn
(
"Model contains polygon references that could not be found"
);
}
}
@Override
@Override
public
void
visit
(
AbstractSpace
space
)
{
public
void
visit
(
AbstractSpace
space
)
{
// if we are here, an AbstractSpace thing was read that is not handled in the
// if we are here, an AbstractSpace thing was read that is not handled in the
...
@@ -903,7 +939,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -903,7 +939,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
parseId
(
co
.
getGmlObject
(),
co
);
parseId
(
co
.
getGmlObject
(),
co
);
co
.
clearGmlGeometries
();
co
.
clearGmlGeometries
();
resolveAndClearReferences
();
resolveAndClearReferences
(
co
);
updateEdgesAndVertices
(
co
);
updateEdgesAndVertices
(
co
);
}
}
...
@@ -1092,7 +1128,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1092,7 +1128,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
return
igh
;
return
igh
;
}
}
private
void
resolveAndClearReferences
()
{
private
void
resolveAndClearReferences
(
CityObject
co
)
{
for
(
ResolvableReference
ref
:
references
)
{
for
(
ResolvableReference
ref
:
references
)
{
String
href
=
ref
.
href
();
String
href
=
ref
.
href
();
if
(
href
.
startsWith
(
"#"
))
{
if
(
href
.
startsWith
(
"#"
))
{
...
@@ -1107,6 +1143,9 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1107,6 +1143,9 @@ public class Citygml3FeatureMapper extends ObjectWalker {
handlePolygonReference
(
href
,
geom
);
handlePolygonReference
(
href
,
geom
);
}
}
}
}
for
(
String
polygonId:
polygonMap
.
keySet
()){
parsedPolygonsIdMap
.
put
(
polygonId
,
co
.
getGmlId
());
}
// clear storage for polygons and vertices
// clear storage for polygons and vertices
references
=
new
ArrayList
<>();
references
=
new
ArrayList
<>();
...
@@ -1117,9 +1156,12 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1117,9 +1156,12 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
void
handlePolygonReference
(
String
href
,
Geometry
geom
)
{
private
void
handlePolygonReference
(
String
href
,
Geometry
geom
)
{
ConcretePolygon
concPoly
=
polygonMap
.
get
(
href
);
ConcretePolygon
concPoly
=
polygonMap
.
get
(
href
);
if
(
concPoly
==
null
)
{
if
(
concPoly
==
null
)
{
if
(
logger
.
isWarnEnabled
())
{
List
<
GmlId
>
featureList
=
unresolvedPolyRefIDMap
.
computeIfAbsent
(
href
,
k
->
new
ArrayList
<>());
logger
.
warn
(
Localization
.
getText
(
"FeatureMapper.polygonUnreferenced"
),
href
);
GmlId
featureId
=
geom
.
getParent
().
getTopLevelCityObject
().
getGmlId
();
}
featureList
.
add
(
featureId
);
// if (logger.isWarnEnabled()) {
// logger.warn(Localization.getText("FeatureMapper.polygonUnreferenced"), href);
// }
}
else
{
}
else
{
LinkedPolygon
lPoly
=
new
LinkedPolygon
(
concPoly
,
geom
);
LinkedPolygon
lPoly
=
new
LinkedPolygon
(
concPoly
,
geom
);
if
(
geom
.
getParent
()
instanceof
BoundarySurface
bs
)
{
if
(
geom
.
getParent
()
instanceof
BoundarySurface
bs
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
View file @
82888d4b
...
@@ -496,6 +496,7 @@ public class CityGmlParser {
...
@@ -496,6 +496,7 @@ public class CityGmlParser {
logger
.
info
(
Localization
.
getText
(
"CityGmlParser.parsedObjects"
),
logger
.
info
(
Localization
.
getText
(
"CityGmlParser.parsedObjects"
),
mapper
.
getModel
().
getNumberOfFeatures
());
mapper
.
getModel
().
getNumberOfFeatures
());
}
}
mapper
.
checkUnresolvedReferences
();
mapper
.
setCityGMLVersion
(
version
);
mapper
.
setCityGMLVersion
(
version
);
return
mapper
.
getModel
();
return
mapper
.
getModel
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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