Instances of this class represent marker symbols. Symbols describe how graphics look on the map. Different symbols are used for graphics with different geometry types. Marker symbols are used to display those graphics which are based on point or multipoint geometry.
Public Member Functions | |
(void) | - decodeWithJSON: |
(void) | - drawGraphic:atX:y:inContext: |
(void) | - drawGraphic:inContext:forEnvelope:atResolution: |
(CGSize) | - drawingSize |
(NSDictionary *) | - encodeToJSON |
(BOOL) | - hitTestGraphic:withEnvelope:atResolution: |
(id) | - initWithJSON: |
(void) | - invalidateCache |
(BOOL) | - shouldDrawGraphic:forEnvelope:atResolution: |
(UIImage *) | - swatchForGeometryType:size: |
Static Public Member Functions | |
(CGPoint) | + toScreenPointWithX:y:envelope:resolution: |
Properties | |
CGFloat | angle |
UIColor * | color |
CGPoint | hotspot |
BOOL | readyToDraw |
BOOL | rotateAroundOffset |
BOOL | shouldCacheSymbol |
CGFloat | xoffset |
CGFloat | yoffset |
- (void) decodeWithJSON: | (NSDictionary *) | json | [optional, inherited] |
Decode object from JSON representation.
json | The JSON representation of the object to be decoded. |
- (void) drawGraphic: | (AGSGraphic *) | graphic | ||
atX: | (float) | x | ||
y: | (float) | y | ||
inContext: | (CGContextRef) | context | ||
This must be implemented by derived classes, don't implement drawGraphic:inContext:forEnvelope:withResolution, implement this instead.
- (void) drawGraphic: | (AGSGraphic *) | graphic | ||
inContext: | (CGContextRef) | context | ||
forEnvelope: | (AGSEnvelope *) | env | ||
atResolution: | (double) | resolution | ||
Method called by AGSGraphicsLayer
to draw geometry onto context.
- (CGSize) drawingSize |
This must be implemented by derived classes. Returns the screen size in points of the symbol to be drawn.
- (NSDictionary *) encodeToJSON | [optional, inherited] |
Encode and return JSON representation for object.
- (BOOL) hitTestGraphic: | (AGSGraphic *) | graphic | ||
withEnvelope: | (AGSEnvelope *) | envelope | ||
atResolution: | (double) | resolution | ||
Called to see if the geometry passes a hit test for this symbol.
- (id) initWithJSON: | (NSDictionary *) | json | [optional, inherited] |
Initialize and return object from JSON representation.
json | The JSON representation of the object to be created. |
Reimplemented in AGSWebMapFeatureCollection.
- (void) invalidateCache |
This may be called by derived classes when a property changes and it needs to invalidate the cache. For example, when you change the size of a simple marker symbol, SMS will call it so that it draws correctly, if the symbol is cached.
- (BOOL) shouldDrawGraphic: | (AGSGraphic *) | graphic | ||
forEnvelope: | (AGSEnvelope *) | envelope | ||
atResolution: | (double) | resolution | ||
Called to see if the symbol should draw for a specific envelope.
- (UIImage *) swatchForGeometryType: | (AGSGeometryType) | geometryType | ||
size: | (CGSize) | size | ||
Returns an image that represents a swatch for a particular geometry type.
geometryType | The type of the geometry determines what kind of swatch is drawn. | |
size | Size of the output swatch. |
+ (CGPoint) toScreenPointWithX: | (double) | x | ||
y: | (double) | y | ||
envelope: | (AGSEnvelope *) | env | ||
resolution: | (double) | res | ||
A method that derived classes can call to help during drawing.
- (CGFloat) angle [read, write, assign] |
The rotation angle (in degrees) of the marker. The marker is rotated in a counter-clockwise direction by the amount specified.
- (UIColor*) color [read, write, retain, inherited] |
Symbol color.
- (CGPoint) hotspot [read, write, assign] |
The location in pixels that defines whether a user tapped on this symbol or not.
For example, consider an AGSPictureMarkerSymbol
using the image of a pushpin. By default, the hotspot would be in the center of the image and so a tap would be registered only if a user tapped in the middle of the pushpin. To allow the user to tap on the head of the pin to show a callout, you would need to specify the corresponding location's hotspot. Furthermore, the callout’s leader will be anchored to this hotspot location.
- (BOOL) readyToDraw [read, write, assign, inherited] |
Property called by the framework. Most symbols should have this set to YES as soon as the symbol is init'ed. If a symbol needs to access a resource asynchronously before it's ready to draw then it should be set to NO initially then YES once it is ready. This is not as efficient as if a symbol is readyToDraw to begin with, however, so custom symbols should only set this to NO initially if absolutely necessary.
- (BOOL) rotateAroundOffset [read, write, assign] |
If true
, the symbol will rotate around the offset location as opposed to the center of the symbol.
- (BOOL) shouldCacheSymbol [read, write, assign] |
This property determines whether or not the symbol can be cached for better performance. Default is YES. Set to NO if you have a symbol that changes often, or if it is a temporary symbol that you only use to draw once. For most cases this should be YES.
- (CGFloat) xoffset [read, write, assign] |
The offset on the x-axis in points, relative to the center of the marker. Default is 0.0 For example, a value of -5 will shift the marker left by 5 points.
This is useful when the marker needs to be offset to properly coincide with a location on the map.
For example, consider an AGSPictureMarkerSymbol
using the image of a pushpin. By default, the center of the image will be used as the anchor to center the image at the map location. However, if you wanted the needle of the pushpin to end at the map location, you would need to specify an xoffset and a yoffset to shift the image appropriately.
- (CGFloat) yoffset [read, write, assign] |
The offset on the y-axis in points, relative to the center of the marker. Default is 0.0 For example, a value of -5 will shift the marker down by 5 points.
This is useful when the marker needs to be offset to properly conicide with a location on the map.
For example, consider an AGSPictureMarkerSymbol
using the image of a pushpin. By default, the center of the image will be used as the anchor to center the image at the map location. However, if you wanted the needle of the pushpin to end at the map location, you would need to specify an xoffset and a yoffset to shift the image appropriately.