Package org.geotools.geometry.iso

Examples of org.geotools.geometry.iso.PrecisionModel


    container.registerComponentImplementation(PrimitiveFactoryImpl.class);
    container.registerComponentImplementation(Geo2DFactory.class);
   
    // Teach Container about other dependacies needed
    container.registerComponentInstance( crs );
    Precision pr = new PrecisionModel();
    container.registerComponentInstance( pr );
   
    return container;   
  }
View Full Code Here


 
  public void testGoodPoint() throws Exception {
    CoordinateReferenceSystem crs = CRS.decode( "EPSG:4326");   
    assertNotNull( crs );

    PositionFactory positionFactory = new PositionFactoryImpl(crs, new PrecisionModel());
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(crs, positionFactory); // null;
   
    assertEquals( crs, primitiveFactory.getCoordinateReferenceSystem() );
   
    Point point = primitiveFactory.createPoint( new double[]{1,1} );
View Full Code Here

    container.registerComponentImplementation(PrimitiveFactoryImpl.class);
    container.registerComponentImplementation(Geo2DFactory.class);
   
    // Teach Container about other dependacies needed
    container.registerComponentInstance( crs );
    Precision pr = new PrecisionModel();
    container.registerComponentInstance( pr );
   
    return container;   
  }
View Full Code Here

    container.registerComponentImplementation(PrimitiveFactoryImpl.class);
    container.registerComponentImplementation(Geo2DFactory.class);
   
    // Teach Container about other dependacies needed
    container.registerComponentInstance( crs );
    Precision pr = new PrecisionModel();
    container.registerComponentInstance( pr );
   
    return container;   
  }
View Full Code Here

    container.registerComponentImplementation(PrimitiveFactoryImpl.class);
    container.registerComponentImplementation(Geo2DFactory.class);
   
    // Teach Container about other dependacies needed
    container.registerComponentInstance( crs );
    Precision pr = new PrecisionModel();
    container.registerComponentInstance( pr );
   
    return container;   
  }
View Full Code Here

   
  }

  public void testPoint() throws Exception {

    PositionFactory positionFactory = new PositionFactoryImpl(crs1, new PrecisionModel());
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(crs1, positionFactory);
   
    PointImpl point1 = (PointImpl) primitiveFactory.createPoint( new double[]{-123.47009555832284, 48.543261561072285} );
    PointImpl point2 = (PointImpl) point1.transform(crs2);
   
    // create expected result
    PositionFactory expectedPosF2 = new PositionFactoryImpl(crs2, new PrecisionModel());
    PrimitiveFactory expectedPrimF2 = new PrimitiveFactoryImpl(crs2, expectedPosF2);
   
    PointImpl expectedPoint2 = (PointImpl) expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} );
   
    //System.out.println(point1);
View Full Code Here

   
  }

  public void testCurve() throws Exception {

    PositionFactory positionFactory = new PositionFactoryImpl(crs1, new PrecisionModel());
    PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(crs1, positionFactory);
    GeometryFactory geometryFactory = new GeometryFactoryImpl(crs1, positionFactory);
   
    List<Position> points = new ArrayList<Position>();
    points.add(primitiveFactory.createPoint( new double[]{-123.47009555832284,48.543261561072285} ));
    points.add(primitiveFactory.createPoint( new double[]{-123.46972894676578,48.55009592117936} ));
    points.add(primitiveFactory.createPoint( new double[]{-123.45463828850829,48.54973520267305} ));
    points.add(primitiveFactory.createPoint( new double[]{-123.4550070827961,48.54290089070186} ));
        LineString lineString = geometryFactory.createLineString(points);
        List curveSegmentList = Collections.singletonList(lineString);
       
        CurveImpl curve1 = (CurveImpl) primitiveFactory.createCurve(curveSegmentList);
        CurveImpl curve2 = (CurveImpl) curve1.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} ));
View Full Code Here

    assertEquals(curve2, expectedCurve, 0.9);
  }
 
  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} ));
View Full Code Here

        assertTrue( "object equals", surface.equals( (Object) surface2 ));
        assertTrue( "geometry equals", surface.equals( surface2 ));
  }
 
  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} ));
View Full Code Here

    container.registerComponentImplementation(PrimitiveFactoryImpl.class);
    container.registerComponentImplementation(Geo2DFactory.class);
   
    // Teach Container about other dependacies needed
    container.registerComponentInstance( crs );
    Precision pr = new PrecisionModel();
    container.registerComponentInstance( pr );
   
    return container;   
  }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.iso.PrecisionModel

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.