diff options
Diffstat (limited to 'gui/fpgaviewwidget.h')
-rw-r--r-- | gui/fpgaviewwidget.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 46231b16..c1165ef3 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -33,6 +33,7 @@ #include <QWaitCondition> #include "nextpnr.h" +#include "quadtree.h" NEXTPNR_NAMESPACE_BEGIN @@ -290,6 +291,9 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions void zoomSelected(); void zoomOutbound(); + Q_SIGNALS: + void clickedBel(BelId bel); + private: void renderLines(void); void zoom(int level); @@ -300,6 +304,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions float zoom_; QMatrix4x4 getProjection(void); QVector4D mouseToWorldCoordinates(int x, int y); + QVector4D mouseToWorldDimensions(int x, int y); const float zoomNear_ = 1.0f; // do not zoom closer than this const float zoomFar_ = 10000.0f; // do not zoom further than this @@ -312,6 +317,21 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions std::unique_ptr<PeriodicRunner> renderRunner_; + using QuadTreeBels = QuadTree<float, BelId>; + + template <typename T> + void commitToQuadtree(T *tree, const DecalXY &decal, BelId bel) + { + float offsetX = decal.x; + float offsetY = decal.y; + + for (auto &el : ctx_->getDecalGraphics(decal.decal)) { + if (el.type == GraphicElement::G_BOX) { + tree->insert(typename T::BoundingBox(offsetX + el.x1, offsetY + el.y1, offsetX + el.x2, offsetY + el.y2), bel); + } + } + } + struct { QColor background; @@ -329,6 +349,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions LineShaderData decals[4]; LineShaderData selected; LineShaderData highlighted[8]; + std::unique_ptr<QuadTreeBels> qtBels; }; struct RendererArgs |