Module org.elasticsearch.geo
Class StreamingGeometrySimplifier<T extends Geometry>
java.lang.Object
org.elasticsearch.geometry.simplify.StreamingGeometrySimplifier<T>
- Direct Known Subclasses:
StreamingGeometrySimplifier.LinearRingSimplifier,StreamingGeometrySimplifier.LineSimplifier,StreamingGeometrySimplifier.PolygonSimplifier
The streaming geometry simplifier can only simplify geometries composed on a single list of Points provided on a stream.
This includes Line, LinearRing and Polygon (with no holes). To produce such a geometry from a stream, perform the following steps:
- Construct the simplifier with the maximum number of points allowed,
or call
reset()on a previously used simplifier - Call
consume(x, y)for each incoming point on the stream - Call
produce()to generate the final simplified geometry of the desired type
consume(x, y) is called, the internal state will never contain more than
the stated maximum number of points (plus one for sorting),
and the final geometry will be that size, or smaller (if fewer points were consumed).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis behaves the same as theLineSimplifierexcept that it assumes the first and last point are the same point.static classSimplifies a Line geometry to the specified maximum number of points.static interfaceImplementation of this interface will receive calls with internal data at each step of the simplification algorithm.static interfaceOverride this method to use alternative objects within the algorithm.static classEach point on the geometry has an error estimate, which is a measure of how much error would be introduced to the geometry should this point be removed from the geometry.static interfaceOverride this method to use alternative objects within the algorithm.static classAs with theLinearRingSimplifier, this works similarly to theLineSimplifierexcept that it assumes the and requires that first and last point are the same point. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SimplificationErrorCalculatorprotected Stringprotected StreamingGeometrySimplifier.PointErrorprotected intprotected final intprotected final StreamingGeometrySimplifier.Monitorprotected intprotected final StreamingGeometrySimplifier.PointError[]protected final PriorityQueue<StreamingGeometrySimplifier.PointError> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStreamingGeometrySimplifier(String description, int maxPoints, SimplificationErrorCalculator calculator, StreamingGeometrySimplifier.Monitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume(double x, double y) Consume a single point on the stream of points to be simplified.voidconsume(StreamingGeometrySimplifier.PointError pointError) Consume a single point on the stream of points to be simplified.protected voidprotected voidabstract Tproduce()Produce the simplified geometry from the consumed pointsvoidreset()Initialize for simplifying using a stream of points.
-
Field Details
-
maxPoints
protected final int maxPoints -
calculator
-
points
-
lastRemoved
-
monitor
-
length
protected int length -
objCount
protected int objCount -
description
-
pointConstructor
-
pointResetter
-
queue
-
-
Constructor Details
-
StreamingGeometrySimplifier
protected StreamingGeometrySimplifier(String description, int maxPoints, SimplificationErrorCalculator calculator, StreamingGeometrySimplifier.Monitor monitor)
-
-
Method Details
-
reset
public void reset()Initialize for simplifying using a stream of points. To save on memory it is useful to re-use the same simplifier instance for multiple geometries. Make sure to call reset before each to mark a separation. -
consume
public void consume(double x, double y) Consume a single point on the stream of points to be simplified. The internal PointError objects will be re-used from a pool of at mostmaxPoints + 1objects. -
consume
Consume a single point on the stream of points to be simplified. No memory management of the points passed in is done, so only use this call if you manage these objects from calling code. -
produce
Produce the simplified geometry from the consumed points -
notifyMonitorPointRemoved
-
notifyMonitorPointAdded
protected void notifyMonitorPointAdded()
-