/usr/include/qgis/qgsfeature.h is in libqgis-dev 1.7.4+1.7.5~20120320-1.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | /***************************************************************************
qgsfeature.h - Spatial Feature Class
--------------------------------------
Date : 09-Sep-2003
Copyright : (C) 2003 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************
* *
* 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. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSFEATURE_H
#define QGSFEATURE_H
#include <QMap>
#include <QString>
#include <QVariant>
#include <QList>
class QgsGeometry;
class QgsRectangle;
class QgsFeature;
// key = field index, value = field value
typedef QMap<int, QVariant> QgsAttributeMap;
// key = feature id, value = changed attributes
typedef QMap<int, QgsAttributeMap> QgsChangedAttributesMap;
// key = feature id, value = changed geometry
typedef QMap<int, QgsGeometry> QgsGeometryMap;
// key = field index, value = field name
typedef QMap<int, QString> QgsFieldNameMap;
typedef QList<QgsFeature> QgsFeatureList;
/** \ingroup core
* The feature class encapsulates a single feature including its id,
* geometry and a list of field/values attributes.
*
* @author Gary E.Sherman
*/
class CORE_EXPORT QgsFeature
{
public:
//! Constructor
QgsFeature( int id = 0, QString typeName = "" );
/** copy ctor needed due to internal pointer */
QgsFeature( QgsFeature const & rhs );
/** assignment operator needed due to internal pointer */
QgsFeature & operator=( QgsFeature const & rhs );
//! Destructor
~QgsFeature();
/**
* Get the feature id for this feature
* @return Feature id
*/
int id() const;
/**
* Set the feature id for this feature
* @param id Feature id
*/
void setFeatureId( int id );
/** returns the feature's type name
*/
QString typeName() const;
/** sets the feature's type name
*/
void setTypeName( QString typeName );
/**
* Get the attributes for this feature.
* @return A std::map containing the field name/value mapping
*/
const QgsAttributeMap& attributeMap() const;
/**Sets all the attributes in one go*/
void setAttributeMap( const QgsAttributeMap& attributeMap );
/** Clear attribute map
* added in 1.5
*/
void clearAttributeMap();
/**
* Add an attribute to the map
*/
void addAttribute( int field, QVariant attr );
/**Deletes an attribute and its value*/
void deleteAttribute( int field );
/**Changes an existing attribute value
@param field index of the field
@param attr attribute name and value to be set */
void changeAttribute( int field, QVariant attr );
/**
* Return the validity of this feature. This is normally set by
* the provider to indicate some problem that makes the feature
* invalid or to indicate a null feature.
*/
bool isValid() const;
/**
* Set the validity of the feature.
*/
void setValid( bool validity );
/**
* Return the dirty state of this feature.
* Dirty is set if (e.g.) the feature's geometry has been modified in-memory.
*/
bool isDirty() const;
/**
* Reset the dirtiness of the feature. (i.e. make clean)
* You would normally do this after it's saved to permanent storage (e.g. disk, an ACID-compliant database)
*/
void clean();
/**
* Get the geometry object associated with this feature
*/
QgsGeometry *geometry();
/**
* Get the geometry object associated with this feature
* The caller assumes responsibility for the QgsGeometry*'s destruction.
*/
QgsGeometry *geometryAndOwnership();
/** Set this feature's geometry from another QgsGeometry object (deep copy)
*/
void setGeometry( const QgsGeometry& geom );
/** Set this feature's geometry (takes geometry ownership)
*/
void setGeometry( QgsGeometry* geom );
/**
* Set this feature's geometry from WKB
*
* This feature assumes responsibility for destroying geom.
*/
void setGeometryAndOwnership( unsigned char * geom, size_t length );
private:
//! feature id
int mFid;
/** map of attributes accessed by field index */
QgsAttributeMap mAttributes;
/** pointer to geometry in binary WKB format
This is usually set by a call to OGRGeometry::exportToWkb()
*/
QgsGeometry *mGeometry;
/** Indicator if the mGeometry is owned by this QgsFeature.
If so, this QgsFeature takes responsibility for the mGeometry's destruction.
*/
bool mOwnsGeometry;
//! Flag to indicate if this feature is valid
// TODO: still applies? [MD]
bool mValid;
//! Flag to indicate if this feature is dirty (e.g. geometry has been modified in-memory)
// TODO: still applies? [MD]
bool mDirty;
/// feature type name
QString mTypeName;
}; // class QgsFeature
#endif
|