Commit 71ea5ff7 authored by Luna Riegel's avatar Luna Riegel
Browse files

Fix: Runtime error if feature retrieval failed

parent afed92ec
Pipeline #12481 failed with stage
in 1 minute and 44 seconds
...@@ -24,7 +24,7 @@ public class MisalignedConnectionError implements CheckError { ...@@ -24,7 +24,7 @@ public class MisalignedConnectionError implements CheckError {
public enum MisalignmentType{ public enum MisalignmentType{
BENT, SHEARED, HANGING, UNKNOWN BENT, SHEARED, UNKNOWN
} }
public MisalignedConnectionError(Geometry subjectGeom, CityObject subject, GmlId candidateGmlId, public MisalignedConnectionError(Geometry subjectGeom, CityObject subject, GmlId candidateGmlId,
......
...@@ -49,18 +49,24 @@ import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError; ...@@ -49,18 +49,24 @@ import de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError;
import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError; import de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError;
import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError; import de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError;
import de.hft.stuttgart.citydoctor2.check.error.XMLValidationError; import de.hft.stuttgart.citydoctor2.check.error.XMLValidationError;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Edge; import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex; import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.utils.PolygonIntersection; import de.hft.stuttgart.citydoctor2.utils.PolygonIntersection;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import java.util.function.Function;
public class ListErrorVisitor implements ErrorVisitor { public class ListErrorVisitor implements ErrorVisitor {
private HighlightController controller; private HighlightController controller;
private final Function<GmlId, CityObject> cityObjectResolver;
public ListErrorVisitor(HighlightController controller) { public ListErrorVisitor(HighlightController controller, Function<GmlId, CityObject> cityObjectResolver) {
this.controller = controller; this.controller = controller;
this.cityObjectResolver = cityObjectResolver;
} }
@Override @Override
...@@ -316,6 +322,11 @@ public class ListErrorVisitor implements ErrorVisitor { ...@@ -316,6 +322,11 @@ public class ListErrorVisitor implements ErrorVisitor {
@Override @Override
public void visit(MisalignedConnectionError err){ public void visit(MisalignedConnectionError err){
//TODO: Implement highlighting controller.highlight(err.getSubjectGeom());
try {
controller.addObjectSkeletonHighlight(cityObjectResolver.apply(err.getCandidateGmlId()));
} catch (RuntimeException e) {
// candidate feature could not be resolved (e.g. not loaded in this session)
}
} }
} }
...@@ -53,7 +53,7 @@ public class Renderer { ...@@ -53,7 +53,7 @@ public class Renderer {
this.mainWindow = mainWindow; this.mainWindow = mainWindow;
this.highlightController = highlightController; this.highlightController = highlightController;
loadingDialog = new LoadingInfoDialog(mainWindow.getMainStage()); loadingDialog = new LoadingInfoDialog(mainWindow.getMainStage());
errVisitor = new ListErrorVisitor(highlightController); errVisitor = new ListErrorVisitor(highlightController, mainWindow::retrieveCityObject);
} }
private boolean triangleVisible(TriangleMeta m) { private boolean triangleVisible(TriangleMeta m) {
...@@ -449,7 +449,11 @@ public class Renderer { ...@@ -449,7 +449,11 @@ public class Renderer {
public void addCandidateSkeletonHighlight(GmlId candidateId){ public void addCandidateSkeletonHighlight(GmlId candidateId){
// TODO: Rework to opengl // TODO: Rework to opengl
try {
highlightController.addObjectSkeletonHighlight(mainWindow.retrieveCityObject(candidateId)); highlightController.addObjectSkeletonHighlight(mainWindow.retrieveCityObject(candidateId));
} catch (RuntimeException e) {
// candidate feature could not be resolved (e.g. not loaded in this session)
}
} }
public void highlight(Polygon p) { public void highlight(Polygon p) {
......
...@@ -74,8 +74,8 @@ public class HealerController { ...@@ -74,8 +74,8 @@ public class HealerController {
this.nextHighlights = new HighlightController(healerView.getNextViewport()); this.nextHighlights = new HighlightController(healerView.getNextViewport());
currentHighlights.setCenterSupplier(() -> currentScene == null ? new double[3] : currentScene.center()); currentHighlights.setCenterSupplier(() -> currentScene == null ? new double[3] : currentScene.center());
nextHighlights.setCenterSupplier(() -> nextScene == null ? new double[3] : nextScene.center()); nextHighlights.setCenterSupplier(() -> nextScene == null ? new double[3] : nextScene.center());
currentErrorVisitor = new ListErrorVisitor(currentHighlights); currentErrorVisitor = new ListErrorVisitor(currentHighlights, id -> model.getCityObject(id));
nextErrorVisitor = new ListErrorVisitor(nextHighlights); nextErrorVisitor = new ListErrorVisitor(nextHighlights, id -> model.getCityObject(id));
} }
/** Installs the current scene into the current viewport and applies the current view options. */ /** Installs the current scene into the current viewport and applies the current view options. */
......
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