TileMatrix.pm

Summary
TileMatrix.pm
BE4::TileMatrixA Tile Matrix defines a grid for a level.
Constructors
newTileMatrix constructor.
_initCheck and store TileMatrix’s informations.
Coordinates manimulators
getImgGroundWidthReturns the ground width of an image, whose number of tile (widthwise) can be provided.
getImgGroundHeightReturns the ground height of an image, whose number of tile (heightwise) can be provided.
columnToXReturns the X coordinate, in the TMS SRS, of the upper left corner, from the column indice and the number of tiles per width.
rowToYReturns the Y coordinate, in the TMS SRS, of the upper left corner, from the row indice and the number of tiles per height.
xToColumnReturns the column indice for the given X coordinate and the number of tiles per width.
yToRowReturns the row indice for the given Y coordinate and the number of tiles per height.
indicesToBBoxReturns the BBox from image’s indices in a list : (xMin,yMin,xMax,yMax).
bboxToIndicesReturns the extrem indices from a bbox in a list : (iMin,jMin,iMax,jMax).
Getters - Setters
getID
setTMS
getResolution
getTileWidth
getTileHeight
getMatrixWidth
getMatrixHeight
getTopLeftCornerX
getTopLeftCornerY
getTargetsTm
getSRS
addTargetTm
Export methods
exportForDebugReturns all informations about the tile matrix.

BE4::TileMatrix

Exporter
BE4::TileMatrix

A Tile Matrix defines a grid for a level.  Informations are extracted from a XML file.

Using

use BE4::TileMatrix;

my $params = {
    id             => "18",
    resolution     => 0.5,
    topLeftCornerX => 0,
    topLeftCornerY => 12000000,
    tileWidth      => 256,
    tileHeight     => 256,
    matrixWidth    => 10080,
    matrixHeight   => 84081,
};

my $objTM = BE4::TileMatrix->new($params);                # ie '/home/ign/tms/'

Attributes

idstring - TM identifiant.
tmsTileMatrixSet - TMS to whom it belong
resolutiondouble - Ground size of a pixel, using unity of the SRS.
topLeftCornerXdouble - X coordinate of the upper left corner for the level, the grid’s origin.
topLeftCornerYdouble - Y coordinate of the upper left corner for the level, the grid’s origin.
tileWidthinteger - Pixel width of a tile.
tileHeightinteger - Pixel height of a tile.
matrixWidthinteger - Number of tile in the grid, widthwise.
matrixHeightinteger - Number of tile in the grid, heightwise.
targetsTmTileMatrix array - Determine other levels which use this one to be generated.  Empty if this level belong to a quad tree TileMatrixSet.

Limits

Resolution have to be the same X and Y wise.

Summary
Constructors
newTileMatrix constructor.
_initCheck and store TileMatrix’s informations.
Coordinates manimulators
getImgGroundWidthReturns the ground width of an image, whose number of tile (widthwise) can be provided.
getImgGroundHeightReturns the ground height of an image, whose number of tile (heightwise) can be provided.
columnToXReturns the X coordinate, in the TMS SRS, of the upper left corner, from the column indice and the number of tiles per width.
rowToYReturns the Y coordinate, in the TMS SRS, of the upper left corner, from the row indice and the number of tiles per height.
xToColumnReturns the column indice for the given X coordinate and the number of tiles per width.
yToRowReturns the row indice for the given Y coordinate and the number of tiles per height.
indicesToBBoxReturns the BBox from image’s indices in a list : (xMin,yMin,xMax,yMax).
bboxToIndicesReturns the extrem indices from a bbox in a list : (iMin,jMin,iMax,jMax).
Getters - Setters
getID
setTMS
getResolution
getTileWidth
getTileHeight
getMatrixWidth
getMatrixHeight
getTopLeftCornerX
getTopLeftCornerY
getTargetsTm
getSRS
addTargetTm
Export methods
exportForDebugReturns all informations about the tile matrix.

Constructors

new

sub new

TileMatrix constructor.  Bless an instance.

Parameters (hash)

idstring - Level identifiant
resolutiondouble - X and Y wise resolution
topLeftCornerXdouble - Origin easting
topLeftCornerYdouble - Origin northing
tileWidthinteger - Tile width, in pixel
tileHeightinteger - Tile height, in pixel
matrixWidthinteger - Grid width, in tile
matrixHeightinteger - Grid height, in tile

See also

_init

_init

sub _init

Check and store TileMatrix’s informations.

Parameters (hash)

idstring - Level identifiant
resolutiondouble - X and Y wise resolution
topLeftCornerXdouble - Origin easting
topLeftCornerYdouble - Origin northing
tileWidthinteger - Tile width, in pixel
tileHeightinteger - Tile height, in pixel
matrixWidthinteger - Grid width, in tile
matrixHeightinteger - Grid height, in tile

Coordinates manimulators

getImgGroundWidth

sub getImgGroundWidth

Returns the ground width of an image, whose number of tile (widthwise) can be provided.

Parameters (list)

tilesPerWidthinteger - Optionnal (1 if undefined)

getImgGroundHeight

sub getImgGroundHeight

Returns the ground height of an image, whose number of tile (heightwise) can be provided.

Parameters (list)

tilesPerHeightinteger - Optionnal (1 if undefined)

columnToX

sub columnToX

Returns the X coordinate, in the TMS SRS, of the upper left corner, from the column indice and the number of tiles per width.

Parameters (list)

colinteger - Column indice
tilesPerWidthinteger - Optionnal (1 if undefined)

rowToY

sub rowToY

Returns the Y coordinate, in the TMS SRS, of the upper left corner, from the row indice and the number of tiles per height.

Parameters (list)

rowinteger - Row indice
tilesPerHeightinteger - Optionnal (1 if undefined)

xToColumn

sub xToColumn

Returns the column indice for the given X coordinate and the number of tiles per width.

Parameters (list)

xdouble - x-axis coordinate
tilesPerWidthinteger - Optionnal (1 if undefined)

yToRow

sub yToRow

Returns the row indice for the given Y coordinate and the number of tiles per height.

Parameters (list)

ydouble - y-axis coordinate
tilesPerHeightinteger - Optionnal (1 if undefined)

indicesToBBox

sub indicesToBBox

Returns the BBox from image’s indices in a list : (xMin,yMin,xMax,yMax).

Parameters (list)

iinteger - Image’s column
jinteger - Image’s row
tilesPerWidthinteger - Number of tile in the image, widthwise
tilesPerHeightinteger - Number of tile in the image, heightwise

bboxToIndices

sub bboxToIndices

Returns the extrem indices from a bbox in a list : (iMin,jMin,iMax,jMax).

Parameters (list)

xMin,yMin,xMax,yMaxbounding box
tilesPerWidthinteger - Number of tile in the image, widthwise
tilesPerHeightinteger - Number of tile in the image, heightwise

Getters - Setters

getID

sub getID

setTMS

sub setTMS

getResolution

sub getResolution

getTileWidth

sub getTileWidth

getTileHeight

sub getTileHeight

getMatrixWidth

sub getMatrixWidth

getMatrixHeight

sub getMatrixHeight

getTopLeftCornerX

sub getTopLeftCornerX

getTopLeftCornerY

sub getTopLeftCornerY

getTargetsTm

sub getTargetsTm

getSRS

sub getSRS

addTargetTm

sub addTargetTm

Parameters (list)

tmTileMatrix - Tile Matrix to add to target ones

Export methods

exportForDebug

sub exportForDebug

Returns all informations about the tile matrix.  Useful for debug.

Example

sub new
TileMatrix constructor.
sub _init
Check and store TileMatrix’s informations.
sub getImgGroundWidth
Returns the ground width of an image, whose number of tile (widthwise) can be provided.
sub getImgGroundHeight
Returns the ground height of an image, whose number of tile (heightwise) can be provided.
sub columnToX
Returns the X coordinate, in the TMS SRS, of the upper left corner, from the column indice and the number of tiles per width.
sub rowToY
Returns the Y coordinate, in the TMS SRS, of the upper left corner, from the row indice and the number of tiles per height.
sub xToColumn
Returns the column indice for the given X coordinate and the number of tiles per width.
sub yToRow
Returns the row indice for the given Y coordinate and the number of tiles per height.
sub indicesToBBox
Returns the BBox from image’s indices in a list : (xMin,yMin,xMax,yMax).
sub bboxToIndices
Returns the extrem indices from a bbox in a list : (iMin,jMin,iMax,jMax).
sub getID
sub setTMS
sub getResolution
sub getTileWidth
sub getTileHeight
sub getMatrixWidth
sub getMatrixHeight
sub getTopLeftCornerX
sub getTopLeftCornerY
sub getTargetsTm
sub getSRS
sub addTargetTm
sub exportForDebug
Returns all informations about the tile matrix.
Load and store all information about a Tile Matrix Set.
A Tile Matrix defines a grid for a level.
Close