Packageorg.openscales.core.layer
Classpublic class Layer
InheritanceLayer Inheritance flash.display.Sprite
Subclasses Aggregate, HTTPRequest, ImageLayer, SwitchLayers, VectorLayer

A Layer displays raster (image) of vector datas on the map, usually loaded from a remote datasource. Unit of the baseLayer is managed by the projection. To access : ProjProjection.getProjProjection(layer.projection).projParams.units



Public Properties
 PropertyDefined By
  aggregate : Aggregate
The aggregate which contains this layer, null most of the time.
Layer
  alpha : Number
[override] [write-only] opacity of the layer (between 0 and 1)
Layer
  available : Boolean
[read-only] The boolean that say if the layer is available or not (according to map) This is a readonly parameter.
Layer
  availableProjections : Vector.<String>
Define the layer available projections by its SRS codes.
Layer
  constraints : Vector.<Constraint>
A list of constraints for the layer
Layer
  DEFAULT_MAXEXTENT : Bounds
[static] [read-only]
Layer
  displayed : Boolean
[read-only] Is this layer currently displayed ?
Layer
  displayInLayerManager : Boolean
Indicates if the layer should be displayed in the LayerManager List or not
Layer
  dpi : Number
Indicates the dpi used to calculate resolution and scale upon this layer
Layer
  extent : Bounds
[read-only] A Bounds object which represents the location bounds of the current extent display on the map.
Layer
  inRange : Boolean
[read-only] Is this layer currently in range, based on its min and max resolutions
Layer
  isFixed : Boolean
Whether or not the layer is a fixed layer.
Layer
  loadComplete : Boolean
[read-only] Whether or not the layer is loading data
Layer
  map : Map
Return a reference to the map where belong this layer
Layer
  maxExtent : Bounds
Maximum extent for this layer.
Layer
  maxResolution : Resolution
Maximal valid resolution for this layer
Layer
  metaData : Object
Allows to add custom metadata about the layer
Layer
  minResolution : Resolution
Minimal valid resolution for this layer
Layer
  name : String
[override] The layer Name (appears in LayerManager for example)
Layer
  numZoomLevels : Number
[read-only] Number of zoom levels (resolutions array length)
Layer
  originators : Vector.<DataOriginator>
The list of originators for the layer.
Layer
  projection : ProjProjection
The projection of the map.
Layer
  proxy : String
Proxy (usually a PHP, Python, or Java script) used to request remote servers like WFS servers in order to allow crossdomain requests.
Layer
  resolutions : Array
A list of map resolutions (map units per pixel) in descending order.
Layer
  security : ISecurity
Security manager associated to this layer
Layer
  selected : Boolean
Layer
  url : String
The url use for the layer request if necessary.
Layer
  visible : Boolean
[override] [write-only] Define if this layer is visible (displayed) or not
Layer
  zindex : int
Current layer position in the display list
Layer
Protected Properties
 PropertyDefined By
  _autoResolution : Boolean = true
Layer
  _centerChanged : Boolean = false
Layer
  loading : Boolean
[write-only] Used to set loading status of layer
Layer
  _mapReload : Boolean = false
Layer
  _projection : ProjProjection = null
Layer
  _projectionChanged : Boolean = false
Layer
  _resolutionChanged : Boolean = false
Layer
Public Methods
 MethodDefined By
  
Layer(name:String)
Layer constructor
Layer
  
addOriginator(originator:DataOriginator):void
Add a new originator for the layer
Layer
  
clear():void
Clear the layer graphics
Layer
  
destroy():void
Detroy the map, including removing all event listeners
Layer
  
generateResolutions(numZoomLevels:uint, nominalResolution:Number):void
Generate resolutions array for a nominal resolution (higher one) and a number of zoom levels.
Layer
  
getLayerPxFromMapPx(mapPx:Pixel):Pixel
Layer
  
getLocationFromMapPx(viewPortPx:Pixel):Location
Return a LonLat which is the passed-in map Pixel, translated into lon/lat by the layer.
Layer
  
getMapPxFromLayerPx(layerPx:Pixel):Pixel
Layer
  
getMapPxFromLocation(lonlat:Location):Pixel
Return a Pixel which is the passed-in LonLat,translated into map pixels.
Layer
  
getURL(bounds:Bounds):String
Return layer URL
Layer
  
hasMultiBBoxes():Boolean
Tells whether this layer defines multiple bounding boxes
Layer
  
isAvailableForBounds(bounds:Bounds, resolution:Resolution):Boolean
This method tells if the layer is available for the specified bounds and resolution
Layer
  
redraw(fullRedraw:Boolean = false):void
Check if the layer can be drawn according to the map parameters.
Layer
  
Remove map related event listeners
Layer
  
reset():void
Reset layer data
Layer
  
supportsProjection(compareProj:*):Boolean
This method tells if the layer supports a projection given in parameter according to the availableProjections set for this layer.
Layer
Protected Methods
 MethodDefined By
  
draw():void
Reset layer data
Layer
  
onEnterFrame(event:Event):void
Bind the redraw of the layers on the flash onEnterFrame
Layer
  
This function is call when the MapEvent.CENTER_CHANGED Call the redraw function to check if the layer can be displayed Override this method if you want a specific behaviour in your layer when the center is changed
Layer
  
Layer
  
This function is call when the MapEvent.PROJECTION_CHANGED Override this method if you want a specific behaviour in your layer when the projection of the map is changed
Layer
  
onMapReload(event:MapEvent):void
This function is call when the MapEvent.RELOAD Override this method if you want a specific behaviour in your layer when the map ask for a reload.
Layer
  
This function is call when the MapEvent.RESIZE Call the redraw method to fully actualize the layer Override this method if you want a specific behaviour in your layer when the size of the map is changed
Layer
  
This function is call when the MapEvent.RESOLUTION_CHANGED Override this method if you want a specific behaviour in your layer when the resolution of the map is changed
Layer
  
This function is call when the MapEvent.MAX_EXTENT_CHANGED Call the redraw method to fully actualize the layer Override this method if you want a specific behaviour in your layer when the MaxExtent of the map is changed
Layer
  
Layer
Public Constants
 ConstantDefined By
  DEFAULT_DPI : Number = 92
[static]
Layer
  DEFAULT_NOMINAL_RESOLUTION : Resolution
[static]
Layer
  DEFAULT_NUM_ZOOM_LEVELS : uint = 18
[static]
Layer
  DEFAULT_PROJECTION : ProjProjection
[static]
Layer
  RESOLUTION_TOLERANCE : Number = 0.000001
[static]
Layer
Property Detail
_autoResolutionproperty
protected var _autoResolution:Boolean = true

_centerChangedproperty 
protected var _centerChanged:Boolean = false

_mapReloadproperty 
protected var _mapReload:Boolean = false

_projectionproperty 
protected var _projection:ProjProjection = null

_projectionChangedproperty 
protected var _projectionChanged:Boolean = false

_resolutionChangedproperty 
protected var _resolutionChanged:Boolean = false

aggregateproperty 
aggregate:Aggregate

The aggregate which contains this layer, null most of the time.


Implementation
    public function get aggregate():Aggregate
    public function set aggregate(value:Aggregate):void
alphaproperty 
alpha:Number  [write-only] [override]

opacity of the layer (between 0 and 1)


Implementation
    public function set alpha(value:Number):void
availableproperty 
available:Boolean  [read-only]

The boolean that say if the layer is available or not (according to map) This is a readonly parameter. Override this method and check what you need to check and return if your layer is available or not.


Implementation
    public function get available():Boolean
availableProjectionsproperty 
availableProjections:Vector.<String>

Define the layer available projections by its SRS codes.


Implementation
    public function get availableProjections():Vector.<String>
    public function set availableProjections(value:Vector.<String>):void
constraintsproperty 
constraints:Vector.<Constraint>

A list of constraints for the layer


Implementation
    public function get constraints():Vector.<Constraint>
    public function set constraints(value:Vector.<Constraint>):void
DEFAULT_MAXEXTENTproperty 
DEFAULT_MAXEXTENT:Bounds  [read-only]


Implementation
    public static function get DEFAULT_MAXEXTENT():Bounds
displayedproperty 
displayed:Boolean  [read-only]

Is this layer currently displayed ?


Implementation
    public function get displayed():Boolean
displayInLayerManagerproperty 
displayInLayerManager:Boolean

Indicates if the layer should be displayed in the LayerManager List or not

The default value is true.


Implementation
    public function get displayInLayerManager():Boolean
    public function set displayInLayerManager(value:Boolean):void
dpiproperty 
dpi:Number

Indicates the dpi used to calculate resolution and scale upon this layer


Implementation
    public function get dpi():Number
    public function set dpi(value:Number):void
extentproperty 
extent:Bounds  [read-only]

A Bounds object which represents the location bounds of the current extent display on the map.


Implementation
    public function get extent():Bounds
inRangeproperty 
inRange:Boolean  [read-only]

Is this layer currently in range, based on its min and max resolutions


Implementation
    public function get inRange():Boolean
isFixedproperty 
isFixed:Boolean

Whether or not the layer is a fixed layer. Fixed layers cannot be controlled by users


Implementation
    public function get isFixed():Boolean
    public function set isFixed(value:Boolean):void
loadCompleteproperty 
loadComplete:Boolean  [read-only]

Whether or not the layer is loading data


Implementation
    public function get loadComplete():Boolean
loadingproperty 
loading:Boolean  [write-only]

Used to set loading status of layer


Implementation
    protected function set loading(value:Boolean):void
mapproperty 
map:Map

Return a reference to the map where belong this layer


Implementation
    public function get map():Map
    public function set map(value:Map):void
maxExtentproperty 
maxExtent:Bounds

Maximum extent for this layer. No data outside the extent will be displayed


Implementation
    public function get maxExtent():Bounds
    public function set maxExtent(value:Bounds):void
maxResolutionproperty 
maxResolution:Resolution

Maximal valid resolution for this layer


Implementation
    public function get maxResolution():Resolution
    public function set maxResolution(value:Resolution):void
metaDataproperty 
metaData:Object

Allows to add custom metadata about the layer


Implementation
    public function get metaData():Object
    public function set metaData(value:Object):void
minResolutionproperty 
minResolution:Resolution

Minimal valid resolution for this layer


Implementation
    public function get minResolution():Resolution
    public function set minResolution(value:Resolution):void
nameproperty 
name:String[override]

The layer Name (appears in LayerManager for example)

This property can be used as the source for data binding.


Implementation
    public function get name():String
    public function set name(value:String):void
numZoomLevelsproperty 
numZoomLevels:Number  [read-only]

Number of zoom levels (resolutions array length)


Implementation
    public function get numZoomLevels():Number
originatorsproperty 
originators:Vector.<DataOriginator>

The list of originators for the layer.


Implementation
    public function get originators():Vector.<DataOriginator>
    public function set originators(value:Vector.<DataOriginator>):void
projectionproperty 
projection:ProjProjection

The projection of the map. This is the display projection of the map If a layer is not in the same projection as the projection of the map he will not be displayed.

The default value is Geometry.DEFAULT_SRS_CODE.


Implementation
    public function get projection():ProjProjection
    public function set projection(value:ProjProjection):void
proxyproperty 
proxy:String

Proxy (usually a PHP, Python, or Java script) used to request remote servers like WFS servers in order to allow crossdomain requests. Remote servers can be used without proxy script by using crossdomain.xml file like http://openscales.org/crossdomain.xml There is 3 cases : - proxy is explicitly defined - proxy is explicitly defined to "" => no proxy will be used - proxy is null => use the proxy of the map


Implementation
    public function get proxy():String
    public function set proxy(value:String):void
resolutionsproperty 
resolutions:Array

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, etc.).


Implementation
    public function get resolutions():Array
    public function set resolutions(value:Array):void
securityproperty 
security:ISecurity

Security manager associated to this layer


Implementation
    public function get security():ISecurity
    public function set security(value:ISecurity):void
selectedproperty 
selected:Boolean


Implementation
    public function get selected():Boolean
    public function set selected(value:Boolean):void
urlproperty 
url:String

The url use for the layer request if necessary.


Implementation
    public function get url():String
    public function set url(value:String):void
visibleproperty 
visible:Boolean  [write-only] [override]

Define if this layer is visible (displayed) or not


Implementation
    public function set visible(value:Boolean):void
zindexproperty 
zindex:int

Current layer position in the display list


Implementation
    public function get zindex():int
    public function set zindex(value:int):void
Constructor Detail
Layer()Constructor
public function Layer(name:String)

Layer constructor

Parameters
name:String
Method Detail
addOriginator()method
public function addOriginator(originator:DataOriginator):void

Add a new originator for the layer

Parameters

originator:DataOriginator — Informations of this new originator (with or without constraints) If no constraint is defined, one default constraint is made with the current extent, minResolution and maxResolution of the layer

clear()method 
public function clear():void

Clear the layer graphics

destroy()method 
public function destroy():void

Detroy the map, including removing all event listeners

draw()method 
protected function draw():void

Reset layer data

generateResolutions()method 
public function generateResolutions(numZoomLevels:uint, nominalResolution:Number):void

Generate resolutions array for a nominal resolution (higher one) and a number of zoom levels. The array is generated with the following principle : resolutions[i] = resolutions[i-1] / 2

Parameters

numZoomLevels:uint (default = NaN)
 
nominalResolution:Number (default = NaN)

getLayerPxFromMapPx()method 
public function getLayerPxFromMapPx(mapPx:Pixel):Pixel

Parameters

mapPx:Pixel

Returns
Pixel
getLocationFromMapPx()method 
public function getLocationFromMapPx(viewPortPx:Pixel):Location

Return a LonLat which is the passed-in map Pixel, translated into lon/lat by the layer.

Parameters

viewPortPx:Pixel

Returns
Location
getMapPxFromLayerPx()method 
public function getMapPxFromLayerPx(layerPx:Pixel):Pixel

Parameters

layerPx:Pixel

Returns
Pixel
getMapPxFromLocation()method 
public function getMapPxFromLocation(lonlat:Location):Pixel

Return a Pixel which is the passed-in LonLat,translated into map pixels.

Parameters

lonlat:Location

Returns
Pixel
getURL()method 
public function getURL(bounds:Bounds):String

Return layer URL

Parameters

bounds:Bounds

Returns
String
hasMultiBBoxes()method 
public function hasMultiBBoxes():Boolean

Tells whether this layer defines multiple bounding boxes

Returns
Boolean — Boolean True if the layer has multiple bboxes, false otherwise
isAvailableForBounds()method 
public function isAvailableForBounds(bounds:Bounds, resolution:Resolution):Boolean

This method tells if the layer is available for the specified bounds and resolution

Parameters

bounds:Bounds — Bounds to intersect the layers bboxes with
 
resolution:Resolution — Resolution to intersect the layer max et min extent with

Returns
Boolean
onEnterFrame()method 
protected function onEnterFrame(event:Event):void

Bind the redraw of the layers on the flash onEnterFrame

Parameters

event:Event

onMapCenterChanged()method 
protected function onMapCenterChanged(event:MapEvent):void

This function is call when the MapEvent.CENTER_CHANGED Call the redraw function to check if the layer can be displayed Override this method if you want a specific behaviour in your layer when the center is changed

Parameters

event:MapEvent

onMapMove()method 
protected function onMapMove(e:MapEvent):void

Parameters

e:MapEvent

onMapProjectionChanged()method 
protected function onMapProjectionChanged(event:MapEvent):void

This function is call when the MapEvent.PROJECTION_CHANGED Override this method if you want a specific behaviour in your layer when the projection of the map is changed

Parameters

event:MapEvent

onMapReload()method 
protected function onMapReload(event:MapEvent):void

This function is call when the MapEvent.RELOAD Override this method if you want a specific behaviour in your layer when the map ask for a reload.

Parameters

event:MapEvent

onMapResize()method 
protected function onMapResize(e:MapEvent):void

This function is call when the MapEvent.RESIZE Call the redraw method to fully actualize the layer Override this method if you want a specific behaviour in your layer when the size of the map is changed

Parameters

e:MapEvent

onMapResolutionChanged()method 
protected function onMapResolutionChanged(event:MapEvent):void

This function is call when the MapEvent.RESOLUTION_CHANGED Override this method if you want a specific behaviour in your layer when the resolution of the map is changed

Parameters

event:MapEvent

onMaxExtentChanged()method 
protected function onMaxExtentChanged(e:MapEvent):void

This function is call when the MapEvent.MAX_EXTENT_CHANGED Call the redraw method to fully actualize the layer Override this method if you want a specific behaviour in your layer when the MaxExtent of the map is changed

Parameters

e:MapEvent

onSecurityInitialized()method 
protected function onSecurityInitialized(e:SecurityEvent):void

Parameters

e:SecurityEvent

redraw()method 
public function redraw(fullRedraw:Boolean = false):void

Check if the layer can be drawn according to the map parameters. If the layer can be drawn it will draw itself. It will set the available parameter to expose if the layer is drawn or not.

Parameters

fullRedraw:Boolean (default = false)

removeEventListenerFromMap()method 
public function removeEventListenerFromMap():void

Remove map related event listeners

reset()method 
public function reset():void

Reset layer data

supportsProjection()method 
public function supportsProjection(compareProj:*):Boolean

This method tells if the layer supports a projection given in parameter according to the availableProjections set for this layer.

Parameters

compareProj:*

Returns
Boolean
Constant Detail
DEFAULT_DPIConstant
public static const DEFAULT_DPI:Number = 92

DEFAULT_NOMINAL_RESOLUTIONConstant 
public static const DEFAULT_NOMINAL_RESOLUTION:Resolution

DEFAULT_NUM_ZOOM_LEVELSConstant 
public static const DEFAULT_NUM_ZOOM_LEVELS:uint = 18

DEFAULT_PROJECTIONConstant 
public static const DEFAULT_PROJECTION:ProjProjection

RESOLUTION_TOLERANCEConstant 
public static const RESOLUTION_TOLERANCE:Number = 0.000001