Package org.geotools.geometry.iso.primitive

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


    return (List<DirectPosition>) pos;   
  }

 
  private PointImpl createPointFromWKT(String aWKTpoint) {
    PointImpl rPoint = null;
    WKTReader wktReader = new WKTReader(this.crs);
    try {
      rPoint = (PointImpl) wktReader.read(aWKTpoint);
    } catch (ParseException e) {
      e.printStackTrace();
View Full Code Here


  public void testPositionImpl() {
   
    CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84_3D;
    DirectPosition dp = new DirectPositionImpl(crs, 1, 2, 0);
    PositionImpl pos = new PositionImpl(dp);
    PointImpl point = new PointImpl(dp);
    PositionImpl pos2 = new PositionImpl(point);
   
    assertTrue(pos2.hasPoint());
    assertTrue(point.equals(pos2.getPoint()));
    pos2.setDirectPosition((DirectPositionImpl) dp);
    assertTrue(pos2.getCoordinateDimension() == 3);
   
    // test toString
    String toS = pos2.toString();
View Full Code Here

    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

    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

    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

  /* (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

         
          // 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

      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

    // 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

   *            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

TOP

Related Classes of org.geotools.geometry.iso.primitive.PointImpl

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.