Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LinearRing


    Geometry view = this.geometryFactory.createLinearRing( Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    String featureCoords = "200 -1000,300 2000," // create a 3-linestring intersection on the LHS of the view, with the left edge of the view being the longest of the 3
                         + "400 2000,400 500,410 500,410 2000," // create another intersection smaller than the negligible distance
                         + "500 2000,500 500,900 500,900 2000," // and a third intersection on the top edge of the view
                         + "900 3000,-1000 3000,-1000 -1000,200 -1000"; // and complete the linear ring, going round anti-clockwise to meet to first point
    LinearRing featureBounds = this.geometryFactory.createLinearRing( Utils.createCoords( featureCoords ) );
    Polygon featurePolygon = this.geometryFactory.createPolygon( featureBounds, null );
   
    // These are the intersections we'd expect, given the above  featureCoords
    Collection<Geometry> expectedIntersections = new ArrayList<Geometry>();
    expectedIntersections.add( this.geometryFactory.createLineString( Utils.createCoords( "0 0, 0 1000" ) ) );
View Full Code Here


  }
 
 
  public void testJustOnTheMap()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry upperFeature = this.geometryFactory.createPoint( new Coordinate( 500, 999.9 ) );
    Geometry lowerFeature = this.geometryFactory.createPoint( new Coordinate( 500, 0.1 ) );
    Geometry rightFeature = this.geometryFactory.createPoint( new Coordinate( 999.9, 500 ) );
    Geometry leftFeature = this.geometryFactory.createPoint( new Coordinate( 0.1, 500 ) );
   
View Full Code Here

    assertNull( testObj.generateIntersections( leftFeature ) );
  }
 
  public void testJustOffTheMap()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry upperFeature = this.geometryFactory.createPoint( new Coordinate( 500, 1000.1 ) );
    Geometry lowerFeature = this.geometryFactory.createPoint( new Coordinate( 500, -0.1 ) );
    Geometry rightFeature = this.geometryFactory.createPoint( new Coordinate( 1000.1, 500 ) );
    Geometry leftFeature = this.geometryFactory.createPoint( new Coordinate( -0.1, 500 ) );
   
View Full Code Here

    assertNotNull( testObj.generateIntersections( leftFeature ) );
  }
 
  public void testJustTooFarOffTheMap()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry upperFeature = this.geometryFactory.createPoint( new Coordinate( 500, 2000.1 ) );
    Geometry lowerFeature = this.geometryFactory.createPoint( new Coordinate( 500, -1000.1 ) );
    Geometry rightFeature = this.geometryFactory.createPoint( new Coordinate( 2000.1, 500 ) );
    Geometry leftFeature = this.geometryFactory.createPoint( new Coordinate( -1000.1, 500 ) );
   
View Full Code Here

    assertNull( testObj.generateIntersections( leftFeature ) );
  }
 
  public void testNotJustTooFarOffTheMap()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry upperFeature = this.geometryFactory.createPoint( new Coordinate( 500, 2000.0 ) );
    Geometry lowerFeature = this.geometryFactory.createPoint( new Coordinate( 500, -1000.0 ) );
    Geometry rightFeature = this.geometryFactory.createPoint( new Coordinate( 2000.0, 500 ) );
    Geometry leftFeature = this.geometryFactory.createPoint( new Coordinate( -1000.0, 500 ) );
   
View Full Code Here

    assertNotNull( testObj.generateIntersections( leftFeature ) );
  }
 
  public void testPartlyVisibleFeature()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Geometry lineFeature = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "500 500,500 1500" ) );
    Point expectedIntersectionPoint = this.geometryFactory.createPoint( new Coordinate( 500, 1000 ) );
    Options options = new Options();
    JustOffTheMapIntersectionGenerator testObj = new JustOffTheMapIntersectionGenerator();
    testObj.setShape( mapBounds );
View Full Code Here

    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
  }
 
  public void testPolygonFeature()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    LinearRing featureBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 1200, 1500, 300, 700 ) );
    Polygon featurePolygon = this.geometryFactory.createPolygon( featureBounds, null );
    Point expectedIntersectionPoint = this.geometryFactory.createPoint( new Coordinate( 1000, 500 ) );
   
    JustOffTheMapIntersectionGenerator testObj = new JustOffTheMapIntersectionGenerator();
    testObj.setShape( mapBounds );
View Full Code Here

    assertTrue( expectedIntersectionPoint.equals( intersectionPoint ) );
  }
 
  public void testPolygonFeatureWithPartialIntersection()
  {
    LinearRing mapBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    LinearRing featureBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createCoords( "200 1800,600 2200,1000 2200,600 1800,200 1800" ) );
    // which when intersected with the map bounds produces a half-parallelogram of:  200 1800, 400 2000, 800 2000, 600 1800, 200 1800
    Polygon featurePolygon = this.geometryFactory.createPolygon( featureBounds, null );
    Point expectedIntersectionPoint = this.geometryFactory.createPoint( new Coordinate( 500, 1000 ) );
   
    JustOffTheMapIntersectionGenerator testObj = new JustOffTheMapIntersectionGenerator();
View Full Code Here

  }
 
 
  public void testCornerIntersection()
  {
    LinearRing polygonBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Polygon polygon = this.geometryFactory.createPolygon( polygonBounds, null );
    Geometry example1 = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 500, 1500, 500, 1500 ) );
   
    SimpleIntersectionGenerator testObj = new SimpleIntersectionGenerator();
    System.out.println( "  -- Corner of linear ring" );
View Full Code Here

    assertEquals( "Intersection with polygon does not create points.", "MultiPoint", testObj.generateIntersections( example1 ).getGeometryType() );
  }
 
  public void testTouchIntersection()
  {
    LinearRing polygonBounds = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 0, 1000, 0, 1000 ) );
    Polygon polygon = this.geometryFactory.createPolygon( polygonBounds, null );
    Geometry example1 = this.geometryFactory.createLinearRing( LimbGeneratorTest.Utils.createBoxCoords( 1000, 2000, 1000, 2000 ) );
   
    SimpleIntersectionGenerator testObj = new SimpleIntersectionGenerator();
    System.out.println( "  -- Touch" );
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.