Examples of PointImpl


Examples of org.geotools.geometry.iso.primitive.PointImpl

    DirectPosition dp1 = pf.createDirectPosition(new double[]{10, 30});
    DirectPosition dp2 = pf.createDirectPosition(new double[]{70, 15});
    DirectPosition dp3 = pf.createDirectPosition(new double[]{45, 5});
    DirectPosition dp4 = pf.createDirectPosition(new double[]{10, 35});
    Set<Point> points = new HashSet<Point>();
    points.add( new PointImpl(dp1) );
    points.add( new PointImpl(dp2) );
    points.add( new PointImpl(dp3) );
    points.add( new PointImpl(dp4) );
    MultiPoint mp = af.createMultiPoint(points);
   
    assertNotNull(mp);
    assertNotNull(mp.getEnvelope());
    assertEquals(mp.getCoordinateDimension(), 2);
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

    if (generator == null)
      throw new IllegalArgumentException(
          "Could not create the boundary of CompositeCurve."); //$NON-NLS-1$
    HashSet<Complex> result = new HashSet<Complex>();
    result.add( new CurveBoundaryImpl( getCoordinateReferenceSystem(),
        new PointImpl( ((CurveImpl) generator
            .get(0)).getStartPoint()), new PointImpl( ((CurveImpl) generator
                .get(0)).getEndPoint()) ) );

    return result;
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

    if (start.equals(end))
      // the boundary is null if the composite curve is closed
      return null;
    else
      return new CurveBoundaryImpl(getCoordinateReferenceSystem(),
          new PointImpl(start),
          new PointImpl(end));
      //return this.getFeatGeometryFactory().getPrimitiveFactory().createCurveBoundary(start, end);
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

  /* (non-Javadoc)
   * @see org.opengis.geometry.primitive.CurveSegment#getBoundary()
   */
  public CurveBoundaryImpl getBoundary() {
    return new CurveBoundaryImpl(this.getCurve().getCoordinateReferenceSystem(),
        new PointImpl(this.getStartPoint()),
        new PointImpl(this.getEndPoint()) );
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

         
          // ensure both this and the given geometry are either points or
          // linesegments so we can use the CGAlrogrithm calculations.
          List<LineSegment> lines1 = null;
          List<LineSegment> lines2 = null;
          PointImpl point1 = null;
          PointImpl point2 = null;
         
          // convert this geom
          if (this instanceof PointImpl) {
            point1 = (PointImpl) this;
          }
          else if (this instanceof CurveImpl) {
            lines1 = ((CurveImpl)this).asLineSegments();
          }
          else if (this instanceof RingImplUnsafe) {
            lines1 = ((RingImplUnsafe)this).asLineString().asLineSegments();
          }
          else if (this instanceof RingImpl) {
            lines1 = ((RingImpl)this).asLineString().asLineSegments();
          }
          else if (this instanceof SurfaceImpl) {
            lines1 = ((RingImplUnsafe)((SurfaceImpl)this).getBoundary().getExterior()).asLineString().asLineSegments();
          }
         
          // convert given geom
          if (geometry instanceof PointImpl) {
            point2 = (PointImpl) geometry;
          }
          else if (geometry instanceof CurveImpl) {
            lines2 = ((CurveImpl)geometry).asLineSegments();
          }
          else if (geometry instanceof RingImplUnsafe) {
            lines2 = ((RingImplUnsafe)geometry).asLineString().asLineSegments();
          }
          else if (geometry instanceof RingImpl) {
            lines2 = ((RingImpl)geometry).asLineString().asLineSegments();
          }
          else if (geometry instanceof SurfaceImpl) {
            lines2 = ((RingImplUnsafe)((SurfaceImpl)geometry).getBoundary().getExterior()).asLineString().asLineSegments();
          }
         
          // now determine which algorithm to use for finding the shortest
          // distance between the two geometries
          if (point1 != null && point2 != null) {
            // use directposition.distance()
            return point1.getPosition().distance(point2.getPosition());
          }
          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;
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

      Set<? extends Primitive> elems = ((MultiPrimitiveImpl)this).getElements();
      Iterator<? extends Primitive> iter = elems.iterator();
      while (iter.hasNext()) {
        Geometry prim = iter.next();
        if (prim.getDimension(null) == maxD) {
          cp.add(new PointImpl(prim.getCentroid()));
        }
      }
     
      // return the average of the centroid points
      return cp.getCentroid();
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

    // Return false, if the point doesn´t lie in the envelope of this object
    if (!((EnvelopeImpl)this.getEnvelope()).intersects(position))
      return false;
   
    GeometryImpl point = new PointImpl( position );
    return point.within(this);
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

   *            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

Examples of org.geotools.geometry.iso.primitive.PointImpl

              LineSegmentImpl seg = new LineSegmentImpl(p1, p2, 0);
              //(LineSegmentImpl)cf.createLineSegment(cf.createPosition(this.forParam(actualParam)),cf.createPosition(this.forParam(actualParam+newSpacing)));

              /* Search maximum of all distances */
              CurveImpl curve = new CurveImpl(seg);
              maxDistance = curve.distance( new PointImpl(segments.get(firstSegment).getStartPoint()) );
              //maxDistance = seg.distance(segments.get(firstSegment).getStartPoint());
              double actDistance = 0;
              for (i=firstSegment; i<lastSegment; i++) {
                actDistance = curve.distance( new PointImpl(segments.get(i).getEndPoint()) );
                //actDistance = seg.distance(segments.get(i).getEndPoint());
                if (actDistance > maxDistance) {
                  maxDistance = actDistance;
                }
              }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

    if (position instanceof DirectPosition || position instanceof DirectPositionImpl) {
      DirectPositionImpl dp = (DirectPositionImpl) position;
      return dp.equals(obj);
    }
    else if (position instanceof Point || position instanceof PointImpl) {
      PointImpl point = (PointImpl) position;
      return point.equals(obj);
    }
    else {
      return position.equals(obj);
    }
  }
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.