vtdata library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DxfParser Class Reference

Public Member Functions

 DxfParser (const vtString &sFileName, std::vector< DxfEntity > &entities, std::vector< DxfLayer > &layers)
 
bool RetrieveEntities (bool progress_callback(int)=NULL)
 
vtString GetFileName ()
 
void SetFileName (const vtString &sFileName)
 
vtString GetLastError ()
 

Protected Member Functions

bool ParseSection ()
 
bool ReadCodeValue (DxfCodeValue &)
 
void SkipSection ()
 
void ReadTableSection (bool progress_callback(int))
 
void ReadEntitySection (bool progress_callback(int))
 
void ReadLayer ()
 
void ReadPoint ()
 
void ReadText ()
 
void ReadPolyline ()
 
void ReadLine ()
 
void ReadVertex (std::vector< DPoint3 > &)
 
int GetLayerIndex (const vtString &)
 
void ReadLWPolyline ()
 
void Read3DFace ()
 

Protected Attributes

std::vector< DxfEntity > & m_entities
 
std::vector< DxfLayer > & m_layers
 
vtString m_sFileName
 
FILE * m_pFile
 
size_t m_iLine
 
size_t m_iLineCount
 
int m_iCounter
 
long m_iEndPosition
 
vtString m_strMessage
 

Detailed Description

This class parses the entire contents of a DXF file. It is up to the caller to go through the resulting entities and use what is desired.

Example:
std::vector<DxfEntity> entities;
std::vector<DxfLayer> layers;
DxfParser parser(fname, entities, layers);
bool bSuccess = parser.RetrieveEntities();
if (bSuccess)
{
// Look through the entities and take what is needed.
}

Constructor & Destructor Documentation

DxfParser::DxfParser ( const vtString sFileName,
std::vector< DxfEntity > &  entities,
std::vector< DxfLayer > &  layers 
)

Constructor. Pass in the filename to parse.

Member Function Documentation

bool DxfParser::RetrieveEntities ( bool   progress_callbackint = NULL)

This method will parse the entire file, collecting all entities that it finds.

Parameters
progress_callbackPass a function to receive progress notification (values of 0 to 100) if desired. Optional.
Returns
Success. If failure, then call GetLastError() to get an informative error message.