Rev 1190 | Rev 1217 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1190 | Rev 1203 | ||
---|---|---|---|
Line 188... | Line 188... | ||
188 | delete mRandom; |
188 | delete mRandom; |
189 | mRandom=new RandomCustomPDF(density_func); |
189 | mRandom=new RandomCustomPDF(density_func); |
190 | if (logLevelInfo()) qDebug() << "new probabilty density function:" << density_func; |
190 | if (logLevelInfo()) qDebug() << "new probabilty density function:" << density_func; |
191 | }
|
191 | }
|
192 | 192 | ||
193 | if (mStandInitItems.isEmpty()) |
193 | if (mStandInitItems.isEmpty()) { |
- | 194 | qDebug() << "Initialize trees ('standgrid'-mode): no items to process (empty landscape)."; |
|
- | 195 | return; |
|
194 |
|
196 | //throw IException("StandLoader::processInit: 'mode' is 'standgrid' but the init file is either empty or contains no 'stand_id'-column.");
|
- | 197 | }
|
|
195 | QHash<int, QVector<InitFileItem> >::const_iterator it = mStandInitItems.constBegin(); |
198 | QHash<int, QVector<InitFileItem> >::const_iterator it = mStandInitItems.constBegin(); |
196 | while (it!=mStandInitItems.constEnd()) { |
199 | while (it!=mStandInitItems.constEnd()) { |
197 | mInitItems = it.value(); // copy the items... |
200 | mInitItems = it.value(); // copy the items... |
198 | executeiLandInitStand(it.key()); |
201 | executeiLandInitStand(it.key()); |
199 | ++it; |
202 | ++it; |
Line 897... | Line 900... | ||
897 | int misses = 0; |
900 | int misses = 0; |
898 | int hits = 0; |
901 | int hits = 0; |
899 | while (hits < pxcount) { |
902 | while (hits < pxcount) { |
900 | int rnd_index = irandom(0, indices.count()); |
903 | int rnd_index = irandom(0, indices.count()); |
901 | QPoint offset=stand_grid->grid().indexOf(indices[rnd_index]); |
904 | QPoint offset=stand_grid->grid().indexOf(indices[rnd_index]); |
902 | ResourceUnit *ru = GlobalSettings::instance()->model()->ru(stand_grid->grid().cellCenterPoint(offset)); |
- | |
903 | //
|
905 | //
|
904 | offset = offset * cPxPerHeight; // index of 10m patch -> to lif pixel coordinates |
906 | offset = offset * cPxPerHeight; // index of 10m patch -> to lif pixel coordinates |
905 | int in_p = irandom(0, cPxPerHeight*cPxPerHeight); // index of lif-pixel |
907 | int in_p = irandom(0, cPxPerHeight*cPxPerHeight); // index of lif-pixel |
906 | offset += QPoint(in_p / cPxPerHeight, in_p % cPxPerHeight); |
908 | offset += QPoint(in_p / cPxPerHeight, in_p % cPxPerHeight); |
907 | SaplingCell *sc = GlobalSettings::instance()->model()->saplings()->cell(offset); |
909 | SaplingCell *sc = GlobalSettings::instance()->model()->saplings()->cell(offset); |