Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MapManager Class Reference

Inheritance diagram for MapManager:

Inheritance graph
List of all members.

Detailed Description

An encapsulation of common mapping functionality.

This object extends the basic Map object to include the provision of a single zoom API as well as the ability to register functions that will render specific layers when the MapManager::draw() is called.

Definition at line 329 of file mapmanager.php.

Public Member Functions

 MapManager ($map_file, $new_map_path=null)
 Constructs a MapServer_Manager.

 getClickType ()
 Returns the type of the user click.

 setZoomType ($zoom_type)
 Determine the type of zoom operation to execute.

 getZoomType ()
 Retrieve the type of zoom operation.

 setZoomScale ($zoom_scale)
 Set the map scale that will be zoomed to when the zoom type is set to MM_ZOOM_SCALE.

 getZoomScale ()
 Get the map scale that will be zoomed to when the zoom type is set to MM_ZOOM_SCALE.

 setZoomExtent ($zoom_extent)
 Set the georeferenced extent to which the map will be set when the zoom type is MM_ZOOM_EXTENT.

 getZoomExtent ()
 Get the georeferenced extent to which the map will be set when the zoom type is MM_ZOOM_EXTENT.

 getMapClick ($as_map_coords=true)
 Get the click point.

 setMapClick ($map_click, $click_type)
 Set the click point.

 setZoomLevel ($zoom_level)
 Specify the multiplication factor with which a zoom operation is applied.

 getZoomLevel ()
 Return the multiplication factor with which zoom operations are applied.

 getMaxExtent ()
 Get the maximum extent of the map in georeferenced coordinates.

 setMaxExtent ($extent)
 Set the maximum extent of the map.

 layerExists ($layer_name)
 Check whether a layer exists.

 layerIsOn ($layer_name)
 Check whether a layer is turned on.

 turnLayerOn ($layer_name, $toggle_group=false)
 Turn a layer on.

 turnLayerOff ($layer_name, $toggle_group=false)
 Turn a layer off.

 isGroupLayer ($layer_name)
 Check whether the layer is a member of a group.

 groupExists ($group_name)
 Check whether a group name exists.

 turnGroupOff ($group_name)
 Turn all member layers of a group off.

 turnGroupOn ($group_name)
 Turn all member layers of a group on.

 layerIsQueryable ($layer_name)
 Check whether a layer can be queried.

 layerIsSelectable ($layer_name)
 Check whether a layer can be selected.

 setLayerSelectable ($layer_name, $selectable)
 Change the selectability status of a layer.

 getSelectableLayerNames ()
 Retrieve the names of all layers which are considered selectable.

 setLayerRenderer ($layer_name, $renderer)
 Set or replace a layer's renderer.

 getLayerRenderer ($layer_name)
 Retrieve a layer's renderer.

 removeLayerRenderer ($layer_name)
 Remove a layer's renderer.

 layerRendererExists ($layer_name)
 Check whether a layer has a renderer set.

 imagePointToMapPoint ($image_point)
 Convert a point in image coordinates to a point in map coordinates.

 mapPointToImagePoint ($map_point)
 Convert a point in geographic coordinates to pixel coordinates.

 imagePointToRefMapPoint ($image_point)
 Convert a point in image coordinates to a point in map coordinates valid for the reference map.

 refMapPointToImagePoint ($map_point)
 Converts a point in geographic coordinates to a point in pixel coordinates valid for the reference map.

 zoomedToMinScale ()
 Check whether the map is zoomed in to the minimum (largest) allowed scale.

 zoomedToMaxScale ()
 Check whether the map is zoomed out to the maximum (smallest) allowed scale.

 zoomedToMaxExtent ()
 Check whether the map is zoomed out to the maximum allowed extent.

 zoom ()
 Perform a zoom operation.

 zoomToExtent ($extent)
 Zoom to a specific extent.

 zoomToScale ($scale)
 Zoom to a specific scale.

 zoomToPoint ($map_point, $zoom_level)
 Zoom to a point.

 panToPoint ($map_point)
 Pan to a point.

 zoomInToPoint ($map_point)
 Zoom in to a point.

 zoomOutToPoint ($map_point)
 Zoom out from a point.

 zoomOutToMapClick ()
 Zoom out from the map click.

 panToMapClick ()
 Pan to the map click.

 zoomInToMapClick ()
 Zoom in to the map click.

 draw ()
 Calls the MapManager::drawLayer() method on all layers and renders the label cache.

 drawLayer ($layer, &$imageObj)
 Renders a layer to an imageObj.

 __wakeup ()
 Initialise object after unserialisation.

 __sleep ()
 Prepare object for serialisation.


Public Attributes

 $max_extent
 The maximum georeferenced extent of the map.

 $zoom_level
 The current zoom factor.

 $layer_renderers
 Associative array mapping layer names to the function which will render them.

 $zoom_type
 Current value containing a MM_ZOOM_* constant.

 $zoom_scale
 The scale to which the map should zoom if MM_ZOOM_SCALE is the zoom type.

 $zoom_extent
 The extent to which the map should zoom if MM_ZOOM_EXTENT is the zoom type.

 $map_click
 The position of the map click in georeferenced coordinates.

 $click_type
 A MM_CLICK_* constant specifying the type of map clicked.


Constructor & Destructor Documentation

MapManager::MapManager map_file,
new_map_path = null
 

Constructs a MapServer_Manager.

Passes it's arguments to the Map base class and performs various initialisations such as setting the zoom type to MM_ZOOM_MAN.

Definition at line 359 of file mapmanager.php.

References MM_ZOOM_PAN.


Member Function Documentation

MapManager::__sleep  ) 
 

Prepare object for serialisation.

This method is automatically called just before the object is serialised to carry out clean-up operations. See the PHP documentation at http://www.php.net/manual/en/language.oop.magic-functions.php for more information.

Returns:
an array of object property names to be serialised.

Reimplemented from Map.

Definition at line 1168 of file mapmanager.php.

References $max_extent, $zoom_extent, and rectToString().

MapManager::__wakeup  ) 
 

Initialise object after unserialisation.

This method is automatically called just after the object is unserialised and ensures it is properly initialised. See the PHP documentation at http://www.php.net/manual/en/language.oop.magic-functions.php for more information.

Returns:
void

Reimplemented from Map.

Definition at line 1154 of file mapmanager.php.

References stringToRect().

MapManager::draw  ) 
 

Calls the MapManager::drawLayer() method on all layers and renders the label cache.

Also embeds the legend and scale if required.

Returns:
the imageObj resource

Reimplemented from Map.

Definition at line 1091 of file mapmanager.php.

MapManager::drawLayer layer,
&$  imageObj
 

Renders a layer to an imageObj.

If a layer renderer has been set this is used, otherwise the default mapserver renderer is used

Parameters:
$layer layerObj representing the layer
$imageObj imageObj to render the layer to

Definition at line 1133 of file mapmanager.php.

MapManager::getClickType  ) 
 

Returns the type of the user click.

The map click point can be specified by either clicking on the reference map or on the main map. The result of this method shows which is true for the current instance.

Returns:
either MM_CLICK_MAIN or MM_CLICK_REF

Definition at line 379 of file mapmanager.php.

MapManager::getLayerRenderer layer_name  ) 
 

Retrieve a layer's renderer.

Parameters:
$layer_name the name of the layer
Returns:
the reference to the renderer function or method

Definition at line 746 of file mapmanager.php.

MapManager::getMapClick as_map_coords = true  ) 
 

Get the click point.

User interaction with the map is generally achieved using a 'click point'. This is a point location of interest on the map.

Parameters:
$as_map_coords true (default) sets returned point to georeferenced map coordinates. False sets it to image coordinates.
Returns:
the click point if MapManager::setMapClick() has been called, otherwise null

Definition at line 448 of file mapmanager.php.

MapManager::getMaxExtent  ) 
 

Get the maximum extent of the map in georeferenced coordinates.

Returns:
the extent as a rectObj

Definition at line 502 of file mapmanager.php.

MapManager::getSelectableLayerNames  ) 
 

Retrieve the names of all layers which are considered selectable.

Returns:
an array of layer names

Definition at line 710 of file mapmanager.php.

MapManager::getZoomExtent  ) 
 

Get the georeferenced extent to which the map will be set when the zoom type is MM_ZOOM_EXTENT.

Returns:
the extent as a rectObj

Definition at line 434 of file mapmanager.php.

MapManager::getZoomLevel  ) 
 

Return the multiplication factor with which zoom operations are applied.

Returns:
the factor as an integer

Definition at line 493 of file mapmanager.php.

MapManager::getZoomScale  ) 
 

Get the map scale that will be zoomed to when the zoom type is set to MM_ZOOM_SCALE.

Returns:
the map scale as a float

Definition at line 416 of file mapmanager.php.

MapManager::getZoomType  ) 
 

Retrieve the type of zoom operation.

Returns:
a MM_ZOOM_* constant

Definition at line 398 of file mapmanager.php.

MapManager::groupExists group_name  ) 
 

Check whether a group name exists.

Parameters:
$group_name the name to check
Returns:
true of the name exists, false otherwise

Definition at line 603 of file mapmanager.php.

MapManager::imagePointToMapPoint image_point  ) 
 

Convert a point in image coordinates to a point in map coordinates.

Parameters:
$image_point pointObj containing the pixel coordinates
Returns:
a pointObj containing the map coordinates

Definition at line 786 of file mapmanager.php.

Referenced by imagePointToRefMapPoint().

MapManager::imagePointToRefMapPoint image_point  ) 
 

Convert a point in image coordinates to a point in map coordinates valid for the reference map.

Parameters:
$image_point pointObj containing the image coordinates
Returns:
a pointObj in map coordinates

Definition at line 814 of file mapmanager.php.

References imagePointToMapPoint().

MapManager::isGroupLayer layer_name  ) 
 

Check whether the layer is a member of a group.

Parameters:
$layer_name the name of the layer
Returns:
true of the layer belongs to a group, false otherwise

Definition at line 589 of file mapmanager.php.

MapManager::layerExists layer_name  ) 
 

Check whether a layer exists.

Parameters:
$layer_name the name of the layer
Returns:
true if the layer exists, false otherwise

Definition at line 523 of file mapmanager.php.

MapManager::layerIsOn layer_name  ) 
 

Check whether a layer is turned on.

A layer is defined as being on if it's status == MS_ON

Parameters:
$layer_name the name of the layer
Returns:
true of the layer is on, false otherwise

Definition at line 537 of file mapmanager.php.

MapManager::layerIsQueryable layer_name  ) 
 

Check whether a layer can be queried.

A layer can be queried if it or any of it's classes contains a value for the TEMPLATE property,

Parameters:
$layer_name the name of the layer
Returns:
true if it can be queried, false otherwise

Definition at line 647 of file mapmanager.php.

MapManager::layerIsSelectable layer_name  ) 
 

Check whether a layer can be selected.

A layer can be selected if it contains the metadata name 'SELECTABLE' with a value of 'ON'

Parameters:
$layer_name the name of the layer
Returns:
true of it can be selected, false otherwise

Definition at line 672 of file mapmanager.php.

MapManager::layerRendererExists layer_name  ) 
 

Check whether a layer has a renderer set.

Parameters:
$layer_name the name of the layer
Returns:
true if a renderer exists, false otherwise

Definition at line 774 of file mapmanager.php.

MapManager::mapPointToImagePoint map_point  ) 
 

Convert a point in geographic coordinates to pixel coordinates.

Parameters:
$map_point pointObj containing the map coordinates
Returns:
a pointObj containing the pixel coordinates

Definition at line 800 of file mapmanager.php.

Referenced by refMapPointToImagePoint().

MapManager::panToMapClick  ) 
 

Pan to the map click.

Returns:
true if the click point has been set, false otherwise

Definition at line 1057 of file mapmanager.php.

References $map_click.

MapManager::panToPoint map_point  ) 
 

Pan to a point.

Parameters:
$map_point a pointObj specifying the point in georeferenced coordinates

Definition at line 1013 of file mapmanager.php.

MapManager::refMapPointToImagePoint map_point  ) 
 

Converts a point in geographic coordinates to a point in pixel coordinates valid for the reference map.

Parameters:
$map_point pointObj containing the map coordinates
Returns:
a pointObj containing the image coordinates

Definition at line 830 of file mapmanager.php.

References mapPointToImagePoint().

MapManager::removeLayerRenderer layer_name  ) 
 

Remove a layer's renderer.

Once a layer renderer is removed the default PHP MapScript rendering is used.

Parameters:
$layer_name the name of the layer

Definition at line 761 of file mapmanager.php.

MapManager::setLayerRenderer layer_name,
renderer
 

Set or replace a layer's renderer.

A layer renderer is a function or method which accepts an imageObj. This imageObj will be used to draw a particular map layer.

Parameters:
$layer_name the name of the layer
$renderer a function reference which conforms to the prototype: void renderer(resource $imageObj);

Definition at line 730 of file mapmanager.php.

MapManager::setLayerSelectable layer_name,
selectable
 

Change the selectability status of a layer.

If a layer is selectable, it is seen as being open to having it's STATUS property toggled programatically. Otherwise the STATUS value will not be altered by a MapServer_Manager instance.

Parameters:
$layer_name the name of the layer
$selectable true if the layer is to be selectable, false otherwise

Definition at line 695 of file mapmanager.php.

MapManager::setMapClick map_click,
click_type
 

Set the click point.

User interaction with the map is generally achieved using a 'click point'. This is a point location of interest on the map.

Parameters:
$map_click a pointObj specifying the click point in georeferenced coordinates
$click_type either MM_CLICK_MAIN or MM_CLICK_REF stating which map the click point refers to

Definition at line 467 of file mapmanager.php.

References $click_type, and $map_click.

MapManager::setMaxExtent extent  ) 
 

Set the maximum extent of the map.

Parameters:
$extent the extent in georeferenced coordinates as a rectObj

Definition at line 511 of file mapmanager.php.

MapManager::setZoomExtent zoom_extent  ) 
 

Set the georeferenced extent to which the map will be set when the zoom type is MM_ZOOM_EXTENT.

Parameters:
$zoom_extent the extent as a rectObj

Definition at line 425 of file mapmanager.php.

References $zoom_extent.

MapManager::setZoomLevel zoom_level  ) 
 

Specify the multiplication factor with which a zoom operation is applied.

Parameters:
$zoom_level 1 equates to no change in zoom. >1 results in progressively larger scales. <1 results in progressively smaller scales

Definition at line 478 of file mapmanager.php.

References $zoom_level, and zoom().

MapManager::setZoomScale zoom_scale  ) 
 

Set the map scale that will be zoomed to when the zoom type is set to MM_ZOOM_SCALE.

Parameters:
$zoom_scale the map scale as a float

Definition at line 407 of file mapmanager.php.

References $zoom_scale.

MapManager::setZoomType zoom_type  ) 
 

Determine the type of zoom operation to execute.

Parameters:
$zoom_type a MM_ZOOM_* constant
Returns:
void

Definition at line 389 of file mapmanager.php.

References $zoom_type.

MapManager::turnGroupOff group_name  ) 
 

Turn all member layers of a group off.

Parameters:
$group_name the name of the group

Definition at line 612 of file mapmanager.php.

MapManager::turnGroupOn group_name  ) 
 

Turn all member layers of a group on.

Parameters:
$group_name the name of the group

Definition at line 628 of file mapmanager.php.

MapManager::turnLayerOff layer_name,
toggle_group = false
 

Turn a layer off.

Parameters:
$layer_name the name of the layer
$toggle_group if true and the layer is a member of a group, turn all layers in the group off

Definition at line 571 of file mapmanager.php.

MapManager::turnLayerOn layer_name,
toggle_group = false
 

Turn a layer on.

Parameters:
$layer_name the name of the layer
$toggle_group if true and the layer is a member of a group, turn all layers in the group on

Definition at line 553 of file mapmanager.php.

MapManager::zoom  ) 
 

Perform a zoom operation.

The type of zoom operation to be performed is determined by the MapManager::setZoomType() method. Based on the zoom type, the correct zoom* method is called. These methods should be viewed as protected and not called directly by Map_Manager instances.

Returns:
true if a zoom operation was performed, false otherwise

Definition at line 917 of file mapmanager.php.

References $zoom_extent, $zoom_scale, $zoom_type, MM_ZOOM_EXTENT, MM_ZOOM_IN, MM_ZOOM_NONE, MM_ZOOM_OUT, MM_ZOOM_PAN, and MM_ZOOM_SCALE.

Referenced by setZoomLevel().

MapManager::zoomedToMaxExtent  ) 
 

Check whether the map is zoomed out to the maximum allowed extent.

Returns:
true if the map is zoomed out to the maximum extent, false otherwise

Definition at line 890 of file mapmanager.php.

References $max_extent.

MapManager::zoomedToMaxScale  ) 
 

Check whether the map is zoomed out to the maximum (smallest) allowed scale.

Returns:
returns true of the map is zoomed out to the maximum scale, false otherwise

Definition at line 869 of file mapmanager.php.

Referenced by zoomToPoint().

MapManager::zoomedToMinScale  ) 
 

Check whether the map is zoomed in to the minimum (largest) allowed scale.

Returns:
true if it is zoomed in completely, false otherwise

Definition at line 848 of file mapmanager.php.

MapManager::zoomInToMapClick  ) 
 

Zoom in to the map click.

Returns:
true if the click point has been set, false otherwise

Definition at line 1072 of file mapmanager.php.

References $map_click.

MapManager::zoomInToPoint map_point  ) 
 

Zoom in to a point.

Parameters:
$map_point a pointObj in georeferenced coordinates

Definition at line 1022 of file mapmanager.php.

References $zoom_level.

MapManager::zoomOutToMapClick  ) 
 

Zoom out from the map click.

Returns:
true if the click point has been set, false otherwise

Definition at line 1042 of file mapmanager.php.

References $map_click.

MapManager::zoomOutToPoint map_point  ) 
 

Zoom out from a point.

Parameters:
$map_point pointObj in georeferenced coordinates

Definition at line 1032 of file mapmanager.php.

References $zoom_level.

MapManager::zoomToExtent extent  ) 
 

Zoom to a specific extent.

Parameters:
$extent a rectObj containing the extent

Definition at line 954 of file mapmanager.php.

References $max_extent.

MapManager::zoomToPoint map_point,
zoom_level
 

Zoom to a point.

Parameters:
$map_point a pointObj specifying the point in georeferenced coordinates
$zoom_level the multiplication factor to apply to the zoom.

Definition at line 989 of file mapmanager.php.

References $max_extent, $zoom_level, and zoomedToMaxScale().

MapManager::zoomToScale scale  ) 
 

Zoom to a specific scale.

Parameters:
$scale the scale as a float

Definition at line 970 of file mapmanager.php.

References $max_extent.


Member Data Documentation

MapManager::$click_type
 

A MM_CLICK_* constant specifying the type of map clicked.

Definition at line 351 of file mapmanager.php.

Referenced by setMapClick().

MapManager::$layer_renderers
 

Associative array mapping layer names to the function which will render them.

Definition at line 338 of file mapmanager.php.

MapManager::$map_click
 

The position of the map click in georeferenced coordinates.

Definition at line 349 of file mapmanager.php.

Referenced by panToMapClick(), setMapClick(), zoomInToMapClick(), and zoomOutToMapClick().

MapManager::$max_extent
 

The maximum georeferenced extent of the map.

Definition at line 334 of file mapmanager.php.

Referenced by __sleep(), zoomedToMaxExtent(), zoomToExtent(), zoomToPoint(), and zoomToScale().

MapManager::$zoom_extent
 

The extent to which the map should zoom if MM_ZOOM_EXTENT is the zoom type.

Definition at line 344 of file mapmanager.php.

Referenced by __sleep(), setZoomExtent(), and zoom().

MapManager::$zoom_level
 

The current zoom factor.

Definition at line 336 of file mapmanager.php.

Referenced by setZoomLevel(), zoomInToPoint(), zoomOutToPoint(), and zoomToPoint().

MapManager::$zoom_scale
 

The scale to which the map should zoom if MM_ZOOM_SCALE is the zoom type.

Definition at line 342 of file mapmanager.php.

Referenced by setZoomScale(), and zoom().

MapManager::$zoom_type
 

Current value containing a MM_ZOOM_* constant.

Definition at line 340 of file mapmanager.php.

Referenced by setZoomType(), and zoom().


The documentation for this class was generated from the following file:
Generated on Mon Feb 14 11:40:07 2005 for MapManager by doxygen 1.3.5