Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Point


            if(splitLine != null){
                Geometry intersection = splitLine.intersection(segment);
                LineString adaptedSegment = segment;
                if(intersection instanceof Point || intersection instanceof MultiPoint){
                    for( int i = 0; i < intersection.getNumGeometries(); i++ ) {
                        Point vertex = (Point) intersection.getGeometryN(i);
                        adaptedSegment = SplitUtil.insertVertexInLine(adaptedSegment, vertex.getCoordinate());
                    }
                }
                segmentMap.put(adaptedSegment.toText(), adaptedSegment );
            } else { // add the original segment
                segmentMap.put(segment.toText(), segment );
View Full Code Here


      // that point.
      // If not... TODO find a solution if not.
      newPt = GeometryUtil.intersection(offset0.p0, offset0.p1, offset1.p0, offset1.p1);

      GeometryFactory gf = new GeometryFactory();
      Point closestPoint = gf.createPoint(offset0.closestPoint(newPt));

      // calculate the distance
      double distance1 = offset0.distance(closestPoint.getCoordinate());
      double distance2 = offset1.distance(closestPoint.getCoordinate());

      if (distance1 <= deprecateValue || distance2 <= deprecateValue) {
        vertexList.addPt(newPt, false);
      } else {
        // TODO and when the distance is larger ?
View Full Code Here

            return;
        }

        DijkstraIterator.EdgeWeighter weighter = new DijkstraIterator.EdgeWeighter() {
            public double getWeight( Edge e ) {
                Point a = (Point ) e.getNodeA().getObject();
                Point b = (Point ) e.getNodeB().getObject();
                double dx = a.getX() - b.getX();
                double dy = a.getY() - b.getY();

                return Math.sqrt( dx * dx + dy * dy );
            }
        };

View Full Code Here

            }
            this.bounds = new ReferencedEnvelope(DefaultGeographicCRS.WGS84);
           
            String row[];
            while ((row = reader.readNext()) != null) {
                Point point = csv.getPoint( row );
                if( point == null ) {
                    continue; // what is the point
                }
                this.bounds.expandToInclude(point.getCoordinate());
            }
        }
        finally {
            reader.close();
        }
View Full Code Here

            return null;
        }
        Graph graph = (Graph) mapboard.get( "graph" );
        Collection<Node> nodes = (Collection<Node>) graph.getNodes();
        for ( Node node : nodes ) {
            Point p = (Point ) node.getObject();
            double d = getDist( coord, p );
            if ( closest == null || d < minDist ) {
                minDist = d;
                closest = node;
            }
View Full Code Here

            if( waypoints.contains(node)){
                graphics.setColor( Color.BLACK );               
            }
            Object obj = node.getObject();
            if( obj instanceof Point ){
                Point point = (Point) obj;
                java.awt.Point pixel = context.worldToPixel( point.getCoordinate() );
                graphics.fillOval(pixel.x-2, pixel.y-2, 5, 5 );
            }
            if( waypoints.contains(node)){
                graphics.setColor( Color.LIGHT_GRAY );                               
            }
        }
        Collection<Edge> edges = graph.getEdges();
        graphics.setColor( Color.DARK_GRAY );
        for( Edge edge : edges ){
            Object obj = edge.getObject();
            if( path.contains(edge)){
                graphics.setColor( Color.BLACK );
                graphics.setLineWidth(3);
            }
            Node start = edge.getNodeA();
            Node end = edge.getNodeB();
       
            Point startPoint = (Point) start.getObject();
            Point endPoint = (Point) end.getObject();           
            java.awt.Point startPixel = context.worldToPixel( startPoint.getCoordinate() );
            java.awt.Point endPixel = context.worldToPixel( endPoint.getCoordinate() );
           
            graphics.drawLine(startPixel.x, startPixel.y, endPixel.x, endPixel.y);           
            double angle = Angle.angle(startPoint.getCoordinate(), endPoint.getCoordinate());
            double dx = Math.cos( angle+0.1 );
            double dy = Math.sin( angle+0.1 );
            graphics.drawLine(
                    endPixel.x, endPixel.y,
                    (int)(endPixel.x - (10.0*dx)),
 
View Full Code Here

        int lat = csv.getHeader("y");
        while ((row = reader.readNext()) != null) {
            String x = row[lon];
            String y = row[lat];
            System.out.print( "row "+count+": point "+x+" x "+y);
            Point point = csv.getPoint( row );
            System.out.println( "-->"+ point );
           
            count++;
        }
        reader.close();
View Full Code Here

    }
   
    @Ignore
    @Test
    public void testWhere() {
        Point location = null;
        try {
            location = seeker.where("1500 Poydras St, New Orleans, LA");
        } catch (IOException e) {
            e.printStackTrace();
            fail("IOException");
        } catch (XmlRpcException e) {
            e.printStackTrace();
            fail("XmlRpcException");
        }
        assertNotNull( location );
        assertEquals( -90.078377, location.getX(), 0 );
        assertEquals( 29.951663, location.getY(), 0 );
    }
View Full Code Here

            fail("XmlRpcException");
        }
        assertNotNull( features );
        assertEquals( 1, features.size() );
        SimpleFeature feature = features.get(0);
        Point location = ((Geometry)feature.getDefaultGeometry()).getCentroid();
        assertEquals( -90.078377, location.getX(), 0 );
        assertEquals( 29.951663, location.getY(), 0 );
    }
View Full Code Here

    // possible inconsistencies between what the user
    // drawn and the projected result
    GeometryFactory gf = new GeometryFactory();
    CoordinateReferenceSystem layerCrs = LayerUtil.getCrs(editLayer);
    CoordinateReferenceSystem mapCrs = editLayer.getMap().getViewportModel().getCRS();
    Point p1 = gf.createPoint(currentShape.getCoord(0));
    Point p2 = gf.createPoint(currentShape.getCoord(1));
    Point p3 = gf.createPoint(currentShape.getCoord(2));

    try {
      p1 = (Point) GeoToolsUtils.reproject(p1, layerCrs, mapCrs);
      p2 = (Point) GeoToolsUtils.reproject(p2, layerCrs, mapCrs);
      p3 = (Point) GeoToolsUtils.reproject(p3, layerCrs, mapCrs);
    } catch (OperationNotFoundException onfe) {
      throw new RuntimeException(onfe);
    } catch (TransformException te) {
      throw new RuntimeException(te);
    }

    ArcBuilder builder = new ArcBuilder();
    builder.setPoints(p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY());

    // TODO: especificar la cantidad de segmentos por cuadrante
    // mediante una preferencia
    Geometry geom = builder.getGeometry(15);
    if (geom == null) {
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.