Rev 315 | Rev 318 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 315 | Rev 316 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | }
|
17 | }
|
18 | Environment::~Environment() |
18 | Environment::~Environment() |
19 | {
|
19 | {
|
20 | if (mInfile) { |
20 | if (mInfile) { |
21 | delete mInfile; |
21 | delete mInfile; |
22 | qDeleteAll(mSpeciesSets); |
- | |
23 | qDeleteAll(mClimate); |
- | |
24 | }
|
22 | }
|
25 | }
|
23 | }
|
26 | 24 | ||
27 | bool Environment::loadFromFile(const QString &fileName) |
25 | bool Environment::loadFromFile(const QString &fileName) |
28 | {
|
26 | {
|
Line 101... | Line 99... | ||
101 | xml.setNodeValue(climateKey,name); // set xml value |
99 | xml.setNodeValue(climateKey,name); // set xml value |
102 | // create climate sets
|
100 | // create climate sets
|
103 | Climate *climate = new Climate(); |
101 | Climate *climate = new Climate(); |
104 | climate->setup(); |
102 | climate->setup(); |
105 | mClimate.push_back(climate); |
103 | mClimate.push_back(climate); |
- | 104 | mCreatedObjects[name]=(void*)climate; |
|
106 | }
|
105 | }
|
107 | qDebug() << mClimate.count() << "climates created"; |
106 | qDebug() << mClimate.count() << "climates created"; |
108 | } else { |
107 | } else { |
109 | // no climate defined - setup default climate
|
108 | // no climate defined - setup default climate
|
110 | Climate *c = new Climate(); |
109 | Climate *c = new Climate(); |
111 | c->setup(); |
110 | c->setup(); |
112 | mClimate.push_back(c); |
111 | mClimate.push_back(c); |
113 | mCreatedObjects["default_climate"]=(void*)c; // prepare clean cleanup |
- | |
114 | mCurrentClimate = c; |
112 | mCurrentClimate = c; |
115 | }
|
113 | }
|
116 | return true; |
114 | return true; |
117 | 115 | ||
118 | } catch(const IException &e) { |
116 | } catch(const IException &e) { |
Line 151... | Line 149... | ||
151 | if (mKeys[col]==climateKey) |
149 | if (mKeys[col]==climateKey) |
152 | mCurrentClimate = (Climate*)mCreatedObjects[value]; |
150 | mCurrentClimate = (Climate*)mCreatedObjects[value]; |
153 | 151 | ||
154 | }
|
152 | }
|
155 | 153 | ||
156 | } else |
- | |
157 | throw IException(QString("Environment:setposition: invalid coordinates (or not present in input file): %1/%2").arg(position.x()).arg(position.y())); |
- | |
- | 154 | } //else |
|
- | 155 | // throw IException(QString("Environment:setposition: invalid coordinates (or not present in input file): %1/%2").arg(position.x()).arg(position.y()));
|
|
158 | }
|
156 | }
|