| 78 | } |
| 79 | |
| 80 | void WSITileGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
| 81 | QWidget *widget){ |
| 82 | float lod = option->levelOfDetailFromTransform(painter->worldTransform()); |
| 83 | if (lod > _lowerLOD) { |
| 84 | if (_item) { |
| 85 | bool draw = false; |
| 86 | if (lod <= _upperLOD) { |
| 87 | draw = true; |
| 88 | } |
| 89 | else if (!_manager->isCovered(_itemLevel, _tileX, _tileY)) { |
| 90 | draw = true; |
| 91 | } |
| 92 | if (draw) { |
| 93 | QRectF pixmapArea = QRectF((option->exposedRect.left() + (_physicalSize / 2))*(_tileSize / _physicalSize), (option->exposedRect.top() + (_physicalSize / 2))*(_tileSize / _physicalSize), option->exposedRect.width()*(_tileSize / _physicalSize), option->exposedRect.height()*(_tileSize / _physicalSize)); |
| 94 | painter->drawPixmap(option->exposedRect, *_item, pixmapArea); |
| 95 | if (_foregroundPixmap && _renderForeground && _foregroundOpacity > 0.0001) { |
| 96 | painter->setOpacity(_foregroundOpacity); |
| 97 | painter->drawPixmap(option->exposedRect, *_foregroundPixmap, pixmapArea); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | void WSITileGraphicsItem::debugPrint() { |
| 105 | std::cout << "Position (x,y): (" << this->pos().x() << ", "<< this->pos().y() << ")" << std::endl; |