Rev 1202 | Rev 1217 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1202 | Rev 1203 | ||
---|---|---|---|
Line 134... | Line 134... | ||
134 | }
|
134 | }
|
135 | void ResourceUnit::setBoundingBox(const QRectF &bb) |
135 | void ResourceUnit::setBoundingBox(const QRectF &bb) |
136 | {
|
136 | {
|
137 | mBoundingBox = bb; |
137 | mBoundingBox = bb; |
138 | mCornerOffset = GlobalSettings::instance()->model()->grid()->indexAt(bb.topLeft()); |
138 | mCornerOffset = GlobalSettings::instance()->model()->grid()->indexAt(bb.topLeft()); |
- | 139 | }
|
|
- | 140 | ||
- | 141 | /// return the sapling cell at given LIF-coordinates
|
|
- | 142 | SaplingCell *ResourceUnit::saplingCell(const QPoint &lifCoords) const |
|
- | 143 | {
|
|
- | 144 | // LIF-Coordinates are global, we here need (RU-)local coordinates
|
|
- | 145 | int ix = lifCoords.x() % cPxPerRU; |
|
- | 146 | int iy = lifCoords.y() % cPxPerRU; |
|
- | 147 | int i = iy*cPxPerRU+ix; |
|
- | 148 | Q_ASSERT(i>=0 && i<cPxPerHectare); |
|
- | 149 | return &mSaplings[i]; |
|
139 | }
|
150 | }
|
140 | 151 | ||
141 | /// set species and setup the species-per-RU-data
|
152 | /// set species and setup the species-per-RU-data
|
142 | void ResourceUnit::setSpeciesSet(SpeciesSet *set) |
153 | void ResourceUnit::setSpeciesSet(SpeciesSet *set) |
143 | {
|
154 | {
|