AWFWeatherMap
Objective-C
@interface AWFWeatherMap
: NSObject <AWFMapContentDelegate, AWFAnimationDelegate,
AWFMapStrategyDelegate>
Swift
class AWFWeatherMap : NSObject, AWFMapContentDelegate, AWFAnimationDelegate, AWFMapStrategyDelegate
An AWFWeatherMap
object provides a complete interface for displaying weather-related overlays and data on a map view. You
use this class to display and control weather information and map contents being displayed from your application.
When you initialize a weather map, you should specify the mapping library to use by using the appropriate {@link AWFWeatherMapType} value. Alternatively, you can initialize a weather map with a map view instance and the proper {@link AWFWeatherMapType} will be assigned based on the type of map view object provided.
-
The mapping strategy provider to use with the weather map.
Declaration
Objective-C
@property (nonatomic, strong, readonly) id<AWFMapStrategy> _Nonnull strategy;
Swift
var strategy: AWFMapStrategy { get }
-
The type of mapping library being used with the weather map.
This value indicates the mapping library currently being used with the weather map.
Declaration
Objective-C
@property (nonatomic, readonly) AWFWeatherMapType weatherMapType;
Swift
var weatherMapType: AWFWeatherMapType { get }
-
The view containing the map view and all related subviews, such as legends and controls.
Declaration
Objective-C
@property (nonatomic, strong, readonly) AWFWeatherMapContainerView *_Nonnull weatherMapView;
Swift
var weatherMapView: AWFWeatherMapContainerView { get }
-
The map view managed by this weather map instance.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIView<AWFWeatherMapView> *_Nonnull mapView;
Swift
var mapView: UIView & AWFWeatherMapView { get }
-
An object that needs to receive all delegate messages from the specific mapping SDK being used.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id mapViewDelegate;
Swift
weak var mapViewDelegate: AnyObject? { get set }
-
Forecast model type to be used for all active future data layers (when supported).
Declaration
Objective-C
@property (nonatomic) int forecastModelType;
Swift
var forecastModelType: Int32 { get set }
-
The view indicating when the map’s timeline is in the future.
Declaration
Objective-C
@property (nonatomic, strong) UIView *_Nonnull futureIndicatorView;
Swift
var futureIndicatorView: UIView { get set }
-
Map content sources currently active on the map.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<AWFMapContentSource *> *_Nonnull sources;
Swift
var sources: [AWFMapContentSource] { get }
-
Returns an array of layer types currently active on the map.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<AWFMapLayer> *_Nonnull activeLayerTypes;
Swift
var activeLayerTypes: [AWFMapLayer] { get }
-
Returns an array of codes corresponding to the active layer types currently active on the map.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<NSString *> *_Nonnull activeLayerTypeCodes;
Swift
var activeLayerTypeCodes: [String] { get }
-
Animation timeline responsible for managing the map’s current time and animation playback.
Declaration
Objective-C
@property (nonatomic, strong, readonly) AWFAnimationTimeline *_Nonnull timeline;
Swift
var timeline: AWFAnimationTimeline { get }
-
The configuration object associated with the weather map.
Declaration
Objective-C
@property (nonatomic, strong, readonly) AWFWeatherMapConfig *_Nonnull config;
Swift
var config: AWFWeatherMapConfig { get }
-
The map style associated with the weather map that provides style specifications for items rendered to the map.
Declaration
Objective-C
@property (nonatomic, strong) AWFWeatherMapStyle *_Nonnull style;
Swift
var style: AWFWeatherMapStyle { get set }
-
The tile source provider responsible for managing all Aeris Maps (AMP) layers on the map.
Declaration
Objective-C
@property (nonatomic, readonly) AWFAmpTileSourceProvider *_Nonnull amp;
Swift
var amp: AWFAmpTileSourceProvider { get }
-
The receiver’s delegate.
A weather map sends messages to its delegate regarding the addition and removal of weather overlays, animation status changes, and forwards respective messages from the interval map view object.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<AWFWeatherMapDelegate> delegate;
Swift
weak var delegate: AWFWeatherMapDelegate? { get set }
-
The receiver’s data source.
A weather map requests data from its data source when displaying map elements, such as callouts and annotations.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<AWFWeatherMapDataSource> dataSource;
Swift
weak var dataSource: AWFWeatherMapDataSource? { get set }
-
Controls the number of times the map animation should repeat after its initial loop. Setting this value to
-1
will loop the animation endlessly until it is stopped.Declaration
Objective-C
@property (nonatomic) NSInteger animationRepeatCount;
Swift
var animationRepeatCount: Int { get set }
-
A Boolean value indicating whether the weather map is currently animating.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isAnimating) BOOL animating;
Swift
var isAnimating: Bool { get }
-
A Boolean value indicating whether the weather map is currently loading data for the animation.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isLoadingAnimation) BOOL loadingAnimation;
Swift
var isLoadingAnimation: Bool { get }
-
Initializes and returns a newly allocated weather map object with the specified map type.
Declaration
Objective-C
- (nonnull instancetype)initWithMapType:(AWFWeatherMapType)mapType;
Swift
init(mapType: AWFWeatherMapType)
Parameters
mapType
The {@link AWFWeatherMapType} to use with the weather map.
Return Value
An initialized weather map object or
nil
if the object couldn’t be created. -
Initializes and returns a newly allocated weather map object with the specified map type and configuration.
Declaration
Objective-C
- (nonnull instancetype)initWithMapType:(AWFWeatherMapType)mapType config: (nullable AWFWeatherMapConfig *)mapConfig;
Swift
init(mapType: AWFWeatherMapType, config mapConfig: AWFWeatherMapConfig?)
Parameters
mapType
The {@link AWFWeatherMapType} to use with the weather map.
Return Value
An initialized weather map object or
nil
if the object couldn’t be created. -
Initializes and returns a newly allocated weather map object using the specified map view.
Declaration
Objective-C
- (nonnull instancetype)initWithMapView:(nonnull id)mapView;
Swift
init(mapView: Any)
Parameters
mapView
The map view to associate with the weather map.
Return Value
An initialized weather map object or
nil
if the object couldn’t be created. -
Initializes and returns a newly allocated weather map object with a map configuration using the specified map view.
Declaration
Objective-C
- (nonnull instancetype)initWithMapView:(nonnull id)mapView config: (nullable AWFWeatherMapConfig *)mapConfig;
Swift
init(mapView: Any, config mapConfig: AWFWeatherMapConfig?)
Parameters
mapView
The map view to associate with the weather map.
mapConfig
The configuration object to use with the weather map.
Return Value
An initialized weather map object or
nil
if the object couldn’t be created.
-
Adds the specified map content source to the map.
The z-index order in which each map content source is rendered on the map will depend on the type of map source (e.g. tile, point, shape, etc). For example, point map content sources will always be rendered above raster or shape sources.
Declaration
Objective-C
- (void)addSource:(nonnull AWFMapContentSource *)source;
Swift
func addSource(_ source: AWFMapContentSource)
Parameters
source
The map source to add.
-
Adds an array of map content sources to the map.
The z-index order in which each map content source is rendered on the map will depend on the type of map source (e.g. tile, point, shape, etc). For example, point map content sources will always be rendered above raster or shape sources.
Declaration
Objective-C
- (void)addSources:(nonnull NSArray<AWFMapContentSource *> *)source;
Swift
func addSources(_ source: [AWFMapContentSource])
Parameters
source
The map sources to add.
-
Removes a map content source from the map.
Declaration
Objective-C
- (void)removeSource:(nonnull AWFMapContentSource *)source;
Swift
func removeSource(_ source: AWFMapContentSource)
Parameters
source
The map source to remove.
-
Removes an array of map content sources from the map.
Declaration
Objective-C
- (void)removeSources:(nonnull NSArray<AWFMapContentSource *> *)sources;
Swift
func removeSources(_ sources: [AWFMapContentSource])
Parameters
sources
The map sources to remove.
-
Adds a new map content source to the map for the specified layer type.
Declaration
Objective-C
- (void)addSourceForLayerType:(nonnull AWFMapLayer)layerType;
Swift
func addSource(forLayerType layerType: AWFMapLayer)
Parameters
layerType
The layer type to add a new map source for.
-
Adds a series of new map content sources to the map for the specified array of layer types.
Declaration
Objective-C
- (void)addSourcesForLayerTypes:(nonnull NSArray<AWFMapLayer> *)layerTypes;
Swift
func addSources(forLayerTypes layerTypes: [AWFMapLayer])
Parameters
layerTypes
The layer types to add map sources for.
-
Removes the map content source from the map associated with the specified layer type, if any.
Declaration
Objective-C
- (void)removeSourceForLayerType:(nonnull AWFMapLayer)layerType;
Swift
func removeSource(forLayerType layerType: AWFMapLayer)
Parameters
layerType
The layer type to remove the map source for.
-
Removes a series of map content sources from the map for the specified array of layer types.
Declaration
Objective-C
- (void)removeSourcesForLayerTypes:(nonnull NSArray<AWFMapLayer> *)layerTypes;
Swift
func removeSources(forLayerTypes layerTypes: [AWFMapLayer])
Parameters
layerTypes
The layer types to remove map sources for, if any.
-
Returns whether the map contains a map content source for the specified layer type.
Declaration
Objective-C
- (BOOL)containsSourceForLayerType:(nonnull AWFMapLayer)layerType;
Swift
func containsSource(forLayerType layerType: AWFMapLayer) -> Bool
Parameters
layerType
The layer type.
Return Value
YES
if the map contains a map source for the layer type, otherwiseNO
. -
Returns the map content source for the specified layer type if it exists on the map.
Declaration
Objective-C
- (nullable AWFMapContentSource *)sourceForLayerType: (nonnull AWFMapLayer)layerType;
Swift
func source(forLayerType layerType: AWFMapLayer) -> AWFMapContentSource?
Parameters
layerType
The layer type.
Return Value
The map content source, or
nil
if one does not exist.
-
Updates all existing map content sources on the map.
Declaration
Objective-C
- (void)refreshAllSources;
Swift
func refreshAllSources()
-
Starts the auto-refresh timer, which will update all active overlays on the map at the specified interval in the weather map’s configuration.
Declaration
Objective-C
- (void)enableAutoRefresh;
Swift
func enableAutoRefresh()
-
Stops the auto-refresh timer that updates all active overlays at regular intervals.
It is recommended that your application call this method when the view containing the weather map disappears so that it no longer performs unnecessary processes.
Declaration
Objective-C
- (void)disableAutoRefresh;
Swift
func disableAutoRefresh()
-
Updates all point data layers by requesting data for the current map bounds.
Declaration
Objective-C
- (void)updatePointDataForCurrentMapBounds;
Swift
func updatePointDataForCurrentMapBounds()
-
Starts animating active overlays from the beginning of the timeline.
Declaration
Objective-C
- (void)startAnimating;
Swift
func startAnimating()
-
Starts animating active overlays from the specified date.
Declaration
Objective-C
- (void)startAnimatingFromTime:(nonnull NSDate *)time;
Swift
func startAnimating(fromTime time: Date)
Parameters
time
The date from which to begin animating.
-
Starts loading data required by the animation, if any. Loading will be done in the background, meaning map content will not show the loading process nor start animating once all loading has been completed.
Declaration
Objective-C
- (void)loadAnimationIfNeeded;
Swift
func loadAnimationIfNeeded()
-
Stops animating active overlays.
Declaration
Objective-C
- (void)stopAnimating;
Swift
func stopAnimating()
-
Pauses all overlay animations if animating.
Declaration
Objective-C
- (void)pauseAnimation;
Swift
func pauseAnimation()
-
Resumes playback of the active animation when paused.
Declaration
Objective-C
- (void)resumeAnimation;
Swift
func resumeAnimation()
-
Moves the map timeline to the specified date and updates overlays as needed.
Declaration
Objective-C
- (void)goToTime:(nonnull NSDate *)time;
Swift
func go(toTime time: Date)
Parameters
time
The date and time to move the timeline to.
-
Returns an array of all of the supported forecast model types.
The returned array contains one NSDictionary object for each forecast model type and include’s the forecast model’s type and name:
{@"type": @(AWFForecastModelTypeHRRR), @"name": @"HRRR"}
This array of supported forecast model types is often used to dynamically generate menus or listings of the available forecast models
AWFWeatherMap
supports.Declaration
Objective-C
+ (nonnull NSArray<NSDictionary<NSString *, NSString *> *> *) supportedForecastModels;
Swift
class func supportedForecastModels() -> [[String : String]]
Return Value
The array of supported forecast model types.