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
845dd0a6
Commit
845dd0a6
authored
May 06, 2025
by
Matthias Betz
Browse files
Merge remote-tracking branch 'remotes/origin/dev' into 111-update-dependencies
parents
8a94994e
ffe66fd4
Pipeline
#11079
passed with stage
in 1 minute and 24 seconds
Changes
162
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/LandUseTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.landuse.LandUse
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
public
class
LandUseTest
{
private
LandUse
lu
;
private
LandObject
land
;
@Before
public
void
setUp
()
{
lu
=
new
LandUse
();
land
=
new
LandObject
(
lu
);
}
@Test
public
void
testContainsError
()
{
assertFalse
(
land
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
land
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
land
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
land
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_NON_PLANAR
,
ResultStatus
.
OK
,
mock
(
CheckError
.
class
)));
assertTrue
(
land
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
land
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
}
@Test
public
void
testClearAllContainedCheckResults
()
{
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertEquals
(
1
,
land
.
getAllCheckResults
().
size
());
land
.
clearAllContainedCheckResults
();
assertTrue
(
land
.
getAllCheckResults
().
isEmpty
());
}
@Test
public
void
testContainsAnyError
()
{
assertFalse
(
land
.
containsAnyError
());
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
land
.
containsAnyError
());
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
land
.
containsAnyError
());
}
@Test
public
void
testCollectContainedErrors
()
{
land
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
land
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGeometries
()
{
lu
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
lu
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
land
.
clearGmlGeometries
();
assertNull
(
lu
.
getLod0MultiSurface
());
assertNull
(
lu
.
getLod1MultiSurface
());
assertNull
(
lu
.
getLod2MultiSurface
());
assertNull
(
lu
.
getLod3MultiSurface
());
assertNull
(
lu
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometries
()
{
land
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
land
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
land
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
land
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
land
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
land
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
lu
.
getLod0MultiSurface
());
assertNotNull
(
lu
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
lu
.
getLod1MultiSurface
());
assertNotNull
(
lu
.
getLod1MultiSurface
().
getObject
());
assertNotNull
(
lu
.
getLod2MultiSurface
());
assertNotNull
(
lu
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
lu
.
getLod3MultiSurface
());
assertNotNull
(
lu
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
lu
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
lu
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
}
\ No newline at end of file
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/ReliefObjectTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
org.citygml4j.core.model.relief.ReliefFeature
;
import
org.junit.Test
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
ReliefObjectTest
{
@Test
public
void
testVisitorPropagationReliefObject
()
{
ReliefFeature
mockRelief
=
new
ReliefFeature
();
ReliefObject
relief
=
new
ReliefObject
(
mockRelief
);
TinObject
mockTin
=
mock
(
TinObject
.
class
);
relief
.
addComponent
(
mockTin
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
relief
.
accept
(
c
);
verify
(
mockTin
).
accept
(
c
);
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TinObjectTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.relief.TINRelief
;
import
org.citygml4j.core.model.relief.TinProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
TinObjectTest
{
@Test
public
void
testVisitorPropagation
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
Geometry
mockGeometry
=
mock
(
Geometry
.
class
);
tin
.
addGeometry
(
mockGeometry
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
tin
.
accept
(
c
);
verify
(
mockGeometry
).
accept
(
c
);
}
@Test
public
void
testContainsError
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
assertFalse
(
tin
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tin
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tin
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tin
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_NON_PLANAR
,
ResultStatus
.
OK
,
mock
(
CheckError
.
class
)));
assertTrue
(
tin
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tin
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
}
@Test
public
void
testClearAllContainedCheckResults
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertEquals
(
1
,
tin
.
getAllCheckResults
().
size
());
tin
.
clearAllContainedCheckResults
();
assertTrue
(
tin
.
getAllCheckResults
().
isEmpty
());
}
@Test
public
void
testContainsAnyError
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
assertFalse
(
tin
.
containsAnyError
());
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
tin
.
containsAnyError
());
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tin
.
containsAnyError
());
}
@Test
public
void
testCollectContainedErrors
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
tin
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tin
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGeometries
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
tir
.
setTin
(
new
TinProperty
());
tin
.
clearGmlGeometries
();
assertNull
(
tir
.
getTin
());
}
@Test
public
void
testReCreateGeometries
()
{
TINRelief
tir
=
new
TINRelief
();
TinObject
tin
=
new
TinObject
(
tir
);
tin
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
tin
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
tir
.
getTin
());
assertNotNull
(
tir
.
getTin
().
getObject
());
assertEquals
(
2
,
tir
.
getLod
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TopLevelTransportFeatureTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.deprecated.transportation.DeprecatedPropertiesOfAbstractTransportationSpace
;
import
org.citygml4j.core.model.transportation.Railway
;
import
org.citygml4j.core.model.transportation.Road
;
import
org.citygml4j.core.model.transportation.Square
;
import
org.citygml4j.core.model.transportation.Track
;
import
org.citygml4j.core.model.transportation.Waterway
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
public
class
TopLevelTransportFeatureTest
{
@Test
public
void
testObjectConstruction
()
{
TopLevelTransportFeature
road
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Road
.
class
));
assertEquals
(
TransportationObject
.
TransportationType
.
ROAD
,
road
.
getTransportationType
());
TopLevelTransportFeature
track
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Track
.
class
));
assertEquals
(
TransportationObject
.
TransportationType
.
TRACK
,
track
.
getTransportationType
());
TopLevelTransportFeature
waterway
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Waterway
.
class
));
assertEquals
(
TransportationObject
.
TransportationType
.
WATERWAY
,
waterway
.
getTransportationType
());
TopLevelTransportFeature
railway
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Railway
.
class
));
assertEquals
(
TransportationObject
.
TransportationType
.
RAILWAY
,
railway
.
getTransportationType
());
TopLevelTransportFeature
square
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Square
.
class
));
assertEquals
(
TransportationObject
.
TransportationType
.
SQUARE
,
square
.
getTransportationType
());
}
@Test
public
void
testVisitorPropagation
()
{
Road
road
=
new
Road
();
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
road
);
TransportSection
mockSection
=
mock
(
TransportSection
.
class
);
TransportSection
mockIntersection
=
mock
(
TransportSection
.
class
);
top
.
addSection
(
mockSection
);
top
.
addIntersection
(
mockIntersection
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
top
.
accept
(
c
);
verify
(
mockSection
).
accept
(
c
);
verify
(
mockIntersection
).
accept
(
c
);
}
@Test
public
void
testContainsError
()
{
Road
road
=
new
Road
();
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
road
);
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_NON_PLANAR
,
ResultStatus
.
OK
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_NON_PLANAR
));
}
@Test
public
void
testContainsAnyError
()
{
Road
road
=
new
Road
();
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
road
);
assertFalse
(
top
.
containsAnyError
());
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
top
.
containsAnyError
());
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsAnyError
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
top
.
clearAllContainedCheckResults
();
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testCollectContainedErrors
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
top
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGmlGeometries
()
{
Road
r
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
r
);
top
.
setGmlObject
(
r
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
dSpace
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
top
.
unsetGmlGeometries
();
assertNull
(
dSpace
.
getLod1MultiSurface
());
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesSolid
()
{
Road
gmlRoad
=
new
Road
();
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
gmlRoad
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
top
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlRoad
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlRoad
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlRoad
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
Road
gmlRoad
=
new
Road
();
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
gmlRoad
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
top
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlRoad
.
getLod0MultiSurface
());
assertNotNull
(
gmlRoad
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlRoad
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlRoad
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlRoad
.
getLod2MultiSurface
());
assertNotNull
(
gmlRoad
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlRoad
.
getLod3MultiSurface
());
assertNotNull
(
gmlRoad
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlRoad
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
gmlRoad
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficAreaTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractThematicSurface
;
import
org.citygml4j.core.model.transportation.TrafficArea
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
public
class
TrafficAreaTest
{
@Test
public
void
testContainsError
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testContainsAnyError
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
assertFalse
(
tao
.
containsAnyError
());
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
tao
.
containsAnyError
());
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tao
.
containsAnyError
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tao
.
clearAllContainedCheckResults
();
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testCollectContainedErrors
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tao
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGmlGeometries
()
{
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
r
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
r
);
DeprecatedPropertiesOfAbstractThematicSurface
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
r
.
setLod0MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
ta
.
unsetGmlGeometries
();
assertNull
(
r
.
getLod0MultiSurface
());
assertNull
(
r
.
getLod1MultiSurface
());
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
TrafficArea
gmlAus
=
new
TrafficArea
()
{
};
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
tao
.
setGmlObject
(
gmlAus
);
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
tao
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAus
.
getLod0MultiSurface
());
assertNotNull
(
gmlAus
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAus
.
getLod2MultiSurface
());
assertNotNull
(
gmlAus
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAus
.
getLod3MultiSurface
());
assertNotNull
(
gmlAus
.
getLod3MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficSpaceTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.ClearCheckResultsVisitor
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundary
;
import
org.citygml4j.core.model.core.AbstractUnoccupiedSpace
;
import
org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractCityObject
;
import
org.citygml4j.core.model.transportation.TrafficSpace
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
public
class
TrafficSpaceTest
{
@Test
public
void
testVisitorPropagation
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficAreaObject
areaMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
areaMock
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
tso
.
accept
(
c
);
verify
(
areaMock
).
accept
(
c
);
}
@Test
public
void
testContainsError
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testContainsAnyError
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
assertFalse
(
tso
.
containsAnyError
());
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
tso
.
containsAnyError
());
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsAnyError
());
}
@Test
public
void
testCollectContainedErrors
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tso
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tso
.
clearAllContainedCheckResults
();
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
verify
(
taMock
).
accept
(
any
(
ClearCheckResultsVisitor
.
class
));
}
@Test
public
void
testUnsetGmlGeometries
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
t
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
t
);
DeprecatedPropertiesOfAbstractCityObject
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractCityObject
.
class
);
when
(
t
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
t
.
setLod0MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
t
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
t
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
tso
.
unsetGmlGeometries
();
assertNull
(
t
.
getLod0MultiSurface
());
assertNull
(
t
.
getLod2MultiSurface
());
assertNull
(
t
.
getLod3MultiSurface
());
}
@Test
public
void
testReCreateGeometriesSolid
()
{
AbstractUnoccupiedSpace
gmlAus
=
new
AbstractUnoccupiedSpace
()
{
@Override
public
boolean
isValidBoundary
(
Class
<?
extends
AbstractSpaceBoundary
>
type
)
{
return
false
;
}
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
)
{
};
tso
.
setGmlObject
(
gmlAus
);
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
tso
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAus
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAus
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAus
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
AbstractUnoccupiedSpace
gmlAus
=
new
AbstractUnoccupiedSpace
()
{
@Override
public
boolean
isValidBoundary
(
Class
<?
extends
AbstractSpaceBoundary
>
type
)
{
return
false
;
}
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
tso
.
setGmlObject
(
gmlAus
);
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
tso
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAus
.
getLod0MultiSurface
());
assertNotNull
(
gmlAus
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAus
.
getLod2MultiSurface
());
assertNotNull
(
gmlAus
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAus
.
getLod3MultiSurface
());
assertNotNull
(
gmlAus
.
getLod3MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObjectTest.java
View file @
845dd0a6
...
...
@@ -19,41 +19,10 @@
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractCityObject
;
import
org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractThematicSurface
;
import
org.citygml4j.core.model.deprecated.transportation.DeprecatedPropertiesOfAbstractTransportationSpace
;
import
org.citygml4j.core.model.transportation.Intersection
;
import
org.citygml4j.core.model.transportation.Railway
;
import
org.citygml4j.core.model.transportation.Road
;
import
org.citygml4j.core.model.transportation.Section
;
import
org.citygml4j.core.model.transportation.Square
;
import
org.citygml4j.core.model.transportation.Track
;
import
org.citygml4j.core.model.transportation.TrafficArea
;
import
org.citygml4j.core.model.transportation.TrafficSpace
;
import
org.citygml4j.core.model.transportation.Waterway
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.datastructure.TransportationObject.TransportationType
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
public
class
TransportationObjectTest
{
...
...
@@ -63,476 +32,5 @@ public class TransportationObjectTest {
assertEquals
(
FeatureType
.
TRANSPORTATION
,
to
.
getFeatureType
());
}
@Test
public
void
testObjectConstruction
()
{
TopLevelTransportFeature
road
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Road
.
class
));
assertEquals
(
TransportationType
.
ROAD
,
road
.
getTransportationType
());
TopLevelTransportFeature
track
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Track
.
class
));
assertEquals
(
TransportationType
.
TRACK
,
track
.
getTransportationType
());
TopLevelTransportFeature
waterway
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Waterway
.
class
));
assertEquals
(
TransportationType
.
WATERWAY
,
waterway
.
getTransportationType
());
TopLevelTransportFeature
railway
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Railway
.
class
));
assertEquals
(
TransportationType
.
RAILWAY
,
railway
.
getTransportationType
());
TopLevelTransportFeature
square
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Square
.
class
));
assertEquals
(
TransportationType
.
SQUARE
,
square
.
getTransportationType
());
}
@Test
(
expected
=
IllegalStateException
.
class
)
public
void
testReCreateGeometriesSolid
()
{
TopLevelTransportFeature
to
=
TopLevelTransportFeature
.
from
(
Mockito
.
mock
(
Road
.
class
));
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
}
@Test
public
void
testReCreateGeometriesTransportationSpace
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod2MultiSurface
(
any
());
verify
(
sectionMock
).
reCreateGeometries
(
any
(),
any
());
verify
(
intersectionMock
).
reCreateGeometries
(
any
(),
any
());
verify
(
tsMock
).
reCreateGeometries
(
any
(),
any
());
verify
(
auxTsMock
).
reCreateGeometries
(
any
(),
any
());
}
@Test
public
void
testReCreateGeometriesTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taoMock
=
Mockito
.
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taoMock
);
tso
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
tso
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
tsMock
).
setLod2MultiSurface
(
any
());
verify
(
taoMock
).
reCreateGeometries
(
any
(),
any
());
}
@Test
public
void
testReCreateGeometriesTrafficArea
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
tao
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
tao
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
taMock
).
setLod2MultiSurface
(
any
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceLod0
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TrafficSpaceObject
ts
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
trafficSpaceMock
=
mock
(
TrafficSpace
.
class
);
ts
.
setGmlObject
(
trafficSpaceMock
);
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
trafficAreaMock
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
trafficAreaMock
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
ts
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
ta
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ts
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ta
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod0MultiSurface
(
any
());
verify
(
trafficSpaceMock
).
setLod0MultiSurface
(
any
());
verify
(
trafficAreaMock
).
setLod0MultiSurface
(
any
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceLod1
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
trafficAreaMock
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
trafficAreaMock
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
roadMock
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
try
{
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
}
catch
(
IllegalArgumentException
e
)
{
fail
(
"Casting of original GML object to AbstractTransportationSpace should work"
);
}
ta
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ta
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
dSpace
).
setLod1MultiSurface
(
any
());
verify
(
trafficAreaMock
).
setLod1MultiSurface
(
any
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceLod2
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TrafficSpaceObject
ts
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
trafficSpaceMock
=
mock
(
TrafficSpace
.
class
);
ts
.
setGmlObject
(
trafficSpaceMock
);
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
trafficAreaMock
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
trafficAreaMock
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
ts
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
ta
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ts
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ta
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod2MultiSurface
(
any
());
verify
(
trafficSpaceMock
).
setLod2MultiSurface
(
any
());
verify
(
trafficAreaMock
).
setLod2MultiSurface
(
any
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceLod3
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TrafficSpaceObject
ts
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
trafficSpaceMock
=
mock
(
TrafficSpace
.
class
);
ts
.
setGmlObject
(
trafficSpaceMock
);
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
trafficAreaMock
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
trafficAreaMock
);
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
ts
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
ta
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ts
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ta
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod3MultiSurface
(
any
());
verify
(
trafficSpaceMock
).
setLod3MultiSurface
(
any
());
verify
(
trafficAreaMock
).
setLod3MultiSurface
(
any
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceLod4
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
trafficAreaMock
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
trafficAreaMock
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
roadMock
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
DeprecatedPropertiesOfAbstractThematicSurface
dArea
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
trafficAreaMock
.
getDeprecatedProperties
()).
thenReturn
(
dArea
);
ta
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
try
{
top
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
}
catch
(
IllegalArgumentException
e
)
{
fail
(
"Casting of original GML object to AbstractTransportationSpace should work"
);
}
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
top
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
ta
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
dSpace
).
setLod4MultiSurface
(
any
());
verify
(
dArea
).
setLod4MultiSurface
(
any
());
}
@Test
public
void
testContainsErrorTransportationSpace
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
verify
(
sectionMock
).
containsError
(
any
());
verify
(
intersectionMock
).
containsError
(
any
());
verify
(
tsMock
).
containsError
(
any
());
verify
(
auxTsMock
).
containsError
(
any
());
}
@Test
public
void
testContainsErrorTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
verify
(
taMock
).
containsError
(
any
());
}
@Test
public
void
testContainsErrorTrafficArea
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testClearAllContainedCheckResultsTransportationSpace
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
top
.
clearAllContainedCheckResults
();
assertFalse
(
top
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
verify
(
sectionMock
).
clearAllContainedCheckResults
();
verify
(
intersectionMock
).
clearAllContainedCheckResults
();
verify
(
tsMock
).
clearAllContainedCheckResults
();
verify
(
auxTsMock
).
clearAllContainedCheckResults
();
}
@Test
public
void
testClearAllContainedCheckResultsTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tso
.
clearAllContainedCheckResults
();
assertFalse
(
tso
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
verify
(
taMock
).
clearAllContainedCheckResults
();
}
@Test
public
void
testClearAllContainedCheckResultsTrafficArea
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
tao
.
clearAllContainedCheckResults
();
assertFalse
(
tao
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testCollectContainedErrorsTransportationSpace
()
{
Road
roadMock
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
roadMock
);
top
.
setGmlObject
(
roadMock
);
TransportSection
sectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TransportSection
intersectionMock
=
Mockito
.
mock
(
TransportSection
.
class
);
TrafficSpaceObject
tsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxTsMock
=
Mockito
.
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
sectionMock
);
top
.
addIntersection
(
intersectionMock
);
top
.
addTrafficSpace
(
tsMock
);
top
.
addAuxTrafficSpace
(
auxTsMock
);
top
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
top
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
verify
(
sectionMock
).
collectContainedErrors
(
errors
);
verify
(
intersectionMock
).
collectContainedErrors
(
errors
);
verify
(
tsMock
).
collectContainedErrors
(
errors
);
verify
(
auxTsMock
).
collectContainedErrors
(
errors
);
}
@Test
public
void
testCollectContainedErrorsTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
tsMock
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
tsMock
);
TrafficAreaObject
taMock
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
taMock
);
tso
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tso
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
verify
(
taMock
).
collectContainedErrors
(
errors
);
}
@Test
public
void
testCollectContainedErrorsTrafficArea
()
{
TrafficAreaObject
tao
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
taMock
=
mock
(
TrafficArea
.
class
);
tao
.
setGmlObject
(
taMock
);
tao
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
tao
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGmlGeometriesTransportationSpace
()
{
Road
r
=
mock
(
Road
.
class
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
r
);
top
.
setGmlObject
(
r
);
TransportSection
mockSection
=
mock
(
TransportSection
.
class
);
TransportSection
mockInterestSection
=
mock
(
TransportSection
.
class
);
TrafficSpaceObject
mockSpace
=
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxMockSpace
=
mock
(
TrafficSpaceObject
.
class
);
top
.
addSection
(
mockSection
);
top
.
addIntersection
(
mockInterestSection
);
top
.
addTrafficSpace
(
mockSpace
);
top
.
addAuxTrafficSpace
(
auxMockSpace
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
dSpace
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
top
.
unsetGmlGeometries
();
assertNull
(
dSpace
.
getLod1MultiSurface
());
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
verify
(
mockSection
).
unsetGmlGeometries
();
verify
(
mockInterestSection
).
unsetGmlGeometries
();
verify
(
mockSpace
).
unsetGmlGeometries
();
verify
(
auxMockSpace
).
unsetGmlGeometries
();
}
@Test
public
void
testUnsetGmlGeometriesTrafficSpace
()
{
TrafficSpaceObject
tso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TrafficSpace
t
=
mock
(
TrafficSpace
.
class
);
tso
.
setGmlObject
(
t
);
TrafficAreaObject
mockArea
=
mock
(
TrafficAreaObject
.
class
);
tso
.
addTrafficArea
(
mockArea
);
DeprecatedPropertiesOfAbstractCityObject
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractCityObject
.
class
);
when
(
t
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
t
.
setLod0MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
t
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
t
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
tso
.
unsetGmlGeometries
();
assertNull
(
t
.
getLod0MultiSurface
());
assertNull
(
t
.
getLod2MultiSurface
());
assertNull
(
t
.
getLod3MultiSurface
());
verify
(
mockArea
).
unsetGmlGeometries
();
}
@Test
public
void
testUnsetGmlGeometriesTrafficArea
()
{
TrafficAreaObject
ta
=
new
TrafficAreaObject
(
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
TrafficArea
r
=
mock
(
TrafficArea
.
class
);
ta
.
setGmlObject
(
r
);
DeprecatedPropertiesOfAbstractThematicSurface
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
r
.
setLod0MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
ta
.
unsetGmlGeometries
();
assertNull
(
r
.
getLod0MultiSurface
());
assertNull
(
r
.
getLod1MultiSurface
());
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationSpaceTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.transportation.AbstractTransportationSpace
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.junit.Test
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
TransportationSpaceTest
{
@Test
public
void
testVisitorPropagation
()
{
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
TrafficSpaceObject
mockSpace
=
mock
(
TrafficSpaceObject
.
class
);
TrafficSpaceObject
auxMockSpace
=
mock
(
TrafficSpaceObject
.
class
);
space
.
addTrafficSpace
(
mockSpace
);
space
.
addAuxTrafficSpace
(
auxMockSpace
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
space
.
accept
(
c
);
verify
(
mockSpace
).
accept
(
c
);
verify
(
auxMockSpace
).
accept
(
c
);
}
@Test
public
void
testContainsError
()
{
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
space
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
space
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
space
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testContainsAnyError
()
{
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
assertFalse
(
space
.
containsAnyError
());
space
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
space
.
containsAnyError
());
space
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
space
.
containsAnyError
());
}
@Test
public
void
testCollectContainedErrors
()
{
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
space
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
space
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
assertFalse
(
space
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
space
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
space
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
space
.
clearAllContainedCheckResults
();
assertFalse
(
space
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testReCreateGeometriesSolid
()
{
AbstractTransportationSpace
gmlAts
=
new
AbstractTransportationSpace
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
space
.
setGmlObject
(
gmlAts
);
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
space
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAts
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAts
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAts
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
AbstractTransportationSpace
gmlAts
=
new
AbstractTransportationSpace
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
TransportationSpace
space
=
new
TransportationSpace
(
TransportationObject
.
TransportationType
.
TRANSPORTATION_COMPLEX
)
{
};
space
.
setGmlObject
(
gmlAts
);
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
space
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
space
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAts
.
getLod0MultiSurface
());
assertNotNull
(
gmlAts
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAts
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlAts
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlAts
.
getLod2MultiSurface
());
assertNotNull
(
gmlAts
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAts
.
getLod3MultiSurface
());
assertNotNull
(
gmlAts
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlAts
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
gmlAts
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/VegetationTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.vegetation.PlantCover
;
import
org.citygml4j.core.model.vegetation.SolitaryVegetationObject
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.GeometryProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSolidProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
public
class
VegetationTest
{
//TODO: Recreate geometries tests
@Test
public
void
testContainsError
()
{
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
veg
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
veg
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
veg
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testContainsAnyError
()
{
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
assertFalse
(
veg
.
containsAnyError
());
veg
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
veg
.
containsAnyError
());
veg
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
veg
.
containsAnyError
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
assertFalse
(
veg
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
veg
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
veg
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
veg
.
clearAllContainedCheckResults
();
assertFalse
(
veg
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testCollectContainedErrors
()
{
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
veg
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
veg
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGmlGeometriesPlantCover
()
{
Vegetation
plantCover
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
PlantCover
gmlCover
=
new
PlantCover
();
plantCover
.
setGmlObject
(
gmlCover
);
gmlCover
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
gmlCover
.
setLod1Solid
(
new
SolidProperty
());
gmlCover
.
setLod2Solid
(
new
SolidProperty
());
gmlCover
.
setLod3Solid
(
new
SolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod1MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod2MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod3MultiSolid
(
new
MultiSolidProperty
());
gmlCover
.
getDeprecatedProperties
().
setLod4MultiSolid
(
new
MultiSolidProperty
());
plantCover
.
clearGmlGeometries
();
assertNull
(
gmlCover
.
getLod0MultiSurface
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlCover
.
getLod2MultiSurface
());
assertNull
(
gmlCover
.
getLod3MultiSurface
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNull
(
gmlCover
.
getLod1Solid
());
assertNull
(
gmlCover
.
getLod2Solid
());
assertNull
(
gmlCover
.
getLod3Solid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod1MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod2MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod3MultiSolid
());
assertNull
(
gmlCover
.
getDeprecatedProperties
().
getLod4MultiSolid
());
}
@Test
public
void
testUnsetGmlGeometriesSolitaryVegetationObject
()
{
Vegetation
solitary
=
new
Vegetation
(
Vegetation
.
VegetationType
.
SOLITARY_VEGETATION_OBJECT
);
SolitaryVegetationObject
gmlSolitary
=
new
SolitaryVegetationObject
();
solitary
.
setGmlObject
(
gmlSolitary
);
gmlSolitary
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlSolitary
.
setLod1Solid
(
new
SolidProperty
());
gmlSolitary
.
setLod2Solid
(
new
SolidProperty
());
gmlSolitary
.
setLod3Solid
(
new
SolidProperty
());
gmlSolitary
.
getDeprecatedProperties
().
setLod1Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod2Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod3Geometry
(
new
GeometryProperty
<>());
gmlSolitary
.
getDeprecatedProperties
().
setLod4Geometry
(
new
GeometryProperty
<>());
solitary
.
clearGmlGeometries
();
assertNull
(
gmlSolitary
.
getLod0MultiSurface
());
assertNull
(
gmlSolitary
.
getLod2MultiSurface
());
assertNull
(
gmlSolitary
.
getLod3MultiSurface
());
assertNull
(
gmlSolitary
.
getLod1Solid
());
assertNull
(
gmlSolitary
.
getLod2Solid
());
assertNull
(
gmlSolitary
.
getLod3Solid
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod1Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod2Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod3Geometry
());
assertNull
(
gmlSolitary
.
getDeprecatedProperties
().
getLod4Geometry
());
}
@Test
public
void
testReCreateGeometriesSolidPlantCover
()
{
PlantCover
gmlPC
=
new
PlantCover
();
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
veg
.
setGmlObject
(
gmlPC
);
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
veg
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurfacePlantCover
()
{
PlantCover
gmlPC
=
new
PlantCover
();
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
PLANT_COVER
);
veg
.
setGmlObject
(
gmlPC
);
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
veg
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlPC
.
getLod0MultiSurface
());
assertNotNull
(
gmlPC
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getLod2MultiSurface
());
assertNotNull
(
gmlPC
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getLod3MultiSurface
());
assertNotNull
(
gmlPC
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
@Test
public
void
testReCreateGeometriesSolidSolitaryVegetationObject
()
{
SolitaryVegetationObject
gmlPC
=
new
SolitaryVegetationObject
();
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
SOLITARY_VEGETATION_OBJECT
);
veg
.
setGmlObject
(
gmlPC
);
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
veg
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlPC
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceSolitaryVegetationObject
()
{
SolitaryVegetationObject
gmlPC
=
new
SolitaryVegetationObject
();
Vegetation
veg
=
new
Vegetation
(
Vegetation
.
VegetationType
.
SOLITARY_VEGETATION_OBJECT
);
veg
.
setGmlObject
(
gmlPC
);
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
veg
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
veg
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlPC
.
getLod0MultiSurface
());
assertNotNull
(
gmlPC
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod1Geometry
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod1Geometry
().
getObject
());
assertNotNull
(
gmlPC
.
getLod2MultiSurface
());
assertNotNull
(
gmlPC
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getLod3MultiSurface
());
assertNotNull
(
gmlPC
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod4Geometry
());
assertNotNull
(
gmlPC
.
getDeprecatedProperties
().
getLod4Geometry
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/WaterTest.java
0 → 100644
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.waterbody.WaterBody
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
public
class
WaterTest
{
@Test
public
void
testVisitorPropagation
()
{
WaterObject
water
=
new
WaterObject
();
BoundarySurface
bsMock
=
mock
(
BoundarySurface
.
class
);
BoundarySurface
bsMock2
=
mock
(
BoundarySurface
.
class
);
water
.
addBoundarySurface
(
bsMock
);
water
.
addBoundarySurface
(
bsMock2
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
water
.
accept
(
c
);
verify
(
bsMock
).
accept
(
c
);
verify
(
bsMock2
).
accept
(
c
);
}
@Test
public
void
testContainsError
()
{
WaterObject
water
=
new
WaterObject
();
water
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
water
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
assertFalse
(
water
.
containsError
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
));
}
@Test
public
void
testContainsAnyError
()
{
WaterObject
water
=
new
WaterObject
();
assertFalse
(
water
.
containsAnyError
());
water
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
OK
,
null
));
assertFalse
(
water
.
containsAnyError
());
water
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_INNER_RINGS_NESTED
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
water
.
containsAnyError
());
}
@Test
public
void
testClearAllContainedCheckResults
()
{
WaterObject
water
=
new
WaterObject
();
assertFalse
(
water
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
water
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
assertTrue
(
water
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
water
.
clearAllContainedCheckResults
();
assertFalse
(
water
.
containsError
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
));
}
@Test
public
void
testCollectContainedErrors
()
{
WaterObject
water
=
new
WaterObject
();
water
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
mock
(
CheckError
.
class
)));
List
<
CheckError
>
errors
=
new
ArrayList
<>();
water
.
collectContainedErrors
(
errors
);
assertEquals
(
1
,
errors
.
size
());
}
@Test
public
void
testUnsetGmlGeometries
()
{
WaterObject
water
=
new
WaterObject
();
WaterBody
gmlWater
=
new
WaterBody
();
water
.
setGmlObject
(
gmlWater
);
gmlWater
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlWater
.
setLod1Solid
(
new
SolidProperty
());
gmlWater
.
setLod2Solid
(
new
SolidProperty
());
gmlWater
.
setLod3Solid
(
new
SolidProperty
());
gmlWater
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
());
water
.
clearGmlGeometries
();
assertNull
(
gmlWater
.
getLod0MultiSurface
());
assertNull
(
gmlWater
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlWater
.
getLod2MultiSurface
());
assertNull
(
gmlWater
.
getLod3MultiSurface
());
assertNull
(
gmlWater
.
getLod1Solid
());
assertNull
(
gmlWater
.
getLod2Solid
());
assertNull
(
gmlWater
.
getLod3Solid
());
assertNull
(
gmlWater
.
getDeprecatedProperties
().
getLod4Solid
());
}
@Test
public
void
testReCreateGeometriesSolid
()
{
WaterBody
gmlWater
=
new
WaterBody
();
WaterObject
water
=
new
WaterObject
();
water
.
setGmlObject
(
gmlWater
);
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
water
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlWater
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlWater
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlWater
.
getLod3Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlWater
.
getDeprecatedProperties
().
getLod4Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
WaterBody
gmlWater
=
new
WaterBody
();
WaterObject
water
=
new
WaterObject
();
water
.
setGmlObject
(
gmlWater
);
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
water
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
water
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlWater
.
getLod0MultiSurface
());
assertNotNull
(
gmlWater
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlWater
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlWater
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlWater
.
getLod2MultiSurface
());
assertNotNull
(
gmlWater
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlWater
.
getLod3MultiSurface
());
assertNotNull
(
gmlWater
.
getLod3MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java
View file @
845dd0a6
...
...
@@ -590,7 +590,7 @@ public class PdfStreamReporter implements StreamReporter {
for
(
Geometry
geom
:
af
.
getGeometries
())
{
writeCheckResultForGeometry
(
geom
,
root
);
}
for
(
BoundarySurface
bs
:
af
.
getBoundarySurface
List
())
{
for
(
BoundarySurface
bs
:
af
.
getBoundarySurface
s
())
{
writeCheckResultForBoundarySurface
(
bs
,
root
);
}
}
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/geometry/NullAreaCheckTest.java
View file @
845dd0a6
...
...
@@ -90,7 +90,7 @@ public class NullAreaCheckTest {
LinearRing
r
=
setupErrorGeometry
();
NullAreaCheck
nac
=
new
NullAreaCheck
();
nac
.
check
(
r
);
Assert
.
assertTrue
(
r
.
hasAnyError
());
Assert
.
assertTrue
(
r
.
hasAnyError
WithoutDependencies
());
}
...
...
@@ -100,7 +100,7 @@ public class NullAreaCheckTest {
LinearRing
r
=
setupValidGeometry
();
NullAreaCheck
nac
=
new
NullAreaCheck
();
nac
.
check
(
r
);
Assert
.
assertFalse
(
r
.
hasAnyError
());
Assert
.
assertFalse
(
r
.
hasAnyError
WithoutDependencies
());
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
View file @
845dd0a6
...
...
@@ -9,6 +9,11 @@ import de.hft.stuttgart.citydoctor2.datastructure.*;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.gui.table.ErrorStat
;
import
de.hft.stuttgart.citydoctor2.gui.tree.*
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectGroupNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.CityObjectNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.GeometryNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.OpeningNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.TopLevelCityObjectNode
;
import
de.hft.stuttgart.citydoctor2.mapper.citygml3.GMLValidationHandler
;
import
de.hft.stuttgart.citydoctor2.parser.*
;
import
de.hft.stuttgart.citydoctor2.utils.ArchivePacker
;
...
...
@@ -24,6 +29,7 @@ import javafx.scene.control.ButtonType;
import
javafx.scene.control.Dialog
;
import
javafx.scene.control.TreeItem
;
import
javafx.scene.control.TreeView
;
import
javafx.scene.paint.Color
;
import
javafx.stage.FileChooser
;
import
javafx.stage.FileChooser.ExtensionFilter
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -268,15 +274,15 @@ public class CityDoctorController {
public
void
buildTrees
()
{
resetFeatureChunks
();
buildBuildings
(
model
);
buildVegetation
(
model
.
getVegetation
()
);
buildTransportation
(
model
.
getTransportation
()
);
buildTunnel
(
model
.
getTunnels
()
);
buildVegetation
(
model
);
buildTransportation
(
model
);
buildTunnel
(
model
);
buildBridges
(
model
);
buildWater
(
model
);
buildLand
(
model
);
buildCityFurniture
(
model
);
buildOtherCityObjects
(
model
);
buildTunnel
(
model
.
getTunnels
()
);
buildTunnel
(
model
);
}
private
void
resetFeatureChunks
()
{
...
...
@@ -296,7 +302,8 @@ public class CityDoctorController {
return
;
}
TreeView
<
Renderable
>
landView
=
mainWindow
.
getTerrainView
();
TreeItem
<
Renderable
>
landRoot
=
new
TreeItem
<>(
new
AllTerrainNode
(
model
.
getLand
()));
TreeItem
<
Renderable
>
landRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getLand
(),
"Land"
,
Color
.
BROWN
));
landRoot
.
setExpanded
(
true
);
landView
.
setRoot
(
landRoot
);
buildLandFromList
(
model
.
getLand
(),
landView
.
getRoot
());
...
...
@@ -308,50 +315,26 @@ public class CityDoctorController {
for
(
int
i
=
landChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
landChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
CityObject
land
=
list
.
get
(
i
);
Renderable
node
;
if
(
land
instanceof
ReliefObject
relief
)
{
node
=
new
ReliefNode
(
relief
);
}
else
if
(
land
instanceof
TinObject
tin
)
{
node
=
new
TinNode
(
tin
);
}
else
{
node
=
new
LandUseNode
((
LandObject
)
land
);
}
CityObjectNode
node
=
new
CityObjectNode
(
land
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
land
,
item
);
if
(
land
instanceof
ReliefObject
relief
)
{
createTinNodes
(
relief
,
item
);
}
}
}
private
void
createTinNodes
(
ReliefObject
relief
,
TreeItem
<
Renderable
>
item
)
{
if
(
relief
.
getComponents
().
isEmpty
())
{
return
;
}
AllTinNode
allTinText
=
new
AllTinNode
(
relief
.
getComponents
());
TreeItem
<
Renderable
>
allBpsTextItem
=
new
TreeItem
<>(
allTinText
);
item
.
getChildren
().
add
(
allBpsTextItem
);
for
(
TinObject
tin
:
relief
.
getComponents
())
{
TinNode
tinNode
=
new
TinNode
(
tin
);
TreeItem
<
Renderable
>
tinNodeItem
=
new
TreeItem
<>(
tinNode
);
tinNodeItem
.
setExpanded
(
true
);
allBpsTextItem
.
getChildren
().
add
(
tinNodeItem
);
createGeometryNodes
(
tin
,
tinNodeItem
);
}
}
private
void
buildCityFurniture
(
CityDoctorModel
model
)
{
if
(
model
.
getCityFurniture
().
isEmpty
())
{
return
;
}
TreeView
<
Renderable
>
cityFurnitureView
=
mainWindow
.
getCityFurnitureView
();
TreeItem
<
Renderable
>
cityFurnitureRoot
=
new
TreeItem
<>(
new
AllCityFurnitureNode
(
model
.
getCityFurniture
()));
TreeItem
<
Renderable
>
cityFurnitureRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getCityFurniture
(),
"City Furniture"
,
Color
.
BLUEVIOLET
));
cityFurnitureRoot
.
setExpanded
(
true
);
cityFurnitureView
.
setRoot
(
cityFurnitureRoot
);
buildTreeFromList
(
model
.
getCityFurniture
(),
cityFurnitureView
.
getRoot
()
,
cityFurnitureChunkNr
);
build
CityFurniture
TreeFromList
(
model
.
getCityFurniture
(),
cityFurnitureView
.
getRoot
());
addMoreButtonIfNecessary
(
model
.
getCityFurniture
(),
cityFurnitureView
,
cityFurnitureRoot
,
cityFurnitureChunkNr
);
}
...
...
@@ -360,10 +343,11 @@ public class CityDoctorController {
return
;
}
TreeView
<
Renderable
>
otherObjectsView
=
mainWindow
.
getGenericCityObjectView
();
TreeItem
<
Renderable
>
otherObjectsRoot
=
new
TreeItem
<>(
new
AllOtherObjectsNode
(
model
.
getGenericCityObjects
()));
TreeItem
<
Renderable
>
otherObjectsRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getGenericCityObjects
(),
"Generic CityObjects"
,
Color
.
DARKGRAY
));
otherObjectsRoot
.
setExpanded
(
true
);
otherObjectsView
.
setRoot
(
otherObjectsRoot
);
buildTreeFromList
(
model
.
getGenericCityObjects
(),
otherObjectsView
.
getRoot
()
,
genericCityObjectsChunkNr
);
build
GenericCityObject
TreeFromList
(
model
.
getGenericCityObjects
(),
otherObjectsView
.
getRoot
());
addMoreButtonIfNecessary
(
model
.
getGenericCityObjects
(),
otherObjectsView
,
otherObjectsRoot
,
genericCityObjectsChunkNr
);
}
...
...
@@ -372,10 +356,11 @@ public class CityDoctorController {
return
;
}
TreeView
<
Renderable
>
waterView
=
mainWindow
.
getWaterView
();
TreeItem
<
Renderable
>
waterRoot
=
new
TreeItem
<>(
new
AllWaterNode
(
model
.
getWater
()));
TreeItem
<
Renderable
>
waterRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getWater
(),
"Water"
,
Color
.
LIGHTSKYBLUE
));
waterRoot
.
setExpanded
(
true
);
waterView
.
setRoot
(
waterRoot
);
buildTreeFromList
(
model
.
getWater
(),
water
View
.
getRoot
(),
waterChunkNr
);
build
Water
TreeFromList
(
model
.
getWater
(),
water
Root
);
addMoreButtonIfNecessary
(
model
.
getWater
(),
waterView
,
waterRoot
,
waterChunkNr
);
}
...
...
@@ -384,47 +369,51 @@ public class CityDoctorController {
return
;
}
TreeView
<
Renderable
>
bridgeView
=
mainWindow
.
getBridgeView
();
TreeItem
<
Renderable
>
bridgeRoot
=
new
TreeItem
<>(
new
AllBridgesNode
(
model
.
getBridges
()));
TreeItem
<
Renderable
>
bridgeRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getBridges
(),
"Bridges"
,
Color
.
CORAL
));
bridgeRoot
.
setExpanded
(
true
);
bridgeView
.
setRoot
(
bridgeRoot
);
buildBridgeTreeFromList
(
model
.
getBridges
(),
bridgeView
.
getRoot
());
addMoreButtonIfNecessary
(
model
.
getBridges
(),
bridgeView
,
bridgeRoot
,
bridgeChunkNr
);
}
private
void
buildTransportation
(
List
<
TransportationObject
>
trans
)
{
if
(
trans
.
isEmpty
())
{
private
void
buildTransportation
(
CityDoctorModel
model
)
{
if
(
model
.
getTransportation
()
.
isEmpty
())
{
return
;
}
TreeView
<
Renderable
>
transView
=
mainWindow
.
getTransportationView
();
TreeItem
<
Renderable
>
transRoot
=
new
TreeItem
<>(
new
AllTransportationNode
(
model
.
getTransportation
()));
TreeItem
<
Renderable
>
transRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getTransportation
(),
"Transportation"
,
Color
.
YELLOW
));
transRoot
.
setExpanded
(
true
);
transView
.
setRoot
(
transRoot
);
buildTransportationTreeFromList
(
trans
,
transView
.
getRoot
());
addMoreButtonIfNecessary
(
trans
,
transView
,
transRoot
,
transportationChunkNr
);
buildTransportationTreeFromList
(
model
.
getTransportation
()
,
transView
.
getRoot
());
addMoreButtonIfNecessary
(
model
.
getTransportation
()
,
transView
,
transRoot
,
transportationChunkNr
);
}
private
void
buildTunnel
(
List
<
Tunnel
>
tunn
el
s
)
{
if
(
t
unnels
.
isEmpty
())
{
private
void
buildTunnel
(
CityDoctorModel
mod
el
)
{
if
(
model
.
getT
unnels
()
.
isEmpty
())
{
return
;
}
TreeView
<
Renderable
>
transView
=
mainWindow
.
getTunnelView
();
TreeItem
<
Renderable
>
transRoot
=
new
TreeItem
<>(
new
AllTunnelsNode
(
model
.
getTunnels
()));
transRoot
.
setExpanded
(
true
);
transView
.
setRoot
(
transRoot
);
buildTreeFromList
(
tunnels
,
transView
.
getRoot
(),
tunnelChunkNr
);
addMoreButtonIfNecessary
(
tunnels
,
transView
,
transRoot
,
tunnelChunkNr
);
TreeView
<
Renderable
>
tunnelView
=
mainWindow
.
getTunnelView
();
TreeItem
<
Renderable
>
tunnelRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getTunnels
(),
"Tunnel"
,
Color
.
SLATEGRAY
));
tunnelRoot
.
setExpanded
(
true
);
tunnelView
.
setRoot
(
tunnelRoot
);
buildTunnelTreeFromList
(
model
.
getTunnels
(),
tunnelRoot
);
addMoreButtonIfNecessary
(
model
.
getTunnels
(),
tunnelView
,
tunnelRoot
,
tunnelChunkNr
);
}
private
void
buildVegetation
(
List
<
Vegetation
>
veg
)
{
if
(
veg
.
isEmpty
())
{
private
void
buildVegetation
(
CityDoctorModel
model
)
{
if
(
model
.
getVegetation
()
.
isEmpty
())
{
return
;
}
TreeView
<
Renderable
>
vegetationsView
=
mainWindow
.
getVegetationView
();
TreeItem
<
Renderable
>
vegRoot
=
new
TreeItem
<>(
new
AllVegetationNode
(
model
.
getVegetation
()));
TreeItem
<
Renderable
>
vegRoot
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getVegetation
(),
"Vegetation"
,
Color
.
LIGHTGREEN
));
vegRoot
.
setExpanded
(
true
);
vegetationsView
.
setRoot
(
vegRoot
);
buildTreeFromList
WithProducer
(
veg
,
vegetationsView
.
getRoot
(),
v
egetation
ChunkNr
,
V
eg
etationNode:
:
new
);
addMoreButtonIfNecessary
(
veg
,
vegetationsView
,
vegRoot
,
vegetationChunkNr
);
build
Vegetation
TreeFromList
(
model
.
getV
egetation
()
,
v
eg
Root
);
addMoreButtonIfNecessary
(
model
.
getVegetation
()
,
vegetationsView
,
vegRoot
,
vegetationChunkNr
);
}
private
void
addMoreButtonIfNecessary
(
List
<?
extends
CityObject
>
list
,
TreeView
<
Renderable
>
view
,
...
...
@@ -439,6 +428,7 @@ public class CityDoctorController {
root
.
getChildren
().
remove
(
root
.
getChildren
().
size
()
-
1
);
chunkCounter
.
incrementAndGet
();
int
visibleFeatures
=
countVisibleNodes
(
view
);
buildTreeFromList
(
list
,
root
,
chunkCounter
);
updateTree
(
root
);
if
(
selectedIndex
>=
0
)
{
...
...
@@ -460,11 +450,13 @@ public class CityDoctorController {
return
;
}
TreeView
<
Renderable
>
buildingsView
=
mainWindow
.
getBuildingsView
();
TreeItem
<
Renderable
>
root
=
new
TreeItem
<>(
new
AllBuildingsNode
(
model
.
getBuildings
()));
TreeItem
<
Renderable
>
root
=
new
TreeItem
<>(
new
CityObjectGroupNode
(
model
.
getBuildings
(),
"Buildings"
,
Color
.
WHITE
));
root
.
setExpanded
(
true
);
buildingsView
.
setRoot
(
root
);
buildBuildingTreeFromList
(
model
.
getBuildings
(),
root
);
addMoreButtonToBuildingsIfNecessary
(
model
.
getBuildings
(),
buildingsView
,
root
,
buildingChunkNr
);
buildingsView
.
setRoot
(
root
);
}
private
void
addMoreButtonToBuildingsIfNecessary
(
List
<
Building
>
list
,
TreeView
<
Renderable
>
view
,
...
...
@@ -557,17 +549,46 @@ public class CityDoctorController {
mainWindow
.
getVertexView
().
getRoot
().
getChildren
().
clear
();
}
private
TreeItem
<
Renderable
>
buildTopLevelCityObjectNode
(
CityObject
co
,
TreeItem
<
Renderable
>
root
)
{
return
buildTopLevelCityObjectNode
(
co
,
root
,
Collections
.
emptyList
());
}
private
TreeItem
<
Renderable
>
buildTopLevelCityObjectNode
(
CityObject
co
,
TreeItem
<
Renderable
>
root
,
List
<
BoundarySurface
>
surfaces
)
{
TopLevelCityObjectNode
node
=
new
TopLevelCityObjectNode
(
co
);
TreeItem
<
Renderable
>
nodeItem
=
new
TreeItem
<>(
node
);
nodeItem
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
nodeItem
);
createGeometryNodes
(
co
,
nodeItem
);
if
(!
surfaces
.
isEmpty
())
{
createBoundarySurfaceNodes
(
surfaces
,
nodeItem
);
}
return
nodeItem
;
}
private
TreeItem
<
Renderable
>
buildCityObjectNode
(
CityObject
co
,
TreeItem
<
Renderable
>
root
)
{
return
buildCityObjectNode
(
co
,
root
,
Collections
.
emptyList
());
}
private
TreeItem
<
Renderable
>
buildCityObjectNode
(
CityObject
co
,
TreeItem
<
Renderable
>
root
,
List
<
BoundarySurface
>
surfaces
)
{
CityObjectNode
node
=
new
CityObjectNode
(
co
);
TreeItem
<
Renderable
>
nodeItem
=
new
TreeItem
<>(
node
);
nodeItem
.
setExpanded
(
false
);
root
.
getChildren
().
add
(
nodeItem
);
createGeometryNodes
(
co
,
nodeItem
);
if
(!
surfaces
.
isEmpty
())
{
createBoundarySurfaceNodes
(
surfaces
,
nodeItem
);
}
return
nodeItem
;
}
private
void
buildBuildingTreeFromList
(
List
<
Building
>
list
,
TreeItem
<
Renderable
>
root
)
{
int
buildingChunk
=
buildingChunkNr
.
get
();
for
(
int
i
=
buildingChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
buildingChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
Building
b
=
list
.
get
(
i
);
BuildingNode
node
=
new
BuildingNode
(
b
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
b
,
item
);
createBoundarySurfaceNodes
(
b
.
getBoundarySurfaces
(),
item
);
TreeItem
<
Renderable
>
item
=
buildTopLevelCityObjectNode
(
b
,
root
,
b
.
getBoundarySurfaces
());
createBuildingInstallationNodes
(
b
,
item
);
createBuildingRoomNodes
(
b
,
item
);
createBuildingFurnitureNodes
(
b
,
item
);
...
...
@@ -582,12 +603,8 @@ public class CityDoctorController {
for
(
int
i
=
bridgeChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
bridgeChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
BridgeObject
bridge
=
list
.
get
(
i
);
BridgeNode
node
=
new
BridgeNode
(
bridge
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
bridge
,
item
);
createBoundarySurfaceNodes
(
bridge
.
getBoundarySurfaces
(),
item
);
TreeItem
<
Renderable
>
item
=
buildTopLevelCityObjectNode
(
bridge
,
root
,
bridge
.
getBoundarySurfaces
());
createBridgeRoomNodes
(
bridge
,
item
);
createBridgeInstallationNodes
(
bridge
,
item
);
createBridgeFurnitureNodes
(
bridge
,
item
);
...
...
@@ -602,11 +619,7 @@ public class CityDoctorController {
for
(
int
i
=
transportChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
transportChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
TransportationObject
t
=
list
.
get
(
i
);
TransportationObjectNode
node
=
new
TransportationObjectNode
(
t
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
t
,
item
);
TreeItem
<
Renderable
>
item
=
buildTopLevelCityObjectNode
(
t
,
root
);
createTransportSectionNodes
(
t
,
item
);
createTrafficSpacesNodes
(
t
,
item
);
}
...
...
@@ -617,11 +630,7 @@ public class CityDoctorController {
for
(
int
i
=
vegetationChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
vegetationChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
Vegetation
v
=
list
.
get
(
i
);
VegetationNode
node
=
new
VegetationNode
(
v
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
v
,
item
);
buildTopLevelCityObjectNode
(
v
,
root
);
}
}
...
...
@@ -630,11 +639,7 @@ public class CityDoctorController {
for
(
int
i
=
waterChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
waterChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
WaterObject
w
=
list
.
get
(
i
);
CityObjectNode
node
=
new
CityObjectNode
(
w
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
w
,
item
);
buildTopLevelCityObjectNode
(
w
,
root
);
}
}
...
...
@@ -643,11 +648,7 @@ public class CityDoctorController {
for
(
int
i
=
cityFurnChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
cityFurnChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
CityFurniture
cf
=
list
.
get
(
i
);
CityObjectNode
node
=
new
CityObjectNode
(
cf
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
cf
,
item
);
buildTopLevelCityObjectNode
(
cf
,
root
);
}
}
...
...
@@ -656,44 +657,32 @@ public class CityDoctorController {
for
(
int
i
=
genericObjectChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
genericObjectChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
GenericCityObject
goc
=
list
.
get
(
i
);
CityObjectNode
node
=
new
CityObjectNode
(
goc
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
goc
,
item
);
buildTopLevelCityObjectNode
(
goc
,
root
);
}
}
private
void
createTransportSectionNodes
(
TransportationObject
t
,
TreeItem
<
Renderable
>
root
)
{
if
(
t
instanceof
TopLevelTransportFeature
top
)
{
if
(!
top
.
getSections
().
isEmpty
())
{
AllTransportSection
Node
allS
ectionsNode
=
new
AllTransportSection
Node
(
top
.
getSections
(),
TransportSection
.
SectionType
.
SECTION
);
TreeItem
<
Renderable
>
allS
ections
NodeText
Item
=
new
TreeItem
<>(
allS
ectionsNode
);
root
.
getChildren
().
add
(
allS
ections
NodeText
Item
);
CityObjectGroup
Node
s
ections
Group
Node
=
new
CityObjectGroup
Node
(
top
.
getSections
(),
"Sections"
,
Color
.
YELLOW
);
TreeItem
<
Renderable
>
s
ections
Group
Item
=
new
TreeItem
<>(
s
ections
Group
Node
);
root
.
getChildren
().
add
(
s
ections
Group
Item
);
for
(
TransportSection
ts
:
top
.
getSections
())
{
TransportationObjectNode
tsNode
=
new
TransportationObjectNode
(
ts
);
TreeItem
<
Renderable
>
tsNodeItem
=
new
TreeItem
<>(
tsNode
);
tsNodeItem
.
setExpanded
(
false
);
allSectionsNodeTextItem
.
getChildren
().
add
(
tsNodeItem
);
createGeometryNodes
(
ts
,
tsNodeItem
);
TreeItem
<
Renderable
>
tsNodeItem
=
buildCityObjectNode
(
ts
,
sectionsGroupItem
);
createTrafficSpacesNodes
(
ts
,
tsNodeItem
);
}
}
if
(!
top
.
getIntersections
().
isEmpty
())
{
AllTransportSection
Node
allI
ntersectionsNode
=
new
AllTransportSection
Node
(
top
.
getIntersections
(),
TransportSection
.
SectionType
.
INTERSECTION
);
TreeItem
<
Renderable
>
allI
ntersections
NodeText
Item
=
new
TreeItem
<>(
allI
ntersectionsNode
);
root
.
getChildren
().
add
(
allI
ntersections
NodeText
Item
);
CityObjectGroup
Node
i
ntersections
Group
Node
=
new
CityObjectGroup
Node
(
top
.
getIntersections
(),
"Intersections"
,
Color
.
YELLOW
);
TreeItem
<
Renderable
>
i
ntersections
Group
Item
=
new
TreeItem
<>(
i
ntersections
Group
Node
);
root
.
getChildren
().
add
(
i
ntersections
Group
Item
);
for
(
TransportSection
ts
:
top
.
getIntersections
())
{
TransportationObjectNode
tsNode
=
new
TransportationObjectNode
(
ts
);
TreeItem
<
Renderable
>
tsNodeItem
=
new
TreeItem
<>(
tsNode
);
tsNodeItem
.
setExpanded
(
false
);
allIntersectionsNodeTextItem
.
getChildren
().
add
(
tsNodeItem
);
createGeometryNodes
(
ts
,
tsNodeItem
);
TreeItem
<
Renderable
>
tsNodeItem
=
buildCityObjectNode
(
ts
,
intersectionsGroupItem
);
createTrafficSpacesNodes
(
ts
,
tsNodeItem
);
}
}
...
...
@@ -703,34 +692,26 @@ public class CityDoctorController {
private
void
createTrafficSpacesNodes
(
TransportationObject
t
,
TreeItem
<
Renderable
>
root
)
{
if
(
t
instanceof
TransportationSpace
space
)
{
if
(!
space
.
getTrafficSpaces
().
isEmpty
())
{
AllT
rafficSpaces
Node
allTS
Node
=
new
AllTrafficSpaces
Node
(
space
.
getTrafficSpaces
(),
TrafficSpaceObject
.
TrafficSpaceType
.
TRAFFIC_SPACE
);
TreeItem
<
Renderable
>
allTSNodeText
Item
=
new
TreeItem
<>(
allTS
Node
);
root
.
getChildren
().
add
(
allTSNodeText
Item
);
allTSNodeText
Item
.
setExpanded
(
true
);
CityObjectGroupNode
t
rafficSpaces
Group
Node
=
new
CityObjectGroup
Node
(
space
.
getTrafficSpaces
(),
"TRAFFIC_SPACE"
,
Color
.
YELLOW
);
TreeItem
<
Renderable
>
trafficSpacesGroup
Item
=
new
TreeItem
<>(
trafficSpacesGroup
Node
);
root
.
getChildren
().
add
(
trafficSpacesGroup
Item
);
trafficSpacesGroup
Item
.
setExpanded
(
true
);
for
(
TrafficSpaceObject
tso
:
space
.
getTrafficSpaces
())
{
TransportationObjectNode
tsoNode
=
new
TransportationObjectNode
(
tso
);
TreeItem
<
Renderable
>
tsoNodeItem
=
new
TreeItem
<>(
tsoNode
);
tsoNodeItem
.
setExpanded
(
false
);
allTSNodeTextItem
.
getChildren
().
add
(
tsoNodeItem
);
createGeometryNodes
(
tso
,
tsoNodeItem
);
TreeItem
<
Renderable
>
tsoNodeItem
=
buildCityObjectNode
(
tso
,
trafficSpacesGroupItem
);
createTrafficAreaNodes
(
tso
,
tsoNodeItem
,
TrafficAreaObject
.
TrafficAreaType
.
TRAFFIC_AREA
);
}
}
if
(!
space
.
getAuxTrafficSpaces
().
isEmpty
())
{
All
TrafficSpaces
Node
allTS
Node
=
new
AllTrafficSpaces
Node
(
space
.
getAuxTrafficSpaces
(),
TrafficSpaceObject
.
TrafficSpaceType
.
AUXILIARY_TRAFFIC_SPACE
);
TreeItem
<
Renderable
>
a
llTSNodeText
Item
=
new
TreeItem
<>(
a
llTS
Node
);
root
.
getChildren
().
add
(
a
llTSNodeText
Item
);
a
llTSNodeText
Item
.
setExpanded
(
true
);
CityObjectGroupNode
aux
TrafficSpaces
Group
Node
=
new
CityObjectGroup
Node
(
space
.
getAuxTrafficSpaces
(),
"
AUXILIARY_TRAFFIC_SPACE
"
,
Color
.
YELLOW
);
TreeItem
<
Renderable
>
a
uxTrafficSpacesGroup
Item
=
new
TreeItem
<>(
a
uxTrafficSpacesGroup
Node
);
root
.
getChildren
().
add
(
a
uxTrafficSpacesGroup
Item
);
a
uxTrafficSpacesGroup
Item
.
setExpanded
(
true
);
for
(
TrafficSpaceObject
atso
:
space
.
getAuxTrafficSpaces
())
{
TransportationObjectNode
atsoNode
=
new
TransportationObjectNode
(
atso
);
TreeItem
<
Renderable
>
atsoNodeItem
=
new
TreeItem
<>(
atsoNode
);
atsoNodeItem
.
setExpanded
(
false
);
allTSNodeTextItem
.
getChildren
().
add
(
atsoNodeItem
);
createGeometryNodes
(
atso
,
atsoNodeItem
);
TreeItem
<
Renderable
>
atsoNodeItem
=
buildCityObjectNode
(
atso
,
auxTrafficSpacesGroupItem
);
createTrafficAreaNodes
(
atso
,
atsoNodeItem
,
TrafficAreaObject
.
TrafficAreaType
.
AUXILIARY_TRAFFIC_AREA
);
}
}
...
...
@@ -739,16 +720,13 @@ public class CityDoctorController {
public
void
createTrafficAreaNodes
(
TransportationObject
t
,
TreeItem
<
Renderable
>
root
,
TrafficAreaObject
.
TrafficAreaType
type
)
{
if
(
t
instanceof
TrafficSpaceObject
space
&&
!
space
.
getTrafficAreas
().
isEmpty
())
{
AllTrafficAreaNode
allTANode
=
new
AllTrafficAreaNode
(
space
.
getTrafficAreas
(),
type
);
TreeItem
<
Renderable
>
allTANodeTextItem
=
new
TreeItem
<>(
allTANode
);
root
.
getChildren
().
add
(
allTANodeTextItem
);
allTANodeTextItem
.
setExpanded
(
true
);
CityObjectGroupNode
trafficAreaGroupNode
=
new
CityObjectGroupNode
(
space
.
getTrafficAreas
(),
type
.
toString
(),
Color
.
YELLOW
);
TreeItem
<
Renderable
>
trafficAreaGroupItem
=
new
TreeItem
<>(
trafficAreaGroupNode
);
root
.
getChildren
().
add
(
trafficAreaGroupItem
);
trafficAreaGroupItem
.
setExpanded
(
true
);
for
(
TrafficAreaObject
tao
:
space
.
getTrafficAreas
())
{
TransportationObjectNode
taoNode
=
new
TransportationObjectNode
(
tao
);
TreeItem
<
Renderable
>
taoNodeTextItem
=
new
TreeItem
<>(
taoNode
);
taoNodeTextItem
.
setExpanded
(
true
);
allTANodeTextItem
.
getChildren
().
add
(
taoNodeTextItem
);
createGeometryNodes
(
tao
,
taoNodeTextItem
);
buildCityObjectNode
(
tao
,
trafficAreaGroupItem
);
}
}
...
...
@@ -758,12 +736,8 @@ public class CityDoctorController {
int
tunnelChunk
=
tunnelChunkNr
.
get
();
for
(
int
i
=
tunnelChunk
*
MAX_FEATURES_PER_CHUNK
;
i
<
(
tunnelChunk
+
1
)
*
MAX_FEATURES_PER_CHUNK
&&
i
<
list
.
size
();
i
++)
{
Tunnel
tunnel
=
list
.
get
(
i
);
TunnelNode
node
=
new
TunnelNode
(
tunnel
);
TreeItem
<
Renderable
>
item
=
new
TreeItem
<>(
node
);
item
.
setExpanded
(
true
);
root
.
getChildren
().
add
(
item
);
createGeometryNodes
(
tunnel
,
item
);
createBoundarySurfaceNodes
(
tunnel
.
getBoundarySurfaces
(),
item
);
TreeItem
<
Renderable
>
item
=
buildTopLevelCityObjectNode
(
tunnel
,
root
);
createTunnelHollowNodes
(
tunnel
,
item
);
createTunnelInstallationNodes
(
tunnel
,
item
);
createTunnelFurnitureNodes
(
tunnel
,
item
);
...
...
@@ -788,17 +762,14 @@ public class CityDoctorController {
if
(
tunnel
.
getTunnelConstructiveElements
().
isEmpty
()){
return
;
}
AllTunnelConstructiveElementsNode
allTceNode
=
new
AllTunnelConstructiveElementsNode
(
tunnel
.
getTunnelConstructiveElements
());
TreeItem
<
Renderable
>
allTceNodeTextItem
=
new
TreeItem
<>(
allTceNode
);
root
.
getChildren
().
add
(
allTceNodeTextItem
);
CityObjectGroupNode
constructiveElementsGroupNode
=
new
CityObjectGroupNode
(
tunnel
.
getTunnelConstructiveElements
(),
"Constructive Elements"
,
Color
.
DARKGRAY
);
TreeItem
<
Renderable
>
constructiveElementsGroupItem
=
new
TreeItem
<>(
constructiveElementsGroupNode
);
root
.
getChildren
().
add
(
constructiveElementsGroupItem
);
for
(
TunnelConstructiveElement
tce
:
tunnel
.
getTunnelConstructiveElements
())
{
TunnelConstructiveElementNode
tceNode
=
new
TunnelConstructiveElementNode
(
tce
);
TreeItem
<
Renderable
>
tceNodeItem
=
new
TreeItem
<>(
tceNode
);
tceNodeItem
.
setExpanded
(
true
);
allTceNodeTextItem
.
getChildren
().
add
(
tceNodeItem
);
createGeometryNodes
(
tce
,
tceNodeItem
);
createBoundarySurfaceNodes
(
tce
.
getBoundarySurfaces
(),
tceNodeItem
);
buildCityObjectNode
(
tce
,
constructiveElementsGroupItem
,
tce
.
getBoundarySurfaces
());
}
}
...
...
@@ -806,17 +777,18 @@ public class CityDoctorController {
if
(
tunnel
.
getTunnelParts
().
isEmpty
())
{
return
;
}
AllTunnelPartsNode
allTpsText
=
new
AllTunnelPartsNode
(
tunnel
.
getTunnelParts
());
TreeItem
<
Renderable
>
allTpsTextItem
=
new
TreeItem
<>(
allTpsText
);
root
.
getChildren
().
add
(
allTpsTextItem
);
CityObjectGroupNode
tunnelPartsGroupNode
=
new
CityObjectGroupNode
(
tunnel
.
getTunnelParts
(),
"Tunnel parts"
,
Color
.
DARKGRAY
);
TreeItem
<
Renderable
>
tunnelPartsGroupItem
=
new
TreeItem
<>(
tunnelPartsGroupNode
);
root
.
getChildren
().
add
(
tunnelPartsGroupItem
);
for
(
TunnelPart
tp
:
tunnel
.
getTunnelParts
())
{
T
unnelPartNode
tpNode
=
new
TunnelPartNode
(
tp
);
TreeItem
<
Renderable
>
tpNodeItem
=
new
TreeItem
<>(
tpNode
);
tpNodeItem
.
setExpanded
(
true
);
allTpsTextItem
.
getChildren
().
add
(
tpNodeItem
);
create
Geometry
Nodes
(
t
p
,
tpNodeItem
);
create
BoundarySurfaceNodes
(
tp
.
getBoundarySurfaces
()
,
tpNodeItem
);
T
reeItem
<
Renderable
>
tpNodeItem
=
buildCityObjectNode
(
tp
,
tunnelPartsGroupItem
,
tp
.
getBoundarySurfaces
()
);
createTunnelHollowNodes
(
tunnel
,
tpNodeItem
);
createTunnelInstallationNodes
(
tunnel
,
tpNodeItem
);
create
TunnelFurniture
Nodes
(
t
unnel
,
tpNodeItem
);
create
TunnelConstructiveElementsNodes
(
tunnel
,
tpNodeItem
);
}
}
...
...
@@ -836,18 +808,14 @@ public class CityDoctorController {
if
(
bridge
.
getConstructiveElements
().
isEmpty
())
{
return
;
}
AllBridgeConstructiveElementsNode
allBceNode
=
new
AllBridgeConstructiveElementsNode
(
bridge
.
getConstructiveElements
());
TreeItem
<
Renderable
>
allBceNodeTextItem
=
new
TreeItem
<>(
allBceNode
);
item
.
getChildren
().
add
(
allBceNodeTextItem
);
CityObjectGroupNode
constructiveElementsGroupNode
=
new
CityObjectGroupNode
(
bridge
.
getConstructiveElements
(),
"Constructive Elements"
,
Color
.
CORAL
);
TreeItem
<
Renderable
>
constructiveElementsGroupItem
=
new
TreeItem
<>(
constructiveElementsGroupNode
);
item
.
getChildren
().
add
(
constructiveElementsGroupItem
);
for
(
BridgeConstructiveElement
bce
:
bridge
.
getConstructiveElements
())
{
BridgeConstructiveElementNode
bceNode
=
new
BridgeConstructiveElementNode
(
bce
);
TreeItem
<
Renderable
>
bceNodeItem
=
new
TreeItem
<>(
bceNode
);
bceNodeItem
.
setExpanded
(
true
);
allBceNodeTextItem
.
getChildren
().
add
(
bceNodeItem
);
createGeometryNodes
(
bce
,
bceNodeItem
);
createBoundarySurfaceNodes
(
bce
.
getBoundarySurfaces
(),
bceNodeItem
);
buildCityObjectNode
(
bce
,
constructiveElementsGroupItem
,
bce
.
getBoundarySurfaces
());
}
}
...
...
@@ -855,21 +823,22 @@ public class CityDoctorController {
if
(
bridge
.
getParts
().
isEmpty
())
{
return
;
}
AllBridgePartsNode
allBpsText
=
new
AllBridgePartsNode
(
bridge
.
getParts
());
TreeItem
<
Renderable
>
allBpsTextItem
=
new
TreeItem
<>(
allBpsText
);
item
.
getChildren
().
add
(
allBpsTextItem
);
CityObjectGroupNode
bridgePartsGroupNode
=
new
CityObjectGroupNode
(
bridge
.
getParts
(),
"Bridge Parts"
,
Color
.
CORAL
);
TreeItem
<
Renderable
>
bridgePartsGroupItem
=
new
TreeItem
<>(
bridgePartsGroupNode
);
item
.
getChildren
().
add
(
bridgePartsGroupItem
);
for
(
BridgeObject
bp
:
bridge
.
getParts
())
{
BridgeNode
bpNode
=
new
BridgeNode
(
bp
);
TreeItem
<
Renderable
>
bpNodeItem
=
new
TreeItem
<>(
bpNode
);
bpNodeItem
.
setExpanded
(
true
);
allBpsTextItem
.
getChildren
().
add
(
bpNodeItem
);
create
Geometry
Nodes
(
bp
,
bpNodeItem
);
createB
oundarySurfaceNodes
(
bp
.
getBoundarySurfaces
()
,
bpNodeItem
);
TreeItem
<
Renderable
>
bpNodeItem
=
buildCityObjectNode
(
bp
,
bridgePartsGroupItem
,
bp
.
getBoundarySurfaces
()
);
createBridgeRoomNodes
(
bp
,
bpNodeItem
);
createBridgeInstallationNodes
(
bp
,
bpNodeItem
);
create
BridgeFurniture
Nodes
(
bp
,
bpNodeItem
);
createB
ridgeConstructiveElementsNodes
(
bp
,
bpNodeItem
);
}
}
private
void
createBuildingInstallationNodes
(
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
private
void
createBuildingInstallationNodes
(
Abstract
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
createInstallationNodes
(
ab
.
getBuildingInstallations
(),
root
);
}
...
...
@@ -878,20 +847,16 @@ public class CityDoctorController {
return
;
}
AllInstallationsNode
allBiNode
=
new
AllInstallationsNode
(
installations
);
TreeItem
<
Renderable
>
allBpsTextItem
=
new
TreeItem
<>(
allBiNode
);
root
.
getChildren
().
add
(
allBpsTextItem
);
CityObjectGroupNode
installationsGroupNode
=
new
CityObjectGroupNode
(
installations
,
"Installations"
,
null
);
TreeItem
<
Renderable
>
installationsGroupItem
=
new
TreeItem
<>(
installationsGroupNode
);
root
.
getChildren
().
add
(
installationsGroupItem
);
for
(
Installation
bi
:
installations
)
{
InstallationNode
biNode
=
new
InstallationNode
(
bi
);
TreeItem
<
Renderable
>
biItem
=
new
TreeItem
<>(
biNode
);
biItem
.
setExpanded
(
true
);
allBpsTextItem
.
getChildren
().
add
(
biItem
);
createGeometryNodes
(
bi
,
biItem
);
createBoundarySurfaceNodes
(
bi
.
getBoundarySurfaces
(),
biItem
);
buildCityObjectNode
(
bi
,
installationsGroupItem
,
bi
.
getBoundarySurfaces
());
}
}
private
void
createBuildingRoomNodes
(
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
private
void
createBuildingRoomNodes
(
Abstract
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
createRoomNodes
(
ab
.
getBuildingRooms
(),
root
);
}
...
...
@@ -900,58 +865,48 @@ public class CityDoctorController {
return
;
}
AllRoomsNode
allRoNode
=
new
AllRoomsNode
(
rooms
);
TreeItem
<
Renderable
>
allRoNodeTextItem
=
new
TreeItem
<>(
allRoNode
);
root
.
getChildren
().
add
(
allRoNodeTextItem
);
CityObjectGroupNode
roomsGroupNode
=
new
CityObjectGroupNode
(
rooms
,
"Rooms"
,
null
);
TreeItem
<
Renderable
>
roomsGroupItem
=
new
TreeItem
<>(
roomsGroupNode
);
root
.
getChildren
().
add
(
roomsGroupItem
);
for
(
AbstractRoom
room
:
rooms
)
{
RoomNode
roomNode
=
new
RoomNode
(
room
);
TreeItem
<
Renderable
>
roomNodeTextItem
=
new
TreeItem
<>(
roomNode
);
roomNodeTextItem
.
setExpanded
(
true
);
allRoNodeTextItem
.
getChildren
().
add
(
roomNodeTextItem
);
createGeometryNodes
(
room
,
roomNodeTextItem
);
createBoundarySurfaceNodes
(
room
.
getBoundarySurfaces
(),
roomNodeTextItem
);
buildCityObjectNode
(
room
,
roomsGroupItem
,
room
.
getBoundarySurfaces
());
}
}
private
void
createBuildingStoreyNodes
(
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
private
void
createBuildingStoreyNodes
(
Abstract
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
List
<
Storey
>
storeys
=
ab
.
getBuildingStoreys
();
if
(
storeys
.
isEmpty
())
{
return
;
}
AllStoreysNode
allSNode
=
new
AllStoreysNode
(
storeys
);
TreeItem
<
Renderable
>
allSNodeTextItem
=
new
TreeItem
<>(
allSNode
);
root
.
getChildren
().
add
(
allSNodeTextItem
);
CityObjectGroupNode
storeysGroupNode
=
new
CityObjectGroupNode
(
storeys
,
"Storeys"
,
null
);
TreeItem
<
Renderable
>
storeysGroupItem
=
new
TreeItem
<>(
storeysGroupNode
);
root
.
getChildren
().
add
(
storeysGroupItem
);
for
(
Storey
storey
:
storeys
)
{
StoreyNode
storeyNode
=
new
StoreyNode
(
storey
);
TreeItem
<
Renderable
>
storeyNodeTextItem
=
new
TreeItem
<>(
storeyNode
);
storeyNodeTextItem
.
setExpanded
(
true
);
allSNodeTextItem
.
getChildren
().
add
(
storeyNodeTextItem
);
createGeometryNodes
(
storey
,
storeyNodeTextItem
);
createBoundarySurfaceNodes
(
storey
.
getBoundarySurfaces
(),
storeyNodeTextItem
);
buildCityObjectNode
(
storey
,
storeysGroupItem
,
storey
.
getBoundarySurfaces
());
}
}
public
void
createBuildingUnitNodes
(
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
public
void
createBuildingUnitNodes
(
Abstract
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
List
<
BuildingUnit
>
buildingUnits
=
ab
.
getBuildingUnits
();
if
(
buildingUnits
.
isEmpty
())
{
return
;
}
AllBuildingUnitsNode
allSNode
=
new
AllBuildingUnitsNode
(
buildingUnits
);
TreeItem
<
Renderable
>
allSNodeTextItem
=
new
TreeItem
<>(
allSNode
);
root
.
getChildren
().
add
(
allSNodeTextItem
);
CityObjectGroupNode
buildingUnitsGroupNode
=
new
CityObjectGroupNode
(
buildingUnits
,
"Building Units"
,
null
);
TreeItem
<
Renderable
>
buildingUnitsGroupItem
=
new
TreeItem
<>(
buildingUnitsGroupNode
);
root
.
getChildren
().
add
(
buildingUnitsGroupItem
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
BuildingUnitNode
buildingUnitNode
=
new
BuildingUnitNode
(
buildingUnit
);
TreeItem
<
Renderable
>
storeyNodeTextItem
=
new
TreeItem
<>(
buildingUnitNode
);
storeyNodeTextItem
.
setExpanded
(
true
);
allSNodeTextItem
.
getChildren
().
add
(
storeyNodeTextItem
);
createGeometryNodes
(
buildingUnit
,
storeyNodeTextItem
);
createBoundarySurfaceNodes
(
buildingUnit
.
getBoundarySurfaces
(),
storeyNodeTextItem
);
buildCityObjectNode
(
buildingUnit
,
buildingUnitsGroupItem
,
buildingUnit
.
getBoundarySurfaces
());
}
}
private
void
createBuildingFurnitureNodes
(
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
private
void
createBuildingFurnitureNodes
(
Abstract
Building
ab
,
TreeItem
<
Renderable
>
root
)
{
createFurnitureNodes
(
ab
.
getBuildingRoomFurnitureList
(),
root
);
}
...
...
@@ -960,16 +915,12 @@ public class CityDoctorController {
return
;
}
AllFurnitureNode
allFnNode
=
new
AllFurnitureNode
(
furniture
);
TreeItem
<
Renderable
>
allFnNodeTextItem
=
new
TreeItem
<>(
allFnNode
);
root
.
getChildren
().
add
(
allFnNodeTextItem
);
CityObjectGroupNode
furnitureGroupNode
=
new
CityObjectGroupNode
(
furniture
,
"Furniture"
,
null
);
TreeItem
<
Renderable
>
furnitureGroupItem
=
new
TreeItem
<>(
furnitureGroupNode
);
root
.
getChildren
().
add
(
furnitureGroupItem
);
for
(
AbstractFurniture
fn
:
furniture
)
{
FurnitureNode
fnNode
=
new
FurnitureNode
(
fn
);
TreeItem
<
Renderable
>
fnNodeTextItem
=
new
TreeItem
<>(
fnNode
);
fnNodeTextItem
.
setExpanded
(
true
);
allFnNodeTextItem
.
getChildren
().
add
(
fnNodeTextItem
);
createGeometryNodes
(
fn
,
fnNodeTextItem
);
createBoundarySurfaceNodes
(
fn
.
getBoundarySurfaceList
(),
fnNodeTextItem
);
buildCityObjectNode
(
fn
,
furnitureGroupItem
,
fn
.
getBoundarySurfaces
());
}
}
...
...
@@ -977,25 +928,26 @@ public class CityDoctorController {
if
(
bsList
.
isEmpty
())
{
return
;
}
AllBoundarySurfacesNode
allBsText
=
new
AllBoundarySurfacesNode
(
bsList
);
TreeItem
<
Renderable
>
allBpsTextItem
=
new
TreeItem
<>(
allBsText
);
root
.
getChildren
().
add
(
allBpsTextItem
);
allBpsTextItem
.
getChildren
().
add
(
new
TreeItem
<>());
CityObjectGroupNode
boundarySurfacesGroupNode
=
new
CityObjectGroupNode
(
bsList
,
"Boundary Surfaces"
,
null
);
TreeItem
<
Renderable
>
boundarySurfacesGroupItem
=
new
TreeItem
<>(
boundarySurfacesGroupNode
);
root
.
getChildren
().
add
(
boundarySurfacesGroupItem
);
allBpsTextItem
.
expandedProperty
().
addListener
((
obs
,
old
,
newV
)
->
{
if
(
Boolean
.
TRUE
.
equals
(
newV
)
&&
allBpsTextItem
.
getChildren
().
size
()
==
1
)
{
boundarySurfacesGroupItem
.
getChildren
().
add
(
new
TreeItem
<>());
boundarySurfacesGroupItem
.
expandedProperty
().
addListener
((
obs
,
old
,
newV
)
->
{
if
(
Boolean
.
TRUE
.
equals
(
newV
)
&&
boundarySurfacesGroupItem
.
getChildren
().
size
()
==
1
)
{
Platform
.
runLater
(()
->
{
allBpsText
Item
.
getChildren
().
clear
();
boundarySurfacesGroup
Item
.
getChildren
().
clear
();
for
(
BoundarySurface
bs
:
bsList
)
{
BoundarySurface
Node
bsText
=
new
BoundarySurface
Node
(
bs
);
CityObject
Node
bsText
=
new
CityObject
Node
(
bs
);
TreeItem
<
Renderable
>
bsTextItem
=
new
TreeItem
<>(
bsText
);
bsTextItem
.
setExpanded
(
true
);
allBpsText
Item
.
getChildren
().
add
(
bsTextItem
);
boundarySurfacesGroup
Item
.
getChildren
().
add
(
bsTextItem
);
createGeometryNodes
(
bs
,
bsTextItem
);
createOpeningNodes
(
bs
.
getOpenings
(),
bsTextItem
);
}
updateTree
(
allBpsText
Item
);
updateTree
(
boundarySurfacesGroup
Item
);
});
}
});
...
...
@@ -1005,31 +957,35 @@ public class CityDoctorController {
if
(
openings
==
null
||
openings
.
isEmpty
())
{
return
;
}
AllOpeningsNode
allOpeningsNode
=
new
AllOpeningsNode
(
openings
);
TreeItem
<
Renderable
>
allOpeningsItem
=
new
TreeItem
<>(
allOpeningsNode
);
CityObjectGroupNode
openingsGroupNode
=
new
CityObjectGroupNode
(
openings
,
"Openings"
,
null
);
TreeItem
<
Renderable
>
openingsGroupItem
=
new
TreeItem
<>(
openingsGroupNode
);
root
.
getChildren
().
add
(
openingsGroupItem
);
for
(
Opening
o
:
openings
)
{
OpeningNode
openingNode
=
new
OpeningNode
(
o
);
TreeItem
<
Renderable
>
opening
s
Item
=
new
TreeItem
<>(
openingNode
);
allO
peningsItem
.
getChildren
().
add
(
opening
s
Item
);
TreeItem
<
Renderable
>
openingItem
=
new
TreeItem
<>(
openingNode
);
o
penings
Group
Item
.
getChildren
().
add
(
openingItem
);
}
root
.
getChildren
().
add
(
allOpeningsItem
);
}
private
void
createBuildingPartNodes
(
Building
ab
,
TreeItem
<
Renderable
>
item
)
{
if
(
ab
.
getBuildingParts
().
isEmpty
())
{
return
;
}
AllBuildingPartsNode
allBpsText
=
new
AllBuildingParts
Node
(
ab
.
getBuildingParts
());
TreeItem
<
Renderable
>
allBpsText
Item
=
new
TreeItem
<>(
allBpsText
);
item
.
getChildren
().
add
(
allBpsText
Item
);
CityObjectGroupNode
buildingPartsGroupNode
=
new
CityObjectGroup
Node
(
ab
.
getBuildingParts
()
,
"Building Parts"
,
null
);
TreeItem
<
Renderable
>
buildingPartsGroup
Item
=
new
TreeItem
<>(
buildingPartsGroupNode
);
item
.
getChildren
().
add
(
buildingPartsGroup
Item
);
for
(
BuildingPart
bp
:
ab
.
getBuildingParts
())
{
BuildingPartNode
bpNode
=
new
BuildingPartNode
(
bp
);
TreeItem
<
Renderable
>
bpNodeItem
=
new
TreeItem
<>(
bpNode
);
bpNodeItem
.
setExpanded
(
true
);
allBpsTextItem
.
getChildren
().
add
(
bpNodeItem
);
createGeometryNodes
(
bp
,
bpNodeItem
);
createBoundarySurfaceNodes
(
bp
.
getBoundarySurfaces
(),
bpNodeItem
);
TreeItem
<
Renderable
>
bpNodeItem
=
buildCityObjectNode
(
bp
,
buildingPartsGroupItem
,
bp
.
getBoundarySurfaces
());
createBuildingInstallationNodes
(
bp
,
bpNodeItem
);
createBuildingRoomNodes
(
bp
,
bpNodeItem
);
createBuildingFurnitureNodes
(
bp
,
bpNodeItem
);
createBuildingStoreyNodes
(
bp
,
bpNodeItem
);
createBuildingUnitNodes
(
bp
,
bpNodeItem
);
}
}
...
...
@@ -1043,11 +999,15 @@ public class CityDoctorController {
public
void
startChecks
(
ValidationConfiguration
config
,
ProgressListener
l
)
{
if
(
model
==
null
)
{
logger
.
warn
(
Localization
.
getText
(
"CityDoctorController.noDatamodel"
));
if
(
logger
.
isWarnEnabled
())
{
logger
.
warn
(
Localization
.
getText
(
"CityDoctorController.noDatamodel"
));
}
return
;
}
if
(
sourceFile
==
null
)
{
logger
.
warn
(
Localization
.
getText
(
"CityDoctorController.noSourceFile"
));
if
(
logger
.
isWarnEnabled
())
{
logger
.
warn
(
Localization
.
getText
(
"CityDoctorController.noSourceFile"
));
}
return
;
}
try
{
...
...
@@ -1083,9 +1043,10 @@ public class CityDoctorController {
public
void
startZipFileChecks
(
ValidationConfiguration
config
,
ProgressListener
l
,
boolean
lowMemoryMode
,
Path
outputPath
,
boolean
pdfReports
,
boolean
xmlReports
)
{
if
(
zipArchive
==
null
)
{
if
(
zipArchive
==
null
&&
logger
.
isWarnEnabled
()
)
{
logger
.
warn
(
Localization
.
getText
(
"CityDoctorController.noZipFile"
));
}
if
(
lowMemoryMode
)
{
startZipFileCheckStream
(
config
,
outputPath
,
pdfReports
,
xmlReports
);
return
;
...
...
@@ -1262,6 +1223,7 @@ public class CityDoctorController {
addErrorStats
(
stats
,
model
.
getBridges
());
addErrorStats
(
stats
,
model
.
getBuildings
());
addErrorStats
(
stats
,
model
.
getLand
());
addErrorStats
(
stats
,
model
.
getTunnels
());
addErrorStats
(
stats
,
model
.
getTransportation
());
addErrorStats
(
stats
,
model
.
getVegetation
());
addErrorStats
(
stats
,
model
.
getWater
());
...
...
@@ -1578,7 +1540,7 @@ public class CityDoctorController {
updateTree
(
mainWindow
.
getBuildingsView
().
getRoot
());
break
;
case
VEGETATION:
buildVegetation
(
model
.
getVegetation
()
);
buildVegetation
(
model
);
updateTree
(
mainWindow
.
getVegetationView
().
getRoot
());
break
;
case
BRIDGE:
...
...
@@ -1590,15 +1552,14 @@ public class CityDoctorController {
updateTree
(
mainWindow
.
getTerrainView
().
getRoot
());
break
;
case
TRANSPORTATION:
buildTransportation
(
model
.
getTransportation
()
);
buildTransportation
(
model
);
updateTree
(
mainWindow
.
getTransportationView
().
getRoot
());
break
;
case
TUNNEL:
buildTunnel
(
model
.
getTunnels
()
);
buildTunnel
(
model
);
updateTree
(
mainWindow
.
getTunnelView
().
getRoot
());
break
;
case
WATER:
buildWater
(
model
);
updateTree
(
mainWindow
.
getWaterView
().
getRoot
());
break
;
...
...
@@ -1664,12 +1625,13 @@ public class CityDoctorController {
public
void
delete
(
TreeItem
<
Renderable
>
selectedItem
)
{
if
(
model
==
null
)
{
return
;
}
}
/* TODO: Rework this properly via Renderable implementation
Renderable render = selectedItem.getValue();
if (render instanceof BuildingNode node) {
model.getBuildings().remove(node.getBuilding());
mainWindow.getBuildingsView().getRoot().getChildren().remove(selectedItem);
}
*/
}
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java
View file @
845dd0a6
...
...
@@ -6,7 +6,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.FeatureType
;
import
de.hft.stuttgart.citydoctor2.gui.logger.GuiLogger
;
import
de.hft.stuttgart.citydoctor2.gui.tree.FeatureNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.Renderable
;
import
de.hft.stuttgart.citydoctor2.gui.tree.RenderableTreeCell
;
import
de.hft.stuttgart.citydoctor2.parameter.ArgumentParser
;
...
...
@@ -45,7 +44,6 @@ import java.io.FileNotFoundException;
import
java.io.IOException
;
import
java.util.*
;
import
static
javafx
.
scene
.
input
.
Clipboard
.
getSystemClipboard
;
public
class
MainWindow
extends
Application
{
...
...
@@ -789,46 +787,35 @@ public class MainWindow extends Application {
private
void
setupFeatureTabContextMenu
(
TreeView
<
Renderable
>
featureView
)
{
ContextMenu
menu
=
new
ContextMenu
();
MenuItem
mi
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.export"
));
mi
.
setOnAction
(
ea
->
{
Renderable
render
=
featureView
.
getSelectionModel
().
getSelectedItem
().
getValue
();
if
(
render
instanceof
FeatureNode
node
)
{
try
{
controller
.
export
(
node
.
getFeature
());
logger
.
info
(
Localization
.
getText
(
"CityDoctorController.exportSuccess"
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"Export failed: Unexpected error occurred"
);
logger
.
error
(
e
);
}
}
else
{
logger
.
info
(
Localization
.
getText
(
"MainWindow.infoTopLevelExport"
));
}
MenuItem
exportOption
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.export"
));
exportOption
.
setOnAction
(
ea
->
{
Renderable
node
=
featureView
.
getSelectionModel
().
getSelectedItem
().
getValue
();
fetchExportAction
(
node
);
});
menu
.
getItems
().
add
(
mi
);
MenuItem
clipMi
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.copyId"
));
clipMi
.
setOnAction
(
ea
->
{
Renderable
render
=
featureView
.
getSelectionModel
().
getSelectedItem
().
getValue
();
if
(
render
instanceof
FeatureNode
node
)
{
Clipboard
clipboard
=
getSystemClipboard
();
ClipboardContent
content
=
new
ClipboardContent
();
content
.
putString
(
node
.
getFeature
().
getGmlId
().
toString
());
if
(!
clipboard
.
setContent
(
content
))
{
logger
.
warn
(
Localization
.
getText
(
"MainWindow.warnCopyIdFailed"
));
}
}
else
{
logger
.
info
(
Localization
.
getText
(
"MainWindow.infoTopLevelCopyID"
));
}
menu
.
getItems
().
add
(
exportOption
);
MenuItem
copyToClipboardOption
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.copyId"
));
copyToClipboardOption
.
setOnAction
(
ea
->
{
Renderable
node
=
featureView
.
getSelectionModel
().
getSelectedItem
().
getValue
();
fetchCopyAction
(
node
);
});
menu
.
getItems
().
add
(
c
lipMi
);
menu
.
getItems
().
add
(
c
opyToClipboardOption
);
MenuItem
delete
Mi
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.delete"
));
delete
Mi
.
setOnAction
(
ae
->
controller
.
delete
(
featureView
.
getSelectionModel
().
getSelectedItem
()));
menu
.
getItems
().
add
(
delete
Mi
);
MenuItem
delete
Option
=
new
MenuItem
(
Localization
.
getText
(
"MainWindow.delete"
));
delete
Option
.
setOnAction
(
ae
->
controller
.
delete
(
featureView
.
getSelectionModel
().
getSelectedItem
()));
menu
.
getItems
().
add
(
delete
Option
);
featureView
.
setContextMenu
(
menu
);
}
public
void
fetchCopyAction
(
Renderable
node
)
{
node
.
getClipboardAction
(
this
);
}
public
void
fetchExportAction
(
Renderable
node
)
{
node
.
getFeatureExportAction
(
this
);
}
private
void
setupSelectListener
(
TreeView
<
Renderable
>
view
)
{
view
.
getSelectionModel
().
selectedItemProperty
().
addListener
((
obs
,
oldI
,
newI
)
->
{
if
(
newI
!=
null
)
{
...
...
@@ -1161,27 +1148,18 @@ public class MainWindow extends Application {
private
Pair
<
Tab
,
TreeView
<
Renderable
>>
getFeatureTabOf
(
CityObject
co
)
{
FeatureType
coType
=
co
.
getFeatureType
();
if
(
coType
==
FeatureType
.
BUILDING
){
return
new
Pair
<>(
buildingsTab
,
buildingsView
);
}
else
if
(
coType
==
FeatureType
.
VEGETATION
){
return
new
Pair
<>(
vegetationTab
,
vegetationView
);
}
else
if
(
coType
==
FeatureType
.
TRANSPORTATION
){
return
new
Pair
<>(
transportationTab
,
transView
);
}
else
if
(
coType
==
FeatureType
.
TUNNEL
){
return
new
Pair
<>(
tunnelTab
,
tunnelView
);
}
else
if
(
coType
==
FeatureType
.
BRIDGE
){
return
new
Pair
<>(
bridgeTab
,
bridgeView
);
}
else
if
(
coType
==
FeatureType
.
WATER
){
return
new
Pair
<>(
waterTab
,
waterView
);
}
else
if
(
coType
==
FeatureType
.
LAND
){
return
new
Pair
<>(
terrainTab
,
terrainView
);
}
else
if
(
coType
==
FeatureType
.
CITY_FURNITURE
){
return
new
Pair
<>(
cityFurnitureTab
,
cityFurnitureView
);
}
else
if
(
coType
==
FeatureType
.
GENERIC_CITY_OBJECT
){
return
new
Pair
<>(
otherObjectsTab
,
otherObjectsView
);
}
else
{
throw
new
IllegalArgumentException
(
"unknown feature type: "
+
coType
);
}
return
switch
(
coType
)
{
case
BUILDING
->
new
Pair
<>(
buildingsTab
,
buildingsView
);
case
VEGETATION
->
new
Pair
<>(
vegetationTab
,
vegetationView
);
case
TRANSPORTATION
->
new
Pair
<>(
transportationTab
,
transView
);
case
TUNNEL
->
new
Pair
<>(
tunnelTab
,
tunnelView
);
case
BRIDGE
->
new
Pair
<>(
bridgeTab
,
bridgeView
);
case
WATER
->
new
Pair
<>(
waterTab
,
waterView
);
case
LAND
->
new
Pair
<>(
terrainTab
,
terrainView
);
case
CITY_FURNITURE
->
new
Pair
<>(
cityFurnitureTab
,
cityFurnitureView
);
case
GENERIC_CITY_OBJECT
->
new
Pair
<>(
otherObjectsTab
,
otherObjectsView
);
default
->
throw
new
IllegalArgumentException
(
"unknown feature type: "
+
coType
);
};
}
public
MainToolBar
getMainToolbar
()
{
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/Renderer.java
View file @
845dd0a6
...
...
@@ -2,9 +2,16 @@ package de.hft.stuttgart.citydoctor2.gui;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.CityObjectCollector
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter
;
import
de.hft.stuttgart.citydoctor2.gui.tree.*
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.EdgeNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.ErrorNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.GenericAttributeNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.LinearRingNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.PolygonNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.node.VertexNode
;
import
de.hft.stuttgart.citydoctor2.math.Triangle3d
;
import
javafx.application.Platform
;
import
javafx.scene.control.TreeItem
;
...
...
@@ -177,332 +184,14 @@ public class Renderer {
}
}
public
void
render
(
Building
building
)
{
public
void
setupRefresher
(
CityObject
co
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupBuildingPolygons
=
setupBuildingPolygons
(
building
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupBuildingPolygons
));
render
(
setupBuildingPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
building
);
errorUpdater
.
run
();
addGenericAttributesToView
(
building
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBuildingPolygons
(
Building
b
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
b
,
polygons
);
for
(
BoundarySurface
bs
:
b
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
for
(
Installation
bi
:
b
.
getBuildingInstallations
())
{
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
}
for
(
BuildingRoom
br
:
b
.
getBuildingRooms
())
{
addPolygons
(
br
,
polygons
);
for
(
BoundarySurface
bs
:
br
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BuildingRoomFurniture
brf
:
b
.
getBuildingRoomFurnitureList
())
{
addPolygons
(
brf
,
polygons
);
for
(
BoundarySurface
bs
:
brf
.
getBoundarySurfaceList
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BuildingPart
bp
:
b
.
getBuildingParts
())
{
polygons
.
addAll
(
setupBuildingPartPolygons
(
bp
));
}
return
polygons
;
}
public
void
render
(
BuildingPart
bp
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupBuildingPartPolygons
=
setupBuildingPartPolygons
(
bp
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupBuildingPartPolygons
));
render
(
setupBuildingPartPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
bp
);
errorUpdater
.
run
();
addGenericAttributesToView
(
bp
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBuildingPartPolygons
(
BuildingPart
bp
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
bp
,
polygons
);
for
(
BoundarySurface
bs
:
bp
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
for
(
Installation
bi
:
bp
.
getBuildingInstallations
())
{
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
}
return
polygons
;
}
public
void
render
(
AbstractRoom
room
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupRoomPolygons
=
setupRoomPolygons
(
room
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupRoomPolygons
));
render
(
setupRoomPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
room
);
errorUpdater
.
run
();
addGenericAttributesToView
(
room
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupRoomPolygons
(
AbstractRoom
room
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
room
,
polygons
);
for
(
BoundarySurface
bs
:
room
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
AbstractFurniture
furniture
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupFurniturePolygons
=
setupFurniturePolygons
(
furniture
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupFurniturePolygons
));
render
(
setupFurniturePolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
furniture
);
errorUpdater
.
run
();
addGenericAttributesToView
(
furniture
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupFurniturePolygons
(
AbstractFurniture
furniture
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
furniture
,
polygons
);
for
(
BoundarySurface
bs
:
furniture
.
getBoundarySurfaceList
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
Storey
storey
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupStoreyPolygons
=
setupStoreyPolygons
(
storey
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupStoreyPolygons
));
render
(
setupStoreyPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
storey
);
errorUpdater
.
run
();
addGenericAttributesToView
(
storey
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupStoreyPolygons
(
Storey
storey
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
storey
,
polygons
);
for
(
BoundarySurface
bs
:
storey
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
BuildingUnit
buildingUnit
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupBuildingUnitPolgons
=
setupBuildingUnitPolygons
(
buildingUnit
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupBuildingUnitPolgons
));
render
(
setupBuildingUnitPolgons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
buildingUnit
);
errorUpdater
.
run
();
addGenericAttributesToView
(
buildingUnit
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBuildingUnitPolygons
(
BuildingUnit
buildingUnit
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
buildingUnit
,
polygons
);
for
(
BoundarySurface
bs
:
buildingUnit
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
private
Set
<
ConcretePolygon
>
setupTransportationObjectPolygons
(
TransportationObject
to
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
to
,
polygons
);
if
(
to
instanceof
TransportationSpace
ts
)
{
if
(
ts
instanceof
TopLevelTransportFeature
top
)
{
for
(
TransportSection
sect
:
top
.
getSections
())
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
sect
));
}
for
(
TransportSection
isect
:
top
.
getIntersections
())
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
isect
));
}
}
for
(
TrafficSpaceObject
tso
:
ts
.
getTrafficSpaces
())
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
tso
));
}
for
(
TrafficSpaceObject
atso
:
ts
.
getAuxTrafficSpaces
())
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
atso
));
}
}
if
(
to
instanceof
TrafficSpaceObject
tso
)
{
for
(
TrafficAreaObject
tao
:
tso
.
getTrafficAreas
())
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
tao
));
}
}
return
polygons
;
}
public
void
render
(
Tunnel
tunnel
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupTunnelPolygons
=
setupTunnelPolygons
(
tunnel
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupTunnelPolygons
));
render
(
setupTunnelPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
tunnel
);
errorUpdater
.
run
();
addGenericAttributesToView
(
tunnel
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupTunnelPolygons
(
Tunnel
tunnel
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
tunnel
,
polygons
);
for
(
BoundarySurface
bs
:
tunnel
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
for
(
Installation
ti
:
tunnel
.
getTunnelInstallations
())
{
addPolygons
(
ti
,
polygons
);
for
(
BoundarySurface
bs
:
ti
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
}
for
(
TunnelHollow
th
:
tunnel
.
getTunnelHollows
())
{
addPolygons
(
th
,
polygons
);
for
(
BoundarySurface
bs
:
th
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
TunnelFurniture
tf
:
tunnel
.
getTunnelFurniture
())
{
addPolygons
(
tf
,
polygons
);
for
(
BoundarySurface
bs
:
tf
.
getBoundarySurfaceList
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
TunnelPart
tp
:
tunnel
.
getTunnelParts
())
{
polygons
.
addAll
(
setupTunnelPartPolygons
(
tp
));
}
return
polygons
;
}
private
Set
<
ConcretePolygon
>
setupTunnelPartPolygons
(
TunnelPart
tp
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
tp
,
polygons
);
for
(
BoundarySurface
bs
:
tp
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
for
(
Installation
bi
:
tp
.
getTunnelInstallations
())
{
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
}
return
polygons
;
}
public
void
render
(
BridgeObject
bridge
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupBridgePolygons
=
setupBridgePolygons
(
bridge
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupBridgePolygons
));
render
(
setupBridgePolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
bridge
);
errorUpdater
.
run
();
addGenericAttributesToView
(
bridge
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBridgePolygons
(
BridgeObject
bridge
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
bridge
,
polygons
);
for
(
BoundarySurface
bs
:
bridge
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
for
(
BridgeConstructiveElement
consElement
:
bridge
.
getConstructiveElements
())
{
addPolygons
(
consElement
,
polygons
);
for
(
BoundarySurface
bs
:
consElement
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
Installation
inst
:
bridge
.
getBridgeInstallations
())
{
addPolygons
(
inst
,
polygons
);
for
(
BoundarySurface
bs
:
inst
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
CityObject
co
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupCityObjectPolygons
=
setupCityObjectPolygons
(
co
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupCityObjectPolygons
));
render
(
setupCityObjectPolygons
);
CityObjectCollector
collector
=
new
CityObjectCollector
();
co
.
accept
(
collector
);
Set
<
ConcretePolygon
>
objectPolygons
=
new
HashSet
<>();
collector
.
getCityObjects
().
forEach
(
object
->
addPolygons
(
object
,
objectPolygons
));
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
objectPolygons
));
render
(
objectPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
co
);
errorUpdater
.
run
();
...
...
@@ -512,142 +201,8 @@ public class Renderer {
refresher
.
run
();
}
public
void
render
(
ReliefObject
relief
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupCityObjectPolygons
=
setupReliefPolygons
(
relief
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupCityObjectPolygons
));
render
(
setupCityObjectPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
relief
);
errorUpdater
.
run
();
addGenericAttributesToView
(
relief
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupReliefPolygons
(
ReliefObject
relief
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
relief
,
polygons
);
for
(
TinObject
tin
:
relief
.
getComponents
())
{
addPolygons
(
tin
,
polygons
);
}
return
polygons
;
}
public
void
render
(
Installation
bi
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupCityObjectPolygons
=
setupBuildingInstallationPolygons
(
bi
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupCityObjectPolygons
));
render
(
setupCityObjectPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
bi
);
errorUpdater
.
run
();
addGenericAttributesToView
(
bi
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBuildingInstallationPolygons
(
Installation
bi
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
CityFurniture
cf
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupCityFurniturePolygons
=
setupCityFurniturePolygons
(
cf
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupCityFurniturePolygons
));
render
(
setupCityFurniturePolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
cf
);
errorUpdater
.
run
();
addGenericAttributesToView
(
cf
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupCityFurniturePolygons
(
CityFurniture
cf
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
cf
,
polygons
);
return
polygons
;
}
public
void
render
(
GenericCityObject
gco
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupGenericCityObjectPolygons
=
setupGenericCityObjectPolygons
(
gco
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupGenericCityObjectPolygons
));
render
(
setupGenericCityObjectPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
gco
);
errorUpdater
.
run
();
addGenericAttributesToView
(
gco
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupGenericCityObjectPolygons
(
GenericCityObject
gco
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
gco
,
polygons
);
for
(
BoundarySurface
bs
:
gco
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
}
return
polygons
;
}
public
void
render
(
TransportationObject
to
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupTransportationPolygons
=
setupTransportationObjectPolygons
(
to
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupTransportationPolygons
));
render
(
setupTransportationPolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
to
);
errorUpdater
.
run
();
addGenericAttributesToView
(
to
);
});
};
refresher
.
run
();
}
public
void
render
(
BoundarySurface
bs
)
{
refresher
=
()
->
{
Set
<
ConcretePolygon
>
setupBoundarySurfacePolygons
=
setupBoundarySurfacePolygons
(
bs
);
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
setupBoundarySurfacePolygons
));
render
(
setupBoundarySurfacePolygons
);
Platform
.
runLater
(()
->
{
errorUpdater
=
()
->
displayErrors
(
bs
);
errorUpdater
.
run
();
addGenericAttributesToView
(
bs
);
});
};
refresher
.
run
();
}
private
Set
<
ConcretePolygon
>
setupBoundarySurfacePolygons
(
BoundarySurface
bs
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
bs
,
polygons
);
for
(
Opening
op
:
bs
.
getOpenings
())
{
addPolygons
(
op
,
polygons
);
}
return
polygons
;
}
private
Set
<
ConcretePolygon
>
setupCityObjectPolygons
(
CityObject
co
)
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
addPolygons
(
co
,
polygons
);
return
polygons
;
public
void
render
(
CityObject
co
)
{
setupRefresher
(
co
);
}
private
void
addPolygons
(
CityObject
co
,
Set
<
ConcretePolygon
>
polygons
)
{
...
...
@@ -693,7 +248,7 @@ public class Renderer {
if
(
geom
.
getEdges
()
==
null
&&
currentGeometry
!=
null
)
{
// if there are no edges available low memory mode is enabled
// clear the old geometry of all meta information
currentGeometry
.
clearMeta
Information
();
currentGeometry
.
clearMeta
Data
();
}
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
...
...
@@ -808,36 +363,7 @@ public class Renderer {
}
public
void
renderBuildings
(
List
<
Building
>
objects
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
Building
b
:
objects
)
{
collectBuildingPolygons
(
polygons
,
b
);
for
(
BuildingPart
bp
:
b
.
getBuildingParts
())
{
collectBuildingPolygons
(
polygons
,
bp
);
}
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
{
Platform
.
runLater
(()
->
loadingDialog
.
hide
());
logger
.
catching
(
e
);
});
t
.
start
();
};
refresher
.
run
();
renderCityObjects
(
objects
,
null
);
}
public
void
render
(
CityDoctorModel
model
)
{
...
...
@@ -871,66 +397,11 @@ public class Renderer {
}
public
void
renderTransportation
(
List
<?
extends
TransportationObject
>
transportation
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
TransportationObject
to
:
transportation
)
{
polygons
.
addAll
(
setupTransportationObjectPolygons
(
to
));
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
Color
.
YELLOW
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
{
Platform
.
runLater
(()
->
loadingDialog
.
hide
());
logger
.
catching
(
e
);
});
t
.
start
();
};
refresher
.
run
();
renderCityObjects
(
transportation
,
Color
.
YELLOW
);
}
public
void
renderBridges
(
List
<
BridgeObject
>
bridges
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
BridgeObject
b
:
bridges
)
{
collectBridgePolygons
(
polygons
,
b
);
for
(
BridgeObject
bp
:
b
.
getParts
())
{
collectBridgePolygons
(
polygons
,
bp
);
}
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
Color
.
CORAL
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
{
Platform
.
runLater
(()
->
loadingDialog
.
hide
());
logger
.
catching
(
e
);
});
t
.
start
();
};
refresher
.
run
();
renderCityObjects
(
bridges
,
Color
.
CORAL
);
}
public
void
renderWater
(
List
<
WaterObject
>
water
)
{
...
...
@@ -938,72 +409,13 @@ public class Renderer {
}
public
void
renderCityFurniture
(
List
<
CityFurniture
>
cityFurniture
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
CityFurniture
cf
:
cityFurniture
)
{
collectCityFurniture
(
polygons
,
cf
);
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
Color
.
BLUEVIOLET
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
{
Platform
.
runLater
(()
->
loadingDialog
.
hide
());
logger
.
catching
(
e
);
});
t
.
start
();
};
refresher
.
run
();
renderCityObjects
(
cityFurniture
,
Color
.
BLUEVIOLET
);
}
public
void
renderTerrain
(
List
<
CityObject
>
land
)
{
render
Land
Objects
(
land
,
Color
.
BROWN
);
render
City
Objects
(
land
,
Color
.
BROWN
);
}
private
void
renderLandObjects
(
List
<
CityObject
>
cos
,
Color
baseColor
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
CityObject
co
:
cos
)
{
addPolygons
(
co
,
polygons
);
if
(
co
instanceof
ReliefObject
)
{
ReliefObject
relief
=
(
ReliefObject
)
co
;
for
(
TinObject
tin
:
relief
.
getComponents
())
{
addPolygons
(
tin
,
polygons
);
}
}
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
baseColor
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
Platform
.
runLater
(()
->
loadingDialog
.
hide
()));
t
.
start
();
};
refresher
.
run
();
}
public
void
renderCityObjects
(
List
<?
extends
CityObject
>
cos
,
Color
baseColor
)
{
errorUpdater
=
null
;
...
...
@@ -1015,10 +427,14 @@ public class Renderer {
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
CityObject
co
:
cos
)
{
addPolygons
(
co
,
polygons
);
CityObjectCollector
collector
=
new
CityObjectCollector
();
cos
.
forEach
(
cityObject
->
cityObject
.
accept
(
collector
));
collector
.
getCityObjects
().
forEach
(
cityObject
->
addPolygons
(
cityObject
,
polygons
));
if
(
baseColor
!=
null
)
{
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
baseColor
);
}
else
{
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
);
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
,
baseColor
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
...
...
@@ -1033,129 +449,9 @@ public class Renderer {
}
public
void
renderTunnels
(
List
<
Tunnel
>
objects
)
{
errorUpdater
=
null
;
refresher
=
()
->
{
Platform
.
runLater
(()
->
{
loadingDialog
.
show
();
clearGeometryTrees
();
clearAttributes
();
});
Thread
t
=
new
Thread
(()
->
{
Set
<
ConcretePolygon
>
polygons
=
new
HashSet
<>();
for
(
Tunnel
tunnel
:
objects
)
{
collectTunnelPolygons
(
polygons
,
tunnel
);
for
(
TunnelPart
tp
:
tunnel
.
getTunnelParts
())
{
collectTunnelPolygons
(
polygons
,
tp
);
}
}
currentTriGeom
=
TriangulatedGeometry
.
of
(
polygons
);
errVisitor
.
setGeometry
(
currentTriGeom
);
Platform
.
runLater
(()
->
{
setupRenderState
();
mainWindow
.
zoomOutForBoundingBox
(
BoundingBox
.
of
(
polygons
));
loadingDialog
.
hide
();
});
});
t
.
setUncaughtExceptionHandler
((
thread
,
e
)
->
{
Platform
.
runLater
(()
->
loadingDialog
.
hide
());
logger
.
catching
(
e
);
});
t
.
start
();
};
refresher
.
run
();
}
private
void
collectBuildingPolygons
(
Set
<
ConcretePolygon
>
polygons
,
AbstractBuilding
ab
)
{
addPolygons
(
ab
,
polygons
);
for
(
Installation
bi
:
ab
.
getBuildingInstallations
())
{
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
}
for
(
BuildingRoom
br
:
ab
.
getBuildingRooms
())
{
addPolygons
(
br
,
polygons
);
for
(
BoundarySurface
bs
:
br
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BoundarySurface
bs
:
ab
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
renderCityObjects
(
objects
,
Color
.
DARKGRAY
);
}
private
void
collectBridgePolygons
(
Set
<
ConcretePolygon
>
polygons
,
BridgeObject
br
)
{
addPolygons
(
br
,
polygons
);
for
(
Installation
bi
:
br
.
getBridgeInstallations
())
{
addPolygons
(
bi
,
polygons
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
}
for
(
BridgeRoom
r
:
br
.
getBridgeRooms
())
{
addPolygons
(
r
,
polygons
);
for
(
BoundarySurface
bs
:
r
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BridgeConstructiveElement
bce
:
br
.
getConstructiveElements
())
{
addPolygons
(
bce
,
polygons
);
for
(
BoundarySurface
bs
:
bce
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BoundarySurface
bs
:
br
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
}
public
void
collectTunnelPolygons
(
Set
<
ConcretePolygon
>
polygons
,
AbstractTunnel
at
)
{
addPolygons
(
at
,
polygons
);
for
(
Installation
ti
:
at
.
getTunnelInstallations
())
{
addPolygons
(
ti
,
polygons
);
for
(
BoundarySurface
bs
:
ti
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
}
for
(
TunnelHollow
th
:
at
.
getTunnelHollows
())
{
addPolygons
(
th
,
polygons
);
for
(
BoundarySurface
bs
:
th
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
TunnelConstructiveElement
tce
:
at
.
getTunnelConstructiveElements
())
{
addPolygons
(
tce
,
polygons
);
for
(
BoundarySurface
bs
:
tce
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
}
}
for
(
BoundarySurface
bs
:
at
.
getBoundarySurfaces
())
{
addPolygons
(
bs
,
polygons
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygons
(
o
,
polygons
);
}
}
}
private
void
collectCityFurniture
(
Set
<
ConcretePolygon
>
polygons
,
CityFurniture
cf
)
{
addPolygons
(
cf
,
polygons
);
}
private
void
addConcretePolygons
(
Set
<
ConcretePolygon
>
polygons
,
Geometry
geom
)
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/TriangulatedGeometry.java
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.gui
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.CityObjectCollector
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter
;
...
...
@@ -75,117 +76,33 @@ public class TriangulatedGeometry {
public
static
TriangulatedGeometry
of
(
CityDoctorModel
model
,
List
<
ViewFilter
>
filters
)
{
List
<
Vector3d
>
points
=
new
ArrayList
<>();
addPointsFromBuildings
(
model
.
getBuildings
(),
points
);
addPointsFromCityObject
(
model
.
getBridges
(),
points
);
addPointsFromCityObject
(
model
.
getLand
(),
points
);
addPointsFromTransportationObjects
(
model
.
getTransportation
(),
points
);
addPointsFromCityObject
(
model
.
getVegetation
(),
points
);
addPointsFromCityObject
(
model
.
getWater
(),
points
);
addPointsFromCityObject
(
model
.
createFeatureStream
().
toList
(),
points
);
TriangulatedGeometry
triGeom
=
new
TriangulatedGeometry
();
triGeom
.
materials
=
new
ArrayList
<>();
triGeom
.
meshes
=
new
ArrayList
<>();
triGeom
.
movedBy
=
triGeom
.
findCenter
(
points
);
addPolygonDataFromBuildings
(
model
.
getBuildings
(),
triGeom
,
filters
);
addPolygonDataFromBridges
(
model
.
getBridges
(),
triGeom
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getLand
(),
triGeom
,
Color
.
BROWN
,
filters
);
addPolygonDataFromTransportationObjects
(
model
.
getTransportation
(),
triGeom
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getBuildings
(),
triGeom
,
Color
.
WHITE
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getBridges
(),
triGeom
,
Color
.
LIGHTSTEELBLUE
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getTunnels
(),
triGeom
,
Color
.
SLATEGRAY
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getLand
(),
triGeom
,
Color
.
TAN
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getTransportation
(),
triGeom
,
Color
.
DIMGRAY
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getVegetation
(),
triGeom
,
Color
.
LIGHTGREEN
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getWater
(),
triGeom
,
Color
.
LIGHTSKYBLUE
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getCityFurniture
(),
triGeom
,
Color
.
BLUEVIOLET
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getGenericCityObjects
(),
triGeom
,
Color
.
DARKGRAY
,
filters
);
addPolygonDataFromCityObjects
(
model
.
getGenericCityObjects
(),
triGeom
,
Color
.
BLACK
,
filters
);
return
triGeom
;
}
private
static
void
addPolygonDataFromBuildings
(
List
<
Building
>
buildings
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
for
(
Building
b
:
buildings
)
{
addPolygonData
(
b
,
triGeom
,
Color
.
WHITE
,
filters
);
addPolygonDataFromBoundarySurfaces
(
b
.
getBoundarySurfaces
(),
triGeom
,
filters
);
addPolygonDataFromCityObjects
(
b
.
getBuildingInstallations
(),
triGeom
,
Color
.
WHITE
,
filters
);
for
(
Installation
bi
:
b
.
getBuildingInstallations
())
{
addPolygonDataFromCityObjects
(
bi
.
getBoundarySurfaces
(),
triGeom
,
Color
.
WHITE
,
filters
);
}
for
(
BuildingPart
bp
:
b
.
getBuildingParts
())
{
addPolygonData
(
bp
,
triGeom
,
Color
.
WHITE
,
filters
);
addPolygonDataFromBoundarySurfaces
(
bp
.
getBoundarySurfaces
(),
triGeom
,
filters
);
addPolygonDataFromCityObjects
(
bp
.
getBuildingInstallations
(),
triGeom
,
Color
.
WHITE
,
filters
);
}
}
}
private
static
void
addPolygonDataFromBridges
(
List
<
BridgeObject
>
bridges
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
for
(
BridgeObject
b
:
bridges
)
{
addPolygonData
(
b
,
triGeom
,
Color
.
CORAL
,
filters
);
addPolygonDataFromBoundarySurfaces
(
b
.
getBoundarySurfaces
(),
triGeom
,
filters
);
addPolygonDataFromCityObjects
(
b
.
getBridgeInstallations
(),
triGeom
,
Color
.
CORAL
,
filters
);
for
(
Installation
bi
:
b
.
getBridgeInstallations
())
{
addPolygonData
(
bi
,
triGeom
,
Color
.
CORAL
,
filters
);
addPolygonDataFromCityObjects
(
bi
.
getBoundarySurfaces
(),
triGeom
,
Color
.
CORAL
,
filters
);
}
for
(
BridgeConstructiveElement
bce
:
b
.
getConstructiveElements
())
{
addPolygonData
(
bce
,
triGeom
,
Color
.
CORAL
,
filters
);
addPolygonDataFromCityObjects
(
bce
.
getBoundarySurfaces
(),
triGeom
,
Color
.
CORAL
,
filters
);
}
addPolygonDataFromBridges
(
b
.
getParts
(),
triGeom
,
filters
);
}
}
private
static
void
addPolygonDataFromTransportationObjects
(
List
<
TransportationObject
>
tos
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
for
(
TransportationObject
to
:
tos
)
{
if
(
to
instanceof
TransportationSpace
tsp
)
{
addPolygonDataFromTransportationSpace
(
tsp
,
triGeom
,
filters
);
if
(
tsp
instanceof
TopLevelTransportFeature
top
)
{
for
(
TransportSection
tse
:
top
.
getSections
())
{
addPolygonDataFromTransportationSpace
(
tse
,
triGeom
,
filters
);
}
for
(
TransportSection
tse
:
top
.
getIntersections
())
{
addPolygonDataFromTransportationSpace
(
tse
,
triGeom
,
filters
);
}
}
}
else
{
addPolygonData
(
to
,
triGeom
,
Color
.
YELLOW
,
filters
);
}
}
}
private
static
void
addPolygonDataFromTransportationSpace
(
TransportationSpace
ts
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
addPolygonData
(
ts
,
triGeom
,
Color
.
YELLOW
,
filters
);
addPolygonDataFromTrafficSpaces
(
ts
.
getTrafficSpaces
(),
triGeom
,
filters
);
addPolygonDataFromTrafficSpaces
(
ts
.
getAuxTrafficSpaces
(),
triGeom
,
filters
);
}
private
static
void
addPolygonDataFromTrafficSpaces
(
List
<
TrafficSpaceObject
>
spaces
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
for
(
TrafficSpaceObject
space
:
spaces
)
{
addPolygonData
(
space
,
triGeom
,
Color
.
YELLOW
,
filters
);
for
(
TrafficAreaObject
area
:
space
.
getTrafficAreas
())
{
addPolygonData
(
area
,
triGeom
,
Color
.
YELLOW
,
filters
);
}
}
}
private
static
void
addPolygonDataFromBoundarySurfaces
(
List
<
BoundarySurface
>
boundarySurfaces
,
TriangulatedGeometry
triGeom
,
List
<
ViewFilter
>
filters
)
{
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
addPolygonData
(
bs
,
triGeom
,
Color
.
WHITE
,
filters
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
addPolygonData
(
o
,
triGeom
,
Color
.
WHITE
,
filters
);
}
}
}
private
static
void
addPolygonDataFromCityObjects
(
List
<?
extends
CityObject
>
cos
,
TriangulatedGeometry
triGeom
,
Color
color
,
List
<
ViewFilter
>
filters
)
{
for
(
CityObject
co
:
cos
)
{
addPolygonData
(
co
,
triGeom
,
color
,
filters
);
}
CityObject
Collector
collector
=
new
CityObjectCollector
();
cos
.
forEach
(
cityObject
->
cityObject
.
accept
(
collector
)
);
collector
.
getCityObjects
().
forEach
(
cityObject
->
addPolygonData
(
cityObject
,
triGeom
,
color
,
filters
));
}
private
static
void
addPolygonData
(
CityObject
co
,
TriangulatedGeometry
triGeom
,
Color
color
,
List
<
ViewFilter
>
filters
)
{
...
...
@@ -213,46 +130,10 @@ public class TriangulatedGeometry {
return
true
;
}
private
static
void
addPointsFromBuildings
(
List
<
Building
>
buildings
,
List
<
Vector3d
>
points
)
{
for
(
Building
b
:
buildings
)
{
addPoints
(
b
,
points
);
for
(
BuildingPart
bp
:
b
.
getBuildingParts
())
{
addPoints
(
bp
,
points
);
addPointsFromCityObject
(
bp
.
getBoundarySurfaces
(),
points
);
addPointsFromCityObject
(
bp
.
getBuildingInstallations
(),
points
);
}
addPointsFromCityObject
(
b
.
getBoundarySurfaces
(),
points
);
addPointsFromCityObject
(
b
.
getBuildingInstallations
(),
points
);
}
}
private
static
void
addPointsFromTransportationObjects
(
List
<?
extends
TransportationObject
>
tos
,
List
<
Vector3d
>
points
)
{
for
(
TransportationObject
to
:
tos
)
{
addPoints
(
to
,
points
);
if
(
to
instanceof
TransportationSpace
ts
)
{
addPointsFromTrafficSpace
(
ts
.
getTrafficSpaces
(),
points
);
addPointsFromTrafficSpace
(
ts
.
getAuxTrafficSpaces
(),
points
);
if
(
ts
instanceof
TopLevelTransportFeature
top
)
{
addPointsFromTransportationObjects
(
top
.
getSections
(),
points
);
addPointsFromTransportationObjects
(
top
.
getIntersections
(),
points
);
}
}
}
}
private
static
void
addPointsFromTrafficSpace
(
List
<
TrafficSpaceObject
>
tos
,
List
<
Vector3d
>
points
)
{
for
(
TrafficSpaceObject
to
:
tos
)
{
addPoints
(
to
,
points
);
for
(
TrafficAreaObject
area
:
to
.
getTrafficAreas
())
{
addPoints
(
area
,
points
);
}
}
}
private
static
void
addPointsFromCityObject
(
List
<?
extends
CityObject
>
cos
,
List
<
Vector3d
>
points
)
{
for
(
CityObject
co
:
cos
)
{
addPoints
(
co
,
points
);
}
CityObject
Collector
collector
=
new
CityObjectCollector
();
cos
.
forEach
(
cityObject
->
cityObject
.
accept
(
collector
)
);
collector
.
getCityObjects
().
forEach
(
cityObject
->
addPoints
(
cityObject
,
points
));
}
private
static
void
addPoints
(
CityObject
co
,
List
<
Vector3d
>
points
)
{
...
...
@@ -286,16 +167,9 @@ public class TriangulatedGeometry {
private
PhongMaterial
calculateMaterial
(
Polygon
p
,
Color
baseColor
)
{
Vector3d
normal
=
p
.
calculateNormalNormalized
();
BoundarySurface
bs
=
p
.
getPartOfSurface
();
if
(
bs
!=
null
)
{
if
(
bs
.
getType
()
==
BoundarySurfaceType
.
ROOF
)
{
baseColor
=
Color
.
RED
;
}
else
if
(
bs
.
getType
()
==
BoundarySurfaceType
.
GROUND
)
{
baseColor
=
Color
.
KHAKI
;
}
if
(
p
.
getRenderColor
()
!=
null
&&
p
.
getRenderColor
()
!=
Color
.
WHITE
)
{
baseColor
=
p
.
getRenderColor
();
}
baseColor
=
determineColorDependingOnParentType
(
p
,
baseColor
);
double
cos
=
normal
.
dot
(
AXIS
);
double
acos
=
Math
.
acos
(
cos
);
...
...
@@ -307,28 +181,6 @@ public class TriangulatedGeometry {
return
new
PhongMaterial
(
derivedColor
);
}
private
Color
determineColorDependingOnParentType
(
Polygon
p
,
Color
baseColor
)
{
p
=
p
.
getOriginal
();
Polygon
p1
=
p
.
getLinkedFromPolygon
();
baseColor
=
changeBaseColorIfPolygonHasOpeningParent
(
p1
,
baseColor
);
baseColor
=
changeBaseColorIfPolygonHasOpeningParent
(
p
,
baseColor
);
return
baseColor
;
}
private
Color
changeBaseColorIfPolygonHasOpeningParent
(
Polygon
p
,
Color
baseColor
)
{
if
(
p
==
null
)
{
return
baseColor
;
}
CityObject
parent
=
p
.
getParent
().
getParent
();
if
(
parent
instanceof
Opening
op
)
{
if
(
op
.
getType
()
==
OpeningType
.
DOOR
)
{
baseColor
=
Color
.
ORANGE
;
}
else
{
baseColor
=
Color
.
TEAL
;
}
}
return
baseColor
;
}
private
Vector3d
findCenter
(
List
<
Vector3d
>
points
)
{
double
xMin
=
Double
.
MAX_VALUE
;
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/VertexClickHandler.java
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.gui
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
de.hft.stuttgart.citydoctor2.gui.tree.FeatureNode
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
javafx.scene.input.Clipboard
;
import
javafx.scene.input.ClipboardContent
;
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java
View file @
845dd0a6
package
de.hft.stuttgart.citydoctor2.gui
;
import
de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryListCell
;
import
de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryNode
;
import
de.hft.stuttgart.citydoctor2.gui.tree.
node.
ZipEntryNode
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry
;
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/AllBoundarySurfacesNode.java
deleted
100644 → 0
View file @
8a94994e
package
de.hft.stuttgart.citydoctor2.gui.tree
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.gui.CheckStatus
;
import
de.hft.stuttgart.citydoctor2.gui.Renderer
;
public
class
AllBoundarySurfacesNode
extends
Renderable
{
private
final
List
<
BoundarySurface
>
boundarySurfaces
;
public
AllBoundarySurfacesNode
(
List
<
BoundarySurface
>
boundarySurfaces
)
{
this
.
boundarySurfaces
=
boundarySurfaces
;
}
@Override
public
String
getText
()
{
return
"Boundary Surfaces"
;
}
@Override
public
void
visit
(
Renderer
renderer
)
{
renderer
.
clearCurrentRender
();
}
@Override
public
void
refreshTextColor
()
{
boolean
isValidated
=
false
;
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
if
(
bs
.
isValidated
())
{
isValidated
=
true
;
}
if
(
bs
.
containsAnyError
())
{
setStatus
(
CheckStatus
.
ERROR
);
return
;
}
}
if
(
isValidated
)
{
setStatus
(
CheckStatus
.
OK
);
}
else
{
setStatus
(
CheckStatus
.
NOT_CHECKED
);
}
}
}
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/AllBridgeConstructiveElementsNode.java
deleted
100644 → 0
View file @
8a94994e
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.gui.tree
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeConstructiveElement
;
import
de.hft.stuttgart.citydoctor2.gui.CheckStatus
;
import
de.hft.stuttgart.citydoctor2.gui.Renderer
;
public
class
AllBridgeConstructiveElementsNode
extends
Renderable
{
private
final
List
<
BridgeConstructiveElement
>
constructiveElements
;
public
AllBridgeConstructiveElementsNode
(
List
<
BridgeConstructiveElement
>
constructiveElements
)
{
this
.
constructiveElements
=
constructiveElements
;
}
@Override
public
String
getText
()
{
return
"Constructive Elements"
;
}
@Override
public
void
visit
(
Renderer
renderer
)
{
renderer
.
clearCurrentRender
();
}
@Override
public
void
refreshTextColor
()
{
boolean
isValidated
=
false
;
for
(
BridgeConstructiveElement
bce
:
constructiveElements
)
{
if
(
bce
.
isValidated
())
{
isValidated
=
true
;
}
if
(
bce
.
containsAnyError
())
{
setStatus
(
CheckStatus
.
ERROR
);
return
;
}
}
if
(
isValidated
)
{
setStatus
(
CheckStatus
.
OK
);
}
else
{
setStatus
(
CheckStatus
.
NOT_CHECKED
);
}
}
}
Prev
1
2
3
4
5
6
7
8
9
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