48 , mAttributes( rhs.mAttributes )
50 , mOwnsGeometry( false )
51 , mValid( rhs.mValid )
52 , mFields( rhs.mFields )
185 for (
int i = 0; i < fieldCount; ++i, ++ptr )
205 if ( fieldIdx == -1 )
215 if ( fieldIdx == -1 )
224 if ( fieldIdx < 0 || fieldIdx >=
mAttributes.count() )
233 if ( fieldIdx == -1 )
243 if ( QString::compare(
mFields.
at( i ).
name(), fieldName, Qt::CaseInsensitive ) == 0 )
QgsFeatureId id() const
Get the feature id for this feature.
const QString & name() const
Gets the name of the field.
bool isValid() const
Return the validity of this feature.
int fieldNameIndex(const QString &fieldName) const
Utility method to get attribute index from name.
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
QgsGeometry * mGeometry
pointer to geometry in binary WKB format
Container of fields for a vector layer.
bool setAttribute(int field, const QVariant &attr)
Set an attribute by id.
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
void setGeometry(const QgsGeometry &geom)
Set this feature's geometry from another QgsGeometry object (deep copy)
void deleteAttribute(int field)
Deletes an attribute and its value.
void setFeatureId(QgsFeatureId id)
Set the feature id for this feature.
void initAttributes(int fieldCount)
Initialize this feature with the given number of fields.
const QgsFields * fields() const
Get associated field map.
int count() const
Return number of items.
QgsFeature & operator=(QgsFeature const &rhs)
assignment operator needed due to internal pointer
void setFields(const QgsFields *fields, bool initAttributes=false)
Assign a field map with the feature to allow attribute access by attribute name.
QgsFeature(QgsFeatureId id=QgsFeatureId())
Constructor.
bool mOwnsGeometry
Indicator if the mGeometry is owned by this QgsFeature.
void setValid(bool validity)
Set the validity of the feature.
QgsAttributes mAttributes
attributes accessed by field index
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
bool mValid
Flag to indicate if this feature is valid.
void fromWkb(unsigned char *wkb, size_t length)
Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length...
QgsFields mFields
Optional field map for name-based attribute lookups.
QgsGeometry * geometryAndOwnership()
Get the geometry object associated with this feature The caller assumes responsibility for the QgsGeo...
QgsFeatureId mFid
feature id
void setGeometryAndOwnership(unsigned char *geom, size_t length)
Set this feature's geometry from WKB.