Commit c748a058 authored by Luna Riegel's avatar Luna Riegel
Browse files

Refactor: Rename functions and fields

parent 8edfe8d6
Pipeline #12217 passed with stage
in 2 minutes and 12 seconds
...@@ -125,7 +125,7 @@ public class CityDoctorModel { ...@@ -125,7 +125,7 @@ public class CityDoctorModel {
public Stream<CityObject> createFeatureStream() { public Stream<CityObject> createFeatureStream() {
return Stream.of(getBuildings(), getVegetation(), getBridges(), getLand(), getTransportation(), return Stream.of(getBuildings(), getVegetation(), getBridges(), getLand(), getTransportation(),
getTunnels(), getWater(), getCityFurniture(), getGenericCityObjects()).flatMap(co -> co); getTunnels(), getWater(), getCityFurniture(), getOtherCityObjects()).flatMap(co -> co);
} }
public List<GmlId> getFeatureIds() { public List<GmlId> getFeatureIds() {
...@@ -347,20 +347,20 @@ public class CityDoctorModel { ...@@ -347,20 +347,20 @@ public class CityDoctorModel {
return cityfurniture.size(); return cityfurniture.size();
} }
public void addGenericCityObject(GenericCityObject coGenericCityObject) { public void addOtherCityObject(CityObject otherCityObject) {
genericObjects.add(coGenericCityObject.getGmlId()); genericObjects.add(otherCityObject.getGmlId());
cache.put(coGenericCityObject); cache.put(otherCityObject);
} }
public Stream<GenericCityObject> getGenericCityObjects() { public Stream<CityObject> getOtherCityObjects() {
return genericObjects.stream().map(co -> (GenericCityObject) cache.get(co)); return genericObjects.stream().map(cache::get);
} }
public List<GmlId> getGenericCityObjectIds() { public List<GmlId> getOtherCityObjectsIds() {
return genericObjects; return genericObjects;
} }
public int getGenericCityObjectCount(){ public int getOtherCityObjectsCount(){
return genericObjects.size(); return genericObjects.size();
} }
......
...@@ -227,6 +227,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -227,6 +227,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
finishCityObjectConstruction(oco); finishCityObjectConstruction(oco);
model.addOtherCityObject(oco);
} }
@Override @Override
......
...@@ -92,7 +92,7 @@ public class CityGMLWriterUtils { ...@@ -92,7 +92,7 @@ public class CityGMLWriterUtils {
storeCityObjects(model.getTransportation(), gmlFactory, model, cModel, val); storeCityObjects(model.getTransportation(), gmlFactory, model, cModel, val);
storeCityObjects(model.getWater(), gmlFactory, model, cModel, val); storeCityObjects(model.getWater(), gmlFactory, model, cModel, val);
storeCityObjects(model.getCityFurniture(), gmlFactory, model, cModel, val); storeCityObjects(model.getCityFurniture(), gmlFactory, model, cModel, val);
storeCityObjects(model.getGenericCityObjects(), gmlFactory, model, cModel, val); storeCityObjects(model.getOtherCityObjects(), gmlFactory, model, cModel, val);
storeCityObjects(model.getTunnels(), gmlFactory, model, cModel, val); storeCityObjects(model.getTunnels(), gmlFactory, model, cModel, val);
writer.write(cModel); writer.write(cModel);
......
...@@ -325,11 +325,11 @@ public class CityDoctorModelTest { ...@@ -325,11 +325,11 @@ public class CityDoctorModelTest {
} }
@Test @Test
public void testAddGenericCityObject() { public void testAddOtherCityObject() {
GenericCityObject gen = Mockito.mock(GenericCityObject.class); GenericCityObject gen = Mockito.mock(GenericCityObject.class);
Mockito.when(gen.getGmlId()).thenReturn(new GmlId("g")); Mockito.when(gen.getGmlId()).thenReturn(new GmlId("g"));
model.addGenericCityObject(gen); model.addOtherCityObject(gen);
assertEquals(gen, model.getGenericCityObjects().toList().get(0)); assertEquals(gen, model.getOtherCityObjects().toList().get(0));
} }
@Test @Test
...@@ -362,7 +362,7 @@ public class CityDoctorModelTest { ...@@ -362,7 +362,7 @@ public class CityDoctorModelTest {
model.addLand(land); model.addLand(land);
model.addWater(water); model.addWater(water);
model.addCityFurniture(cf); model.addCityFurniture(cf);
model.addGenericCityObject(generic); model.addOtherCityObject(generic);
assertEquals(9, model.getNumberOfFeatures()); assertEquals(9, model.getNumberOfFeatures());
...@@ -547,11 +547,11 @@ public class CityDoctorModelTest { ...@@ -547,11 +547,11 @@ public class CityDoctorModelTest {
GenericCityObject gco2 = Mockito.mock(GenericCityObject.class); GenericCityObject gco2 = Mockito.mock(GenericCityObject.class);
Mockito.when(gco2.getGmlId()).thenReturn(new GmlId("gco2")); Mockito.when(gco2.getGmlId()).thenReturn(new GmlId("gco2"));
model.addGenericCityObject(gco1); model.addOtherCityObject(gco1);
assertEquals(gco1, model.getGenericCityObjects().toList().get(0)); assertEquals(gco1, model.getOtherCityObjects().toList().get(0));
model.replaceFeature(gco1, gco2); model.replaceFeature(gco1, gco2);
assertEquals(gco2, model.getGenericCityObjects().toList().get(0)); assertEquals(gco2, model.getOtherCityObjects().toList().get(0));
assertEquals(1, model.getGenericCityObjects().toList().size()); assertEquals(1, model.getOtherCityObjects().toList().size());
} }
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
......
...@@ -67,7 +67,7 @@ public class CityDoctorController { ...@@ -67,7 +67,7 @@ public class CityDoctorController {
private AtomicInteger waterChunkNr = new AtomicInteger(0); private AtomicInteger waterChunkNr = new AtomicInteger(0);
private AtomicInteger landChunkNr = new AtomicInteger(0); private AtomicInteger landChunkNr = new AtomicInteger(0);
private AtomicInteger cityFurnitureChunkNr = new AtomicInteger(0); private AtomicInteger cityFurnitureChunkNr = new AtomicInteger(0);
private AtomicInteger genericCityObjectsChunkNr = new AtomicInteger(0); private AtomicInteger otherCityObjectsChunkNr = new AtomicInteger(0);
...@@ -164,7 +164,7 @@ public class CityDoctorController { ...@@ -164,7 +164,7 @@ public class CityDoctorController {
mainWindow.setDisableOfFeatureTab(FeatureType.WATER, model.getWaterCount() == 0); mainWindow.setDisableOfFeatureTab(FeatureType.WATER, model.getWaterCount() == 0);
mainWindow.setDisableOfFeatureTab(FeatureType.LAND, model.getLandCount() == 0); mainWindow.setDisableOfFeatureTab(FeatureType.LAND, model.getLandCount() == 0);
mainWindow.setDisableOfFeatureTab(FeatureType.CITY_FURNITURE, model.getCityFurnitureCount() == 0); mainWindow.setDisableOfFeatureTab(FeatureType.CITY_FURNITURE, model.getCityFurnitureCount() == 0);
mainWindow.setDisableOfFeatureTab(FeatureType.GENERIC_CITY_OBJECT, model.getGenericCityObjectCount() == 0); mainWindow.setDisableOfFeatureTab(FeatureType.OTHER_CITY_OBJECT, model.getOtherCityObjectsCount() == 0);
} }
public void buildTrees() { public void buildTrees() {
...@@ -190,7 +190,7 @@ public class CityDoctorController { ...@@ -190,7 +190,7 @@ public class CityDoctorController {
waterChunkNr.set(0); waterChunkNr.set(0);
landChunkNr.set(0); landChunkNr.set(0);
cityFurnitureChunkNr.set(0); cityFurnitureChunkNr.set(0);
genericCityObjectsChunkNr.set(0); otherCityObjectsChunkNr.set(0);
} }
private void buildLand(CityDoctorModel model) { private void buildLand(CityDoctorModel model) {
...@@ -235,18 +235,18 @@ public class CityDoctorController { ...@@ -235,18 +235,18 @@ public class CityDoctorController {
} }
private void buildGenericCityObjects(CityDoctorModel model) { private void buildGenericCityObjects(CityDoctorModel model) {
if (model.getGenericCityObjectCount() == 0) { if (model.getOtherCityObjectsCount() == 0) {
return; return;
} }
TreeView<Renderable> otherObjectsView = mainWindow.getGenericCityObjectView(); TreeView<Renderable> otherObjectsView = mainWindow.getOtherCityObjectView();
TreeItem<Renderable> otherObjectsRoot = new TreeItem<>(new CityObjectGroupNode(Collections.emptyList(), TreeItem<Renderable> otherObjectsRoot = new TreeItem<>(new CityObjectGroupNode(Collections.emptyList(),
"Generic CityObjects", Color.DARKGRAY)); "Generic CityObjects", Color.DARKGRAY));
otherObjectsRoot.setExpanded(true); otherObjectsRoot.setExpanded(true);
otherObjectsView.setRoot(otherObjectsRoot); otherObjectsView.setRoot(otherObjectsRoot);
Supplier<Stream<GenericCityObject>> supply = model::getGenericCityObjects; Supplier<Stream<CityObject>> supply = model::getOtherCityObjects;
buildGenericCityObjectTreeFromList(supply, otherObjectsView.getRoot()); buildOtherCityObjectsTreeFromList(supply, otherObjectsView.getRoot());
addMoreButtonForGenericCityObjects( otherObjectsView, otherObjectsRoot, genericCityObjectsChunkNr, supply, addMoreButtonForOtherCityObjects( otherObjectsView, otherObjectsRoot, otherCityObjectsChunkNr, supply,
model.getGenericCityObjectCount()); model.getOtherCityObjectsCount());
} }
private void buildWater(CityDoctorModel model) { private void buildWater(CityDoctorModel model) {
...@@ -528,13 +528,13 @@ public class CityDoctorController { ...@@ -528,13 +528,13 @@ public class CityDoctorController {
} }
} }
private void addMoreButtonForGenericCityObjects(TreeView<Renderable> view, TreeItem<Renderable> root, private void addMoreButtonForOtherCityObjects(TreeView<Renderable> view, TreeItem<Renderable> root,
AtomicInteger chunkCounter, Supplier<Stream<GenericCityObject>> supply, int featureCount){ AtomicInteger chunkCounter, Supplier<Stream<CityObject>> supply, int featureCount){
if ((chunkCounter.get() + 1) * MAX_FEATURES_PER_CHUNK < featureCount) { if ((chunkCounter.get() + 1) * MAX_FEATURES_PER_CHUNK < featureCount) {
AddMoreButtonRunnable run = new AddMoreButtonRunnable(featureCount, view, root, chunkCounter) { AddMoreButtonRunnable run = new AddMoreButtonRunnable(featureCount, view, root, chunkCounter) {
@Override @Override
public void buildNodeTreeCall() { public void buildNodeTreeCall() {
buildGenericCityObjectTreeFromList(supply, root); buildOtherCityObjectsTreeFromList(supply, root);
updateTree(root); updateTree(root);
} }
}; };
...@@ -590,7 +590,7 @@ public class CityDoctorController { ...@@ -590,7 +590,7 @@ public class CityDoctorController {
mainWindow.getWaterView().setRoot(null); mainWindow.getWaterView().setRoot(null);
mainWindow.getTerrainView().setRoot(null); mainWindow.getTerrainView().setRoot(null);
mainWindow.getCityFurnitureView().setRoot(null); mainWindow.getCityFurnitureView().setRoot(null);
mainWindow.getGenericCityObjectView().setRoot(null); mainWindow.getOtherCityObjectView().setRoot(null);
mainWindow.getErrorTree().getRoot().getChildren().clear(); mainWindow.getErrorTree().getRoot().getChildren().clear();
mainWindow.getAttributeView().getRoot().getChildren().clear(); mainWindow.getAttributeView().getRoot().getChildren().clear();
mainWindow.getGlobalErrorsView().getItems().clear(); mainWindow.getGlobalErrorsView().getItems().clear();
...@@ -697,8 +697,8 @@ public class CityDoctorController { ...@@ -697,8 +697,8 @@ public class CityDoctorController {
}); });
} }
private void buildGenericCityObjectTreeFromList(Supplier<Stream<GenericCityObject>> supply, TreeItem<Renderable> root) { private void buildOtherCityObjectsTreeFromList(Supplier<Stream<CityObject>> supply, TreeItem<Renderable> root) {
int genericObjectChunk = genericCityObjectsChunkNr.get(); int genericObjectChunk = otherCityObjectsChunkNr.get();
supply.get().skip((long) genericObjectChunk * MAX_FEATURES_PER_CHUNK).limit(MAX_FEATURES_PER_CHUNK).forEach(gen ->{ supply.get().skip((long) genericObjectChunk * MAX_FEATURES_PER_CHUNK).limit(MAX_FEATURES_PER_CHUNK).forEach(gen ->{
buildTopLevelCityObjectNode(gen, root); buildTopLevelCityObjectNode(gen, root);
}); });
...@@ -1105,7 +1105,7 @@ public class CityDoctorController { ...@@ -1105,7 +1105,7 @@ public class CityDoctorController {
updateTree(mainWindow.getCityFurnitureView().getRoot()); updateTree(mainWindow.getCityFurnitureView().getRoot());
updateTree(mainWindow.getTransportationView().getRoot()); updateTree(mainWindow.getTransportationView().getRoot());
updateTree(mainWindow.getWaterView().getRoot()); updateTree(mainWindow.getWaterView().getRoot());
updateTree(mainWindow.getGenericCityObjectView().getRoot()); updateTree(mainWindow.getOtherCityObjectView().getRoot());
updateTree(mainWindow.getTunnelView().getRoot()); updateTree(mainWindow.getTunnelView().getRoot());
renderer.updateErrors(); renderer.updateErrors();
} }
...@@ -1228,7 +1228,7 @@ public class CityDoctorController { ...@@ -1228,7 +1228,7 @@ public class CityDoctorController {
case WATER -> filterWaterTree(searchString); case WATER -> filterWaterTree(searchString);
case LAND -> filterLandTree(searchString); case LAND -> filterLandTree(searchString);
case CITY_FURNITURE -> filterCityFurnitureTree(searchString); case CITY_FURNITURE -> filterCityFurnitureTree(searchString);
case GENERIC_CITY_OBJECT -> filterGenericCityObjectTree(searchString); case OTHER_CITY_OBJECT -> filterOtherCityObjectsTree(searchString);
} }
...@@ -1325,15 +1325,15 @@ public class CityDoctorController { ...@@ -1325,15 +1325,15 @@ public class CityDoctorController {
addMoreButtonForCityFurniture(cityFurnitureView, root, cityFurnitureChunkNr, foundCityFurniture, featureCount); addMoreButtonForCityFurniture(cityFurnitureView, root, cityFurnitureChunkNr, foundCityFurniture, featureCount);
} }
private void filterGenericCityObjectTree(String searchString) { private void filterOtherCityObjectsTree(String searchString) {
Supplier<Stream<GenericCityObject>> foundGenericCityObject = () -> model.getGenericCityObjects(). Supplier<Stream<CityObject>> foundGenericCityObject = () -> model.getOtherCityObjects().
filter(co ->featureFilter(co, searchString)); filter(co ->featureFilter(co, searchString));
int featureCount = (int) foundGenericCityObject.get().count(); int featureCount = (int) foundGenericCityObject.get().count();
TreeView<Renderable> genericCityObjectView = mainWindow.getGenericCityObjectView(); TreeView<Renderable> genericCityObjectView = mainWindow.getOtherCityObjectView();
TreeItem<Renderable> root = genericCityObjectView.getRoot(); TreeItem<Renderable> root = genericCityObjectView.getRoot();
root.getChildren().clear(); root.getChildren().clear();
buildGenericCityObjectTreeFromList(foundGenericCityObject, root); buildOtherCityObjectsTreeFromList(foundGenericCityObject, root);
addMoreButtonForGenericCityObjects(genericCityObjectView, root, genericCityObjectsChunkNr, addMoreButtonForOtherCityObjects(genericCityObjectView, root, otherCityObjectsChunkNr,
foundGenericCityObject, featureCount); foundGenericCityObject, featureCount);
} }
...@@ -1484,8 +1484,8 @@ public class CityDoctorController { ...@@ -1484,8 +1484,8 @@ public class CityDoctorController {
addMoreButtonForCityFurniture(cityFurnitureView, root, cityFurnitureChunkNr, supply, foundCityFurniture.size()); addMoreButtonForCityFurniture(cityFurnitureView, root, cityFurnitureChunkNr, supply, foundCityFurniture.size());
} }
public void fillTreeViewWithErrorGenericCityObjects() { public void fillTreeViewWithErrorOtherCityObjects() {
TreeView<Renderable> genericCityObjectsView = mainWindow.getGenericCityObjectView(); TreeView<Renderable> genericCityObjectsView = mainWindow.getOtherCityObjectView();
TreeItem<Renderable> root = genericCityObjectsView.getRoot(); TreeItem<Renderable> root = genericCityObjectsView.getRoot();
if (model == null) { if (model == null) {
return; return;
...@@ -1496,14 +1496,14 @@ public class CityDoctorController { ...@@ -1496,14 +1496,14 @@ public class CityDoctorController {
mainWindow.resetSearchBar(); mainWindow.resetSearchBar();
root.getChildren().clear(); root.getChildren().clear();
resetFeatureChunks(); resetFeatureChunks();
List<GmlId> foundGenericCityObjects = model.getCache().getErrorFeatureIds(); List<GmlId> foundOtherCityObjects = model.getCache().getErrorFeatureIds();
List<GmlId> idList = model.getGenericCityObjectIds(); List<GmlId> idList = model.getOtherCityObjectsIds();
foundGenericCityObjects.removeIf(gmlId -> (!idList.contains(gmlId))); foundOtherCityObjects.removeIf(gmlId -> (!idList.contains(gmlId)));
Supplier<Stream<GenericCityObject>> supply = () -> model.getCache().getStream(foundGenericCityObjects).map(co -> (GenericCityObject) co); Supplier<Stream<CityObject>> supply = () -> model.getCache().getStream(foundOtherCityObjects).map(co -> (GenericCityObject) co);
buildGenericCityObjectTreeFromList(supply, root); buildOtherCityObjectsTreeFromList(supply, root);
updateTree(root); updateTree(root);
addMoreButtonForGenericCityObjects(genericCityObjectsView, root, genericCityObjectsChunkNr, supply, foundGenericCityObjects.size()); addMoreButtonForOtherCityObjects(genericCityObjectsView, root, otherCityObjectsChunkNr, supply, foundOtherCityObjects.size());
} }
public void fillTreeViewWithErrorTransportation() { public void fillTreeViewWithErrorTransportation() {
...@@ -1647,7 +1647,7 @@ public class CityDoctorController { ...@@ -1647,7 +1647,7 @@ public class CityDoctorController {
fillTreeViewWithErrorTunnel(); fillTreeViewWithErrorTunnel();
fillTreeViewWithErrorWater(); fillTreeViewWithErrorWater();
fillTreeViewWithErrorCityFurniture(); fillTreeViewWithErrorCityFurniture();
fillTreeViewWithErrorGenericCityObjects(); fillTreeViewWithErrorOtherCityObjects();
} else { } else {
throw new IllegalStateException("Unknown filter index selected: " + newV); throw new IllegalStateException("Unknown filter index selected: " + newV);
} }
......
...@@ -639,7 +639,7 @@ public class MainWindow extends Application { ...@@ -639,7 +639,7 @@ public class MainWindow extends Application {
selectedTab = FeatureType.CITY_FURNITURE; selectedTab = FeatureType.CITY_FURNITURE;
break; break;
case 8: case 8:
selectedTab = FeatureType.GENERIC_CITY_OBJECT; selectedTab = FeatureType.OTHER_CITY_OBJECT;
break; break;
default: default:
throw new IllegalStateException("Unknown tab index: " + index); throw new IllegalStateException("Unknown tab index: " + index);
...@@ -673,7 +673,7 @@ public class MainWindow extends Application { ...@@ -673,7 +673,7 @@ public class MainWindow extends Application {
case CITY_FURNITURE: case CITY_FURNITURE:
cityFurnitureTab.setDisable(value); cityFurnitureTab.setDisable(value);
break; break;
case GENERIC_CITY_OBJECT: case OTHER_CITY_OBJECT:
otherObjectsTab.setDisable(value); otherObjectsTab.setDisable(value);
break; break;
default: default:
...@@ -1015,7 +1015,7 @@ public class MainWindow extends Application { ...@@ -1015,7 +1015,7 @@ public class MainWindow extends Application {
return attributeView; return attributeView;
} }
public TreeView<Renderable> getGenericCityObjectView() { public TreeView<Renderable> getOtherCityObjectView() {
return otherObjectsView; return otherObjectsView;
} }
...@@ -1161,7 +1161,7 @@ public class MainWindow extends Application { ...@@ -1161,7 +1161,7 @@ public class MainWindow extends Application {
case WATER -> new Pair<>(waterTab, waterView); case WATER -> new Pair<>(waterTab, waterView);
case LAND -> new Pair<>(terrainTab, terrainView); case LAND -> new Pair<>(terrainTab, terrainView);
case CITY_FURNITURE -> new Pair<>(cityFurnitureTab, cityFurnitureView); case CITY_FURNITURE -> new Pair<>(cityFurnitureTab, cityFurnitureView);
case GENERIC_CITY_OBJECT -> new Pair<>(otherObjectsTab, otherObjectsView); case OTHER_CITY_OBJECT -> new Pair<>(otherObjectsTab, otherObjectsView);
default -> throw new IllegalArgumentException("unknown feature type: " + coType); default -> throw new IllegalArgumentException("unknown feature type: " + coType);
}; };
} }
......
...@@ -92,7 +92,7 @@ public class TriangulatedGeometry { ...@@ -92,7 +92,7 @@ public class TriangulatedGeometry {
addPolygonDataFromCityObjects(model.getVegetation(), triGeom, Color.LIGHTGREEN, filters); addPolygonDataFromCityObjects(model.getVegetation(), triGeom, Color.LIGHTGREEN, filters);
addPolygonDataFromCityObjects(model.getWater(), triGeom, Color.LIGHTSKYBLUE, filters); addPolygonDataFromCityObjects(model.getWater(), triGeom, Color.LIGHTSKYBLUE, filters);
addPolygonDataFromCityObjects(model.getCityFurniture(), triGeom, Color.BLUEVIOLET, filters); addPolygonDataFromCityObjects(model.getCityFurniture(), triGeom, Color.BLUEVIOLET, filters);
addPolygonDataFromCityObjects(model.getGenericCityObjects(), triGeom, Color.BLACK, filters); addPolygonDataFromCityObjects(model.getOtherCityObjects(), triGeom, Color.BLACK, filters);
return triGeom; return triGeom;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment