Interpolates the route into even points along the route and adds these to the points list.

@param lineString our route geometry.
@return list of sliced {@link Point}s.
972689
List<Point> sliceRoute(LineString lineString) {
    double distanceMeters = TurfMeasurement.length(lineString, TurfConstants.UNIT_METERS);
    if (distanceMeters <= 0) {
      return Collections.emptyList();
    }

    List<Point> points = new ArrayList<>();
    for (double i = 0; i < distanceMeters; i += distance) {
      Point point = TurfMeasurement.along(lineString, i, TurfConstants.UNIT_METERS);
      points.add(point);
    }
    return points;
  }
481012
public static List<Polygon> createSimpleDirectionArrow( Geometry... geometries ) {
        List<Polygon> polygons = new ArrayList<>();
        for( Geometry geometry : geometries ) {
            for( int i = 0; i < geometry.getNumGeometries(); i++ ) {
                Geometry geometryN = geometry.getGeometryN(i);
                if (geometryN instanceof LineString) {
                    LineString line = (LineString) geometryN;
                    polygons.addAll(makeArrows(line));
                } else if (geometryN instanceof Polygon) {
                    Polygon polygonGeom = (Polygon) geometryN;
                    LineString exteriorRing = polygonGeom.getExteriorRing();
                    polygons.addAll(makeArrows(exteriorRing));
                    int numInteriorRing = polygonGeom.getNumInteriorRing();
                    for( int j = 0; j < numInteriorRing; j++ ) {
                        LineString interiorRingN = polygonGeom.getInteriorRingN(j);
                        polygons.addAll(makeArrows(interiorRingN));
                    }
                }
            }
        }
        return polygons;
    }
471341
private Set<LineString> getSegments(Collection<LineString> lines) {
        Set<LineString> set = new HashSet<>();
        for (LineString line : lines) {
            Coordinate[] cc = line.getCoordinates();
            for (int i = 1; i < cc.length; i++) {
                if (!cc[i - 1].equals(cc[i])) {
                    LineString segment = line.getFactory().createLineString(
                            new Coordinate[]{new Coordinate(cc[i - 1]), new Coordinate(cc[i])});
                    set.add(segment);
                }
            }
        }
        return set;
    }
617095
public static LineString of(Stream<Point> points) {
        return of(points.collect(Collectors.toList()));
    }
1224754
public MultiLineString createMultiLineString(LineString[] lineStrings) {
		if (lineStrings == null) {
			return new MultiLineString(srid, precision);
		}
		LineString[] clones = new LineString[lineStrings.length];
		for (int i = 0; i < lineStrings.length; i++) {
			clones[i] = (LineString) lineStrings[i].clone();
		}
		return new MultiLineString(srid, precision, clones);
	}
557333
private Path2D getPath(double simplifyTolerance, BoundingBox boundingBox,
			ProjectionTransform transform, LineString lineString) {

		Path2D path = null;

		// Try to simplify the number of points in the LineString
		List<Point> lineStringPoints = simplifyPoints(simplifyTolerance,
				lineString.getPoints());

		for (Point point : lineStringPoints) {

			Point projectedPoint = transform.transform(point);

			float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
					projectedPoint.getX());
			float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
					projectedPoint.getY());

			if (path == null) {
				path = new Path2D.Double();
				path.moveTo(x, y);
			} else {
				path.lineTo(x, y);
			}

		}

		return path;
	}
33586
private static LinearRing insertVertexInLinearRing(LineString lineString,
            Point vertexPoint, double tolerance) {
        GeometryLocation geomLocation = EditUtilities.getVertexToSnap(lineString, vertexPoint, tolerance);
        if (geomLocation != null) {
            Coordinate[] coords = lineString.getCoordinates();
            int index = geomLocation.getSegmentIndex();
            Coordinate coord = geomLocation.getCoordinate();
            if (!CoordinateUtils.contains2D(coords, coord)) {
                Coordinate[] ret = new Coordinate[coords.length + 1];
                System.arraycopy(coords, 0, ret, 0, index + 1);
                ret[index + 1] = coord;
                System.arraycopy(coords, index + 1, ret, index + 2, coords.length
                        - (index + 1));
                return FACTORY.createLinearRing(ret);
            }
            return null;
        } else {
            return null;
        }
    }
830867
public static String buildStringFromLines(String... lines) {
		int numChars = lines.length;
		for (String line : lines) {
			numChars += line.length();
		}
		StringBuilder builder = new StringBuilder(numChars);
		for (String line : lines) {
			builder.append(line);
			builder.append('\n');
		}
		return builder.toString();
	}
254413
public MultiPolylineOptions toPolylines(MultiLineString multiLineString) {

        MultiPolylineOptions polylines = new MultiPolylineOptions();

        for (LineString lineString : multiLineString.getLineStrings()) {
            PolylineOptions polyline = toPolyline(lineString);
            polylines.add(polyline);
        }

        return polylines;
    }
1360271
private static MultiLineString splitMultiLineStringWithPoint(MultiLineString multiLineString, Point pointToSplit, double tolerance) {
        ArrayList<LineString> linestrings = new ArrayList<LineString>();
        boolean notChanged = true;
        int nb = multiLineString.getNumGeometries();
        for (int i = 0; i < nb; i++) {
            LineString subGeom = (LineString) multiLineString.getGeometryN(i);
            LineString[] result = splitLineStringWithPoint(subGeom, pointToSplit, tolerance);
            if (result != null) {
                Collections.addAll(linestrings, result);
                notChanged = false;
            } else {
                linestrings.add(subGeom);
            }
        }
        if (!notChanged) {
            return FACTORY.createMultiLineString(linestrings.toArray(new LineString[0]));
        }
        return null;
    }
562006
@NonNull
  private static List<Point> coordAll(@NonNull List<Point> coords, @NonNull LineString lineString) {
    coords.addAll(lineString.coordinates());
    return coords;
  }
580896
public LineString toLineString(List<LatLng> latLngs, boolean hasZ,
                                   boolean hasM) {

        LineString lineString = new LineString(hasZ, hasM);

        populateLineString(lineString, latLngs);

        return lineString;
    }
1192972
public static LineString createDummyLine() {
        Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0)};
        LineString lineString = gf().createLineString(c);
        return lineString;
    }
372501
public List<LineString> lineStrings() {
    List<List<Point>> coordinates = coordinates();
    List<LineString> lineStrings = new ArrayList<>(coordinates.size());
    for (List<Point> points : coordinates) {
      lineStrings.add(LineString.fromLngLats(points));
    }
    return lineStrings;
  }
1118798
public static LinearRing of(Iterable<Point> points) {
        LinearPositions.Builder builder = LinearPositions.builder();
        for(Point point : points) {
            builder.addSinglePosition(point.positions());
        }
        return new LinearRing(builder.build());
    }
388112
public static double[] bbox(@NonNull LineString lineString) {
    List<Point> resultCoords = TurfMeta.coordAll(lineString);
    return bboxCalculator(resultCoords);
  }
1099109
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException {
        if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) {
            return null;
        }
        if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) {
            throw new SQLException("At least two points are required to make a line.");
        }
        List<Coordinate> coordinateList = new LinkedList<Coordinate>();
        addCoordinatesToList(pointA, coordinateList);
        for (Geometry optionalPoint : optionalPoints) {
            addCoordinatesToList(optionalPoint, coordinateList);
        }
        return ((Geometry) pointA).getFactory().createLineString(
                coordinateList.toArray(new Coordinate[optionalPoints.length]));
    }