A generic DXF-reading class. More...
#include "dxfFile.h"
Classes | |
struct | Color |
Public Member Functions | |
virtual void | begin_file () |
A hook for user code, if desired. More... | |
virtual void | begin_section () |
A hook for user code, if desired. More... | |
virtual void | done_entity () |
This is the primary hook for user code. More... | |
virtual void | done_vertex () |
A hook for user code, if desired. More... | |
virtual void | end_file () |
A hook for user code, if desired. More... | |
virtual void | end_section () |
A hook for user code, if desired. More... | |
virtual void | error () |
A hook for user code, if desired. More... | |
const Color & | get_color () const |
This is a convenience function to return the r,g,b color of the current entity (at the time of done_entity()). More... | |
virtual DXFLayer * | new_layer (const std::string &name) |
void | ocs_2_wcs () |
Assuming the current entity is a planar-based entity, for instance, a 2-d polygon (as opposed to a 3-d polygon), this converts the coordinates from the funny planar coordinate system to the world coordinates. More... | |
void | process (Filename filename) |
Opens the indicated filename and reads it as a DXF file. More... | |
void | process (std::istream *in, bool owns_in) |
Reads the indicated stream as a DXF file. More... | |
Static Public Member Functions | |
static int | find_color (double r, double g, double b) |
Returns the index of the closest matching AutoCAD color to the indicated r, g, b. More... | |
Public Attributes | |
int | _color_index |
Entity | _entity |
int | _flags |
DXFLayer * | _layer |
DXFLayerMap | _layers |
LPoint3d | _p |
LPoint3d | _q |
LPoint3d | _r |
LPoint3d | _s |
Section | _section |
DXFVertices | _verts |
LVector3d | _z |
Static Public Attributes | |
static Color | _colors [DXF_num_colors] |
A generic DXF-reading class.
This class can read a DXF file but doesn't actually do anything with the data; it's intended to be inherited from and the appropriate functions overridden (particularly DoneEntity()).
|
virtual |
A hook for user code, if desired.
This function is called whenever processing begins on the DXF file.
Definition at line 371 of file dxfFile.cxx.
|
virtual |
A hook for user code, if desired.
This function is called whenever a new section in the DXF file is encountered.
Definition at line 380 of file dxfFile.cxx.
|
virtual |
This is the primary hook for user code.
This function is called when an entity is read from the DXF file. This may be something like a polygon, point, or a polygon mesh: any geometry. It is up to the user code to override this function and do something interesting with each piece of geometry that is read.
Reimplemented in DXFPoints.
Definition at line 406 of file dxfFile.cxx.
|
virtual |
A hook for user code, if desired.
This function is called whenever a vertex is read from the DXF file. This function has the default behavior of adding the vertex to the _verts list, so that when done_entity() is called later, it will have the complete list of vertices available to it.
Definition at line 391 of file dxfFile.cxx.
|
virtual |
A hook for user code, if desired.
This function is called when the DXF processing is complete.
Definition at line 424 of file dxfFile.cxx.
|
virtual |
A hook for user code, if desired.
This function is called as each section in the DXF file is finished.
Definition at line 415 of file dxfFile.cxx.
|
virtual |
A hook for user code, if desired.
This function is called when some unexpected error occurs while reading the DXF file.
Definition at line 433 of file dxfFile.cxx.
|
static |
Returns the index of the closest matching AutoCAD color to the indicated r, g, b.
Definition at line 444 of file dxfFile.cxx.
const DXFFile::Color & DXFFile::get_color | ( | ) | const |
This is a convenience function to return the r,g,b color of the current entity (at the time of done_entity()).
It's based on the _color_index value that was read from the DXF file.
Definition at line 467 of file dxfFile.cxx.
Referenced by DXFToEggLayer::add_line(), and DXFToEggLayer::add_polygon().
void DXFFile::ocs_2_wcs | ( | ) |
Assuming the current entity is a planar-based entity, for instance, a 2-d polygon (as opposed to a 3-d polygon), this converts the coordinates from the funny planar coordinate system to the world coordinates.
It converts the _p value of the entity, as well as all vertices in the _verts list.
Definition at line 482 of file dxfFile.cxx.
Referenced by DXFPoints::done_entity().
void DXFFile::process | ( | Filename | filename | ) |
Opens the indicated filename and reads it as a DXF file.
Definition at line 310 of file dxfFile.cxx.
References Filename::set_text().
void DXFFile::process | ( | std::istream * | in, |
bool | owns_in | ||
) |
Reads the indicated stream as a DXF file.
If owns_in is true, then the istream will be deleted via vfs->close_read_file() when the DXFFile object destructs.
Definition at line 328 of file dxfFile.cxx.