17#ifndef QGSCOORDINATEREFERENCESYSTEMMODEL_H
18#define QGSCOORDINATEREFERENCESYSTEMMODEL_H
25#include <QAbstractItemModel>
26#include <QSortFilterProxyModel>
30class QgsCoordinateReferenceSystemModelGroupNode;
41class GUI_EXPORT QgsCoordinateReferenceSystemModelNode
51 virtual ~QgsCoordinateReferenceSystemModelNode();
56 virtual NodeType nodeType()
const = 0;
61 QgsCoordinateReferenceSystemModelNode *parent() {
return mParent; }
66 QList<QgsCoordinateReferenceSystemModelNode *> children() {
return mChildren; }
71 QList<QgsCoordinateReferenceSystemModelNode *> children()
const {
return mChildren; }
77 QgsCoordinateReferenceSystemModelNode *takeChild( QgsCoordinateReferenceSystemModelNode *node );
83 void addChildNode( QgsCoordinateReferenceSystemModelNode *node );
88 void deleteChildren();
95 QgsCoordinateReferenceSystemModelGroupNode *getChildGroupNode(
const QString &
id );
98 QgsCoordinateReferenceSystemModelNode *mParent =
nullptr;
99 QList<QgsCoordinateReferenceSystemModelNode *> mChildren;
108class GUI_EXPORT QgsCoordinateReferenceSystemModelGroupNode :
public QgsCoordinateReferenceSystemModelNode
114 QgsCoordinateReferenceSystemModelGroupNode(
const QString &name,
const QIcon &icon,
const QString &
id );
119 QString id()
const {
return mId; }
124 QString name()
const {
return mName; }
129 QIcon icon()
const {
return mIcon; }
131 NodeType nodeType()
const override {
return NodeGroup; }
145class GUI_EXPORT QgsCoordinateReferenceSystemModelCrsNode :
public QgsCoordinateReferenceSystemModelNode
152 QgsCoordinateReferenceSystemModelCrsNode(
const QgsCrsDbRecord &record );
154 NodeType nodeType()
const override {
return NodeCrs; }
168 void setWkt(
const QString &wkt ) { mWkt = wkt; }
177 QString wkt()
const {
return mWkt; }
186 void setProj(
const QString &proj ) { mProj = proj; }
195 QString proj()
const {
return mProj; }
203 void setGroup(
const QString &group ) { mGroup = group; }
211 QString group()
const {
return mGroup; }
219 void setProjection(
const QString &projection ) { mProjection = projection; }
227 QString projection()
const {
return mProjection; }
269 Group = Qt::UserRole + 8,
270 Projection = Qt::UserRole + 9,
280 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
281 QVariant data(
const QModelIndex &index,
int role )
const override;
282 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
283 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
284 int columnCount(
const QModelIndex & = QModelIndex() )
const override;
285 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
286 QModelIndex parent(
const QModelIndex &index )
const override;
301 QModelIndex authIdToIndex(
const QString &authId )
const;
306 void userCrsAdded(
const QString &
id );
307 void userCrsRemoved(
long id );
308 void userCrsChanged(
const QString &
id );
311 QgsCoordinateReferenceSystemModelCrsNode *addRecord(
const QgsCrsDbRecord &record );
313 QgsCoordinateReferenceSystemModelNode *index2node(
const QModelIndex &index )
const;
314 QModelIndex node2index( QgsCoordinateReferenceSystemModelNode *node )
const;
315 QModelIndex indexOfParentTreeNode( QgsCoordinateReferenceSystemModelNode *parentNode )
const;
318 std::unique_ptr<QgsCoordinateReferenceSystemModelGroupNode> mRootNode;
320 QList<QgsCrsDbRecord> mCrsDbRecords;
338 FilterHorizontal = 1 << 1,
339 FilterVertical = 1 << 2,
340 FilterCompound = 1 << 3,
379 void setFilterString(
const QString &filter );
394 void setFilterAuthIds(
const QSet<QString> &filter );
408 void setFilterDeprecated(
bool filter );
417 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
418 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
422 QString mFilterString;
423 QSet<QString> mFilterAuthIds;
424 bool mFilterDeprecated =
false;
425 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