本文整理汇总了Java中com.vividsolutions.jts.geom.Location.BOUNDARY属性的典型用法代码示例。如果您正苦于以下问题:Java Location.BOUNDARY属性的具体用法?Java Location.BOUNDARY怎么用?Java Location.BOUNDARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vividsolutions.jts.geom.Location
的用法示例。
在下文中一共展示了Location.BOUNDARY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeIntersectionNodes
/**
* Insert nodes for all intersections on the edges of a Geometry.
* Label the created nodes the same as the edge label if they do not already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
*/
private void computeIntersectionNodes(int argIndex) {
for (Iterator i = this.arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
Edge e = (Edge) i.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) this.nodes.addNode(ei.coord);
if (eLoc == Location.BOUNDARY) {
n.setLabelBoundary(argIndex);
} else {
if (n.getLabel().isNull(argIndex)) {
n.setLabel(argIndex, Location.INTERIOR);
}
}
//Debug.println(n);
}
}
}
示例2: labelIntersectionNodes
/**
* For all intersections on the edges of a Geometry,
* label the corresponding node IF it doesn't already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
*/
private void labelIntersectionNodes(int argIndex) {
for (Iterator i = this.arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
Edge e = (Edge) i.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) this.nodes.find(ei.coord);
if (n.getLabel().isNull(argIndex)) {
if (eLoc == Location.BOUNDARY) {
n.setLabelBoundary(argIndex);
} else {
n.setLabel(argIndex, Location.INTERIOR);
}
}
//n.print(System.out);
}
}
}
示例3: computeIntersectionNodes
/**
* Insert nodes for all intersections on the edges of a Geometry.
* Label the created nodes the same as the edge label if they do not already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
* <p>
* Precondition: edge intersections have been computed.
*/
public void computeIntersectionNodes(GeometryGraph geomGraph, int argIndex) {
for (Iterator edgeIt = geomGraph.getEdgeIterator(); edgeIt.hasNext(); ) {
Edge e = (Edge) edgeIt.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) this.nodes.addNode(ei.coord);
if (eLoc == Location.BOUNDARY) {
n.setLabelBoundary(argIndex);
} else {
if (n.getLabel().isNull(argIndex)) {
n.setLabel(argIndex, Location.INTERIOR);
}
}
//Debug.println(n);
}
}
}
示例4: isResultOfOp
/**
* This method will handle arguments of Location.NONE correctly
*
* @return true if the locations correspond to the opCode
*/
public static boolean isResultOfOp(int loc0, int loc1, int opCode) {
if (loc0 == Location.BOUNDARY) {
loc0 = Location.INTERIOR;
}
if (loc1 == Location.BOUNDARY) {
loc1 = Location.INTERIOR;
}
switch (opCode) {
case INTERSECTION:
return loc0 == Location.INTERIOR
&& loc1 == Location.INTERIOR;
case UNION:
return loc0 == Location.INTERIOR
|| loc1 == Location.INTERIOR;
case DIFFERENCE:
return loc0 == Location.INTERIOR
&& loc1 != Location.INTERIOR;
case SYMDIFFERENCE:
return (loc0 == Location.INTERIOR && loc1 != Location.INTERIOR)
|| (loc0 != Location.INTERIOR && loc1 == Location.INTERIOR);
}
return false;
}
示例5: locate
/**
* Computes the topological relationship ({@link Location}) of a single point
* to a Geometry.
* It handles both single-element
* and multi-element Geometries.
* The algorithm for multi-part Geometries
* takes into account the SFS Boundary Determination Rule.
*
* @return the {@link Location} of the point relative to the input Geometry
*/
public int locate(Coordinate p, Geometry geom) {
if (geom.isEmpty()) {
return Location.EXTERIOR;
}
if (geom instanceof LineString) {
return this.locate(p, (LineString) geom);
} else if (geom instanceof Polygon) {
return this.locate(p, (Polygon) geom);
}
this.isIn = false;
this.numBoundaries = 0;
this.computeLocation(p, geom);
if (this.boundaryRule.isInBoundary(this.numBoundaries)) {
return Location.BOUNDARY;
}
if (this.numBoundaries > 0 || this.isIn) {
return Location.INTERIOR;
}
return Location.EXTERIOR;
}
示例6: computeLabelling
/**
* Compute the labelling for all dirEdges in this star, as well
* as the overall labelling
*/
@Override
public void computeLabelling(GeometryGraph[] geom) {
//Debug.print(this);
super.computeLabelling(geom);
// determine the overall labelling for this DirectedEdgeStar
// (i.e. for the node it is based at)
this.label = new Label(Location.NONE);
for (Iterator it = this.iterator(); it.hasNext(); ) {
EdgeEnd ee = (EdgeEnd) it.next();
Edge e = ee.getEdge();
Label eLabel = e.getLabel();
for (int i = 0; i < 2; i++) {
int eLoc = eLabel.getLocation(i);
if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY) {
this.label.setLocation(i, Location.INTERIOR);
}
}
}
//Debug.print(this);
}
示例7: setLabelBoundary
/**
* Updates the label of a node to BOUNDARY,
* obeying the mod-2 boundaryDetermination rule.
*/
public void setLabelBoundary(int argIndex) {
if (this.label == null) {
return;
}
// determine the current location for the point (if any)
int loc = Location.NONE;
if (this.label != null) {
loc = this.label.getLocation(argIndex);
}
// flip the loc
int newLoc;
switch (loc) {
case Location.BOUNDARY:
newLoc = Location.INTERIOR;
break;
case Location.INTERIOR:
newLoc = Location.BOUNDARY;
break;
default:
newLoc = Location.BOUNDARY;
break;
}
this.label.setLocation(argIndex, newLoc);
}
示例8: isInBoundary
/**
* This method implements the Boundary Determination Rule
* for determining whether
* a component (node or edge) that appears multiple times in elements
* of a MultiGeometry is in the boundary or the interior of the Geometry
* <br>
* The SFS uses the "Mod-2 Rule", which this function implements
* <br>
* An alternative (and possibly more intuitive) rule would be
* the "At Most One Rule":
* isInBoundary = (componentCount == 1)
*/
/*
public static boolean isInBoundary(int boundaryCount)
{
// the "Mod-2 Rule"
return boundaryCount % 2 == 1;
}
public static int determineBoundary(int boundaryCount)
{
return isInBoundary(boundaryCount) ? Location.BOUNDARY : Location.INTERIOR;
}
*/
public static int determineBoundary(BoundaryNodeRule boundaryNodeRule, int boundaryCount) {
return boundaryNodeRule.isInBoundary(boundaryCount)
? Location.BOUNDARY : Location.INTERIOR;
}
示例9: insertBoundaryPoint
/**
* Adds candidate boundary points using the current {@link BoundaryNodeRule}.
* This is used to add the boundary
* points of dim-1 geometries (Curves/MultiCurves).
*/
private void insertBoundaryPoint(int argIndex, Coordinate coord) {
Node n = this.nodes.addNode(coord);
// nodes always have labels
Label lbl = n.getLabel();
// the new point to insert is on a boundary
int boundaryCount = 1;
// determine the current location for the point (if any)
int loc = Location.NONE;
loc = lbl.getLocation(argIndex, Position.ON);
if (loc == Location.BOUNDARY) {
boundaryCount++;
}
// determine the boundary status of the point according to the Boundary Determination Rule
int newLoc = determineBoundary(this.boundaryNodeRule, boundaryCount);
lbl.setLocation(argIndex, newLoc);
}
示例10: computeIntersectionNodes
/**
* Insert nodes for all intersections on the edges of a Geometry.
* Label the created nodes the same as the edge label if they do not already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
*/
private void computeIntersectionNodes(int argIndex) {
for (Iterator i = arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
Edge e = (Edge) i.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) nodes.addNode(ei.coord);
if (eLoc == Location.BOUNDARY)
n.setLabelBoundary(argIndex);
else {
if (n.getLabel().isNull(argIndex))
n.setLabel(argIndex, Location.INTERIOR);
}
//Debug.println(n);
}
}
}
示例11: labelIntersectionNodes
/**
* For all intersections on the edges of a Geometry,
* label the corresponding node IF it doesn't already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
*/
private void labelIntersectionNodes(int argIndex) {
for (Iterator i = arg[argIndex].getEdgeIterator(); i.hasNext(); ) {
Edge e = (Edge) i.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) nodes.find(ei.coord);
if (n.getLabel().isNull(argIndex)) {
if (eLoc == Location.BOUNDARY)
n.setLabelBoundary(argIndex);
else
n.setLabel(argIndex, Location.INTERIOR);
}
//n.print(System.out);
}
}
}
示例12: computeIntersectionNodes
/**
* Insert nodes for all intersections on the edges of a Geometry.
* Label the created nodes the same as the edge label if they do not already have a label.
* This allows nodes created by either self-intersections or
* mutual intersections to be labelled.
* Endpoint nodes will already be labelled from when they were inserted.
* <p/>
* Precondition: edge intersections have been computed.
*/
public void computeIntersectionNodes(GeometryGraph geomGraph, int argIndex) {
for (Iterator edgeIt = geomGraph.getEdgeIterator(); edgeIt.hasNext(); ) {
Edge e = (Edge) edgeIt.next();
int eLoc = e.getLabel().getLocation(argIndex);
for (Iterator eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {
EdgeIntersection ei = (EdgeIntersection) eiIt.next();
RelateNode n = (RelateNode) nodes.addNode(ei.coord);
if (eLoc == Location.BOUNDARY)
n.setLabelBoundary(argIndex);
else {
if (n.getLabel().isNull(argIndex))
n.setLabel(argIndex, Location.INTERIOR);
}
//Debug.println(n);
}
}
}
示例13: computeLabelling
/**
* Compute the labelling for all dirEdges in this star, as well
* as the overall labelling
*/
public void computeLabelling(GeometryGraph[] geom) {
//Debug.print(this);
super.computeLabelling(geom);
// determine the overall labelling for this DirectedEdgeStar
// (i.e. for the node it is based at)
label = new Label(Location.NONE);
for (Iterator it = iterator(); it.hasNext(); ) {
EdgeEnd ee = (EdgeEnd) it.next();
Edge e = ee.getEdge();
Label eLabel = e.getLabel();
for (int i = 0; i < 2; i++) {
int eLoc = eLabel.getLocation(i);
if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY)
label.setLocation(i, Location.INTERIOR);
}
}
//Debug.print(this);
}
示例14: setLabelBoundary
/**
* Updates the label of a node to BOUNDARY,
* obeying the mod-2 boundaryDetermination rule.
*/
public void setLabelBoundary(int argIndex) {
if (label == null) return;
// determine the current location for the point (if any)
int loc = Location.NONE;
if (label != null)
loc = label.getLocation(argIndex);
// flip the loc
int newLoc;
switch (loc) {
case Location.BOUNDARY:
newLoc = Location.INTERIOR;
break;
case Location.INTERIOR:
newLoc = Location.BOUNDARY;
break;
default:
newLoc = Location.BOUNDARY;
break;
}
label.setLocation(argIndex, newLoc);
}
示例15: setLabelBoundary
/**
* Updates the label of a node to BOUNDARY,
* obeying the mod-2 boundaryDetermination rule.
*/
public void setLabelBoundary(int argIndex)
{
if (label == null) return;
// determine the current location for the point (if any)
int loc = Location.NONE;
if (label != null)
loc = label.getLocation(argIndex);
// flip the loc
int newLoc;
switch (loc) {
case Location.BOUNDARY: newLoc = Location.INTERIOR; break;
case Location.INTERIOR: newLoc = Location.BOUNDARY; break;
default: newLoc = Location.BOUNDARY; break;
}
label.setLocation(argIndex, newLoc);
}