Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Coordinate


    for (int i = 0; i < jsonCoords.length(); i++) {
      JSONObject nextCoord = jsonCoords.getJSONObject(i);
      if (nextCoord == null) {
        throw new UnmarshallException("inner coordinate missing");
      }
      coordinates[i] = new Coordinate(nextCoord.getDouble("x"), nextCoord.getDouble("y"));
    }
    geometry = new LineString(new CoordinateArraySequence(coordinates), factory);
    return geometry;
  }
View Full Code Here


    JSONObject coord = jsonCoords.getJSONObject(0);
    if (coord == null) {
      throw new UnmarshallException("inner coordinate missing");
    }

    Coordinate coordinate = new Coordinate(coord.getDouble("x"), coord.getDouble("y"));
    geometry = new Point(new CoordinateArraySequence(new Coordinate[] {coordinate}), factory);
    return geometry;
  }
View Full Code Here

public class MidpointSplitPointFinder implements ConstraintSplitPointFinder {
    /**
     * Gets the midpoint of the split segment
     */
    public Coordinate findSplitPoint(Segment seg, Coordinate encroachPt) {
        Coordinate p0 = seg.getStart();
        Coordinate p1 = seg.getEnd();
        return new Coordinate((p0.x + p1.x) / 2, (p0.y + p1.y) / 2);
    }
View Full Code Here

  /**
   * returns the closest distance between point p and line segment s
   */
  public static final double distanceFromLineSegment(VectorXZ p, LineSegmentXZ s) {
    LineSegment sJTS = new LineSegment(s.p1.x, s.p1.z, s.p2.x, s.p2.z);
    return sJTS.distance(new Coordinate(p.x, p.z));
  }
View Full Code Here

public class JTSConversionUtil {

  public static final GeometryFactory GF = new GeometryFactory();
 
  public static final Coordinate vectorXZToJTSCoordinate(VectorXZ v) {
    return new Coordinate(v.x, v.z);
  }
View Full Code Here

  public static final Coordinate vectorXZToJTSCoordinate(VectorXZ v) {
    return new Coordinate(v.x, v.z);
  }
 
  public static final Coordinate vectorXYZToJTSCoordinate(VectorXYZ v) {
    return new Coordinate(v.x, v.z, v.y);
  }
View Full Code Here

    int         nPts = ring.length;

  /* For each line edge l = (i-1, i), see if it crosses ray from test point in positive x direction. */
  for (i = 1; i < nPts; i++ ) {
    i1 = i - 1;
    Coordinate p1 = ring[i];
    Coordinate p2 = ring[i1];
    x1 = p1.x - p.x;
    y1 = p1.y - p.y;
    x2 = p2.x - p.x;
    y2 = p2.y - p.y;

View Full Code Here

    // check that this is a valid ring - if not, simply return a dummy value
    if (nPts < 4) return false;

    // algorithm to check if a Ring is stored in CCW order
    // find highest point
    Coordinate hip = ring[0];
    int hii = 0;
    for (int i = 1; i <= nPts; i++) {
      Coordinate p = ring[i];
      if (p.y > hip.y) {
        hip = p;
        hii = i;
      }
    }

    // find different point before highest point
    int iPrev = hii;
    do {
      iPrev = (iPrev - 1) % nPts;
    } while (ring[iPrev].equals(hip) && iPrev != hii);

    // find different point after highest point
    int iNext = hii;
    do {
      iNext = (iNext + 1) % nPts;
    } while (ring[iNext].equals(hip) && iNext != hii);

    Coordinate prev = ring[iPrev];
    Coordinate next = ring[iNext];

    if (prev.equals(hip) || next.equals(hip) || prev.equals(next))
        throw new IllegalArgumentException("degenerate ring (does not contain 3 different points)");

    // translate so that hip is at the origin.
    // This will not affect the area calculation, and will avoid
    // finite-accuracy errors (i.e very small vectors with very large coordinates)
View Full Code Here

  private final int segmentOctant;
  private final boolean isInterior;

  public SegmentNode(NodedSegmentString segString, Coordinate coord, int segmentIndex, int segmentOctant) {
    this.segString = segString;
    this.coord = new Coordinate(coord);
    this.segmentIndex = segmentIndex;
    this.segmentOctant = segmentOctant;
    isInterior = ! coord.equals2D(segString.getCoordinate(segmentIndex));
  }
View Full Code Here

    compute();
  }

  private void compute()
  {
    Coordinate centroid = average(pts);
    intPt = findNearestPoint(centroid, pts);
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Coordinate

Copyright © 2018 www.massapicom. 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.