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
8858aa45
Commit
8858aa45
authored
Oct 18, 2024
by
Riegel
Browse files
Add support for Tunnel
parent
61c6bd73
Changes
7
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractTunnel.java
0 → 100644
View file @
8858aa45
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
AbstractTunnel
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
-
2196414503088741206L
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
AbstractTunnel
.
class
);
private
final
List
<
Installation
>
tunnelInstallations
=
new
ArrayList
<>(
2
);
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
private
final
List
<
TunnelHollow
>
tunnelHollows
=
new
ArrayList
<>();
private
final
List
<
TunnelPart
>
tunnelParts
=
new
ArrayList
<>();
private
final
List
<
TunnelFurniture
>
tunnelFurnitureList
=
new
ArrayList
<>();
private
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
at
;
/**
* 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
.
tunnel
.
AbstractTunnel
getGmlObject
()
{
return
at
;
}
@Override
public
FeatureType
getFeatureType
()
{
return
FeatureType
.
TUNNEL
;
}
@Override
public
void
unsetGmlGeometries
()
{
at
.
setLod1Solid
(
null
);
at
.
setLod2Solid
(
null
);
at
.
setLod3Solid
(
null
);
at
.
setLod2MultiSurface
(
null
);
at
.
setLod3MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
at
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
unsetGmlGeometries
();
}
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
unsetGmlGeometries
();
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
unsetGmlGeometries
();
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
unsetGmlGeometries
();
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
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
:
tunnelInstallations
)
{
bi
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
at
.
getBoundaries
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
at
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
return
;
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
switch
(
geom
.
getLod
())
{
case
LOD0:
at
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
at
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
at
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD3:
at
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD4:
at
.
getDeprecatedProperties
().
setLod4MultiSurface
(
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:
at
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
at
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
at
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD4:
at
.
getDeprecatedProperties
().
setLod4Solid
(
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
:
tunnelInstallations
)
{
bi
.
accept
(
c
);
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
accept
(
c
);
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
accept
(
c
);
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
accept
(
c
);
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
accept
(
c
);
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
collectContainedErrors
(
errors
);
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
collectContainedErrors
(
errors
);
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
collectContainedErrors
(
errors
);
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
collectContainedErrors
(
errors
);
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
collectContainedErrors
(
errors
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
clearAllContainedCheckResults
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearAllContainedCheckResults
();
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
clearAllContainedCheckResults
();
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
clearAllContainedCheckResults
();
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearAllContainedCheckResults
();
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
Installation
bi
:
tunnelInstallations
)
{
if
(
bi
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
if
(
th
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
if
(
tfr
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
Installation
bi
:
tunnelInstallations
)
{
if
(
bi
.
containsAnyError
())
{
return
true
;
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsAnyError
())
{
return
true
;
}
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
if
(
th
.
containsAnyError
())
{
return
true
;
}
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
if
(
tfr
.
containsAnyError
())
{
return
true
;
}
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
void
setCityGmlBuilding
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
at
)
{
this
.
at
=
at
;
}
public
void
addBoundarySurface
(
BoundarySurface
bs
)
{
boundarySurfaceList
.
add
(
bs
);
bs
.
setParent
(
this
);
}
public
void
addTunnelInstallation
(
Installation
coBi
)
{
tunnelInstallations
.
add
(
coBi
);
coBi
.
setParent
(
this
);
}
public
void
addTunnelHollow
(
TunnelHollow
hollow
)
{
tunnelHollows
.
add
(
hollow
);
hollow
.
setParent
(
this
);
}
public
void
addTunnelFurniture
(
TunnelFurniture
furniture
)
{
tunnelFurnitureList
.
add
(
furniture
);
furniture
.
setParent
(
this
);
}
public
void
addTunnelPart
(
TunnelPart
tunnelPart
)
{
tunnelParts
.
add
(
tunnelPart
);
}
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
at
)
{
this
.
at
=
at
;
}
public
List
<
Installation
>
getTunnelInstallations
()
{
return
tunnelInstallations
;
}
public
List
<
TunnelHollow
>
getTunnelHollows
()
{
return
tunnelHollows
;
}
public
List
<
TunnelFurniture
>
getTunnelFurnitureList
()
{
return
tunnelFurnitureList
;
}
public
List
<
TunnelPart
>
getTunnelParts
()
{
return
tunnelParts
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
prepareForChecking
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
prepareForChecking
();
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
prepareForChecking
();
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
prepareForChecking
();
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
clearMetaInformation
();
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearMetaInformation
();
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
clearMetaInformation
();
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
clearMetaInformation
();
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
boundarySurfaceList
);
handler
.
addInstance
(
tunnelInstallations
);
handler
.
addInstance
(
tunnelHollows
);
handler
.
addInstance
(
tunnelFurnitureList
);
handler
.
addInstance
(
tunnelParts
);
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
AbstractTunnel
originalAt
=
(
AbstractTunnel
)
original
;
for
(
BoundarySurface
originalBs
:
originalAt
.
boundarySurfaceList
)
{
boundarySurfaceList
.
add
(
handler
.
getCopyInstance
(
originalBs
));
}
for
(
Installation
originalTi
:
originalAt
.
tunnelInstallations
)
{
tunnelInstallations
.
add
(
handler
.
getCopyInstance
(
originalTi
));
}
for
(
TunnelHollow
originalTh
:
originalAt
.
tunnelHollows
)
{
tunnelHollows
.
add
(
handler
.
getCopyInstance
(
originalTh
));
}
for
(
TunnelFurniture
originalTFR
:
originalAt
.
tunnelFurnitureList
)
{
tunnelFurnitureList
.
add
(
handler
.
getCopyInstance
(
originalTFR
));
}
for
(
TunnelPart
originalTp
:
originalAt
.
tunnelParts
)
{
tunnelParts
.
add
(
handler
.
getCopyInstance
(
originalTp
));
}
at
=
originalAt
.
at
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/FeatureType.java
View file @
8858aa45
...
...
@@ -27,6 +27,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
public
enum
FeatureType
{
BUILDING
,
TRANSPORTATION
,
VEGETATION
,
BRIDGE
,
LAND
,
WATER
,
BOUNDARY_SURFACE
,
INSTALLATION
,
OPENING
,
BUILDING_PART
,
BRIDGE_CONSTRUCTION_ELEMENT
,
BRIDGE_INSTALLATION
,
ROOM
,
FURNITURE
,
CITY_FURNITURE
,
GENERIC_CITY_OBJECT
BUILDING_PART
,
BRIDGE_CONSTRUCTION_ELEMENT
,
BRIDGE_INSTALLATION
,
ROOM
,
FURNITURE
,
CITY_FURNITURE
,
GENERIC_CITY_OBJECT
,
TUNNEL
,
TUNNEL_PART
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java
View file @
8858aa45
...
...
@@ -27,8 +27,8 @@ public class LibraryObject extends Geometry{
private
static
HashMap
<
String
,
LibraryObject
>
libraryObjects
=
new
HashMap
<>();
public
static
LibraryObject
of
(
Path
path
,
ParserConfiguration
config
)
{
if
(
libraryObjects
.
containsKey
(
path
))
{
return
libraryObjects
.
get
(
path
);
if
(
libraryObjects
.
containsKey
(
path
.
toString
()
))
{
return
libraryObjects
.
get
(
path
.
toString
()
);
}
Geometry
protoGeom
=
parseFile
(
path
,
config
);
if
(
protoGeom
==
null
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Tunnel.java
0 → 100644
View file @
8858aa45
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.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.model.tunnel.TunnelInstallation
;
import
org.citygml4j.core.model.tunnel.TunnelInstallationProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Tunnel
extends
AbstractTunnel
{
@Serial
private
static
final
long
serialVersionUID
=
5316281216192555555L
;
private
List
<
TunnelPart
>
tunnelParts
=
new
ArrayList
<>();
public
List
<
TunnelPart
>
getTunnelParts
()
{
return
tunnelParts
;
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
public
void
accept
(
Check
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
accept
(
c
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
collectContainedErrors
(
errors
);
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
public
void
addTunnelPart
(
TunnelPart
tunnelPart
)
{
tunnelParts
.
add
(
tunnelPart
);
}
@Override
public
String
toString
()
{
return
"Tunnel [id="
+
getGmlId
()
+
"]"
;
}
public
void
anonymize
()
{
for
(
Geometry
geom
:
getGeometries
())
{
geom
.
anonymize
();
}
org
.
citygml4j
.
core
.
model
.
tunnel
.
Tunnel
gmlT
=
new
org
.
citygml4j
.
core
.
model
.
tunnel
.
Tunnel
();
gmlT
.
setId
(
GmlId
.
generateId
().
getGmlString
());
for
(
Installation
ti
:
getTunnelInstallations
())
{
ti
.
anonymize
();
gmlT
.
getTunnelInstallations
().
add
(
new
TunnelInstallationProperty
((
TunnelInstallation
)
ti
.
getGmlObject
()));
}
for
(
BoundarySurface
bs
:
getBoundarySurfaces
())
{
bs
.
anonymize
();
gmlT
.
addBoundary
(
new
AbstractSpaceBoundaryProperty
(
bs
.
getGmlObject
()));
}
setCityGmlBuilding
(
gmlT
);
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearMetaInformation
();
}
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
prepareForChecking
();
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
Tunnel
originalTunnel
=
(
Tunnel
)
original
;
for
(
TunnelPart
originalTp
:
originalTunnel
.
tunnelParts
)
{
tunnelParts
.
add
(
handler
.
getCopyInstance
(
originalTp
));
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
handler
.
addInstance
(
tp
);
}
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
Tunnel
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelFurniture.java
0 → 100644
View file @
8858aa45
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.building.BuildingFurniture
;
import
java.io.Serial
;
public
class
TunnelFurniture
extends
AbstractFurniture
{
@Serial
private
static
final
long
serialVersionUID
=
-
4667219019432204174L
;
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelFurniture
gmlObject
)
{
super
.
setGmlObject
(
gmlObject
);
}
@Override
public
Copyable
createCopyInstance
(){
return
new
BuildingRoomFurniture
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelHollow.java
0 → 100644
View file @
8858aa45
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.tunnel.TunnelFurnitureProperty
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TunnelHollow
extends
AbstractRoom
{
@Serial
private
static
final
long
serialVersionUID
=
-
276088332165299253L
;
private
final
List
<
TunnelFurnitureProperty
>
furnitureRefs
=
new
ArrayList
<>(
2
);
private
CityObject
parent
;
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingRoom
cgmlRoom
){
super
.
cgmlRoom
=
cgmlRoom
;
}
public
void
setParent
(
CityObject
parent
){
this
.
parent
=
parent
;
}
public
void
addFurnitureRef
(
TunnelFurnitureProperty
furnitureRef
)
{
furnitureRefs
.
add
(
furnitureRef
);
}
public
List
<
TunnelFurnitureProperty
>
getFurnitureRefs
()
{
return
furnitureRefs
;
}
public
CityObject
getParent
()
{
return
parent
;
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
){
super
.
fillValues
(
original
,
handler
);
TunnelHollow
oHollow
=
(
TunnelHollow
)
original
;
parent
=
handler
.
getCopyInstance
(
oHollow
.
getParent
());
}
@Override
public
void
collectInstances
(
CopyHandler
handler
){
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
parent
);
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TunnelHollow
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelPart.java
0 → 100644
View file @
8858aa45
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
java.io.Serial
;
public
class
TunnelPart
extends
AbstractTunnel
{
@Serial
private
static
final
long
serialVersionUID
=
8200322261958679163L
;
private
Tunnel
parent
;
private
TunnelPart
()
{
}
public
TunnelPart
(
Tunnel
parent
)
{
this
.
parent
=
parent
;
parent
.
addTunnelPart
(
this
);
}
public
Tunnel
getParent
()
{
return
parent
;
}
@Override
public
FeatureType
getFeatureType
()
{
return
FeatureType
.
TUNNEL_PART
;
}
@Override
public
String
toString
()
{
return
"TunnelPart [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TunnelPart
originalPart
=
(
TunnelPart
)
original
;
parent
=
handler
.
getCopyInstance
(
originalPart
.
parent
);
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
parent
);
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TunnelPart
();
}
}
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