| Package | com.afcomponents.umap.styles |
| Class | public class IconStyle |
| Inheritance | IconStyle Style |
// 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 uses IconStyle object for advanced icon styling
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();
style.icon = "myMarker";
// align icon to bottom center
style.iconStyle.align = Align.fromString("bottom-center");
// inflate icon twice it's size
style.iconStyle.scale = 2;
// rotate icon 45 degress
style.iconStyle.rotation = 45;
// make icon semi-transparent
style.iconStyle.colorTransform = new ColorTransform(1.0, 1.0, 1.0, 0.5);
// 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
map.addOverlay(new Marker(param, style));See also
| Property | Defined by | ||
|---|---|---|---|
| align : Align
Specifies Align object that will be used to align the icon.
| IconStyle | ||
| colorTransform : ColorTransform = null
Specifies the color transform object that should be applied to the icon.
| IconStyle | ||
| offset : Offset
Specifies new offset distance taht should be applied to icon after aligning.
| IconStyle | ||
| rotation : Number = 0
Specifies the rotation angle of the icon in degrees.
| IconStyle | ||
| scale : Number = 1
Specifies the scaling factor of the icon.
| IconStyle | ||
| Method | Defined by | ||
|---|---|---|---|
|
IconStyle(param:Object = null)
IconStyle contructor.
| IconStyle | ||
|
applyTo(icon:DisplayObject, target:*):void
Applies the style to a DisplayObject.
| IconStyle | ||
![]() |
Creates a copy of the
Style object. | Style | |
![]() |
Creates a clone of this
Style,
copies the properties from specified object and returns the new style. | Style | |
![]() |
copy(object:Object):void
Copies all the properties from the specified object into the
Style object. | Style | |
![]() |
copyStyle(dest:Object, src:Object):void
[static]
Copies all properties of one object into another.
| Style | |
|
[static]
Creates new IconStyle from XML object in KML 2.1 format.
| IconStyle | ||
![]() |
getStyleFromXML(xml:XML):Style
[static]
Returns new
Style object, from the source XML object. | Style | |
![]() |
getXMLFromStyle(style:Style, name:String = ""):XML
[static]
Returns an
XML object that represents all the style's properties. | Style | |
![]() |
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 IconStyle.
| IconStyle | ||
| align | property |
public var align:AlignSpecifies Align object that will be used to align the icon.
The default value is bottom-center alignment.
See also
| colorTransform | property |
public var colorTransform:ColorTransform = nullSpecifies the color transform object that should be applied to the icon.
The default value is No color transformation..
| offset | property |
public var offset:OffsetSpecifies new offset distance taht should be applied to icon after aligning.
The default value is no offset.
See also
| rotation | property |
public var rotation:Number = 0Specifies the rotation angle of the icon in degrees.
The default value is 0.
| scale | property |
public var scale:Number = 1Specifies the scaling factor of the icon.
The default value is 1.
| IconStyle | () | constructor |
public function IconStyle(param:Object = null)IconStyle contructor.
Creates new IconStyle object with the default parameters.
Properties defined in param object will override the default values.
By default, icon will be aligned bottom-center with no scaling, rotation and color transformation applied.
Parametersparam:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
|
| applyTo | () | method |
public function applyTo(icon:DisplayObject, target:*):voidApplies the style to a DisplayObject.
Parametersicon:DisplayObject — DisplayObject that needs to be aligned.
|
|
target:* — Target object that we wish to align the icon with.
Can be one of the following: DisplayObject, Bounds object or a Point.
|
See also
| fromXML | () | method |
public static function fromXML(xml:XML):IconStyleCreates new IconStyle from XML object in KML 2.1 format.
Parametersxml:XML — XML object with root <IconStyle> node.
|
IconStyle —
New IconStyle object.
|
<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 -->
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> <!-- kml:vec2Type -->
</IconStyle>| toXML | () | method |
public override function toXML(afcTags:Boolean = false):XMLBuilds an XML object in KML 2.1 format that describes the IconStyle.
ParametersafcTags:Boolean (default = false) — Flag that determines whether to generate KML data with extended AFC tags.
|
XML — XML object in KML 2.1 format.
|
<IconStyle id="ID">
<!-- specific to IconStyle -->
<scale>1</scale> <!-- float -->
<heading>0</heading> <!-- float -->
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> <!-- kml:vec2Type -->
</IconStyle>