Java 类com.vividsolutions.jts.geom.util.LinearComponentExtracter 实例源码

项目:Earth    文件:RectangleIntersects.java   
@Override
protected void visit(Geometry geom) {
    /**
     * It may be the case that the rectangle and the
     * envelope of the geometry component are disjoint,
     * so it is worth checking this simple condition.
     */
    Envelope elementEnv = geom.getEnvelopeInternal();
    if (!this.rectEnv.intersects(elementEnv)) {
        return;
    }

    // check segment intersections
    // get all lines from geometry component
    // (there may be more than one if it's a multi-ring polygon)
    List lines = LinearComponentExtracter.getLines(geom);
    this.checkIntersectionWithLineStrings(lines);
}
项目:jts    文件:RectangleIntersects.java   
protected void visit(Geometry geom) {
    /**
     * It may be the case that the rectangle and the
     * envelope of the geometry component are disjoint,
     * so it is worth checking this simple condition.
     */
    Envelope elementEnv = geom.getEnvelopeInternal();
    if (!rectEnv.intersects(elementEnv))
        return;

    // check segment intersections
    // get all lines from geometry component
    // (there may be more than one if it's a multi-ring polygon)
    List lines = LinearComponentExtracter.getLines(geom);
    checkIntersectionWithLineStrings(lines);
}
项目:jeql    文件:GeomFunction.java   
public static List<Geometry> splitBySegment(Geometry geom) {
  List<Geometry> items = new ArrayList<Geometry>();
  List lines = new ArrayList();

  LinearComponentExtracter.getLines(geom, lines);
  for (int icomp = 0; icomp < lines.size(); icomp++) {

    Coordinate[] pts = ((LineString) lines.get(icomp)).getCoordinates();
    for (int i = 0; i < pts.length - 1; i++) {
      LineString line = geomFactory.createLineString(
          new Coordinate[] { new Coordinate(pts[i]), new Coordinate(pts[i+1]) });
      items.add(line);
    }
  }
  return items;
}
项目:sig-seguimiento-vehiculos    文件:DivideLineStringTool.java   
private Collection<Geometry> getLines(final Geometry geom) {
    final List<Geometry> linesList = new ArrayList<Geometry>();
    final LinearComponentExtracter lineFilter = new LinearComponentExtracter(
            linesList);

    geom.apply(lineFilter);

    return linesList;
}
项目:sig-seguimiento-vehiculos    文件:DividePolygonTool.java   
private Collection<Geometry> getLines(final Geometry geom1, final Geometry geom2) {
    final List<Geometry> linesList = new ArrayList<Geometry>();
    final LinearComponentExtracter lineFilter = new LinearComponentExtracter(
            linesList);

    geom1.apply(lineFilter);
    geom2.apply(lineFilter);

    return linesList;
}
项目:Earth    文件:OffsetPointGenerator.java   
/**
 * Gets the computed offset points.
 *
 * @return List<Coordinate>
 */
public List getPoints(double offsetDistance) {
    List offsetPts = new ArrayList();
    List lines = LinearComponentExtracter.getLines(this.g);
    for (Object line1 : lines) {
        LineString line = (LineString) line1;
        this.extractPoints(line, offsetDistance, offsetPts);
    }
    //System.out.println(toMultiPoint(offsetPts));
    return offsetPts;
}
项目:Earth    文件:IsSimpleOp.java   
/**
 * Computes simplicity for polygonal geometries.
 * Polygonal geometries are simple if and only if
 * all of their component rings are simple.
 *
 * @param geom a Polygonal geometry
 * @return true if the geometry is simple
 */
private boolean isSimplePolygonal(Geometry geom) {
    List rings = LinearComponentExtracter.getLines(geom);
    for (Object ring1 : rings) {
        LinearRing ring = (LinearRing) ring1;
        if (!this.isSimpleLinearGeometry(ring)) {
            return false;
        }
    }
    return true;
}
项目:Earth    文件:BufferDistanceValidator.java   
private Geometry getPolygonLines(Geometry g) {
    List lines = new ArrayList();
    LinearComponentExtracter lineExtracter = new LinearComponentExtracter(lines);
    List polys = PolygonExtracter.getPolygons(g);
    for (Object poly1 : polys) {
        Polygon poly = (Polygon) poly1;
        poly.apply(lineExtracter);
    }
    return g.getFactory().buildGeometry(lines);
}
项目:Earth    文件:ConformingDelaunayTriangulationBuilder.java   
private static List createConstraintSegments(Geometry geom) {
    List lines = LinearComponentExtracter.getLines(geom);
    List constraintSegs = new ArrayList();
    for (Object line1 : lines) {
        LineString line = (LineString) line1;
        createConstraintSegments(line, constraintSegs);
    }
    return constraintSegs;
}
项目:Earth    文件:IndexedPointInAreaLocator.java   
private void init(Geometry geom) {
    List lines = LinearComponentExtracter.getLines(geom);
    for (Object line1 : lines) {
        LineString line = (LineString) line1;
        Coordinate[] pts = line.getCoordinates();
        this.addLine(pts);
    }
}
项目:Earth    文件:SegmentStringUtil.java   
/**
 * Extracts all linear components from a given {@link Geometry}
 * to {@link SegmentString}s.
 * The SegmentString data item is set to be the source Geometry.
 *
 * @param geom the geometry to extract from
 * @return a List of SegmentStrings
 */
public static List extractSegmentStrings(Geometry geom) {
    List segStr = new ArrayList();
    List lines = LinearComponentExtracter.getLines(geom);
    for (Object line1 : lines) {
        LineString line = (LineString) line1;
        Coordinate[] pts = line.getCoordinates();
        segStr.add(new NodedSegmentString(pts, geom));
    }
    return segStr;
}
项目:Earth    文件:GeometryNoder.java   
private List extractLines(Collection geoms) {
    List lines = new ArrayList();
    LinearComponentExtracter lce = new LinearComponentExtracter(lines);
    for (Object geom1 : geoms) {
        Geometry geom = (Geometry) geom1;
        geom.apply(lce);
    }
    return lines;
}
项目:geowe-core    文件:DivideLineStringTool.java   
private Collection<Geometry> getLines(final Geometry geom) {
    final List<Geometry> linesList = new ArrayList<Geometry>();
    final LinearComponentExtracter lineFilter = new LinearComponentExtracter(
            linesList);

    geom.apply(lineFilter);

    return linesList;
}
项目:geowe-core    文件:DividePolygonTool.java   
private Collection<Geometry> getLines(final Geometry geom1, final Geometry geom2) {
    final List<Geometry> linesList = new ArrayList<Geometry>();
    final LinearComponentExtracter lineFilter = new LinearComponentExtracter(
            linesList);

    geom1.apply(lineFilter);
    geom2.apply(lineFilter);

    return linesList;
}
项目:jts    文件:OffsetPointGenerator.java   
/**
 * Gets the computed offset points.
 *
 * @return List<Coordinate>
 */
public List getPoints(double offsetDistance) {
    List offsetPts = new ArrayList();
    List lines = LinearComponentExtracter.getLines(g);
    for (Iterator i = lines.iterator(); i.hasNext(); ) {
        LineString line = (LineString) i.next();
        extractPoints(line, offsetDistance, offsetPts);
    }
    //System.out.println(toMultiPoint(offsetPts));
    return offsetPts;
}
项目:jts    文件:IsSimpleOp.java   
/**
 * Computes simplicity for polygonal geometries.
 * Polygonal geometries are simple if and only if
 * all of their component rings are simple.
 *
 * @param geom a Polygonal geometry
 * @return true if the geometry is simple
 */
private boolean isSimplePolygonal(Geometry geom) {
    List rings = LinearComponentExtracter.getLines(geom);
    for (Iterator i = rings.iterator(); i.hasNext(); ) {
        LinearRing ring = (LinearRing) i.next();
        if (!isSimpleLinearGeometry(ring))
            return false;
    }
    return true;
}
项目:jts    文件:BufferDistanceValidator.java   
private Geometry getPolygonLines(Geometry g) {
    List lines = new ArrayList();
    LinearComponentExtracter lineExtracter = new LinearComponentExtracter(lines);
    List polys = PolygonExtracter.getPolygons(g);
    for (Iterator i = polys.iterator(); i.hasNext(); ) {
        Polygon poly = (Polygon) i.next();
        poly.apply(lineExtracter);
    }
    return g.getFactory().buildGeometry(lines);
}
项目:jts    文件:DistanceOp.java   
/**
 * Computes distance between facets (lines and points)
 * of input geometries.
 */
private void computeFacetDistance() {
    GeometryLocation[] locGeom = new GeometryLocation[2];

    /**
     * Geometries are not wholely inside, so compute distance from lines and points
     * of one to lines and points of the other
     */
    List lines0 = LinearComponentExtracter.getLines(geom[0]);
    List lines1 = LinearComponentExtracter.getLines(geom[1]);

    List pts0 = PointExtracter.getPoints(geom[0]);
    List pts1 = PointExtracter.getPoints(geom[1]);

    // exit whenever minDistance goes LE than terminateDistance
    computeMinDistanceLines(lines0, lines1, locGeom);
    updateMinDistance(locGeom, false);
    if (minDistance <= terminateDistance) return;

    locGeom[0] = null;
    locGeom[1] = null;
    computeMinDistanceLinesPoints(lines0, pts1, locGeom);
    updateMinDistance(locGeom, false);
    if (minDistance <= terminateDistance) return;

    locGeom[0] = null;
    locGeom[1] = null;
    computeMinDistanceLinesPoints(lines1, pts0, locGeom);
    updateMinDistance(locGeom, true);
    if (minDistance <= terminateDistance) return;

    locGeom[0] = null;
    locGeom[1] = null;
    computeMinDistancePoints(pts0, pts1, locGeom);
    updateMinDistance(locGeom, false);
}
项目:jts    文件:ConformingDelaunayTriangulationBuilder.java   
private static List createConstraintSegments(Geometry geom) {
    List lines = LinearComponentExtracter.getLines(geom);
    List constraintSegs = new ArrayList();
    for (Iterator i = lines.iterator(); i.hasNext(); ) {
        LineString line = (LineString) i.next();
        createConstraintSegments(line, constraintSegs);
    }
    return constraintSegs;
}
项目:jts    文件:IndexedPointInAreaLocator.java   
private void init(Geometry geom) {
    List lines = LinearComponentExtracter.getLines(geom);
    for (Iterator i = lines.iterator(); i.hasNext(); ) {
        LineString line = (LineString) i.next();
        Coordinate[] pts = line.getCoordinates();
        addLine(pts);
    }
}
项目:jts    文件:SegmentStringUtil.java   
/**
 * Extracts all linear components from a given {@link Geometry}
 * to {@link SegmentString}s.
 * The SegmentString data item is set to be the source Geometry.
 *
 * @param geom the geometry to extract from
 * @return a List of SegmentStrings
 */
public static List extractSegmentStrings(Geometry geom) {
    List segStr = new ArrayList();
    List lines = LinearComponentExtracter.getLines(geom);
    for (Iterator i = lines.iterator(); i.hasNext(); ) {
        LineString line = (LineString) i.next();
        Coordinate[] pts = line.getCoordinates();
        segStr.add(new NodedSegmentString(pts, geom));
    }
    return segStr;
}
项目:jts    文件:GeometryNoder.java   
private List extractLines(Collection geoms) {
    List lines = new ArrayList();
    LinearComponentExtracter lce = new LinearComponentExtracter(lines);
    for (Iterator it = geoms.iterator(); it.hasNext(); ) {
        Geometry geom = (Geometry) it.next();
        geom.apply(lce);
    }
    return lines;
}
项目:jts    文件:LineDissolvePerfTest.java   
Geometry extractLines(Collection geoms)
{
  GeometryFactory factory = null;
  List lines = new ArrayList();
  for (Iterator i = geoms.iterator(); i.hasNext(); ) {
    Geometry g = (Geometry) i.next();
    if (factory == null)
        factory = g.getFactory();
    lines.addAll(LinearComponentExtracter.getLines(g));
  }
  return factory.buildGeometry(geoms);
}
项目:geodroid_master_update    文件:IsSimpleOp.java   
/**
 * Computes simplicity for polygonal geometries.
 * Polygonal geometries are simple if and only if
 * all of their component rings are simple.
 * 
 * @param geom a Polygonal geometry
 * @return true if the geometry is simple
 */
private boolean isSimplePolygonal(Geometry geom)
{
  List rings = LinearComponentExtracter.getLines(geom);
  for (Iterator i = rings.iterator(); i.hasNext(); ) {
    LinearRing ring = (LinearRing) i.next();
    if (! isSimpleLinearGeometry(ring))
      return false;
  }
  return true;
}
项目:geodroid_master_update    文件:SegmentStringUtil.java   
/**
 * Extracts all linear components from a given {@link Geometry}
 * to {@link SegmentString}s.
 * The SegmentString data item is set to be the source Geometry.
 * 
 * @param geom the geometry to extract from
 * @return a List of SegmentStrings
 */
public static List extractSegmentStrings(Geometry geom)
{
  List segStr = new ArrayList();
  List lines = LinearComponentExtracter.getLines(geom);
  for (Iterator i = lines.iterator(); i.hasNext(); ) {
    LineString line = (LineString) i.next();
    Coordinate[] pts = line.getCoordinates();
    segStr.add(new NodedSegmentString(pts, geom));
  }
  return segStr;
}
项目:terraingis    文件:IsSimpleOp.java   
/**
 * Computes simplicity for polygonal geometries.
 * Polygonal geometries are simple if and only if
 * all of their component rings are simple.
 * 
 * @param geom a Polygonal geometry
 * @return true if the geometry is simple
 */
private boolean isSimplePolygonal(Geometry geom)
{
  List rings = LinearComponentExtracter.getLines(geom);
  for (Iterator i = rings.iterator(); i.hasNext(); ) {
    LinearRing ring = (LinearRing) i.next();
    if (! isSimpleLinearGeometry(ring))
      return false;
  }
  return true;
}
项目:terraingis    文件:SegmentStringUtil.java   
/**
 * Extracts all linear components from a given {@link Geometry}
 * to {@link SegmentString}s.
 * The SegmentString data item is set to be the source Geometry.
 * 
 * @param geom the geometry to extract from
 * @return a List of SegmentStrings
 */
public static List extractSegmentStrings(Geometry geom)
{
  List segStr = new ArrayList();
  List lines = LinearComponentExtracter.getLines(geom);
  for (Iterator i = lines.iterator(); i.hasNext(); ) {
    LineString line = (LineString) i.next();
    Coordinate[] pts = line.getCoordinates();
    segStr.add(new NodedSegmentString(pts, geom));
  }
  return segStr;
}
项目:sig-seguimiento-vehiculos    文件:DivideLineStringTool.java   
public List<Geometry> linealize(Geometry geometry) {
    LinearComponentExtracter extracter = new LinearComponentExtracter(
            getLines(geometry));
    return extracter.getLines(geometry);
}
项目:Earth    文件:DistanceOp.java   
/**
 * Computes distance between facets (lines and points)
 * of input geometries.
 */
private void computeFacetDistance() {
    GeometryLocation[] locGeom = new GeometryLocation[2];

    /**
     * Geometries are not wholely inside, so compute distance from lines and points
     * of one to lines and points of the other
     */
    List lines0 = LinearComponentExtracter.getLines(this.geom[0]);
    List lines1 = LinearComponentExtracter.getLines(this.geom[1]);

    List pts0 = PointExtracter.getPoints(this.geom[0]);
    List pts1 = PointExtracter.getPoints(this.geom[1]);

    // exit whenever minDistance goes LE than terminateDistance
    this.computeMinDistanceLines(lines0, lines1, locGeom);
    this.updateMinDistance(locGeom, false);
    if (this.minDistance <= this.terminateDistance) {
        return;
    }

    locGeom[0] = null;
    locGeom[1] = null;
    this.computeMinDistanceLinesPoints(lines0, pts1, locGeom);
    this.updateMinDistance(locGeom, false);
    if (this.minDistance <= this.terminateDistance) {
        return;
    }

    locGeom[0] = null;
    locGeom[1] = null;
    this.computeMinDistanceLinesPoints(lines1, pts0, locGeom);
    this.updateMinDistance(locGeom, true);
    if (this.minDistance <= this.terminateDistance) {
        return;
    }

    locGeom[0] = null;
    locGeom[1] = null;
    this.computeMinDistancePoints(pts0, pts1, locGeom);
    this.updateMinDistance(locGeom, false);
}
项目:geowe-core    文件:DivideLineStringTool.java   
public List<Geometry> linealize(Geometry geometry) {
    LinearComponentExtracter extracter = new LinearComponentExtracter(
            getLines(geometry));
    return extracter.getLines(geometry);
}