Search in sources :

Example 16 with Triangle

use of com.revolsys.geometry.model.Triangle 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

Triangle (com.revolsys.geometry.model.Triangle)16 Point (com.revolsys.geometry.model.Point)6 BoundingBox (com.revolsys.geometry.model.BoundingBox)5 AbstractTriangle (com.revolsys.geometry.model.impl.AbstractTriangle)5 ArrayList (java.util.ArrayList)5 Geometry (com.revolsys.geometry.model.Geometry)4 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)3 PointDoubleXYZ (com.revolsys.geometry.model.impl.PointDoubleXYZ)3 TriangleDoubleXYZ (com.revolsys.geometry.model.impl.TriangleDoubleXYZ)3 LineSegment (com.revolsys.geometry.model.segment.LineSegment)3 LineSegmentDoubleGF (com.revolsys.geometry.model.segment.LineSegmentDoubleGF)3 List (java.util.List)3 Lists (com.revolsys.collection.list.Lists)2 MapEx (com.revolsys.collection.map.MapEx)2 TriangulatedIrregularNetwork (com.revolsys.elevation.tin.TriangulatedIrregularNetwork)2 ScaledIntegerTriangulatedIrregularNetwork (com.revolsys.elevation.tin.compactbinary.ScaledIntegerTriangulatedIrregularNetwork)2 AsciiTin (com.revolsys.elevation.tin.tin.AsciiTin)2 GeometryFactoryProxy (com.revolsys.geometry.model.GeometryFactoryProxy)2 LineString (com.revolsys.geometry.model.LineString)2 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)2