Subversion Repositories public iLand

Rev

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

Rev 1107 Rev 1118
Line 121... Line 121...
121
121
122
}
122
}
123
void ResourceUnit::setBoundingBox(const QRectF &bb)
123
void ResourceUnit::setBoundingBox(const QRectF &bb)
124
{
124
{
125
    mBoundingBox = bb;
125
    mBoundingBox = bb;
126
    mCornerCoord = GlobalSettings::instance()->model()->grid()->indexAt(bb.topLeft());
-
 
-
 
126
    mCornerOffset = GlobalSettings::instance()->model()->grid()->indexAt(bb.topLeft());
127
}
127
}
128
128
129
/// set species and setup the species-per-RU-data
129
/// set species and setup the species-per-RU-data
130
void ResourceUnit::setSpeciesSet(SpeciesSet *set)
130
void ResourceUnit::setSpeciesSet(SpeciesSet *set)
131
{
131
{
Line 441... Line 441...
441
}
441
}
442
442
443
void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height)
443
void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height)
444
{
444
{
445
    Q_ASSERT(mSaplingHeightMap);
445
    Q_ASSERT(mSaplingHeightMap);
446
    int pixel_index = cPxPerRU*(position.x()-mCornerCoord.x())+(position.y()-mCornerCoord.y());
-
 
-
 
446
    int pixel_index = cPxPerRU*(position.x()-mCornerOffset.x())+(position.y()-mCornerOffset.y());
447
    if (pixel_index<0 || pixel_index>=cPxPerRU*cPxPerRU) {
447
    if (pixel_index<0 || pixel_index>=cPxPerRU*cPxPerRU) {
448
        qDebug() << "setSaplingHeightAt-Error for position" << position << "for RU at" << boundingBox() << "with corner" << mCornerCoord;
-
 
-
 
448
        qDebug() << "setSaplingHeightAt-Error for position" << position << "for RU at" << boundingBox() << "with corner" << mCornerOffset;
449
    } else {
449
    } else {
450
        if (mSaplingHeightMap[pixel_index]<height)
450
        if (mSaplingHeightMap[pixel_index]<height)
451
            mSaplingHeightMap[pixel_index]=height;
451
            mSaplingHeightMap[pixel_index]=height;
452
    }
452
    }
453
}
453
}