Package com.aerisweather.aeris.tiles
Class AerisAmp
- java.lang.Object
- 
- com.aerisweather.aeris.tiles.AerisAmp
 
- 
 public class AerisAmp extends Object Created by sshie on 1/6/2017.
- 
- 
Constructor SummaryConstructors Constructor Description AerisAmp()Constructor Create AerisAmp class with default refreshPermissions to falseAerisAmp(String clientId, String clientSecret)Constructor Create AerisAmp class with default refreshPermissions to falseAerisAmp(String clientId, String clientSecret, boolean refreshPermissions)Constructor Create AerisAmp class allowing permissions to be refreshed if neededAerisAmp(String clientId, String clientSecret, float lat, float lon, int zoom, int width, int height)Constructor Create AerisAmp class passing in user defined values for lat, lon, zoom etc.AerisAmp(String clientId, String clientSecret, float lat, float lon, int zoom, int width, int height, boolean refreshPermissions)Constructor Create AerisAmp class passing in user defined values for lat, lon, zoom etc as well as allowing user to specify if permissions is refresh or not.AerisAmp(String clientId, String clientSecret, int width, int height, double south, double west, double north, double east)Constructor for creating an AMP layer from a bounding box
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbuildStaticMapUrl()Create a static map URL to get a layer image from AMP using a center latlon and zoomStringbuildStaticMapUrlWithBoundingBox()Create a static map URL to get a layer image from AMP using a bounding boxStringbuildTileUrl(int x, int y, int zoom)AerisAmpLayercreateNewLayer(String id, String name, int opacity)AerisAmpLayergetActiveLayer(String layerId)Returns a specific AerisAmpLayer.AerisAmpLayergetActiveLayerFromId(String layerId)Returns a specific AerisAmpLayer.AerisAmpLayergetActiveLayerFromName(String layerName)Returns a specific AerisAmpLayer.ArrayList<AerisAmpLayer>getActiveMapLayers()Returns a list of AerisAmpLayer currently selected/active.ArrayList<AerisAmpLayer>getAllPossibleLayers()Returns a list of all AMP layers available to the user.android.graphics.BitmapgetBitmapFromAMP(String urlString)Get the map bitmap from AMP.StringgetClientId()StringgetClientSecret()StringgetFutureLayerId(AerisAmpLayer ampLayer)StringgetFutureLayerId(String layerId)com.google.android.gms.maps.model.LatLnggetLatLng()AerisAmpLayergetLayerFromId(String layerId)Returns a specific AerisAmpLayer.AerisAmpLayergetLayerFromName(String layerName)Returns a specific AerisAmpLayer.ArrayListgetLayerModifiersFromId(String layerId)Returns the available modifiers for a specific layer.ArrayListgetLayerModifiersFromName(String layerName)Returns the available modifiers for a specific layer.ArrayList<AerisAmpLayer>getPermissibleLayers()Returns a list of all AMP layers available to the user.ArrayList<AerisAmpLayer>getPermissibleLayers(boolean forceRefresh)Overload used to manually force a refresh of the array.com.aerisweather.aeris.model.AerisPermissionsgetPermissions(Boolean refresh)Return an AerisPermissions object with the current Aeris API permissions.android.graphics.BitmapgetStaticMapImage()Get the map bitmap from AMP.StringgetStaticMapUrl()Returns the last static map url created.longgetTileValidTime()intgetZoom()voidremoveLayer(AerisAmpLayer removeLayer)removeLayer() Remove a layer from the AMP layer array.voidremoveLayer(String aerisLayerId)removeLayer() Remove a layer from the AMP layer array using the layer ID.voidsetBoundingBox(com.google.android.gms.maps.model.LatLngBounds latLngBounds)Used when creating an AMP layer from a bounding boxvoidsetClientId(String id)Set the AerisEngine client idvoidsetClientSecret(String secret)Set the AerisEngine client secretbooleansetDefaultLayers()setDefaultLayers() - Clears any layers that have been added previously, and adds the default layers of - Radar, opacity 80% - Flat, opacity 100% - Admin, opacity 100%voidsetEast(double east)Set the eastern most (right) longitude coordinate of the bounding box, in degrees.voidsetLatitude(float lat)voidsetLatLng(com.google.android.gms.maps.model.LatLng latLng)voidsetLayer(AerisAmpLayer layer)addLayer() Add an existing layer to the AMP layer array.intsetLayerFromId(String layerId)addLayer() Add a layer to the AMP layer array, based on the layer id.intsetLayerFromName(String layerName)addLayer() Add a layer to the AMP layer array, based on the layer name.voidsetLongitude(float lon)voidsetMapHeight(int height)voidsetMapWidth(int width)voidsetNorth(double north)Set the northern most (top) latitude coordinate of the bounding box, in degrees.voidsetOpacity(int height)voidsetSouth(double south)Set the southern most (bottom) latitude coordinate of the bounding box, in degrees.voidsetTileValidTime(long tileValidTime)Use this method to set the overall valid time for the Amp layer.voidsetTimeOffset(String offset)voidsetWest(double west)Set the western most (left) longitude coordinate of the bounding box, in degrees.voidsetZoom(float zoom)
 
- 
- 
- 
Constructor Detail- 
AerisAmppublic AerisAmp() Constructor Create AerisAmp class with default refreshPermissions to false
 - 
AerisAmppublic AerisAmp(String clientId, String clientSecret) Constructor Create AerisAmp class with default refreshPermissions to false- Parameters:
- clientId- The AerisWeather client id
- clientSecret- The AerisWeather client key
 
 - 
AerisAmppublic AerisAmp(String clientId, String clientSecret, boolean refreshPermissions) Constructor Create AerisAmp class allowing permissions to be refreshed if needed- Parameters:
- clientId- The AerisWeather client id
- clientSecret- The AerisWeather client key
 
 - 
AerisAmppublic AerisAmp(String clientId, String clientSecret, float lat, float lon, int zoom, int width, int height) Constructor Create AerisAmp class passing in user defined values for lat, lon, zoom etc. Refresh permissions is defaulted to false.- Parameters:
- clientId- The AerisWeather client id
- clientSecret- The AerisWeather client key
 
 - 
AerisAmppublic AerisAmp(String clientId, String clientSecret, float lat, float lon, int zoom, int width, int height, boolean refreshPermissions) Constructor Create AerisAmp class passing in user defined values for lat, lon, zoom etc as well as allowing user to specify if permissions is refresh or not.- Parameters:
- clientId- The AerisWeather client id
- clientSecret- The AerisWeather client key
 
 - 
AerisAmppublic AerisAmp(String clientId, String clientSecret, int width, int height, double south, double west, double north, double east) Constructor for creating an AMP layer from a bounding box- Parameters:
- clientId- The AerisWeather client id
- clientSecret- The AerisWeather client key
- width- The width of the map area
- height- The height of the map area
- south- The southern most longitude
- west- The western most latitude
- north- The northern most longitude
- east- The eastern most latitude
 
 
- 
 - 
Method Detail- 
setClientIdpublic void setClientId(String id) Set the AerisEngine client id- Parameters:
- id- The AerisWeather client id
 
 - 
setClientSecretpublic void setClientSecret(String secret) Set the AerisEngine client secret- Parameters:
- secret- The AerisWeather client key
 
 - 
setSouthpublic void setSouth(double south) Set the southern most (bottom) latitude coordinate of the bounding box, in degrees.- Parameters:
- south- southern most (bottom) latitude
 
 - 
setWestpublic void setWest(double west) Set the western most (left) longitude coordinate of the bounding box, in degrees.- Parameters:
- west- western most (left) longitude
 
 - 
setNorthpublic void setNorth(double north) Set the northern most (top) latitude coordinate of the bounding box, in degrees.- Parameters:
- north- northern most (top) latitude
 
 - 
setEastpublic void setEast(double east) Set the eastern most (right) longitude coordinate of the bounding box, in degrees.- Parameters:
- east- eastern most (right) longitude
 
 - 
setBoundingBoxpublic void setBoundingBox(com.google.android.gms.maps.model.LatLngBounds latLngBounds) Used when creating an AMP layer from a bounding box- Parameters:
- latLngBounds- latitude and longitude boundaries
 
 - 
getPermissionspublic com.aerisweather.aeris.model.AerisPermissions getPermissions(Boolean refresh) Return an AerisPermissions object with the current Aeris API permissions. Will pull permissions from the API if the member permissions object is null or if the user specifies to force a refresh.- Parameters:
- refresh- boolean
- Returns:
- AerisPermissions
 
 - 
getClientIdpublic String getClientId() 
 - 
getClientSecretpublic String getClientSecret() 
 - 
setLatitudepublic void setLatitude(float lat) 
 - 
setLongitudepublic void setLongitude(float lon) 
 - 
setZoompublic void setZoom(float zoom) 
 - 
getZoompublic int getZoom() 
 - 
setMapWidthpublic void setMapWidth(int width) 
 - 
setMapHeightpublic void setMapHeight(int height) 
 - 
setLatLngpublic void setLatLng(com.google.android.gms.maps.model.LatLng latLng) 
 - 
getLatLngpublic com.google.android.gms.maps.model.LatLng getLatLng() 
 - 
setOpacitypublic void setOpacity(int height) 
 - 
setTimeOffsetpublic void setTimeOffset(String offset) 
 - 
createNewLayerpublic AerisAmpLayer createNewLayer(String id, String name, int opacity) 
 - 
setDefaultLayerspublic boolean setDefaultLayers() setDefaultLayers() - Clears any layers that have been added previously, and adds the default layers of - Radar, opacity 80% - Flat, opacity 100% - Admin, opacity 100%- Returns:
- boolean True if successful, false if failed
 
 - 
removeLayerpublic void removeLayer(String aerisLayerId) removeLayer() Remove a layer from the AMP layer array using the layer ID.- Parameters:
- aerisLayerId- layerId
 
 - 
removeLayerpublic void removeLayer(AerisAmpLayer removeLayer) removeLayer() Remove a layer from the AMP layer array.- Parameters:
- removeLayer- AerisAmpLayer
 
 - 
setLayerpublic void setLayer(AerisAmpLayer layer) addLayer() Add an existing layer to the AMP layer array.- Parameters:
- layer- AerisAmpLayer
 
 - 
setLayerFromNamepublic int setLayerFromName(String layerName) addLayer() Add a layer to the AMP layer array, based on the layer name.- Parameters:
- layerName- The string name of the layer to add
- Returns:
- int Returns an int indicating the success or fail code. 0 = success 1 = failed - invalid layer name 2 = failed - no permissions for layer 3 = failed - error or exception
 
 - 
setLayerFromIdpublic int setLayerFromId(String layerId) addLayer() Add a layer to the AMP layer array, based on the layer id.- Parameters:
- layerId- The string id of the layer to add
- Returns:
- int Returns an int indicating the success or fail code. 0 = success 1 = failed - invalid layer id 2 = failed - no permissions for layer 3 = failed - error or exception
 
 - 
buildStaticMapUrlpublic String buildStaticMapUrl() Create a static map URL to get a layer image from AMP using a center latlon and zoom- Returns:
- String AMP url
 
 - 
buildStaticMapUrlWithBoundingBoxpublic String buildStaticMapUrlWithBoundingBox() Create a static map URL to get a layer image from AMP using a bounding box- Returns:
- String AMP url
 
 - 
getStaticMapUrlpublic String getStaticMapUrl() Returns the last static map url created. To create a new static map url, call buildStaticMapUrl()- Returns:
- String The static map url created from the current amp properties.
 
 - 
buildTileUrlpublic String buildTileUrl(int x, int y, int zoom) 
 - 
getFutureLayerIdpublic String getFutureLayerId(AerisAmpLayer ampLayer) 
 - 
getStaticMapImagepublic android.graphics.Bitmap getStaticMapImage() Get the map bitmap from AMP. If a bitmap has already been created it will be returned, if not a call will be made to the AerisWeather AMP API.- Returns:
- Bitmap
 
 - 
getBitmapFromAMPpublic android.graphics.Bitmap getBitmapFromAMP(String urlString) Get the map bitmap from AMP. The url passed in must include a valid AerisWeather client id and secret. This call will directly hit the AerisWeather API. To check if a bitmap has been generated previously, call getStaticMapImage()- Parameters:
- urlString-
- Returns:
- Bitmap
 
 - 
getAllPossibleLayerspublic ArrayList<AerisAmpLayer> getAllPossibleLayers() Returns a list of all AMP layers available to the user.- Returns:
- ArrayList All AMP layers defined in the layers.json
 
 - 
getPermissibleLayerspublic ArrayList<AerisAmpLayer> getPermissibleLayers() Returns a list of all AMP layers available to the user. If the array is already populated, it will return it as such. To force a refresh and recheck the layers, call the overloaded method with the forceRefresh parameter set to true.- Returns:
- ArrayList The list of AMP layer objects available to the user
 
 - 
getPermissibleLayerspublic ArrayList<AerisAmpLayer> getPermissibleLayers(boolean forceRefresh) Overload used to manually force a refresh of the array.- Parameters:
- forceRefresh- boolean - pass true to manually force a recheck of allowed layers
- Returns:
- ArrayList The list of AMP layer objects available to the user
 
 - 
getActiveMapLayerspublic ArrayList<AerisAmpLayer> getActiveMapLayers() Returns a list of AerisAmpLayer currently selected/active.- Returns:
- ArrayList The active layers.
 
 - 
getActiveLayerpublic AerisAmpLayer getActiveLayer(String layerId) Returns a specific AerisAmpLayer. Returns null if the layer is not currently selected/active.- Returns:
- AerisAmpLayer The requested active layer, or null if the layer is not active.
 
 - 
getActiveLayerFromIdpublic AerisAmpLayer getActiveLayerFromId(String layerId) Returns a specific AerisAmpLayer. Returns null if the layer is not currently selected/active.- Returns:
- AerisAmpLayer The requested active layer, or null if the layer is not active.
 
 - 
getActiveLayerFromNamepublic AerisAmpLayer getActiveLayerFromName(String layerName) Returns a specific AerisAmpLayer. Returns null if the layer is not currently selected/active.- Returns:
- AerisAmpLayer The requested active layer, or null if the layer is not active.
 
 - 
getLayerFromIdpublic AerisAmpLayer getLayerFromId(String layerId) Returns a specific AerisAmpLayer. Returns null if the layer is not currently selected/active.- Returns:
- AerisAmpLayer The requested active layer, or null if the layer is not active.
 
 - 
getLayerFromNamepublic AerisAmpLayer getLayerFromName(String layerName) Returns a specific AerisAmpLayer. Returns null if the layer is not currently selected/active.- Returns:
- AerisAmpLayer The requested active layer, or null if the layer is not active.
 
 - 
getLayerModifiersFromIdpublic ArrayList getLayerModifiersFromId(String layerId) Returns the available modifiers for a specific layer.- Parameters:
- layerId- String
 
 - 
getLayerModifiersFromNamepublic ArrayList getLayerModifiersFromName(String layerName) Returns the available modifiers for a specific layer.- Parameters:
- layerName- String
 
 - 
setTileValidTimepublic void setTileValidTime(long tileValidTime) Use this method to set the overall valid time for the Amp layer. Most useful when loading or reloading tiles, since GoogleMap doesn't allow us to get at the data when it is drawing tiles.- Parameters:
- tileValidTime- long
 
 - 
getTileValidTimepublic long getTileValidTime() 
 
- 
 
-