Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LineString.intersection()


      LineString segment = fc.createLineString(segmentCoordinates);
      // if intersect, this is the vertex we need to add, so add it to the
      // result coordinates list.
      if (segment.intersects(line)) {

        Geometry point = segment.intersection(line);

        Geometry[] sorted = sortPoints(point, segment);
        // add all the points.
        for (int j = 0; j < sorted.length; j++) {
View Full Code Here


            // make the intersection between the line segment and each boundary segment in order to
            // create the intersection link
            List<LineString> ringSegmentList = ringToSegmentList(ring);
            for( LineString ringSegment : ringSegmentList ) {

                Geometry intersectionGeom = lineSegment.intersection(ringSegment);

                if (intersectionGeom instanceof Point) {

                    IntersectionLink link = new IntersectionLink(lineSegment, ringSegment,
                            (Point) intersectionGeom);
View Full Code Here

    holeCoords[i + 1] };

  LineString holeSegment;
  GeometryFactory geomFact = intersectingSegment.getFactory();
  holeSegment = geomFact.createLineString(holeSegmentCoord);
  Geometry intersection = holeSegment.intersection(intersectingSegment);

  return intersection;
    }

    /**
 
View Full Code Here

      Point nearestCrossStart = null;
      double nearestStart = Double.MAX_VALUE;
      for (Iterator<LineString> itrTrimExtend = trimExtendToList
          .iterator(); itrTrimExtend.hasNext();) {
        LineString l = itrTrimExtend.next();
        Geometry crossPoints = l.intersection(lStart);
        if (crossPoints != null) {
          ArrayList<Point> pts = new ArrayList<Point>();
          if (crossPoints instanceof Point) {
            pts.add((Point) crossPoints);
          } else if (crossPoints instanceof MultiPoint) {
View Full Code Here

      Point nearestCrossEnd = null;
      double nearestEnd = Double.MAX_VALUE;
      for (Iterator<LineString> itrTrimExtend = trimExtendToList
          .iterator(); itrTrimExtend.hasNext();) {
        LineString l = itrTrimExtend.next();
        Geometry crossPoints = l.intersection(lEnd);
        if (crossPoints != null) {
          ArrayList<Point> pts = new ArrayList<Point>();
          if (crossPoints instanceof Point) {
            pts.add((Point) crossPoints);
          } else if (crossPoints instanceof MultiPoint) {
View Full Code Here

            Point startPoint = geometryFactory.createPoint(startCoordinate);
            for (NamedArea area : intersects) {
                Geometry polygon = area.getPolygon();
                if (!polygon.intersects(startPoint))
                    continue;
                Geometry lineParts = line.intersection(polygon);
                if (lineParts.getLength() > 0.000001) {
                    Coordinate edgeCoordinate = null;
                    // this is either a LineString or a MultiLineString (we hope)
                    if (lineParts instanceof MultiLineString) {
                        MultiLineString mls = (MultiLineString) lineParts;
View Full Code Here

                        continue;

                    // Check for real intersection
                    LineString seg2 = GeometryUtils.makeLineString(ringSegment.nA.lon,
                            ringSegment.nA.lat, ringSegment.nB.lon, ringSegment.nB.lat);
                    Geometry intersection = seg2.intersection(seg);
                    Point p = null;
                    if (intersection.isEmpty()) {
                        continue;
                    } else if (intersection instanceof Point) {
                        p = (Point) intersection;
View Full Code Here

            for (Area area : intersects) {
                MultiPolygon polygon = area.toJTSMultiPolygon();
                if (!(polygon.intersects(startPoint) || polygon.getBoundary()
                        .intersects(startPoint)))
                    continue;
                Geometry lineParts = line.intersection(polygon);
                if (lineParts.getLength() > 0.000001) {
                    Coordinate edgeCoordinate = null;
                    // this is either a LineString or a MultiLineString (we hope)
                    if (lineParts instanceof MultiLineString) {
                        MultiLineString mls = (MultiLineString) lineParts;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.