public static GoogleMapShape addShapeToMap ( GoogleMap map , GoogleMapShape shape ) { GoogleMapShape addedShape = null ; switch ( shape . getShapeType ( ) ) { case LAT_LNG : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MARKER , addLatLngToMap ( map , ( LatLng ) shape . getShape ( ) ) ) ; break ; case MARKER_OPTIONS : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MARKER , addMarkerOptionsToMap ( map , ( MarkerOptions ) shape . getShape ( ) ) ) ; break ; case POLYLINE_OPTIONS : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . POLYLINE , addPolylineToMap ( map , ( PolylineOptions ) shape . getShape ( ) ) ) ; break ; case POLYGON_OPTIONS : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . POLYGON , addPolygonToMap ( map , ( PolygonOptions ) shape . getShape ( ) ) ) ; break ; case MULTI_LAT_LNG : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MULTI_MARKER , addLatLngsToMap ( map , ( MultiLatLng ) shape . getShape ( ) ) ) ; break ; case MULTI_POLYLINE_OPTIONS : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MULTI_POLYLINE , addPolylinesToMap ( map , ( MultiPolylineOptions ) shape . getShape ( ) ) ) ; break ; case MULTI_POLYGON_OPTIONS : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MULTI_POLYGON , addPolygonsToMap ( map , ( MultiPolygonOptions ) shape . getShape ( ) ) ) ; break ; case COLLECTION : List < GoogleMapShape > addedShapeList = new ArrayList < GoogleMapShape > ( ) ; @ SuppressWarnings ( "unchecked" ) List < GoogleMapShape > shapeList = ( List < GoogleMapShape > ) shape . getShape ( ) ; for ( GoogleMapShape shapeListItem : shapeList ) { addedShapeList . add ( addShapeToMap ( map , shapeListItem ) ) ; } addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . COLLECTION , addedShapeList ) ; break ; default : throw new GeoPackageException ( "Unsupported Shape Type: " + shape . getShapeType ( ) ) ; } return addedShape ; }
Add a shape to the map