SMap_Tile __construct(
SMap
$map, SMap_View
$view, array
$bounds, array
$grid
)
|
|
Set the properties of this tile
Parameters:
|
object The |
$map: |
map that contains this tile |
|
object The |
$view: |
view that contains this tile |
|
array |
$bounds: |
The real bounds of the tile |
|
array |
$grid: |
Where this tile is in relation to the others |
Add a layer to this tile.
Adding the layer is the first step in getting it rendered. Each layer can only be added once. After all layers are added, flatten() must be called.
The creation of layers should use few resources. Use SMap_Layer::applyTile() to do any major setup. If there is a cache hit, it will not be called.
Parameters:
API Tags:
Apply an object to this tile
Applies a tile to an object, and adds said object to the $objs array.
Parameters:
|
object Object |
$obj: |
to draw |
API Tags:
void constrain(
integer
$lid
)
|
|
Constrain each obect to this tile
Calls addObject() for each object of the designated layer. addObject() then calls SMap_Object::applyTile() to apply this tile to each object.
Constrain should be called on all tiles for each layer at a time. This ensures that layers are properly handled even if an object calls addObject() on a neighboring tile via SMap_View::sendObj().
Parameters:
|
integer |
$lid: |
Constrain this layer's objects |
API Tags:
Ensures that we have a rendered image
If the image doesn't already exist, create it. If layers have been added but not rendered, render them.
API Tags:
Display the current image
Also produces the appropriate headers.
API Tags:
void flatten(
boolean
$isImg
)
|
|
Flattens the layers by reducing them to objects
This is the second step in the process of rendering. The first is adding the layers. Here we take care of reducing each layer to objects, or retrieving the cached image.
Flattening is done after all layers are added so background labels can avoid foreground objects (such as the panning graphic). This is done before the final render is done so that labels have a chance to organize and send themselves to corrisponding tiles.
Image format selection is also decided here. We hope that photo realistic images (such as satellite) can be compressed as JPEG, just because it's more efficient compression. If a single layer requests PNG compression, though, we'll have to use PNG. This will ensure that we aren't forcing lossy compression where there shouldn't be any.
If all layers can agree on a different format (not PNG or JPEG), that format will be used. Ensure that the chosen format is enabled in SMap_Object_CachedImage::cache(), SMap_Object_CachedImage::getCachedFName(), and display().
If applicable, we are also handling caching here. SMap_Layer::cacheStatus() is called, and we figure out which layers should be cached, and which we can't cache at all. If the tile is cacheable and we have a cached tile, we retrieve it and use it. Otherwise we need to break it down to layers. Is each layer cacheable? Use a SMap_Object_CachedImage in place of rendering it.
Parameters:
|
boolean |
$isImg: |
Are we rendering an image or image map? |
API Tags:
The image specific part of flattening
API Tags:
Generate a 'map key'
This key is different than SMap::$key because it only uses the layers enabled in this tile. It can also only be used after flatten() is called.
API Tags:
Get GET request vars to create an image URL
Returns the variables that need to be passed to this tile in order to generate the image.
API Tags:
Return the parameters for an image map (links)
If we are returning a server side image map, one of the returned objects will be of shape 'ismap'. The form should be able to handle this case. If a user clicks on a server side image map, {@SMap::handleImageMap()} should be called, which will return the appropriate URL the user should be redirected to.
If we are returning a client side image map, returned set of arrays represent the "area" of the image map. They have indexes at ['alt'], ['coords'], ['shape'], and ['href'].
If there is no link here, we will return an empty array.
API Tags:
void needGrid(
SMap_Layer
$layer, [
$mask = null]
)
|
|
Marks the tile grid as in use
If the tile grid is needed, it will be passed via the URL to render the final image properly. It is suggested that the grid is only used when you really need it to allow for better caching. The grid also won't be available if we have some sort of dynamic Google Maps thing going on.
A layer that calls this must not be cached, or an exception will be thrown.
Parameters:
|
integer |
$layer: |
Mask of the needed parts of the grid |
|
|
$mask: |
|
API Tags:
void setLastModified(
integer
$time
)
|
|
Sets the last modified time for this tile
If no last modified time is set, then the current time is used. If there is already a modified time, then the more recent one is used.
Parameters:
|
integer |
$time: |
Unix timestamp |
API Tags:
mixed __get(
string
$nm
)
|
|
Access useful vars read-only
Parameters:
|
string |
$nm: |
Name of member |
API Tags:
| Return: | Value of member |
| Access: | public |