Packagecom.distriqt.extension.nativemaps.objects
Classpublic class CustomMarkerIcon
InheritanceCustomMarkerIcon Inheritance Object

This class defines a custom image which can be used as the icon for a MapMarker object.



Public Properties
 PropertyDefined By
  centerOffset : Point
centerOffset is the offset in pixels from the center of the marker image to the position that gets placed at the markers coordinate.
CustomMarkerIcon
  id : String
This ID should be used when setting custom icons for map markers.
CustomMarkerIcon
  image : BitmapData
The image associated with this custom icon
CustomMarkerIcon
  pixelScale : Number = -1
The pixel scale to be used when drawing this image For iOS retina displays, this should be set to 2.
CustomMarkerIcon
Public Methods
 MethodDefined By
  
CustomMarkerIcon(id:String, image:BitmapData = null, pixelScale:Number = -1, centerOffset:Point = null)
Constructor
CustomMarkerIcon
  
dispose():void
Disposes any current image bitmap data stored.
CustomMarkerIcon
  
setCenterOffset(x:Number, y:Number):CustomMarkerIcon
Sets the offsets to use for this marker icon
CustomMarkerIcon
  
setImage(image:BitmapData):CustomMarkerIcon
Sets the image used as the marker icon from the given BitmapData instance.
CustomMarkerIcon
  
setPixelScale(pixelScale:Number):CustomMarkerIcon
Sets the pixel scale for this marker icon.
CustomMarkerIcon
Property Detail
centerOffsetproperty
public var centerOffset:Point

centerOffset is the offset in pixels from the center of the marker image to the position that gets placed at the markers coordinate. Positive offset values move the icon down and to the right, while negative values move it up and to the left.

By default, the center of the marker icon is placed over the coordinate of the marker. i.e. offsets of 0.

To use the bottom middle of the image as the anchor point you would set the x offset to be 0 and the y offset to be - imageHeight / 2


Example
The following will set the bottom middle of the icon to be placed on the position of the marker.
         var markerImage:Bitmap = ...;
                  var markerIcon:CustomMarkerIcon = new CustomMarkerIcon( "MARKER_ID_1" )
              .setImage( markerImage.bitmapData )
              .setCenterOffset( 0, -markerImage.height 0.5 );
         
idproperty 
public var id:String

This ID should be used when setting custom icons for map markers.

Set customIconId property of a MapMarker instance to match this ID value.

imageproperty 
public var image:BitmapData

The image associated with this custom icon

pixelScaleproperty 
public var pixelScale:Number = -1

The pixel scale to be used when drawing this image

For iOS retina displays, this should be set to 2. You should create two versions of marker icons to allow retina display support, and use NativeMaps.service.isRetinaDisplay() to decide which icon to use when creating markers.

The default of -1 will use the device scale and automatically scale the icon to the device.

Constructor Detail
CustomMarkerIcon()Constructor
public function CustomMarkerIcon(id:String, image:BitmapData = null, pixelScale:Number = -1, centerOffset:Point = null)

Constructor

Parameters
id:String — String A string ID to identify the icon. This must be unique.
 
image:BitmapData (default = null) — BitmapData A bitmap data object to be used as the icon.
 
pixelScale:Number (default = -1)
 
centerOffset:Point (default = null)
Method Detail
dispose()method
public function dispose():void

Disposes any current image bitmap data stored. This method is used internally. You will probably not need this.

setCenterOffset()method 
public function setCenterOffset(x:Number, y:Number):CustomMarkerIcon

Sets the offsets to use for this marker icon

Parameters

x:Number
 
y:Number

Returns
CustomMarkerIconCustomMarkerIcon instance for chaining
setImage()method 
public function setImage(image:BitmapData):CustomMarkerIcon

Sets the image used as the marker icon from the given BitmapData instance.

Parameters

image:BitmapDataBitmapData instance

Returns
CustomMarkerIconCustomMarkerIcon instance for chaining
setPixelScale()method 
public function setPixelScale(pixelScale:Number):CustomMarkerIcon

Sets the pixel scale for this marker icon.

Parameters

pixelScale:Number — The pixel scale.

Returns
CustomMarkerIconCustomMarkerIcon instance for chaining