Skip to content

Commit fe59da5

Browse files
committedMar 30, 2013
Add overload for QgsFeature with QgsFields
1 parent bd373fd commit fe59da5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
 

‎python/core/qgsfeature.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class QgsFeature
9090
//! Constructor
9191
QgsFeature( qint64 id = 0 );
9292

93+
QgsFeature( const QgsFields& fields, qint64 id = 0 );
94+
9395
/** copy ctor needed due to internal pointer */
9496
QgsFeature( const QgsFeature & rhs );
9597

‎src/core/qgsfeature.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ QgsFeature::QgsFeature( QgsFeatureId id )
3737
// NOOP
3838
}
3939

40+
QgsFeature::QgsFeature( const QgsFields &fields, QgsFeatureId id )
41+
: mFid( id )
42+
, mGeometry( 0 )
43+
, mOwnsGeometry( 0 )
44+
, mValid( false )
45+
, mFields( &fields )
46+
{
47+
initAttributes( fields.count() );
48+
}
49+
4050
QgsFeature::QgsFeature( QgsFeature const & rhs )
4151
: mFid( rhs.mFid )
4252
, mAttributes( rhs.mAttributes )

‎src/core/qgsfeature.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class CORE_EXPORT QgsFeature
117117
//! Constructor
118118
QgsFeature( QgsFeatureId id = QgsFeatureId() );
119119

120+
QgsFeature( const QgsFields& fields, QgsFeatureId id = QgsFeatureId() );
121+
120122
/** copy ctor needed due to internal pointer */
121123
QgsFeature( const QgsFeature & rhs );
122124

0 commit comments

Comments
 (0)
Please sign in to comment.