Package org.geotools.geometry.iso.coordinate

Examples of org.geotools.geometry.iso.coordinate.DirectPositionImpl


   */
  public static List<Position> toPositionList(
      CoordinateReferenceSystem crs, Coordinate[] coordArray) {
    List<Position> rList = new ArrayList<Position>();
    for (int i = 0; i < coordArray.length; i++) {
      DirectPositionImpl position = new DirectPositionImpl( crs, coordArray[i].getCoordinates() );
      rList.add( new PositionImpl((DirectPosition)position.clone()) );
      //rList.add(coordinateFactory.createPosition(coordArray[i].getCoordinates()));
    }
    return rList;
  }
View Full Code Here


    // loop through each point in this Ring and transform it to the new CRS, then
    // use the new points to build a new Ring and return that.
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(newCRS, getPositionFactory());
    GeometryFactory geometryFactory = new GeometryFactoryImpl(newCRS, getPositionFactory());
   
    DirectPositionImpl dp1 = null;
    List<DirectPosition> currentpositions = this.asDirectPositions();
    Iterator<DirectPosition> iter = currentpositions.iterator();
    List<Position> newpositions = new ArrayList<Position>();
    while (iter.hasNext()) {
      DirectPosition thispos = (DirectPosition) iter.next();
     
      dp1 = new DirectPositionImpl(newCRS);
      dp1 = (DirectPositionImpl) transform.transform( thispos, dp1);
      newpositions.add(dp1);
    }
   
    // use the new positions list to build a new Ring and return it
View Full Code Here

   */
  public static List<DirectPositionImpl> toDirectPositionList(
      CoordinateReferenceSystem crs, Coordinate[] coordArray) {
    List<DirectPositionImpl> rList = new ArrayList<DirectPositionImpl>();
    for (int i = 0; i < coordArray.length; i++) {
      rList.add(new DirectPositionImpl( crs, coordArray[i].getCoordinates() ));
    }
    return rList;
  }
View Full Code Here

    Position p1 = cs0.getEndPosition();

    Point pt0 = toPoint( p0 );
    Point pt1 = toPoint( p1 );
    if (pt0 == null) {
      DirectPositionImpl copy = new DirectPositionImpl(p0.getDirectPosition());
      pt0 = new PointImpl(copy);
      //pt0 = this.getFeatGeometryFactory().getPrimitiveFactory().createPoint(p0);
    }
    if (pt1 == null) {
      DirectPositionImpl copy = new DirectPositionImpl(p1.getDirectPosition());
      pt1 = new PointImpl(copy);
      //pt1 = this.getFeatGeometryFactory().getPrimitiveFactory().createPoint(p1);
    }
    // Calculate and Set Boundary
    this.boundary = this.calculateBoundary(pt0, pt1);
View Full Code Here

    }
    private Point toPoint( Position position ){
        if( position instanceof Point ){
            return (Point) position;
        }
        return new PointImpl( new DirectPositionImpl(position));       
    }
View Full Code Here

    // Test OK
    // Create a new Curve by cloning the direct positions which define the control points of this curve
    List<DirectPosition> dPList = this.asDirectPositions();
    List<DirectPosition> newDPList = new ArrayList<DirectPosition>();
    for (int i=0; i<dPList.size(); i++) {
      newDPList.add( new DirectPositionImpl( dPList.get(i) ));
    }

    List<Position> rPositions = new LinkedList<Position>();
    for (int i = 0; i < newDPList.size(); i++) {
      rPositions.add(new PositionImpl(newDPList.get(i)));
View Full Code Here

    // loop through each point in this curve and transform it to the new CRS, then
    // use the new points to build a new curve and return that.
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(newCRS, getPositionFactory());
    GeometryFactory geometryFactory = new GeometryFactoryImpl(newCRS, getPositionFactory());
   
    DirectPositionImpl dp1 = null;
    List<DirectPosition> currentpositions = asDirectPositions();
    Iterator<DirectPosition> iter = currentpositions.iterator();
    List<Position> newpositions = new ArrayList<Position>();
    while (iter.hasNext()) {
      DirectPosition thispos = (DirectPosition) iter.next();
      dp1 = new DirectPositionImpl(newCRS);
      dp1 = (DirectPositionImpl) transform.transform(thispos, dp1);
      newpositions.add(dp1);
    }
   
    // use the new positions list to build a new curve and return it
View Full Code Here

      }
    }
  }

  public DirectPositionImpl getCentroid() {
    DirectPositionImpl centroid =  new DirectPositionImpl(crs); //this.factory.getGeometryFactoryImpl().createDirectPosition();
    centroid.setX(this.centSumX / 3 / this.areasum2);
    centroid.setY(this.centSumY / 3 / this.areasum2);
    return centroid;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.geotools.geometry.featgeom.root.GeometryImpl#getEnvelope()
   */
  public Envelope getEnvelope() {
    EnvelopeImpl env = new EnvelopeImpl(new DirectPositionImpl( getCoordinateReferenceSystem(), (new double[] {Double.NaN, Double.NaN})) );
    Iterator<? extends Geometry> elementIter = this.elements.iterator();
    while (elementIter.hasNext()) {
      env.add((EnvelopeImpl)((Primitive)elementIter.next()).getEnvelope());
    }
    return env;   
View Full Code Here

      // if no points, return null
      return null;
    }
    if (inputPts.length == 1) {
      // 1 point: return Point
      return new PointImpl( new DirectPositionImpl(crs, inputPts[0].getCoordinates()) ); //this.geomFactory.getPrimitiveFactory().createPoint(inputPts[0].getCoordinate());
    }
    if (inputPts.length == 2) {
      List<Position> positions = CoordinateArrays.toPositionList(this.crs, this.inputPts);
      LineStringImpl lineString = new LineStringImpl(new PointArrayImpl(positions), 0.0);
      List<CurveSegment> segments = new ArrayList<CurveSegment>();
View Full Code Here

TOP

Related Classes of org.geotools.geometry.iso.coordinate.DirectPositionImpl

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.