Subversion Repositories public iLand

Rev

Rev 316 | Rev 319 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 316 Rev 318
Line 74... Line 74...
74
            qDebug() << "creating species sets:" << speciesNames;
74
            qDebug() << "creating species sets:" << speciesNames;
75
            foreach (const QString &name, speciesNames) {
75
            foreach (const QString &name, speciesNames) {
76
                xml.setNodeValue(speciesKey,name); // set xml value
76
                xml.setNodeValue(speciesKey,name); // set xml value
77
                // create species sets
77
                // create species sets
78
                SpeciesSet *set = new SpeciesSet();
78
                SpeciesSet *set = new SpeciesSet();
79
                set->setup();
-
 
80
                mSpeciesSets.push_back(set);
79
                mSpeciesSets.push_back(set);
81
                mCreatedObjects[name] = (void*)set;
80
                mCreatedObjects[name] = (void*)set;
-
 
81
                set->setup();
82
            }
82
            }
83
            qDebug() << mSpeciesSets.count() << "species sets created.";
83
            qDebug() << mSpeciesSets.count() << "species sets created.";
84
        } else {
84
        } else {
85
            // no species sets specified
85
            // no species sets specified
86
            SpeciesSet *speciesSet = new SpeciesSet();
86
            SpeciesSet *speciesSet = new SpeciesSet();
87
            speciesSet->setup();
-
 
88
            mSpeciesSets.push_back(speciesSet);
87
            mSpeciesSets.push_back(speciesSet);
-
 
88
            speciesSet->setup();
89
            mCurrentSpeciesSet = speciesSet;
89
            mCurrentSpeciesSet = speciesSet;
90
        }
90
        }
91
91
92
        // ******** setup of Climate *******
92
        // ******** setup of Climate *******
93
        if ((index = mKeys.indexOf(climateKey))>-1) {
93
        if ((index = mKeys.indexOf(climateKey))>-1) {
Line 97... Line 97...
97
            qDebug() << "creating climatae: " << climateNames;
97
            qDebug() << "creating climatae: " << climateNames;
98
            foreach (QString name, climateNames) {
98
            foreach (QString name, climateNames) {
99
                xml.setNodeValue(climateKey,name); // set xml value
99
                xml.setNodeValue(climateKey,name); // set xml value
100
                // create climate sets
100
                // create climate sets
101
                Climate *climate = new Climate();
101
                Climate *climate = new Climate();
102
                climate->setup();
-
 
103
                mClimate.push_back(climate);
102
                mClimate.push_back(climate);
104
                mCreatedObjects[name]=(void*)climate;
103
                mCreatedObjects[name]=(void*)climate;
-
 
104
                climate->setup();
105
            }
105
            }
106
            qDebug() << mClimate.count() << "climates created";
106
            qDebug() << mClimate.count() << "climates created";
107
        } else {
107
        } else {
108
            // no climate defined - setup default climate
108
            // no climate defined - setup default climate
109
            Climate *c = new Climate();
109
            Climate *c = new Climate();
110
            c->setup();
-
 
111
            mClimate.push_back(c);
110
            mClimate.push_back(c);
-
 
111
            c->setup();
112
            mCurrentClimate = c;
112
            mCurrentClimate = c;
113
        }
113
        }
114
        return true;
114
        return true;
115
115
116
    } catch(const IException &e) {
116
    } catch(const IException &e) {
-
 
117
        QString addMsg;
-
 
118
        if (!mClimate.isEmpty())
-
 
119
            addMsg = QString("last Climate: %1 ").arg(mClimate.last()->name());
-
 
120
        if (!mSpeciesSets.isEmpty())
-
 
121
            addMsg += QString("last Speciesset table: %1").arg(mSpeciesSets.last()->name());
117
        QString error_msg = QString("An error occured during the setup of the environment: \n%1").arg(e.toString());
122
        QString error_msg = QString("An error occured during the setup of the environment: \n%1\n%2").arg(e.toString()).arg(addMsg);
118
        qDebug() << error_msg;
123
        qDebug() << error_msg;
119
        Helper::msg(error_msg);
124
        Helper::msg(error_msg);
120
        return false;
125
        return false;
121
    }
126
    }
122
}
127
}