public class MortonCode extends Object
Morton codes are labels for the nodes of a QuadTree. A QuadTree is a partition of a spatial extent by recursively
decomposing it into four equal quadrants. A QuadTree is determined by a spatial extent and depth of the tree (the
number of recursive subdivisions of the extent). Both are specified by the MortonContext
passed during
construction of instances of this class.
The Morton code of a Geometry
can be viewed as a path to the quadrant containing the envelope of that
Geometry
. The left-most character of the code contains the label of the quadrant at depth 1, the second at
depth 2, etc. If the Morton code is the empty string, then the envelope fits in no single quandrant of the QuadTree.
At each level the four quadrants are labeled:
Constructor and Description |
---|
MortonCode(MortonContext mortonContext)
Constructs an instance with the given
Mortoncontext
|
Modifier and Type | Method and Description |
---|---|
Envelope |
envelopeOf(String mortoncode)
Returns the extent that corresponds to the specified morton code
|
int |
getMaxLength()
Returns the maximum length of a morton code generated by this instance.
|
String |
ofEnvelope(Envelope envelope)
Returns the Morton code for the specified
Envelope . |
String |
ofGeometry(Geometry geometry)
Returns the Morton code for the specified
Geometry . |
String |
ofPoint(Point point)
Returns the Morton code for the specified
Point . |
public MortonCode(MortonContext mortonContext)
Mortoncontext
The specified MortonCode
determines a QuadTree for which
this instance calculates labels.
mortonContext
- the context to use when calculating morton codes.public String ofGeometry(Geometry geometry)
Geometry
.
This method is equivalent to ofEnvelope(geometry.getEnvelope())
.
geometry
- a {code Geometry} value.Geometry
.IllegalArgumentException
- if the geometry is null, or has an envelope which is not contained in
the spatial extent of this instance's MortonContext
public String ofEnvelope(Envelope envelope)
Envelope
.envelope
- an Envelope
value.Envelope
value.IllegalArgumentException
- if the value of the envelope parameter is null, or is not contained in
the spatial extent of this instance's MortonContext
public String ofPoint(Point point)
Point
.point
- an Point
value.Point
value.IllegalArgumentException
- if the value of the point parameter is null, or is not contained in
the spatial extent of this instance's MortonContext
public int getMaxLength()
Copyright © 2015 geolatte.org. All rights reserved.