vtdata library
 All Classes Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtFeatureSet Class Referenceabstract
Inheritance diagram for vtFeatureSet:
Inheritance graph
[legend]

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 uint NumEntities () 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 (OCTransform *pTransform, bool progress_callback(int)=0)=0
 
virtual bool AppendGeometryFrom (vtFeatureSet *pFromSet)=0
 
virtual int NumTotalVertices () const
 
virtual bool EarthExtents (DRECT &ext) const =0
 
void SetToDelete (int iFeature)
 
int ApplyDeletion ()
 
void Select (uint iEnt, bool set=true)
 
bool IsSelected (uint iEnt)
 
uint NumSelected () const
 
void DeselectAll ()
 
void InvertSelection ()
 
int SelectByCondition (int iField, int iCondition, const char *szValue)
 
void DeleteSelected ()
 
bool IsDeleted (uint iEnt)
 
int DoBoxSelect (const DRECT &rect, SelectionType st)
 
void Pick (uint iEnt, bool set=true)
 
bool IsPicked (uint iEnt)
 
void DePickAll ()
 
uint NumFields () 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 (uint record, uint field, const char *string)
 
void SetValue (uint record, uint field, int value)
 
void SetValue (uint record, uint field, double value)
 
void SetValue (uint record, uint field, bool value)
 
void GetValueAsString (uint record, uint field, vtString &str) const
 
void SetValueFromString (uint iRecord, uint iField, const vtString &str)
 
void SetValueFromString (uint iRecord, uint iField, const char *str)
 
int GetIntegerValue (uint iRecord, uint iField) const
 
short GetShortValue (uint iRecord, uint iField) const
 
float GetFloatValue (uint iRecord, uint iField) const
 
double GetDoubleValue (uint iRecord, uint iField) const
 
bool GetBoolValue (uint iRecord, uint iField) const
 
void SetProjection (const vtProjection &proj)
 
vtProjectionGetAtProjection ()
 
vtFeature * GetFeature (uint iIndex) const
 

Protected Member Functions

virtual bool IsInsideRect (int iElem, const DRECT &rect)=0
 
virtual void CopyGeometry (uint from, uint to)=0
 
virtual void SaveGeomToSHP (SHPHandle hSHP, bool progress_callback(int)=0) const =0
 
virtual void SetNumGeometries (int iNum)=0
 
void CopyEntity (uint from, uint 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 vtFeatureSetPolygon, vtFeatureSetLineString3D, vtFeatureSetLineString, vtFeatureSetPoint3D, and vtFeatureSetPoint2D.

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.