org.openjump.core.geomutils.algorithm
Class IntersectGeometries

java.lang.Object
  extended by org.openjump.core.geomutils.algorithm.IntersectGeometries

public class IntersectGeometries
extends java.lang.Object


Constructor Summary
IntersectGeometries()
           
 
Method Summary
static boolean checkIntersectionByGeomTypeB(com.vividsolutions.jts.geom.Geometry g1, com.vividsolutions.jts.geom.Geometry g2)
          evaluates if two geometries intersect.
static boolean checkPolygonIntersection(com.vividsolutions.jts.geom.Geometry g1, com.vividsolutions.jts.geom.Geometry g2)
          evaluates if two polygon geometries intersect.
static java.util.ArrayList<com.vividsolutions.jts.geom.Geometry> intersectPolygons(java.util.ArrayList<com.vividsolutions.jts.geom.Geometry> geomList, double accurracy, TaskMonitor monitor, PlugInContext context)
          the method intersects all polygons in the geometry list with each other.
static java.util.Collection nodeLines(java.util.Collection lines)
          Nodes a collection of linestrings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntersectGeometries

public IntersectGeometries()
Method Detail

intersectPolygons

public static java.util.ArrayList<com.vividsolutions.jts.geom.Geometry> intersectPolygons(java.util.ArrayList<com.vividsolutions.jts.geom.Geometry> geomList,
                                                                                          double accurracy,
                                                                                          TaskMonitor monitor,
                                                                                          PlugInContext context)
the method intersects all polygons in the geometry list with each other. An intersection is only proceeded if it returns another polygon (i.e. the intersection area > 0). Unfortunately the method returns results where some polygons may contain spikes. For this reason it may be better to create an an intersection of Linestrings (derived from the Polygons) and then use the Polygonizer (see IntersectPolygonLayersPlugIn).

Parameters:
geomList -
this - parameter is currently not used and replaced by the use of a fixed precision model
monitor - can be null
context - can be null
Returns:

checkIntersectionByGeomTypeB

public static boolean checkIntersectionByGeomTypeB(com.vividsolutions.jts.geom.Geometry g1,
                                                   com.vividsolutions.jts.geom.Geometry g2)
evaluates if two geometries intersect. E.g. for two polygons it evaluates if the intersection is an area and not just a line. \n This method is used since area1.intersection(area2) does return also a positive result if the intersection is on the boundary (i.e. no intersection of the interior).\n Note1: the order of how the geometries are provided matters! It tested such that g1.SpatialCritearia(g2). NOTE 2: the function has not been checked for mixed geometry types

Parameters:
g1 -
g2 -
Returns:
true if more a geometry is split in at least 2 parts

checkPolygonIntersection

public static boolean checkPolygonIntersection(com.vividsolutions.jts.geom.Geometry g1,
                                               com.vividsolutions.jts.geom.Geometry g2)
evaluates if two polygon geometries intersect. E.g. for two polygons it evaluates if the intersection is an area and not just a line. \n This method is used since area1.intersection(area2) does return also a positive result if the intersection is on the boundary (i.e. no intersection of the interior).\n Note1: the order of how the geometries are provided matters! It tested such that g1.SpatialCritearia(g2). NOTE 2: the function has not been checked for mixed geometry types

Parameters:
g1 -
g2 -
Returns:
true if area(intersection) > 0

nodeLines

public static java.util.Collection nodeLines(java.util.Collection lines)
Nodes a collection of linestrings. Noding is done via JTS union, which is reasonably effective but may exhibit robustness failures. \n note: the method is taken from PolygonizerPlugIn

Parameters:
lines - the linear geometries to node
Returns:
a collection of linear geometries, noded together