Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createLineString()


  Coordinate[] holeSegmentCoord = new Coordinate[] { holeCoords[i],
    holeCoords[i + 1] };

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

  return intersection;
    }
View Full Code Here


      }
     
      GeometryFactory lineFactory = new GeometryFactory( intersection.getPrecisionModel(), intersection.getSRID() );
     
      // Starting with the first line (we already know we have at least 2 coords).
      LineString largestLine = lineFactory.createLineString( new Coordinate[]{ coords[0], coords[1] } );
      double largestLineLength = largestLine.getLength();
      for (int coordIndex=2; coordIndex<coords.length; coordIndex++)
      {
        LineString otherLine = lineFactory.createLineString( new Coordinate[]{ coords[coordIndex-1], coords[coordIndex] } );
        double otherLineLength = otherLine.getLength();
View Full Code Here

      // Starting with the first line (we already know we have at least 2 coords).
      LineString largestLine = lineFactory.createLineString( new Coordinate[]{ coords[0], coords[1] } );
      double largestLineLength = largestLine.getLength();
      for (int coordIndex=2; coordIndex<coords.length; coordIndex++)
      {
        LineString otherLine = lineFactory.createLineString( new Coordinate[]{ coords[coordIndex-1], coords[coordIndex] } );
        double otherLineLength = otherLine.getLength();
        if (otherLineLength > largestLineLength)
        {
          largestLine = otherLine;
          largestLineLength = otherLineLength;
View Full Code Here

    // TODO Create a multi-point for a multi-polygon.
    Coordinate viewCentre = mapArea.getCentroid().getCoordinate();
    Coordinate featureCentre = intersectedFeature.getCentroid().getCoordinate();
   
    Coordinate[] directLineToFeatureCoords = new Coordinate[]{ viewCentre, featureCentre };
    LineString directLineToFeature = geometryFactory.createLineString( directLineToFeatureCoords );
   
    return mapBounds.intersection( directLineToFeature );
  }
 
 
View Full Code Here

      return ctx.makeLineString(Collections.<Point>emptyList());

    GeometryFactory geometryFactory = ctx.getGeometryFactory();

    Coordinate[] coordinates = coordinateSequence(state);
    return makeShapeFromGeometry(geometryFactory.createLineString(coordinates));
  }

  /**
   * Parses a POLYGON shape from the raw string. It might return a {@link com.spatial4j.core.shape.Rectangle}
   * if the polygon is one.
View Full Code Here

        for (int i = 0; i < n; i++) {
            double x = xbase + i * xInc;
            double y = ybase + i * yInc;
            Coordinate p1 = new Coordinate(x, y);
            Coordinate p2 = new Coordinate(x + dx, y + dy);
            lines[i] = gf.createLineString(new Coordinate[]{p1, p2});
        }
        return lines;
    }

    /**
 
View Full Code Here

        coords.add(new Coordinate(0, 1));
        assertEquals(31347480l, values.get(0).get());
        GeometryFactory gf = new GeometryFactory();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder((SimpleFeatureType) featureType.get()
                .type());
        fb.set("geom", gf.createLineString(coords.toArray(new Coordinate[0])));
        fb.set("name", "newname");
        fb.set("id", 31347480l);
        fb.set("nodes", values.get(3).get());
        SimpleFeature newFeature = fb.buildFeature("31347480");
        geogig.getRepository().workingTree().insert("residential", newFeature);
View Full Code Here

        coords.add(new Coordinate(0, 1));
        assertEquals(31347480l, values.get(0).get());
        GeometryFactory gf = new GeometryFactory();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder((SimpleFeatureType) featureType.get()
                .type());
        fb.set("geom", gf.createLineString(coords.toArray(new Coordinate[0])));
        fb.set("name_alias", "newname");
        fb.set("id", 31347480l);
        fb.set("nodes", values.get(3).get());
        SimpleFeature newFeature = fb.buildFeature("31347480");
        geogig.getRepository().workingTree().insert("residential", newFeature);
View Full Code Here

        // create a LineString for display
        Coordinate pathToStreetCoords[] = new Coordinate[2];
        pathToStreetCoords[0] = dropPoint;
        pathToStreetCoords[1] = origin.getCoordinate();
        LineString pathToStreet = gf.createLineString(pathToStreetCoords);

        // get distance between origin and drop point for time correction
        double distanceToRoad = this.distanceLibrary.distance(origin.getY(), origin.getX(),
                dropPoint.y, dropPoint.x);
        long offRoadTimeCorrection = (long) (distanceToRoad / this.offRoadWalkspeed);
View Full Code Here

        List<Geometry> debugGeom = new ArrayList<Geometry>();
        if (debugSeedGrid) {
            for (GridEdge e : initialEdges) {
                Coordinate A = getCoordinate(e.A.index);
                Coordinate B = getCoordinate(e.B.index);
                debugGeom.add(geomFactory.createLineString(new Coordinate[] { A, B }));
            }
            // for (Coordinate p0 : __p0List) {
            // debugGeom.add(geomFactory.createPoint(p0));
            // }
        }
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.