Package com.google.common.geometry
Class S2ShapeAspect.ChainAspect.Simple
- java.lang.Object
-
- com.google.common.geometry.S2ShapeAspect.ChainAspect.Simple
-
- All Implemented Interfaces:
S2Shape
,S2ShapeAspect.ChainAspect
,S2ShapeAspect.EdgeAspect
,S2ShapeAspect.Mixed
,S2ShapeAspect.TopoAspect
,S2ShapeAspect.VertexAspect
- Direct Known Subclasses:
S2LaxPolygonShape.SimpleList
,S2LaxPolylineShape.SimpleList
,S2ShapeAspect.ChainAspect.Simple.Array
,S2ShapeAspect.ChainAspect.Simple.Packed
,S2ShapeAspect.ChainAspect.Simple.Snapped
- Enclosing interface:
- S2ShapeAspect.ChainAspect
public abstract static class S2ShapeAspect.ChainAspect.Simple extends java.lang.Object implements S2ShapeAspect.Mixed
A single non-empty chain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
S2ShapeAspect.ChainAspect.Simple.Array
A simple chain of S2Point references.(package private) static class
S2ShapeAspect.ChainAspect.Simple.Packed
A simple chain of packed coordinates.(package private) static class
S2ShapeAspect.ChainAspect.Simple.Snapped
A simple chain of packed cell centers.-
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
-
-
Constructor Summary
Constructors Constructor Description Simple()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
chainId(int edgeIndex)
Returns the chain ID of a given edge.int
edgeId(int chainId)
Returns start edge ID of a chain, or the number of edges ifchainId==numChains()
.int
getChainLength(int chainId)
Returns the number of edge ids corresponding to the edge chain for the given chain id.int
getChainStart(int chainId)
Returns the first edge id corresponding to the edge chain for the given chain id.int
numChains()
Returns the number of contiguous edge chains in the shape.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.common.geometry.S2Shape
chain, chains, containsOrigin, dimension, getChainEdge, getChainVertex, getEdge, getReferencePoint, hasInterior, numEdges
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.EdgeAspect
adjustChains, getChainEdge, getChainVertex, getEdge, numEdges, vertexId
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.TopoAspect
containsOrigin, dimension, hasInterior
-
Methods inherited from interface com.google.common.geometry.S2ShapeAspect.VertexAspect
numVertices, vertex, vertices
-
-
-
-
Method Detail
-
numChains
public int numChains()
Description copied from interface:S2Shape
Returns the number of contiguous edge chains in the shape. For example, a shape whose edges are [AB, BC, CD, AE, EF] may consist of two chains [A, B, C, D] and [A, E, F]. Every chain is assigned a chain id numbered sequentially starting from zero.An empty shape has no chains. A full shape (which contains the entire globe) has one chain with no edges. Other shapes should have at least one chain, and the sum of all valid
chain lengths
should equalS2Shape.numEdges()
(that is, edges may only be used by a single chain).Note that it is always acceptable to implement this method by returning
S2Shape.numEdges()
(i.e. every chain consists of a single edge), but this may reduce the efficiency of some algorithms.- Specified by:
numChains
in interfaceS2Shape
- Specified by:
numChains
in interfaceS2ShapeAspect.ChainAspect
-
getChainStart
public int getChainStart(int chainId)
Description copied from interface:S2Shape
Returns the first edge id corresponding to the edge chain for the given chain id. The edge chains must form contiguous, non-overlapping ranges that cover the entire range of edge ids.- Specified by:
getChainStart
in interfaceS2Shape
- Specified by:
getChainStart
in interfaceS2ShapeAspect.ChainAspect
- Parameters:
chainId
- which edge chain to return its start, from 0 toS2Shape.numChains()
- 1
-
getChainLength
public int getChainLength(int chainId)
Description copied from interface:S2Shape
Returns the number of edge ids corresponding to the edge chain for the given chain id. The edge chains must form contiguous, non-overlapping ranges that cover the entire range of edge ids.- Specified by:
getChainLength
in interfaceS2Shape
- Specified by:
getChainLength
in interfaceS2ShapeAspect.ChainAspect
- Parameters:
chainId
- which edge chain to return its length, from 0 toS2Shape.numChains()
- 1
-
edgeId
public int edgeId(int chainId)
Description copied from interface:S2ShapeAspect.ChainAspect
Returns start edge ID of a chain, or the number of edges ifchainId==numChains()
.- Specified by:
edgeId
in interfaceS2ShapeAspect.ChainAspect
-
chainId
public int chainId(int edgeIndex)
Description copied from interface:S2ShapeAspect.ChainAspect
Returns the chain ID of a given edge.- Specified by:
chainId
in interfaceS2ShapeAspect.ChainAspect
-
-