use of mil.nga.sf.MultiPoint in project geopackage-android-map by ngageoint.
the class GoogleMapShapeConverter method addToMap.
/**
* Convert a {@link Geometry} to a Map shape and add it
*
* @param map google map
* @param geometry geometry
* @return google map shape
*/
@SuppressWarnings("unchecked")
public GoogleMapShape addToMap(GoogleMap map, Geometry geometry) {
GoogleMapShape shape = null;
GeometryType geometryType = geometry.getGeometryType();
switch(geometryType) {
case POINT:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MARKER, addLatLngToMap(map, toLatLng((Point) geometry)));
break;
case LINESTRING:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.POLYLINE, addPolylineToMap(map, toPolyline((LineString) geometry)));
break;
case POLYGON:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.POLYGON, addPolygonToMap(map, toPolygon((Polygon) geometry)));
break;
case MULTIPOINT:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_MARKER, addLatLngsToMap(map, toLatLngs((MultiPoint) geometry)));
break;
case MULTILINESTRING:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, toPolylines((MultiLineString) geometry)));
break;
case MULTIPOLYGON:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, toPolygons((MultiPolygon) geometry)));
break;
case CIRCULARSTRING:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.POLYLINE, addPolylineToMap(map, toPolyline((CircularString) geometry)));
break;
case COMPOUNDCURVE:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, toPolylines((CompoundCurve) geometry)));
break;
case CURVEPOLYGON:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.POLYGON, addPolygonToMap(map, toCurvePolygon((CurvePolygon<Curve>) geometry)));
break;
case POLYHEDRALSURFACE:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, toPolygons((PolyhedralSurface) geometry)));
break;
case TIN:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, toPolygons((TIN) geometry)));
break;
case TRIANGLE:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.POLYGON, addPolygonToMap(map, toPolygon((Triangle) geometry)));
break;
case GEOMETRYCOLLECTION:
shape = new GoogleMapShape(geometryType, GoogleMapShapeType.COLLECTION, addToMap(map, (GeometryCollection<Geometry>) geometry));
break;
default:
throw new GeoPackageException("Unsupported Geometry Type: " + geometryType.getName());
}
return shape;
}
use of mil.nga.sf.MultiPoint in project geopackage-android-map by ngageoint.
the class GoogleMapShapeConverter method toMultiPoint.
/**
* Convert a {@link MultiLatLng} to a {@link MultiPoint}
*
* @param latLngs lat lngs
* @param hasZ has z flag
* @param hasM has m flag
* @return multi point
*/
public MultiPoint toMultiPoint(List<LatLng> latLngs, boolean hasZ, boolean hasM) {
MultiPoint multiPoint = new MultiPoint(hasZ, hasM);
for (LatLng latLng : latLngs) {
Point point = toPoint(latLng);
multiPoint.addPoint(point);
}
return multiPoint;
}
use of mil.nga.sf.MultiPoint in project geopackage-android-map by ngageoint.
the class GoogleMapShapeConverterUtils method convertMultiPoint.
/**
* Test the MultiPoint conversion
*
* @param converter
* @param multiPoint
*/
private static void convertMultiPoint(GoogleMapShapeConverter converter, MultiPoint multiPoint) {
MultiLatLng latLngs = converter.toLatLngs(multiPoint);
TestCase.assertNotNull(latLngs);
TestCase.assertFalse(latLngs.getLatLngs().isEmpty());
List<Point> points = multiPoint.getPoints();
comparePointsAndLatLngs(converter, points, latLngs.getLatLngs());
MultiPoint multiPoint2 = converter.toMultiPoint(latLngs);
comparePoints(multiPoint.getPoints(), multiPoint2.getPoints());
}
use of mil.nga.sf.MultiPoint in project geopackage-android-map by ngageoint.
the class GoogleMapShapeConverter method toLatLngs.
/**
* Convert a {@link MultiPoint} to a {@link MultiLatLng}
*
* @param multiPoint multi point
* @return multi lat lng
*/
public MultiLatLng toLatLngs(MultiPoint multiPoint) {
MultiLatLng multiLatLng = new MultiLatLng();
for (Point point : multiPoint.getPoints()) {
LatLng latLng = toLatLng(point);
multiLatLng.add(latLng);
}
return multiLatLng;
}
Aggregations