Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
671 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
19
 
269 werner 20
#ifndef ENVIRONMENT_H
21
#define ENVIRONMENT_H
280 werner 22
#include <QtCore>
23
 
269 werner 24
class Climate;
280 werner 25
class SpeciesSet;
26
class CSVFile;
567 werner 27
class GisGrid;
269 werner 28
 
340 werner 29
/** Environment specifes the geographical properties of the landscape.
30
    This is achieved by specifying (user defined) values (e.g. soil depth) for each resource unit.
31
    Resource units are specified by x/y indices.
32
    see http://iland.boku.ac.at/initialize+the+landscape */
269 werner 33
class Environment
34
{
35
public:
36
    Environment();
280 werner 37
    ~Environment();
281 werner 38
    bool isSetup() const { return mInfile!=0; }
567 werner 39
    /// switch to 'grid-mode': load the grid provided by @p grid_file_name
40
    bool setGridMode(const QString &grid_file_name);
280 werner 41
    // setup
281 werner 42
    void setDefaultValues(Climate *climate, SpeciesSet *speciesSet) {mCurrentClimate=climate; mCurrentSpeciesSet=speciesSet; }
280 werner 43
    bool loadFromString(const QString &source);
44
    bool loadFromFile(const QString &fileName);
281 werner 45
    QList<Climate*> climateList() const { return mClimate; } ///< created climates.
46
    QList<SpeciesSet*> speciesSetList() const { return mSpeciesSets; } ///< created species sets
280 werner 47
    // access
48
    void setPosition(const QPointF position); ///< set position (metric coordinates). Subsequent calls to retriever functions are for the current location.
281 werner 49
    Climate *climate() const { return mCurrentClimate;} ///< get climate at current pos
50
    SpeciesSet *speciesSet() const {return mCurrentSpeciesSet;} ///< get species set on current pos
889 werner 51
    int currentID() const { return mCurrentID; } ///< current grid id (in grid mode the id of the stand grid, in matrix mode simply the an autogenerated index)
280 werner 52
 
269 werner 53
private:
567 werner 54
    bool mGridMode;
569 werner 55
    int mCurrentID; ///< in grid mode, current id is the (grid) ID of the resource unit
340 werner 56
    Climate *mCurrentClimate; ///< climate at current location
57
    SpeciesSet *mCurrentSpeciesSet; ///< species set at current location
280 werner 58
    QList<Climate*> mClimate; ///< created climates.
59
    QList<SpeciesSet*> mSpeciesSets; ///< created species sets
60
    QStringList mKeys;
61
    QHash<QString, int> mRowCoordinates;
281 werner 62
    QHash<QString, void*> mCreatedObjects;
280 werner 63
    CSVFile *mInfile;
567 werner 64
    GisGrid *mGrid;
280 werner 65
 
269 werner 66
};
67
 
68
#endif // ENVIRONMENT_H