Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Point


  public void testDistanceFromPointToSimpleLine() throws Exception
  {
    LineString featureGeometry = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "0 0, 100 0" ) );
    this.feature.setDefaultGeometry( featureGeometry );
   
    Point intersectionPoint = this.geometryFactory.createPoint( new Coordinate( 50, 50 ) );
   
    Limb limb = new Limb();
    limb.setFeature( this.feature );
    limb.setIntersection( intersectionPoint );
   
View Full Code Here


   */
  protected void setUpRegularPolygons( Geometry bounds, int numberOfPolygons, Collection<Geometry> polygons )
  {
    Geometry boundingBox = bounds.getEnvelope();
   
    Point centre = boundingBox.getCentroid();
    Coordinate corner = boundingBox.getCoordinates()[0];
    double halfWidth = Math.abs( corner.x - centre.getX() );
    double halfHeight = Math.abs( corner.y - centre.getY() );
    double shapeRadius = Math.min( halfWidth, halfHeight );
   
    for (int i=0; i<numberOfPolygons; i++)
    {
      polygons.add( setUpRegularPolygon( corner, shapeRadius, 4 ) );
View Full Code Here

    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() );
  }
 
  public void testMultiPoint()
  {
    Point point1 = this.geometryFactory.createPoint( new Coordinate( 50.6, 124.59 ) );
    Point point2 = this.geometryFactory.createPoint( new Coordinate( 45.2, 343.93 ) );
    Point point3 = this.geometryFactory.createPoint( new Coordinate( 82.5, 4.5785 ) );
   
    Geometry multiPoint = this.geometryFactory.createMultiPoint( new Point[]{ point1, point2, point3 } );
    this.geoJsonWriter.value( multiPoint );
   
    assertEquals( "{\"type\":\"MultiPoint\",\"coordinates\":[[50.6,124.59],[45.2,343.93],[82.5,4.5785]]}", this.geoJsonBuffer.toString() );
View Full Code Here

 
  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 );
    testObj.setDefaultOffTheMapDistance( 10.0 );
   
    // Ignore is on by default, which is used because no options are specified.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( null );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is off by default, which is used because no options are specified.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( null );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
   
    // Ignore is on by default, which is used because no specific option is specified.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( null );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is off by default, which is used because no specific option is specified.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( null );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
   
    // Ignore is turned on in the options.
    testObj.setDefaultIgnoreVisibleFeatures( false );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( true );
    assertNull( testObj.generateIntersections( lineFeature ) );
   
    // Ignore is turned off in the options.
    testObj.setDefaultIgnoreVisibleFeatures( true );
    testObj.setOptions( options );
    options.setIgnoreVisibleFeatures( false );
    assertTrue( expectedIntersectionPoint.equals( testObj.generateIntersections( lineFeature ) ) );
  }
View Full Code Here

  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 );
    testObj.setDefaultOffTheMapDistance( 1000.0 );
   
    Geometry intersectionPoint = testObj.generateIntersections( featurePolygon );
    assertNotNull( intersectionPoint );
    assertTrue( expectedIntersectionPoint.equals( intersectionPoint ) );
  }
View Full Code Here

  {
    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();
    testObj.setShape( mapBounds );
    testObj.setDefaultOffTheMapDistance( 1000.0 );
   
    Geometry intersectionPoint = testObj.generateIntersections( featurePolygon );
    assertNotNull( intersectionPoint );
    assertTrue( expectedIntersectionPoint.equals( intersectionPoint ) );
  }
View Full Code Here

  public void testVerticalUp() throws Exception
  {
    LineString featureGeometry = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "0 0, 0 40" ) );
    this.feature.setDefaultGeometry( featureGeometry );
   
    Point intersectionPoint = this.geometryFactory.createPoint( new Coordinate( 0, 20 ) );
   
    Limb limb = new Limb();
    limb.setFeature( this.feature );
    limb.setIntersection( intersectionPoint );
   
View Full Code Here

  public void testVerticalDown() throws Exception
  {
    LineString featureGeometry = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "0 40, 0 0" ) );
    this.feature.setDefaultGeometry( featureGeometry );
   
    Point intersectionPoint = this.geometryFactory.createPoint( new Coordinate( 0, 20 ) );
   
    Limb limb = new Limb();
    limb.setFeature( this.feature );
    limb.setIntersection( intersectionPoint );
   
View Full Code Here

  public void testFlat() throws Exception
  {
    LineString featureGeometry = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "0 0, 40 0" ) );
    this.feature.setDefaultGeometry( featureGeometry );
   
    Point intersectionPoint = this.geometryFactory.createPoint( new Coordinate( 20, 0 ) );
   
    Limb limb = new Limb();
    limb.setFeature( this.feature );
    limb.setIntersection( intersectionPoint );
   
View Full Code Here

  public void testIncline() throws Exception
  {
    LineString featureGeometry = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "0 0, 40 40" ) );
    this.feature.setDefaultGeometry( featureGeometry );
   
    Point intersectionPoint = this.geometryFactory.createPoint( new Coordinate( 20, 20 ) );
   
    Limb limb = new Limb();
    limb.setFeature( this.feature );
    limb.setIntersection( intersectionPoint );
   
View Full Code Here

TOP

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

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.