17#ifndef QGSCOORDINATEREFERENCESYSTEMMODEL_H
18#define QGSCOORDINATEREFERENCESYSTEMMODEL_H
25#include <QAbstractItemModel>
26#include <QSortFilterProxyModel>
30class QgsCoordinateReferenceSystemModelGroupNode;
41class GUI_EXPORT QgsCoordinateReferenceSystemModelNode
53 virtual ~QgsCoordinateReferenceSystemModelNode();
58 virtual NodeType nodeType()
const = 0;
63 QgsCoordinateReferenceSystemModelNode *parent() {
return mParent; }
68 QList<QgsCoordinateReferenceSystemModelNode *> children() {
return mChildren; }
73 QList<QgsCoordinateReferenceSystemModelNode *> children()
const {
return mChildren; }
79 QgsCoordinateReferenceSystemModelNode *takeChild( QgsCoordinateReferenceSystemModelNode *node );
85 void addChildNode( QgsCoordinateReferenceSystemModelNode *node );
90 void deleteChildren();
97 QgsCoordinateReferenceSystemModelGroupNode *getChildGroupNode(
const QString &
id );
101 QgsCoordinateReferenceSystemModelNode *mParent =
nullptr;
102 QList<QgsCoordinateReferenceSystemModelNode *> mChildren;
112class GUI_EXPORT QgsCoordinateReferenceSystemModelGroupNode :
public QgsCoordinateReferenceSystemModelNode
120 QgsCoordinateReferenceSystemModelGroupNode(
const QString &name,
const QIcon &icon,
const QString &
id );
125 QString id()
const {
return mId; }
130 QString name()
const {
return mName; }
135 QIcon icon()
const {
return mIcon; }
137 NodeType nodeType()
const override {
return NodeGroup; }
153class GUI_EXPORT QgsCoordinateReferenceSystemModelCrsNode :
public QgsCoordinateReferenceSystemModelNode
162 QgsCoordinateReferenceSystemModelCrsNode(
const QgsCrsDbRecord &record );
164 NodeType nodeType()
const override {
return NodeCrs; }
178 void setWkt(
const QString &wkt ) { mWkt = wkt; }
187 QString wkt()
const {
return mWkt; }
196 void setProj(
const QString &proj ) { mProj = proj; }
205 QString proj()
const {
return mProj; }
257 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
258 QVariant data(
const QModelIndex &index,
int role )
const override;
259 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
260 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
261 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
262 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
263 QModelIndex parent(
const QModelIndex &index )
const override;
278 QModelIndex authIdToIndex(
const QString &authId )
const;
283 void userCrsAdded(
const QString &
id );
284 void userCrsRemoved(
long id );
285 void userCrsChanged(
const QString &
id );
289 QgsCoordinateReferenceSystemModelCrsNode *addRecord(
const QgsCrsDbRecord &record );
291 QgsCoordinateReferenceSystemModelNode *index2node(
const QModelIndex &index )
const;
292 QModelIndex node2index( QgsCoordinateReferenceSystemModelNode *node )
const;
293 QModelIndex indexOfParentTreeNode( QgsCoordinateReferenceSystemModelNode *parentNode )
const;
296 std::unique_ptr< QgsCoordinateReferenceSystemModelGroupNode > mRootNode;
298 QList< QgsCrsDbRecord > mCrsDbRecords;
318 FilterHorizontal = 1 << 1,
319 FilterVertical = 1 << 2,
320 FilterCompound = 1 << 3,
359 void setFilterString(
const QString &filter );
374 void setFilterAuthIds(
const QSet< QString > &filter );
388 void setFilterDeprecated(
bool filter );
397 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
398 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
403 QString mFilterString;
404 QSet< QString > mFilterAuthIds;
405 bool mFilterDeprecated =
false;
406 Filters mFilters = Filters();
A tree model for display of known coordinate reference systems.
CustomRole
Custom model roles.
A sort/filter proxy model for coordinate reference systems.
bool filterDeprecated() const
Returns whether deprecated CRS will be filtered from the results.
QSet< QString > filterAuthIds() const
Returns the current filter list of auth ID strings, if set.
Filter
Available filter flags for filtering the model.
QString filterString() const
Returns the current filter string, if set.
This class represents a coordinate reference system (CRS).
#define SIP_ENUM_BASETYPE(type)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
const QgsCoordinateReferenceSystem & crs