This layer allows you to add graphics on the map. By using these graphics, you can add your own places of interest to the map, or highlight existing places.
Each graphic contains a geometry describing the location and the shape of the graphic. A Graphics layer typically contains graphics
based on a single geometry type (Point, Multipoint, Polyline, or Polygon). Each graphic can be associated with an AGSSymbol
which controls how the graphic looks. Alternatively, the layer can be associated with an AGSRenderer
which manages the appearance of all graphics in the layer.
In a Model-View-Controller architecture, this object represents the Model. The corresponding View object, AGSDynamicLayerView
, is created when this object is added to the map.
The spatialReference
property of a graphics layer is defined either by setting the initialEnvelope with a valid spatial reference or when the first graphic is added with a valid geometry and spatial reference. Furthermore, the geometry of individual graphics in the layer must be of the same spatial reference.
Public Member Functions | |
(void) | - addGraphic: |
(void) | - addGraphics: |
(void) | - dataChanged |
(NSOperation < AGSDynamicLayerDrawingOperation > *) | - exportMapImage: |
(void) | - layerDidFailToLoad: |
(void) | - layerDidLoad |
(void) | - removeAllGraphics |
(void) | - removeGraphic: |
Static Public Member Functions | |
(id) | + graphicsLayer |
Properties | |
id< AGSLayerDelegate > | delegate |
NSError * | error |
id< AGSExportMapImageDelegate > | exportDelegate |
AGSEnvelope * | fullEnvelope |
NSMutableArray * | graphics |
AGSEnvelope * | initialEnvelope |
BOOL | loaded |
double | maxScale |
double | minScale |
NSString * | name |
AGSRenderer * | renderer |
AGSSpatialReference * | spatialReference |
BOOL | timeAware |
AGSUnits | units |
- (void) addGraphic: | (AGSGraphic *) | graphic |
Adds graphic
to the layer. You must call dataChanged
to redraw the layer.
graphic | The graphic to be added. |
- (void) addGraphics: | (NSArray *) | graphics |
Adds graphics
to the layer. You must call dataChanged
to redraw the layer.
graphics | Array of AGSGraphic objects to be added. |
- (void) dataChanged |
This method tells the graphics layer that the underlying graphics or symbology has changed and that it needs to be redrawn.
Implements AGSLayer.
- (NSOperation<AGSDynamicLayerDrawingOperation>*) exportMapImage: | (AGSExportImageParams *) | params |
Get new map image. The exportDelegate is notified when the image is exported. This method must be implemented by subclasses.
params | The input parameters for the export image operation. |
+ (id) graphicsLayer |
A method to get an initialized and autoreleased graphics layer.
- (void) layerDidFailToLoad: | (NSError *) | error |
Method to notify the delegate that a layer failed to load. This method will also post a "LayerFailedToLoad" notification that can be observed by the developer.
error | Information regarding the cause of the layer failing to load. |
- (void) layerDidLoad |
Method to notify the delegate that a layer successfully loaded. This method will also post a "LayerDidLoad" notification that can be observed by the developer.
- (void) removeAllGraphics |
Remove all graphics from the layer. You must call dataChanged
to redraw the layer.
- (void) removeGraphic: | (AGSGraphic *) | graphic |
Remove graphic
from the graphics collection. You must call dataChanged
to redraw the layer.
graphic | The graphic to be removed. |
- (id<AGSLayerDelegate>) delegate [read, write, assign, inherited] |
Delegate to be notified when the layer is loaded or fails to load. When this layer is loaded, a corresponding AGSLayerView
object is automatically set as the delegate. This delegate must not be replaced.
- (NSError*) error [read, retain, inherited] |
Information about the error associated with a layer.
- (id<AGSExportMapImageDelegate>) exportDelegate [read, write, assign, inherited] |
Delegate to be notified of events related to exporting the map image. When this layer is loaded, a corresponding View object is automatically set as the exportDelegate
which should not be replaced.
- (AGSEnvelope*) fullEnvelope [read, assign, inherited] |
Full extent of the layer.
Implemented in AGSBingMapLayer, AGSGPResultLayer, and AGSOpenStreetMapLayer.
- (NSMutableArray*) graphics [read, retain] |
The array of AGSGraphic
objects that need to be displayed on the map.
- (AGSEnvelope*) initialEnvelope [read, write, retain] |
- (BOOL) loaded [read, assign, inherited] |
A property indicating whether the layer is loaded and ready to be used. When the layer is loaded, the value becomes YES
, and layer properties can be accessed.
- (double) maxScale [read, write, assign] |
The maximum scale at which this layer is visible. If the map is zoomed in beyond this scale, the layer will not be visible.
Implements AGSDynamicLayer.
- (double) minScale [read, write, assign] |
The minimum scale at which this layer is visible. If the map is zoomed out beyond this scale, the layer will not be visible.
Implements AGSDynamicLayer.
- (NSString*) name [read, retain, inherited] |
The name of the layer. This property will be set by the framework when the layer is added to the map.
- (AGSRenderer*) renderer [read, write, retain] |
AGSRenderer
assigned to the layer. It is responsible for symbolizing the graphics. It is optional as each graphic may have it's own symbol. If a graphic has a symbol, that will be used for drawing the graphic instead of the renderer.
- (AGSSpatialReference*) spatialReference [read, assign, inherited] |
The spatial reference of the layer.
Implemented in AGSBingMapLayer, AGSGPResultLayer, and AGSOpenStreetMapLayer.
- (BOOL) timeAware [read, assign, inherited] |
A property indicating whether the layer is time-aware.
- (AGSUnits) units [read, write, assign, inherited] |
The units the layer is in. Possible values include
AGSUnitsCentimeters
AGSUnitsDecimalDegrees
AGSUnitsDecimeters
AGSUnitsFeet
AGSUnitsInches
AGSUnitsKilometers
AGSUnitsMeters
AGSUnitsMiles
AGSUnitsMillimeters
AGSUnitsNauticalMiles
AGSUnitsPoints
AGSUnitsUnknown
AGSUnitsYards