本文整理汇总了Java中com.vividsolutions.jts.geom.IntersectionMatrix类的典型用法代码示例。如果您正苦于以下问题:Java IntersectionMatrix类的具体用法?Java IntersectionMatrix怎么用?Java IntersectionMatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntersectionMatrix类属于com.vividsolutions.jts.geom包,在下文中一共展示了IntersectionMatrix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* update the IM with the sum of the IMs for each component
*/
private void updateIM(IntersectionMatrix im) {
//Debug.println(im);
for (Object isolatedEdge : isolatedEdges) {
Edge e = (Edge) isolatedEdge;
e.updateIM(im);
//Debug.println(im);
}
for (Iterator ni = this.nodes.iterator(); ni.hasNext(); ) {
RelateNode node = (RelateNode) ni.next();
node.updateIM(im);
//Debug.println(im);
node.updateIMFromEdges(im);
//Debug.println(im);
//node.print(System.out);
}
}
示例2: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* update the IM with the sum of the IMs for each component
*/
private void updateIM(IntersectionMatrix im) {
//Debug.println(im);
for (Iterator ei = isolatedEdges.iterator(); ei.hasNext(); ) {
Edge e = (Edge) ei.next();
e.updateIM(im);
//Debug.println(im);
}
for (Iterator ni = nodes.iterator(); ni.hasNext(); ) {
RelateNode node = (RelateNode) ni.next();
node.updateIM(im);
//Debug.println(im);
node.updateIMFromEdges(im);
//Debug.println(im);
//node.print(System.out);
}
}
示例3: computeDisjointIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* If the Geometries are disjoint, we need to enter their dimension and
* boundary dimension in the Ext rows in the IM
*/
private void computeDisjointIM(IntersectionMatrix im) {
Geometry ga = this.arg[0].getGeometry();
if (!ga.isEmpty()) {
im.set(Location.INTERIOR, Location.EXTERIOR, ga.getDimension());
im.set(Location.BOUNDARY, Location.EXTERIOR, ga.getBoundaryDimension());
}
Geometry gb = this.arg[1].getGeometry();
if (!gb.isEmpty()) {
im.set(Location.EXTERIOR, Location.INTERIOR, gb.getDimension());
im.set(Location.EXTERIOR, Location.BOUNDARY, gb.getBoundaryDimension());
}
}
示例4: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Update the IM with the contribution for the EdgeStubs around the node.
*/
void updateIM(IntersectionMatrix im) {
for (Iterator it = this.iterator(); it.hasNext(); ) {
EdgeEndBundle esb = (EdgeEndBundle) it.next();
esb.updateIM(im);
}
}
示例5: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Updates an IM from the label for an edge.
* Handles edges from both L and A geometries.
*/
public static void updateIM(Label label, IntersectionMatrix im) {
im.setAtLeastIfValid(label.getLocation(0, Position.ON), label.getLocation(1, Position.ON), 1);
if (label.isArea()) {
im.setAtLeastIfValid(label.getLocation(0, Position.LEFT), label.getLocation(1, Position.LEFT), 2);
im.setAtLeastIfValid(label.getLocation(0, Position.RIGHT), label.getLocation(1, Position.RIGHT), 2);
}
}
示例6: checkCoordinatesWithFilteringArea
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
protected boolean checkCoordinatesWithFilteringArea(double x, double y) {
Geometry geom = this.geometryFactory.createPoint(new Coordinate(x, y));
IntersectionMatrix includingMatrix = geom.relate(this.includingArea);
if (!includingMatrix.isWithin()) {
LOGGER.info("Coordinates (" + x + ", " + y + ") are outside the including area " + this.includingAreaString);
return false;
}
IntersectionMatrix excludingMatrix = geom.relate(this.excludingArea);
if (excludingMatrix.isWithin()) {
LOGGER.info("Coordinates (" + x + ", " + y + ") are inside the excluding area " + this.excludingAreaString);
return false;
}
return true;
}
示例7: computeDisjointIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* If the Geometries are disjoint, we need to enter their dimension and
* boundary dimension in the Ext rows in the IM
*/
private void computeDisjointIM(IntersectionMatrix im) {
Geometry ga = arg[0].getGeometry();
if (!ga.isEmpty()) {
im.set(Location.INTERIOR, Location.EXTERIOR, ga.getDimension());
im.set(Location.BOUNDARY, Location.EXTERIOR, ga.getBoundaryDimension());
}
Geometry gb = arg[1].getGeometry();
if (!gb.isEmpty()) {
im.set(Location.EXTERIOR, Location.INTERIOR, gb.getDimension());
im.set(Location.EXTERIOR, Location.BOUNDARY, gb.getBoundaryDimension());
}
}
示例8: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Update the IM with the contribution for the EdgeStubs around the node.
*/
void updateIM(IntersectionMatrix im) {
for (Iterator it = iterator(); it.hasNext(); ) {
EdgeEndBundle esb = (EdgeEndBundle) it.next();
esb.updateIM(im);
}
}
示例9: runRelateTest
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
void runRelateTest(String wkt1, String wkt2, String expectedIM)
throws ParseException
{
Geometry g1 = rdr.read(wkt1);
Geometry g2 = rdr.read(wkt2);
IntersectionMatrix im = RelateOp.relate(g1, g2);
String imStr = im.toString();
System.out.println(imStr);
assertTrue(im.matches(expectedIM));
}
示例10: runRelateTest
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
void runRelateTest(String wkt1, String wkt2, BoundaryNodeRule bnRule, String expectedIM)
throws ParseException
{
Geometry g1 = rdr.read(wkt1);
Geometry g2 = rdr.read(wkt2);
IntersectionMatrix im = RelateOp.relate(g1, g2, bnRule);
String imStr = im.toString();
System.out.println(imStr);
assertTrue(im.matches(expectedIM));
}
示例11: computeIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
public IntersectionMatrix computeIM() {
IntersectionMatrix im = new IntersectionMatrix();
// since Geometries are finite and embedded in a 2-D space, the EE element must always be 2
im.set(Location.EXTERIOR, Location.EXTERIOR, 2);
// if the Geometries don't overlap there is nothing to do
if (!this.arg[0].getGeometry().getEnvelopeInternal().intersects(
this.arg[1].getGeometry().getEnvelopeInternal())) {
this.computeDisjointIM(im);
return im;
}
this.arg[0].computeSelfNodes(this.li, false);
this.arg[1].computeSelfNodes(this.li, false);
// compute intersections between edges of the two input geometries
SegmentIntersector intersector = this.arg[0].computeEdgeIntersections(this.arg[1], this.li, false);
//System.out.println("computeIM: # segment intersection tests: " + intersector.numTests);
this.computeIntersectionNodes(0);
this.computeIntersectionNodes(1);
/**
* Copy the labelling for the nodes in the parent Geometries. These override
* any labels determined by intersections between the geometries.
*/
this.copyNodesAndLabels(0);
this.copyNodesAndLabels(1);
// complete the labelling for any nodes which only have a label for a single geometry
//Debug.addWatch(nodes.find(new Coordinate(110, 200)));
//Debug.printWatch();
this.labelIsolatedNodes();
//Debug.printWatch();
// If a proper intersection was found, we can set a lower bound on the IM.
this.computeProperIntersectionIM(intersector, im);
/**
* Now process improper intersections
* (eg where one or other of the geometries has a vertex at the intersection point)
* We need to compute the edge graph at all nodes to determine the IM.
*/
// build EdgeEnds for all intersections
EdgeEndBuilder eeBuilder = new EdgeEndBuilder();
List ee0 = eeBuilder.computeEdgeEnds(this.arg[0].getEdgeIterator());
this.insertEdgeEnds(ee0);
List ee1 = eeBuilder.computeEdgeEnds(this.arg[1].getEdgeIterator());
this.insertEdgeEnds(ee1);
//Debug.println("==== NodeList ===");
//Debug.print(nodes);
this.labelNodeEdges();
/**
* Compute the labeling for isolated components
* <br>
* Isolated components are components that do not touch any other components in the graph.
* They can be identified by the fact that they will
* contain labels containing ONLY a single element, the one for their parent geometry.
* We only need to check components contained in the input graphs, since
* isolated components will not have been replaced by new components formed by intersections.
*/
//debugPrintln("Graph A isolated edges - ");
this.labelIsolatedEdges(0, 1);
//debugPrintln("Graph B isolated edges - ");
this.labelIsolatedEdges(1, 0);
// update the IM from all components
this.updateIM(im);
return im;
}
示例12: computeProperIntersectionIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
private void computeProperIntersectionIM(SegmentIntersector intersector, IntersectionMatrix im) {
// If a proper intersection is found, we can set a lower bound on the IM.
int dimA = this.arg[0].getGeometry().getDimension();
int dimB = this.arg[1].getGeometry().getDimension();
boolean hasProper = intersector.hasProperIntersection();
boolean hasProperInterior = intersector.hasProperInteriorIntersection();
// For Geometry's of dim 0 there can never be proper intersections.
/**
* If edge segments of Areas properly intersect, the areas must properly overlap.
*/
if (dimA == 2 && dimB == 2) {
if (hasProper) {
im.setAtLeast("212101212");
}
}
/**
* If an Line segment properly intersects an edge segment of an Area,
* it follows that the Interior of the Line intersects the Boundary of the Area.
* If the intersection is a proper <i>interior</i> intersection, then
* there is an Interior-Interior intersection too.
* Note that it does not follow that the Interior of the Line intersects the Exterior
* of the Area, since there may be another Area component which contains the rest of the Line.
*/
else if (dimA == 2 && dimB == 1) {
if (hasProper) {
im.setAtLeast("FFF0FFFF2");
}
if (hasProperInterior) {
im.setAtLeast("1FFFFF1FF");
}
} else if (dimA == 1 && dimB == 2) {
if (hasProper) {
im.setAtLeast("F0FFFFFF2");
}
if (hasProperInterior) {
im.setAtLeast("1F1FFFFFF");
}
}
/* If edges of LineStrings properly intersect *in an interior point*, all
we can deduce is that
the interiors intersect. (We can NOT deduce that the exteriors intersect,
since some other segments in the geometries might cover the points in the
neighbourhood of the intersection.)
It is important that the point be known to be an interior point of
both Geometries, since it is possible in a self-intersecting geometry to
have a proper intersection on one segment that is also a boundary point of another segment.
*/
else if (dimA == 1 && dimB == 1) {
if (hasProperInterior) {
im.setAtLeast("0FFFFFFFF");
}
}
}
示例13: computeIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Update the IM with the contribution for this component.
* A component only contributes if it has a labelling for both parent geometries
*/
@Override
protected void computeIM(IntersectionMatrix im) {
im.setAtLeastIfValid(this.label.getLocation(0), this.label.getLocation(1), 0);
}
示例14: updateIMFromEdges
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Update the IM with the contribution for the EdgeEnds incident on this node.
*/
void updateIMFromEdges(IntersectionMatrix im) {
((EdgeEndBundleStar) this.edges).updateIM(im);
}
示例15: updateIM
import com.vividsolutions.jts.geom.IntersectionMatrix; //导入依赖的package包/类
/**
* Update the IM with the contribution for the computed label for the EdgeStubs.
*/
void updateIM(IntersectionMatrix im) {
Edge.updateIM(this.label, im);
}