com.esri.core.map
Class TiledLayerModel

java.lang.Object
  extended by com.esri.core.map.LayerModel
      extended by com.esri.core.map.TiledLayerModel
All Implemented Interfaces:
Serializable

public abstract class TiledLayerModel
extends LayerModel

Base class for all tiled layer models. You would typically work with one of the higher level classes, for example, use TiledLayer for cached data; DynamicLayer for non-cached data;

In a Model-View-Controller architecture, this class represents the Model. It handles fetching map tiles, calculating map extent and so on.

See Also:
Serialized Form

Nested Class Summary
static class TiledLayerModel.TileGrid
          TileGrid holds the tiles to fill the current map extent.
 
Constructor Summary
TiledLayerModel(SpatialReference coordsys, Envelope full, com.esri.core.internal.value.TileInfo tci)
          Instantiates a tiled layer model with the given tile information.
 
Method Summary
 int getLevel()
          Gets the current level number.
 int getLodTileHeight()
          Gets the default tile height in pixels.
 int getLodTileWidth()
          Gets the default tile width in pixels.
 List<Double> getResolutions()
          Gets the resolution list supported by the associated map service.
abstract  byte[] getTile(int lev, int row, int col)
          This method provides implementation of fetching a tile from a map service.
 void setExtent(Point centerPt, double resolution, int width, int height, SpatialReference sr)
          Sets the extent using the center point and the resolution.
 void setResolution(double res)
          Sets the resolution of the layer.
 TiledLayerModel.TileGrid toGrid()
          Calculates the grid based on the current map extent.
 TiledLayerModel.TileGrid toGridStateless(Envelope mapExtent, double mapResolution)
          Calculates the grid based on the current map extent.
protected  double updateLOD(double destResolution)
          Reset the model instance to the new resolution.
protected  double updateLOD(int levelId)
          Resets the model instance to the given level.
 double zoom(float pdx, float pdy, double to)
          Zooms the map to the given resolution at the pivot screen point.
 void zoomin(int px, int py)
          Zooms in one level on the current map.
 void zoomout(int px, int py)
          Zooms out one level on the current map.
 
Methods inherited from class com.esri.core.map.LayerModel
centerAt, getCenter, getDefaultSpatialReference, getExtent, getFullExtent, getResolution, getSpatialReference, pan, resize, setExtent, setFullExtent, setScreenSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TiledLayerModel

public TiledLayerModel(SpatialReference coordsys,
                       Envelope full,
                       com.esri.core.internal.value.TileInfo tci)
Instantiates a tiled layer model with the given tile information.

Parameters:
coordsys - the default map spatial reference.
full - the full map extent.
tci - the level of details for tiles.
Method Detail

setExtent

public void setExtent(Point centerPt,
                      double resolution,
                      int width,
                      int height,
                      SpatialReference sr)
Description copied from class: LayerModel
Sets the extent using the center point and the resolution. The spatial reference of the center point will be used as the layer's spatial reference, and the map image will be returned in this coordinate system.

Overrides:
setExtent in class LayerModel
Parameters:
centerPt - the map center;
width - map width in pixels
height - map height in pixels
sr - the coordinates of the map extent

toGrid

public TiledLayerModel.TileGrid toGrid()
Calculates the grid based on the current map extent.


toGridStateless

public TiledLayerModel.TileGrid toGridStateless(Envelope mapExtent,
                                                double mapResolution)
Calculates the grid based on the current map extent.


updateLOD

protected double updateLOD(int levelId)
Resets the model instance to the given level.

Parameters:
levelId - the level id.
Returns:
the resolution of the give level.

updateLOD

protected double updateLOD(double destResolution)
Reset the model instance to the new resolution.

Parameters:
destResolution - the new resolution to set.
Returns:
the updated resolution.

zoomin

public void zoomin(int px,
                   int py)
Zooms in one level on the current map. The pivot point is the coordinate that should remain unchanged by the specified transformation.

Parameters:
px - the pivot x in screen coordinate.
py - the pivot y in screen coordinate.

zoomout

public void zoomout(int px,
                    int py)
Zooms out one level on the current map. The pivot point is the coordinate that should remain unchanged by the specified transformation.

Parameters:
px - the pivot x in screen coordinate.
py - the pivot y in screen coordinate.

zoom

public double zoom(float pdx,
                   float pdy,
                   double to)
Description copied from class: LayerModel
Zooms the map to the given resolution at the pivot screen point. The pivot point is defined as a offset of the screen center point.

Overrides:
zoom in class LayerModel
Parameters:
pdx - the x coordinate of the center offset.
pdy - the y coordinate of the center offset.
to - the new resolution.

setResolution

public void setResolution(double res)
Description copied from class: LayerModel
Sets the resolution of the layer.

Overrides:
setResolution in class LayerModel
Parameters:
res - the new resolution.

getLodTileWidth

public int getLodTileWidth()
Gets the default tile width in pixels. If the tiled is resized, the width here may be different than it returned in the toGrid().


getLodTileHeight

public int getLodTileHeight()
Gets the default tile height in pixels. If the tiled is resized, the width here may be different than it returned in the toGrid().


getResolutions

public List<Double> getResolutions()
Gets the resolution list supported by the associated map service.


getLevel

public int getLevel()
Gets the current level number.


getTile

public abstract byte[] getTile(int lev,
                               int row,
                               int col)
                        throws Exception
This method provides implementation of fetching a tile from a map service.

Parameters:
lev - the level number of the tile.
col - the column id of the tile
row - the row id of the tile.
Throws:
Exception


Copyright © 2010. All Rights Reserved.