NNGraph.pm

Summary
NNGraph.pm
BE4::NNGraphRepresentation of a “nearest neighbour” pyramid : pyramid’s image = Node.
Constructors
newNNGraph constructor.
_initChecks and stores informations.
_loadDetermines all nodes from the bottom level to the top level, thanks to the data source.
Nodes determination methods
identifyBottomNodesCalculate all nodes in bottom level concerned by the datasource (tiles which touch the data source extent).
identifyAboveNodesCalculate all nodes in above levels.
Compute methods
computeYourself
containsNodeReturns a boolean : TRUE if the node belong to this tree, FALSE otherwise (if a parameter is not defined too).
Getters - Setters
getPyramid
getForest
getDataSource
getTopID
getBottomID
getTopOrder
getBottomOrder
getNodesOfLevelReturns a Node array, contaning all nodes of the provided level.
isLevelEmptyReturns a boolean, precise if level is empty.
getNodesOfTopLevel
getBbox
updateBBoxCompare provided and stored extrems coordinates and update values.
getScriptsOfLevelReturns a Script array, used scripts to generate the supllied level.
Export methods
exportForDebugReturns all informations about the “nearest neighbour” graph.

BE4::NNGraph

Exporter
BE4::NNGraph

Representation of a “nearest neighbour” pyramid : pyramid’s image = Node.

To generate this kind of graph, we use :

  • jobNumber scripts by level : to generate image to work format.
  • jobNumber scripts : to move image in the final pyramid, with the wanted format (compression...)

=> jobNumber x (levelNumber + 1) scripts

Organization in the Forest scripts’ array :

Link between a node and his children or his father is not trivial.  It is calculated and store in the Node object.

Using

use BE4::NNGraph;

# NNGraph object creation
my $objNNGraph = BE4::QTree->new($objForest, $objDataSource, $objPyramid, $objCommands);

...

# Fill each node with computing code
$objNNGraph->computeYourself();

Attributes

forestForest - Forest which this tree belong to.
pyramidPyramid - Pyramid linked to this tree.
commandsCommands - Command to use to generate images.
datasourceDataSource - Data source to use to define bottom level nodes and generate them.
bboxdouble array - Datasource bbox, [xmin,ymin,xmax,ymax], in TMS’ SRS
nodesNode hash - Structure is:
level1 => {
   c1_r2 => n1,
   c2_r2 => n2,
   c3_r2 => n3, ...}
level2 => {
   c1_r2 => n4,
   c2_r2 => n5, ...}

cX : node's column
rX : node's row
nX : BE4::Node
bottomIDstring - Bottom level identifiant
topIDstring - Top level identifiant
Summary
Constructors
newNNGraph constructor.
_initChecks and stores informations.
_loadDetermines all nodes from the bottom level to the top level, thanks to the data source.
Nodes determination methods
identifyBottomNodesCalculate all nodes in bottom level concerned by the datasource (tiles which touch the data source extent).
identifyAboveNodesCalculate all nodes in above levels.
Compute methods
computeYourself
containsNodeReturns a boolean : TRUE if the node belong to this tree, FALSE otherwise (if a parameter is not defined too).
Getters - Setters
getPyramid
getForest
getDataSource
getTopID
getBottomID
getTopOrder
getBottomOrder
getNodesOfLevelReturns a Node array, contaning all nodes of the provided level.
isLevelEmptyReturns a boolean, precise if level is empty.
getNodesOfTopLevel
getBbox
updateBBoxCompare provided and stored extrems coordinates and update values.
getScriptsOfLevelReturns a Script array, used scripts to generate the supllied level.
Export methods
exportForDebugReturns all informations about the “nearest neighbour” graph.

Constructors

new

sub new

NNGraph constructor.  Bless an instance.

Parameters (list)

objForestForest - Forest which this tree belong to
objSrcDataSource - Datasource which determine bottom level nodes
objPyrPyramid - Pyramid linked to this tree
objCommandsCommands - Commands to use to generate pyramid’s images

See also

_init, _load

_init

sub _init

Checks and stores informations.

Parameters (list)

objForestForest - Forest which this tree belong to
objSrcDataSource - Data source which determine bottom level nodes
objPyrPyramid - Pyramid linked to this tree
objCommandsCommands - Commands to use to generate pyramid’s images

_load

sub _load

Determines all nodes from the bottom level to the top level, thanks to the data source.

Nodes determination methods

identifyBottomNodes

sub identifyBottomNodes

Calculate all nodes in bottom level concerned by the datasource (tiles which touch the data source extent).

Parameters (list)

ct<Geo::OSR::CoordinateTransformation> - To convert data extent or images’ bbox.

identifyAboveNodes

sub identifyAboveNodes

Calculate all nodes in above levels.  We generate a above level node if one or more children are generated.

We have to use “nearest neighbour” interpolation with this kinf of graph.  So (beacause pixel’s center are aligned), we keep the value from the below level.  Goal is to always have values from source data, no average.

When we load the TMS, we precise links between different levels (source and targets).  For each level, we identify above nodes (thanks to bounding boxes) which will be generated from the node.  We store all this parent-child relations.

Compute methods

computeYourself

sub computeYourself

Only one step

  • browse graph and write commands in different scripts.

containsNode

sub containsNode

Returns a boolean : TRUE if the node belong to this tree, FALSE otherwise (if a parameter is not defined too).

Parameters (list)

levelstring - Level ID of the node we want to know if it is in the quad tree.
iinteger - Column of the node we want to know if it is in the quad tree.
jinteger - Row of the node we want to know if it is in the quad tree.

Getters - Setters

getPyramid

sub getPyramid

getForest

sub getForest

getDataSource

sub getDataSource

getTopID

sub getTopID

getBottomID

sub getBottomID

getTopOrder

sub getTopOrder

getBottomOrder

sub getBottomOrder

getNodesOfLevel

sub getNodesOfLevel

Returns a Node array, contaning all nodes of the provided level.

Parameters (list)

levelstring - Level ID whose we want all nodes.

isLevelEmpty

sub isLevelEmpty

Returns a boolean, precise if level is empty.

Parameters (list)

levelstring - Level ID

getNodesOfTopLevel

sub getNodesOfTopLevel

getBbox

sub getBbox

updateBBox

sub updateBBox

Compare provided and stored extrems coordinates and update values.

Parameters (list)

xmin, ymin, xmax, ymaxdouble - New coordinates to compare with current bbox.

getScriptsOfLevel

sub getScriptsOfLevel

Returns a Script array, used scripts to generate the supllied level.

Parameters (list)

levelstring - Level identifiant, whose scripts we want.

Export methods

exportForDebug

sub exportForDebug

Returns all informations about the “nearest neighbour” graph.  Useful for debug.

Example

Descibe a node of a QTree or a Graph.
sub new
NNGraph constructor.
sub _init
Checks and stores informations.
sub _load
Determines all nodes from the bottom level to the top level, thanks to the data source.
sub identifyBottomNodes
Calculate all nodes in bottom level concerned by the datasource (tiles which touch the data source extent).
sub identifyAboveNodes
Calculate all nodes in above levels.
sub computeYourself
sub containsNode
Returns a boolean : TRUE if the node belong to this tree, FALSE otherwise (if a parameter is not defined too).
sub getPyramid
sub getForest
sub getDataSource
sub getTopID
sub getBottomID
sub getTopOrder
sub getBottomOrder
sub getNodesOfLevel
Returns a Node array, contaning all nodes of the provided level.
sub isLevelEmpty
Returns a boolean, precise if level is empty.
sub getNodesOfTopLevel
sub getBbox
sub updateBBox
Compare provided and stored extrems coordinates and update values.
sub getScriptsOfLevel
Returns a Script array, used scripts to generate the supllied level.
Describe a script, its weight and allowed to write in.
sub exportForDebug
Returns all informations about the “nearest neighbour” graph.
Creates and manages all graphs, NNGraph and QTree.
Store all informations about a pyramid.
Configure and assemble commands used to generate pyramid’s images.
Manage a data source, physical (image files) or virtual (WMS server) or both.
Close