Skip to content

Commit

Permalink
Merge pull request #7790 from m-kuhn/featureid
Browse files Browse the repository at this point in the history
 Move QgsFeatureId to own header
  • Loading branch information
m-kuhn committed Sep 4, 2018
2 parents 8af1c3f + b85f1ed commit ded7978
Show file tree
Hide file tree
Showing 49 changed files with 105 additions and 66 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsattributes.sip.in
Expand Up @@ -26,7 +26,7 @@ typedef QVector<QVariant> QgsAttributes;
%MappedType QgsAttributes
{
%TypeHeaderCode
#include <qgsfeature.h>
#include "qgsfeature.h"
%End

%ConvertFromTypeCode
Expand Down
5 changes: 0 additions & 5 deletions python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -14,8 +14,6 @@





class QgsFeature
{
%Docstring
Expand Down Expand Up @@ -527,9 +525,6 @@ typedef QMap<qint64, QMap<int, QVariant> > QgsChangedAttributesMap;

typedef QMap<qint64, QgsGeometry> QgsGeometryMap;


typedef QSet<qint64> QgsFeatureIds;

typedef QList<QgsFeature> QgsFeatureList;


Expand Down
21 changes: 21 additions & 0 deletions python/core/auto_generated/qgsfeatureid.sip.in
@@ -0,0 +1,21 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeatureid.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





typedef QSet<qint64> QgsFeatureIds;

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeatureid.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -44,6 +44,7 @@
%Include auto_generated/qgsexpressioncontextscopegenerator.sip
%Include auto_generated/qgsexpressionfieldbuffer.sip
%Include auto_generated/qgsfeaturefilterprovider.sip
%Include auto_generated/qgsfeatureid.sip
%Include auto_generated/qgsfeatureiterator.sip
%Include auto_generated/qgsfeaturerequest.sip
%Include auto_generated/qgsfeaturesink.sip
Expand Down
Expand Up @@ -9,7 +9,6 @@




class QgsIFeatureSelectionManager : QObject
{
%Docstring
Expand Down
1 change: 0 additions & 1 deletion src/analysis/network/qgsgraphbuilder.cpp
Expand Up @@ -21,7 +21,6 @@
#include "qgsgraphbuilder.h"
#include "qgsgraph.h"

#include "qgsfeature.h"
#include "qgsgeometry.h"

QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem &crs, bool otfEnabled, double topologyTolerance, const QString &ellipsoidID )
Expand Down
3 changes: 1 addition & 2 deletions src/analysis/vector/geometry_checker/qgsgeometrychecker.h
Expand Up @@ -24,9 +24,8 @@
#include <QMutex>
#include <QStringList>
#include "qgis_analysis.h"
#include "qgsfeatureid.h"

typedef qint64 QgsFeatureId;
typedef QSet<QgsFeatureId> QgsFeatureIds;
struct QgsGeometryCheckerContext;
class QgsGeometryCheck;
class QgsGeometryCheckError;
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsattributerelationedit.h
Expand Up @@ -19,7 +19,6 @@
#include "ui_qgsattributerelationedit.h"

#include "qgseditorconfigwidget.h"
#include "qgsfeature.h"
#include "qgsvectordataprovider.h"
#include "qgshelp.h"
#include "qgis_app.h"
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsattributesforminitcode.h
Expand Up @@ -19,7 +19,6 @@
#include "ui_qgsattributesforminitcode.h"

#include "qgseditorconfigwidget.h"
#include "qgsfeature.h"
#include "qgsvectordataprovider.h"
#include "qgshelp.h"
#include "qgis_app.h"
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptooldigitizefeature.h
Expand Up @@ -19,6 +19,8 @@
#include "qgsmaptoolcapture.h"
#include "qgis_app.h"

class QgsFeature;

//! This tool digitizes geometry of new point/line/polygon features on already existing vector layers
class APP_EXPORT QgsMapToolDigitizeFeature : public QgsMapToolCapture
{
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptooloffsetcurve.h
Expand Up @@ -26,6 +26,7 @@ class QGridLayout;
class QgsSnapIndicator;
class QgsDoubleSpinBox;
class QGraphicsProxyWidget;
class QgsFeature;

class APP_EXPORT QgsOffsetUserWidget : public QWidget, private Ui::QgsOffsetUserInputBase
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolshowhidelabels.h
Expand Up @@ -19,7 +19,7 @@
#define QGSMAPTOOLSHOWHIDELABELS_H

#include "qgsmaptoollabel.h"
#include "qgsfeature.h"
#include "qgsfeatureid.h"
#include "qgis_app.h"


Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsmaptoolsimplify.h
Expand Up @@ -20,9 +20,10 @@
#include "ui_qgssimplifytolerancedialog.h"

#include <QVector>
#include "qgsfeature.h"
#include "qgstolerance.h"
#include "qgsgeometry.h"
#include "qgis_app.h"
#include "qgsfeature.h"

class QgsRubberBand;
class QgsMapToolSimplify;
Expand Down
2 changes: 1 addition & 1 deletion src/app/vertextool/qgsselectedfeature.h
Expand Up @@ -16,8 +16,8 @@
#ifndef QGSSELECTEDFEATURE_H
#define QGSSELECTEDFEATURE_H

#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgsfeatureid.h"

#include <QObject>

Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -851,6 +851,7 @@ SET(QGIS_CORE_HDRS
qgsexpressioncontextscopegenerator.h
qgsexpressionfieldbuffer.h
qgsfeaturefilterprovider.h
qgsfeatureid.h
qgsfeatureiterator.h
qgsfeaturerequest.h
qgsfeaturesink.h
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometry.h
Expand Up @@ -29,9 +29,9 @@ email : morb at ozemail dot com dot au
#include "qgis.h"

#include "qgsabstractgeometry.h"
#include "qgsfeature.h"
#include "qgspointxy.h"
#include "qgspoint.h"
#include "qgsfeatureid.h"


class QgsGeometryEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometryeditutils.h
Expand Up @@ -23,8 +23,8 @@ class QgsVectorLayer;

#define SIP_NO_FILE

#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgsfeatureid.h"
#include <QMap>
#include <memory>

Expand Down
1 change: 0 additions & 1 deletion src/core/layout/qgslayoutrendercontext.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgslayoutrendercontext.h"
#include "qgsfeature.h"
#include "qgslayout.h"

QgsLayoutRenderContext::QgsLayoutRenderContext( QgsLayout *layout )
Expand Down
4 changes: 3 additions & 1 deletion src/core/mesh/qgstriangularmesh.cpp
Expand Up @@ -17,12 +17,14 @@

#include <memory>
#include <QList>
#include "qgsfeature.h"
#include "qgspolygon.h"
#include "qgslinestring.h"
#include "qgstriangularmesh.h"
#include "qgsrendercontext.h"
#include "qgscoordinatetransform.h"
#include "qgsfeatureid.h"
#include "qgsgeometry.h"
#include "qgsrectangle.h"

static void ENP_centroid_step( const QPolygonF &pX, double &cx, double &cy, double &signedArea, int i, int i1 )
{
Expand Down
1 change: 1 addition & 0 deletions src/core/mesh/qgstriangularmesh.h
Expand Up @@ -25,6 +25,7 @@
#include "qgis_core.h"
#include "qgsmeshdataprovider.h"
#include "qgsgeometry.h"
#include "qgsfeatureid.h"
#include "qgsspatialindex.h"

class QgsRenderContext;
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsattributes.h
Expand Up @@ -33,7 +33,6 @@
#include "qgsfields.h"


class QgsGeometry;
class QgsRectangle;
class QgsFeature;
class QgsFeaturePrivate;
Expand Down Expand Up @@ -130,7 +129,7 @@ typedef QVector<QVariant> QgsAttributes;
% MappedType QgsAttributes
{
% TypeHeaderCode
#include <qgsfeature.h>
#include "qgsfeature.h"
% End

% ConvertFromTypeCode
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscacheindex.h
Expand Up @@ -17,7 +17,7 @@
#define QGSCACHEINDEX_H

#include "qgis_core.h"
#include "qgsfeature.h" // QgsFeatureIds
#include "qgsfeatureid.h"

class QgsFeatureRequest;
class QgsFeatureIterator;
Expand Down
17 changes: 1 addition & 16 deletions src/core/qgsfeature.h
Expand Up @@ -29,6 +29,7 @@ email : sherman at mrcc.com

#include "qgsattributes.h"
#include "qgsfields.h"
#include "qgsfeatureid.h"

class QgsFeature;
class QgsFeaturePrivate;
Expand All @@ -43,15 +44,6 @@ class QgsRectangle;
* See details in QEP #17
****************************************************************************/

// feature id class (currently 64 bit)

// 64 bit feature ids
typedef qint64 QgsFeatureId SIP_SKIP;
#define FID_IS_NEW(fid) (fid<0)
#define FID_TO_NUMBER(fid) static_cast<qint64>(fid)
#define FID_TO_STRING(fid) QString::number( fid )
#define STRING_TO_FID(str) (str).toLongLong()


/**
* \ingroup core
Expand Down Expand Up @@ -540,13 +532,6 @@ typedef QMap<QgsFeatureId, QgsGeometry> QgsGeometryMap;
typedef QMap<qint64, QgsGeometry> QgsGeometryMap;
#endif


#ifndef SIP_RUN
typedef QSet<QgsFeatureId> QgsFeatureIds;
#else
typedef QSet<qint64> QgsFeatureIds;
#endif

typedef QList<QgsFeature> QgsFeatureList;

uint qHash( const QgsFeature &key, uint seed = 0 ) SIP_SKIP;
Expand Down
37 changes: 37 additions & 0 deletions src/core/qgsfeatureid.h
@@ -0,0 +1,37 @@
/***************************************************************************
qgsfeatureid.h
--------------------------------------
Date : 3.9.2018
Copyright : (C) 2018 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSFEATUREID_H
#define QGSFEATUREID_H

#include <QSet>
#include "qgis_sip.h"

// feature id (currently 64 bit)

// 64 bit feature ids
typedef qint64 QgsFeatureId SIP_SKIP;
#define FID_IS_NEW(fid) (fid<0)
#define FID_TO_NUMBER(fid) static_cast<qint64>(fid)
#define FID_TO_STRING(fid) QString::number( fid )
#define STRING_TO_FID(str) (str).toLongLong()

#ifndef SIP_RUN
typedef QSet<QgsFeatureId> QgsFeatureIds;
#else
typedef QSet<qint64> QgsFeatureIds;
#endif

#endif
4 changes: 3 additions & 1 deletion src/core/qgspointlocator.h
Expand Up @@ -20,12 +20,14 @@ class QgsPointXY;
class QgsVectorLayer;
class QgsFeatureRenderer;
class QgsRenderContext;
class QgsRectangle;

#include "qgis_core.h"
#include "qgsfeature.h"
#include "qgspointxy.h"
#include "qgscoordinatereferencesystem.h"
#include "qgscoordinatetransform.h"
#include "qgsfeatureid.h"
#include "qgsgeometry.h"
#include <memory>

class QgsPointLocator_VisitorNearestVertex;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgspropertytransformer.cpp
Expand Up @@ -18,9 +18,9 @@
#include "qgslogger.h"
#include "qgsexpression.h"
#include "qgsexpressionnodeimpl.h"
#include "qgsfeature.h"
#include "qgssymbollayerutils.h"
#include "qgscolorramp.h"
#include "qgspointxy.h"


//
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsspatialindexkdbush.h
Expand Up @@ -18,16 +18,15 @@
#ifndef QGSSPATIALINDEXKDBUSH_H
#define QGSSPATIALINDEXKDBUSH_H

class QgsPointXY;
class QgsFeatureIterator;
class QgsFeedback;
class QgsFeatureSource;
class QgsSpatialIndexKDBushPrivate;
class QgsRectangle;

#include "qgis_core.h"
#include "qgsfeature.h"
#include "qgsspatialindexkdbushdata.h"
#include "qgspointxy.h"
#include <memory>
#include <QList>

Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsspatialindexkdbushdata.h
Expand Up @@ -18,7 +18,8 @@
#ifndef QGSSPATIALINDEXKDBUSHDATA_H
#define QGSSPATIALINDEXKDBUSHDATA_H

#include "qgsfeature.h"
#include "qgsfeatureid.h"
#include "qgspointxy.h"

/**
* \class QgsSpatialIndexKDBushData
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgstracer.h
Expand Up @@ -23,9 +23,10 @@ class QgsVectorLayer;
#include <QVector>
#include <memory>

#include "qgsfeatureid.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsfeature.h"
#include "qgsrectangle.h"
#include "qgsgeometry.h"

struct QgsTracerGraph;

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditutils.h
Expand Up @@ -18,9 +18,9 @@

#include "qgis_core.h"
#include "qgis.h"
#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgsvectorlayer.h"
#include "qgsfeatureid.h"

class QgsCurve;

Expand Down

0 comments on commit ded7978

Please sign in to comment.