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

Description

A layer that allows the user to interactively sketch geometries on the map. You can skech point, polygon, and polyline geometries from scratch, modify existing geometries, insert and remove vertices, undo and redo changes, and so on.

Notifications

The layer posts AGSSketchGraphicsLayerGeometryDidChangeNotification when its geometry changes.

See also
Conceptual Doc: Using a Sketch Layer
Sample: Sketch Layer
Since
1.8
Inheritance diagram for AGSSketchGraphicsLayer:
AGSGraphicsLayer <AGSMapViewTouchDelegate> AGSLayer <AGSHitTestable>

Instance Methods

(void) - addGraphic:
 
(void) - addGraphics:
 
(void) - addPart
 
(void) - applyGeometry:
 
(void) - clear
 
(void) - clearSelection
 
(int) - defaultDpi
 
(id) - initWithFullEnvelope:
 
(id) - initWithFullEnvelope:renderingMode:
 
(id) - initWithGeometry:
 
(id) - initWithSpatialReference:
 
(void) - insertVertex:inPart:atIndex:
 
(BOOL) - isGraphicSelected:
 
(BOOL) - isInScale
 
(void) - layerDidFailToLoad:
 
(void) - layerDidLoad
 
(void) - mapDidUpdate:
 
(void) - mapView:didClickAtPoint:mapPoint:features:
 
(void) - mapView:didClickAtPoint:mapPoint:graphics:
 
(void) - mapView:didEndTapAndHoldAtPoint:mapPoint:features:
 
(void) - mapView:didEndTapAndHoldAtPoint:mapPoint:graphics:
 
(void) - mapView:didMoveTapAndHoldAtPoint:mapPoint:features:
 
(void) - mapView:didMoveTapAndHoldAtPoint:mapPoint:graphics:
 
(void) - mapView:didTapAndHoldAtPoint:mapPoint:features:
 
(void) - mapView:didTapAndHoldAtPoint:mapPoint:graphics:
 
(BOOL) - mapView:shouldProcessClickAtPoint:mapPoint:
 
(BOOL) - mapView:shouldProcessEndTapAndHoldAtPoint:mapPoint:
 
(void) - mapViewDidCancelTapAndHold:
 
(void) - moveVertexInPart:atIndex:toPoint:
 
(void) - refresh
 
(void) - removeAllGraphics
 
(void) - removeGraphic:
 
(void) - removeGraphics:
 
(void) - removePartAtIndex:
 
(BOOL) - removeSelectedPart
 
(BOOL) - removeSelectedVertex
 
(void) - removeVertexInPart:atIndex:
 
(NSArray *) - selectedGraphics
 
(void) - selectLastVertex
 
(void) - setSelected:forGraphic:
 
(void) - spatialReferenceStatusInitialized
 

Class Methods

(AGSCompositeSymbol *) + defaultMainSymbol
 
(AGSMarkerSymbol *) + defaultMidVertexSymbol
 
(AGSMarkerSymbol *) + defaultSelectedVertexSymbol
 
(AGSMarkerSymbol *) + defaultVertexSymbol
 
(id) + graphicsLayer
 

Properties

BOOL allowCallout
 
BOOL allowHitTest
 
BOOL allowLayerConsolidation
 
id< AGSLayerCalloutDelegatecalloutDelegate
 
id< AGSLayerDelegatedelegate
 
BOOL drawLineAsPolygon
 
AGSPolygondrawnPolygon
 
NSString * endTimeField
 
NSError * error
 
AGSEnvelopefullEnvelope
 
AGSGeometrygeometry
 
NSArray * graphics
 
NSUInteger graphicsCount
 
AGSEnvelopeinitialEnvelope
 
BOOL loaded
 
AGSCompositeSymbolmainSymbol
 
AGSMapViewmapView
 
double maxScale
 
AGSMarkerSymbolmidVertexSymbol
 
double minScale
 
NSString * name
 
CGFloat opacity
 
AGSRendererrenderer
 
AGSGraphicsLayerRenderingMode renderingMode
 
BOOL renderNativeResolution
 
AGSMarkerSymbolselectedVertexSymbol
 
AGSColorselectionColor
 
AGSSymbolselectionSymbol
 
BOOL showNumbersForVertices
 
AGSSpatialReferencespatialReference
 
BOOL spatialReferenceStatusValid
 
NSString * startTimeField
 
BOOL timeAware
 
double timeOffset
 
AGSTimeIntervalUnits timeOffsetUnits
 
NSUndoManager * undoManager
 
AGSMarkerSymbolvertexSymbol
 
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) addPart

Add a part to the geometry

Since
1.8
- (void) applyGeometry: (AGSGeometry *)  geometry

Applies the passed in geometry to the current geometry. These geometries must be matching in type.

Since
1.8
- (void) clear

Clears the current geometry.

Since
1.8
- (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).

+ (AGSCompositeSymbol*) defaultMainSymbol

The default main symbol for sketch graphics layers, this symbol is used for the lines and fills.

Since
1.8
+ (AGSMarkerSymbol*) defaultMidVertexSymbol

The default symbol to display the mid vertices for sketch graphics layers.

Since
1.8
+ (AGSMarkerSymbol*) defaultSelectedVertexSymbol

The default selected vertex symbol for sketch graphics layers.

Since
1.8
+ (AGSMarkerSymbol*) defaultVertexSymbol

The default symbol used to display the vertices for sketch graphics layers.

Since
1.8
+ (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) initWithGeometry: (AGSGeometry *)  geometry

Initializes an AGSSketchGraphicsLayer.

Parameters
geometryThe geometry that will be modified as the user sketches. This geometry must be mutable.
Since
1.8
- (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
- (void) insertVertex: (AGSPoint *)  point
inPart: (NSInteger)  partIndex
atIndex: (NSInteger)  coordinateIndex 

Inserts a vertex in a specfied part and index.

Parameters
pointThe vertex to insert.
partIndexThe index of the part to insert the point.
coordinateIndexThe index of the coordinate at which to insert the point.
Since
1.8
- (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) mapView: (AGSMapView *)  mapView
didClickAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
features: (NSDictionary *)  features 

The method that is called when a user clicks on the map.

Since
1.8

Reimplemented from <AGSMapViewTouchDelegate>.

- (void) mapView: (AGSMapView *)  mapView
didClickAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
graphics: (NSDictionary *)  graphics 
optionalinherited

Tells the delegate the map was single-tapped at specified location.

Parameters
mapViewMap tapped by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
graphicsGraphics from all graphics layers in the map that intersect or contain the location. The dictionary contains layer name (key) : AGSGraphic array (value)
Deprecated:
Deprecated at 10.2. Use mapView:didClickAtPoint:mapPoint:features: instead.
Since
1.8
- (void) mapView: (AGSMapView *)  mapView
didEndTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
features: (NSDictionary *)  features 

The method that is called when a user ends a tap and hold on the map.

Since
1.8

Reimplemented from <AGSMapViewTouchDelegate>.

- (void) mapView: (AGSMapView *)  mapView
didEndTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
graphics: (NSDictionary *)  graphics 
optionalinherited

Tells the delegate that a tap and hold event has ended.

Parameters
mapViewMap tapped and held by the user.
screenScreen coordinates of where the user ended the tap and hold.
mappointMap coordinates of where the user ended the tap and hold.
graphicsGraphics from all graphics layers in the map that intersect or contain the location. The dictionary contains layer name (key) : AGSGraphic array (value)
Deprecated:
Deprecated at 10.2. Use mapView:didEndTapAndHoldAtPoint:mapPoint:features: instead.
Since
1.8
- (void) mapView: (AGSMapView *)  mapView
didMoveTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
features: (NSDictionary *)  features 
optionalinherited

Tells the delegate that the user moved his finger while tapping and holding on the map.

Parameters
mapViewMap tapped and held by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
featuresid<AGSFeature> objects from all hit-testable layers in the map that intersect or contain the location. The dictionary contains layer name (key) : Array of id<AGSFeature> (value)
Since
10.2
- (void) mapView: (AGSMapView *)  mapView
didMoveTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
graphics: (NSDictionary *)  graphics 
optionalinherited

Tells the delegate that the user moved his finger while tapping and holding on the map.

Parameters
mapViewMap tapped and held by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
graphicsGraphics from all graphics layers in the map that intersect or contain the location. The dictionary contains layer name (key) : AGSGraphic array (value)
Deprecated:
Deprecated at 10.2. Use mapView:didMoveTapAndHoldAtPoint:mapPoint:features: instead.
Since
1.8
- (void) mapView: (AGSMapView *)  mapView
didTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
features: (NSDictionary *)  features 
optionalinherited

Tells the delegate that a point on the map was tapped and held at specified location.

Parameters
mapViewMap tapped and held by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
featuresid<AGSFeature> objects from all hit-testable layers in the map that intersect or contain the location. The dictionary contains layer name (key) : Array of id<AGSFeature> (value)
Since
10.2
- (void) mapView: (AGSMapView *)  mapView
didTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint
graphics: (NSDictionary *)  graphics 
optionalinherited

Tells the delegate that a point on the map was tapped and held at specified location.

Parameters
mapViewMap tapped and held by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
graphicsGraphics from all graphics layers in the map that intersect or contain the location. The dictionary contains layer name (key) : AGSGraphic array (value)
Deprecated:
Deprecated at 10.2. Use mapView:didTapAndHoldAtPoint:mapPoint:features: instead.
Since
1.8
- (BOOL) mapView: (AGSMapView *)  mapView
shouldProcessClickAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint 
optionalinherited

Asks the delegate if the map should process the click at the given location. The default value if this method is not implemented is YES.

Parameters
mapViewMap tapped by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
Returns
BOOL value whether the click should be processed by the map.
Since
2.0
- (BOOL) mapView: (AGSMapView *)  mapView
shouldProcessEndTapAndHoldAtPoint: (CGPoint)  screen
mapPoint: (AGSPoint *)  mappoint 
optionalinherited

Asks the delegate if the map should process the tap and hold ended event at the given location. The default value if this method is not implemented is YES.

Parameters
mapViewMap tapped by the user.
screenLocation in screen coordinates.
mappointLocation in map coordinates.
Returns
BOOL value whether the end tap and hold should be processed by the map.
Since
2.0
- (void) mapViewDidCancelTapAndHold: (AGSMapView *)  mapView
optionalinherited

Tells the delegate that a tap and hold event was cancelled. This may happen when you have the magnifier visible and attempt to take a screenshot using the home/lock button combination.

Parameters
mapViewMap tapped and held by the user.
Since
10.1.1
- (void) moveVertexInPart: (NSInteger)  partIndex
atIndex: (NSInteger)  coordinateIndex
toPoint: (AGSPoint *)  point 

Moves a vertex to a specified location.

Parameters
partIndexThe index of the part to insert the point.
coordinateIndexThe index of the coordinate at which to insert the point.
pointThe location to move the point to.
Since
1.8
- (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.

- (void) removePartAtIndex: (NSInteger)  partIndex

Removes a part at a specified index.

Parameters
partIndexIndex of the part to remove.
Since
1.8
- (BOOL) removeSelectedPart

Removes the selected part.

Returns
Boolean value that specifies if the remove succeeded.
Since
1.8
- (BOOL) removeSelectedVertex

Removes the selected vertex.

Returns
Boolean value that specifies if the remove succeeded.
Since
1.8
- (void) removeVertexInPart: (NSInteger)  partIndex
atIndex: (NSInteger)  coordinateIndex 

Remove a vertex in a specified part and index.

Parameters
partIndexThe index of the part to remove the vertex.
coordinateIndexThe index of the coordinate to remove.
Since
1.8
- (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) selectLastVertex

Selects the last vertex in the geometry.

Since
1.8
- (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
readwritenonatomicassigninherited

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

Since
10.2
- (BOOL) allowHitTest
readwritenonatomicassigninherited

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

Since
10.2
- (BOOL) allowLayerConsolidation
readwritenonatomicassigninherited

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

Since
10.1.1.1
- (id<AGSLayerCalloutDelegate>) calloutDelegate
readwritenonatomicweakinherited

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
- (BOOL) drawLineAsPolygon
readwritenonatomicassign

Only valid when you have given the sketch layer an AGSMutablePolyline. Setting this to YES will cause it to be drawn as if it were a polygon.

Since
10.2
- (AGSPolygon*) drawnPolygon
readwritenonatomiccopy

Only valid if drawLineAsPolygon is YES.

Since
10.2
- (NSString*) endTimeField
readwritenonatomiccopyinherited

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
- (AGSGeometry*) geometry
readwritenonatomicstrong

The geometry that is populated as the user sketches. Must be a mutable geometry because it will be modified by the layer while the user is sketching.

Since
1.8
- (NSArray*) graphics
readnonatomiccopyinherited

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
readnonatomicassigninherited

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
- (AGSCompositeSymbol*) mainSymbol
readwritenonatomicstrong

Composite symbol that contains the symbology for drawing the lines and fills for what the user sketches.

Since
1.8
- (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
- (AGSMarkerSymbol*) midVertexSymbol
readwritenonatomicstrong

Symbol to display the mid vertices.

Since
1.8
- (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
readwritenonatomicstronginherited

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
readnonatomicassigninherited

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
- (AGSMarkerSymbol*) selectedVertexSymbol
readwritenonatomicstrong

Symbol used to display the selected vertex.

Since
1.8
- (AGSColor*) selectionColor
readwritenonatomiccopyinherited

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
readwritenonatomicstronginherited

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

Since
10.1.1
See also
selectionColor
- (BOOL) showNumbersForVertices
readwritenonatomicassign

If enabled, every vertex in the sketch is labeled with a number.

Since
10.2
- (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
readwritenonatomiccopyinherited

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
readwritenonatomicassigninherited

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
readwritenonatomicassigninherited

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

Since
10.1.1
- (NSUndoManager*) undoManager
readnonatomicstrong

The undo manager.

Since
1.8
- (AGSMarkerSymbol*) vertexSymbol
readwritenonatomicstrong

Symbol used to display the vertices.

Since
1.8
- (BOOL) visible
readwritenonatomicassigninherited

Indicates whether this layer should be visible in the map.

Since
10.1.1