Search in sources :

Example 11 with TriangulatedIrregularNetwork

use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.

the class TriangulatedIrregularNetworkLayerRenderer method render.

@Override
public void render(final Viewport2D viewport, final Cancellable cancellable, final TriangulatedIrregularNetworkLayer layer) {
    final double scaleForVisible = viewport.getScaleForVisible();
    if (layer.isVisible(scaleForVisible)) {
        if (!layer.isEditable()) {
            final TriangulatedIrregularNetwork tin = layer.getTin();
            if (tin != null) {
                try (BaseCloseable transformCloseable = viewport.setUseModelCoordinates(true)) {
                    for (final Triangle triangle : cancellable.cancellable(tin.getTriangles(viewport.getBoundingBox()))) {
                        final Geometry convertedTriangle = tin.convertGeometry(triangle);
                        viewport.drawGeometry(convertedTriangle, this.style);
                    }
                }
            }
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) TriangulatedIrregularNetwork(com.revolsys.elevation.tin.TriangulatedIrregularNetwork) BaseCloseable(com.revolsys.io.BaseCloseable) Triangle(com.revolsys.geometry.model.Triangle)

Aggregations

TriangulatedIrregularNetwork (com.revolsys.elevation.tin.TriangulatedIrregularNetwork)11 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)5 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)4 LasPointCloud (com.revolsys.elevation.cloud.las.LasPointCloud)2 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 Point (com.revolsys.geometry.model.Point)2 Triangle (com.revolsys.geometry.model.Triangle)2 PathResource (com.revolsys.spring.resource.PathResource)2 WebColors (com.revolsys.awt.WebColors)1 PointCloud (com.revolsys.elevation.cloud.PointCloud)1 IntArrayScaleGriddedElevationModel (com.revolsys.elevation.gridded.IntArrayScaleGriddedElevationModel)1 Geometry (com.revolsys.geometry.model.Geometry)1 Circle (com.revolsys.geometry.model.impl.Circle)1 BaseCloseable (com.revolsys.io.BaseCloseable)1 Resource (com.revolsys.spring.resource.Resource)1 BasicStroke (java.awt.BasicStroke)1 BorderLayout (java.awt.BorderLayout)1 Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1 AffineTransform (java.awt.geom.AffineTransform)1