Examples of GeometryFactoryImpl


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

 
  public void testRing() throws Exception {

    PositionFactory positionFactory = new PositionFactoryImpl(crs1, new PrecisionModel());
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(crs1, positionFactory);
    GeometryFactory geometryFactory = new GeometryFactoryImpl(crs1, positionFactory);
   
    List<Position> points1 = new ArrayList<Position>();
    points1.add(primitiveFactory.createPoint( new double[]{-123.47009555832284,48.543261561072285} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.46972894676578,48.55009592117936} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.45463828850829,48.54973520267305} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.4550070827961,48.54290089070186} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.47009555832284,48.543261561072285} ));
    LineString lineString1 = geometryFactory.createLineString(points1);
        List curveSegmentList1 = Collections.singletonList(lineString1);
       
        CurveImpl curve1 = (CurveImpl) primitiveFactory.createCurve(curveSegmentList1);
       
    /* Build Ring from Curve */
    ArrayList<OrientableCurve> curveList = new ArrayList<OrientableCurve>();
    curveList.add(curve1);
   
    RingImplUnsafe ring1 = (RingImplUnsafe) primitiveFactory.createRing(curveList);
    RingImplUnsafe ring2 = (RingImplUnsafe) ring1.transform(crs2);
   
    // create expected result
    PositionFactory expectedPosF2 = new PositionFactoryImpl(crs2, new PrecisionModel());
    PrimitiveFactory expectedPrimF2 = new PrimitiveFactoryImpl(crs2, expectedPosF2);
    GeometryFactory ExpectedGeomF2 = new GeometryFactoryImpl(crs2, expectedPosF2);
   
    List<Position> expectedPoints = new ArrayList<Position>();
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187127.9999999998, 396026.99999999825} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000007, 396027.0000000039} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000005, 395268.0000000018} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
        LineString expectedLineString = ExpectedGeomF2.createLineString(expectedPoints);
        List expectedCurveSegmentList = Collections.singletonList(expectedLineString);
       
        CurveImpl expectedCurve = (CurveImpl) expectedPrimF2.createCurve(expectedCurveSegmentList);
       
    /* Build Ring from Curve */
 
View Full Code Here

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

  }
 
  public void testSurface() throws Exception {
    PositionFactory positionFactory = new PositionFactoryImpl(crs1, new PrecisionModel());
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(crs1, positionFactory);
    GeometryFactory geometryFactory = new GeometryFactoryImpl(crs1, positionFactory);
   
    List<Position> points1 = new ArrayList<Position>();
    points1.add(primitiveFactory.createPoint( new double[]{-123.47009555832284,48.543261561072285} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.46972894676578,48.55009592117936} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.45463828850829,48.54973520267305} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.4550070827961,48.54290089070186} ));
    points1.add(primitiveFactory.createPoint( new double[]{-123.47009555832284,48.543261561072285} ));
    LineString lineString1 = geometryFactory.createLineString(points1);
        List curveSegmentList1 = Collections.singletonList(lineString1);
       
        CurveImpl curve1 = (CurveImpl) primitiveFactory.createCurve(curveSegmentList1);
       
    /* Build Ring from Curve */
    ArrayList<OrientableCurve> curveList = new ArrayList<OrientableCurve>();
    curveList.add(curve1);
   
    // Build Ring then SurfaceBoundary then Surface
    RingImpl exteriors = (RingImpl) primitiveFactory.createRing(curveList);
    List<Ring> interiors = new ArrayList<Ring>();
    SurfaceBoundary sboundary = primitiveFactory.createSurfaceBoundary(exteriors, interiors);
    Surface surface1 = primitiveFactory.createSurface(sboundary);
    Surface surface2 = (SurfaceImpl) surface1.transform(crs2);
   
    // create expected result
    PositionFactory expectedPosF2 = new PositionFactoryImpl(crs2, new PrecisionModel());
    PrimitiveFactory expectedPrimF2 = new PrimitiveFactoryImpl(crs2, expectedPosF2);
    GeometryFactory ExpectedGeomF2 = new GeometryFactoryImpl(crs2, expectedPosF2);
   
    List<Position> expectedPoints = new ArrayList<Position>();
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187127.9999999998, 396026.99999999825} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000007, 396027.0000000039} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000005, 395268.0000000018} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
        LineString expectedLineString = ExpectedGeomF2.createLineString(expectedPoints);
        List expectedCurveSegmentList = Collections.singletonList(expectedLineString);
       
        CurveImpl expectedCurve = (CurveImpl) expectedPrimF2.createCurve(expectedCurveSegmentList);
       
    /* Build Ring from Curve */
 
View Full Code Here

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



  private CurveImpl createCurveA(GeometryBuilder builder) {

    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    // Self-Intersecting Curve
    // CURVE(30 20, 10 50, 100 120, 100 70, 10 140)
    ArrayList<Position> line1 = new ArrayList<Position>();
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{30, 20})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{10, 50})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 120})));
    ArrayList<Position> line2 = new ArrayList<Position>();
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 120})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 70})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{10, 140})));

    /* Setting up Array of these LineStrings */
    ArrayList<CurveSegment> tLineList1 = new ArrayList<CurveSegment>();
    tLineList1.add(tCoordFactory.createLineString(line1));
    tLineList1.add(tCoordFactory.createLineString(line2));

    /* Build Curve */
    return tPrimFactory.createCurve(tLineList1);
   
  }
View Full Code Here

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

   
  }

  private CurveImpl createCurveB(GeometryBuilder builder) {

    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    // Non-Self-Intersecting Curve
    // CURVE(30 20, 10 50, 100 70, 100 120, 10 140)
    ArrayList<Position> line1 = new ArrayList<Position>();
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{30, 20})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{10, 50})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 70})));
    ArrayList<Position> line2 = new ArrayList<Position>();
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 70})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 120})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{10, 140})));

    /* Setting up Array of these LineStrings */
    ArrayList<CurveSegment> tLineList1 = new ArrayList<CurveSegment>();
    tLineList1.add(tCoordFactory.createLineString(line1));
    tLineList1.add(tCoordFactory.createLineString(line2));

    /* Build Curve */
    return tPrimFactory.createCurve(tLineList1);
   
  }
View Full Code Here

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

    return new CurveImpl( positionA.getCoordinateReferenceSystem(), segments )
  }
 
  private void _testCurve(GeometryBuilder builder) {
   
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    PositionImpl p1 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-500}));
    PositionImpl p2 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-3030}));
    PositionImpl p3 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{050}));
    PositionImpl p4 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{3030}));
    PositionImpl p5 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{500}));

    LineStringImpl line1 = null;
   
    ArrayList<Position> positionList = new ArrayList<Position>();
    positionList .add(p1);
    positionList.add(p2);
    positionList.add(p3);
    positionList.add(p4);
    positionList.add(p5);
    line1 = tCoordFactory.createLineString(positionList);

    /* Set parent curve for LineString */
    ArrayList<CurveSegment> tLineList = new ArrayList<CurveSegment>();
    tLineList.add(line1);

    // PrimitiveFactory.createCurve(List<CurveSegment>)
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList);
    //System.out.println("\nCurve1: " + curve1);
   
    assertTrue(curve1.isCycle() == false);
   
    // Set curve for further LineString tests
    line1.setCurve(curve1);

    //System.out.println("\n*** TEST: Curve\n" + curve1);
   
    // ***** getStartPoint()
    //System.out.println("\n*** TEST: .getStartPoint()\n" + curve1.getStartPoint());
    assertTrue(curve1.getStartPoint().getOrdinate(0) == -50);
    assertTrue(curve1.getStartPoint().getOrdinate(1) == 0);
   
    // ***** getEndPoint()
    //System.out.println("\n*** TEST: .getEndPoint()\n" + curve1.getEndPoint());
    assertTrue(curve1.getEndPoint().getOrdinate(0) == 50);
    assertTrue(curve1.getEndPoint().getOrdinate(1) == 0);

    // ***** getStartParam()
    //System.out.println("\n*** TEST: .getStartParam()\n" + curve1.getStartParam());
    assertTrue(curve1.getStartParam() == 0.0);

    // ***** getEndParam()
    //System.out.println("\n*** TEST: .getEndParam()\n" + curve1.getEndParam());
    assertTrue(Math.round(line1.getEndParam()) == 144.0);

    // ***** getStartConstructiveParam()
    //System.out.println("\n*** TEST: .getStartConstructiveParam()\n" + curve1.getStartConstructiveParam());
    assertTrue(curve1.getStartConstructiveParam() == 0.0);

    // ***** getEndConstructiveParam()
    //System.out.println("\n*** TEST: .getEndConstructiveParam()\n" + curve1.getEndConstructiveParam());
    assertTrue(curve1.getEndConstructiveParam() == 1.0);

    // ***** getBoundary()
    //System.out.println("\n*** TEST: .getBoundary()\n" + curve1.getBoundary());
    CurveBoundary cb = curve1.getBoundary();
    assertTrue(cb != null);
    double[] dp = cb.getStartPoint().getDirectPosition().getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0);
    dp = cb.getEndPoint().getDirectPosition().getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0);
   
    // ***** getEnvelope()
    //System.out.println("\n*** TEST: .getEnvelope()\n" + curve1.getEnvelope());
    assertTrue(curve1.getEnvelope() != null);
    dp = curve1.getEnvelope().getLowerCorner().getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0);
    dp = curve1.getEnvelope().getUpperCorner().getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 50);
   
    // ***** forParam(double distance) : DirectPosition
    dp = curve1.forParam(0).getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forParam(curve1.length()).getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forParam(50).getCoordinate();
    ////System.out.println("forParam: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*1000) == -18397);
    assertTrue(Math.round(dp[1]*1000) == 37735);

    // ***** forConstructiveParam(double distance)
    dp = curve1.forConstructiveParam(0.0).getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0.0);

    dp = curve1.forConstructiveParam(1.0).getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forConstructiveParam(50 / curve1.length()).getCoordinate();
    assertTrue(Math.round(dp[0]*1000) == -18397);
    assertTrue(Math.round(dp[1]*1000) == 37735);
   
    // ***** getTangent(double distance)
    dp = curve1.getTangent(0);
    ////System.out.println("tangent: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*1000) == -49445);
    assertTrue(Math.round(dp[1]*1000) == 832);

    dp = curve1.getTangent(40);
    assertTrue(Math.round(dp[0]*100) == -2589);
    assertTrue(Math.round(dp[1]*100) == 3274);

    dp = curve1.getTangent(curve1.getEndParam());
    //System.out.println("tangent: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*100) == 5055);
    assertTrue(Math.round(dp[1]*100) == -83);
   
    // ***** getRepresentativePoint()
    dp = curve1.getRepresentativePoint().getCoordinate();
    ////System.out.print("REPRER" + dp);
    assertTrue(dp[0] == 0);
    assertTrue(dp[1] == 50);
   
   
    // ***** Curve.Merge(Curve)
   
    DirectPosition p6 = tCoordFactory.createDirectPosition(new double[]{8020});
    DirectPosition p7 = tCoordFactory.createDirectPosition(new double[]{13060});
   
    List<DirectPosition> directPositions = new ArrayList<DirectPosition>();
   
    directPositions.add(p5.getDirectPosition());
    directPositions.add(p6);
View Full Code Here

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

  }
 
  private void _testMultiCurve(PicoContainer c) {

    AggregateFactoryImpl af = (AggregateFactoryImpl) c.getComponentInstanceOfType(AggregateFactory.class);
    GeometryFactoryImpl gf = (GeometryFactoryImpl) c.getComponentInstanceOfType( GeometryFactory.class );
    PositionFactory pf = (PositionFactory ) c.getComponentInstanceOfType( PositionFactory.class );
   
    DirectPosition dp1 = pf.createDirectPosition(new double[]{10, 30});
    DirectPosition dp2 = pf.createDirectPosition(new double[]{70, 15});
    LineSegment line1 = gf.createLineSegment(dp1, pf.createDirectPosition(new double[]{20, 40}));
    LineSegment line2 = gf.createLineSegment(dp2, pf.createDirectPosition(new double[]{45, 25}));
    Set<OrientableCurve> curves = new HashSet<OrientableCurve>();
    curves.add( new CurveImpl( line1 ) );
    curves.add( new CurveImpl( line2 ) );
    MultiCurve mc = af.createMultiCurve(curves);
   
View Full Code Here

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

    return new CurveImpl( positionA.getCoordinateReferenceSystem(), segments )
  }
 
  private void _testCurve(GeometryBuilder builder) {
   
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    PositionImpl p1 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-500}));
    PositionImpl p2 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-3030}));
    PositionImpl p3 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{050}));
    PositionImpl p4 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{3030}));
    PositionImpl p5 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{500}));

    LineStringImpl line1 = null;
   
    ArrayList<Position> positionList = new ArrayList<Position>();
    positionList .add(p1);
    positionList.add(p2);
    positionList.add(p3);
    positionList.add(p4);
    positionList.add(p5);
    line1 = tCoordFactory.createLineString(positionList);

    /* Set parent curve for LineString */
    ArrayList<CurveSegment> tLineList = new ArrayList<CurveSegment>();
    tLineList.add(line1);

    // PrimitiveFactory.createCurve(List<CurveSegment>)
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList);
    //System.out.println("\nCurve1: " + curve1);
   
    assertTrue(curve1.isCycle() == false);
   
    // Set curve for further LineString tests
    line1.setCurve(curve1);

    //System.out.println("\n*** TEST: Curve\n" + curve1);
   
    // ***** getStartPoint()
    //System.out.println("\n*** TEST: .getStartPoint()\n" + curve1.getStartPoint());
    assertTrue(curve1.getStartPoint().getOrdinate(0) == -50);
    assertTrue(curve1.getStartPoint().getOrdinate(1) == 0);
   
    // ***** getEndPoint()
    //System.out.println("\n*** TEST: .getEndPoint()\n" + curve1.getEndPoint());
    assertTrue(curve1.getEndPoint().getOrdinate(0) == 50);
    assertTrue(curve1.getEndPoint().getOrdinate(1) == 0);

    // ***** getStartParam()
    //System.out.println("\n*** TEST: .getStartParam()\n" + curve1.getStartParam());
    assertTrue(curve1.getStartParam() == 0.0);

    // ***** getEndParam()
    //System.out.println("\n*** TEST: .getEndParam()\n" + curve1.getEndParam());
    assertTrue(Math.round(line1.getEndParam()) == 144.0);

    // ***** getStartConstructiveParam()
    //System.out.println("\n*** TEST: .getStartConstructiveParam()\n" + curve1.getStartConstructiveParam());
    assertTrue(curve1.getStartConstructiveParam() == 0.0);

    // ***** getEndConstructiveParam()
    //System.out.println("\n*** TEST: .getEndConstructiveParam()\n" + curve1.getEndConstructiveParam());
    assertTrue(curve1.getEndConstructiveParam() == 1.0);

    // ***** getBoundary()
    //System.out.println("\n*** TEST: .getBoundary()\n" + curve1.getBoundary());
    CurveBoundary cb = curve1.getBoundary();
    assertTrue(cb != null);
    double[] dp = cb.getStartPoint().getDirectPosition().getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0);
    dp = cb.getEndPoint().getDirectPosition().getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0);
   
    // ***** getEnvelope()
    //System.out.println("\n*** TEST: .getEnvelope()\n" + curve1.getEnvelope());
    assertTrue(curve1.getEnvelope() != null);
    dp = curve1.getEnvelope().getLowerCorner().getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0);
    dp = curve1.getEnvelope().getUpperCorner().getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 50);
   
    // ***** forParam(double distance) : DirectPosition
    dp = curve1.forParam(0).getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forParam(curve1.length()).getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forParam(50).getCoordinate();
    ////System.out.println("forParam: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*1000) == -18397);
    assertTrue(Math.round(dp[1]*1000) == 37735);

    // ***** forConstructiveParam(double distance)
    dp = curve1.forConstructiveParam(0.0).getCoordinate();
    assertTrue(dp[0] == -50);
    assertTrue(dp[1] == 0.0);

    dp = curve1.forConstructiveParam(1.0).getCoordinate();
    assertTrue(dp[0] == 50);
    assertTrue(dp[1] == 0.0);
   
    dp = curve1.forConstructiveParam(50 / curve1.length()).getCoordinate();
    assertTrue(Math.round(dp[0]*1000) == -18397);
    assertTrue(Math.round(dp[1]*1000) == 37735);
   
    // ***** getTangent(double distance)
    dp = curve1.getTangent(0);
    ////System.out.println("tangent: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*1000) == -49445);
    assertTrue(Math.round(dp[1]*1000) == 832);

    dp = curve1.getTangent(40);
    assertTrue(Math.round(dp[0]*100) == -2589);
    assertTrue(Math.round(dp[1]*100) == 3274);

    dp = curve1.getTangent(curve1.getEndParam());
    //System.out.println("tangent: " + dp[0] + "," + dp[1]);
    assertTrue(Math.round(dp[0]*100) == 5055);
    assertTrue(Math.round(dp[1]*100) == -83);
   
    // ***** getRepresentativePoint()
    dp = curve1.getRepresentativePoint().getCoordinate();
    ////System.out.print("REPRER" + dp);
    assertTrue(dp[0] == 0);
    assertTrue(dp[1] == 50);
   
   
    // ***** Curve.Merge(Curve)
   
    DirectPosition p6 = tCoordFactory.createDirectPosition(new double[]{8020});
    DirectPosition p7 = tCoordFactory.createDirectPosition(new double[]{13060});
   
    List<DirectPosition> directPositions = new ArrayList<DirectPosition>();
   
    directPositions.add(p5.getDirectPosition());
    directPositions.add(p6);
View Full Code Here

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

      MathTransform transform) throws MismatchedDimensionException, TransformException {

    // 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
    LineString lineString = geometryFactory.createLineString(newpositions);
    List curveSegmentList = Collections.singletonList(lineString);
    CurveImpl newCurve = (CurveImpl) primitiveFactory.createCurve(curveSegmentList);
    ArrayList<OrientableCurve> curveList = new ArrayList<OrientableCurve>();
    curveList.add(newCurve);
    Ring newRing = primitiveFactory.createRing(curveList);
View Full Code Here

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

      MathTransform transform) throws MismatchedDimensionException, TransformException {

    // 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
    LineString lineString = geometryFactory.createLineString(newpositions);
    List curveSegmentList = Collections.singletonList(lineString);
    CurveImpl newCurve = (CurveImpl) primitiveFactory.createCurve(curveSegmentList);
    return newCurve;
     
  }
View Full Code Here

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

  public void testMain() {
   
    CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
    PicoContainer container = container( crs ); // normal 2D
   
    GeometryFactoryImpl tGeomFactory = (GeometryFactoryImpl) container.getComponentInstanceOfType(GeometryFactory.class);
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) container.getComponentInstanceOfType( PrimitiveFactoryImpl.class );
    //PositionFactory positionFactory = (PositionFactory ) container.getComponentInstanceOfType( PositionFactory.class );

    // Creates by SurfaceBoundary
    this._testSurface2(tGeomFactory, tPrimFactory);
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.