本文整理汇总了Java中com.vividsolutions.jts.geom.Location.EXTERIOR属性的典型用法代码示例。如果您正苦于以下问题:Java Location.EXTERIOR属性的具体用法?Java Location.EXTERIOR怎么用?Java Location.EXTERIOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vividsolutions.jts.geom.Location
的用法示例。
在下文中一共展示了Location.EXTERIOR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
}
}
}
示例3: isAllTestComponentsInTarget
/**
* Tests whether all components of the test Geometry
* are contained in the target geometry.
* Handles both linear and point components.
*
* @param geom a geometry to test
* @return true if all componenta of the argument are contained in the target geometry
*/
protected boolean isAllTestComponentsInTarget(Geometry testGeom) {
List coords = ComponentCoordinateExtracter.getCoordinates(testGeom);
for (Object coord : coords) {
Coordinate p = (Coordinate) coord;
int loc = this.targetPointLocator.locate(p);
if (loc == Location.EXTERIOR) {
return false;
}
}
return true;
}
示例4: 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);
}
}
}
}
示例5: isCovered
/**
* @return true if the coord is located in the interior or boundary of
* a geometry in the list.
*/
private boolean isCovered(Coordinate coord, List geomList) {
for (Object aGeomList : geomList) {
Geometry geom = (Geometry) aGeomList;
int loc = this.ptLocator.locate(coord, geom);
if (loc != Location.EXTERIOR) {
return true;
}
}
return false;
}
示例6: 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;
}
示例7: computeContainmentDistance
private void computeContainmentDistance(GeometryLocation ptLoc,
Polygon poly,
GeometryLocation[] locPtPoly) {
Coordinate pt = ptLoc.getCoordinate();
// if pt is not in exterior, distance to geom is 0
if (Location.EXTERIOR != this.ptLocator.locate(pt, poly)) {
this.minDistance = 0.0;
locPtPoly[0] = ptLoc;
locPtPoly[1] = new GeometryLocation(poly, pt);
}
}
示例8: depthFactor
/**
* Computes the factor for the change in depth when moving from one location to another.
* E.g. if crossing from the INTERIOR to the EXTERIOR the depth decreases, so the factor is -1
*/
public static int depthFactor(int currLocation, int nextLocation) {
if (currLocation == Location.EXTERIOR && nextLocation == Location.INTERIOR) {
return 1;
} else if (currLocation == Location.INTERIOR && nextLocation == Location.EXTERIOR) {
return -1;
}
return 0;
}
示例9: 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;
}
示例10: isAnyTargetComponentInAreaTest
/**
* Tests whether any component of the target geometry
* intersects the test geometry (which must be an areal geometry)
*
* @param geom the test geometry
* @param repPts the representative points of the target geometry
* @return true if any component intersects the areal test geometry
*/
protected boolean isAnyTargetComponentInAreaTest(Geometry testGeom, List targetRepPts) {
PointOnGeometryLocator piaLoc = new SimplePointInAreaLocator(testGeom);
for (Object targetRepPt : targetRepPts) {
Coordinate p = (Coordinate) targetRepPt;
int loc = piaLoc.locate(p);
if (loc != Location.EXTERIOR) {
return true;
}
}
return false;
}
示例11: locate
/**
* Determines the {@link Location} of a point in an areal {@link Geometry}.
* Currently this will never return a value of BOUNDARY.
*
* @param p the point to test
* @param geom the areal geometry to test
* @return the Location of the point in the geometry
*/
public static int locate(Coordinate p, Geometry geom) {
if (geom.isEmpty()) {
return Location.EXTERIOR;
}
if (containsPoint(p, geom)) {
return Location.INTERIOR;
}
return Location.EXTERIOR;
}
示例12: locateInPolygonRing
private int locateInPolygonRing(Coordinate p, LinearRing ring) {
// bounding-box check
if (!ring.getEnvelopeInternal().intersects(p)) {
return Location.EXTERIOR;
}
return CGAlgorithms.locatePointInRing(p, ring.getCoordinates());
}
示例13: depthAtLocation
public static int depthAtLocation(int location) {
if (location == Location.EXTERIOR) {
return 0;
}
if (location == Location.INTERIOR) {
return 1;
}
return NULL_VALUE;
}
示例14: 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 (isPointOnSegment)
return Location.BOUNDARY;
// The point is in the interior of the ring if the number of X-crossings is
// odd.
if ((crossingCount % 2) == 1) {
return Location.INTERIOR;
}
return Location.EXTERIOR;
}
示例15: 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);
}
}
}
}