Search in sources :

Example 6 with TopologyException

use of com.revolsys.geometry.model.TopologyException in project com.revolsys.open by revolsys.

the class Buffer method bufferReducedPrecision.

private static Geometry bufferReducedPrecision(final Geometry geometry, final double distance, final BufferParameters parameters) {
    TopologyException saveException = null;
    // try and compute with decreasing precision
    for (int precDigits = MAX_PRECISION_DIGITS; precDigits >= 0; precDigits--) {
        try {
            final double sizeBasedScaleFactor = precisionScaleFactor(geometry, distance, precDigits);
            final GeometryFactory precisionModel = geometry.getGeometryFactory().convertScales(sizeBasedScaleFactor, sizeBasedScaleFactor);
            return bufferFixedPrecision(precisionModel, geometry, distance, parameters);
        } catch (final TopologyException e) {
            saveException = e;
        // TODO remove
        // throw e;
        }
    }
    throw saveException;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) TopologyException(com.revolsys.geometry.model.TopologyException) Point(com.revolsys.geometry.model.Point)

Example 7 with TopologyException

use of com.revolsys.geometry.model.TopologyException in project com.revolsys.open by revolsys.

the class BufferSubgraph method computeNodeDepth.

private void computeNodeDepth(final Node n) {
    // find a visited dirEdge to start at
    DirectedEdge startEdge = null;
    for (final Object element : (DirectedEdgeStar) n.getEdges()) {
        final DirectedEdge de = (DirectedEdge) element;
        if (de.isVisited() || de.getSym().isVisited()) {
            startEdge = de;
            break;
        }
    }
    // only compute string append if assertion would fail
    if (startEdge == null) {
        throw new TopologyException("unable to find edge to compute depths at POINT(" + n.getX() + " " + n.getY() + ")");
    }
    ((DirectedEdgeStar) n.getEdges()).computeDepths(startEdge);
    // copy depths to sym edges
    for (final Object element : (DirectedEdgeStar) n.getEdges()) {
        final DirectedEdge de = (DirectedEdge) element;
        de.setVisited(true);
        copySymDepths(de);
    }
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) TopologyException(com.revolsys.geometry.model.TopologyException)

Example 8 with TopologyException

use of com.revolsys.geometry.model.TopologyException in project com.revolsys.open by revolsys.

the class ScaleMultipleRenderer method renderRecords.

@Override
protected // NOTE: Needed for multiple styles
void renderRecords(final Viewport2D viewport, final Cancellable cancellable, final AbstractRecordLayer layer, final List<LayerRecord> records) {
    final BoundingBox visibleArea = viewport.getBoundingBox();
    final AbstractRecordLayerRenderer renderer = getRenderer(viewport);
    if (renderer != null) {
        for (final LayerRecord record : cancellable.cancellable(records)) {
            if (isVisible(record)) {
                try {
                    renderer.renderRecord(viewport, visibleArea, layer, record);
                } catch (final TopologyException e) {
                }
            }
        }
    }
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) TopologyException(com.revolsys.geometry.model.TopologyException)

Aggregations

TopologyException (com.revolsys.geometry.model.TopologyException)8 DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)2 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 Point (com.revolsys.geometry.model.Point)2 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 DirectedEdgeStar (com.revolsys.geometry.geomgraph.DirectedEdgeStar)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Location (com.revolsys.geometry.model.Location)1 LineStringEditor (com.revolsys.geometry.model.editor.LineStringEditor)1 LinkedHashMap (java.util.LinkedHashMap)1