vtdata library
Public Member Functions | Protected Member Functions | Protected Attributes
vtFeatureSet Class Reference
Inheritance diagram for vtFeatureSet:
Inheritance graph
[legend]

List of all members.

Public Member Functions

bool SaveToSHP (const char *filename, bool progress_callback(int)=0) const
bool LoadFromOGR (OGRLayer *pLayer, bool progress_callback(int)=0)
virtual void LoadGeomFromSHP (SHPHandle hSHP, bool progress_callback(int)=0)=0
bool LoadFromSHP (const char *fname, bool progress_callback(int)=0)
bool LoadDataFromDBF (const char *filename, bool progress_callback(int)=0)
bool LoadFieldInfoFromDBF (const char *filename)
bool LoadDataFromCSV (const char *filename, bool progress_callback(int)=0)
bool SaveToKML (const char *filename, bool progress_callback(int)=0) const
void SetFilename (const vtString &str)
vtString GetFilename () const
virtual unsigned int GetNumEntities () const =0
void SetNumEntities (int iNum)
void AllocateFeatures ()
OGRwkbGeometryType GetGeomType () const
void SetGeomType (OGRwkbGeometryType eGeomType)
bool AppendDataFrom (vtFeatureSet *pFromSet)
virtual void Reserve (int iNum)=0
virtual bool ComputeExtent (DRECT &rect) const =0
virtual void Offset (const DPoint2 &p, bool bSelectedOnly=false)=0
virtual bool TransformCoords (OCT *pTransform, bool progress_callback(int)=0)=0
virtual bool AppendGeometryFrom (vtFeatureSet *pFromSet)=0
virtual int NumTotalVertices () const
void SetToDelete (int iFeature)
void ApplyDeletion ()
void Select (unsigned int iEnt, bool set=true)
bool IsSelected (unsigned int iEnt)
unsigned int NumSelected () const
void DeselectAll ()
void InvertSelection ()
int SelectByCondition (int iField, int iCondition, const char *szValue)
void DeleteSelected ()
bool IsDeleted (unsigned int iEnt)
int DoBoxSelect (const DRECT &rect, SelectionType st)
void Pick (unsigned int iEnt, bool set=true)
bool IsPicked (unsigned int iEnt)
void DePickAll ()
unsigned int GetNumFields () const
FieldGetField (int i)
const FieldGetField (int i) const
FieldGetField (const char *name)
int GetFieldIndex (const char *name) const
int AddField (const char *name, FieldType ftype, int string_length=40)
int AddRecord ()
void DeleteFields ()
void SetValue (unsigned int record, unsigned int field, const char *string)
void SetValue (unsigned int record, unsigned int field, int value)
void SetValue (unsigned int record, unsigned int field, double value)
void SetValue (unsigned int record, unsigned int field, bool value)
void GetValueAsString (unsigned int record, unsigned int field, vtString &str) const
void SetValueFromString (unsigned int iRecord, unsigned int iField, const vtString &str)
void SetValueFromString (unsigned int iRecord, unsigned int iField, const char *str)
int GetIntegerValue (unsigned int iRecord, unsigned int iField) const
short GetShortValue (unsigned int iRecord, unsigned int iField) const
float GetFloatValue (unsigned int iRecord, unsigned int iField) const
double GetDoubleValue (unsigned int iRecord, unsigned int iField) const
bool GetBoolValue (unsigned int iRecord, unsigned int iField) const
void SetProjection (const vtProjection &proj)
vtProjectionGetAtProjection ()
vtFeatureGetFeature (unsigned int iIndex) const

Protected Member Functions

virtual bool IsInsideRect (int iElem, const DRECT &rect)=0
virtual void CopyGeometry (unsigned int from, unsigned int to)=0
virtual void SaveGeomToSHP (SHPHandle hSHP, bool progress_callback(int)=0) const =0
virtual void SetNumGeometries (int iNum)=0
void CopyEntity (unsigned int from, unsigned int to)
void ParseDBFFields (DBFHandle db)
void ParseDBFRecords (DBFHandle db, bool progress_callback(int)=0)

Protected Attributes

OGRwkbGeometryType m_eGeomType
std::vector< vtFeature * > m_Features
vtArray< Field * > m_fields
vtProjection m_proj
vtString m_strFilename

Detailed Description

vtFeatureSet contains a collection of features which are just abstract data, without any specific correspondence to any aspect of the physical world. This is the same as a traditional GIS file (e.g. ESRI Shapefile).

Examples: political and property boundaries, geocoded addresses, flight paths, place names.


Member Function Documentation

int vtFeatureSet::AddField ( const char *  name,
FieldType  ftype,
int  string_length = 40 
)

Add a data field to this featureset. The field contain a value of any type, for every entity.

Parameters:
nameName of the new field.
ftypeType of the new field.
string_lengthFor backward compatibility with the old SHP/DBF file formats, this is the maximum length of a string, for string fields. It has no effect unless you save this featureset to a SHP/DBF file.
bool vtFeatureSet::AppendDataFrom ( vtFeatureSet pFromSet)

Append the contents of another featureset to this one. The two featuresets must have the same geometry type. Only fields with matching names are copied in the record data.

int vtFeatureSet::GetFieldIndex ( const char *  name) const

Return the index of the field with the given name, or -1 if no field with that name was found.

OGRwkbGeometryType vtFeatureSet::GetGeomType ( ) const

Returns the type of geometry that each feature has.

Returns:
  • wkbPoint for 2D points
  • wkbPoint25D fpr 3D points
  • wkbLineString for 2D polylines
  • wkbPolygon for 2D polygons
bool vtFeatureSet::LoadDataFromCSV ( const char *  filename,
bool   progress_callbackint = 0 
)

Load a featureset's field data from a comma-separated-value (CSV) file.

Parameters:
filenamefilename in UTF-8 encoding.
progress_callbackProvide a callback function if you want to receive progress indication.
Returns:
true if successful.
bool vtFeatureSet::LoadDataFromDBF ( const char *  filename,
bool   progress_callbackint = 0 
)

Load a featureset's field data from a DBF file

Parameters:
filenameFilename in UTF-8 encoding.
progress_callbackProvide a callback function if you want to receive progress indication.
Returns:
true if successful.
bool vtFeatureSet::LoadFieldInfoFromDBF ( const char *  filename)

A lightweight alternative to LoadDataFromDBF, which simply reads the field descriptions from the DBF file.

bool vtFeatureSet::LoadFromSHP ( const char *  fname,
bool   progress_callbackint = 0 
)

Load a featureset from a SHP (ESRI Shapefile).

Parameters:
fnamefilename in UTF-8 encoding.
progress_callbackProvide a callback function if you want to receive progress indication.
Returns:
true if successful.
virtual void vtFeatureSet::Reserve ( int  iNum) [pure virtual]

If you know how many entities you will be adding to this FeatureSet, is it more efficient to reserve space for that many.

Implemented in vtFeatureSetPoint2D, vtFeatureSetPoint3D, vtFeatureSetLineString, vtFeatureSetLineString3D, and vtFeatureSetPolygon.

bool vtFeatureSet::SaveToKML ( const char *  filename,
bool   progress_callbackint = 0 
) const

Export a featureset to a KML file. This is still very limited and experimental.

Parameters:
filenameFilename in UTF-8 encoding.
progress_callbackProvide a callback function if you want to receive progress indication.
Returns:
true if successful.
bool vtFeatureSet::SaveToSHP ( const char *  filename,
bool   progress_callbackint = 0 
) const

Save a featureset from a SHP (ESRI Shapefile) with corresponding DBF file

Parameters:
filenameFilename in UTF-8 encoding.
progress_callbackProvide a callback function if you want to receive progress indication.
Returns:
true if successful.
void vtFeatureSet::SetGeomType ( OGRwkbGeometryType  eGeomType)

Set the type of geometry that each feature will have.

Parameters:
eGeomType
  • wkbPoint for 2D points
  • wkbPoint25D fpr 3D points
  • wkbLineString for 2D polylines
  • wkbPolygon for 2D polygons
void vtFeatureSet::SetNumEntities ( int  iNum)

Set the number of entities. This expands (or contracts) the number of geometry entities and corresponding records.

 All Classes Files Functions Variables Enumerations Enumerator