Package com.google.common.geometry
Interface S2LaxPolylineShape
-
- All Superinterfaces:
S2Shape
,S2ShapeAspect.ChainAspect
,S2ShapeAspect.EdgeAspect
,S2ShapeAspect.EdgeAspect.Open
,S2ShapeAspect.Mixed
,S2ShapeAspect.TopoAspect
,S2ShapeAspect.VertexAspect
- All Known Implementing Classes:
S2LaxPolylineShape.MultiArray
,S2LaxPolylineShape.MultiPacked
,S2LaxPolylineShape.MultiSnapped
,S2LaxPolylineShape.SimpleArray
,S2LaxPolylineShape.SimpleList
,S2LaxPolylineShape.SimplePacked
,S2LaxPolylineShape.SimpleSnapped
@GwtIncompatible("S2ShapeAspect incompatible") public interface S2LaxPolylineShape extends S2ShapeAspect.EdgeAspect.Open
S2LaxPolylineShape represents a polyline. It is similar toS2Polyline
except that duplicate vertices are allowed, and the representation is slightly more compact since this class does not implementS2Region
.Polylines may have any number of vertices, but note that polylines with fewer than 2 vertices do not define any edges. To create a polyline consisting of a single degenerate edge, repeat the same vertex twice.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
S2LaxPolylineShape.Coder
An encoder/decoder ofS2LaxPolylineShape
s.static class
S2LaxPolylineShape.MultiArray
A multi polyline storing references to previously allocated S2Point instances.static class
S2LaxPolylineShape.MultiPacked
A multi polyline storing xyz coordinates in a single packed 'double' array.static class
S2LaxPolylineShape.MultiSnapped
A multi polyline storing cell IDs in a single 'long' array.static class
S2LaxPolylineShape.SimpleArray
A polyline storing references to previously allocated S2Point instances.static class
S2LaxPolylineShape.SimpleList
A polyline storingS2Point
s in aList
.static class
S2LaxPolylineShape.SimplePacked
A polyline storing xyz coordinates in a single packed 'double' array.static class
S2LaxPolylineShape.SimpleSnapped
A polyline storing cell IDs in a single 'long' array.-
Nested classes/interfaces inherited from interface com.google.common.geometry.S2Shape
S2Shape.MutableEdge, S2Shape.ReferencePoint
-
Nested classes/interfaces inherited from interface com.google.common.geometry.S2ShapeAspect.ChainAspect
S2ShapeAspect.ChainAspect.Multi, S2ShapeAspect.ChainAspect.Simple
-
Nested classes/interfaces inherited from interface com.google.common.geometry.S2ShapeAspect.EdgeAspect
S2ShapeAspect.EdgeAspect.Closed, S2ShapeAspect.EdgeAspect.Open
-
-
Field Summary
Fields Modifier and Type Field Description static S2LaxPolylineShape
EMPTY
A polyline with no edges.
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
containsOrigin()
Returns true if this shape containsS2.origin()
.static S2LaxPolylineShape
create(S2Polyline line)
Creates a lax polyline from theline
by copying its data.static S2LaxPolylineShape
create(java.lang.Iterable<S2Point> vertices)
Creates a new lax polyline from the given vertices.static S2LaxPolylineShape
createMulti(java.lang.Iterable<? extends java.lang.Iterable<S2Point>> lines)
Creates a new lax multipolyline with the given lines.static S2LaxPolylineShape
createMultiPacked(java.lang.Iterable<? extends java.lang.Iterable<S2Point>> lines)
Ascreate(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].static S2LaxPolylineShape
createMultiSnapped(java.lang.Iterable<? extends java.lang.Iterable<S2CellId>> lines)
Ascreate(com.google.common.geometry.S2Polyline)
, but with vertices at the center of cell IDs, packed into a long[].static S2LaxPolylineShape
createPacked(java.lang.Iterable<S2Point> vertices)
Ascreate(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].static S2LaxPolylineShape
createSnapped(java.lang.Iterable<S2CellId> vertices)
Ascreate(com.google.common.geometry.S2Polyline)
, but with vertices at the center of cell IDs, packed into a long[].default int
dimension()
Returns the dimension of the geometry represented by this shape.static <T> java.lang.Iterable<T>
filterLine(java.lang.Iterable<T> input)
Returns 'input' or an empty iterable if 'input' has only one vertex.static <T> java.lang.Iterable<? extends java.lang.Iterable<T>>
filterLines(java.lang.Iterable<? extends java.lang.Iterable<T>> input)
default boolean
hasInterior()
Returns true if this shape has an interior, i.e.default boolean
isEmpty()
Returns true unless there is at least one edge in this line.default boolean
isFull()
Returns false in all cases since a polyline may never cover the entire sphere.default int
numEdges()
Returns the number of edges in this shape.default java.lang.Object
readResolve()
Canonicalize exactly empty polylines to EMPTY.-
Methods inherited from interface com.google.common.geometry.S2Shape
chain, chains, getChainLength, getChainStart, getReferencePoint, numChains
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.ChainAspect
chainId, edgeId, getChainLength, getChainStart, numChains
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.EdgeAspect.Open
adjustChains, getChainEdge, getChainVertex, getEdge, vertexId
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.VertexAspect
numVertices, vertex, vertices
-
-
-
-
Field Detail
-
EMPTY
static final S2LaxPolylineShape EMPTY
A polyline with no edges.
-
-
Method Detail
-
create
static S2LaxPolylineShape create(S2Polyline line)
Creates a lax polyline from theline
by copying its data.
-
create
static S2LaxPolylineShape create(java.lang.Iterable<S2Point> vertices)
Creates a new lax polyline from the given vertices.
-
createPacked
static S2LaxPolylineShape createPacked(java.lang.Iterable<S2Point> vertices)
Ascreate(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].
-
createSnapped
static S2LaxPolylineShape createSnapped(java.lang.Iterable<S2CellId> vertices)
Ascreate(com.google.common.geometry.S2Polyline)
, but with vertices at the center of cell IDs, packed into a long[].
-
createMulti
static S2LaxPolylineShape createMulti(java.lang.Iterable<? extends java.lang.Iterable<S2Point>> lines)
Creates a new lax multipolyline with the given lines.
-
createMultiPacked
static S2LaxPolylineShape createMultiPacked(java.lang.Iterable<? extends java.lang.Iterable<S2Point>> lines)
Ascreate(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].
-
createMultiSnapped
static S2LaxPolylineShape createMultiSnapped(java.lang.Iterable<? extends java.lang.Iterable<S2CellId>> lines)
Ascreate(com.google.common.geometry.S2Polyline)
, but with vertices at the center of cell IDs, packed into a long[].
-
filterLine
static <T> java.lang.Iterable<T> filterLine(java.lang.Iterable<T> input)
Returns 'input' or an empty iterable if 'input' has only one vertex.
-
filterLines
static <T> java.lang.Iterable<? extends java.lang.Iterable<T>> filterLines(java.lang.Iterable<? extends java.lang.Iterable<T>> input)
-
readResolve
default java.lang.Object readResolve()
Canonicalize exactly empty polylines to EMPTY.
-
dimension
default int dimension()
Description copied from interface:S2Shape
Returns the dimension of the geometry represented by this shape.- 0 - Point geometry. Each point is represented as a degenerate edge.
- 1 - Polyline geometry. Polyline edges may be degenerate. A shape may represent any number of polylines. Polylines edges may intersect.
- 2 - Polygon geometry. Edges should be oriented such that the polygon interior is always on the left. In theory the edges may be returned in any order, but typically the edges are organized as a collection of edge chains where each chain represents one polygon loop. Polygons may have degeneracies, e.g., degenerate edges or sibling pairs consisting of an edge and its corresponding reversed edge. A polygon loop may also be full (containing all points on the sphere); by convention this is represented as a chain with no edges.
Note that this method allows degenerate geometry of different dimensions to be distinguished, e.g., it allows a point to be distinguished from a polyline or polygon that has been simplified to a single point.
- Specified by:
dimension
in interfaceS2Shape
- Specified by:
dimension
in interfaceS2ShapeAspect.TopoAspect
-
hasInterior
default boolean hasInterior()
Description copied from interface:S2Shape
Returns true if this shape has an interior, i.e. the shape consists of one or more closed non-intersecting loops.- Specified by:
hasInterior
in interfaceS2Shape
- Specified by:
hasInterior
in interfaceS2ShapeAspect.TopoAspect
-
containsOrigin
default boolean containsOrigin()
Description copied from interface:S2Shape
Returns true if this shape containsS2.origin()
. Should return false for shapes that do not have an interior.- Specified by:
containsOrigin
in interfaceS2Shape
- Specified by:
containsOrigin
in interfaceS2ShapeAspect.TopoAspect
-
numEdges
default int numEdges()
Description copied from interface:S2Shape
Returns the number of edges in this shape.- Specified by:
numEdges
in interfaceS2Shape
- Specified by:
numEdges
in interfaceS2ShapeAspect.EdgeAspect
- Specified by:
numEdges
in interfaceS2ShapeAspect.EdgeAspect.Open
-
isEmpty
default boolean isEmpty()
Returns true unless there is at least one edge in this line.
-
isFull
default boolean isFull()
Returns false in all cases since a polyline may never cover the entire sphere.
-
-