HSLayers.Control.ProjectionSwitcher (class)

HSLayers.Control.ProjectionSwitcher

class HSLayers.Control.ProjectionSwitcher()

Switches projection on for the map

Example usage:

// create switcher with pre-set epsg:102067 and epsg:4326 projections
// if userProjections is ommited, only those projections supported by
// *ALL* layers will be displayed
var switcher = new HSLayers.Control.ProjectionSwitcher({
                  div: document.getElementById("projectionswitcher"),
                  projections: [
                     {
                         projection: new OpenLayers.Projection("epsg:102067"),
                         maxExtent: new OpenLayers.Bounds(...),
                         scales: [2000000,1000000,...]
                         ...
                         },
                     {
                         projection:new OpenLayers.Projection("epsg:4326"},
                         scales: [...],
                         maxExtent: ...,
                         ...

                         ]});
map.addControl(switcher);
// to add support for reprojecting to map layers, you have to add new
//*projections* parameter
var wmslayer = new OpenLayers.Layer.WMS("name","url",{wmsparams},{
         ...,
         projections: [{projection: new OpenLayers.Projection("epsg:4326")},{projection: new OpenLayers.Projection("epsg:102067")}, {projection: new OpenLayers.Projection("epsg:900913")}],
         ...

Properties

HSLayers.Control.ProjectionSwitcher.CLASS_NAME
Type :String (static)

HSLayers.Control.ProjectionSwitcher

HSLayers.Control.ProjectionSwitcher.projDefs
Type :<a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Projection-js.html“>OpenLayers.Projection</a>[] (static)

HSLayers.Control.ProjectionSwitcher

list of projections

HSLayers.Control.ProjectionSwitcher.scaleMap
Type :Object (static)

HSLayers.Control.ProjectionSwitcher

mapping object for scales and projections

Example usage:

HSLayers.Control.ProjectionSwitcher.switcher
Type :DOMObject (static)

HSLayers.Control.ProjectionSwitcher

the select object

HSLayers.Control.ProjectionSwitcher.title
Type :String (static)

HSLayers.Control.ProjectionSwitcher

Methods

they actually are

was changed

on the page. If a div has not been created one is created. Controls with a visual component will almost always want to override this method to customize the look of control.

ok, switch it!

HSLayers.Control.ProjectionSwitcher.setMap()
HSLayers.Control.ProjectionSwitcher.redraw()
Go through scales and generate the switcher

they actually are

HSLayers.Control.ProjectionSwitcher.returnBack()

return back to original state

HSLayers.Control.ProjectionSwitcher.onSwitcherChange(evt)

called, when the switcher has changed

Arguments:
  • evt (Event) –
HSLayers.Control.ProjectionSwitcher.onZoomChange()
check, if the projection should be changed automatically, while zoom

was changed

HSLayers.Control.ProjectionSwitcher.draw(px)
The draw method is called when the control is ready to be displayed

on the page. If a div has not been created one is created. Controls with a visual component will almost always want to override this method to customize the look of control.

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Pixel-js.html“>OpenLayers.Pixel</a> px:

The top-left pixel position of the control or null.
returns:A reference to the DIV DOMElement containing the control
rtype:DOMElement
HSLayers.Control.ProjectionSwitcher.getProjDef(code)

get projDef object

Arguments:
  • code (String) – epsg code, like “epsg:4326”
Returns:

projDef object

Return type:

Object

HSLayers.Control.ProjectionSwitcher.switchProjection(projection)
Method: switchProjection

ok, switch it!

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Projection-js.html“>OpenLayers.Projection</a>|String projection:
HSLayers.Control.ProjectionSwitcher.reproject(srcDef, dstDef, extent)

reproject the extent

Arguments:
  • srcDef (Object) – source projection definition
  • dstDef (Object) – destination projection definition
  • extent (OpenLayers.Bounds) –
Returns:

[OpenLayers.LonLat, OpenLayers.Bounds] new center and extent

HSLayers.Control.ProjectionSwitcher.getTitle(proj)

get projection title or code

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Projection-js.html“>OpenLayers.Projection</a>|String proj:

Returns:
Return type:String

Main Menu


Table Of Contents

Previous topic

HSLayers.Control.PanZoom (class)

Next topic

HSLayers.Control.Query (class)

This Page