Package com.google.common.geometry
Class S2ShapeAspect.ChainAspect.Multi
java.lang.Object
com.google.common.geometry.S2ShapeAspect.ChainAspect.Multi
- All Implemented Interfaces:
S2Shape,S2ShapeAspect.ChainAspect,S2ShapeAspect.EdgeAspect,S2ShapeAspect.Mixed,S2ShapeAspect.TopoAspect,S2ShapeAspect.VertexAspect
- Direct Known Subclasses:
S2LaxPolygonShape.MultiList,S2ShapeAspect.ChainAspect.Multi.Array,S2ShapeAspect.ChainAspect.Multi.Packed,S2ShapeAspect.ChainAspect.Multi.Snapped
- Enclosing interface:
S2ShapeAspect.ChainAspect
public abstract static class S2ShapeAspect.ChainAspect.Multi
extends Object
implements S2ShapeAspect.Mixed
A sequence of chains, represented as an array of the first 'edgeId' for each chain.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classAn array of S2Point references for multiple chains.(package private) static classPacked coordinates for multiple chains.(package private) static classSnapped cell centers for multiple chains.Nested classes/interfaces inherited from interface com.google.common.geometry.S2Shape
S2Shape.MutableEdge, S2Shape.ReferencePointNested classes/interfaces inherited from interface com.google.common.geometry.S2ShapeAspect.ChainAspect
S2ShapeAspect.ChainAspect.Multi, S2ShapeAspect.ChainAspect.SimpleNested classes/interfaces inherited from interface com.google.common.geometry.S2ShapeAspect.EdgeAspect
S2ShapeAspect.EdgeAspect.Closed, S2ShapeAspect.EdgeAspect.Open -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intchainId(int edgeId) Returns the chain ID of a given edge.final intedgeId(int chainId) Returns start edge ID of a chain, or the number of edges ifchainId==numChains().final intgetChainLength(int chainId) Returns the number of edge ids corresponding to the edge chain for the given chain id.final intgetChainStart(int chainId) Returns the first edge id corresponding to the edge chain for the given chain id.final intReturns 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, waitMethods inherited from interface com.google.common.geometry.S2Shape
chain, chains, containsOrigin, dimension, getChainEdge, getChainVertex, getEdge, getReferencePoint, hasInterior, numEdgesMethods inherited from interface com.google.common.geometry.S2ShapeAspect.EdgeAspect
adjustChains, getChainEdge, getChainVertex, getEdge, numEdges, vertexIdMethods inherited from interface com.google.common.geometry.S2ShapeAspect.TopoAspect
containsOrigin, dimension, hasInteriorMethods inherited from interface com.google.common.geometry.S2ShapeAspect.VertexAspect
numVertices, vertex, vertices
-
Field Details
-
cumulativeEdges
private final int[] cumulativeEdges
-
-
Constructor Details
-
Multi
-
Multi
Multi(int[] cumulativeEdges)
-
-
Method Details
-
numChains
public final int numChains()Description copied from interface:S2ShapeReturns 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 lengthsshould 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:
numChainsin interfaceS2Shape- Specified by:
numChainsin interfaceS2ShapeAspect.ChainAspect
-
edgeId
public final int edgeId(int chainId) Description copied from interface:S2ShapeAspect.ChainAspectReturns start edge ID of a chain, or the number of edges ifchainId==numChains().- Specified by:
edgeIdin interfaceS2ShapeAspect.ChainAspect
-
getChainStart
public final int getChainStart(int chainId) Description copied from interface:S2ShapeReturns 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:
getChainStartin interfaceS2Shape- Specified by:
getChainStartin interfaceS2ShapeAspect.ChainAspect- Parameters:
chainId- which edge chain to return its start, from 0 toS2Shape.numChains()- 1
-
getChainLength
public final int getChainLength(int chainId) Description copied from interface:S2ShapeReturns 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:
getChainLengthin interfaceS2Shape- Specified by:
getChainLengthin interfaceS2ShapeAspect.ChainAspect- Parameters:
chainId- which edge chain to return its length, from 0 toS2Shape.numChains()- 1
-
chainId
public final int chainId(int edgeId) Description copied from interface:S2ShapeAspect.ChainAspectReturns the chain ID of a given edge.- Specified by:
chainIdin interfaceS2ShapeAspect.ChainAspect
-