Search in sources :

Example 1 with GeoJsonPolygon

use of com.google.maps.android.data.geojson.GeoJsonPolygon in project android-maps-utils by googlemaps.

the class MultiGeometryTest method testGetGeometryType.

public void testGetGeometryType() throws Exception {
    ArrayList<LineString> lineStrings = new ArrayList<>();
    lineStrings.add(new LineString(new ArrayList<>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 50)))));
    lineStrings.add(new LineString(new ArrayList<>(Arrays.asList(new LatLng(56, 65), new LatLng(23, 23)))));
    mg = new MultiGeometry(lineStrings);
    assertEquals("MultiGeometry", mg.getGeometryType());
    ArrayList<GeoJsonPolygon> polygons = new ArrayList<GeoJsonPolygon>();
    ArrayList<ArrayList<LatLng>> polygon = new ArrayList<ArrayList<LatLng>>();
    polygon.add(new ArrayList<LatLng>(Arrays.asList(new LatLng(0, 0), new LatLng(20, 20), new LatLng(60, 60), new LatLng(0, 0))));
    polygons.add(new GeoJsonPolygon(polygon));
    polygon = new ArrayList<ArrayList<LatLng>>();
    polygon.add(new ArrayList<LatLng>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 80), new LatLng(10, 15), new LatLng(0, 0))));
    polygon.add(new ArrayList<LatLng>(Arrays.asList(new LatLng(0, 0), new LatLng(20, 20), new LatLng(60, 60), new LatLng(0, 0))));
    polygons.add(new GeoJsonPolygon(polygon));
    mg = new MultiGeometry(polygons);
    assertEquals("MultiGeometry", mg.getGeometryType());
}
Also used : ArrayList(java.util.ArrayList) GeoJsonPolygon(com.google.maps.android.data.geojson.GeoJsonPolygon) LatLng(com.google.android.gms.maps.model.LatLng)

Aggregations

LatLng (com.google.android.gms.maps.model.LatLng)1 GeoJsonPolygon (com.google.maps.android.data.geojson.GeoJsonPolygon)1 ArrayList (java.util.ArrayList)1