LineString implements CoordinateContainer<List<Point>> { public static LineString fromLngLats(@NonNull MultiPoint multiPoint) { return new LineString(TYPE, null, multiPoint.coordinates()); } LineString(String type, @Nullable BoundingBox bbox, List<Point> coordinates); static LineString fromJson(String json); static LineString fromLngLats(@NonNull MultiPoint multiPoint); static LineString fromLngLats(@NonNull List<Point> points); static LineString fromLngLats(@NonNull List<Point> points, @Nullable BoundingBox bbox); static LineString fromLngLats(@NonNull MultiPoint multiPoint, @Nullable BoundingBox bbox); static LineString fromPolyline(@NonNull String polyline, int precision); @NonNull @Override String type(); @Nullable @Override BoundingBox bbox(); @NonNull @Override List<Point> coordinates(); @Override String toJson(); String toPolyline(int precision); static TypeAdapter<LineString> typeAdapter(Gson gson); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void sanity() throws Exception { List<Point> points = new ArrayList<>(); points.add(Point.fromLngLat(1.0, 1.0)); points.add(Point.fromLngLat(2.0, 2.0)); points.add(Point.fromLngLat(3.0, 3.0)); LineString lineString = LineString.fromLngLats(points); assertNotNull(lineString); }
@Test public void testSerializable() throws Exception { List<Point> points = new ArrayList<>(); points.add(Point.fromLngLat(1.0, 1.0)); points.add(Point.fromLngLat(2.0, 2.0)); points.add(Point.fromLngLat(3.0, 3.0)); BoundingBox bbox = BoundingBox.fromLngLats(1.0, 2.0, 3.0, 4.0); LineString lineString = LineString.fromLngLats(points, bbox); byte[] bytes = serialize(lineString); assertEquals(lineString, deserialize(bytes, LineString.class)); }