Subversion Repositories public iLand

Rev

Rev 697 | Rev 705 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 697 Rev 699
Line 32... Line 32...
32
#include "expression.h"
32
#include "expression.h"
33
#include "expressionwrapper.h"
33
#include "expressionwrapper.h"
34
#include "environment.h"
34
#include "environment.h"
35
#include "csvfile.h"
35
#include "csvfile.h"
36
#include "mapgrid.h"
36
#include "mapgrid.h"
-
 
37
#include "snapshot.h"
37
38
38
/** @class StandLoader
39
/** @class StandLoader
39
    @ingroup tools
40
    @ingroup tools
40
    loads (initializes) trees for a "stand" from various sources.
41
    loads (initializes) trees for a "stand" from various sources.
41
    StandLoader initializes trees on the landscape. It reads (usually) from text files, creates the
42
    StandLoader initializes trees on the landscape. It reads (usually) from text files, creates the
Line 93... Line 94...
93
        loadInitFile(fileName, type);
94
        loadInitFile(fileName, type);
94
        evaluateDebugTrees();
95
        evaluateDebugTrees();
95
        return;
96
        return;
96
    }
97
    }
97
98
98
    // copy trees from first unit to all other units:
-
 
99
    if (copy_mode=="copy") {
-
 
100
        loadInitFile(fileName, type);
-
 
101
        copyTrees();
-
 
102
        evaluateDebugTrees();
-
 
103
        return;
-
 
104
    }
-
 
105
99
106
    // call a single tree init for each resource unit
100
    // call a single tree init for each resource unit
107
    if (copy_mode=="unit") {
101
    if (copy_mode=="unit") {
108
        foreach( const ResourceUnit *const_ru, g->model()->ruList()) {
102
        foreach( const ResourceUnit *const_ru, g->model()->ruList()) {
109
            ResourceUnit *ru = const_cast<ResourceUnit*>(const_ru);
103
            ResourceUnit *ru = const_cast<ResourceUnit*>(const_ru);
Line 144... Line 138...
144
            }
138
            }
145
        }
139
        }
146
        evaluateDebugTrees();
140
        evaluateDebugTrees();
147
        return;
141
        return;
148
    }
142
    }
-
 
143
    if (copy_mode=="snapshot") {
-
 
144
        // load a snapshot from a file
-
 
145
        Snapshot shot;
149
146
-
 
147
        QString input_db = GlobalSettings::instance()->path(fileName);
-
 
148
        shot.loadSnapshot(input_db);
-
 
149
        return;
-
 
150
    }
150
    throw IException("StandLoader::processInit: invalid initalization.mode!");
151
    throw IException("StandLoader::processInit: invalid initalization.mode!");
151
}
152
}
152
153
153
void StandLoader::evaluateDebugTrees()
154
void StandLoader::evaluateDebugTrees()
154
{
155
{