Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Point


            String gpsTaggingTolerance = r.getString(14);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            StudyRegion studyRegion = new StudyRegion();
            studyRegion.setId(id);
            studyRegion.setName(name);
            studyRegion.setDescription(description);
            studyRegion.setCurrentRegion(currentRegion);
            studyRegion.setMapZoomLevel(mapZoomLevel);
            studyRegion.setDefaultZoneType(defaultZoneType);
            studyRegion.setUtcOffset(utcOffset);
            studyRegion.setMinimumSoakInterval(minimumSoakInterval);
            studyRegion.setCommercialZoneBlockLength(commercialZoneBlockLength);
            studyRegion.setIndustrialZoneBlockLength(industrialZoneBlockLength);
            studyRegion.setResidentialZoneBlockLength(residentialZoneBlockLength);
            studyRegion.setGpsTaggingTolerance(gpsTaggingTolerance);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            studyRegion.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            studyRegion.setCentroid(centroid);
           
            // and get the map meta data too
            Geometry mapCenterGeom = reader.read(mapCenterWKT);
            Point mapCenterJTS = mapCenterGeom.getCentroid();
            Vertex mapCenterVertex = new Vertex();
            mapCenterVertex.setLat(mapCenterJTS.getY());
            mapCenterVertex.setLng(mapCenterJTS.getX());
            studyRegion.setMapCenter(mapCenterVertex);
           
           
            studyRegionList.add(studyRegion);
      }
View Full Code Here


            String lineString = r.getString(6);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            RoadDetails roadDetails = new RoadDetails();
            roadDetails.setId(id);
            roadDetails.setName(name);
            roadDetails.setDescription(description);
            roadDetails.setTagId(tagId);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            roadDetails.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            roadDetails.setCentroid(centroid);
           
            //TODO: Do we need to include the study region name, description here?
            StudyRegion sr = new StudyRegion();
            sr.setId(regionId);
View Full Code Here

            String lineString = r.getString(6);
           
            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            ZoneDetails zoneDetails = new ZoneDetails();
            zoneDetails.setId(id);
            zoneDetails.setName(name);
            zoneDetails.setDescription(description);
            zoneDetails.setZoneType(zoneType);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            zoneDetails.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            zoneDetails.setCentroid(centroid);
           
            //TODO: do I need to include the study region id, description here?
            zoneDetails.setRegion(region);
           
View Full Code Here

  public void inserir()
  {

    //Ponto Central Foz do Iguacu
    Coordinate coord = new Coordinate(-25.4607 -54.5820);
    Point location = new GeometryFactory().createPoint(coord);
    location.setSRID(4326);
   
   
    Geotwitt twitt = new Geotwitt();
    twitt.setAutor("rafikdabahia");
    twitt.setMensagem("Testando o nosso primeiro #geotwitt com localizacao");
View Full Code Here

  @Transactional(readOnly = true)
  public CensusLookupResponse findByCoordinates(
      CensusGeographyEnum geographyType, double longitude, double latitude) {

    // WGS84 hard coded for now
    Point point = GeometryUtil.getPoint(longitude, latitude, 4326);
    CensusLookupResponse apiResponse = new CensusLookupResponse();
    CensusLookupBaseResponse censusLookupBaseResponse = new CensusLookupBaseResponse();
    apiResponse.setCensusLookupBaseResponse(censusLookupBaseResponse);
    List<String> messages = apiResponse.getMessageList();
    ValidationUtil.isValidCensusGeographyType(apiResponse, geographyType);
View Full Code Here

    public static Point getPoint(double longitude, double latitude, int srid) {
        GeometryFactory geometryFactory = new GeometryFactory();
        Coordinate coordinate = new Coordinate();
        coordinate.x = longitude;
        coordinate.y = latitude;
        Point point = geometryFactory.createPoint(coordinate);
        point.setSRID(srid);
        return point;
    }
View Full Code Here

    // Have two intersections (a line and a point) on each edge.
    LineString topEdgeLine = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "200 1000, 400 1000" ) );
    LineString bottomEdgeLine = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "200 0, 400 0" ) );
    LineString leftEdgeLine = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords(   "0 200, 0 400" ) );
    LineString rightEdgeLine = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "1000 200, 1000 400" ) );
    Point topEdgePoint = this.geometryFactory.createPoint( new Coordinate( 500, 1000 ) );
    Point bottomEdgePoint = this.geometryFactory.createPoint( new Coordinate( 500, 0 ) );
    Point leftEdgePoint = this.geometryFactory.createPoint( new Coordinate( 0, 500 ) );
    Point rightEdgePoint = this.geometryFactory.createPoint( new Coordinate( 1000, 500 ) );
    Geometry intersection = this.geometryFactory.createGeometryCollection( new Geometry[]{ topEdgeLine, topEdgePoint, bottomEdgeLine, bottomEdgePoint, leftEdgeLine, leftEdgePoint, rightEdgeLine, rightEdgePoint } );
   
    // We'd expect each edge to be 'registered' just once (no duplicates).
    Set<Edge> expectedEdges = new HashSet<Edge>( 4 );
    expectedEdges.add( Edge.TOP );
View Full Code Here

  {
    final double expectedScreenX = 200.1;
    final double expectedScreenY = 100.2;
    final double x = this.defaultViewEnvelope.getMinX() + (2 * expectedScreenX);
    final double y = this.defaultViewEnvelope.getMinY() + (2 * expectedScreenY);
    Point point = this.geometryFactory.createPoint( new Coordinate( x, y ) );
   
    Limb limb = new Limb();
    limb.setIntersection( point );
   
    Options options = new Options();
View Full Code Here

  {
    final double expectedScreenX = 5731.1;
    final double expectedScreenY = 1400.2;
    final double x = this.defaultViewEnvelope.getMinX() + (expectedScreenX / 3);
    final double y = this.defaultViewEnvelope.getMinY() + (expectedScreenY/ 3);
    Point point = this.geometryFactory.createPoint( new Coordinate( x, y ) );
   
    Limb limb = new Limb();
    limb.setIntersection( point );
   
    Options options = new Options();
View Full Code Here

    final double y1 = this.defaultViewEnvelope.getMinY() + (2 * expectedScreenY1);
    final double expectedScreenX2 = 952.5;
    final double expectedScreenY2 = 385.9;
    final double x2 = this.defaultViewEnvelope.getMinX() + (2 * expectedScreenX2);
    final double y2 = this.defaultViewEnvelope.getMinY() + (2 * expectedScreenY2);
    Point point = this.geometryFactory.createPoint( new Coordinate( x1, y1 ) );
    LineString line = this.geometryFactory.createLineString( LimbGeneratorTest.Utils.createCoords( "" + x1 + " " + y1 +", " + x2 + " " + y2 ) );
    MultiLineString multiLine = this.geometryFactory.createMultiLineString( new LineString[]{ line, line } );
    GeometryCollection innerCollection = this.geometryFactory.createGeometryCollection( new Geometry[]{ point, line } );
    GeometryCollection outerCollection = this.geometryFactory.createGeometryCollection( new Geometry[]{ multiLine, innerCollection } );
    // It's important to re-use the same line object multiple times.
    // We're then able to verify that the cloning process takes a deep copy of the geometry collection.
    // A shallow copy will result in the transform being applied several times to the same line object.
    // (Interestingly, outerCollection.clone() takes a deep copy
    //  but GeometryFactory::createGeometry( outerCollection ) takes a shallow copy.)
   
    Limb limb = new Limb();
    limb.setIntersection( outerCollection );
   
    Options options = new Options();
    options.setScreenSize( this.halfScreenSize );
   
    PositionAssignmentLimbRefiner testObj = new PositionAssignmentLimbRefiner();
    testObj.refine( limb, this.defaultView, options );
   
    assertTrue( limb.getPosition() instanceof GeometryCollection );
    GeometryCollection position = (GeometryCollection)limb.getPosition();
    assertTrue( position.getGeometryN( 0 ) instanceof MultiLineString );
    MultiLineString position1 = (MultiLineString)position.getGeometryN( 0 );
    assertTrue( position1.getGeometryN( 0 ) instanceof LineString );
    LineString multiLine1 = (LineString)position1.getGeometryN( 0 );
    assertEquals( expectedScreenX1, multiLine1.getCoordinateN( 0 ).x, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY1, multiLine1.getCoordinateN( 0 ).y, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenX2, multiLine1.getCoordinateN( 1 ).x, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY2, multiLine1.getCoordinateN( 1 ).y, DOUBLE_TOLERANCE );
    assertTrue( position1.getGeometryN( 1 ) instanceof LineString );
    LineString multiLine2 = (LineString)position1.getGeometryN( 1 );
    assertEquals( expectedScreenX1, multiLine2.getCoordinateN( 0 ).x, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY1, multiLine2.getCoordinateN( 0 ).y, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenX2, multiLine2.getCoordinateN( 1 ).x, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY2, multiLine2.getCoordinateN( 1 ).y, DOUBLE_TOLERANCE );
    assertTrue( position.getGeometryN( 1 ) instanceof GeometryCollection );
    GeometryCollection position2 = (GeometryCollection)position.getGeometryN( 1 );
    assertTrue( position2.getGeometryN( 0 ) instanceof Point );
    Point point1 = (Point)position2.getGeometryN( 0 );
    assertEquals( expectedScreenX1, point1.getX(), DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY1, point1.getY(), DOUBLE_TOLERANCE );
    assertTrue( position2.getGeometryN( 1 ) instanceof LineString );
    LineString line1 = (LineString)position2.getGeometryN( 1 );
    assertEquals( expectedScreenX1, line1.getCoordinateN( 0 ).x, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenY1, line1.getCoordinateN( 0 ).y, DOUBLE_TOLERANCE );
    assertEquals( expectedScreenX2, line1.getCoordinateN( 1 ).x, DOUBLE_TOLERANCE );
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.