Index: python/core/conversions.sip =================================================================== --- python/core/conversions.sip (revision 9219) +++ python/core/conversions.sip (working copy) @@ -4,8 +4,9 @@ - QVector< QVector > - QVector< QVector< QVector > > - QSet +- QSet - QSet -- QMap > +- QMap > - QMap - QMap - QMultiMap @@ -221,7 +222,55 @@ }; +%MappedType QSet +{ +%TypeHeaderCode +#include +%End +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ((l = PyList_New(sipCpp->size())) == NULL) + return NULL; + + // Set the list elements. + QSet::iterator it = sipCpp->begin(); + for (int i = 0; it != sipCpp->end(); ++it, ++i) + { + PyObject *tobj; + + if ((tobj = PyLong_FromLongLong(*it)) == NULL) + { + Py_DECREF(l); + return NULL; + } + PyList_SET_ITEM(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + // Check the type if that is all that is required. + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + QSet *qset = new QSet; + + for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) + { + qset->insert(PyLong_AsLongLong(PyList_GET_ITEM(sipPy, i))); + } + + *sipCppPtr = qset; + return sipGetState(sipTransferObj); +%End + +}; + + template %MappedType QSet { @@ -289,15 +338,13 @@ *sipCppPtr = qset; return sipGetState(sipTransferObj); %End - }; - - template -%MappedType QMap > +%MappedType QMap > { %TypeHeaderCode +#include #include %End @@ -311,11 +358,11 @@ const sipMappedType* qmap2 = sipFindMappedType("QMap"); // Set the list elements. - for (QMap >::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it) + for (QMap >::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it) { QMap* t = new QMap(*it); - PyObject *kobj = PyInt_FromLong(it.key()); + PyObject *kobj = PyLong_FromLongLong(it.key()); PyObject *tobj = sipConvertFromMappedType(t, qmap2, sipTransferObj); if (kobj == NULL || tobj == NULL || PyDict_SetItem(d, kobj, tobj) < 0) @@ -372,13 +419,13 @@ return 1; } - QMap > *qm = new QMap >; + QMap > *qm = new QMap >; Py_ssize_t i = 0; while (PyDict_Next(sipPy, &i, &kobj, &tobj)) { - int k = PyInt_AsLong(kobj); + qint64 k = PyLong_AsLongLong(kobj); // using sipConvertToMappedType to convert directly to QMap doesn't work // and ends with a segfault @@ -409,7 +456,93 @@ *sipCppPtr = qm; return sipGetState(sipTransferObj); %End +}; +%MappedType QMap +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *d; + + if ((d = PyDict_New()) == NULL) + return NULL; + + // Set the list elements. + for (QMap::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it) + { + PyObject *kobj = PyLong_FromLongLong(it.key()); + PyObject *tobj = sipConvertFromInstance( &it.value(), sipClass_QgsGeometry, sipTransferObj); + + if (kobj == NULL || tobj == NULL || PyDict_SetItem(d, kobj, tobj) < 0) + { + Py_DECREF(d); + + if (kobj) + { + Py_DECREF(kobj); + } + + if (tobj) + { + Py_DECREF(tobj); + } + + return NULL; + } + + Py_DECREF(tobj); + } + + return d; +%End + +%ConvertToTypeCode + PyObject *kobj, *tobj; + + // Check the type if that is all that is required. + if (sipIsErr == NULL) + { + if (!PyDict_Check(sipPy)) + return 0; + + Py_ssize_t i = 0; + while (PyDict_Next(sipPy, &i, &kobj, &tobj)) + { + if (!PyDict_Check(tobj)) + return 0; + + if (!sipCanConvertToInstance(tobj, sipClass_QgsGeometry, SIP_NOT_NONE)) + return 0; + } + return 1; + } + + QMap *qm = new QMap; + + Py_ssize_t i = 0; + while (PyDict_Next(sipPy, &i, &kobj, &tobj)) + { + int state; + qint64 k = PyLong_AsLongLong(kobj); + QgsGeometry * fa = reinterpret_cast(sipConvertToInstance(tobj, sipClass_QgsGeometry, sipTransferObj,SIP_NOT_NONE,&state,sipIsErr)); + + if (*sipIsErr) + { + sipReleaseInstance(tobj, sipClass_QgsGeometry, state); + delete qm; + return 0; + } + + qm->insert(k, *fa); + } + + *sipCppPtr = qm; + return sipGetState(sipTransferObj); +%End }; %MappedType QMap @@ -736,4 +869,4 @@ return sipGetState(sipTransferObj); %End - }; +}; Index: python/core/qgsfeature.sip =================================================================== --- python/core/qgsfeature.sip (revision 9219) +++ python/core/qgsfeature.sip (working copy) @@ -11,7 +11,7 @@ typedef unsigned int size_t; //! Constructor - QgsFeature(int id = 0, QString typeName = "" ); + QgsFeature(qint64 id = 0, QString typeName = "" ); /** copy ctor needed due to internal pointer */ QgsFeature(const QgsFeature & rhs ); @@ -24,13 +24,13 @@ * Get the feature id for this feature * @return Feature id */ - int featureId() const; + qint64 featureId() const; /** * Set the feature id for this feature * @param id Feature id */ - void setFeatureId(int id); + void setFeatureId(qint64 id); /** returns the feature's type name Index: python/core/qgsvectorlayer.sip =================================================================== --- python/core/qgsvectorlayer.sip (revision 9219) +++ python/core/qgsvectorlayer.sip (working copy) @@ -74,10 +74,10 @@ QList selectedFeatures(); /** Return reference to identifiers of selected features */ - const QSet& selectedFeaturesIds() const; + const QSet& selectedFeaturesIds() const; /** Change selection to the new set of features */ - void setSelectedFeatures(const QSet& ids); + void setSelectedFeatures(const QSet& ids); /** Returns the bounding box of the selected features. If there is no selection, QgsRect(0,0,0,0) is returned */ QgsRect boundingBoxOfSelected(); @@ -165,18 +165,18 @@ * in the given ring, item (first number is index 0), and feature * Not meaningful for Point geometries */ - bool insertVertex(double x, double y, int atFeatureId, int beforeVertex); + bool insertVertex(double x, double y, qint64 atFeatureId, int beforeVertex); /** Moves the vertex at the given position number, * ring and item (first number is index 0), and feature * to the given coordinates */ - bool moveVertex(double x, double y, int atFeatureId, int atVertex); + bool moveVertex(double x, double y, qint64 atFeatureId, int atVertex); /** Deletes the vertex at the given position number, * ring and item (first number is index 0), and feature */ - bool deleteVertex(int atFeatureId, int atVertex); + bool deleteVertex(qint64 atFeatureId, int atVertex); /** Deletes the selected features * @return true in case of success and false otherwise @@ -209,7 +209,7 @@ @param dx translation of x-coordinate @param dy translation of y-coordinate @return 0 in case of success*/ - int translateFeature(int featureId, double dx, double dy); + int translateFeature(qint64 featureId, double dx, double dy); /**Splits features cut by the given line @param splitLine line that splits the layer features @@ -304,7 +304,7 @@ bool startEditing(); /** changed an attribute value (but does not commit it */ - bool changeAttributeValue(int fid, int field, QVariant value, bool emitSignal = true); + bool changeAttributeValue(qint64 fid, int field, QVariant value, bool emitSignal = true); /** add an attribute field (but does not commit it) returns the field index or -1 in case of failure */ @@ -355,7 +355,7 @@ public slots: /** Select feature by its ID, optionally emit signal selectionChanged() */ - void select(int featureId, bool emitSignal = TRUE); + void select(qint64 featureId, bool emitSignal = TRUE); /** Clear selection */ void removeSelection(bool emitSignal = TRUE); @@ -379,10 +379,10 @@ void editingStopped(); void attributeAdded(int idx); void attributeDeleted(int idx); - void featureDeleted(int fid); + void featureDeleted(qint64 fid); void layerDeleted(); - void attributeValueChanged(int fid, int idx, const QVariant &); + void attributeValueChanged(qint64 fid, int idx, const QVariant &); private: // Private methods Index: python/core/qgsvectordataprovider.sip =================================================================== --- python/core/qgsvectordataprovider.sip (revision 9219) +++ python/core/qgsvectordataprovider.sip (working copy) @@ -70,7 +70,7 @@ * @param fetchAttributes a list containing the indexes of the attribute fields to copy * @return True when feature was found, otherwise false */ - virtual bool getFeatureAtId(int featureId, + virtual bool getFeatureAtId(qint64 featureId, QgsFeature& feature, bool fetchGeometry = true, QList fetchAttributes = QList()); @@ -154,7 +154,7 @@ * @param id list containing feature ids to delete * @return true in case of success and false in case of failure */ - virtual bool deleteFeatures(const QSet & id); + virtual bool deleteFeatures(const QSet & id); /** * Adds new attributes @@ -175,7 +175,7 @@ * @param attr_map a map containing changed attributes * @return true in case of success and false in case of failure */ - virtual bool changeAttributeValues(const QMap > & attr_map); + virtual bool changeAttributeValues(const QMap > & attr_map); /** * Returns the default value for field specified by @c fieldId @@ -188,7 +188,7 @@ * the second map parameter being the new geometries themselves * @return true in case of success and false in case of failure */ - virtual bool changeGeometryValues(QMap & geometry_map); + virtual bool changeGeometryValues(QMap & geometry_map); /** * Creates a spatial index on the datasource (if supported by the provider type). Index: src/app/qgsidentifyresults.h =================================================================== --- src/app/qgsidentifyresults.h (revision 9219) +++ src/app/qgsidentifyresults.h (working copy) @@ -20,7 +20,10 @@ #define QGSIDENTIFYRESULTS_H #include "ui_qgsidentifyresultsbase.h" + #include "qgsattributeaction.h" +#include "qgsfeature.h" + #include #include #include @@ -55,10 +58,10 @@ void addDerivedAttribute( QTreeWidgetItem *parent, QString field, QString value ); /** Add an action to the feature display node */ - void addAction( QTreeWidgetItem *parent, int id, QString field, QString value ); + void addAction( QTreeWidgetItem *parent, QgsFeatureId id, QString field, QString value ); /** Add an edit action to the feature display node */ - void addEdit( QTreeWidgetItem *parent, int id ); + void addEdit( QTreeWidgetItem *parent, QgsFeatureId id ); /** Add a feature node to the feature display */ QTreeWidgetItem * addNode( QString label ); @@ -87,8 +90,8 @@ //void reject(); signals: - void selectedFeatureChanged( int featureId ); - void editFeature( int featureId ); + void selectedFeatureChanged( QgsFeatureId featureId ); + void editFeature( QgsFeatureId featureId ); public slots: Index: src/app/qgsattributetable.cpp =================================================================== --- src/app/qgsattributetable.cpp (revision 9219) +++ src/app/qgsattributetable.cpp (working copy) @@ -200,7 +200,7 @@ { for ( int index = range_it->topRow(); index <= range_it->bottomRow(); index++ ) { - emit selected( item( index, 0 )->text().toInt(), false ); + emit selected( item( index, 0 )->text().toLongLong(), false ); } } @@ -209,14 +209,14 @@ //todo: don't repaint in case of double clicks } -void QgsAttributeTable::insertFeatureId( int id, int row ) +void QgsAttributeTable::insertFeatureId( QgsFeatureId id, int row ) { rowIdMap.insert( id, row ); } -void QgsAttributeTable::selectRowWithId( int id ) +void QgsAttributeTable::selectRowWithId( QgsFeatureId id ) { - QMap < int, int >::iterator it = rowIdMap.find( id ); + QMap < QgsFeatureId, int >::iterator it = rowIdMap.find( id ); setRangeSelected( QTableWidgetSelectionRange( it.value(), 0, it.value(), columnCount() - 1 ), true ); } @@ -493,8 +493,8 @@ } //id-field - int id = fet.featureId(); - QTableWidgetItem *twi = new QTableWidgetItem( QString::number( id ) ); + QgsFeatureId id = fet.featureId(); + QTableWidgetItem *twi = new QTableWidgetItem( FID_TO_STRING( id ) ); twi->setTextAlignment( Qt::AlignRight | Qt::AlignVCenter ); setItem( row, 0, twi ); insertFeatureId( id, row ); //insert the id into the search tree of qgsattributetable @@ -692,7 +692,7 @@ } } -void QgsAttributeTable::attributeValueChanged( int fid, int idx, const QVariant &value ) +void QgsAttributeTable::attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value ) { if ( !rowIdMap.contains( fid ) ) return; @@ -727,7 +727,7 @@ item( rowIdMap[fid], mAttrIdxMap[idx] )->setText( v ); } -void QgsAttributeTable::featureDeleted( int fid ) +void QgsAttributeTable::featureDeleted( QgsFeatureId fid ) { if ( !rowIdMap.contains( fid ) ) return; @@ -736,7 +736,7 @@ removeRow( row ); - for ( QMap::iterator it = rowIdMap.begin(); it != rowIdMap.end(); it++ ) + for ( QMap::iterator it = rowIdMap.begin(); it != rowIdMap.end(); it++ ) if ( it.value() > row ) rowIdMap[ it.key()]--; } Index: src/app/qgsattributetable.h =================================================================== --- src/app/qgsattributetable.h (revision 9219) +++ src/app/qgsattributetable.h (working copy) @@ -66,9 +66,9 @@ /* Inserts the feature with the specified id into rowIdMap. This function has to be called (e.g. from QgsShapeFileLayer) when a row is inserted into the table */ - void insertFeatureId( int id, int row ); + void insertFeatureId( QgsFeatureId id, int row ); /**Selects the row which belongs to the feature with the specified id*/ - void selectRowWithId( int id ); + void selectRowWithId( QgsFeatureId id ); /**Sorts a column. If the first entry contains a letter, sort alphanumerically, otherwise numerically.*/ void sortColumn( int col, bool ascending ); /* Use this to give this class the current attribute actions, @@ -105,8 +105,8 @@ // Called when the user chooses an item on the popup menu void popupItemSelected( QAction * menuAction ); - void attributeValueChanged( int fid, int idx, const QVariant &value ); - void featureDeleted( int fid ); + void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value ); + void featureDeleted( QgsFeatureId fid ); protected slots: void handleChangedSelections(); @@ -115,7 +115,7 @@ /**Flag telling if the ctrl-button or the shift-button is pressed*/ bool lockKeyPressed; /**Search tree to find a row corresponding to a feature id*/ - QMap rowIdMap; + QMap rowIdMap; /**Map attribute index to columns*/ QMap mAttrIdxMap; bool mEditable; @@ -149,7 +149,7 @@ signals: /**Is emitted when a row was selected*/ - void selected( int, bool ); + void selected( QgsFeatureId, bool ); /**Is emitted when all rows have been deselected*/ void selectionRemoved( bool ); /**Is emitted when a set of related selection and deselection signals have been emitted*/ Index: src/app/qgsmaptoolmovefeature.h =================================================================== --- src/app/qgsmaptoolmovefeature.h (revision 9219) +++ src/app/qgsmaptoolmovefeature.h (working copy) @@ -43,7 +43,7 @@ QgsRubberBand* mRubberBand; /**Id of moved feature*/ - int mMovedFeature; + QgsFeatureId mMovedFeature; }; #endif Index: src/app/qgsdbsourceselect.cpp =================================================================== --- src/app/qgsdbsourceselect.cpp (revision 9219) +++ src/app/qgsdbsourceselect.cpp (working copy) @@ -414,7 +414,7 @@ { connect( mColumnTypeThread, SIGNAL( setLayerType( QString, QString, QString, QString ) ), this, SLOT( setLayerType( QString, QString, QString, QString ) ) ); - connect( this, SIGNAL( finished() ), + connect( this, SIGNAL( finished( int ) ), mColumnTypeThread, SLOT( stop() ) ); // Do it in a thread. Index: src/app/qgsmaptoolidentify.cpp =================================================================== --- src/app/qgsmaptoolidentify.cpp (revision 9219) +++ src/app/qgsmaptoolidentify.cpp (working copy) @@ -284,8 +284,8 @@ // Be informed when the dialog box is closed so that we can stop using it. connect( mResults, SIGNAL( accepted() ), this, SLOT( resultsDialogGone() ) ); connect( mResults, SIGNAL( rejected() ), this, SLOT( resultsDialogGone() ) ); - connect( mResults, SIGNAL( selectedFeatureChanged( int ) ), this, SLOT( highlightFeature( int ) ) ); - connect( mResults, SIGNAL( editFeature( int ) ), this, SLOT( editFeature( int ) ) ); + connect( mResults, SIGNAL( selectedFeatureChanged( QgsFeatureId ) ), this, SLOT( highlightFeature( QgsFeatureId ) ) ); + connect( mResults, SIGNAL( editFeature( QgsFeatureId ) ), this, SLOT( editFeature( QgsFeatureId ) ) ); // restore the identify window position and show it mResults->restorePosition(); @@ -299,7 +299,7 @@ QApplication::setOverrideCursor( Qt::WaitCursor ); - int lastFeatureId = 0; + QgsFeatureId lastFeatureId = 0; QgsFeatureList::iterator f_it = mFeatureList.begin(); for ( ; f_it != mFeatureList.end(); ++f_it ) @@ -431,7 +431,7 @@ QgsMapTool::deactivate(); } -void QgsMapToolIdentify::highlightFeature( int featureId ) +void QgsMapToolIdentify::highlightFeature( QgsFeatureId featureId ) { QgsVectorLayer* layer = dynamic_cast( mLayer ); if ( !layer ) @@ -462,7 +462,7 @@ } } -void QgsMapToolIdentify::editFeature( int featureId ) +void QgsMapToolIdentify::editFeature( QgsFeatureId featureId ) { for ( QgsFeatureList::iterator it = mFeatureList.begin(); it != mFeatureList.end(); it++ ) { Index: src/app/qgsidentifyresults.cpp =================================================================== --- src/app/qgsidentifyresults.cpp (revision 9219) +++ src/app/qgsidentifyresults.cpp (working copy) @@ -185,19 +185,19 @@ new QTreeWidgetItem( daRootNode, labels ); } -void QgsIdentifyResults::addEdit( QTreeWidgetItem * fnode, int id ) +void QgsIdentifyResults::addEdit( QTreeWidgetItem * fnode, QgsFeatureId id ) { QStringList labels; - labels << "edit" << QString::number( id ); + labels << "edit" << FID_TO_STRING( id ); QTreeWidgetItem *item = new QTreeWidgetItem( fnode, labels ); item->setIcon( 0, QgisApp::getThemeIcon( "/mIconEditable.png" ) ); } -void QgsIdentifyResults::addAction( QTreeWidgetItem * fnode, int id, QString field, QString value ) +void QgsIdentifyResults::addAction( QTreeWidgetItem * fnode, QgsFeatureId id, QString field, QString value ) { QStringList labels; - labels << field << value << "action" << QString::number( id ); + labels << field << value << "action" << FID_TO_STRING( id ); QTreeWidgetItem *item = new QTreeWidgetItem( fnode, labels ); item->setIcon( 0, QgisApp::getThemeIcon( "/mAction.png" ) ); Index: src/app/qgsattributetabledisplay.cpp =================================================================== --- src/app/qgsattributetabledisplay.cpp (revision 9219) +++ src/app/qgsattributetabledisplay.cpp (working copy) @@ -93,14 +93,14 @@ connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) ); connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) ); - connect( mLayer, SIGNAL( attributeValueChanged( int, int, const QVariant & ) ), - tblAttributes, SLOT( attributeValueChanged( int, int, const QVariant & ) ) ); + connect( mLayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ), + tblAttributes, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant & ) ) ); - connect( mLayer, SIGNAL( featureDeleted( int ) ), - tblAttributes, SLOT( featureDeleted( int ) ) ); + connect( mLayer, SIGNAL( featureDeleted( QgsFeatureId ) ), + tblAttributes, SLOT( featureDeleted( QgsFeatureId ) ) ); // etablish connections between table and vector layer - connect( tblAttributes, SIGNAL( selected( int, bool ) ), mLayer, SLOT( select( int, bool ) ) ); + connect( tblAttributes, SIGNAL( selected( QgsFeatureId, bool ) ), mLayer, SLOT( select( QgsFeatureId, bool ) ) ); connect( tblAttributes, SIGNAL( selectionRemoved( bool ) ), mLayer, SLOT( removeSelection( bool ) ) ); connect( tblAttributes, SIGNAL( repaintRequested() ), mLayer, SLOT( triggerRepaint() ) ); Index: src/app/qgsmaptoolidentify.h =================================================================== --- src/app/qgsmaptoolidentify.h (revision 9219) +++ src/app/qgsmaptoolidentify.h (working copy) @@ -60,10 +60,10 @@ public slots: //! creates rubberband on top of the feature to highlight it - void highlightFeature( int featureId ); + void highlightFeature( QgsFeatureId featureId ); //! edit a feature - void editFeature( int featureId ); + void editFeature( QgsFeatureId featureId ); private: Index: src/core/qgsfeature.cpp =================================================================== --- src/core/qgsfeature.cpp (revision 9219) +++ src/core/qgsfeature.cpp (working copy) @@ -22,7 +22,7 @@ * \brief Encapsulates a spatial feature with attributes */ -QgsFeature::QgsFeature( int id, QString typeName ) +QgsFeature::QgsFeature( QgsFeatureId id, QString typeName ) : mFid( id ), mGeometry( 0 ), mOwnsGeometry( 0 ), @@ -84,7 +84,7 @@ * Get the feature id for this feature * @return Feature id */ -int QgsFeature::featureId() const +QgsFeatureId QgsFeature::featureId() const { return mFid; } @@ -140,7 +140,7 @@ /** Set the feature id */ -void QgsFeature::setFeatureId( int id ) +void QgsFeature::setFeatureId( QgsFeatureId id ) { mFid = id; } Index: src/core/qgsvectorlayer.cpp =================================================================== --- src/core/qgsvectorlayer.cpp (revision 9219) +++ src/core/qgsvectorlayer.cpp (working copy) @@ -817,9 +817,9 @@ } } -void QgsVectorLayer::select( int number, bool emitSignal ) +void QgsVectorLayer::select( QgsFeatureId id, bool emitSignal ) { - mSelectedFeatureIds.insert( number ); + mSelectedFeatureIds.insert( id ); if ( emitSignal ) { @@ -1208,7 +1208,7 @@ // check if changed geometries are in rectangle for ( ; mFetchChangedGeomIt != mChangedGeometries.end(); mFetchChangedGeomIt++ ) { - int fid = mFetchChangedGeomIt.key(); + QgsFeatureId fid = mFetchChangedGeomIt.key(); if ( mFetchConsidered.contains( fid ) ) // skip deleted features @@ -1227,7 +1227,7 @@ if ( mFetchAttributes.size() > 0 ) { - if ( fid < 0 ) + if ( FID_IS_NEW( fid ) ) { // fid<0 => in mAddedFeatures bool found = false; @@ -1265,7 +1265,7 @@ for ( ; mFetchAddedFeaturesIt != mAddedFeatures.end(); mFetchAddedFeaturesIt++ ) { - int fid = mFetchAddedFeaturesIt->featureId(); + QgsFeatureId fid = mFetchAddedFeaturesIt->featureId(); if ( mFetchConsidered.contains( fid ) ) // must have changed geometry outside rectangle @@ -1311,7 +1311,7 @@ return false; } -int QgsVectorLayer::getFeatureAtId( int featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes ) +int QgsVectorLayer::getFeatureAtId( QgsFeatureId featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes ) { if ( !mDataProvider ) return 1; @@ -1326,7 +1326,7 @@ if ( fetchAttributes ) { - if ( featureId < 0 ) + if ( FID_IS_NEW( featureId ) ) { // featureId<0 => in mAddedFeatures bool found = false; @@ -1433,7 +1433,7 @@ } -bool QgsVectorLayer::insertVertex( double x, double y, int atFeatureId, int beforeVertex ) +bool QgsVectorLayer::insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex ) { if ( !mEditable ) { @@ -1463,7 +1463,7 @@ } -bool QgsVectorLayer::moveVertex( double x, double y, int atFeatureId, int atVertex ) +bool QgsVectorLayer::moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex ) { if ( !mEditable ) { @@ -1492,7 +1492,7 @@ } -bool QgsVectorLayer::deleteVertex( int atFeatureId, int atVertex ) +bool QgsVectorLayer::deleteVertex( QgsFeatureId atFeatureId, int atVertex ) { if ( !mEditable ) { @@ -1538,7 +1538,7 @@ while ( mSelectedFeatureIds.size() > 0 ) { - int fid = *mSelectedFeatureIds.begin(); + QgsFeatureId fid = *mSelectedFeatureIds.begin(); deleteFeature( fid ); // removes from selection } @@ -1598,7 +1598,7 @@ return 5; } - int selectedFeatureId = *mSelectedFeatureIds.constBegin(); + QgsFeatureId selectedFeatureId = *mSelectedFeatureIds.constBegin(); //look if geometry of selected feature already contains geometry changes QgsGeometryMap::iterator changedIt = mChangedGeometries.find( selectedFeatureId ); @@ -1632,7 +1632,7 @@ return 6; //geometry not found } -int QgsVectorLayer::translateFeature( int featureId, double dx, double dy ) +int QgsVectorLayer::translateFeature( QgsFeatureId featureId, double dx, double dy ) { //look if geometry of selected feature already contains geometry changes QgsGeometryMap::iterator changedIt = mChangedGeometries.find( featureId ); @@ -1715,7 +1715,7 @@ QgsFeature f; while ( getNextFeature( f ) ) - featureList << QgsFeature(f); + featureList << QgsFeature( f ); } QgsFeatureList::iterator select_it = featureList.begin(); @@ -2449,12 +2449,12 @@ return true; } // bool QgsVectorLayer::writeXml -bool QgsVectorLayer::changeAttributeValue( int fid, int field, QVariant value, bool emitSignal ) +bool QgsVectorLayer::changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal ) { if ( !isEditable() ) return false; - if ( fid >= 0 ) + if ( !FID_IS_NEW( fid ) ) { // changed attribute of existing feature if ( !mChangedAttributeValues.contains( fid ) ) @@ -2532,7 +2532,7 @@ return true; } -bool QgsVectorLayer::deleteFeature( int fid ) +bool QgsVectorLayer::deleteFeature( QgsFeatureId fid ) { if ( !isEditable() ) return false; @@ -3096,7 +3096,7 @@ return n == 0 ? 2 : 0; } -void QgsVectorLayer::snapToGeometry( const QgsPoint& startPoint, int featureId, QgsGeometry* geom, double sqrSnappingTolerance, +void QgsVectorLayer::snapToGeometry( const QgsPoint& startPoint, QgsFeatureId featureId, QgsGeometry* geom, double sqrSnappingTolerance, QMultiMap& snappingResults, QgsSnapper::SNAP_TO snap_to ) const { if ( !geom ) Index: src/core/qgsvectordataprovider.cpp =================================================================== --- src/core/qgsvectordataprovider.cpp (revision 9219) +++ src/core/qgsvectordataprovider.cpp (working copy) @@ -47,10 +47,11 @@ return -1; } -bool QgsVectorDataProvider::getFeatureAtId( int featureId, - QgsFeature& feature, - bool fetchGeometry, - QgsAttributeList fetchAttributes ) +bool QgsVectorDataProvider::getFeatureAtId( + QgsFeatureId featureId, + QgsFeature& feature, + bool fetchGeometry, + QgsAttributeList fetchAttributes ) { select( fetchAttributes, QgsRect(), fetchGeometry ); Index: src/core/qgsfeature.h =================================================================== --- src/core/qgsfeature.h (revision 9219) +++ src/core/qgsfeature.h (working copy) @@ -21,25 +21,75 @@ #include #include #include +#include class QgsGeometry; class QgsRect; class QgsFeature; -// key = field index, value = field value -typedef QMap QgsAttributeMap; +// feature id class (currently 64 bit) +#if 0 +#include -// key = feature id, value = changed attributes -typedef QMap QgsChangedAttributesMap; +class QgsFeatureId +{ + public: + QgsFeatureId( qint64 id = 0 ) : mId( id ) {} + QgsFeatureId &operator=( const QgsFeatureId &other ) { mId = other.mId; return *this; } -// key = feature id, value = changed geometry -typedef QMap QgsGeometryMap; + bool operator==( const QgsFeatureId &id ) const { return mId == id.mId; } + bool operator!=( const QgsFeatureId &id ) const { return mId != id.mId; } + bool operator<( const QgsFeatureId &id ) const { return mId < id.mId; } + bool operator>( const QgsFeatureId &id ) const { return mId > id.mId; } + operator QString() const { return QString::number( mId ); } -// key = field index, value = field name -typedef QMap QgsFieldNameMap; + bool isNew() const + { + return mId < 0; + } -typedef QList QgsFeatureList; + long toLong() const + { + Q_ASSERT( mId >= std::numeric_limits::min() && mId <= std::numeric_limits::max() ); + return static_cast( mId ); + } + private: + qint64 mId; + + friend uint qHash( const QgsFeatureId &id ); +}; + +inline uint qHash( const QgsFeatureId &id ) +{ + return qHash( id.mId ); +} + +#define FID_IS_NEW(fid) fid.isNew() +#define FID_TO_LONG(fid) fid.toLong() +#define FID_TO_STRING(fid) static_cast(fid) +#endif + +// 64 bit feature ids +#if 1 +typedef qint64 QgsFeatureId; +#define FID_IS_NEW(fid) (fid<0) +#define FID_TO_LONG(fid) static_cast(fid) +#define FID_TO_STRING(fid) QString::number( fid ) +#endif + +// 32 bit feature ids +#if 0 +typedef int QgsFeatureId; +#define FID_IS_NEW(fid) (fid<0) +#define FID_TO_LONG(fid) static_cast(fid) +#define FID_TO_STRING(fid) QString::number( fid ) +#endif + + +// key = field index, value = field value +typedef QMap QgsAttributeMap; + /** \ingroup core * The feature class encapsulates a single feature including its id, * geometry and a list of field/values attributes. @@ -49,8 +99,13 @@ class CORE_EXPORT QgsFeature { public: +#if 0 + typedef qint64 FeatureId; +#endif + + //! Constructor - QgsFeature( int id = 0, QString typeName = "" ); + QgsFeature( QgsFeatureId id = QgsFeatureId(), QString typeName = "" ); /** copy ctor needed due to internal pointer */ QgsFeature( QgsFeature const & rhs ); @@ -61,18 +116,17 @@ //! Destructor ~QgsFeature(); - /** * Get the feature id for this feature * @return Feature id */ - int featureId() const; + QgsFeatureId featureId() const; /** * Set the feature id for this feature * @param id Feature id */ - void setFeatureId( int id ); + void setFeatureId( QgsFeatureId id ); /** returns the feature's type name @@ -159,7 +213,7 @@ private: //! feature id - int mFid; + QgsFeatureId mFid; /** map of attributes accessed by field index */ QgsAttributeMap mAttributes; @@ -186,8 +240,19 @@ /// feature type name QString mTypeName; - }; // class QgsFeature +// key = feature id, value = changed attributes +typedef QMap QgsChangedAttributesMap; +// key = feature id, value = changed geometry +typedef QMap QgsGeometryMap; + +typedef QSet QgsFeatureIds; + +// key = field index, value = field name +typedef QMap QgsFieldNameMap; + +typedef QList QgsFeatureList; + #endif Index: src/core/qgsvectorlayer.h =================================================================== --- src/core/qgsvectorlayer.h (revision 9219) +++ src/core/qgsvectorlayer.h (working copy) @@ -48,7 +48,6 @@ class QgsRect; typedef QList QgsAttributeList; -typedef QSet QgsFeatureIds; typedef QSet QgsAttributeIds; /** \ingroup core @@ -210,7 +209,7 @@ /**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features @return 0 in case of success*/ - int getFeatureAtId( int featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true ); + int getFeatureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true ); /** Adds a feature @param lastFeatureInBatch If True, will also go to the effort of e.g. updating the extents. @@ -223,17 +222,17 @@ * in the given ring, item (first number is index 0), and feature * Not meaningful for Point geometries */ - bool insertVertex( double x, double y, int atFeatureId, int beforeVertex ); + bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex ); /** Moves the vertex at the given position number, * ring and item (first number is index 0), and feature * to the given coordinates */ - bool moveVertex( double x, double y, int atFeatureId, int atVertex ); + bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex ); /** Deletes a vertex from a feature */ - bool deleteVertex( int atFeatureId, int atVertex ); + bool deleteVertex( QgsFeatureId atFeatureId, int atVertex ); /** Deletes the selected features * @return true in case of success and false otherwise @@ -266,7 +265,7 @@ @param dx translation of x-coordinate @param dy translation of y-coordinate @return 0 in case of success*/ - int translateFeature( int featureId, double dx, double dy ); + int translateFeature( QgsFeatureId featureId, double dx, double dy ); /**Splits features cut by the given line @param splitLine line that splits the layer features @@ -327,11 +326,11 @@ @param snap_to to segment / to vertex @return 0 in case of success */ - int snapWithContext( const QgsPoint& startPoint, - double snappingTolerance, - QMultiMap& snappingResults, - QgsSnapper::SNAP_TO snap_to ); + int snapWithContext( const QgsPoint& startPoint, + double snappingTolerance, + QMultiMap < double, + QgsSnappingResult > & snappingResults, + QgsSnapper::SNAP_TO snap_to ); /** Draws the layer * @return FALSE if an error occurred during drawing @@ -344,10 +343,10 @@ /** \brief Draws the layer labels using coordinate transformation * \param scale size scale, applied to all values in pixels */ - void drawLabels( QPainter * p, const QgsRect& viewExtent, - const QgsMapToPixel* cXf, - const QgsCoordinateTransform* ct, - double scale ); + void drawLabels( QPainter * p, const QgsRect& viewExtent, + const QgsMapToPixel* cXf, + const QgsCoordinateTransform* ct, + double scale ); /** returns field list in the to-be-committed state */ const QgsFieldMap &pendingFields(); @@ -365,7 +364,7 @@ bool startEditing(); /** changed an attribute value (but does not commit it */ - bool changeAttributeValue( int fid, int field, QVariant value, bool emitSignal = true ); + bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal = true ); /** add an attribute field (but does not commit it) returns the field index or -1 in case of failure */ @@ -378,7 +377,7 @@ bool addFeatures( QgsFeatureList features, bool makeSelected = TRUE ); /** delete a feature from the layer (but does not commit it) */ - bool deleteFeature( int fid ); + bool deleteFeature( QgsFeatureId fid ); /** Attempts to commit any changes to disk. Returns the result of the attempt. @@ -415,7 +414,7 @@ public slots: /** Select feature by its ID, optionally emit signal selectionChanged() */ - void select( int featureId, bool emitSignal = TRUE ); + void select( QgsFeatureId featureId, bool emitSignal = TRUE ); /** Clear selection */ void removeSelection( bool emitSignal = TRUE ); @@ -439,10 +438,10 @@ void editingStopped(); void attributeAdded( int idx ); void attributeDeleted( int idx ); - void featureDeleted( int fid ); + void featureDeleted( QgsFeatureId fid ); void layerDeleted(); - void attributeValueChanged( int fid, int idx, const QVariant & ); + void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & ); private: // Private methods @@ -517,7 +516,7 @@ @param snappingResult list to which the result is appended @param snap_to snap to vertex or to segment */ - void snapToGeometry( const QgsPoint& startPoint, int featureId, QgsGeometry* geom, double sqrSnappingTolerance, + void snapToGeometry( const QgsPoint& startPoint, QgsFeatureId featureId, QgsGeometry* geom, double sqrSnappingTolerance, QMultiMap& snappingResults, QgsSnapper::SNAP_TO snap_to ) const; /**Little helper function that gives bounding box from a list of points. @@ -620,7 +619,7 @@ QgsAttributeList mFetchNullAttributes; bool mFetchGeometry; - QSet mFetchConsidered; + QSet mFetchConsidered; QgsGeometryMap::iterator mFetchChangedGeomIt; QgsFeatureList::iterator mFetchAddedFeaturesIt; }; Index: src/core/qgsvectordataprovider.h =================================================================== --- src/core/qgsvectordataprovider.h (revision 9219) +++ src/core/qgsvectordataprovider.h (working copy) @@ -35,7 +35,7 @@ /** \ingroup core * This is the base class for vector data providers. * - * Data providers abstract the retrieval and writing (where supported) + * Data providers abstract the retrieval and writing (where supported) * of feature and attrubute information from a spatial datasource. * * @@ -110,7 +110,7 @@ * Default implementation traverses all features until it finds the one with correct ID. * In case the provider supports reading the feature directly, override this function. */ - virtual bool getFeatureAtId( int featureId, + virtual bool getFeatureAtId( QgsFeatureId featureId, QgsFeature& feature, bool fetchGeometry = true, QgsAttributeList fetchAttributes = QgsAttributeList() ); @@ -227,7 +227,7 @@ /** * Changes geometries of existing features - * @param geometry_map A QgsGeometryMap whose index contains the feature IDs + * @param geometry_map A QgsGeometryMap whose index contains the feature IDs * that will have their geometries changed. * The second map parameter being the new geometries themselves * @return True in case of success and false in case of failure Index: src/core/spatialindex/qgsspatialindex.cpp =================================================================== --- src/core/spatialindex/qgsspatialindex.cpp (revision 9219) +++ src/core/spatialindex/qgsspatialindex.cpp (working copy) @@ -94,7 +94,7 @@ if ( !g ) return false; - id = f.featureId(); + id = FID_TO_LONG( f.featureId() ); r = rectToRegion( g->boundingBox() ); return true; } Index: src/core/qgssnapper.h =================================================================== --- src/core/qgssnapper.h (revision 9219) +++ src/core/qgssnapper.h (working copy) @@ -21,6 +21,7 @@ #include "qgspoint.h" #include #include +#include "qgsfeature.h" class QgsMapRenderer; class QgsVectorLayer; @@ -47,7 +48,7 @@ or -1 if no such vertex*/ int afterVertexNr; /**Index of the snapped geometry*/ - int snappedAtGeometry; + QgsFeatureId snappedAtGeometry; /**Layer where the snap occured*/ const QgsVectorLayer* layer; }; Index: src/providers/postgres/qgspostgresprovider.h =================================================================== --- src/providers/postgres/qgspostgresprovider.h (revision 9219) +++ src/providers/postgres/qgspostgresprovider.h (working copy) @@ -319,6 +319,8 @@ QgsFeature &feature, const QgsAttributeList &fetchAttributes ); + qint64 getBinaryInt( PGresult *queryResult, int row, int col ); + const QgsField &field( int index ) const; /** Double quote a PostgreSQL identifier for placement in a SQL string. Index: src/providers/postgres/qgspostgresprovider.cpp =================================================================== --- src/providers/postgres/qgspostgresprovider.cpp (revision 9219) +++ src/providers/postgres/qgspostgresprovider.cpp (working copy) @@ -227,6 +227,7 @@ //fill type names into sets mSupportedNativeTypes.insert( "double precision", QVariant::Double ); + mSupportedNativeTypes.insert( "int2", QVariant::Int ); mSupportedNativeTypes.insert( "int4", QVariant::Int ); mSupportedNativeTypes.insert( "int8", QVariant::LongLong ); mSupportedNativeTypes.insert( "text", QVariant::String ); @@ -443,16 +444,54 @@ } } +qint64 QgsPostgresProvider::getBinaryInt( PGresult *queryResult, int row, int col ) +{ + qint64 oid; + void *p = PQgetvalue( queryResult, row, col ); + + size_t s = PQgetlength( queryResult, row, col ); + switch ( s ) + { + case 2: + oid = *( qint16 * )p; + if ( swapEndian ) + oid = ntohs( oid ); + break; + + + case 8: + if ( swapEndian ) + { + qint64 oid0 = htonl( *( qint32 * )p ); + qint64 oid1 = htonl( *(( qint32 * )p + 1 ) ); + oid = ( oid0 << 32 ) + oid1; + } + else + { + oid = *( qint64 * )p; + } + break; + + default: + QgsDebugMsg( QString( "unexpected size %d" ).arg( s ) ); + + case 4: + oid = *( qint32 * )p; + if ( swapEndian ) + oid = ntohl( oid ); + break; + } + + return oid; +} + bool QgsPostgresProvider::getFeature( PGresult *queryResult, int row, bool fetchGeometry, QgsFeature &feature, const QgsAttributeList &fetchAttributes ) { try { - int oid = *( int * )PQgetvalue( queryResult, row, 0 ); - if ( swapEndian ) - oid = ntohl( oid ); // convert oid to opposite endian - + QgsFeatureId oid = getBinaryInt( queryResult, row, 0 ); feature.setFeatureId( oid ); int col; // first attribute column after geometry @@ -909,14 +948,14 @@ // oid isn't indexed (and that they may want to add a // primary key to the table) primaryKey = "oid"; - primaryKeyType = "int4"; + primaryKeyType = "int8"; } else { showMessageBox( tr( "No suitable key column in table" ), tr( "The table has no column suitable for use as a key.\n\n" "Qgis requires that the table either has a column of type\n" - "int4 with a unique constraint on it (which includes the\n" + "int with a unique constraint on it (which includes the\n" "primary key) or has a PostgreSQL oid column.\n" ) ); } } @@ -955,11 +994,11 @@ QString columnName = QString::fromUtf8( PQgetvalue( types, 0, 0 ) ); QString columnType = QString::fromUtf8( PQgetvalue( types, 0, 1 ) ); - if ( columnType != "int4" ) + if ( columnType != "int2" && columnType != "int4" && columnType != "int8" ) log.append( tr( "The unique index on column" ) + " '" + columnName + "' " + tr( "is unsuitable because Qgis does not currently support" - " non-int4 type columns as a key into the table.\n" ) ); + " non-int2/4/8 type columns as a key into the table.\n" ) ); else suitableKeyColumns.push_back( std::make_pair( columnName, columnType ) ); } @@ -1013,13 +1052,13 @@ if ( PQntuples( oidCheck ) != 0 ) { primaryKey = "oid"; - primaryKeyType = "int4"; + primaryKeyType = "int8"; } else { log.prepend( "There were no columns in the table that were suitable " "as a qgis key into the table (either a column with a " - "unique index and type int4 or a PostgreSQL oid column.\n" ); + "unique index and type int2/4/8 or a PostgreSQL oid column.\n" ); } } @@ -1095,7 +1134,7 @@ // This sql returns one or more rows if the column 'tableCol' in // table 'tableName' and schema 'schemaName' has one or more // columns that satisfy the following conditions: - // 1) the column has data type of int4. + // 1) the column has data type of int2/4/8. // 2) the column has a unique constraint or primary key constraint // on it. // 3) the constraint applies just to the column of interest (i.e., @@ -1106,13 +1145,13 @@ "and array_dims(conkey)='[1:1]'" ).arg( quotedValue( tableCol ) ).arg( rel_oid ); result = connectionRO->PQexec( sql ); - if ( PQntuples( result ) == 1 && colType == "int4" ) + if ( PQntuples( result ) == 1 && ( colType == "int2" || colType == "int4" || colType == "int8" ) ) suitable[viewCol] = iter->second; QString details = "'" + viewCol + "'" + tr( " derives from " ) + "'" + schemaName + "." + tableName + "." + tableCol + "' "; - if ( PQntuples( result ) == 1 && colType == "int4" ) + if ( PQntuples( result ) == 1 && ( colType == "int2" || colType == "int4" || colType == "int8" ) ) { details += tr( "and is suitable." ); } @@ -1224,7 +1263,7 @@ "of which satisfy the above conditions:" ) ); log.prepend( tr( "Qgis requires that the view has a column that can be used " "as a unique key. Such a column should be derived from " - "a table column of type int4 and be a primary key, " + "a table column of type int2/4/8 and be a primary key, " "have a unique constraint on it, or be a PostgreSQL " "oid column. To improve " "performance the column should also be indexed.\n" ) ); @@ -1994,7 +2033,7 @@ // cycle through the features for ( QgsChangedAttributesMap::const_iterator iter = attr_map.begin();iter != attr_map.end();++iter ) { - int fid = iter.key(); + QgsFeatureId fid = iter.key(); // skip added features if ( fid < 0 ) @@ -2399,15 +2438,13 @@ swapEndian = true; if ( PQntuples( fResult ) > 0 ) { - // get the oid value from the binary cursor - int oid = *( int * )PQgetvalue( fResult, 0, 0 ); + qint64 oid = getBinaryInt( fResult, 0, 0 ); - //--std::cout << "Got oid of " << oid << " from the binary cursor" << std::endl; + QgsDebugMsg( QString( "Got oid of %1 from the binary cursor" ).arg( oid ) ); + QgsDebugMsg( QString( "First oid is %1" ).arg( oidValue ) ); - //--std::cout << "First oid is " << oidValue << std::endl; - // compare the two oid values to determine if we need to do an endian swap - if ( oid == oidValue.toInt() ) + if ( oid != oidValue.toLongLong() ) swapEndian = false; } connectionRO->closeCursor( "oidcursor" ); Index: src/providers/ogr/qgsogrprovider.h =================================================================== --- src/providers/ogr/qgsogrprovider.h (revision 9219) +++ src/providers/ogr/qgsogrprovider.h (working copy) @@ -250,5 +250,5 @@ /**Adds one feature*/ bool addFeature( QgsFeature& f ); /**Deletes one feature*/ - bool deleteFeature( int id ); + bool deleteFeature( QgsFeatureId id ); }; Index: src/providers/ogr/qgsogrprovider.cpp =================================================================== --- src/providers/ogr/qgsogrprovider.cpp (revision 9219) +++ src/providers/ogr/qgsogrprovider.cpp (working copy) @@ -612,7 +612,7 @@ { for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it ) { - long fid = ( long ) it.key(); + long fid = FID_TO_LONG( it.key() ); OGRFeatureH of = OGR_L_GetFeature( ogrLayer, fid ); @@ -677,7 +677,7 @@ for ( QgsGeometryMap::iterator it = geometry_map.begin(); it != geometry_map.end(); ++it ) { - theOGRFeature = OGR_L_GetFeature( ogrLayer, it.key() ); + theOGRFeature = OGR_L_GetFeature( ogrLayer, FID_TO_LONG( it.key() ) ); if ( !theOGRFeature ) { QgsLogger::warning( "QgsOgrProvider::changeGeometryValues, cannot find feature" ); @@ -759,9 +759,9 @@ return returnvalue; } -bool QgsOgrProvider::deleteFeature( int id ) +bool QgsOgrProvider::deleteFeature( QgsFeatureId id ) { - OGRErr res = OGR_L_DeleteFeature( ogrLayer, id ); + OGRErr res = OGR_L_DeleteFeature( ogrLayer, FID_TO_LONG( id ) ); return ( res == OGRERR_NONE ); } Index: src/providers/memory/memoryprovider.h =================================================================== --- src/providers/memory/memoryprovider.h (revision 9219) +++ src/providers/memory/memoryprovider.h (working copy) @@ -16,7 +16,7 @@ #include "qgsvectordataprovider.h" -typedef QMap QgsFeatureMap; +typedef QMap QgsFeatureMap; class QgsSpatialIndex; Index: src/providers/gpx/gpsdata.cpp =================================================================== --- src/providers/gpx/gpsdata.cpp (revision 9219) +++ src/providers/gpx/gpsdata.cpp (working copy) @@ -288,9 +288,9 @@ void GPSData::removeWaypoints( const QgsFeatureIds & ids ) { - QList ids2 = ids.toList(); + QList ids2 = ids.toList(); qSort( ids2 ); - QList::const_iterator iter = ids2.begin(); + QList::const_iterator iter = ids2.begin(); WaypointIterator wIter; for ( wIter = waypoints.begin(); wIter != waypoints.end() && iter != ids2.end(); ) @@ -309,9 +309,9 @@ void GPSData::removeRoutes( const QgsFeatureIds & ids ) { - QList ids2 = ids.toList(); + QList ids2 = ids.toList(); qSort( ids2 ); - QList::const_iterator iter = ids2.begin(); + QList::const_iterator iter = ids2.begin(); RouteIterator rIter; for ( rIter = routes.begin(); rIter != routes.end() && iter != ids2.end(); ) { @@ -329,9 +329,9 @@ void GPSData::removeTracks( const QgsFeatureIds & ids ) { - QList ids2 = ids.toList(); + QList ids2 = ids.toList(); qSort( ids2 ); - QList::const_iterator iter = ids2.begin(); + QList::const_iterator iter = ids2.begin(); TrackIterator tIter; for ( tIter = tracks.begin(); tIter != tracks.end() && iter != ids2.end(); ) { Index: src/providers/gpx/qgsgpxprovider.cpp =================================================================== --- src/providers/gpx/qgsgpxprovider.cpp (revision 9219) +++ src/providers/gpx/qgsgpxprovider.cpp (working copy) @@ -667,7 +667,7 @@ } -bool QgsGPXProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map ) +bool QgsGPXProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_map ) { QgsChangedAttributesMap::const_iterator aIter = attr_map.begin(); if ( mFeatureType == WaypointType ) Index: src/providers/gpx/gpsdata.h =================================================================== --- src/providers/gpx/gpsdata.h (revision 9219) +++ src/providers/gpx/gpsdata.h (working copy) @@ -31,6 +31,7 @@ #include #include "qgsrect.h" +#include "qgsfeature.h" // workaround for MSVC compiler which already has defined macro max // that interferes with calling std::numeric_limits::max @@ -40,8 +41,6 @@ # endif #endif -typedef QSet QgsFeatureIds; - /** This is the parent class for all GPS data classes (except tracksegment). It contains the variables that all GPS objects can have. */ @@ -91,7 +90,7 @@ { public: virtual void writeXML( QTextStream& stream ); - int id; + QgsFeatureId id; }; @@ -102,7 +101,7 @@ public: virtual void writeXML( QTextStream& stream ); std::vector points; - int id; + QgsFeatureId id; }; @@ -124,7 +123,7 @@ public: virtual void writeXML( QTextStream& stream ); std::vector segments; - int id; + QgsFeatureId id; };