| Package | com.afcomponents.umap.styles |
| Class | public class MarkerStyle |
| Inheritance | MarkerStyle GeometryStyle Style |
Properties overview:
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:
See also
| Property | Defined by | ||
|---|---|---|---|
![]() | fill : String = "rgb"
Specify a fill style to use when drawing on a Graphics object.
| GeometryStyle | |
![]() | fillAlpha : Number = 0.5
Defines fill color opacity.
| GeometryStyle | |
![]() | fillBitmap : BitmapStyle = null
Defines fill bitmap properties as a
BitmapStyle object. | GeometryStyle | |
![]() | fillGradient : GradientStyle = null
Defines fill gradient properties as a
GradientStyle object. | GeometryStyle | |
![]() | fillRGB : 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 | ||
![]() | stroke : String = "rgb"
Specify a stroke style to use when drawing on a Graphics object.
| GeometryStyle | |
![]() | strokeAlpha : Number = 1.0
Defines stroke opacity.
| GeometryStyle | |
![]() | strokeGradient : GradientStyle = null
Defines stroke gradient properties as a
GradientStyle object. | GeometryStyle | |
![]() | strokeRGB : uint = 0x000000
Defines RGB stroke color.
| GeometryStyle | |
![]() | strokeStyle : StrokeStyle
Defines advanced stroke properties as a
StrokeStyle object. | GeometryStyle | |
![]() | strokeThickness : Number = 2.0
An integer that indicates the thickness of the line in points.
| GeometryStyle | |
| Method | Defined by | ||
|---|---|---|---|
|
MarkerStyle(param:Object = null)
MarkerStyle contructor.
| MarkerStyle | ||
![]() |
applyTo(graphics:Graphics, noFill:Boolean = false, noStroke:Boolean = false):void
Applies current fill & stroke style to the specified
Graphics object. | GeometryStyle | |
![]() |
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 | |
|
fromXML(xml:XML):MarkerStyle
[static]
Creates new MarkerStyle from XML object in KML 2.1 format.
| MarkerStyle | ||
![]() |
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 MarkerStyle.
| MarkerStyle | ||
| icon | property |
public var icon:* = nullSpecifies a custom icon.
It can be either one of the following:
String)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
// 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);
}| iconStyle | property |
public var iconStyle:IconStyleSpecifies IconStyle object that will be applied to the custom icon after it was loaded.
See also
| label | property |
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
| labelStyle | property |
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
| radius | property |
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.
| shadow | property |
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
| shadowStyle | property |
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
| 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:
param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
|
| fromXML | () | method |
public static function fromXML(xml:XML):MarkerStyleCreates new MarkerStyle from XML object in KML 2.1 format.
Parametersxml:XML — XML object with root <Style> node.
|
MarkerStyle —
New MarkerStyle object.
|
<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):XMLBuilds an XML object in KML 2.1 format that describes the MarkerStyle.
ParametersafcTags:Boolean (default = false) — Flag that determines whether to generate KML data with extended AFC tags.
|
XML — XML object in KML 2.1 format.
|
<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>