Package com.vividsolutions.jts.linearref

Examples of com.vividsolutions.jts.linearref.LocationIndexedLine.extractPoint()


                        int numPoints = ls.getNumPoints();
                        LocationIndexedLine lil = new LocationIndexedLine(ls);
                        int seg = random.nextInt(numPoints);
                        double frac = random.nextDouble();
                        LinearLocation ll = new LinearLocation(seg, frac);
                        c = lil.extractPoint(ll);
                    } else {
                        c = v.getCoordinate();
                    }
                    // perturb
                    double distance = random.nextDouble() * radius;
 
View Full Code Here


   
        LocationIndexedLine index = new LocationIndexedLine(line);
   
        LinearLocation location = index.project(point.getCoordinate());
   
        Coordinate snap = index.extractPoint(location);
   
        Point pt = point.getFactory().createPoint(snap);
   
        return Converters.convert(pt, context); // convert to requested format
    }
View Full Code Here

      SpatialDatabaseRecord record = records.next();
      Geometry geom = record.getGeometry();
      if (geom instanceof LineString) {
        LocationIndexedLine line = new LocationIndexedLine(geom);
        LinearLocation here = line.project(point.getCoordinate());
        Coordinate snap = line.extractPoint(here);
        double distance = snap.distance(point.getCoordinate());
        results.add(new PointResult(layer.getGeometryFactory()
            .createPoint(snap), record, distance));
      } else if (geom instanceof Point) {
                Point here = (Point) geom;
View Full Code Here

    System.out.println("Extracting line from position 0.0 to " + (length / 2) + ": " + line.extractLine(0, length / 2));
    LocationIndexedLine pline = new LocationIndexedLine(geometry);
    System.out.println("Have LocationIndexedLine: " + pline);
    System.out.println("Have start index: " + pline.getStartIndex());
    System.out.println("Have end index: " + pline.getEndIndex());
    System.out.println("Extracting point at start: " + pline.extractPoint(pline.getStartIndex()));
    System.out.println("Extracting point at end: " + pline.extractPoint(pline.getEndIndex()));
    System.out.println("Extracting point at start offset 0.5: " + pline.extractPoint(pline.getStartIndex(), 0.5));
    System.out.println("Extracting point at end offset 0.5: " + pline.extractPoint(pline.getEndIndex(), 0.5));
  }
View Full Code Here

    LocationIndexedLine pline = new LocationIndexedLine(geometry);
    System.out.println("Have LocationIndexedLine: " + pline);
    System.out.println("Have start index: " + pline.getStartIndex());
    System.out.println("Have end index: " + pline.getEndIndex());
    System.out.println("Extracting point at start: " + pline.extractPoint(pline.getStartIndex()));
    System.out.println("Extracting point at end: " + pline.extractPoint(pline.getEndIndex()));
    System.out.println("Extracting point at start offset 0.5: " + pline.extractPoint(pline.getStartIndex(), 0.5));
    System.out.println("Extracting point at end offset 0.5: " + pline.extractPoint(pline.getEndIndex(), 0.5));
  }

  @Test
View Full Code Here

    System.out.println("Have LocationIndexedLine: " + pline);
    System.out.println("Have start index: " + pline.getStartIndex());
    System.out.println("Have end index: " + pline.getEndIndex());
    System.out.println("Extracting point at start: " + pline.extractPoint(pline.getStartIndex()));
    System.out.println("Extracting point at end: " + pline.extractPoint(pline.getEndIndex()));
    System.out.println("Extracting point at start offset 0.5: " + pline.extractPoint(pline.getStartIndex(), 0.5));
    System.out.println("Extracting point at end offset 0.5: " + pline.extractPoint(pline.getEndIndex(), 0.5));
  }

  @Test
  public void testSnapping() throws Exception {
View Full Code Here

    System.out.println("Have start index: " + pline.getStartIndex());
    System.out.println("Have end index: " + pline.getEndIndex());
    System.out.println("Extracting point at start: " + pline.extractPoint(pline.getStartIndex()));
    System.out.println("Extracting point at end: " + pline.extractPoint(pline.getEndIndex()));
    System.out.println("Extracting point at start offset 0.5: " + pline.extractPoint(pline.getStartIndex(), 0.5));
    System.out.println("Extracting point at end offset 0.5: " + pline.extractPoint(pline.getEndIndex(), 0.5));
  }

  @Test
  public void testSnapping() throws Exception {
    if (true)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.