Subversion Repositories public iLand

Rev

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

Rev 452 Rev 453
Line 26... Line 26...
26
ResourceUnit::ResourceUnit(const int index)
26
ResourceUnit::ResourceUnit(const int index)
27
{
27
{
28
    mSpeciesSet = 0;
28
    mSpeciesSet = 0;
29
    mClimate = 0;
29
    mClimate = 0;
30
    mPixelCount=0;
30
    mPixelCount=0;
-
 
31
    mStockedArea = 0;
-
 
32
    mStockedPixelCount = 0;
31
    mIndex = index;
33
    mIndex = index;
32
    mSaplingHeightMap = 0;
34
    mSaplingHeightMap = 0;
33
    mWater = new WaterCycle();
35
    mWater = new WaterCycle();
34
36
35
    mTrees.reserve(100); // start with space for 100 trees.
37
    mTrees.reserve(100); // start with space for 100 trees.
Line 268... Line 270...
268
void ResourceUnit::setSaplingHeightAt(const QPoint &position, const float height)
270
void ResourceUnit::setSaplingHeightAt(const QPoint &position, const float height)
269
{
271
{
270
    Q_ASSERT(mSaplingHeightMap);
272
    Q_ASSERT(mSaplingHeightMap);
271
    int pixel_index = cPxPerRU*(position.x()-mCornerCoord.x())+(position.y()-mCornerCoord.y());
273
    int pixel_index = cPxPerRU*(position.x()-mCornerCoord.x())+(position.y()-mCornerCoord.y());
272
    if (pixel_index<0 || pixel_index>=cPxPerRU*cPxPerRU)
274
    if (pixel_index<0 || pixel_index>=cPxPerRU*cPxPerRU)
273
        qDebug() << "setSaplingHeightAt-Error";
-
 
-
 
275
        qDebug() << "setSaplingHeightAt-Error for position" << position << "for RU at" << boundingBox() << "with corner" << mCornerCoord;
274
    else
276
    else
275
        mSaplingHeightMap[pixel_index]=height;
277
        mSaplingHeightMap[pixel_index]=height;
276
}
278
}
277
279