Commit 49846d26 authored by Riegel's avatar Riegel
Browse files

Fixed Bridge rendering

Showing with 83 additions and 13 deletions
+83 -13
...@@ -805,7 +805,35 @@ public class Renderer { ...@@ -805,7 +805,35 @@ public class Renderer {
} }
public void renderBridges(List<BridgeObject> bridges) { public void renderBridges(List<BridgeObject> bridges) {
renderCityObjects(bridges, Color.CORAL); errorUpdater = null;
refresher = () -> {
Platform.runLater(() -> {
loadingDialog.show();
clearGeometryTrees();
});
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();
} }
public void renderWater(List<WaterObject> water) { public void renderWater(List<WaterObject> water) {
...@@ -961,6 +989,38 @@ public class Renderer { ...@@ -961,6 +989,38 @@ public class Renderer {
} }
} }
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) { public void collectTunnelPolygons(Set<ConcretePolygon> polygons, AbstractTunnel at) {
} }
......
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import java.util.ArrayList; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.hft.stuttgart.citydoctor2.datastructure.*; import de.hft.stuttgart.citydoctor2.datastructure.*;
import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter; import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter;
import de.hft.stuttgart.citydoctor2.math.Triangle3d; import de.hft.stuttgart.citydoctor2.math.Triangle3d;
...@@ -14,11 +9,9 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d; ...@@ -14,11 +9,9 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d;
import de.hft.stuttgart.citydoctor2.tesselation.TesselatedPolygon; import de.hft.stuttgart.citydoctor2.tesselation.TesselatedPolygon;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial; import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.CullFace; import javafx.scene.shape.*;
import javafx.scene.shape.DrawMode;
import javafx.scene.shape.MeshView; import java.util.*;
import javafx.scene.shape.TriangleMesh;
import javafx.scene.shape.VertexFormat;
public class TriangulatedGeometry { public class TriangulatedGeometry {
...@@ -98,7 +91,7 @@ public class TriangulatedGeometry { ...@@ -98,7 +91,7 @@ public class TriangulatedGeometry {
triGeom.movedBy = triGeom.findCenter(points); triGeom.movedBy = triGeom.findCenter(points);
addPolygonDataFromBuildings(model.getBuildings(), triGeom, filters); addPolygonDataFromBuildings(model.getBuildings(), triGeom, filters);
addPolygonDataFromCityObjects(model.getBridges(), triGeom, Color.CORAL, filters); addPolygonDataFromBridges(model.getBridges(), triGeom, filters);
addPolygonDataFromCityObjects(model.getLand(), triGeom, Color.BROWN, filters); addPolygonDataFromCityObjects(model.getLand(), triGeom, Color.BROWN, filters);
addPolygonDataFromCityObjects(model.getTransportation(), triGeom, Color.YELLOW, filters); addPolygonDataFromCityObjects(model.getTransportation(), triGeom, Color.YELLOW, filters);
addPolygonDataFromCityObjects(model.getVegetation(), triGeom, Color.LIGHTGREEN, filters); addPolygonDataFromCityObjects(model.getVegetation(), triGeom, Color.LIGHTGREEN, filters);
...@@ -125,6 +118,23 @@ public class TriangulatedGeometry { ...@@ -125,6 +118,23 @@ public class TriangulatedGeometry {
} }
} }
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 addPolygonDataFromBoundarySurfaces(List<BoundarySurface> boundarySurfaces, private static void addPolygonDataFromBoundarySurfaces(List<BoundarySurface> boundarySurfaces,
TriangulatedGeometry triGeom, List<ViewFilter> filters) { TriangulatedGeometry triGeom, List<ViewFilter> filters) {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
......
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