2013-10-24 16:44:38 +00:00
|
|
|
/******************************************************************************
|
|
|
|
** libDXFrw - Library to read/write DXF files (ascii & binary) **
|
|
|
|
** **
|
|
|
|
** Copyright (C) 2011 Rallaz, rallazz@gmail.com **
|
|
|
|
** **
|
|
|
|
** This library is free software, licensed under the terms of the GNU **
|
|
|
|
** General Public License as published by the Free Software Foundation, **
|
|
|
|
** either version 2 of the License, or (at your option) any later version. **
|
|
|
|
** You should have received a copy of the GNU General Public License **
|
|
|
|
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DRW_INTERFACE_H
|
|
|
|
#define DRW_INTERFACE_H
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "drw_entities.h"
|
|
|
|
#include "drw_objects.h"
|
|
|
|
// #include "dl_extrusion.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract class (interface) for comunicate dxfReader with the application.
|
|
|
|
* Inherit your class which takes care of the entities in the
|
|
|
|
* processed DXF file from this interface.
|
|
|
|
*
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Interface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DRW_Interface()
|
|
|
|
{
|
|
|
|
// extrusion = new DL_Extrusion;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~DRW_Interface()
|
|
|
|
{
|
|
|
|
// delete extrusion;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Called when header is parsed. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addHeader( const DRW_Header* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every line Type. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addLType( const DRW_LType& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every layer. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addLayer( const DRW_Layer& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every dim style. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimStyle( const DRW_Dimstyle& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every VPORT table. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addVport( const DRW_Vport& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every text style. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addTextStyle( const DRW_Textstyle& data ) = 0;
|
|
|
|
|
|
|
|
/** Called for every AppId entry. */
|
|
|
|
virtual void addAppId( const DRW_AppId& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every block. Note: all entities added after this
|
|
|
|
* command go into this block until endBlock() is called.
|
|
|
|
*
|
|
|
|
* @see endBlock()
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addBlock( const DRW_Block& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* In DWG called when the following entities corresponding to a
|
|
|
|
* block different from the current. Note: all entities added after this
|
|
|
|
* command go into this block until setBlock() is called already.
|
|
|
|
*
|
|
|
|
* int handle are the value of DRW_Block::handleBlock added with addBlock()
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void setBlock( const int handle ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called to end the current block */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void endBlock() = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every point */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addPoint( const DRW_Point& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every line */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addLine( const DRW_Line& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every ray */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addRay( const DRW_Ray& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every xline */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addXline( const DRW_Xline& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every arc */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addArc( const DRW_Arc& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every circle */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addCircle( const DRW_Circle& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every ellipse */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addEllipse( const DRW_Ellipse& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every lwpolyline */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addLWPolyline( const DRW_LWPolyline& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every polyline start */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addPolyline( const DRW_Polyline& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every spline */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addSpline( const DRW_Spline* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every spline knot value */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addKnot( const DRW_Entity& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every insert. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addInsert( const DRW_Insert& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every trace start */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addTrace( const DRW_Trace& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every 3dface start */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void add3dFace( const DRW_3Dface& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every solid start */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addSolid( const DRW_Solid& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** Called for every Multi Text entity. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addMText( const DRW_MText& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Called for every Text entity. */
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addText( const DRW_Text& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every aligned dimension entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimAlign( const DRW_DimAligned* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every linear or rotated dimension entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimLinear( const DRW_DimLinear* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every radial dimension entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimRadial( const DRW_DimRadial* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every diametric dimension entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimDiametric( const DRW_DimDiametric* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every angular dimension (2 lines version) entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimAngular( const DRW_DimAngular* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every angular dimension (3 points version) entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimAngular3P( const DRW_DimAngular3p* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every ordinate dimension entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addDimOrdinate( const DRW_DimOrdinate* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every leader start.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addLeader( const DRW_Leader* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every hatch entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addHatch( const DRW_Hatch* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every viewport entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addViewport( const DRW_Viewport& data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every image entity.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addImage( const DRW_Image* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every image definition.
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void linkImage( const DRW_ImageDef* data ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every comment in the DXF file (code 999).
|
|
|
|
*/
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void addComment( const char* comment ) = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
/** Sets the current attributes for entities. */
|
|
|
|
/* void setExtrusion(double dx, double dy, double dz, double elevation) {
|
|
|
|
* extrusion->setDirection(dx, dy, dz);
|
|
|
|
* extrusion->setElevation(elevation);
|
|
|
|
* }*/
|
|
|
|
|
|
|
|
/** @return the current attributes used for new entities. */
|
|
|
|
// DL_Extrusion* getExtrusion() {
|
|
|
|
// return extrusion;
|
|
|
|
// }
|
|
|
|
|
|
|
|
virtual void writeHeader( DRW_Header& data ) = 0;
|
|
|
|
virtual void writeBlocks() = 0;
|
|
|
|
virtual void writeBlockRecords() = 0;
|
2015-02-24 09:07:40 +00:00
|
|
|
virtual void writeEntities() = 0;
|
|
|
|
virtual void writeLTypes() = 0;
|
|
|
|
virtual void writeLayers() = 0;
|
|
|
|
virtual void writeTextstyles() = 0;
|
|
|
|
virtual void writeVports() = 0;
|
|
|
|
virtual void writeDimstyles() = 0;
|
|
|
|
virtual void writeAppId() = 0;
|
2013-10-24 16:44:38 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// DL_Attributes attributes;
|
|
|
|
// DL_Extrusion *extrusion;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|