Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LinearRing


          // when there are more than 1 ring to be eliminated, that
          // means that the eliminatedPoint was a point common between
          // those 2 rings. So now, eliminate the ring that has less
          // size.
          double min = Double.MAX_VALUE;
          LinearRing candidate = null;
          for (LinearRing ring : deletedRings) {
            double size = ring.getCoordinates().length;
            if (size < min) {
              min = size;
              candidate = ring;
View Full Code Here


   * @throws InvalidDistanceException
   */
  private LinearRing improveTheRing(int i, int j, int n, Coordinate[] ringCoords, Boolean forward, int until)
    throws InvalidDistanceException {

    LinearRing result = null;
    int firstIndex, secondIndex, thirdIndex, fourthIndex, untilDifference = 0, ringLength = ringCoords.length;

    untilDifference = calculateUntilDifference(forward, until, j, i, n, ringLength);

    if (forward) {
View Full Code Here

      // if they don't have the same orientation, reverse this ring.
      if (isCCWinputList != isCCWpolygon) {

        CoordinateArrays.reverse(polCoord);
      }
      LinearRing polygonRing = gf.createLinearRing(polCoord);
      ringList.add(polygonRing);
    }
    return ringList;
  }
View Full Code Here

      createdRing.add(createdRing.get(0));
    }

    Coordinate[] createdCoords = createdRing.toArray(new Coordinate[createdRing.size()]);

    LinearRing result = gf.createLinearRing(createdCoords);
    return result;
  }
View Full Code Here

    assertEquals( "{\"type\":\"LineString\",\"coordinates\":[[34.474,843.487],[942.42,4.47452],[3562.4,95633.1]]}", this.geoJsonBuffer.toString() );
  }
 
  public void testPolygon()
  {
    LinearRing exterior = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 5, 0, 5 ) );
    LinearRing hole1 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 1, 2, 1, 2 ) );
    LinearRing hole2 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 3, 4, 3, 4 ) );
   
    Geometry polygon = this.geometryFactory.createPolygon( exterior, new LinearRing[]{ hole1, hole2 } );
    this.geoJsonWriter.value( polygon );
   
    assertEquals( "{\"type\":\"Polygon\",\"coordinates\":[[[0,0],[0,5],[5,5],[5,0],[0,0]],[[1,1],[1,2],[2,2],[2,1],[1,1]],[[3,3],[3,4],[4,4],[4,3],[3,3]]]}", this.geoJsonBuffer.toString() );
View Full Code Here

    assertEquals( "{\"type\":\"MultiLineString\",\"coordinates\":[[[34.474,843.487],[942.42,4.47452],[3562.4,95633.1]],[[34.474,843.487],[942.42,4.47452],[3562.4,95633.1]],[[34.474,843.487],[942.42,4.47452],[3562.4,95633.1]]]}", this.geoJsonBuffer.toString() );
  }
 
  public void testMultiPolygon()
  {
    LinearRing polygon1exterior = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 5, 0, 5 ) );
    LinearRing polygon1hole1 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 1, 2, 1, 2 ) );
    LinearRing polygon1hole2 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 3, 4, 3, 4 ) );
    Polygon polygon1 = this.geometryFactory.createPolygon( polygon1exterior, new LinearRing[]{ polygon1hole1, polygon1hole2 } );
   
    LinearRing polygon2exterior = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 5, 0, 5 ) );
    LinearRing polygon2hole1 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 1, 2, 1, 2 ) );
    LinearRing polygon2hole2 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 3, 4, 3, 4 ) );
    Polygon polygon2 = this.geometryFactory.createPolygon( polygon2exterior, new LinearRing[]{ polygon2hole1, polygon2hole2 } );
   
    LinearRing polygon3exterior = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 5, 0, 5 ) );
    LinearRing polygon3hole1 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 1, 2, 1, 2 ) );
    LinearRing polygon3hole2 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 3, 4, 3, 4 ) );
    Polygon polygon3 = this.geometryFactory.createPolygon( polygon3exterior, new LinearRing[]{ polygon3hole1, polygon3hole2 } );
   
    Geometry multiPolygon = this.geometryFactory.createMultiPolygon( new Polygon[]{ polygon1, polygon2, polygon3 } );
    this.geoJsonWriter.value( multiPolygon );
   
View Full Code Here

    assertEquals( "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[0,0],[0,5],[5,5],[5,0],[0,0]],[[1,1],[1,2],[2,2],[2,1],[1,1]],[[3,3],[3,4],[4,4],[4,3],[3,3]]],[[[0,0],[0,5],[5,5],[5,0],[0,0]],[[1,1],[1,2],[2,2],[2,1],[1,1]],[[3,3],[3,4],[4,4],[4,3],[3,3]]],[[[0,0],[0,5],[5,5],[5,0],[0,0]],[[1,1],[1,2],[2,2],[2,1],[1,1]],[[3,3],[3,4],[4,4],[4,3],[3,3]]]]}", this.geoJsonBuffer.toString() );
  }
 
  public void testGeometryCollection()
  {
    LinearRing exterior = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 5, 0, 5 ) );
    LinearRing hole1 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 1, 2, 1, 2 ) );
    LinearRing hole2 = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 3, 4, 3, 4 ) );
    Geometry polygon = this.geometryFactory.createPolygon( exterior, new LinearRing[]{ hole1, hole2 } );
   
    Geometry point = this.geometryFactory.createPoint( new Coordinate( 50.6, 124.59 ) );
   
    Geometry line = this.geometryFactory.createLineString( new Coordinate[]{ new Coordinate( 34.474, 843.487 ),
View Full Code Here

      double vertexY = centre.y + (Math.sin( angle ) * radius);
      polygonCoords[vertexIndex] = new Coordinate( vertexX, vertexY );
    }
    polygonCoords[numberOfVertices] = polygonCoords[0];
   
    LinearRing polygonRing = this.geometryFactory.createLinearRing( polygonCoords );
    return this.geometryFactory.createPolygon( polygonRing, null );
  }
View Full Code Here

  {
    super.setUp();
   
    this.geometryFactory = new GeometryFactory( new PrecisionModel( PrecisionModel.FLOATING ), 27700 );
   
    LinearRing exampleLinearRing = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 1, 0, 1 ) );
    Polygon examplePolygon = this.geometryFactory.createPolygon( exampleLinearRing, null );
    this.linearRingGeomDescriptor = Utils.createGeometryDescriptor( Utils.createGeometryType( exampleLinearRing ) );
    this.polygonGeomDescriptor = Utils.createGeometryDescriptor( Utils.createGeometryType( examplePolygon ) );
   
    AttributeDescriptor simpleTextAttribute = new AttributeDescriptorImpl( STRING_TYPE, new NameImpl( NAME_ATTRIBUTE_NAME ), 0, 1, true, null );
View Full Code Here

  }
 
  public void testSingleIntersectionOnTopLineOfView() throws Exception
  {
    Geometry view = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    LinearRing featureBounds = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 250, 750, 900, 1900 ) );
    Polygon featurePolygon = this.geometryFactory.createPolygon( featureBounds, null );
   
    // Set the feature geometry into the first polygon.
    GeometryAttribute featureGeometry = Utils.createGeometryAttribute( this.polygonGeomDescriptor, featurePolygon );
    this.feature1.setDefaultGeometryProperty( featureGeometry );
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.LinearRing

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.