Packagecom.afcomponents.umap.styles
Classpublic class MarkerStyle
InheritanceMarkerStyle Inheritance GeometryStyle Inheritance Style

Specifies a drawing style for a Marker overlay.

Properties overview:

MarkerStyle example


Example
Here is a quick example:
 import com.afcomponents.umap.core.UMap;
 import com.afcomponents.umap.styles.
 import com.afcomponents.umap.overlays.Marker;
  
 // create UMap instance
 var map:UMap = new UMap();
 map.setSize(300,300);
 addChild(map);
  
 // create new Marker Style
 var style:MarkerStyle = new MarkerStyle();
 style.radius = 20;
 style.fill = GeometryStyle.RGB;
 style.fillRGB = 0xFFCC00;
 style.fillAlpha = 1.0;
 style.strokeRGB = 0x000055;
 style.strokeAlpha = 1.0;
 style.strokeThickness = 4;
 style.labelStyle.textFormat.bold = true;
 style.labelStyle.textFormat.size = 24;
 
 // create new Marker overlay with the defined style and add it to the map
 var marker:Marker = new Marker({index:"A"}, style);
 map.addOverlay(marker);
 

Here is what you should see after executing the code:

MarkerStyle example

See also

com.afcomponents.umap.overlays.Marker


Public Properties
 PropertyDefined by
 Inheritedfill : String = "rgb"
Specify a fill style to use when drawing on a Graphics object.
GeometryStyle
 InheritedfillAlpha : Number = 0.5
Defines fill color opacity.
GeometryStyle
 InheritedfillBitmap : BitmapStyle = null
Defines fill bitmap properties as a BitmapStyle object.
GeometryStyle
 InheritedfillGradient : GradientStyle = null
Defines fill gradient properties as a GradientStyle object.
GeometryStyle
 InheritedfillRGB : uint = 0x89B9FE
Defines RGB fill color.
GeometryStyle
  icon : * = null
Specifies a custom icon.
MarkerStyle
  iconStyle : IconStyle
Specifies IconStyle object that will be applied to the custom icon after it was loaded.
MarkerStyle
  label : Boolean = true
Defines whether to display label with index text.
MarkerStyle
  labelStyle : TextStyle
Specifies a TextStyle object that controls label's appearence.
MarkerStyle
  radius : Number = 10
Defines default icon radius.
MarkerStyle
  shadow : Boolean = true
Defines whether to display a drop shadow.
MarkerStyle
  shadowStyle : DropShadowStyle
Specifies a DropShadowStyle object that controls drop shadow render parameters.
MarkerStyle
 Inheritedstroke : String = "rgb"
Specify a stroke style to use when drawing on a Graphics object.
GeometryStyle
 InheritedstrokeAlpha : Number = 1.0
Defines stroke opacity.
GeometryStyle
 InheritedstrokeGradient : GradientStyle = null
Defines stroke gradient properties as a GradientStyle object.
GeometryStyle
 InheritedstrokeRGB : uint = 0x000000
Defines RGB stroke color.
GeometryStyle
 InheritedstrokeStyle : StrokeStyle
Defines advanced stroke properties as a StrokeStyle object.
GeometryStyle
 InheritedstrokeThickness : Number = 2.0
An integer that indicates the thickness of the line in points.
GeometryStyle
Public Methods
 MethodDefined by
  
MarkerStyle(param:Object = null)
MarkerStyle contructor.
MarkerStyle
 Inherited
applyTo(graphics:Graphics, noFill:Boolean = false, noStroke:Boolean = false):void
Applies current fill & stroke style to the specified Graphics object.
GeometryStyle
 Inherited
Creates a copy of the Style object.
Style
 Inherited
concat(param:Object):Style
Creates a clone of this Style, copies the properties from specified object and returns the new style.
Style
 Inherited
copy(object:Object):void
Copies all the properties from the specified object into the Style object.
Style
 Inherited
copyStyle(dest:Object, src:Object):void
[static] Copies all properties of one object into another.
Style
  
fromXML(xml:XML):MarkerStyle
[static] Creates new MarkerStyle from XML object in KML 2.1 format.
MarkerStyle
 Inherited
[static] Returns new Style object, from the source XML object.
Style
 Inherited
getXMLFromStyle(style:Style, name:String = ""):XML
[static] Returns an XML object that represents all the style's properties.
Style
 Inherited
toString():String
Returns a String that represents all the style's properties.
Style
  
toXML(afcTags:Boolean = false):XML
Builds an XML object in KML 2.1 format that describes the MarkerStyle.
MarkerStyle
Public Constants
 ConstantDefined by
 InheritedBITMAP : String = "bitmap"
[static] The GeometryStyle.BITMAP constant defines the value of the fill property of the GeometryStyle object that indicates that bitmap fill should be used.
GeometryStyle
 InheritedGRADIENT : String = "gradient"
[static] The GeometryStyle.GRADIENT constant defines the value of the fill or stroke property of the GeometryStyle object that indicates that gradient fill or stroke should be used.
GeometryStyle
 InheritedNONE : String = "none"
[static] The GeometryStyle.NONE constant defines the value of the fill or stroke property of the GeometryStyle object that indicates that no fill or stroke should be used.
GeometryStyle
 InheritedRGB : String = "rgb"
[static] The GeometryStyle.RGB constant defines the value of the fill or stroke property of the GeometryStyle object that indicates that simple one-color fill or stroke should be used.
GeometryStyle
Property detail
iconproperty
public var icon:* = null

Specifies a custom icon.

It can be either one of the following:

  • URL to an external image (String)
  • Class Name of a symbol in the library (String)
  • URLRequest object instance (URLRequest)
  • DisplayObject instance (DisplayObject)
  • If you specify a custom icon, the default one is not created. To know when the icon has been loaded catch OverlayEvent.READY event. To remove loaded icon & return to normal, specify new style with icon property set to null.

    See also


    Example
    Here is an example of using custom & default icon:
      // You should have a custom icon in your library with linked class name "myMarker"
      // (simply draw something, create new symbol, name it & export for AS)
      // Example switches custom icon to default and visa-versa on each user CLICK
       
      import com.afcomponents.umap.core.UMap;
      import com.afcomponents.umap.styles.MarkerStyle;
      import com.afcomponents.umap.overlays.Marker;
      import com.afcomponents.umap.types.LatLng;
      import com.afcomponents.umap.types.Align;
      import com.afcomponents.umap.events.OverlayEvent;
        
      // create UMap instance
      var map:UMap = new UMap();
      map.setSize(300,300);
      addChild(map);
       
      // create new Marker style
      var style:MarkerStyle = new MarkerStyle();
      // specify icon as a symbol in the library
      style.icon = "myMarker";
      style.iconStyle.align = Align.fromString("bottom-center");
       
      // create parameter object
      var param:Object = new Object();
      param.position = new LatLng(20, 10);
      param.autoInfo = false;
       
      // create new marker and add it to the map
      var marker:Marker = map.addOverlay(new Marker(param, style)) as Marker;
      marker.addEventListener(OverlayEvent.CLICK, markerClick);
       
      // marker CLICK handler
      function markerClick(event:OverlayEvent)
      {
       var target:Marker = event.target as Marker;
       var newStyle:MarkerStyle = target.getStyle() as MarkerStyle;
       if (newStyle.icon == null)
       {
        newStyle.icon = "myMarker";
       }
       else
       {
        newStyle.icon = null;
       }
       target.setStyle(newStyle);
      }

    iconStyleproperty 
    public var iconStyle:IconStyle

    Specifies IconStyle object that will be applied to the custom icon after it was loaded.

    See also

    com.afcomponents.umap.style.IconStyle
    labelproperty 
    public var label:Boolean = true

    Defines whether to display label with index text. Please note that label can be visible both in custom & default icons. If index property is set to null, label will be invisible. To control label's appearence please use labelStyle property.

    The default value is true.

    See also

    labelStyleproperty 
    public var labelStyle:TextStyle

    Specifies a TextStyle object that controls label's appearence. Text field with a label will be always automatically sized, so TextStyle.autoSize property will have no effect.

    See also

    radiusproperty 
    public var radius:Number = 10

    Defines default icon radius. Changing the radius property scales the whole icon, because the tail heightis proportional to the radius value.

    Tail height is proportional to the radius value.

    The default value is 10.

    shadowproperty 
    public var shadow:Boolean = true

    Defines whether to display a drop shadow. Use shadowStyle proeprty to control drop shadow style.

    The default value is true.

    See also

    shadowStyleproperty 
    public var shadowStyle:DropShadowStyle

    Specifies a DropShadowStyle object that controls drop shadow render parameters. The shadow will not be rendered if shadow property is set to false.

    See also

    Constructor detail
    MarkerStyle()constructor
    public function MarkerStyle(param:Object = null)

    MarkerStyle contructor.

    Creates new MarkerStyle object with the default parameters. Properties defined in param object will override the default values.

    By default, marker will be drawn gradient-filled with a grey outline & black index text:

    MarkerStyle example

    Parameters
    param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
    Method detail
    fromXML()method
    public static function fromXML(xml:XML):MarkerStyle

    Creates new MarkerStyle from XML object in KML 2.1 format.

    Parameters
    xml:XML — XML object with root <Style> node.

    Returns
    MarkerStyle — New MarkerStyle object.

    Example
    Here is a sample KML structure:
      <Style id="ID">
        <IconStyle id="ID">
          <!-- inherited from ColorStyle -->
          <color>ffffffff</color>         <!-- kml:color -->
          <colorMode>normal</colorMode>   <!-- kml:colorModeEnum:normal or random -->
            
          <!-- specific to IconStyle -->
          <scale>1</scale>                <!-- float -->
          <heading>0</heading>            <!-- float -->
          <Icon>                                <!-- Custom icon -->
            <href>...</href>
          </Icon>
          <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>  <!-- kml:vec2Type -->
        </IconStyle>
      </Style>

    toXML()method 
    public override function toXML(afcTags:Boolean = false):XML

    Builds an XML object in KML 2.1 format that describes the MarkerStyle.

    Parameters
    afcTags:Boolean (default = false) — Flag that determines whether to generate KML data with extended AFC tags.

    Returns
    XML — XML object in KML 2.1 format.

    Example
    Here is a sample KML structure:
      <Style id="ID">
        <IconStyle id="ID">
          <!-- inherited from ColorStyle -->
          <color>ffffffff</color>         <!-- kml:color -->
          <colorMode>normal</colorMode>   <!-- kml:colorModeEnum:normal or random -->
            
          <!-- specific to IconStyle -->
          <scale>1</scale>                <!-- float -->
          <heading>0</heading>            <!-- float -->
          <Icon>                                <!-- Custom icon -->
            <href>...</href>
          </Icon>
          <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>  <!-- kml:vec2Type -->
        </IconStyle>
      </Style>