FractalZoomWidget.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef FRACTALZOOMWIDGET_H
  2. #define FRACTALZOOMWIDGET_H
  3. #include "EscapeTimeVisualWidget.h"
  4. #include "FractalWidgetUtils.h"
  5. class FractalZoomWidget;
  6. ///
  7. /// \brief represents a grid of images at a certain depth
  8. /// in the fractal.
  9. ///
  10. class SliceGrid
  11. {
  12. public:
  13. FractalZoomWidget& owner;
  14. int level;
  15. mnd::Real dpp;
  16. std::unordered_map<std::pair<GridIndex, GridIndex>, std::unique_ptr<GridElement>, IndexPairHash> cells;
  17. public:
  18. SliceGrid(FractalZoomWidget& owner, int level);
  19. std::pair<GridIndex, GridIndex> getCellIndices(mnd::Real x, mnd::Real y);
  20. std::pair<mnd::Real, mnd::Real> getPositions(GridIndex i, GridIndex j);
  21. GridElement* getCell(GridIndex i, GridIndex j);
  22. void setCell(GridIndex i, GridIndex j, std::unique_ptr<GridElement> tex);
  23. inline size_t countAllocatedCells(void) const { return cells.size(); }
  24. void clearCells(void);
  25. void clearUncleanCells(void);
  26. };
  27. class FractalZoomWidget :
  28. public EscapeTimeVisualWidget
  29. {
  30. Q_OBJECT
  31. mnd::MandelGenerator* generator;
  32. public:
  33. static const int chunkSize = 256;
  34. FractalZoomWidget(QWidget* parent = nullptr);
  35. };
  36. #endif // FRACTALZOOMWIDGET_H