phpDocumentor SMap
Layers
[ class tree: SMap ] [ index: SMap ] [ all elements ]

Class: SMap_Layer

Source Location: /SMap/Layer.php

Class SMap_Layer

Class Overview

A layer that can be added to the map

Layers are the basis for users drawing on the map. Create a layer and add it to a view using SMap_View::addLayer(). If the layer is enabled in the view, it will be drawn.

Layers are drawn using SMap_Layer::getMapObjs(), SMap_Layer::, and SMap_View::sendObj(). The objects passed via these calls are sent to SMap_Tile, which then composites and renders them.

Located in /SMap/Layer.php [line 53]



		
				Author(s):
		
API Tags:
Abstract:  

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
SMap_Layer_Group Represents a group of layers
SMap_Layer_OGR An OGR readable vector file
SMap_Layer_Points A set of points
SMap_Layer_Lines Draws a set of lines on the map
SMap_Layer_Polygon Draws a polygon on the map
SMap_Layer_Images Layers a set of images
SMap_Layer_Grid Lay out a grid
SMap_Layer_Zoom Navigational elements for zooming in on an image
SMap_Layer_Pan Navigational elements for panning across a map
SMap_Layer_Inset A small inset microcosm of our view

[ Top ]
Property Summary
integer   $id   Each layer that can be active has an integer ID. This ID is used to determine if the layer is enabled or not, and it is used to keep track of which layers are enabled in a given map.
object   $map   The map that this layer is embedded in

[ Top ]
Method Summary
SMap_Layer   __construct()   Construct the layer
mixed   cacheStatus()   How cachable is this layer?
array   getAdjViewBounds()   Adjust the view coords if we are in an image
integer   getID()   Returns the ID of this layer
integer   getImageFmt()   Recommended format for this layer
array   getImgObjs()   Composite this layer onto the tile (in a raster way)
object The   getMap()   Return the map that contains this layer
array   getMapObjs()   Composite this layer onto the tile
boolean   hasCachedRects()   Might have cached rects in the DB
boolean   isValidZoom()   Is this layer zoomed to a useful resolution?
void   pxOffBound()   Get the bound at a pixel offset from a bound.

[ Top ]
Properties
integer   $id [line 61]

Each layer that can be active has an integer ID. This ID is used to determine if the layer is enabled or not, and it is used to keep track of which layers are enabled in a given map.

API Tags:
Access:  protected


[ Top ]
object   $map [line 69]

The map that this layer is embedded in

API Tags:
Access:  protected
See:  SMap


[ Top ]
Methods
Constructor __construct  [line 78]

  SMap_Layer __construct( SMap $map, $id  )

Construct the layer

Each layer should have a unique ID

Parameters:
integer   $map:  This layer's ID
   $id: 


Redefined in descendants as:

[ Top ]
cacheStatus  [line 145]

  mixed cacheStatus( )

How cachable is this layer?

Return the "cache status" of this layer. The intent of this is to determine whether we should use the cache images generated by this layer.

False is returned if the layer should not be cached. True is returned if the layer can be cached, but it really doesn't matter either way. For real control when caching, return an integer. The returned number should be the number of seconds the cache is valid for.

Note that SMap_Tile::tileGrid is ignored when caching.


API Tags:
Return:  True, false, or time in seconds.
Usedby:  SMap_Tile::needGrid()
Usedby:  SMap_Tile::flattenImg()
Access:  public


[ Top ]
getAdjViewBounds  [line 176]

  array getAdjViewBounds( array $tG  )

Adjust the view coords if we are in an image

Uses the current bounds and the tile grid to calculate the view bounds of the original image.

Parameters:
array   $tG:  The current tile grid

API Tags:
Return:  The overall view bounds
Access:  protected


[ Top ]
getID  [line 232]

  integer getID( )

Returns the ID of this layer

No two layers should have the same ID


API Tags:
Return:  This layer's ID
Access:  public


[ Top ]
getImageFmt  [line 114]

  integer getImageFmt( )

Recommended format for this layer

What is the best image format for this layer? The IMAGETYPE_PNG should be used for line art and text. IMAGETYPE_JPEG should be used for photographs, such as satelite imagery.

A PNG image is a "lossless" image. All information is kept. This is the default, but for the best file size, use JPEG on photographic images.

To be safe, this value is not determined within the SMap package, so if you wish your layer to express its preference, you will have to override this method.


API Tags:
Return:  An image format
Usedby:  SMap_Tile::flatten()
Access:  public


[ Top ]
getImgObjs  [line 165]

  array getImgObjs( SMap_View $view, SMap_Tile $tile  )

Composite this layer onto the tile (in a raster way)

Parameters:
object The   $view:  view we are compositing in
object The   $tile:  tile we are compositing to

API Tags:
Return:  The objects to composite
Access:  public
Abstract:  


Redefined in descendants as:

[ Top ]
getMap  [line 241]

  object The getMap( )

Return the map that contains this layer


API Tags:
Return:  map object
Access:  public


[ Top ]
getMapObjs  [line 156]

  array getMapObjs( SMap_View $view, SMap_Tile $tile  )

Composite this layer onto the tile

Parameters:
object The   $view:  view we are compositing in
object The   $tile:  tile we are compositing to

API Tags:
Return:  The objects to composite
Usedby:  SMap_Tile::flatten()
Access:  public
Abstract:  


Redefined in descendants as:

[ Top ]
hasCachedRects  [line 126]

  boolean hasCachedRects( )

Might have cached rects in the DB

Might this layer have cached rects in the DB? Layers which have cached rects include layers which use labels.


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
isValidZoom  [line 93]

  boolean isValidZoom( $zoomNum  )

Is this layer zoomed to a useful resolution?

Note that a layer should be drawable at any resolution, but sometimes it just doesn't make sense to zoom in anymore. This may be because an image is at it's maximum resolution, or all the labels are displayed easily, or only a few regions are displayed.

Parameters:
   $zoomNum: 


[ Top ]
pxOffBound  [line 210]

  void pxOffBound( SMap_View $view, integer $boundSide, integer $pixels  )

Get the bound at a pixel offset from a bound.

Parameters:
object View   $view:  we are drawing in
integer   $boundSide:  Index of the side we are working with
integer   $pixels:  Pixels offset

API Tags:
Access:  protected


[ Top ]

Documentation generated on Mon, 09 Apr 2007 18:53:14 -0500 by phpDocumentor 1.3.0