API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class Layer

Package | org.openscales.core.layer
Class | public class Layer
Inheritance | Layer flash.display.Sprite
Subclasses | FeatureLayer, HTTPRequest, ImageLayer

A Layer display image of vector datas on the map, usually loaded from a remote datasource. Unit of the baseLayer is hanging by the projection. To access : this.projection.projParams.units

Public Properties

| Property | Defined by
--- | --- | ---
|  | DEFAULT_MAXEXTENT : Bounds [static][read-only] | Layer
|  | DEFAULT_PROJECTION : ProjProjection [static][read-only] | Layer
|  | displayed : Boolean [read-only] | Layer
|  | extent : Bounds [read-only] A Bounds object which represents the lon/lat bounds of the current viewPort. | Layer
|  | imageSize : Size For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension. | Layer
|  | inRange : Boolean [read-only] | Layer
|  | isBaseLayer : Boolean Whether or not the layer is a base layer. | 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 | Layer
|  | maxExtent : Bounds The center of these bounds will not stray outside of the viewport extent during panning. | Layer
|  | maxResolution : Number [read-only] | Layer
|  | maxZoomLevel : Number | Layer
|  | minResolution : Number [read-only] | Layer
|  | minZoomLevel : Number | Layer
|  | numZoomLevels : Number [read-only] Number of zoom levels | Layer
|  | projection : ProjProjection Override the default projection. | 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 | Layer
|  | visible : Boolean [write-only] | Layer
|  | zindex : int | Layer

Protected Properties

| Property | Defined by
--- | --- | ---
|  | _imageSize : Size = null | Layer
|  | loading : Boolean [write-only] Used to set loading status of layer | Layer

Public Methods

| Method | Defined by
--- | --- | ---
|  | Layer(name:String, isBaseLayer:Boolean = false, visible:Boolean = true, srsCode:String = null, proxy:String = null, security:ISecurity = null) Layer constructor | Layer
|  | clear():void Clear the layer graphics | Layer
|  | destroy(setNewBaseLayer:Boolean = true):void | Layer
|  | generateResolutions(numZoomLevels:uint, nominalResolution:Number):void | Layer
|  | getLonLatFromMapPx(viewPortPx:Pixel):LonLat Return a LonLat which is the passed-in map Pixel, translated into lon/lat by the layer. | Layer
|  | getMapPxFromLonLat(lonlat:LonLat):Pixel Return a Pixel which is the passed-in LonLat,translated into map pixels. | Layer
|  | getURL(bounds:Bounds):String | Layer
|  | getZoomForExtent(extent:Bounds):Number | Layer
|  | getZoomForResolution(resolution:Number):Number Return The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification. | Layer
|  | onMapMove(e:MapEvent):void | Layer
|  | onMapResize(e:MapEvent):void | Layer
|  | onMapZoom(e:MapEvent):void | Layer
|  | onSecurityInitialized(e:SecurityEvent):void | Layer
|  | redraw(fullRedraw:Boolean = true):void Clear and draw, if needed, layer based on current data eventually retreived previously by moveTo function. | Layer
|  | reset():void Reset layer data | Layer

Protected Methods

| Method | Defined by
--- | --- | ---
|  | draw():void Reset layer data | Layer

Public Constants

| Constant | Defined by
--- | --- | ---
|  | DEFAULT_NOMINAL_RESOLUTION : Number = 1.40625 [static] | Layer
|  | DEFAULT_NUM_ZOOM_LEVELS : uint = 16 [static] | Layer
|  | DEFAULT_SRS_CODE : String = "EPSG:4326" [static] | Layer
|  | RESOLUTION_TOLERANCE : Number = 0.000001 [static] | Layer

Property detail

DEFAULT_MAXEXTENT | property

`DEFAULT_MAXEXTENT:Bounds` [read-only]Implementation
`public static function get DEFAULT_MAXEXTENT():Bounds`

DEFAULT_PROJECTION | property |

`DEFAULT_PROJECTION:ProjProjection` [read-only]Implementation
`public static function get DEFAULT_PROJECTION():ProjProjection`

displayed | property |

`displayed:Boolean` [read-only]Implementation
`public function get displayed():Boolean`

extent | property |

`extent:Bounds` [read-only]

A Bounds object which represents the lon/lat bounds of the current viewPort.

Implementation
`public function get extent():Bounds`

_imageSize | property |

`protected var _imageSize:Size = null`

imageSize | property |

`imageSize:Size` [read-write]

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

Implementation
`public function get imageSize():Size`
`public function set imageSize(value:Size):void`

inRange | property |

`inRange:Boolean` [read-only]Implementation
`public function get inRange():Boolean`

isBaseLayer | property |

`isBaseLayer:Boolean` [read-write]

Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false

Implementation
`public function get isBaseLayer():Boolean`
`public function set isBaseLayer(value:Boolean):void`

isFixed | property |

`isFixed:Boolean` [read-write]

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`

loadComplete | property |

`loadComplete:Boolean` [read-only]

Whether or not the layer is loading data

Implementation
`public function get loadComplete():Boolean`

loading | property |

`loading:Boolean` [write-only]

Used to set loading status of layer

Implementation
`protected function set loading(value:Boolean):void`

map | property |

`map:Map` [read-write]Implementation
`public function get map():Map`
`public function set map(value:Map):void`

maxExtent | property |

`maxExtent:Bounds` [read-write]

The center of these bounds will not stray outside of the viewport extent during panning. In addition, if is set to false, data will not be requested that falls completely outside of these bounds.

Implementation
`public function get maxExtent():Bounds`
`public function set maxExtent(value:Bounds):void`

maxResolution | property |

`maxResolution:Number` [read-only]Implementation
`public function get maxResolution():Number`

maxZoomLevel | property |

`maxZoomLevel:Number` [read-write]

Implementation
`public function get maxZoomLevel():Number`
`public function set maxZoomLevel(value:Number):void`

minResolution | property |

`minResolution:Number` [read-only]Implementation
`public function get minResolution():Number`

minZoomLevel | property |

`minZoomLevel:Number` [read-write]

Implementation
`public function get minZoomLevel():Number`
`public function set minZoomLevel(value:Number):void`

numZoomLevels | property |

`numZoomLevels:Number` [read-only]

Number of zoom levels

Implementation
`public function get numZoomLevels():Number`

projection | property |

`projection:ProjProjection` [read-write]

Override the default projection. You should also set maxExtent, maxResolution, and units if appropriate.

Implementation
`public function get projection():ProjProjection`
`public function set projection(value:ProjProjection):void`

proxy | property |

`proxy:String` [read-write]

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 If not defined, use map proxy

Implementation
`public function get proxy():String`
`public function set proxy(value:String):void`

resolutions | property |

`resolutions:Array` [read-write]

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`

security | property |

`security:ISecurity` [read-write]Implementation
`public function get security():ISecurity`
`public function set security(value:ISecurity):void`

visible | property |

`visible:Boolean` [write-only]Implementation
`public function set visible(value:Boolean):void`

zindex | property |

`zindex:int` [read-write]Implementation
`public function get zindex():int`
`public function set zindex(value:int):void`
Constructor detail

Layer | () | constructor

`public function Layer(name:String, isBaseLayer:Boolean = false, visible:Boolean = true, srsCode:String = null, proxy:String = null, security:ISecurity = null)`

Layer constructor

Parameters

| `name:String`
| `isBaseLayer:Boolean` (default = `false`)``
| `visible:Boolean` (default = `true`)``
| `srsCode:String` (default = `null`)``
| `proxy:String` (default = `null`)``
| `security:ISecurity` (default = `null`)``

Method detail

clear | () | method

`public function clear():void`

Clear the layer graphics

destroy | () | method |

`public function destroy(setNewBaseLayer:Boolean = true):void` Parameters

| `setNewBaseLayer:Boolean` (default = `true`)``

draw | () | method |

`protected function draw():void`

Reset layer data

generateResolutions | () | method |

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

| `numZoomLevels:uint`
| `nominalResolution:Number`

getLonLatFromMapPx | () | method |

`public function getLonLatFromMapPx(viewPortPx:Pixel):LonLat`

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

Parameters

| `viewPortPx:Pixel`

Returns

| `LonLat`

getMapPxFromLonLat | () | method |

`public function getMapPxFromLonLat(lonlat:LonLat):Pixel`

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

Parameters

| `lonlat:LonLat`

Returns

| `Pixel`

getURL | () | method |

`public function getURL(bounds:Bounds):String` Parameters

| `bounds:Bounds`

Returns

| `String`

getZoomForExtent | () | method |

`public function getZoomForExtent(extent:Bounds):Number` Parameters

| `extent:Bounds`

Returns

| `Number`

getZoomForResolution | () | method |

`public function getZoomForResolution(resolution:Number):Number`

Return The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

| `resolution:Number`

Returns

| `Number`

onMapMove | () | method |

`public function onMapMove(e:MapEvent):void` Parameters

| `e:MapEvent`

onMapResize | () | method |

`public function onMapResize(e:MapEvent):void` Parameters

| `e:MapEvent`

onMapZoom | () | method |

`public function onMapZoom(e:MapEvent):void` Parameters

| `e:MapEvent`

onSecurityInitialized | () | method |

`public function onSecurityInitialized(e:SecurityEvent):void` Parameters

| `e:SecurityEvent`

redraw | () | method |

`public function redraw(fullRedraw:Boolean = true):void`

Clear and draw, if needed, layer based on current data eventually retreived previously by moveTo function.

Parameters

| `fullRedraw:Boolean` (default = `true`)``

reset | () | method |

`public function reset():void`

Reset layer data

Constant detail

DEFAULT_NOMINAL_RESOLUTION | constant

`public static const DEFAULT_NOMINAL_RESOLUTION:Number = 1.40625`

DEFAULT_NUM_ZOOM_LEVELS | constant |

`public static const DEFAULT_NUM_ZOOM_LEVELS:uint = 16`

DEFAULT_SRS_CODE | constant |

`public static const DEFAULT_SRS_CODE:String = "EPSG:4326"`

RESOLUTION_TOLERANCE | constant |

`public static const RESOLUTION_TOLERANCE:Number = 0.000001`