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 class
This behaves the same as theLineSimplifier
except that it assumes the first and last point are the same point.static class
Simplifies a Line geometry to the specified maximum number of points.static interface
Implementation of this interface will receive calls with internal data at each step of the simplification algorithm.static interface
Override this method to use alternative objects within the algorithm.static class
Each 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 interface
Override this method to use alternative objects within the algorithm.static class
As with theLinearRingSimplifier
, this works similarly to theLineSimplifier
except that it assumes the and requires that first and last point are the same point. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SimplificationErrorCalculator
protected String
protected StreamingGeometrySimplifier.PointError
protected int
protected final int
protected final StreamingGeometrySimplifier.Monitor
protected int
protected final StreamingGeometrySimplifier.PointError[]
protected final PriorityQueue
<StreamingGeometrySimplifier.PointError> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StreamingGeometrySimplifier
(String description, int maxPoints, SimplificationErrorCalculator calculator, StreamingGeometrySimplifier.Monitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
consume
(double x, double y) Consume a single point on the stream of points to be simplified.void
consume
(StreamingGeometrySimplifier.PointError pointError) Consume a single point on the stream of points to be simplified.protected void
protected void
abstract T
produce()
Produce the simplified geometry from the consumed pointsvoid
reset()
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 + 1
objects. -
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()
-