use of com.google.maps.android.data.Geometry in project android-maps-utils by googlemaps.
the class KmlMultiGeometryTest method createMultiGeometry.
public KmlMultiGeometry createMultiGeometry() {
ArrayList<Geometry> kmlGeometries = new ArrayList<Geometry>();
ArrayList<LatLng> coordinates = new ArrayList<LatLng>();
coordinates.add(new LatLng(0, 0));
coordinates.add(new LatLng(50, 50));
coordinates.add(new LatLng(100, 100));
Geometry kmlGeometry = new KmlLineString(coordinates);
kmlGeometries.add(kmlGeometry);
return new KmlMultiGeometry(kmlGeometries);
}
use of com.google.maps.android.data.Geometry in project android-maps-utils by googlemaps.
the class GeoJsonMultiLineString method getLineStrings.
/**
* Gets a list of GeoJsonLineStrings
*
* @return list of GeoJsonLineStrings
*/
public List<GeoJsonLineString> getLineStrings() {
// Convert list of Geometry types to list of GeoJsonLineString types
List<Geometry> geometryList = getGeometryObject();
ArrayList<GeoJsonLineString> geoJsonLineStrings = new ArrayList<GeoJsonLineString>();
for (Geometry geometry : geometryList) {
GeoJsonLineString lineString = (GeoJsonLineString) geometry;
geoJsonLineStrings.add(lineString);
}
return geoJsonLineStrings;
}
use of com.google.maps.android.data.Geometry in project android-maps-utils by googlemaps.
the class GeoJsonMultiPoint method getPoints.
/**
* Gets a list of GeoJsonPoints
*
* @return list of GeoJsonPoints
*/
public List<GeoJsonPoint> getPoints() {
//convert list of Geometry types to list of GeoJsonPoint types
List<Geometry> geometryList = getGeometryObject();
ArrayList<GeoJsonPoint> geoJsonPoints = new ArrayList<GeoJsonPoint>();
for (Geometry geometry : geometryList) {
GeoJsonPoint point = (GeoJsonPoint) geometry;
geoJsonPoints.add(point);
}
return geoJsonPoints;
}
use of com.google.maps.android.data.Geometry in project android-maps-utils by googlemaps.
the class GeoJsonMultiPolygon method getPolygons.
/**
* Gets a list of GeoJsonPolygons
*
* @return list of GeoJsonPolygons
*/
public List<GeoJsonPolygon> getPolygons() {
//convert list of Geometry types to list of GeoJsonPolygon types
List<Geometry> geometryList = getGeometryObject();
ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>();
for (Geometry geometry : geometryList) {
GeoJsonPolygon polygon = (GeoJsonPolygon) geometry;
geoJsonPolygon.add(polygon);
}
return geoJsonPolygon;
}
use of com.google.maps.android.data.Geometry in project android-maps-utils by googlemaps.
the class GeoJsonParser method parseGeometryToFeature.
/**
* Converts a Geometry object into a GeoJsonFeature object. A geometry object has no ID,
* properties or bounding box so it is set to null.
*
* @param geoJsonGeometry Geometry object to convert into a Feature object
* @return new Feature object
*/
private static GeoJsonFeature parseGeometryToFeature(JSONObject geoJsonGeometry) {
Geometry geometry = parseGeometry(geoJsonGeometry);
if (geometry != null) {
return new GeoJsonFeature(geometry, null, new HashMap<String, String>(), null);
}
Log.w(LOG_TAG, "Geometry could not be parsed");
return null;
}
Aggregations