Packagenet.systemeD.halcyon.styleparser
Classpublic class RuleSet

A complete stylesheet, as loaded from a MapCSS file. It contains all selectors, declarations, and embedded images.

The RuleSet class has two principal methods: getStyles, which calculates the styles that apply to an entity (returned as a StyleList); and parse, which parses a MapCSS stylesheet into a complete RuleSet.



Public Properties
 PropertyDefined by
  choosers : Array
RuleSet
  evals : Array
RuleSet
  images : Object
Hash of loaded images.
RuleSet
  imageWidths : Object
Hash of image widths.
RuleSet
  loaded : Boolean = false
Is the RuleSet fully loaded and available for use?
RuleSet
Public Methods
 MethodDefined by
  
RuleSet(mins:uint, maxs:uint, redrawCall:Function = null, iconLoadedCallback:Function = null)
Constructor
RuleSet
  
getStyles(obj:Entity, tags:Object, zoom:uint):StyleList
Create a StyleList for an Entity, by creating a blank StyleList, then running each StyleChooser over it.
RuleSet
  
loadFromCSS(str:String):void
Load and then parse a MapCSS stylesheet.
RuleSet
  
parse(css:String):void
Parse a MapCSS stylesheet into a set of StyleChoosers.
RuleSet
  
parseCSSColor(colorStr:String):uint
[static] Convert a colour string from CSS colour name ("blue"), short hex ("#abc") or long hex ("#a0b0c0"), to an integer.
RuleSet
Property detail
choosersproperty
public var choosers:Array
evalsproperty 
public var evals:Array
imagesproperty 
public var images:Object

Hash of loaded images. Hash key is filename, value is BitmapData for the image.

imageWidthsproperty 
public var imageWidths:Object

Hash of image widths. Hash key is filename, value is pixel width.

loadedproperty 
public var loaded:Boolean = false

Is the RuleSet fully loaded and available for use?

Constructor detail
RuleSet()constructor
public function RuleSet(mins:uint, maxs:uint, redrawCall:Function = null, iconLoadedCallback:Function = null)

Constructor

Parameters
mins:uint
 
maxs:uint
 
redrawCall:Function (default = null)
 
iconLoadedCallback:Function (default = null)
Method detail
getStyles()method
public function getStyles(obj:Entity, tags:Object, zoom:uint):StyleList

Create a StyleList for an Entity, by creating a blank StyleList, then running each StyleChooser over it.

Parameters
obj:Entity
 
tags:Object
 
zoom:uint

Returns
StyleList

See also

loadFromCSS()method 
public function loadFromCSS(str:String):void

Load and then parse a MapCSS stylesheet. Usually you will supply a filename, but you can also pass a complete stylesheet in the string parameter. (Any string containing space characters will be assumed to be a stylesheet rather than a filename.)

Parameters
str:String
parse()method 
public function parse(css:String):void

Parse a MapCSS stylesheet into a set of StyleChoosers. The parser is regular expression-based and runs sequentially through the file from start to end.

Parameters
css:String
parseCSSColor()method 
public static function parseCSSColor(colorStr:String):uint

Convert a colour string from CSS colour name ("blue"), short hex ("#abc") or long hex ("#a0b0c0"), to an integer.

Parameters
colorStr:String

Returns
uint