iLand
|
#include <scriptgrid.h>
Public Slots | |
bool | create (int awidth, int aheight, int acellsize) |
creates a grid with cellsize / width / height the offset of the grid (lower left corner) is given by coordx/coordy More... | |
void | setName (QString arg) |
void | setOrigin (double x, double y) |
set the origin of the grid (iLand coordiantes). More... | |
QJSValue | copy () |
create a copy of the current grid and return a new script object More... | |
void | clear () |
fill the grid with 0-values More... | |
void | paint (double min_val, double max_val) |
draw the map More... | |
QString | info () |
void | save (QString fileName) |
save to a file as ESRI ASC raster grid (relative to project file) More... | |
bool | load (QString fileName) |
load from a file (ESRI ASC raster grid), relative to project root. More... | |
void | apply (QString expression) |
apply a function on the values of the grid, thus modifiying the grid (see the copy() function). More... | |
void | combine (QString expression, QJSValue grid_object) |
combine multiple grids, and calculate the result of 'expression' More... | |
QJSValue | resample (QJSValue grid_object) |
resamples the grid to the extent/cellsize given by the grid 'grid_object' Resampling is "brute-force", every cell of the new grid gets the cell value of the cell center returns the object itself. More... | |
void | aggregate (int factor) |
double | sum (QString expression) |
apply the expression "expression" on all pixels of the grid and return the sum of the values More... | |
void | sumTrees (QString expression, QString filter) |
loop over all trees and create a sum of 'expression' for each cell. Filter trees with 'filter' More... | |
double | value (int x, int y) const |
access values of the grid More... | |
void | setValue (int x, int y, double value) const |
write values to the grid More... | |
double | valueAt (double x, double y) const |
access value of the grid in metric coordinates More... | |
void | setValueAt (double x, double y, double value) const |
write values to the grid at metric coordinates x and y. More... | |
double | metricX (int indexx) const |
convert a cellindex in x-direction to a metric value (x) representing the center of the cell More... | |
double | metricY (int indexy) const |
convert a cellindex in y-direction to a metric value (y) representing the center of the cell More... | |
int | indexX (double meterx) const |
convert a metric value (x-axis) to an index for the x-axis (see also isIndexValid(), isCoordValid() ) More... | |
int | indexY (double metery) const |
convert a metric value (y-axis) to an index for the y-axis (see also isIndexValid(), isCoordValid() ) More... | |
bool | isIndexValid (int x, int y) const |
check if a given pair of indices (x/y) is valid for the grid More... | |
bool | isCoordValid (double x, double y) const |
check if a given pair of metric coordinates (x/y) is valid for the grid More... | |
Public Member Functions | |
Q_INVOKABLE | ScriptGrid (QObject *parent=nullptr) |
Q_INVOKABLE | ScriptGrid (QString fileName) |
ScriptGrid (Grid< double > *grid) | |
void | setGrid (Grid< double > *grid) |
void | setOwnership (bool should_delete) |
~ScriptGrid () | |
QString | name () const |
Grid< double > * | grid () |
int | width () const |
int | height () const |
int | count () const |
int | cellsize () const |
bool | isValid () const |
Static Public Member Functions | |
static QJSValue | createGrid (Grid< double > *grid, QString name=QString()) |
static void | addToScriptEngine (QJSEngine *engine) |
Properties | |
QString | name |
int | width |
int | height |
int | count |
int | cellsize |
bool | isValid |
ScriptGrid::ScriptGrid | ( | QObject * | parent = nullptr | ) |
|
inline |
|
inlineexplicit |
ScriptGrid::~ScriptGrid | ( | ) |
|
static |
|
slot |
|
slot |
apply a function on the values of the grid, thus modifiying the grid (see the copy() function).
The function is given as an Expression and is run for each cell of the grid.
|
inline |
|
slot |
fill the grid with 0-values
|
slot |
combine multiple grids, and calculate the result of 'expression'
|
slot |
create a copy of the current grid and return a new script object
|
inline |
|
slot |
creates a grid with cellsize / width / height the offset of the grid (lower left corner) is given by coordx/coordy
|
static |
|
inline |
|
inline |
|
inlineslot |
convert a metric value (x-axis) to an index for the x-axis (see also isIndexValid(), isCoordValid() )
|
inlineslot |
convert a metric value (y-axis) to an index for the y-axis (see also isIndexValid(), isCoordValid() )
|
slot |
|
inlineslot |
check if a given pair of metric coordinates (x/y) is valid for the grid
|
inlineslot |
check if a given pair of indices (x/y) is valid for the grid
|
inline |
|
slot |
load from a file (ESRI ASC raster grid), relative to project root.
return true on success.
|
inlineslot |
convert a cellindex in x-direction to a metric value (x) representing the center of the cell
|
inlineslot |
convert a cellindex in y-direction to a metric value (y) representing the center of the cell
|
inline |
|
slot |
draw the map
|
slot |
resamples the grid to the extent/cellsize given by the grid 'grid_object' Resampling is "brute-force", every cell of the new grid gets the cell value of the cell center returns the object itself.
|
slot |
save to a file as ESRI ASC raster grid (relative to project file)
|
inline |
|
inlineslot |
|
slot |
set the origin of the grid (iLand coordiantes).
the width/height of the grid are not altered, the grid is just moved to the new coordiantes.
|
inline |
|
inlineslot |
write values to the grid
|
inlineslot |
write values to the grid at metric coordinates x and y.
|
slot |
apply the expression "expression" on all pixels of the grid and return the sum of the values
|
slot |
loop over all trees and create a sum of 'expression' for each cell. Filter trees with 'filter'
|
inlineslot |
access values of the grid
|
inlineslot |
access value of the grid in metric coordinates
|
inline |
|
read |
|
read |
|
read |
|
read |
|
readwrite |
|
read |