OpenLayers. LayerSummary | | | | | | | | | | | | | {Array(String)} Supported application event types | | | | | | { OpenLayers.Map} This variable is set when the layer is added to the map, via the accessor function setMap(). | | {Boolean} Whether or not the layer is a base layer. | | {Boolean} The layer’s images have an alpha channel. | | {Boolean} Display the layer’s name in the layer switcher. | | {Boolean} The layer should be displayed in the map. | | | | {Boolean} The current map resolution is within the layer’s min/max range. | | { OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter. | | {Object} An optional object whose properties will be set on the layer. | | {Integer} Determines the width (in pixels) of the gutter around image tiles to ignore. | | {String} Set in the layer options to override the default projection string this layer - also set maxExtent, maxResolution, and units if appropriate. | | {String} The layer map units. | | {Array} An array of map scales in descending order. | | {Array} A list of map resolutions (map units per pixel) in descending order. | | { OpenLayers.Bounds} The center of these bounds will not stray outside of the viewport extent during panning. | | | | {Float} Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. | | | | | | | | | | {Boolean} Request map tiles that are completely outside of the max extent for this layer. | | {Boolean} #487 for more info. | | | | | | | | Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own. | | | | Sets the new layer name for this layer. | | | | This function can be implemented by subclasses | | | | | | Set the map property for the layer. | | Just as setMap() allows each layer the possibility to take a personalized action on being added to the map, removeMap() allows each layer to take a personalized action on being removed from it. | | { OpenLayers.Size} The size that the image should be, taking into account gutters. | | Set the tile size based on the map size. | | {Boolean} The layer should be displayed (if in range). | | Set the visibility flag for the layer and hide/show & redraw accordingly. | | | | {Boolean} The layer is displayable at the current map’s current resolution. | | | | This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer. | | {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level. | | { OpenLayers.Bounds} A Bounds object which represents the lon/lat bounds of the current viewPort. | | | | Calculates the max extent which includes all of the data for the layer. | | | | | | | | Sets the opacity for the entire layer (all images) | | | | This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. |
EVENT_TYPES{Array(String)} Supported application event types
map{OpenLayers.Map} This variable is set when the layer is added to the map, via the accessor function setMap().
isBaseLayer{Boolean} Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false
alpha{Boolean} The layer’s images have an alpha channel. Default is false.
displayInLayerSwitcher{Boolean} Display the layer’s name in the layer switcher. Default is true.
visibility{Boolean} The layer should be displayed in the map. Default is true.
inRange{Boolean} The current map resolution is within the layer’s min/max range. This is set in OpenLayers.Map.setCenter whenever the zoom changes.
imageOffset{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.
options{Object} An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.
gutter{Integer} Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.
projection{String} Set in the layer options to override the default projection string this layer - also set maxExtent, maxResolution, and units if appropriate.
units{String} The layer map units. Defaults to ‘degrees’. Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’.
scales{Array} An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use resolutions instead wherever possible.
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, maxScale, etc.).
maxExtent{OpenLayers.Bounds} The center of these bounds will not stray outside of the viewport extent during panning. In addition, if displayOutsideMaxExtent is set to false, data will not be requested that falls completely outside of these bounds.
maxResolution{Float} Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using a geographic projection and displaying the whole world.
displayOutsideMaxExtent{Boolean} Request map tiles that are completely outside of the max extent for this layer. Defaults to false.
wrapDateLine{Boolean} #487 for more info.
OpenLayers. LayerParametersname | {String} The layer name | options | {Object} Hashtable of extra options to tag onto the layer |
destroydestroy: function( | setNewBaseLayer | ) |
|
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own. ParameterssetNewBaseLayer | {Boolean} Set a new base layer when this layer has been destroyed. Default is true. |
setNamesetName: function( | newName | ) |
|
Sets the new layer name for this layer. Can trigger a changelayer event on the map. ParametersnewName | {String} The new name. |
addOptionsaddOptions: function ( | newOptions | ) |
|
Parameters
onMapResizeThis function can be implemented by subclasses
redrawRedraws the layer. Returns true if the layer was redrawn, false if not. Returns{Boolean} The layer was redrawn.
moveTomoveTo:function( | bounds, | | zoomChanged, | | dragging | ) |
|
Parametersbound | {OpenLayers.Bounds} | zoomChanged | {Boolean} Tells when zoom has changed, as layers have to do some init work in that case. | dragging | {Boolean} |
setMapSet the map property for the layer. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set. Here we take care to bring over any of the necessary default properties from the map. Parameters
removeMapJust as setMap() allows each layer the possibility to take a personalized action on being added to the map, removeMap() allows each layer to take a personalized action on being removed from it. For now, this will be mostly unused, except for the EventPane layer, which needs this hook so that it can remove the special invisible pane. Parameters
getImageSizeReturns{OpenLayers.Size} The size that the image should be, taking into account gutters.
setTileSizesetTileSize: function( | size | ) |
|
Set the tile size based on the map size. This also sets layer.imageSize and layer.imageOffset for use by Tile.Image. Parameters
getVisibilitygetVisibility: function() |
Returns{Boolean} The layer should be displayed (if in range).
setVisibilitysetVisibility: function( | visibility | ) |
|
Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified Note that visibility is no longer simply whether or not the layer’s style.display is set to “block”. Now we store a ‘visibility’ state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map’s resolution is out of the layer’s range, this desire may be subverted. Parametersvisible | {Boolean} Whether or not to display the layer (if in range) |
displaydisplay: function( | display | ) |
|
Hide or show the Layer Parameters
calculateInRangecalculateInRange: function() |
Returns{Boolean} The layer is displayable at the current map’s current resolution.
setIsBaseLayersetIsBaseLayer: function( | isBaseLayer | ) |
|
Parameters
initResolutionsinitResolutions: function() |
This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer. The user has several options that determine how the array is set up. For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels
getResolutiongetResolution: function() |
Returns{Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.
getExtentReturns{OpenLayers.Bounds} A Bounds object which represents the lon/lat bounds of the current viewPort.
getZoomForExtentgetZoomForExtent: function( | extent, | | closest | ) |
|
Parametersbounds | {OpenLayers.Bounds} | closest | {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false. |
Returns{Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the ‘closest’ parameter.
getDataExtentgetDataExtent: function () |
Calculates the max extent which includes all of the data for the layer. This function is to be implemented by subclasses. Returns{OpenLayers.Bounds}
getZoomForResolutiongetZoomForResolution: function( | resolution, | | closest | ) |
|
Parametersresolution | {Float} | closest | {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it’ll be close). Default is false. |
Returns{Integer} 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.
getLonLatFromViewPortPxgetLonLatFromViewPortPx: function ( | viewPortPx | ) |
|
ParametersReturns{OpenLayers.LonLat} An OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the layer.
setOpacitysetOpacity: function( | opacity | ) |
|
Sets the opacity for the entire layer (all images) Parameter
setZIndexsetZIndex: function ( | zIndex | ) |
|
Parameters
adjustBoundsadjustBounds: function ( | bounds | ) |
|
This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right. Parameters
|