IBSimu 1.0.4
Public Member Functions

MyDXFEntities Class Reference

DXF entity database. More...

#include <mydxfentities.hpp>

List of all members.

Public Member Functions

 MyDXFEntities ()
 Construct empty entities database.
 MyDXFEntities (MyDXFEntities *ent, MyDXFEntitySelection *sel)
 Construct new entities containing copies of selected intities in ent.
 MyDXFEntities (class MyDXFFile *dxf, bool reading_blocks=false)
 Construct entities database by reading from DXF file.
 ~MyDXFEntities ()
 Destructor.
void write (class MyDXFFile *dxf, std::ofstream &ostr)
 Write entities section of dxf file to stream.
void write_entities (class MyDXFFile *dxf, std::ofstream &ostr)
 Write a list of entities to stream.
uint32_t size () const
 Return number of entities.
const MyDXFEntityget_entity (uint32_t a) const
 Return const pointer to entity a.
MyDXFEntityget_entity (uint32_t a)
 Return pointer to entity a.
void add_entity (MyDXFEntity *e)
 Add entity to list.
MyDXFEntitySelectionselection_all (void) const
 Make a new selection containg all entities from database.
MyDXFEntitySelectionselection_layer (const std::string &layername) const
 Make a new selection containg entities from named layer.
MyDXFEntitySelectionselection_type (EntityType type) const
 Make a new selection containg entities of given type.
MyDXFEntitySelectionselection_path_loop (MyDXFEntitySelection *selection, double eps=1.0e-6)
 Build complete loops.
bool geom_same (uint32_t a, uint32_t b, double eps=1.0e-6) const
 Check if two entities are geometrically same.
bool inside_loop (MyDXFEntitySelection *selection, double x, double y, double eps=1.0e-6)
void plot (const MyDXFEntitySelection *selection, const class MyDXFFile *dxf, cairo_t *cairo, const Transformation *t, const double range[4]) const
 Plot selected entities with cairo.
void get_bbox (const MyDXFEntitySelection *selection, Vec3D &min, Vec3D &max, const class MyDXFFile *dxf, const Transformation *t) const
 Get bounding box containing all entities in selection.
void scale (MyDXFEntitySelection *selection, class MyDXFFile *dxf, double s)
 Scale selected entities by factor s.
void remove (MyDXFEntitySelection *selection)
 Remove selected entities.
void explode (MyDXFEntitySelection *selection, class MyDXFFile *dxf)
 Explode selected insert entities.
void explode (MyDXFEntities *ent, class MyDXFFile *dxf, const Transformation *t) const
 Explode all entities to ent.
void debug_print (std::ostream &os) const
 Print debugging information to os.

Detailed Description

DXF entity database.

A database of entities. Also responsible for reading entities from a DXF file. All supported entities are saved to database. All others are silently ignored.


Constructor & Destructor Documentation

MyDXFEntities::MyDXFEntities ( ) [inline]

Construct empty entities database.

MyDXFEntities::MyDXFEntities ( MyDXFEntities ent,
MyDXFEntitySelection sel 
)

Construct new entities containing copies of selected intities in ent.

MyDXFEntities::MyDXFEntities ( class MyDXFFile dxf,
bool  reading_blocks = false 
)

Construct entities database by reading from DXF file.

Called with reading_block = true if called from inside BLOCKS section.

MyDXFEntities::~MyDXFEntities ( )

Destructor.


Member Function Documentation

void MyDXFEntities::add_entity ( MyDXFEntity e) [inline]

Add entity to list.

No copy of entity is made. The pointer is saved to the database.

void MyDXFEntities::debug_print ( std::ostream &  os) const

Print debugging information to os.

void MyDXFEntities::explode ( MyDXFEntitySelection selection,
class MyDXFFile dxf 
)

Explode selected insert entities.

The insert entities are expoded to contain just primitive entities with no dependencies to blocks. Selection can be a NULL pointer to explode all entities.

void MyDXFEntities::explode ( MyDXFEntities ent,
class MyDXFFile dxf,
const Transformation t 
) const

Explode all entities to ent.

Explode and add all entities into ent using transformation t.

bool MyDXFEntities::geom_same ( uint32_t  a,
uint32_t  b,
double  eps = 1.0e-6 
) const

Check if two entities are geometrically same.

Checks if entity a is the geometrically same as entity b within error limit eps.

void MyDXFEntities::get_bbox ( const MyDXFEntitySelection selection,
Vec3D min,
Vec3D max,
const class MyDXFFile dxf,
const Transformation t 
) const

Get bounding box containing all entities in selection.

MyDXFEntity* MyDXFEntities::get_entity ( uint32_t  a) [inline]

Return pointer to entity a.

const MyDXFEntity* MyDXFEntities::get_entity ( uint32_t  a) const [inline]

Return const pointer to entity a.

bool MyDXFEntities::inside_loop ( MyDXFEntitySelection selection,
double  x,
double  y,
double  eps = 1.0e-6 
)
void MyDXFEntities::plot ( const MyDXFEntitySelection selection,
const class MyDXFFile dxf,
cairo_t *  cairo,
const Transformation t,
const double  range[4] 
) const

Plot selected entities with cairo.

Plot the entities using the transformation t from the object space to cairo coordinates. The visible range is specified by range (xmin,ymin,xmax,ymax) in cairo coordinates.

Selection can be a NULL pointer to plot all entities.

void MyDXFEntities::remove ( MyDXFEntitySelection selection)

Remove selected entities.

Selection can be a NULL pointer to remove all entities. The selection is invalid after this operation and should not be used further. Also all other selections are invalidated by this operation because entity indices change.

void MyDXFEntities::scale ( MyDXFEntitySelection selection,
class MyDXFFile dxf,
double  s 
)

Scale selected entities by factor s.

Selection can be a NULL pointer to plot all entities.

MyDXFEntitySelection* MyDXFEntities::selection_all ( void  ) const

Make a new selection containg all entities from database.

MyDXFEntitySelection* MyDXFEntities::selection_layer ( const std::string &  layername) const

Make a new selection containg entities from named layer.

MyDXFEntitySelection* MyDXFEntities::selection_path_loop ( MyDXFEntitySelection selection,
double  eps = 1.0e-6 
)

Build complete loops.

Make a new subselection of a selection. The new selection will contain only objects, which make up one or several complete loops. Ending point of one entity is ensured to be exactly the starting point of another entity. Errors of the size eps are accepted and fixed between end-to-end matching.

MyDXFEntitySelection* MyDXFEntities::selection_type ( EntityType  type) const

Make a new selection containg entities of given type.

uint32_t MyDXFEntities::size ( void  ) const [inline]

Return number of entities.

void MyDXFEntities::write ( class MyDXFFile dxf,
std::ofstream &  ostr 
)

Write entities section of dxf file to stream.

void MyDXFEntities::write_entities ( class MyDXFFile dxf,
std::ofstream &  ostr 
)

Write a list of entities to stream.

This function only writes the entities withing the object. It can be called for writing the entities section or a block.


The documentation for this class was generated from the following file: