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 {
public enum MisalignmentType{
BENT, SHEARED, HANGING, UNKNOWN
BENT, SHEARED, UNKNOWN
}
public MisalignedConnectionError(Geometry subjectGeom, CityObject subject, GmlId candidateGmlId,
......
......@@ -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.UnknownCheckError;
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.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.utils.PolygonIntersection;
import javafx.scene.paint.Color;
import java.util.function.Function;
public class ListErrorVisitor implements ErrorVisitor {
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.cityObjectResolver = cityObjectResolver;
}
@Override
......@@ -316,6 +322,11 @@ public class ListErrorVisitor implements ErrorVisitor {
@Override
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 {
this.mainWindow = mainWindow;
this.highlightController = highlightController;
loadingDialog = new LoadingInfoDialog(mainWindow.getMainStage());
errVisitor = new ListErrorVisitor(highlightController);
errVisitor = new ListErrorVisitor(highlightController, mainWindow::retrieveCityObject);
}
private boolean triangleVisible(TriangleMeta m) {
......@@ -449,7 +449,11 @@ public class Renderer {
public void addCandidateSkeletonHighlight(GmlId candidateId){
// TODO: Rework to opengl
highlightController.addObjectSkeletonHighlight(mainWindow.retrieveCityObject(candidateId));
try {
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) {
......
......@@ -74,8 +74,8 @@ public class HealerController {
this.nextHighlights = new HighlightController(healerView.getNextViewport());
currentHighlights.setCenterSupplier(() -> currentScene == null ? new double[3] : currentScene.center());
nextHighlights.setCenterSupplier(() -> nextScene == null ? new double[3] : nextScene.center());
currentErrorVisitor = new ListErrorVisitor(currentHighlights);
nextErrorVisitor = new ListErrorVisitor(nextHighlights);
currentErrorVisitor = new ListErrorVisitor(currentHighlights, id -> model.getCityObject(id));
nextErrorVisitor = new ListErrorVisitor(nextHighlights, id -> model.getCityObject(id));
}
/** 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