Package org.geotools.geometry.iso.topograph2D

Examples of org.geotools.geometry.iso.topograph2D.Coordinate


  public Node(Envelope env, int level) {
    // this.parent = parent;
    this.env = env;
    this.level = level;
    centre = new Coordinate();
    centre.x = (env.getMinX() + env.getMaxX()) / 2;
    centre.y = (env.getMinY() + env.getMaxY()) / 2;
  }
View Full Code Here


    Envelope testEnv = new Envelope(env.getLowerCorner().getOrdinate(X), env
        .getUpperCorner().getOrdinate(X), env.getLowerCorner().getOrdinate(Y), env
        .getUpperCorner().getOrdinate(Y));
    // Take a point on the ring to do the point in ring test
    DirectPosition dp = testRing.getRepresentativePoint();
    Coordinate testPt = new Coordinate(dp.getCoordinate());

    EdgeRing minShell = null;
    Envelope minEnv = null;
    for (Iterator it = shellList.iterator(); it.hasNext();) {
      EdgeRing tryShell = (EdgeRing) it.next();
View Full Code Here

    Map endPoints = new TreeMap();
    for (Iterator i = graph.getEdgeIterator(); i.hasNext();) {
      Edge e = (Edge) i.next();
      int maxSegmentIndex = e.getMaximumSegmentIndex();
      boolean isClosed = e.isClosed();
      Coordinate p0 = e.getCoordinate(0);
      addEndpoint(endPoints, p0, isClosed);
      Coordinate p1 = e.getCoordinate(e.getNumPoints() - 1);
      addEndpoint(endPoints, p1, isClosed);
    }

    for (Iterator i = endPoints.values().iterator(); i.hasNext();) {
      EndpointInfo eiInfo = (EndpointInfo) i.next();
View Full Code Here

          else if (lines1 != null) {
            if (point2 != null) {
              // loop through each linesegment and check for the min distance
              double minDistance = Double.POSITIVE_INFINITY;
              for (int i=0; i<lines1.size(); i++) {
                Coordinate c1 = new Coordinate(point2.getRepresentativePoint().getCoordinate());
                Coordinate cA = new Coordinate(lines1.get(i).getStartPoint().getCoordinate());
                Coordinate cB = new Coordinate(lines1.get(i).getEndPoint().getCoordinate());
                double d = CGAlgorithms.distancePointLine(c1, cA, cB);
                if ( d < minDistance) {
                  minDistance = d;
                  if (minDistance == 0) return 0;
                }
              }
              return minDistance;
            }
            else if (lines2 != null) {
              // loop through each set of linesegments and check for the
              // min distance
              double minDistance = Double.POSITIVE_INFINITY;
              for (int i=0; i<lines1.size(); i++) {
                for (int y=0; y<lines2.size(); y++) {
                  Coordinate A = new Coordinate(lines1.get(i).getStartPoint().getCoordinate());
                  Coordinate B = new Coordinate(lines1.get(i).getEndPoint().getCoordinate());
                  Coordinate C = new Coordinate(lines2.get(y).getStartPoint().getCoordinate());
                  Coordinate D = new Coordinate(lines2.get(y).getEndPoint().getCoordinate());
                  double d = CGAlgorithms.distanceLineLine(A, B, C, D);
                  if ( d < minDistance) {
                    minDistance = d;
                    if (minDistance == 0) return 0;
                  }
                }
              }
              return minDistance;
            }
           
          }
          else if (lines2 != null) {
            if (point1 != null) {
              // loop through each linesegment and check for the min distance
              double minDistance = Double.POSITIVE_INFINITY;
              for (int i=0; i<lines2.size(); i++) {
                Coordinate c1 = new Coordinate(point1.getRepresentativePoint().getCoordinate());
                Coordinate cA = new Coordinate(lines2.get(i).getStartPoint().getCoordinate());
                Coordinate cB = new Coordinate(lines2.get(i).getEndPoint().getCoordinate());
                double d = CGAlgorithms.distancePointLine(c1, cA, cB);
                if ( d < minDistance) {
                  minDistance = d;
                  if (minDistance == 0) return 0;
                }
View Full Code Here

   *
   * @param n
   *            the node to test
   */
  private void filterCoveredNodeToPoint(Node n) {
    Coordinate coord = n.getCoordinate();
    if (!op.isCoveredByLA(coord)) {
      PointImpl pt = new PointImpl(new DirectPositionImpl(crs, coord.getCoordinates()));
      //PointImpl pt = primitiveFactory.createPoint(coord.getCoordinates());
      resultPointList.add(pt);
    }
  }
View Full Code Here

  public Envelope getEnvelope() {
    return env;
  }

  public Coordinate getCentre() {
    return new Coordinate((env.getMinX() + env.getMaxX()) / 2, (env
        .getMinY() + env.getMaxY()) / 2);
  }
View Full Code Here

        mce.startIndex[chainIndex1 + 1], si);
  }

  private void computeIntersectsForChain(int start0, int end0,
      MonotoneChainEdge mce, int start1, int end1, SegmentIntersector ei) {
    Coordinate p00 = pts[start0];
    Coordinate p01 = pts[end0];
    Coordinate p10 = mce.pts[start1];
    Coordinate p11 = mce.pts[end1];
    // Debug.println("computeIntersectsForChain:" + p00 + p01 + p10 + p11);
    // terminating condition for the recursion
    if (end0 - start0 == 1 && end1 - start1 == 1) {
      ei.addIntersections(e, start0, mce.e, start1);
      return;
View Full Code Here

   */
  public void addIntersections(Edge e0, int segIndex0, Edge e1, int segIndex1) {
    if (e0 == e1 && segIndex0 == segIndex1)
      return;
    numTests++;
    Coordinate p00 = e0.getCoordinates()[segIndex0];
    Coordinate p01 = e0.getCoordinates()[segIndex0 + 1];
    Coordinate p10 = e1.getCoordinates()[segIndex1];
    Coordinate p11 = e1.getCoordinates()[segIndex1 + 1];

    li.computeIntersection(p00, p01, p10, p11);
    // if (li.hasIntersection() && li.isProper()) Debug.println(li);
    /**
     * Always record any non-proper intersections. If includeProper is true,
View Full Code Here

  }

  private boolean isBoundaryPoint(LineIntersector li, Collection bdyNodes) {
    for (Iterator i = bdyNodes.iterator(); i.hasNext();) {
      Node node = (Node) i.next();
      Coordinate pt = node.getCoordinate();
      if (li.isIntersection(pt))
        return true;
    }
    return false;
  }
View Full Code Here

   * @return a {@link Coordinate} from <code>testPts</code> which is not in
   *         <code>pts</code>, ' or <code>null</code>
   */
  public static Coordinate ptNotInList(Coordinate[] testPts, Coordinate[] pts) {
    for (int i = 0; i < testPts.length; i++) {
      Coordinate testPt = testPts[i];
      if (CoordinateArrays.indexOf(testPt, pts) < 0)
        return testPt;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.iso.topograph2D.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.