Packagecom.afcomponents.umap.styles
Classpublic class Style
SubclassesBitmapStyle, DropShadowStyle, GeometryStyle, GradientStyle, GroupStyle, IconStyle, StrokeStyle, TextStyle

Style is the base abstract class for all UMap styles. It provides methods for copying, cloning and merging style objects. Classes contructor also support style creation from an untyped object.

You should never create instance of the Style class directly. Instead please create a subclass, define static public constant ENUM_PARAMS as an Array holding all the tunable variable names. You constructor should accept a parameters Object which holds the parameters that need to be modified. Simply pass this Object to a superclass.


Example
Here is a sample MyStyle class, which subclasses Style.
  1. Create new ActionScript file, copy & paste the code below and save it as MyScript.as.
  2.  package
     {
      import com.afcomponents.umap.styles.Style;
      
      public class MyStyle extends Style
      {
       // constant that holds all tuneable parameter names
       static public const ENUM_PARAMS:Array = ['a', 'b', 'c'];
       
       // parameters & default values
       public var a:String = "myString";
       public var b:Number = 1.2345;
       public var c:Boolean = true;
       
       // class constructor
       public function MyStyle (param:Object = null)
       {
        super(param);
       }
      }
     }
  3. Create new .fla file, copy & paste the code below and save it in the same folder your MyScipt.as file is.
  4.  var style:MyStyle = new MyStyle(); // all default parameters
     trace(style);
     style = null;
     style = new MyStyle({a:"anotherString", b:0, c:false});
     trace(style);
  5. Run the code. The output window should read:
  6.  MyStyle {a: 'myString', b: 1.2345, c: true}
     MyStyle {a: 'anotherString', b: 0, c: false}



Public Methods
 MethodDefined by
  
Style(param:Object = null)
Style constructor.
Style
  
Creates a copy of the Style object.
Style
  
concat(param: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] 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
Abstract function.
Style
Constructor detail
Style()constructor
public function Style(param:Object = null)

Style constructor. Creates new Style object with the default parameters. Properties defined in param object will override the default values. You should never create an instance of this Class directly, instead use subclassing. Don't forget to define public static constant ENUM_PARAMS as an Array where you should list all the tuneable properties.

Parameters
param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.

Throws
— Direct instantiation not allowed.
 
— com.afcomponents.umap.styles::Style.ENUM_PARAMS hasn't been defined.
Method detail
clone()method
public function clone():Style

Creates a copy of the Style object.

Returns
Style — A copy of this object.
concat()method 
public function concat(param:Object):Style

Creates a clone of this Style, copies the properties from specified object and returns the new style.

Parameters
param:Object — Object that defines all the properties you wish to copy.

Returns
Style — A cloned style concatennated with specified object.
copy()method 
public function copy(object:Object):void

Copies all the properties from the specified object into the Style object.

Parameters
object:Object — Object that defines all the properties you wish to copy.
copyStyle()method 
public static function copyStyle(dest:Object, src:Object):void

Copies all properties of one object into another.

Parameters
dest:Object — Destination object
 
src:Object — Source object
getStyleFromXML()method 
public static function getStyleFromXML(xml:XML):Style

Returns new Style object, from the source XML object.

Parameters
xml:XML — Source XML object.

Returns
StyleStyle object which will be created from the source XML object.
getXMLFromStyle()method 
public static function getXMLFromStyle(style:Style, name:String = ""):XML

Returns an XML object that represents all the style's properties.

Parameters
style:Style — Destination object
 
name:String (default = "")

Returns
XML — Style's properties structured as an XML object.
toString()method 
public function toString():String

Returns a String that represents all the style's properties.

The output will look like "Style Class Name {property1:value, property2:value, ...}"

Returns
String — A textual representation of this Style object.
toXML()method 
public function toXML(afcTags:Boolean = false):XML

Abstract function. Override to return XML data in KML 2.1 format.

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, or null if KML export for the style is unsupported.