本文整理汇总了Java中com.vividsolutions.jts.geom.Location.INTERIOR属性的典型用法代码示例。如果您正苦于以下问题:Java Location.INTERIOR属性的具体用法?Java Location.INTERIOR怎么用?Java Location.INTERIOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vividsolutions.jts.geom.Location
的用法示例。
在下文中一共展示了Location.INTERIOR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitInteriorRing
private void visitInteriorRing(LineString ring, PlanarGraph graph) {
Coordinate[] pts = ring.getCoordinates();
Coordinate pt0 = pts[0];
/**
* Find first point in coord list different to initial point.
* Need special check since the first point may be repeated.
*/
Coordinate pt1 = findDifferentPoint(pts, pt0);
Edge e = graph.findEdgeInSameDirection(pt0, pt1);
DirectedEdge de = (DirectedEdge) graph.findEdgeEnd(e);
DirectedEdge intDe = null;
if (de.getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
intDe = de;
} else if (de.getSym().getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
intDe = de.getSym();
}
Assert.isTrue(intDe != null, "unable to find dirEdge with Interior on RHS");
this.visitLinkedDirectedEdges(intDe);
}
示例2: addLineString
private void addLineString(LineString line) {
Coordinate[] coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates());
if (coord.length < 2) {
this.hasTooFewPoints = true;
this.invalidPoint = coord[0];
return;
}
// add the edge for the LineString
// line edges do not have locations for their left and right sides
Edge e = new Edge(coord, new Label(this.argIndex, Location.INTERIOR));
this.lineEdgeMap.put(line, e);
this.insertEdge(e);
/**
* Add the boundary points of the LineString, if any.
* Even if the LineString is closed, add both points as if they were endpoints.
* This allows for the case that the node already exists and is a boundary point.
*/
Assert.isTrue(coord.length >= 2, "found LineString with single point");
this.insertBoundaryPoint(this.argIndex, coord[0]);
this.insertBoundaryPoint(this.argIndex, coord[coord.length - 1]);
}
示例3: 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);
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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);
}
示例8: add
public void add(Label lbl)
{
for (int i = 0; i < 2; i++) {
for (int j = 1; j < 3; j++) {
int loc = lbl.getLocation(i, j);
if (loc == Location.EXTERIOR || loc == Location.INTERIOR) {
// initialize depth if it is null, otherwise add this location value
if (isNull(i, j)) {
depth[i][j] = depthAtLocation(loc);
}
else
depth[i][j] += depthAtLocation(loc);
}
}
}
}
示例9: 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);
}
示例10: fastGetSharedAreaRatio
/**
* This is ten times faster than the absolutely correct
* version above, and it's only off by an average of 1%.
* Note that the first argument MUST be rectangular, or
* your results will be meaningless.
*/
public static double fastGetSharedAreaRatio (Geometry geom1, Geometry geom2) {
Envelope env1 = geom1.getEnvelopeInternal();
if ((SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMaxY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
(SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMaxY()), geom2) == Location.INTERIOR)) {
// I suppose it is possible for a valid polygon geometry
// to contain all four corners and share considerably less
// than 100% of its area with the envelope in question.
// But if you're that worried about correctness you
// shouldn't be using this method in the first place.
return 1.0;
}
double xInc = env1.getWidth() / 9.0;
double yInc = env1.getHeight() / 9.0;
double x = env1.getMinX();
double y = env1.getMinY();
double ct = 0;
for (int i = 0; i < 10; i += 1) {
y = env1.getMinY();
for (int j = 0; j < 10; j += 1) {
if (SimplePointInAreaLocator.locate(new Coordinate(x,y), geom2) == Location.INTERIOR) {
ct += 1;
}
y += yInc;
}
x += xInc;
}
return (ct / 100.0);
}
示例11: computeLabelSide
/**
* To compute the summary label for a side, the algorithm is:
* FOR all edges
* IF any edge's location is INTERIOR for the side, side location = INTERIOR
* ELSE IF there is at least one EXTERIOR attribute, side location = EXTERIOR
* ELSE side location = NULL
* <br>
* Note that it is possible for two sides to have apparently contradictory information
* i.e. one edge side may indicate that it is in the interior of a geometry, while
* another edge side may indicate the exterior of the same geometry. This is
* not an incompatibility - GeometryCollections may contain two Polygons that touch
* along an edge. This is the reason for Interior-primacy rule above - it
* results in the summary label having the Geometry interior on <b>both</b> sides.
*/
private void computeLabelSide(int geomIndex, int side) {
for (Iterator it = this.iterator(); it.hasNext(); ) {
EdgeEnd e = (EdgeEnd) it.next();
if (e.getLabel().isArea()) {
int loc = e.getLabel().getLocation(geomIndex, side);
if (loc == Location.INTERIOR) {
this.label.setLocation(geomIndex, side, Location.INTERIOR);
return;
} else if (loc == Location.EXTERIOR) {
this.label.setLocation(geomIndex, side, Location.EXTERIOR);
}
}
}
}
示例12: setInteriorEdgesInResult
private void setInteriorEdgesInResult(PlanarGraph graph) {
for (Object o : graph.getEdgeEnds()) {
DirectedEdge de = (DirectedEdge) o;
if (de.getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
de.setInResult(true);
}
}
}
示例13: isValidResult
private boolean isValidResult(int overlayOp, int[] location) {
boolean expectedInterior = OverlayOp.isResultOfOp(location[0], location[1], overlayOp);
boolean resultInInterior = (location[2] == Location.INTERIOR);
// MD use simpler: boolean isValid = (expectedInterior == resultInInterior);
boolean isValid = expectedInterior == resultInInterior;
if (!isValid) {
this.reportResult(overlayOp, location, expectedInterior);
}
return isValid;
}
示例14: depthDelta
/**
* Compute the change in depth as an edge is crossed from R to L
*/
private static int depthDelta(Label label) {
int lLoc = label.getLocation(0, Position.LEFT);
int rLoc = label.getLocation(0, Position.RIGHT);
if (lLoc == Location.INTERIOR && rLoc == Location.EXTERIOR) {
return 1;
} else if (lLoc == Location.EXTERIOR && rLoc == Location.INTERIOR) {
return -1;
}
return 0;
}
示例15: getLocation
/**
* Gets the {@link Location} of the point relative to
* the ring, polygon
* or multipolygon from which the processed segments were provided.
* <p>
* This method only determines the correct location
* if <b>all</b> relevant segments must have been processed.
*
* @return the Location of the point
*/
public int getLocation() {
if (this.isPointOnSegment) {
return Location.BOUNDARY;
}
// The point is in the interior of the ring if the number of X-crossings is
// odd.
if ((this.crossingCount % 2) == 1) {
return Location.INTERIOR;
}
return Location.EXTERIOR;
}