qHexWalker 0.0.1
Hexagonal Grid Pathfinding & Maze Visualization on Interactive Maps
Loading...
Searching...
No Matches
H3TargetsModel Class Referencefinal

#include <h3TargetsModel.h>

+ Inheritance diagram for H3TargetsModel:
+ Collaboration diagram for H3TargetsModel:

Public Types

enum  Roles {
  ResRole = Qt::UserRole + 1 , ZoomRole , OrderRole , IndexRole ,
  CellColor , PathRole , CoordinatesRole
}
 

Public Member Functions

 H3TargetsModel (QObject *parent=nullptr)
 
 ~H3TargetsModel () override
 
int rowCount (const QModelIndex &parent) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
QHash< int, QByteArray > roleNames () const override
 
void compute ()
 
void move (int from, int to)
 
qsizetype remove (int row)
 
void requestCell (quint8 mapZoom, const QGeoCoordinate &coordinate)
 
void clearAllCells ()
 
void setMazeWalls (const std::unordered_set< H3Index > &walls)
 
void setMazeBounds (const QGeoCoordinate &center, double radiusMeters)
 
public::void onRemoveCell (const std::vector< H3Index > &indexes)
 
void onCompute (const std::vector< H3Index > &indexes)
 
void clearingStarted ()
 
void clearingFinished ()
 
void showNotification (const QString &message, const QString &type)
 

Private Member Functions

bool isCoordinateTargetValid (quint8 zoom, const QGeoCoordinate &coordinate) const
 

Private Attributes

QList< H3Target * > cells_
 
std::unordered_set< H3Index > mazeWalls_
 
QGeoCoordinate mazeCenter_
 
double mazeRadius_ {0.0}
 
const uint8_t minZoom_c {3}
 
const uint8_t maxZoom_c {15}
 
std::unordered_map< uint8_t, uint8_t > zoomToRes_
 
const QHash< int, QString > resolutionColors_c
 
std::atomic_bool isClearing_ {false}
 

Detailed Description

Definition at line 9 of file h3TargetsModel.h.

Member Enumeration Documentation

◆ Roles

Enumerator
ResRole 
ZoomRole 
OrderRole 
IndexRole 
CellColor 
PathRole 
CoordinatesRole 

Definition at line 13 of file h3TargetsModel.h.

Constructor & Destructor Documentation

◆ H3TargetsModel()

H3TargetsModel::H3TargetsModel ( QObject *  parent = nullptr)
explicit

Definition at line 6 of file h3TargetsModel.cpp.

References maxZoom_c, minZoom_c, and zoomToRes_.

◆ ~H3TargetsModel()

H3TargetsModel::~H3TargetsModel ( )
override

Definition at line 15 of file h3TargetsModel.cpp.

References cells_.

Member Function Documentation

◆ clearAllCells()

void H3TargetsModel::clearAllCells ( )

Definition at line 209 of file h3TargetsModel.cpp.

References cells_, clearingFinished(), clearingStarted(), and isClearing_.

+ Here is the call graph for this function:

◆ clearingFinished()

void H3TargetsModel::clearingFinished ( )

Referenced by clearAllCells(), move(), and remove().

+ Here is the caller graph for this function:

◆ clearingStarted()

void H3TargetsModel::clearingStarted ( )

Referenced by clearAllCells(), move(), and remove().

+ Here is the caller graph for this function:

◆ compute()

void H3TargetsModel::compute ( )

Definition at line 63 of file h3TargetsModel.cpp.

References cells_, and onCompute().

Referenced by move(), and remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ data()

QVariant H3TargetsModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 25 of file h3TargetsModel.cpp.

References CellColor, cells_, CoordinatesRole, data(), IndexRole, OrderRole, PathRole, ResRole, and ZoomRole.

Referenced by data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCoordinateTargetValid()

bool H3TargetsModel::isCoordinateTargetValid ( quint8  zoom,
const QGeoCoordinate &  coordinate 
) const
private

Definition at line 235 of file h3TargetsModel.cpp.

References maxZoom_c.

Referenced by requestCell().

+ Here is the caller graph for this function:

◆ move()

void H3TargetsModel::move ( int  from,
int  to 
)

Definition at line 71 of file h3TargetsModel.cpp.

References cells_, clearingFinished(), clearingStarted(), compute(), isClearing_, and OrderRole.

+ Here is the call graph for this function:

◆ onCompute()

void H3TargetsModel::onCompute ( const std::vector< H3Index > &  indexes)

Referenced by compute(), and EntryPoint::InitDataModels().

+ Here is the caller graph for this function:

◆ onRemoveCell()

public::void H3TargetsModel::onRemoveCell ( const std::vector< H3Index > &  indexes)

Referenced by EntryPoint::InitDataModels(), and remove().

+ Here is the caller graph for this function:

◆ remove()

qsizetype H3TargetsModel::remove ( int  row)

Definition at line 103 of file h3TargetsModel.cpp.

References cells_, clearingFinished(), clearingStarted(), compute(), isClearing_, onRemoveCell(), and OrderRole.

+ Here is the call graph for this function:

◆ requestCell()

void H3TargetsModel::requestCell ( quint8  mapZoom,
const QGeoCoordinate &  coordinate 
)

Definition at line 143 of file h3TargetsModel.cpp.

References cells_, H3_VIEWER::Helper::indexToPolygon(), isClearing_, isCoordinateTargetValid(), mazeCenter_, mazeRadius_, mazeWalls_, showNotification(), and zoomToRes_.

+ Here is the call graph for this function:

◆ roleNames()

QHash< int, QByteArray > H3TargetsModel::roleNames ( ) const
override

Definition at line 51 of file h3TargetsModel.cpp.

References CellColor, CoordinatesRole, IndexRole, OrderRole, PathRole, ResRole, and ZoomRole.

◆ rowCount()

int H3TargetsModel::rowCount ( const QModelIndex &  parent) const
override

Definition at line 20 of file h3TargetsModel.cpp.

References cells_.

◆ setMazeBounds()

void H3TargetsModel::setMazeBounds ( const QGeoCoordinate &  center,
double  radiusMeters 
)

Definition at line 251 of file h3TargetsModel.cpp.

References mazeCenter_, and mazeRadius_.

Referenced by EntryPoint::InitDataModels().

+ Here is the caller graph for this function:

◆ setMazeWalls()

void H3TargetsModel::setMazeWalls ( const std::unordered_set< H3Index > &  walls)

Definition at line 246 of file h3TargetsModel.cpp.

References mazeWalls_.

Referenced by EntryPoint::InitDataModels().

+ Here is the caller graph for this function:

◆ showNotification()

void H3TargetsModel::showNotification ( const QString &  message,
const QString &  type 
)

Referenced by requestCell().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cells_

QList<H3Target *> H3TargetsModel::cells_
private

◆ isClearing_

std::atomic_bool H3TargetsModel::isClearing_ {false}
private

Definition at line 54 of file h3TargetsModel.h.

Referenced by clearAllCells(), move(), remove(), and requestCell().

◆ maxZoom_c

const uint8_t H3TargetsModel::maxZoom_c {15}
private

Definition at line 47 of file h3TargetsModel.h.

Referenced by H3TargetsModel(), and isCoordinateTargetValid().

◆ mazeCenter_

QGeoCoordinate H3TargetsModel::mazeCenter_
private

Definition at line 43 of file h3TargetsModel.h.

Referenced by requestCell(), and setMazeBounds().

◆ mazeRadius_

double H3TargetsModel::mazeRadius_ {0.0}
private

Definition at line 44 of file h3TargetsModel.h.

Referenced by requestCell(), and setMazeBounds().

◆ mazeWalls_

std::unordered_set<H3Index> H3TargetsModel::mazeWalls_
private

Definition at line 42 of file h3TargetsModel.h.

Referenced by requestCell(), and setMazeWalls().

◆ minZoom_c

const uint8_t H3TargetsModel::minZoom_c {3}
private

Definition at line 46 of file h3TargetsModel.h.

Referenced by H3TargetsModel().

◆ resolutionColors_c

const QHash<int, QString> H3TargetsModel::resolutionColors_c
private
Initial value:
= {
{3, "limegreen"}, {4, "green"}, {5, "darkGreen"}, {6, "gold"}, {7, "yellow"},
{8, "greenyellow"}, {9, "limegreen"}, {10, "mediumseagreen"}, {11, "turquoise"}, {12, "deepskyblue"},
{13, "dodgerblue"}, {14, "mediumblue"}, {15, "darkviolet"}}

Definition at line 49 of file h3TargetsModel.h.

◆ zoomToRes_

std::unordered_map<uint8_t, uint8_t> H3TargetsModel::zoomToRes_
private

Definition at line 48 of file h3TargetsModel.h.

Referenced by H3TargetsModel(), and requestCell().


The documentation for this class was generated from the following files: