2017-06-20 10:40:39 +02:00
|
|
|
/******************************************************************************
|
|
|
|
** libDXFrw - Library to read/write DXF files (ascii & binary) **
|
|
|
|
** **
|
|
|
|
** Copyright (C) 2011-2015 José F. Soriano, 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 <cstring>
|
|
|
|
|
|
|
|
#include "drw_entities.h"
|
|
|
|
#include "drw_objects.h"
|
|
|
|
#include "drw_header.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract class (interface) for comunicate dxfReader with the application.
|
2017-06-21 11:34:20 +02:00
|
|
|
* Inherit your class which takes care of the entities in the
|
|
|
|
* processed DXF file from this interface.
|
2017-06-20 10:40:39 +02:00
|
|
|
*
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Interface {
|
|
|
|
public:
|
2017-06-21 13:54:17 +02:00
|
|
|
DRW_Interface() {
|
|
|
|
}
|
2017-06-21 11:34:20 +02:00
|
|
|
virtual ~DRW_Interface() = default;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called when header is parsed. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addHeader(const DRW_Header *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every line Type. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addLType(const DRW_LType &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every layer. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addLayer(const DRW_Layer &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every dim style. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimStyle(const DRW_Dimstyle &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every VPORT table. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addVport(const DRW_Vport &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every text style. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addTextStyle(const DRW_Textstyle &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every AppId entry. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addAppId(const DRW_AppId &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every block. Note: all entities added after this
|
|
|
|
* command go into this block until endBlock() is called.
|
|
|
|
*
|
|
|
|
* @see endBlock()
|
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addBlock(const DRW_Block &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called to end the current block */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void endBlock() { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every point */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addPoint(const DRW_Point &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every line */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addLine(const DRW_Line &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every ray */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addRay(const DRW_Ray &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every xline */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addXline(const DRW_Xline &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every arc */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addArc(const DRW_Arc &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every circle */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addCircle(const DRW_Circle &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every ellipse */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addEllipse(const DRW_Ellipse &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every lwpolyline */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addLWPolyline(const DRW_LWPolyline &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every polyline start */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addPolyline(const DRW_Polyline &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every spline */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addSpline(const DRW_Spline *) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/** Called for every spline knot value */
|
|
|
|
virtual void addKnot(const DRW_Entity &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every insert. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addInsert(const DRW_Insert &) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every trace start */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addTrace(const DRW_Trace &) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
/** Called for every 3dface start */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void add3dFace(const DRW_3Dface &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every solid start */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addSolid(const DRW_Solid &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
/** Called for every Multi Text entity. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addMText(const DRW_MText &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/** Called for every Text entity. */
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addText(const DRW_Text &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every aligned dimension entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimAlign(const DRW_DimAligned *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every linear or rotated dimension entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimLinear(const DRW_DimLinear *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every radial dimension entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimRadial(const DRW_DimRadial *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every diametric dimension entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimDiametric(const DRW_DimDiametric *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every angular dimension (2 lines version) entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimAngular(const DRW_DimAngular *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every angular dimension (3 points version) entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimAngular3P(const DRW_DimAngular3p *) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
/**
|
2017-06-21 11:34:20 +02:00
|
|
|
* Called for every ordinate dimension entity.
|
2017-06-20 10:40:39 +02:00
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addDimOrdinate(const DRW_DimOrdinate *) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
|
|
|
/**
|
2017-06-21 13:54:17 +02:00
|
|
|
* Called for every leader start.
|
|
|
|
*/
|
|
|
|
virtual void addLeader(const DRW_Leader *) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
|
|
|
* Called for every hatch entity.
|
|
|
|
*/
|
|
|
|
virtual void addHatch(const DRW_Hatch *) { }
|
2017-06-21 11:34:20 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
/**
|
|
|
|
* Called for every viewport entity.
|
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addViewport(const DRW_Viewport &) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/**
|
2017-06-21 13:54:17 +02:00
|
|
|
* Called for every image entity.
|
|
|
|
*/
|
|
|
|
virtual void addImage(const DRW_Image *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-06-21 13:54:17 +02:00
|
|
|
/**
|
|
|
|
* Called for every image definition.
|
|
|
|
*/
|
|
|
|
virtual void linkImage(const DRW_ImageDef *) { }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for every comment in the DXF file (code 999).
|
|
|
|
*/
|
2017-06-21 13:54:17 +02:00
|
|
|
virtual void addComment(const char *) { }
|
|
|
|
|
|
|
|
virtual void writeHeader(DRW_Header &) { }
|
|
|
|
virtual void writeBlocks() { }
|
|
|
|
virtual void writeBlockRecords() { }
|
|
|
|
virtual void writeEntities() { }
|
|
|
|
virtual void writeLTypes() { }
|
|
|
|
virtual void writeLayers() { }
|
|
|
|
virtual void writeTextstyles() { }
|
|
|
|
virtual void writeVports() { }
|
|
|
|
virtual void writeDimstyles() { }
|
|
|
|
virtual void writeAppId() { }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|