Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
8dbd30ce
Commit
8dbd30ce
authored
5 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Add support for BuildingSubdivisions
parent
01bd1295
master
107-opengl-view
dev
dev_cpp_code_conversion
dev_gui_features
dev_gui_features_zip_loading
3.16.0
archive/dev_gui_features_zip_loading
archive/dev_citygml3
2 merge requests
!11
CityDoctor Release Version 3.16.0
,
!10
CityGML 3.0. Support
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
+43
-2
...stuttgart/citydoctor2/datastructure/AbstractBuilding.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingSubdivision.java
+366
-0
...itydoctor2/datastructure/AbstractBuildingSubdivision.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingRoom.java
+3
-9
...hft/stuttgart/citydoctor2/datastructure/BuildingRoom.java
with
412 additions
and
11 deletions
+412
-11
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
+
43
-
2
View file @
8dbd30ce
...
...
@@ -56,7 +56,7 @@ public abstract class AbstractBuilding extends CityObject {
private
final
List
<
Installation
>
buildingInstallations
=
new
ArrayList
<>(
2
);
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
private
final
List
<
BuildingRoom
>
buildingRooms
=
new
ArrayList
<>();
private
final
List
<
AbstractBuildingSubdivision
>
buildingSubdivisions
=
new
ArrayList
<>();
private
final
List
<
BuildingRoomFurniture
>
buildingRoomFurnitureList
=
new
ArrayList
<>();
private
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
ab
;
...
...
@@ -102,6 +102,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
unsetGmlGeometries
();
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
unsetGmlGeometries
();
}
}
@Override
...
...
@@ -127,6 +130,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
reCreateGeometries
(
factory
,
config
);
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
...
...
@@ -202,6 +208,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
accept
(
c
);
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
accept
(
c
);
}
}
@Override
...
...
@@ -219,6 +228,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
collectContainedErrors
(
errors
);
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
collectContainedErrors
(
errors
);
}
}
@Override
...
...
@@ -236,6 +248,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
clearAllContainedCheckResults
();
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
clearAllContainedCheckResults
();
}
}
@Override
...
...
@@ -264,6 +279,11 @@ public abstract class AbstractBuilding extends CityObject {
return
true
;
}
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
if
(
abs
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
...
...
@@ -293,6 +313,11 @@ public abstract class AbstractBuilding extends CityObject {
return
true
;
}
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
if
(
abs
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
...
...
@@ -320,7 +345,9 @@ public abstract class AbstractBuilding extends CityObject {
roomFurniture
.
setParent
(
this
);
}
public
void
addAbstractBuildingSubdivision
(
AbstractBuildingSubdivision
abs
)
{
buildingSubdivisions
.
add
(
abs
);
}
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
ab
)
{
this
.
ab
=
ab
;
...
...
@@ -338,6 +365,10 @@ public abstract class AbstractBuilding extends CityObject {
return
buildingRoomFurnitureList
;
}
public
List
<
AbstractBuildingSubdivision
>
getBuildingSubdivisions
()
{
return
buildingSubdivisions
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
...
...
@@ -353,6 +384,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
prepareForChecking
();
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
prepareForChecking
();
}
}
@Override
...
...
@@ -370,6 +404,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
clearMetaInformation
();
}
for
(
AbstractBuildingSubdivision
abs
:
buildingSubdivisions
)
{
abs
.
clearMetaInformation
();
}
}
@Override
...
...
@@ -379,6 +416,7 @@ public abstract class AbstractBuilding extends CityObject {
handler
.
addInstance
(
buildingInstallations
);
handler
.
addInstance
(
buildingRooms
);
handler
.
addInstance
(
buildingRoomFurnitureList
);
handler
.
addInstance
(
buildingSubdivisions
);
}
@Override
...
...
@@ -397,6 +435,9 @@ public abstract class AbstractBuilding extends CityObject {
for
(
BuildingRoomFurniture
originalBFR
:
originalAb
.
buildingRoomFurnitureList
)
{
buildingRoomFurnitureList
.
add
(
handler
.
getCopyInstance
(
originalBFR
));
}
for
(
AbstractBuildingSubdivision
originalBSub
:
originalAb
.
buildingSubdivisions
)
{
buildingSubdivisions
.
add
(
handler
.
getCopyInstance
(
originalBSub
));
}
ab
=
originalAb
.
ab
;
}
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingSubdivision.java
0 → 100644
+
366
-
0
View file @
8dbd30ce
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.List
;
public
abstract
class
AbstractBuildingSubdivision
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
7033994252340571002L
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
AbstractBuildingSubdivision
.
class
);
private
final
List
<
Installation
>
buildingInstallations
=
new
ArrayList
<>(
2
);
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
private
final
List
<
BuildingRoom
>
buildingRooms
=
new
ArrayList
<>();
private
final
List
<
BuildingRoomFurniture
>
buildingRoomFurnitureList
=
new
ArrayList
<>();
private
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuildingSubdivision
abs
;
/**
* Getter for all boundary surfaces contained in this building.
*
* @return the boundary surfaces
*/
public
List
<
BoundarySurface
>
getBoundarySurfaces
()
{
return
boundarySurfaceList
;
}
@Override
public
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuildingSubdivision
getGmlObject
()
{
return
abs
;
}
@Override
public
FeatureType
getFeatureType
()
{
return
FeatureType
.
BUILDING
;
}
@Override
public
void
unsetGmlGeometries
()
{
abs
.
setLod1Solid
(
null
);
abs
.
setLod2Solid
(
null
);
abs
.
setLod3Solid
(
null
);
abs
.
setLod2MultiSurface
(
null
);
abs
.
setLod3MultiSurface
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
unsetGmlGeometries
();
}
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
unsetGmlGeometries
();
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
unsetGmlGeometries
();
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
unsetGmlGeometries
();
}
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
setMultiSurfaceAccordingToLod
(
geom
,
ms
);
}
else
{
Solid
solid
=
CityGmlUtils
.
createSolid
(
geom
,
factory
,
config
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
abs
.
getBoundaries
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
abs
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
return
;
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
switch
(
geom
.
getLod
())
{
case
LOD0:
abs
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
abs
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD3:
abs
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" multi surface to buildings"
);
}
}
private
void
setSolidAccordingToLod
(
Geometry
geom
,
Solid
solid
)
{
switch
(
geom
.
getLod
())
{
case
LOD1:
abs
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
abs
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
abs
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" solid to buildings"
);
}
}
@Override
public
void
accept
(
Check
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
}
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
accept
(
c
);
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
accept
(
c
);
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
accept
(
c
);
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
accept
(
c
);
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
collectContainedErrors
(
errors
);
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
collectContainedErrors
(
errors
);
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
collectContainedErrors
(
errors
);
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
collectContainedErrors
(
errors
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
clearAllContainedCheckResults
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearAllContainedCheckResults
();
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
clearAllContainedCheckResults
();
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
clearAllContainedCheckResults
();
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
Installation
bi
:
buildingInstallations
)
{
if
(
bi
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
if
(
br
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
if
(
bfr
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
Installation
bi
:
buildingInstallations
)
{
if
(
bi
.
containsAnyError
())
{
return
true
;
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsAnyError
())
{
return
true
;
}
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
if
(
br
.
containsAnyError
())
{
return
true
;
}
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
if
(
bfr
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
void
setCityGmlBuilding
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuildingSubdivision
abs
)
{
this
.
abs
=
abs
;
}
public
void
addBoundarySurface
(
BoundarySurface
bs
)
{
boundarySurfaceList
.
add
(
bs
);
bs
.
setParent
(
this
);
}
public
void
addBuildingInstallation
(
Installation
coBi
)
{
buildingInstallations
.
add
(
coBi
);
coBi
.
setParent
(
this
);
}
public
void
addBuildingRoom
(
BuildingRoom
room
)
{
buildingRooms
.
add
(
room
);
room
.
setParent
(
this
);
}
public
void
addBuildingRoomFurniture
(
BuildingRoomFurniture
roomFurniture
)
{
buildingRoomFurnitureList
.
add
(
roomFurniture
);
roomFurniture
.
setParent
(
this
);
}
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuildingSubdivision
abs
)
{
this
.
abs
=
abs
;
}
public
List
<
Installation
>
getBuildingInstallations
()
{
return
buildingInstallations
;
}
public
List
<
BuildingRoom
>
getBuildingRooms
()
{
return
buildingRooms
;
}
public
List
<
BuildingRoomFurniture
>
getBuildingRoomFurnitureList
()
{
return
buildingRoomFurnitureList
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
prepareForChecking
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
prepareForChecking
();
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
prepareForChecking
();
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
clearMetaInformation
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearMetaInformation
();
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
clearMetaInformation
();
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
boundarySurfaceList
);
handler
.
addInstance
(
buildingInstallations
);
handler
.
addInstance
(
buildingRooms
);
handler
.
addInstance
(
buildingRoomFurnitureList
);
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
AbstractBuildingSubdivision
originalAbs
=
(
AbstractBuildingSubdivision
)
original
;
for
(
BoundarySurface
originalBs
:
originalAbs
.
boundarySurfaceList
)
{
boundarySurfaceList
.
add
(
handler
.
getCopyInstance
(
originalBs
));
}
for
(
Installation
originalBi
:
originalAbs
.
buildingInstallations
)
{
buildingInstallations
.
add
(
handler
.
getCopyInstance
(
originalBi
));
}
for
(
BuildingRoom
originalBr
:
originalAbs
.
buildingRooms
)
{
buildingRooms
.
add
(
handler
.
getCopyInstance
(
originalBr
));
}
for
(
BuildingRoomFurniture
originalBFR
:
originalAbs
.
buildingRoomFurnitureList
)
{
buildingRoomFurnitureList
.
add
(
handler
.
getCopyInstance
(
originalBFR
));
}
abs
=
originalAbs
.
abs
;
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingRoom.java
+
3
-
9
View file @
8dbd30ce
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.building.BuildingFurnitureProperty
;
import
org.citygml4j.core.model.construction.AbstractFurnitureProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
java.io.Serial
;
import
java.util.ArrayList
;
...
...
@@ -19,14 +13,14 @@ public class BuildingRoom extends AbstractRoom{
@Serial
private
static
final
long
serialVersionUID
=
-
276088332165299253L
;
private
final
List
<
BuildingFurnitureProperty
>
furnitureRefs
=
new
ArrayList
<>(
2
);
private
AbstractBuilding
parent
;
private
CityObject
parent
;
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingRoom
cgmlRoom
){
super
.
cgmlRoom
=
cgmlRoom
;
}
public
void
setParent
(
AbstractBuilding
parent
){
public
void
setParent
(
CityObject
parent
){
this
.
parent
=
parent
;
}
...
...
@@ -43,7 +37,7 @@ public class BuildingRoom extends AbstractRoom{
return
furnitureRefs
;
}
public
AbstractBuilding
getParent
()
{
public
CityObject
getParent
()
{
return
parent
;
}
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets