Example usage for com.google.common.geometry S2Polyline S2Polyline

List of usage examples for com.google.common.geometry S2Polyline S2Polyline

Introduction

In this page you can find the example usage for com.google.common.geometry S2Polyline S2Polyline.

Prototype

public S2Polyline(S2Polyline src) 

Source Link

Document

Copy constructor.

Usage

From source file:com.bc.fiduceo.geometry.s2.BcS2GeometryFactory.java

@Override
public LineString createLineString(List<Point> points) {
    final List<S2Point> loopPoints = extractS2Points(points);

    final S2Polyline s2Polyline = new S2Polyline(loopPoints);
    return new BcS2LineString(s2Polyline);
}

From source file:org.geosde.cassandra.GeometryTestCase.java

static S2Polyline makePolyline(String str) {
    List<S2Point> vertices = Lists.newArrayList();
    parseVertices(str, vertices);/*ww  w. ja  v a2s  .  com*/
    return new S2Polyline(vertices);
}

From source file:com.bc.fiduceo.geometry.s2.BcS2TimeAxis.java

S2Polyline createSubLineTo(S2Point intersectionStartPoint) {
    final List<S2Point> vertices = new ArrayList<>();

    final int nearestEdgeIndex = polyline.getNearestEdgeIndex(intersectionStartPoint);
    final S2Point projectedIntersection = polyline.projectToEdge(intersectionStartPoint, nearestEdgeIndex);
    if (nearestEdgeIndex == 0) {
        vertices.add(polyline.vertex(0));
        vertices.add(projectedIntersection);
    } else {/*from w  ww . j a  v a  2s  .  com*/
        for (int i = 0; i <= nearestEdgeIndex; i++) {
            vertices.add(polyline.vertex(i));
        }
        vertices.add(projectedIntersection);
    }

    return new S2Polyline(vertices);
}

From source file:com.bc.geometry.s2.S2WKTReader.java

/**
 * Creates a <code>LineString</code> using the next token in the stream.
 *
 * @return a <code>LineString</code> specified by the next
 * token in the stream/* www. j a  v a 2 s  . c o  m*/
 * @throws IOException              if an I/O error occurs
 * @throws IllegalArgumentException if an unexpected token was encountered
 */
private S2Polyline readLineStringText() throws IOException, IllegalArgumentException {
    return new S2Polyline(getPoints());
}

From source file:com.bc.geometry.s2.S2WKTReader.java

private S2Polyline getMultiLineStringPoints() throws IOException, IllegalArgumentException {
    ArrayList<S2Point> points = new ArrayList<>();
    points.add(getPreciseCoordinate());//from   ww w.j a va  2 s.  co  m
    String nextToken = getNextCloserOrComma();
    while (COMMA.equals(nextToken)) {
        points.add(getPreciseCoordinate());
        nextToken = getNextCloserOrComma();
    }

    if (points.size() > 1 && points.get(0).equals(points.get(points.size() - 1))) {
        points.remove(points.size() - 1);
    }
    return new S2Polyline(points);
}