Package org.geotools.geometry.iso.primitive

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


   *
   * @return primitive representing the envelope of this Geometry
   * @see org.opengis.geometry.coordinate.root.Geometry#getMbRegion()
   */
  public Geometry getMbRegion() {
    PrimitiveFactoryImpl primitiveFactory = new PrimitiveFactoryImpl(crs, getPositionFactory());
    return primitiveFactory.createPrimitive( this.getEnvelope() );
  }
View Full Code Here


    //System.out.println("\n Envelope: " + surface.getEnvelope());
  }
 
  private Curve _createCurve1(GeometryBuilder builder) {
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();

    PositionImpl p1 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-500, 0}));
    PositionImpl p2 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{-3030, 10}));
    PositionImpl p3 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{050, 20}));
    PositionImpl p4 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{3030, 10}));
    PositionImpl p5 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{500, 0}));

    LineStringImpl line1 = null;
   
    ArrayList<Position> positionList = new ArrayList<Position>();
    positionList.add(p1);
    positionList.add(p2);
    positionList.add(p3);
    positionList.add(p4);
    positionList.add(p5);
    try {
      line1 = tCoordFactory.createLineString(positionList);
    } catch (IllegalArgumentException e) {
      //System.out.println(e);
    }

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

    // PrimitiveFactory.createCurve(List<CurveSegment>)
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList);
   
    // Set curve for further LineString tests
    line1.setCurve(curve1);
   
    return curve1;
View Full Code Here

    return curve1;
  }
 
  private Curve _createCurve2(GeometryBuilder builder) {
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();

    PositionImpl p1 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{10, 0, 100}));
    PositionImpl p2 = new PositionImpl(tCoordFactory.createDirectPosition(new double[]{50, 30, 100}));

    LineStringImpl line1 = null;
   
    ArrayList<Position> positionList = new ArrayList<Position>();
    positionList.add(p1);
    positionList.add(p2);
    try {
      line1 = tCoordFactory.createLineString(positionList);
    } catch (IllegalArgumentException e) {
      //System.out.println("e");
    }

    /* Set parent curve for LineString */
    ArrayList<CurveSegment> tLineList = new ArrayList<CurveSegment>();
    tLineList.add(line1);
   
    // PrimitiveFactory.createCurve(List<CurveSegment>)
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList);
   
    // Set curve for further LineString tests
    line1.setCurve(curve1);
   
    return curve1;
View Full Code Here

 
 
 
  private Surface _createSurface1(GeometryBuilder builder) {
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();

    List<DirectPosition> directPositionList = new ArrayList<DirectPosition>();
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {20, 10, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {40, 10, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {50, 40, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {30, 50, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {10, 30, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {20, 10, 100}));

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    Surface surface2 = tPrimFactory.createSurface(surfaceBoundary1);
   
    return surface2;
  }
View Full Code Here

    return surface2;
  }

  public Surface _createSurface2(GeometryBuilder builder) {
    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();

    List<DirectPosition> directPositionList = new ArrayList<DirectPosition>();
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {20, 10, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {40, 10, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {50, 40, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {30, 50, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {10, 30, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {20, 10, 100}));

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    Surface surface2 = tPrimFactory.createSurface(surfaceBoundary1);
   
    return surface2;
  }
View Full Code Here

  }

  private static void _testRing1(GeometryBuilder builder) {

    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    /* Defining Positions for LineStrings */
    ArrayList<Position> line1 = new ArrayList<Position>();
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{50, 20})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{30, 30})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 50})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 70})));

    ArrayList<Position> line2 = new ArrayList<Position>();
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 70})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{40, 80})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{70, 80})));

    ArrayList<Position> line3 = new ArrayList<Position>();
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{70, 80})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{90, 70})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 60})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 40})));

    ArrayList<Position> line4 = new ArrayList<Position>();
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 40})));
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{80, 30})));
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{50, 20})));
   
    /* Setting up Array of these LineStrings */
    ArrayList<CurveSegment> tLineList1 = new ArrayList<CurveSegment>();
    tLineList1.add(tCoordFactory.createLineString(line1));
    tLineList1.add(tCoordFactory.createLineString(line2));

    ArrayList<CurveSegment> tLineList2 = new ArrayList<CurveSegment>();
    tLineList2.add(tCoordFactory.createLineString(line3));
    tLineList2.add(tCoordFactory.createLineString(line4));

    /* Build Curve */
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList1);
    CurveImpl curve2 = tPrimFactory.createCurve(tLineList2);

   
    /* Build Ring */
    ArrayList<OrientableCurve> curveList = new ArrayList<OrientableCurve>();
    curveList.add(curve1);
    curveList.add(curve2);
   
    Ring ring1 = tPrimFactory.createRing(curveList);

    System.out.println(ring1);

    System.out.println(ring1.getEnvelope());
   
View Full Code Here

  }

  private void _testRing1(GeometryBuilder builder) {

    GeometryFactoryImpl tCoordFactory = (GeometryFactoryImpl) builder.getGeometryFactory();
    PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
   
    /* Defining Positions for LineStrings */
    ArrayList<Position> line1 = new ArrayList<Position>();
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{50, 20})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{30, 30})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 50})));
    line1.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 70})));

    ArrayList<Position> line2 = new ArrayList<Position>();
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{20, 70})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{40, 80})));
    line2.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{70, 80})));

    ArrayList<Position> line3 = new ArrayList<Position>();
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{70, 80})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{90, 70})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 60})));
    line3.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 40})));

    ArrayList<Position> line4 = new ArrayList<Position>();
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{100, 40})));
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{80, 30})));
    line4.add(new PositionImpl(tCoordFactory.createDirectPosition(new double[]{50, 20})));
   
    /* Setting up Array of these LineStrings */
    ArrayList<CurveSegment> tLineList1 = new ArrayList<CurveSegment>();
    tLineList1.add(tCoordFactory.createLineString(line1));
    tLineList1.add(tCoordFactory.createLineString(line2));

    ArrayList<CurveSegment> tLineList2 = new ArrayList<CurveSegment>();
    tLineList2.add(tCoordFactory.createLineString(line3));
    tLineList2.add(tCoordFactory.createLineString(line4));

    /* Build Curve */
    CurveImpl curve1 = tPrimFactory.createCurve(tLineList1);
    CurveImpl curve2 = tPrimFactory.createCurve(tLineList2);

   
    /* Build Ring */
    ArrayList<OrientableCurve> curveList = new ArrayList<OrientableCurve>();
    curveList.add(curve1);
    curveList.add(curve2);
   
    Ring ring1 = tPrimFactory.createRing(curveList);

    //System.out.println(ring1);

    //System.out.println(ring1.getEnvelope());
   
View Full Code Here

TOP

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

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.