Class Label
- java.lang.Object
-
- org.locationtech.jts.geomgraph.Label
-
public class Label extends java.lang.Object
ALabel
indicates the topological relationship of a component of a topology graph to a givenGeometry
. This class supports labels for relationships to twoGeometry
s, which is sufficient for algorithms for binary operations.Topology graphs support the concept of labeling nodes and edges in the graph. The label of a node or edge specifies its topological relationship to one or more geometries. (In fact, since JTS operations have only two arguments labels are required for only two geometries). A label for a node or edge has one or two elements, depending on whether the node or edge occurs in one or both of the input
Geometry
s. Elements contain attributes which categorize the topological location of the node or edge relative to the parentGeometry
; that is, whether the node or edge is in the interior, boundary or exterior of theGeometry
. Attributes have a value from the set{Interior, Boundary, Exterior}
. In a node each element has a single attribute<On>
. For an edge each element has a triplet of attributes<Left, On, Right>
.It is up to the client code to associate the 0 and 1
TopologyLocation
s with specific geometries.- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description Label(int onLoc)
Construct a Label with a single location for both Geometries.Label(int geomIndex, int onLoc)
Construct a Label with a single location for both Geometries.Label(int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for both Geometries.Label(int geomIndex, int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for both Geometries.Label(Label lbl)
Construct a Label with the same values as the argument Label.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allPositionsEqual(int geomIndex, int loc)
void
flip()
int
getGeometryCount()
int
getLocation(int geomIndex)
int
getLocation(int geomIndex, int posIndex)
boolean
isAnyNull(int geomIndex)
boolean
isArea()
boolean
isArea(int geomIndex)
boolean
isEqualOnSide(Label lbl, int side)
boolean
isLine(int geomIndex)
boolean
isNull(int geomIndex)
void
merge(Label lbl)
Merge this label with another one.void
setAllLocations(int geomIndex, int location)
void
setAllLocationsIfNull(int location)
void
setAllLocationsIfNull(int geomIndex, int location)
void
setLocation(int geomIndex, int location)
void
setLocation(int geomIndex, int posIndex, int location)
void
toLine(int geomIndex)
Converts one GeometryLocation to a Line locationstatic Label
toLineLabel(Label label)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Label
public Label(int onLoc)
Construct a Label with a single location for both Geometries. Initialize the locations to Null- Parameters:
onLoc
- On location
-
Label
public Label(int geomIndex, int onLoc)
Construct a Label with a single location for both Geometries. Initialize the location for the Geometry index.- Parameters:
geomIndex
- Geometry indexonLoc
- On location
-
Label
public Label(int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for both Geometries. Initialize the locations for both Geometries to the given values.- Parameters:
onLoc
- On locationrightLoc
- Right locationleftLoc
- Left location
-
Label
public Label(int geomIndex, int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for both Geometries. Initialize the locations for the given Geometry index.- Parameters:
geomIndex
- Geometry indexonLoc
- On locationrightLoc
- Right locationleftLoc
- Left location
-
Label
public Label(Label lbl)
Construct a Label with the same values as the argument Label.- Parameters:
lbl
- Label
-
-
Method Detail
-
flip
public void flip()
-
getLocation
public int getLocation(int geomIndex, int posIndex)
-
getLocation
public int getLocation(int geomIndex)
-
setLocation
public void setLocation(int geomIndex, int posIndex, int location)
-
setLocation
public void setLocation(int geomIndex, int location)
-
setAllLocations
public void setAllLocations(int geomIndex, int location)
-
setAllLocationsIfNull
public void setAllLocationsIfNull(int geomIndex, int location)
-
setAllLocationsIfNull
public void setAllLocationsIfNull(int location)
-
merge
public void merge(Label lbl)
Merge this label with another one. Merging updates any null attributes of this label with the attributes from lbl.- Parameters:
lbl
- Label to merge s
-
getGeometryCount
public int getGeometryCount()
-
isNull
public boolean isNull(int geomIndex)
-
isAnyNull
public boolean isAnyNull(int geomIndex)
-
isArea
public boolean isArea()
-
isArea
public boolean isArea(int geomIndex)
-
isLine
public boolean isLine(int geomIndex)
-
isEqualOnSide
public boolean isEqualOnSide(Label lbl, int side)
-
allPositionsEqual
public boolean allPositionsEqual(int geomIndex, int loc)
-
toLine
public void toLine(int geomIndex)
Converts one GeometryLocation to a Line location- Parameters:
geomIndex
- geometry location
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-