10.2.5: AGSGraphicsLayer Class Reference
10.2.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
AGSGraphicsLayer Class Reference

Description

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.

Defined in:
AGSGraphicsLayer.h ( ArcGIS library)

Since
1.0
See also
AGSMapViewDelegate for events related to tapping on graphics in the graphics layer.
Inheritance diagram for AGSGraphicsLayer:
AGSLayer <AGSHitTestable> AGSFeatureLayer AGSSketchGraphicsLayer

Instance Methods

(void) - addGraphic:
 
(void) - addGraphics:
 
(void) - clearSelection
 
(int) - defaultDpi
 
(id) - initWithFullEnvelope:
 
(id) - initWithFullEnvelope:renderingMode:
 
(id) - initWithSpatialReference:
 
(BOOL) - isGraphicSelected:
 
(BOOL) - isInScale
 
(void) - layerDidFailToLoad:
 
(void) - layerDidLoad
 
(void) - mapDidUpdate:
 
(void) - refresh
 
(void) - removeAllGraphics
 
(void) - removeGraphic:
 
(void) - removeGraphics:
 
(NSArray *) - selectedGraphics
 
(void) - setSelected:forGraphic:
 
(void) - spatialReferenceStatusInitialized
 

Class Methods

(id) + graphicsLayer
 

Properties

BOOL allowCallout
 
BOOL allowHitTest
 
BOOL allowLayerConsolidation
 
id< AGSLayerCalloutDelegatecalloutDelegate
 
id< AGSLayerDelegatedelegate
 
NSString * endTimeField
 
NSError * error
 
AGSEnvelopefullEnvelope
 
NSArray * graphics
 
NSUInteger graphicsCount
 
AGSEnvelopeinitialEnvelope
 
BOOL loaded
 
AGSMapViewmapView
 
double maxScale
 
double minScale
 
NSString * name
 
CGFloat opacity
 
AGSRendererrenderer
 
AGSGraphicsLayerRenderingMode renderingMode
 
BOOL renderNativeResolution
 
AGSColorselectionColor
 
AGSSymbolselectionSymbol
 
AGSSpatialReferencespatialReference
 
BOOL spatialReferenceStatusValid
 
NSString * startTimeField
 
BOOL timeAware
 
double timeOffset
 
AGSTimeIntervalUnits timeOffsetUnits
 
BOOL visible
 

Method Documentation

- (void) addGraphic: (AGSGraphic *)  graphic

Adds graphic to the layer.

Parameters
graphicThe graphic to be added.
Since
1.0
- (void) addGraphics: (NSArray *)  graphics

Adds graphics to the layer.

Parameters
graphicsArray of AGSGraphic objects to be added.
Since
1.0
- (void) clearSelection

Clears selection on all graphics

Since
10.1.1

Implemented in AGSFeatureLayer.

- (int) defaultDpi

The default dpi for the layer.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

+ (id) graphicsLayer

A method to get an initialized and autoreleased graphics layer.

Returns
A new, autoreleased, graphics layer object.
Since
1.0
- (id) initWithFullEnvelope: (AGSEnvelope *)  fullEnv

Initializes a graphics layer with a full envelope. If you don't use this, the spatial reference is implied from the contents of the graphics in the layer at the point the graphics layer is added to the map. It's recommended to use this initWithFullEnvelope: or initWithSpatialReference if the AGSGraphicsLayer will be a base-map layer (the first layer added to a map). In this case the full envelope should have it's spatialReference property not nil.

Since
10.1.1
- (id) initWithFullEnvelope: (AGSEnvelope *)  fullEnv
renderingMode: (AGSGraphicsLayerRenderingMode renderingMode 

Initializes an AGSGraphicsLayer with a full envelope and a flag stating whether the layer will rasterize it's graphics. Rasterizing graphics is good when you have a lot of graphics. If you have a small number of graphics you can move them around more efficiently if you set this to NO. The full envelope can be nil, but it should be valid and have a valid spatial reference if this layer will be a base layer in a map.

Since
10.1.1.1
- (id) initWithSpatialReference: (AGSSpatialReference *)  sr

Initializes an AGSGraphicsLayer with a spatial reference. You should use this or initWithFullEnvelope: if you want your layer to be the base layer. This method is helpful if you don't know the full envelope. This method will attempt to pull the defualt full envelope from the spatial reference for initialization purposes.

Since
10.1.1
- (BOOL) isGraphicSelected: (AGSGraphic *)  graphic

Returns whether a given graphic is selected or not. Graphics with selection enabled will be drawn using selectionSymbol. If selectionSymbol is not specified, then selectionColor will be used to draw a halo around the graphic.

Parameters
graphic
Since
10.1.1
- (BOOL) isInScale

Indicates whether the map's scale is within this layer's scale range (minScale and maxScale).

Since
10.1.1
- (void) layerDidFailToLoad: (NSError *)  error

Subclasses should call this when the layer fails to load. Implementation for this method is provided by the framework.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

- (void) layerDidLoad

Subclasses should call this when the layer is ready to draw. Implementation for this method is provided by the framework.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

- (void) mapDidUpdate: (AGSMapUpdateType updateType

Method called when the map is updated. You can override this, but make sure to call the super's implementation.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

- (void) refresh

This method does nothing for AGSGraphicsLayer. This method will be potentially implemented of subclasses of AGSGraphicsLayer that retrieve their content from a service.

Since
10.1.1

Implements AGSLayer.

Implemented in AGSFeatureLayer.

- (void) removeAllGraphics

Remove all graphics from the layer. the layer.

Since
1.0
- (void) removeGraphic: (AGSGraphic *)  graphic

Remove graphic from the graphics collection. redraw the layer.

Parameters
graphicThe graphic to be removed.
Since
1.0
- (void) removeGraphics: (NSArray *)  objects

Removes a set of graphics from the layer.

- (NSArray*) selectedGraphics

An array of AGSGraphic objects representing graphics that have selection enabled Graphics with selection enabled will be drawn using selectionSymbol. If selectionSymbol is not specified, then selectionColor will be used to draw a halo around the graphic.

Since
10.1.1
- (void) setSelected: (BOOL)  selected
forGraphic: (AGSGraphic *)  graphic 

Selects or un-selects the graphic. Graphics with selection enabled will be drawn using selectionSymbol. If selectionSymbol is not specified, then selectionColor will be used to draw a halo around the graphic.

Parameters
selectedIf YES, graphic will be selected. Else it will be un-selected
graphic
Since
10.1.1
See also
selectionColor selectionSymbol for changing how selected graphics are displayed
- clearSelection to clear selection
- (void) spatialReferenceStatusInitialized

Called when the status of the layer's spatial reference has been established. You can override this method, just make sure to call the super's implementation.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

Property Documentation

- (BOOL) allowCallout
readwritenonatomicassign

Property that determines if the layer allows callouts to be shown for its features.

Since
10.2
- (BOOL) allowHitTest
readwritenonatomicassign

Property that determines if the layer allows it to be hit tested or if it is bypassed.

Since
10.2
- (BOOL) allowLayerConsolidation
readwritenonatomicassign

Specifies whether the layer can be consolidated with other layers for saving memory.

Since
10.1.1.1
- (id<AGSLayerCalloutDelegate>) calloutDelegate
readwritenonatomicweak

Delegate that allows the layer to react to when a callout is shown for one of it's features.

Since
10.2
- (id<AGSLayerDelegate>) delegate
readwritenonatomicweakinherited

Delegate to be notified when the layer is loaded or fails to load.

Since
1.0
- (NSString*) endTimeField
readwritenonatomiccopy

The name of the attribute that contains ending time information of a graphic. Only applicable if graphics contain temporal information.

Since
10.1.1
- (NSError*) error
readnonatomicstronginherited

Information about the error associated with a layer.

Since
1.0

Provided by category AGSLayer(ForSubclassEyesOnly).

- (AGSEnvelope*) fullEnvelope
readnonatomicstronginherited

Full extent of the layer.

Since
1.0
- (NSArray*) graphics
readnonatomiccopy

The array of AGSGraphic objects that need to be displayed on the map. This property returns a thread-safe copy.

Since
1.0
- (NSUInteger) graphicsCount
readnonatomicassign

If you simply need the count of the graphics, you can access it through this property instead of using the graphics property which has the overhead of creating a copy.

Since
10.1.1
- (AGSEnvelope*) initialEnvelope
readwritenonatomicstronginherited

Gets or sets the initial envelope of the layer.

Since
1.0
- (BOOL) loaded
readnonatomicassigninherited

Indicates that this layer loaded successfully.

Since
1.0
- (AGSMapView*) mapView
readwritenonatomicweakinherited

The map that the layer is in.

Since
10.1.1

Provided by category AGSLayer(ForSubclassEyesOnly).

- (double) maxScale
readwritenonatomicassigninherited

The maximum scale at which this layer is visible. If the map is zoomed in beyond this scale, the layer will not be visible.

Since
1.0
- (double) minScale
readwritenonatomicassigninherited

The minimum scale at which this layer is visible. If the map is zoomed out beyond this scale, the layer will not be visible.

Since
1.0
- (NSString*) name
readwritenonatomiccopyinherited

The name of this layer

Since
10.1.1
- (CGFloat) opacity
readwritenonatomicassigninherited

The opacity of this layer as a value between 0(fully transparent) and 1(fully opaque)

Since
10.1.1
- (AGSRenderer*) renderer
readwritenonatomicstrong

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.

Since
1.0
- (AGSGraphicsLayerRenderingMode) renderingMode
readnonatomicassign

The rendering mode for this graphics layer.

Since
10.1.1.1
- (BOOL) renderNativeResolution
readwritenonatomicassigninherited

Gets a value that determines if the layer renders at the native resolution. This property will not have any affect on iOS devices without a retina display. If using an iOS device with a retina display and you want to take advantage of that display you can set this value to YES. If YES, this layer will use more memory and network bandwidth, but the layer will render at a higher resolution. This property is not settable for every layer type.

Since
2.1
- (AGSColor*) selectionColor
readwritenonatomiccopy

The color to use for drawing a halo around selected graphics. Default is cyan. Only used if selectionSymbol is not specified.

Since
10.1.1
- (AGSSymbol*) selectionSymbol
readwritenonatomicstrong

The symbol to use for drawing selected graphics. If this is not specified, selectionColor is used.

Since
10.1.1
See also
selectionColor
- (AGSSpatialReference*) spatialReference
readnonatomicstronginherited

The spatial reference of the layer.

Since
1.0
- (BOOL) spatialReferenceStatusValid
readwritenonatomicassigninherited

This property will be NO until the spatial reference status has been initialized. See the layer:didInitializeSpatialReferenceStatus method on delegate for more information.

- (NSString*) startTimeField
readwritenonatomiccopy

The name of the attribute that contains starting time information of a graphic. Only applicable if graphics contain temporal information.

Since
10.1.1
- (BOOL) timeAware
readnonatomicassigninherited

A property indicating whether the layer is time-aware.

Since
1.0
- (double) timeOffset
readwritenonatomicassign

The amount of time by which data in this layer is offset from the time when the data was recorded. Specify the units using the timeOffsetUnits property.

Since
10.1.1
- (AGSTimeIntervalUnits) timeOffsetUnits
readwritenonatomicassign

Units of the amount specified by timeOffset. Refer to AGSTimeIntervalUnits for possible values.

Since
10.1.1
- (BOOL) visible
readwritenonatomicassigninherited

Indicates whether this layer should be visible in the map.

Since
10.1.1