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
8b2305a7
Commit
8b2305a7
authored
Nov 12, 2025
by
Luna Riegel
Browse files
Refactor: Simplify error filtering
parent
dbc4750b
Changes
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
View file @
8b2305a7
...
@@ -1391,7 +1391,6 @@ public class CityDoctorController {
...
@@ -1391,7 +1391,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getBuildingIds
();
List
<
GmlId
>
idList
=
model
.
getBuildingIds
();
foundBuildings
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundBuildings
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getBuildings().filter(Checkable::containsAnyError).forEach(co -> foundBuildings.add(co.getGmlId()));
Supplier
<
Stream
<
Building
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundBuildings
).
map
(
co
->
(
Building
)
co
);
Supplier
<
Stream
<
Building
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundBuildings
).
map
(
co
->
(
Building
)
co
);
buildBuildingTreeFromList
(
supply
,
root
);
buildBuildingTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1414,7 +1413,6 @@ public class CityDoctorController {
...
@@ -1414,7 +1413,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getVegetationIds
();
List
<
GmlId
>
idList
=
model
.
getVegetationIds
();
foundVegetation
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundVegetation
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getVegetation().filter(Checkable::containsAnyError).forEach(co -> foundVegetation.add(co.getGmlId()));
Supplier
<
Stream
<
Vegetation
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundVegetation
).
map
(
co
->
(
Vegetation
)
co
);
Supplier
<
Stream
<
Vegetation
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundVegetation
).
map
(
co
->
(
Vegetation
)
co
);
buildVegetationTreeFromList
(
supply
,
root
);
buildVegetationTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1437,7 +1435,6 @@ public class CityDoctorController {
...
@@ -1437,7 +1435,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getBridgeIds
();
List
<
GmlId
>
idList
=
model
.
getBridgeIds
();
foundBridge
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundBridge
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getBridges().filter(Checkable::containsAnyError).forEach(co -> foundBridge.add(co.getGmlId()));
Supplier
<
Stream
<
BridgeObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundBridge
).
map
(
co
->
(
BridgeObject
)
co
);
Supplier
<
Stream
<
BridgeObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundBridge
).
map
(
co
->
(
BridgeObject
)
co
);
buildBridgeTreeFromList
(
supply
,
root
);
buildBridgeTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1460,7 +1457,6 @@ public class CityDoctorController {
...
@@ -1460,7 +1457,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getLandIds
();
List
<
GmlId
>
idList
=
model
.
getLandIds
();
foundLand
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundLand
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getLand().filter(Checkable::containsAnyError).forEach(co -> foundLand.add(co.getGmlId()));
Supplier
<
Stream
<
CityObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundLand
).
map
(
co
->
(
CityObject
)
co
);
Supplier
<
Stream
<
CityObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundLand
).
map
(
co
->
(
CityObject
)
co
);
buildLandTreeFromList
(
supply
,
root
);
buildLandTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1483,7 +1479,6 @@ public class CityDoctorController {
...
@@ -1483,7 +1479,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getCityFurnitureIds
();
List
<
GmlId
>
idList
=
model
.
getCityFurnitureIds
();
foundCityFurniture
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundCityFurniture
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getCityFurniture().filter(Checkable::containsAnyError).forEach(co -> foundCityFurniture.add(co.getGmlId()));
Supplier
<
Stream
<
CityFurniture
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundCityFurniture
).
map
(
co
->
(
CityFurniture
)
co
);
Supplier
<
Stream
<
CityFurniture
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundCityFurniture
).
map
(
co
->
(
CityFurniture
)
co
);
buildCityFurnitureTreeFromList
(
supply
,
root
);
buildCityFurnitureTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1506,7 +1501,6 @@ public class CityDoctorController {
...
@@ -1506,7 +1501,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getGenericCityObjectIds
();
List
<
GmlId
>
idList
=
model
.
getGenericCityObjectIds
();
foundGenericCityObjects
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundGenericCityObjects
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getGenericCityObjects().filter(Checkable::containsAnyError).forEach(co -> foundGenericCityObjects.add(co.getGmlId()));
Supplier
<
Stream
<
GenericCityObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundGenericCityObjects
).
map
(
co
->
(
GenericCityObject
)
co
);
Supplier
<
Stream
<
GenericCityObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundGenericCityObjects
).
map
(
co
->
(
GenericCityObject
)
co
);
buildGenericCityObjectTreeFromList
(
supply
,
root
);
buildGenericCityObjectTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1529,7 +1523,6 @@ public class CityDoctorController {
...
@@ -1529,7 +1523,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getTransportationIds
();
List
<
GmlId
>
idList
=
model
.
getTransportationIds
();
foundTransportation
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundTransportation
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getTransportation().filter(Checkable::containsAnyError).forEach(co -> foundTransportation.add(co.getGmlId()));
Supplier
<
Stream
<
TransportationObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundTransportation
).
map
(
co
->
(
TransportationObject
)
co
);
Supplier
<
Stream
<
TransportationObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundTransportation
).
map
(
co
->
(
TransportationObject
)
co
);
buildTransportationTreeFromList
(
supply
,
root
);
buildTransportationTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1552,7 +1545,6 @@ public class CityDoctorController {
...
@@ -1552,7 +1545,6 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getTunnelIds
();
List
<
GmlId
>
idList
=
model
.
getTunnelIds
();
foundTunnel
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundTunnel
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getTunnels().filter(Checkable::containsAnyError).forEach(co -> foundTunnel.add(co.getGmlId()));
Supplier
<
Stream
<
Tunnel
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundTunnel
).
map
(
co
->
(
Tunnel
)
co
);
Supplier
<
Stream
<
Tunnel
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundTunnel
).
map
(
co
->
(
Tunnel
)
co
);
buildTunnelTreeFromList
(
supply
,
root
);
buildTunnelTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
...
@@ -1576,60 +1568,12 @@ public class CityDoctorController {
...
@@ -1576,60 +1568,12 @@ public class CityDoctorController {
List
<
GmlId
>
idList
=
model
.
getWaterIds
();
List
<
GmlId
>
idList
=
model
.
getWaterIds
();
foundWater
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
foundWater
.
removeIf
(
gmlId
->
(!
idList
.
contains
(
gmlId
)));
// model.getWater().filter(Checkable::containsAnyError).forEach(co -> foundWater.add(co.getGmlId()));
Supplier
<
Stream
<
WaterObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundWater
).
map
(
co
->
(
WaterObject
)
co
);
Supplier
<
Stream
<
WaterObject
>>
supply
=
()
->
model
.
getCache
().
getStream
(
foundWater
).
map
(
co
->
(
WaterObject
)
co
);
buildWaterTreeFromList
(
supply
,
root
);
buildWaterTreeFromList
(
supply
,
root
);
updateTree
(
root
);
updateTree
(
root
);
addMoreButtonForWater
(
waterView
,
root
,
tunnelChunkNr
,
supply
,
foundWater
.
size
());
addMoreButtonForWater
(
waterView
,
root
,
tunnelChunkNr
,
supply
,
foundWater
.
size
());
}
}
public
void
fillTreeViewFromFeatures
(
FeatureType
selectedTab
)
{
if
(
model
==
null
)
{
return
;
}
mainWindow
.
resetSearchBar
();
switch
(
selectedTab
)
{
case
BUILDING:
buildBuildings
(
model
);
updateTree
(
mainWindow
.
getBuildingsView
().
getRoot
());
break
;
case
VEGETATION:
buildVegetation
(
model
);
updateTree
(
mainWindow
.
getVegetationView
().
getRoot
());
break
;
case
BRIDGE:
buildBridges
(
model
);
updateTree
(
mainWindow
.
getBridgeView
().
getRoot
());
break
;
case
LAND:
buildLand
(
model
);
updateTree
(
mainWindow
.
getTerrainView
().
getRoot
());
break
;
case
TRANSPORTATION:
buildTransportation
(
model
);
updateTree
(
mainWindow
.
getTransportationView
().
getRoot
());
break
;
case
TUNNEL:
buildTunnel
(
model
);
updateTree
(
mainWindow
.
getTunnelView
().
getRoot
());
break
;
case
WATER:
buildWater
(
model
);
updateTree
(
mainWindow
.
getWaterView
().
getRoot
());
break
;
case
CITY_FURNITURE:
buildCityFurniture
(
model
);
updateTree
(
mainWindow
.
getCityFurnitureView
().
getRoot
());
break
;
case
GENERIC_CITY_OBJECT:
buildGenericCityObjects
(
model
);
updateTree
(
mainWindow
.
getGenericCityObjectView
().
getRoot
());
break
;
default
:
throw
new
IllegalStateException
();
}
}
public
CityDoctorModel
getModel
()
{
public
CityDoctorModel
getModel
()
{
return
model
;
return
model
;
}
}
...
@@ -1692,40 +1636,19 @@ public class CityDoctorController {
...
@@ -1692,40 +1636,19 @@ public class CityDoctorController {
public
void
errorFilterIndexChanged
(
Number
newV
)
{
public
void
errorFilterIndexChanged
(
Number
newV
)
{
mainWindow
.
getMeshGroup
().
getChildren
().
clear
();
mainWindow
.
getMeshGroup
().
getChildren
().
clear
();
mainWindow
.
unselectEverything
();
mainWindow
.
unselectEverything
();
if
(
newV
.
intValue
()
==
0
)
{
if
(
newV
.
intValue
()
==
0
)
{
// Error filter was set to "All"
fillTreeViewFromFeatures
(
mainWindow
.
getSelectedTab
());
buildTrees
();
}
else
if
(
newV
.
intValue
()
==
1
)
{
updateFeatureTrees
();
switch
(
mainWindow
.
getSelectedTab
())
{
}
else
if
(
newV
.
intValue
()
==
1
)
{
// Error filter was set to "With errors"
case
BUILDING:
fillTreeViewWithErrorBuildings
();
fillTreeViewWithErrorBuildings
();
break
;
case
VEGETATION:
fillTreeViewWithErrorVegetation
();
fillTreeViewWithErrorVegetation
();
break
;
case
BRIDGE:
fillTreeViewWithErrorBridges
();
fillTreeViewWithErrorBridges
();
break
;
case
LAND:
fillTreeViewWithErrorLand
();
fillTreeViewWithErrorLand
();
break
;
case
TRANSPORTATION:
fillTreeViewWithErrorTransportation
();
fillTreeViewWithErrorTransportation
();
break
;
case
TUNNEL:
fillTreeViewWithErrorTunnel
();
fillTreeViewWithErrorTunnel
();
break
;
case
WATER:
fillTreeViewWithErrorWater
();
fillTreeViewWithErrorWater
();
break
;
case
CITY_FURNITURE:
fillTreeViewWithErrorCityFurniture
();
fillTreeViewWithErrorCityFurniture
();
break
;
case
GENERIC_CITY_OBJECT:
fillTreeViewWithErrorGenericCityObjects
();
fillTreeViewWithErrorGenericCityObjects
();
break
;
default
:
throw
new
IllegalStateException
(
"Unknown selected feature tab: "
+
mainWindow
.
getSelectedTab
());
}
}
else
{
}
else
{
throw
new
IllegalStateException
(
"Unknown filter index selected: "
+
newV
);
throw
new
IllegalStateException
(
"Unknown filter index selected: "
+
newV
);
}
}
...
...
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