2017-06-20 10:40:39 +02:00
|
|
|
/******************************************************************************
|
|
|
|
** libDXFrw - Library to read/write DXF files (ascii & binary) **
|
|
|
|
** **
|
2022-02-07 13:52:41 +01:00
|
|
|
** Copyright (C) 2016-2022 A. Stebich (librecad@mail.lordofbikes.de) **
|
2017-06-20 10:40:39 +02:00
|
|
|
** 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_ENTITIES_H
|
|
|
|
#define DRW_ENTITIES_H
|
|
|
|
|
|
|
|
#include "drw_base.h"
|
2023-08-21 16:24:10 +02:00
|
|
|
#include <QtGlobal>
|
2023-02-26 09:30:56 +01:00
|
|
|
#include <algorithm>
|
2023-08-21 16:24:10 +02:00
|
|
|
#include <list>
|
2023-11-20 11:23:56 +01:00
|
|
|
#include <memory>
|
2023-08-21 16:24:10 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
class dxfReader;
|
|
|
|
class DRW_Polyline;
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
namespace DRW
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Entity's type.
|
|
|
|
enum ETYPE
|
|
|
|
{
|
|
|
|
E3DFACE,
|
|
|
|
// E3DSOLID, //encripted propietry data
|
|
|
|
// ACAD_PROXY_ENTITY,
|
|
|
|
ARC,
|
2023-11-20 14:15:51 +01:00
|
|
|
ATTDEF,
|
2023-08-21 16:24:10 +02:00
|
|
|
// ATTRIB,
|
|
|
|
BLOCK, // and ENDBLK
|
|
|
|
// BODY, //encripted propietry data
|
|
|
|
CIRCLE,
|
|
|
|
DIMENSION,
|
|
|
|
DIMALIGNED,
|
|
|
|
DIMLINEAR,
|
|
|
|
DIMRADIAL,
|
|
|
|
DIMDIAMETRIC,
|
|
|
|
DIMANGULAR,
|
|
|
|
DIMANGULAR3P,
|
|
|
|
DIMORDINATE,
|
|
|
|
ELLIPSE,
|
|
|
|
HATCH,
|
|
|
|
// HELIX,
|
|
|
|
IMAGE,
|
|
|
|
INSERT,
|
|
|
|
LEADER,
|
|
|
|
// LIGHT,
|
|
|
|
LINE,
|
|
|
|
LWPOLYLINE,
|
|
|
|
// MESH,
|
|
|
|
// MLINE,
|
|
|
|
// MLEADERSTYLE,
|
|
|
|
// MLEADER,
|
|
|
|
MTEXT,
|
|
|
|
// OLEFRAME,
|
|
|
|
// OLE2FRAME,
|
|
|
|
POINT,
|
|
|
|
POLYLINE,
|
|
|
|
RAY,
|
|
|
|
// REGION, //encripted propietry data
|
|
|
|
// SECTION,
|
|
|
|
// SEQEND,//not needed?? used in polyline and insert/attrib and dwg
|
|
|
|
// SHAPE,
|
|
|
|
SOLID,
|
|
|
|
SPLINE,
|
|
|
|
// SUN,
|
|
|
|
// SURFACE, //encripted propietry data can be four types
|
|
|
|
// TABLE,
|
|
|
|
TEXT,
|
|
|
|
// TOLERANCE,
|
|
|
|
TRACE,
|
|
|
|
UNDERLAY,
|
|
|
|
VERTEX,
|
|
|
|
VIEWPORT,
|
|
|
|
// WIPEOUT, //WIPEOUTVARIABLE
|
|
|
|
XLINE,
|
|
|
|
ASTMNOTCH, // ASTM NOTCH
|
|
|
|
UNKNOWN
|
|
|
|
};
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
} // namespace DRW
|
|
|
|
// only in DWG: MINSERT, 5 types of vertex, 4 types of polylines: 2d, 3d, pface & mesh
|
|
|
|
// shape, dictionary, MLEADER, MLEADERSTYLE
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
#define SETENTFRIENDS friend class dxfRW;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
//! Base class for entities
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Base class for entities
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
// initializes default values
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Entity()
|
2023-08-21 16:24:10 +02:00
|
|
|
: eType(DRW::UNKNOWN),
|
|
|
|
handle(DRW::NoHandle),
|
|
|
|
appData(),
|
|
|
|
parentHandle(DRW::NoHandle),
|
|
|
|
space(DRW::ModelSpace),
|
|
|
|
layer("0"),
|
|
|
|
lineType("BYLAYER"),
|
|
|
|
material(DRW::MaterialByLayer),
|
|
|
|
color(DRW::ColorByLayer),
|
|
|
|
lWeight(DRW_LW_Conv::widthByLayer),
|
|
|
|
ltypeScale(1.0),
|
|
|
|
visible(true),
|
|
|
|
numProxyGraph(0),
|
|
|
|
proxyGraphics(),
|
|
|
|
color24(-1),
|
|
|
|
colorName(),
|
|
|
|
transparency(DRW::Opaque),
|
|
|
|
plotStyle(DRW::DefaultPlotStyle),
|
|
|
|
shadow(DRW::CastAndReceieveShadows),
|
|
|
|
haveExtrusion(false),
|
|
|
|
extData(),
|
|
|
|
extAxisX(),
|
|
|
|
extAxisY(),
|
|
|
|
curr(nullptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DRW_Entity(const DRW_Entity &e)
|
|
|
|
: eType(e.eType),
|
|
|
|
handle(e.handle),
|
|
|
|
appData(),
|
|
|
|
parentHandle(e.parentHandle),
|
|
|
|
space(e.space),
|
|
|
|
layer(e.layer),
|
|
|
|
lineType(e.lineType),
|
|
|
|
material(e.material),
|
|
|
|
color(e.color),
|
|
|
|
lWeight(e.lWeight),
|
|
|
|
ltypeScale(e.ltypeScale),
|
|
|
|
visible(e.visible),
|
|
|
|
numProxyGraph(e.numProxyGraph),
|
|
|
|
proxyGraphics(),
|
|
|
|
color24(e.color24),
|
|
|
|
colorName(),
|
|
|
|
transparency(e.transparency),
|
|
|
|
plotStyle(e.plotStyle),
|
|
|
|
shadow(e.shadow),
|
|
|
|
haveExtrusion(e.haveExtrusion),
|
|
|
|
extData(),
|
|
|
|
extAxisX(),
|
|
|
|
extAxisY(),
|
|
|
|
curr(nullptr /*e.curr*/)
|
|
|
|
{
|
|
|
|
for (std::vector<DRW_Variant *>::const_iterator it = e.extData.begin(); it != e.extData.end(); ++it)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
extData.push_back(new DRW_Variant(*(*it)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
virtual ~DRW_Entity()
|
|
|
|
{
|
|
|
|
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
|
2017-06-20 10:40:39 +02:00
|
|
|
delete *it;
|
|
|
|
|
|
|
|
extData.clear();
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void reset()
|
|
|
|
{
|
|
|
|
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
|
2017-06-20 10:40:39 +02:00
|
|
|
delete *it;
|
|
|
|
extData.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void applyExtrusion() = 0;
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void setWidthMm(double millimeters)
|
|
|
|
{
|
|
|
|
if (millimeters < 0.0)
|
|
|
|
{
|
2017-06-21 13:54:17 +02:00
|
|
|
lWeight = DRW_LW_Conv::widthByLayer;
|
|
|
|
return;
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
if (millimeters > 2.11)
|
|
|
|
millimeters = 2.11;
|
2017-06-21 13:54:17 +02:00
|
|
|
lWeight = DRW_LW_Conv::dxfInt2lineWidth(int(floor(millimeters * 100.0)));
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
protected:
|
2023-08-21 16:24:10 +02:00
|
|
|
// parses dxf pair to read entity
|
2023-11-20 11:23:56 +01:00
|
|
|
virtual auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool;
|
2023-08-21 16:24:10 +02:00
|
|
|
// calculates extrusion axis (normal vector)
|
2017-06-20 10:40:39 +02:00
|
|
|
void calculateAxis(DRW_Coord extPoint);
|
2023-08-21 16:24:10 +02:00
|
|
|
// apply extrusion to @extPoint and return data in @point
|
2017-07-06 11:58:26 +02:00
|
|
|
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
// parses dxf 102 groups to read entity
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseDxfGroups(int code, const std::unique_ptr<dxfReader> &reader) -> bool;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW::ETYPE eType; /*!< enum: entity type, code 0 */
|
|
|
|
duint32 handle; /*!< entity identifier, code 5 */
|
|
|
|
std::list<std::list<DRW_Variant>> appData; /*!< list of application data, code 102 */
|
|
|
|
duint32 parentHandle; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
|
|
|
|
DRW::Space space; /*!< space indicator, code 67*/
|
|
|
|
UTF8STRING layer; /*!< layer name, code 8 */
|
|
|
|
UTF8STRING lineType; /*!< line type, code 6 */
|
|
|
|
duint32 material; /*!< hard pointer id to material object, code 347 */
|
|
|
|
int color; /*!< entity color, code 62 */
|
|
|
|
DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
|
|
|
|
double ltypeScale; /*!< linetype scale, code 48 */
|
|
|
|
bool visible; /*!< entity visibility, code 60 */
|
|
|
|
int numProxyGraph; /*!< Number of bytes in proxy graphics, code 92 */
|
|
|
|
std::string proxyGraphics; /*!< proxy graphics bytes, code 310 */
|
|
|
|
int color24; /*!< 24-bit color, code 420 */
|
|
|
|
std::string colorName; /*!< color name, code 430 */
|
|
|
|
int transparency; /*!< transparency, code 440 */
|
|
|
|
int plotStyle; /*!< hard pointer id to plot style object, code 390 */
|
|
|
|
DRW::ShadowMode shadow; /*!< shadow mode, code 284 */
|
|
|
|
bool haveExtrusion; /*!< set to true if the entity have extrusion*/
|
|
|
|
std::vector<DRW_Variant *> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const DRW_Entity &) -> DRW_Entity &Q_DECL_EQ_DELETE;
|
2017-06-20 10:40:39 +02:00
|
|
|
DRW_Coord extAxisX;
|
|
|
|
DRW_Coord extAxisY;
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Variant *curr;
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle point entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle point entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Point : public DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Point() { eType = DRW::POINT; }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-04-06 17:21:24 +02:00
|
|
|
DRW_Coord basePoint{}; /*!< base point, code 10, 20 & 30 */
|
|
|
|
double thickness{0}; /*!< thickness, code 39 */
|
|
|
|
DRW_Coord extPoint{DRW_Coord(0, 0, 1)}; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
|
2017-06-20 10:40:39 +02:00
|
|
|
// TNick: we're not handling code 50 - Angle of the X axis for
|
|
|
|
// the UCS in effect when the point was drawn
|
|
|
|
};
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
class DRW_ASTMNotch : public DRW_Point
|
|
|
|
{
|
2020-03-15 12:35:31 +01:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2020-03-15 12:35:31 +01:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_ASTMNotch() { eType = DRW::ASTMNOTCH; }
|
2020-03-15 12:35:31 +01:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2020-03-15 12:35:31 +01:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double angle{0}; /*!< angle, code 50 */
|
2020-03-15 12:35:31 +01:00
|
|
|
};
|
|
|
|
|
2023-11-20 14:15:51 +01:00
|
|
|
class DRW_ATTDEF : public DRW_Point
|
|
|
|
{
|
|
|
|
SETENTFRIENDS
|
|
|
|
|
|
|
|
public:
|
|
|
|
DRW_ATTDEF() { eType = DRW::ATTDEF; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DRW_Coord adjustmentPoint{}; /*!< alignment point, code 11, 21 & 31 */
|
|
|
|
double height{0}; /*!< height text, code 40 */
|
|
|
|
UTF8STRING text{}; /*!< text string, code 1 */
|
|
|
|
UTF8STRING name{}; /*!< name, code 2 */
|
|
|
|
UTF8STRING promptString{}; /*!< prompt string, code 3 */
|
|
|
|
int flags{0}; /*!< flags, code 70 */
|
|
|
|
int horizontalAdjustment{0}; /*!< Horizontal text justification, code 72, default 0 */
|
|
|
|
};
|
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
//! Class to handle line entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle line entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Line : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Line()
|
2023-08-21 16:24:10 +02:00
|
|
|
: secPoint()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::LINE;
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle ray entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle ray entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Ray : public DRW_Line
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Ray() { eType = DRW::RAY; }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle xline entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle xline entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Xline : public DRW_Ray
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Xline() { eType = DRW::XLINE; }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle circle entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle circle entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Circle : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Circle()
|
2023-08-21 16:24:10 +02:00
|
|
|
: radious()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::CIRCLE;
|
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double radious; /*!< radius, code 40 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle arc entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle arc entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Arc : public DRW_Circle
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Arc()
|
2023-08-21 16:24:10 +02:00
|
|
|
: staangle(),
|
|
|
|
endangle(),
|
|
|
|
isccw(1)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::ARC;
|
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
//! center point in OCS
|
2023-05-03 13:07:02 +02:00
|
|
|
auto center() const -> const DRW_Coord & { return basePoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! the radius of the circle
|
2023-05-03 13:07:02 +02:00
|
|
|
auto radius() const -> double { return radious; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! start angle in radians
|
2023-05-03 13:07:02 +02:00
|
|
|
auto startAngle() const -> double { return staangle; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! end angle in radians
|
2023-05-03 13:07:02 +02:00
|
|
|
auto endAngle() const -> double { return endangle; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! thickness
|
2023-05-03 13:07:02 +02:00
|
|
|
auto thick() const -> double { return thickness; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! extrusion
|
2023-05-03 13:07:02 +02:00
|
|
|
auto extrusion() const -> const DRW_Coord & { return extPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//! interpret code in dxf reading process or dispatch to inherited class
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double staangle; /*!< start angle, code 50 in radians*/
|
|
|
|
double endangle; /*!< end angle, code 51 in radians */
|
|
|
|
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle ellipse entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle ellipse and elliptic arc entity
|
|
|
|
* Note: start/end parameter are in radians for ellipse entity but
|
|
|
|
* for hatch boundary are in degrees
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Ellipse : public DRW_Line
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Ellipse()
|
2023-08-21 16:24:10 +02:00
|
|
|
: ratio(),
|
|
|
|
staparam(),
|
|
|
|
endparam(),
|
|
|
|
isccw(1)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::ELLIPSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void toPolyline(DRW_Polyline *pol, int parts = 128);
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//! interpret code in dxf reading process or dispatch to inherited class
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void correctAxis();
|
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double ratio; /*!< ratio, code 40 */
|
|
|
|
double staparam; /*!< start parameter, code 41, 0.0 for full ellipse*/
|
|
|
|
double endparam; /*!< end parameter, code 42, 2*PI for full ellipse */
|
|
|
|
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle trace entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle trace entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Trace : public DRW_Line
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Trace()
|
2023-08-21 16:24:10 +02:00
|
|
|
: thirdPoint(),
|
|
|
|
fourPoint()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::TRACE;
|
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
|
|
|
|
DRW_Coord fourPoint; /*!< four point, code 13, 23 & 33 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle solid entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle solid entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Solid : public DRW_Trace
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Solid() { eType = DRW::SOLID; }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
//! first corner (2D)
|
2023-05-03 13:07:02 +02:00
|
|
|
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! second corner (2D)
|
2023-05-03 13:07:02 +02:00
|
|
|
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! third corner (2D)
|
2023-05-03 13:07:02 +02:00
|
|
|
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! fourth corner (2D)
|
2023-08-21 16:24:10 +02:00
|
|
|
auto fourthCorner() const -> const DRW_Coord & { return fourPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! thickness
|
2023-05-03 13:07:02 +02:00
|
|
|
auto thick() const -> double { return thickness; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! elevation
|
2023-05-03 13:07:02 +02:00
|
|
|
auto elevation() const -> double { return basePoint.z; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! extrusion
|
2023-05-03 13:07:02 +02:00
|
|
|
auto extrusion() const -> const DRW_Coord & { return extPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle 3dface entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle 3dface entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_3Dface : public DRW_Trace
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
enum InvisibleEdgeFlags
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
NoEdge = 0x00,
|
|
|
|
FirstEdge = 0x01,
|
|
|
|
SecodEdge = 0x02,
|
|
|
|
ThirdEdge = 0x04,
|
|
|
|
FourthEdge = 0x08,
|
|
|
|
AllEdges = 0x0F
|
|
|
|
};
|
|
|
|
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_3Dface()
|
2023-08-21 16:24:10 +02:00
|
|
|
: invisibleflag(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::E3DFACE;
|
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
//! first corner in WCS
|
2023-05-03 13:07:02 +02:00
|
|
|
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! second corner in WCS
|
2023-05-03 13:07:02 +02:00
|
|
|
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! third corner in WCS
|
2023-05-03 13:07:02 +02:00
|
|
|
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! fourth corner in WCS
|
2023-05-03 13:07:02 +02:00
|
|
|
auto fourthCorner() const -> const DRW_Coord & { return fourPoint; }
|
2017-06-20 10:40:39 +02:00
|
|
|
//! edge visibility flags
|
2023-05-03 13:07:02 +02:00
|
|
|
auto edgeFlags() const -> InvisibleEdgeFlags { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//! interpret code in dxf reading process or dispatch to inherited class
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
int invisibleflag; /*!< invisible edge flag, code 70 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle block entries
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle block entries
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Block : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Block()
|
2023-08-21 16:24:10 +02:00
|
|
|
: name("*U0"),
|
|
|
|
flags(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::BLOCK;
|
2018-04-12 12:13:19 +02:00
|
|
|
layer = '0';
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
UTF8STRING name; /*!< block name, code 2 */
|
|
|
|
int flags; /*!< block type, code 70 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle insert entries
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle insert entries
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Insert : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Insert()
|
2023-08-21 16:24:10 +02:00
|
|
|
: name(),
|
|
|
|
xscale(1),
|
|
|
|
yscale(1),
|
|
|
|
zscale(1),
|
|
|
|
angle(0),
|
|
|
|
colcount(1),
|
|
|
|
rowcount(1),
|
|
|
|
colspace(0),
|
|
|
|
rowspace(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::INSERT;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
UTF8STRING name; /*!< block name, code 2 */
|
|
|
|
double xscale; /*!< x scale factor, code 41 */
|
|
|
|
double yscale; /*!< y scale factor, code 42 */
|
|
|
|
double zscale; /*!< z scale factor, code 43 */
|
|
|
|
double angle; /*!< rotation angle in radians, code 50 */
|
|
|
|
int colcount; /*!< column count, code 70 */
|
|
|
|
int rowcount; /*!< row count, code 71 */
|
|
|
|
double colspace; /*!< column space, code 44 */
|
|
|
|
double rowspace; /*!< row space, code 45 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle lwpolyline entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle lwpolyline entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_LWPolyline : public DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_LWPolyline()
|
2023-08-21 16:24:10 +02:00
|
|
|
: vertexnum(),
|
|
|
|
flags(0),
|
|
|
|
width(0.0),
|
|
|
|
elevation(0.0),
|
|
|
|
thickness(0.0),
|
|
|
|
extPoint(DRW_Coord(0, 0, 1)),
|
|
|
|
vertex(nullptr),
|
|
|
|
vertlist()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::LWPOLYLINE;
|
|
|
|
}
|
2017-06-21 13:54:17 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_LWPolyline(const DRW_LWPolyline &p)
|
|
|
|
: DRW_Entity(p),
|
|
|
|
vertexnum(),
|
|
|
|
flags(p.flags),
|
|
|
|
width(p.width),
|
|
|
|
elevation(p.elevation),
|
|
|
|
thickness(p.thickness),
|
|
|
|
extPoint(p.extPoint),
|
|
|
|
vertex(nullptr),
|
|
|
|
vertlist()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
this->eType = DRW::LWPOLYLINE;
|
2023-08-21 16:24:10 +02:00
|
|
|
for (unsigned i = 0; i < p.vertlist.size(); i++) // RLZ ok or new
|
|
|
|
this->vertlist.push_back(new DRW_Vertex2D(*(p.vertlist.at(i))));
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
~DRW_LWPolyline()
|
|
|
|
{
|
|
|
|
for (DRW_Vertex2D *item : vertlist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override;
|
2023-08-21 16:24:10 +02:00
|
|
|
void addVertex(DRW_Vertex2D v)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
|
|
|
vert->x = v.x;
|
|
|
|
vert->y = v.y;
|
|
|
|
vert->stawidth = v.stawidth;
|
|
|
|
vert->endwidth = v.endwidth;
|
|
|
|
vert->bulge = v.bulge;
|
|
|
|
vertlist.push_back(vert);
|
|
|
|
}
|
2023-05-03 13:07:02 +02:00
|
|
|
auto addVertex() -> DRW_Vertex2D *
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
|
|
|
vert->stawidth = 0;
|
|
|
|
vert->endwidth = 0;
|
|
|
|
vert->bulge = 0;
|
|
|
|
vertlist.push_back(vert);
|
|
|
|
return vert;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
int vertexnum; /*!< number of vertex, code 90 */
|
|
|
|
int flags; /*!< polyline flag, code 70, default 0 */
|
|
|
|
double width; /*!< constant width, code 43 */
|
|
|
|
double elevation; /*!< elevation, code 38 */
|
|
|
|
double thickness; /*!< thickness, code 39 */
|
|
|
|
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
|
|
|
|
DRW_Vertex2D *vertex; /*!< current vertex to add data */
|
|
|
|
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
|
|
|
|
|
2017-07-05 18:35:34 +02:00
|
|
|
private:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const DRW_LWPolyline &) -> DRW_LWPolyline &Q_DECL_EQ_DELETE;
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle insert entries
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle insert entries
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Text : public DRW_Line
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
|
|
|
//! Vertical alignments.
|
2023-08-21 16:24:10 +02:00
|
|
|
enum VAlign
|
|
|
|
{
|
|
|
|
VBaseLine = 0, /*!< Top = 0 */
|
|
|
|
VBottom, /*!< Bottom = 1 */
|
|
|
|
VMiddle, /*!< Middle = 2 */
|
|
|
|
VTop /*!< Top = 3 */
|
|
|
|
};
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
//! Horizontal alignments.
|
2023-08-21 16:24:10 +02:00
|
|
|
enum HAlign
|
|
|
|
{
|
|
|
|
HLeft = 0, /*!< Left = 0 */
|
|
|
|
HCenter, /*!< Centered = 1 */
|
|
|
|
HRight, /*!< Right = 2 */
|
|
|
|
HAligned, /*!< Aligned = 3 (if VAlign==0) */
|
|
|
|
HMiddle, /*!< middle = 4 (if VAlign==0) */
|
|
|
|
HFit /*!< fit into point = 5 (if VAlign==0) */
|
|
|
|
};
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Text()
|
2023-08-21 16:24:10 +02:00
|
|
|
: height(),
|
|
|
|
text(),
|
|
|
|
angle(0),
|
|
|
|
widthscale(1),
|
|
|
|
oblique(0),
|
|
|
|
style("STANDARD"),
|
|
|
|
textgen(0),
|
|
|
|
alignH(HLeft),
|
|
|
|
alignV(VBaseLine)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::TEXT;
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void applyExtrusion() override {} // RLZ TODO
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double height; /*!< height text, code 40 */
|
|
|
|
UTF8STRING text; /*!< text string, code 1 */
|
|
|
|
double angle; /*!< rotation angle in degrees (360), code 50 */
|
|
|
|
double widthscale; /*!< width factor, code 41 */
|
|
|
|
double oblique; /*!< oblique angle, code 51 */
|
|
|
|
UTF8STRING style; /*!< style name, code 7 */
|
|
|
|
int textgen; /*!< text generation, code 71 */
|
|
|
|
HAlign alignH; /*!< horizontal align, code 72 */
|
|
|
|
VAlign alignV; /*!< vertical align, code 73 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle insert entries
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle insert entries
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_MText : public DRW_Text
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
|
|
|
//! Attachments.
|
2023-08-21 16:24:10 +02:00
|
|
|
enum Attach
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
TopLeft = 1,
|
|
|
|
TopCenter,
|
|
|
|
TopRight,
|
|
|
|
MiddleLeft,
|
|
|
|
MiddleCenter,
|
|
|
|
MiddleRight,
|
|
|
|
BottomLeft,
|
|
|
|
BottomCenter,
|
|
|
|
BottomRight
|
|
|
|
};
|
|
|
|
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_MText()
|
2023-08-21 16:24:10 +02:00
|
|
|
: interlin(1),
|
|
|
|
hasXAxisVec(false) // if true needed to recalculate angle
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::MTEXT;
|
2017-07-05 18:35:34 +02:00
|
|
|
alignV = static_cast<VAlign>(TopLeft);
|
2023-08-21 16:24:10 +02:00
|
|
|
textgen = 1;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2023-08-21 16:24:10 +02:00
|
|
|
void updateAngle(); // recalculate angle if 'haveXAxis' is true
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double interlin; /*!< width factor, code 44 */
|
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
private:
|
2021-11-23 13:43:26 +01:00
|
|
|
bool hasXAxisVec;
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle vertex
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle vertex for polyline entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Vertex final : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Vertex()
|
2023-08-21 16:24:10 +02:00
|
|
|
: stawidth(0),
|
|
|
|
endwidth(0),
|
|
|
|
bulge(0),
|
|
|
|
flags(0),
|
|
|
|
tgdir(),
|
|
|
|
vindex1(0),
|
|
|
|
vindex2(0),
|
|
|
|
vindex3(0),
|
|
|
|
vindex4(0),
|
|
|
|
identifier(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::VERTEX;
|
|
|
|
}
|
2017-07-05 18:35:34 +02:00
|
|
|
|
2017-07-16 20:10:48 +02:00
|
|
|
DRW_Vertex(double sx, double sy, double sz = 0.0, double b = 0.0)
|
2023-08-21 16:24:10 +02:00
|
|
|
: stawidth(0),
|
|
|
|
endwidth(0),
|
|
|
|
bulge(b),
|
|
|
|
flags(0),
|
|
|
|
tgdir(),
|
|
|
|
vindex1(0),
|
|
|
|
vindex2(0),
|
|
|
|
vindex3(0),
|
|
|
|
vindex4(0),
|
|
|
|
identifier(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
basePoint.x = sx;
|
2017-07-05 18:35:34 +02:00
|
|
|
basePoint.y = sy;
|
|
|
|
basePoint.z = sz;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double stawidth; /*!< Start width, code 40 */
|
|
|
|
double endwidth; /*!< End width, code 41 */
|
|
|
|
double bulge; /*!< bulge, code 42 */
|
|
|
|
|
|
|
|
int flags; /*!< vertex flag, code 70, default 0 */
|
|
|
|
double tgdir; /*!< curve fit tangent direction, code 50 */
|
|
|
|
int vindex1; /*!< polyface mesh vertex index, code 71, default 0 */
|
|
|
|
int vindex2; /*!< polyface mesh vertex index, code 72, default 0 */
|
|
|
|
int vindex3; /*!< polyface mesh vertex index, code 73, default 0 */
|
|
|
|
int vindex4; /*!< polyface mesh vertex index, code 74, default 0 */
|
|
|
|
int identifier; /*!< vertex identifier, code 91, default 0 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle polyline entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle polyline entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Polyline : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Polyline()
|
2023-08-21 16:24:10 +02:00
|
|
|
: flags(0),
|
|
|
|
defstawidth(0.0),
|
|
|
|
defendwidth(0.0),
|
|
|
|
vertexcount(0),
|
|
|
|
facecount(0),
|
|
|
|
smoothM(0),
|
|
|
|
smoothN(0),
|
|
|
|
curvetype(0),
|
|
|
|
vertlist(),
|
|
|
|
handlesList(),
|
|
|
|
firstEH(),
|
|
|
|
lastEH()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::POLYLINE;
|
|
|
|
basePoint.x = basePoint.y = 0.0;
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
|
|
|
|
DRW_Polyline(const DRW_Polyline &p)
|
|
|
|
: DRW_Point(p),
|
|
|
|
flags(p.flags),
|
|
|
|
defstawidth(p.defstawidth),
|
|
|
|
defendwidth(p.defendwidth),
|
|
|
|
vertexcount(p.vertexcount),
|
|
|
|
facecount(p.facecount),
|
|
|
|
smoothM(p.smoothM),
|
|
|
|
smoothN(p.smoothN),
|
|
|
|
curvetype(p.curvetype),
|
|
|
|
vertlist(),
|
|
|
|
handlesList(),
|
|
|
|
firstEH(),
|
|
|
|
lastEH()
|
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < p.vertlist.size(); i++) // RLZ ok or new
|
|
|
|
this->vertlist.push_back(new DRW_Vertex(*(p.vertlist.at(i))));
|
2017-06-21 13:54:17 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
|
|
|
|
~DRW_Polyline()
|
|
|
|
{
|
|
|
|
for (DRW_Vertex *item : vertlist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
void addVertex(DRW_Vertex v)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
DRW_Vertex *vert = new DRW_Vertex();
|
|
|
|
vert->basePoint.x = v.basePoint.x;
|
|
|
|
vert->basePoint.y = v.basePoint.y;
|
|
|
|
vert->basePoint.z = v.basePoint.z;
|
|
|
|
vert->stawidth = v.stawidth;
|
|
|
|
vert->endwidth = v.endwidth;
|
|
|
|
vert->bulge = v.bulge;
|
|
|
|
vertlist.push_back(vert);
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
void appendVertex(DRW_Vertex *v) { vertlist.push_back(v); }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
int flags; /*!< polyline flag, code 70, default 0 */
|
|
|
|
double defstawidth; /*!< Start width, code 40, default 0 */
|
|
|
|
double defendwidth; /*!< End width, code 41, default 0 */
|
|
|
|
int vertexcount; /*!< polygon mesh M vertex or polyface vertex num, code 71, default 0 */
|
|
|
|
int facecount; /*!< polygon mesh N vertex or polyface face num, code 72, default 0 */
|
|
|
|
int smoothM; /*!< smooth surface M density, code 73, default 0 */
|
|
|
|
int smoothN; /*!< smooth surface M density, code 74, default 0 */
|
|
|
|
int curvetype; /*!< curves & smooth surface type, code 75, default 0 */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
std::vector<DRW_Vertex *> vertlist; /*!< vertex list */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const DRW_Polyline &) -> DRW_Polyline &Q_DECL_EQ_DELETE;
|
2023-08-21 16:24:10 +02:00
|
|
|
std::list<duint32> handlesList; // list of handles, only in 2004+
|
|
|
|
duint32 firstEH; // handle of first entity, only in pre-2004
|
|
|
|
duint32 lastEH; // handle of last entity, only in pre-2004
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle spline entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle spline entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Spline : public DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Spline()
|
2023-08-21 16:24:10 +02:00
|
|
|
: normalVec(),
|
|
|
|
tgStart(),
|
|
|
|
tgEnd(),
|
|
|
|
flags(0),
|
|
|
|
degree(),
|
|
|
|
nknots(0),
|
|
|
|
ncontrol(0),
|
|
|
|
nfit(0),
|
|
|
|
tolknot(0.0000001),
|
|
|
|
tolcontrol(0.0000001),
|
|
|
|
tolfit(0.0000001),
|
|
|
|
knotslist(),
|
|
|
|
weightlist(),
|
|
|
|
controllist(),
|
|
|
|
fitlist(),
|
|
|
|
controlpoint(),
|
|
|
|
fitpoint()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::SPLINE;
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
|
|
|
|
DRW_Spline(const DRW_Spline &p)
|
|
|
|
: DRW_Entity(p),
|
|
|
|
normalVec(p.normalVec),
|
|
|
|
tgStart(p.tgStart),
|
|
|
|
tgEnd(p.tgEnd),
|
|
|
|
flags(p.flags),
|
|
|
|
degree(p.degree),
|
|
|
|
nknots(p.nknots),
|
|
|
|
ncontrol(p.ncontrol),
|
|
|
|
nfit(p.nfit),
|
|
|
|
tolknot(p.tolknot),
|
|
|
|
tolcontrol(p.tolcontrol),
|
|
|
|
tolfit(p.tolfit),
|
|
|
|
knotslist(),
|
|
|
|
weightlist(),
|
|
|
|
controllist(),
|
|
|
|
fitlist(),
|
|
|
|
controlpoint(),
|
|
|
|
fitpoint()
|
|
|
|
{
|
|
|
|
eType = DRW::SPLINE;
|
2022-08-08 14:25:14 +02:00
|
|
|
|
|
|
|
std::copy(p.knotslist.begin(), p.knotslist.end(), std::back_inserter(knotslist));
|
|
|
|
std::copy(p.weightlist.begin(), p.weightlist.end(), std::back_inserter(weightlist));
|
|
|
|
std::transform(p.controllist.cbegin(), p.controllist.cend(), std::back_inserter(controllist),
|
|
|
|
[](DRW_Coord *v) { return new DRW_Coord(*v); });
|
|
|
|
std::transform(p.fitlist.cbegin(), p.fitlist.cend(), std::back_inserter(fitlist),
|
|
|
|
[](DRW_Coord *v) { return new DRW_Coord(*v); });
|
2017-06-21 13:54:17 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
|
|
|
|
~DRW_Spline()
|
|
|
|
{
|
|
|
|
for (DRW_Coord *item : controllist)
|
|
|
|
delete item;
|
|
|
|
for (DRW_Coord *item : fitlist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
// double ex; /*!< normal vector x coordinate, code 210 */
|
|
|
|
// double ey; /*!< normal vector y coordinate, code 220 */
|
|
|
|
// double ez; /*!< normal vector z coordinate, code 230 */
|
|
|
|
DRW_Coord normalVec; /*!< normal vector, code 210, 220, 230 */
|
|
|
|
DRW_Coord tgStart; /*!< start tangent, code 12, 22, 32 */
|
|
|
|
// double tgsx; /*!< start tangent x coordinate, code 12 */
|
|
|
|
// double tgsy; /*!< start tangent y coordinate, code 22 */
|
|
|
|
// double tgsz; /*!< start tangent z coordinate, code 32 */
|
|
|
|
DRW_Coord tgEnd; /*!< end tangent, code 13, 23, 33 */
|
|
|
|
// double tgex; /*!< end tangent x coordinate, code 13 */
|
|
|
|
// double tgey; /*!< end tangent y coordinate, code 23 */
|
|
|
|
// double tgez; /*!< end tangent z coordinate, code 33 */
|
|
|
|
int flags; /*!< spline flag, code 70 */
|
|
|
|
int degree; /*!< degree of the spline, code 71 */
|
|
|
|
dint32 nknots; /*!< number of knots, code 72, default 0 */
|
|
|
|
dint32 ncontrol; /*!< number of control points, code 73, default 0 */
|
|
|
|
dint32 nfit; /*!< number of fit points, code 74, default 0 */
|
|
|
|
double tolknot; /*!< knot tolerance, code 42, default 0.0000001 */
|
|
|
|
double tolcontrol; /*!< control point tolerance, code 43, default 0.0000001 */
|
|
|
|
double tolfit; /*!< fit point tolerance, code 44, default 0.0000001 */
|
|
|
|
|
|
|
|
std::vector<double> knotslist; /*!< knots list, code 40 */
|
|
|
|
std::vector<double> weightlist; /*!< weight list, code 41 */
|
|
|
|
std::vector<DRW_Coord *> controllist; /*!< control points list, code 10, 20 & 30 */
|
|
|
|
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const DRW_Spline &) -> DRW_Spline &Q_DECL_EQ_DELETE;
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Coord *controlpoint; /*!< current control point to add data */
|
|
|
|
DRW_Coord *fitpoint; /*!< current fit point to add data */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle hatch loop
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle hatch loop
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_HatchLoop
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-06 11:58:26 +02:00
|
|
|
explicit DRW_HatchLoop(int t)
|
2023-08-21 16:24:10 +02:00
|
|
|
: type(t),
|
|
|
|
numedges(0),
|
|
|
|
objlist()
|
|
|
|
{
|
|
|
|
}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
~DRW_HatchLoop()
|
|
|
|
{
|
2017-06-21 13:54:17 +02:00
|
|
|
// for(DRW_LWPolyline *item : pollist) delete item;
|
2023-08-21 16:24:10 +02:00
|
|
|
for (DRW_Entity *item : objlist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void update() { numedges = static_cast<int>(objlist.size()); }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
int type; /*!< boundary path type, code 92, polyline=2, default=0 */
|
|
|
|
int numedges; /*!< number of edges (if not a polyline), code 93 */
|
|
|
|
// TODO: store lwpolylines as entities
|
|
|
|
// std::vector<DRW_LWPolyline *> pollist; /*!< polyline list */
|
|
|
|
std::vector<DRW_Entity *> objlist; /*!< entities list */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle hatch entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle hatch entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
// TODO: handle lwpolylines, splines and ellipses
|
|
|
|
class DRW_Hatch : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Hatch()
|
2023-08-21 16:24:10 +02:00
|
|
|
: name(),
|
|
|
|
solid(1),
|
|
|
|
associative(0),
|
|
|
|
hstyle(0),
|
|
|
|
hpattern(1),
|
|
|
|
doubleflag(0),
|
|
|
|
loopsnum(0),
|
|
|
|
angle(0.0),
|
|
|
|
scale(0.0),
|
|
|
|
deflines(0),
|
|
|
|
looplist(),
|
|
|
|
loop(nullptr),
|
|
|
|
line(),
|
|
|
|
arc(),
|
|
|
|
ellipse(),
|
|
|
|
spline(),
|
|
|
|
pline(),
|
|
|
|
pt(),
|
|
|
|
plvert(),
|
|
|
|
ispol()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::HATCH;
|
|
|
|
basePoint.x = basePoint.y = basePoint.z = 0.0;
|
|
|
|
clearEntities();
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
~DRW_Hatch()
|
|
|
|
{
|
|
|
|
for (DRW_HatchLoop *item : looplist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void appendLoop(DRW_HatchLoop *v) { looplist.push_back(v); }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
UTF8STRING name; /*!< hatch pattern name, code 2 */
|
|
|
|
int solid; /*!< solid fill flag, code 70, solid=1, pattern=0 */
|
|
|
|
int associative; /*!< associativity, code 71, associatve=1, non-assoc.=0 */
|
|
|
|
int hstyle; /*!< hatch style, code 75 */
|
|
|
|
int hpattern; /*!< hatch pattern type, code 76 */
|
|
|
|
int doubleflag; /*!< hatch pattern double flag, code 77, double=1, single=0 */
|
|
|
|
int loopsnum; /*!< namber of boundary paths (loops), code 91 */
|
|
|
|
double angle; /*!< hatch pattern angle, code 52 */
|
|
|
|
double scale; /*!< hatch pattern scale, code 41 */
|
|
|
|
int deflines; /*!< number of pattern definition lines, code 78 */
|
|
|
|
|
|
|
|
std::vector<DRW_HatchLoop *> looplist; /*!< polyline list */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
2022-08-12 17:50:13 +02:00
|
|
|
// cppcheck-suppress unknownMacro
|
|
|
|
Q_DISABLE_COPY_MOVE(DRW_Hatch) // NOLINT
|
2023-08-21 16:24:10 +02:00
|
|
|
void clearEntities()
|
|
|
|
{
|
2017-07-05 18:35:34 +02:00
|
|
|
pt = line = nullptr;
|
|
|
|
pline = nullptr;
|
|
|
|
arc = nullptr;
|
|
|
|
ellipse = nullptr;
|
|
|
|
spline = nullptr;
|
|
|
|
plvert = nullptr;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void addLine()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
clearEntities();
|
2023-08-21 16:24:10 +02:00
|
|
|
if (loop)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
pt = line = new DRW_Line;
|
|
|
|
loop->objlist.push_back(line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void addArc()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
clearEntities();
|
2023-08-21 16:24:10 +02:00
|
|
|
if (loop)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
pt = arc = new DRW_Arc;
|
|
|
|
loop->objlist.push_back(arc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void addEllipse()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
clearEntities();
|
2023-08-21 16:24:10 +02:00
|
|
|
if (loop)
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
pt = ellipse = new DRW_Ellipse;
|
|
|
|
loop->objlist.push_back(ellipse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
void addSpline()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
clearEntities();
|
2023-08-21 16:24:10 +02:00
|
|
|
if (loop)
|
|
|
|
{
|
2017-07-05 18:35:34 +02:00
|
|
|
pt = nullptr;
|
2017-06-20 10:40:39 +02:00
|
|
|
spline = new DRW_Spline;
|
|
|
|
loop->objlist.push_back(spline);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_HatchLoop *loop; /*!< current loop to add data */
|
2017-06-20 10:40:39 +02:00
|
|
|
DRW_Line *line;
|
|
|
|
DRW_Arc *arc;
|
|
|
|
DRW_Ellipse *ellipse;
|
|
|
|
DRW_Spline *spline;
|
|
|
|
DRW_LWPolyline *pline;
|
|
|
|
DRW_Point *pt;
|
|
|
|
DRW_Vertex2D *plvert;
|
|
|
|
bool ispol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle image entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle image entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Image : public DRW_Line
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Image()
|
2023-08-21 16:24:10 +02:00
|
|
|
: ref(),
|
|
|
|
vVector(),
|
|
|
|
sizeu(),
|
|
|
|
sizev(),
|
|
|
|
dz(),
|
|
|
|
clip(0),
|
|
|
|
brightness(50),
|
|
|
|
contrast(50),
|
|
|
|
fade(0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::IMAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
duint32 ref; /*!< Hard reference to imagedef object, code 340 */
|
|
|
|
DRW_Coord vVector; /*!< V-vector of single pixel, x coordinate, code 12, 22 & 32 */
|
|
|
|
// double vx; /*!< V-vector of single pixel, x coordinate, code 12 */
|
|
|
|
// double vy; /*!< V-vector of single pixel, y coordinate, code 22 */
|
|
|
|
// double vz; /*!< V-vector of single pixel, z coordinate, code 32 */
|
|
|
|
double sizeu; /*!< image size in pixels, U value, code 13 */
|
|
|
|
double sizev; /*!< image size in pixels, V value, code 23 */
|
|
|
|
double dz; /*!< z coordinate, code 33 */
|
|
|
|
int clip; /*!< Clipping state, code 280, 0=off 1=on */
|
|
|
|
int brightness; /*!< Brightness value, code 281, (0-100) default 50 */
|
|
|
|
int contrast; /*!< Brightness value, code 282, (0-100) default 50 */
|
|
|
|
int fade; /*!< Brightness value, code 283, (0-100) default 0 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Base class for dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Base class for dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Dimension : public DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Dimension()
|
2023-08-21 16:24:10 +02:00
|
|
|
: type(0),
|
|
|
|
name(),
|
|
|
|
defPoint(),
|
|
|
|
textPoint(),
|
|
|
|
text(),
|
|
|
|
style("STANDARD"),
|
|
|
|
align(5),
|
|
|
|
linesty(1),
|
|
|
|
linefactor(1.0),
|
|
|
|
rot(0.0),
|
|
|
|
extPoint(DRW_Coord(0, 0, 1.0)),
|
|
|
|
hdir(),
|
|
|
|
clonePoint(),
|
|
|
|
def1(),
|
|
|
|
def2(),
|
|
|
|
angle(0.0),
|
|
|
|
oblique(0.0),
|
|
|
|
circlePoint(),
|
|
|
|
arcPoint(),
|
|
|
|
length(0.0),
|
|
|
|
hasActual(false),
|
|
|
|
actual(0.0)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMENSION;
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Dimension(const DRW_Dimension &d)
|
|
|
|
: DRW_Entity(d),
|
|
|
|
type(d.type),
|
|
|
|
name(d.name),
|
|
|
|
defPoint(d.defPoint),
|
|
|
|
textPoint(d.textPoint),
|
|
|
|
text(d.text),
|
|
|
|
style(d.style),
|
|
|
|
align(d.align),
|
|
|
|
linesty(d.linesty),
|
|
|
|
linefactor(d.linefactor),
|
|
|
|
rot(d.rot),
|
|
|
|
extPoint(d.extPoint),
|
|
|
|
hdir(),
|
|
|
|
clonePoint(d.clonePoint),
|
|
|
|
def1(d.def1),
|
|
|
|
def2(d.def2),
|
|
|
|
angle(d.angle),
|
|
|
|
oblique(d.oblique),
|
|
|
|
circlePoint(d.circlePoint),
|
|
|
|
arcPoint(d.arcPoint),
|
|
|
|
length(d.length),
|
|
|
|
hasActual(d.hasActual),
|
|
|
|
actual(d.actual)
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMENSION;
|
2023-08-21 16:24:10 +02:00
|
|
|
// RLZ needed a def value for this: hdir = ???
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-11-20 11:23:56 +01:00
|
|
|
~DRW_Dimension() override = default;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDefPoint() const -> DRW_Coord { return defPoint; } /*!< Definition point, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDefPoint(const DRW_Coord &p) { defPoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getTextPoint() const -> DRW_Coord { return textPoint; } /*!< Middle point of text, code 11, 21 & 31 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setTextPoint(const DRW_Coord &p) { textPoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getStyle() const -> std::string { return style; } /*!< Dimension style, code 3 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setStyle(const std::string &s) { style = s; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getAlign() const -> int { return align; } /*!< attachment point, code 71 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setAlign(const int a) { align = a; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getTextLineStyle() const -> int
|
|
|
|
{
|
|
|
|
return linesty;
|
|
|
|
} /*!< Dimension text line spacing style, code 72, default 1 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setTextLineStyle(const int l) { linesty = l; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getText() const -> std::string { return text; } /*!< Dimension text explicitly entered by the user, code 1 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setText(const std::string &t) { text = t; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getTextLineFactor() const -> double
|
|
|
|
{
|
|
|
|
return linefactor;
|
|
|
|
} /*!< Dimension text line spacing factor, code 41, default 1? */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setTextLineFactor(const double l) { linefactor = l; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDir() const -> double
|
|
|
|
{
|
|
|
|
return rot;
|
|
|
|
} /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDir(const double d) { rot = d; }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getExtrusion() const -> DRW_Coord { return extPoint; } /*!< extrusion, code 210, 220 & 230 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setExtrusion(const DRW_Coord &p) { extPoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getName() const -> std::string { return name; } /*!< Name of the block that contains the entities, code 2 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setName(const std::string &s) { name = s; }
|
|
|
|
// int getType(){ return type;} /*!< Dimension type, code 70 */
|
2023-05-03 13:07:02 +02:00
|
|
|
auto hasActualMeasurement() const -> bool { return hasActual; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setActualMeasurement(double value)
|
|
|
|
{
|
|
|
|
hasActual = true;
|
|
|
|
actual = value;
|
|
|
|
}
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getActualMeasurement() const -> double { return actual; }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPt2() const -> DRW_Coord { return clonePoint; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setPt2(const DRW_Coord &p) { clonePoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPt3() const -> DRW_Coord { return def1; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setPt3(const DRW_Coord &p) { def1 = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPt4() const -> DRW_Coord { return def2; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setPt4(const DRW_Coord &p) { def2 = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPt5() const -> DRW_Coord { return circlePoint; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setPt5(const DRW_Coord &p) { circlePoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getPt6() const -> DRW_Coord { return arcPoint; }
|
2023-08-21 16:24:10 +02:00
|
|
|
void setPt6(const DRW_Coord &p) { arcPoint = p; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getAn50() const -> double
|
|
|
|
{
|
|
|
|
return angle;
|
|
|
|
} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setAn50(const double d) { angle = d; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getOb52() const -> double { return oblique; } /*!< oblique angle, code 52 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setOb52(const double d) { oblique = d; }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getRa40() const -> double { return length; } /*!< Leader length, code 40 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setRa40(const double d) { length = d; }
|
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
int type; /*!< Dimension type, code 70 */
|
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
private:
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const DRW_Dimension &) -> DRW_Dimension &Q_DECL_EQ_DELETE;
|
2023-08-21 16:24:10 +02:00
|
|
|
std::string name; /*!< Name of the block that contains the entities, code 2 */
|
|
|
|
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
|
|
|
|
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
|
|
|
|
UTF8STRING text; /*!< Dimension text explicitly entered by the user, code 1 */
|
|
|
|
UTF8STRING style; /*!< Dimension style, code 3 */
|
|
|
|
int align; /*!< attachment point, code 71 */
|
|
|
|
int linesty; /*!< Dimension text line spacing style, code 72, default 1 */
|
|
|
|
double linefactor; /*!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00*/
|
|
|
|
double rot; /*!< rotation angle of the dimension text, code 53 */
|
|
|
|
DRW_Coord extPoint; /*!< extrusion normal vector, code 210, 220 & 230 */
|
|
|
|
|
|
|
|
double hdir; /*!< horizontal direction for the dimension, code 51, default ? */
|
|
|
|
DRW_Coord clonePoint; /*!< Insertion point for clones (Baseline & Continue), code 12, 22 & 32 (OCS) */
|
|
|
|
DRW_Coord def1; /*!< Definition point 1for linear & angular, code 13, 23 & 33 (WCS) */
|
|
|
|
DRW_Coord def2; /*!< Definition point 2, code 14, 24 & 34 (WCS) */
|
|
|
|
double angle; /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
|
|
|
double oblique; /*!< oblique angle, code 52 */
|
|
|
|
|
|
|
|
DRW_Coord circlePoint; /*!< Definition point for diameter, radius & angular dims code 15, 25 & 35 (WCS) */
|
|
|
|
DRW_Coord arcPoint; /*!< Point defining dimension arc, x coordinate, code 16, 26 & 36 (OCS) */
|
|
|
|
double length; /*!< Leader length, code 40 */
|
|
|
|
bool hasActual; /*!< Actual measurement has been read, code 42 */
|
|
|
|
double actual; /*!< Actual measurement (optional; read-only value), code 42 */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle aligned dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle aligned dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimAligned : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimAligned()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMALIGNED;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 1;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimAligned(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMALIGNED;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getClonepoint() const -> DRW_Coord
|
|
|
|
{
|
|
|
|
return getPt2();
|
|
|
|
} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setClonePoint(const DRW_Coord &c) { setPt2(c); }
|
2017-06-20 10:40:39 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDimPoint() const -> DRW_Coord { return getDefPoint(); } /*!< dim line location point, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDimPoint(const DRW_Coord &p) { setDefPoint(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDef1Point() const -> DRW_Coord { return getPt3(); } /*!< Definition point 1, code 13, 23 & 33 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDef1Point(const DRW_Coord &p) { setPt3(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDef2Point() const -> DRW_Coord { return getPt4(); } /*!< Definition point 2, code 14, 24 & 34 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDef2Point(const DRW_Coord &p) { setPt4(p); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle linear or rotated dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle linear or rotated dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimLinear : public DRW_DimAligned
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimLinear()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMLINEAR;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 0;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimLinear(const DRW_Dimension &d)
|
|
|
|
: DRW_DimAligned(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMLINEAR;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getAngle() const -> double
|
|
|
|
{
|
|
|
|
return getAn50();
|
|
|
|
} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setAngle(const double d) { setAn50(d); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getOblique() const -> double { return getOb52(); } /*!< oblique angle, code 52 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setOblique(const double d) { setOb52(d); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle radial dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle aligned, linear or rotated dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimRadial : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimRadial()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMRADIAL;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 4;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimRadial(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMRADIAL;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getCenterPoint() const -> DRW_Coord { return getDefPoint(); } /*!< center point, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setCenterPoint(const DRW_Coord &p) { setDefPoint(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDiameterPoint() const -> DRW_Coord
|
|
|
|
{
|
|
|
|
return getPt5();
|
|
|
|
} /*!< Definition point for radius, code 15, 25 & 35 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDiameterPoint(const DRW_Coord &p) { setPt5(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getLeaderLength() const -> double { return getRa40(); } /*!< Leader length, code 40 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setLeaderLength(const double d) { setRa40(d); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle radial dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle aligned, linear or rotated dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimDiametric : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimDiametric()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMDIAMETRIC;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 3;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimDiametric(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMDIAMETRIC;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDiameter1Point() const -> DRW_Coord
|
|
|
|
{
|
|
|
|
return getPt5();
|
|
|
|
} /*!< First definition point for diameter, code 15, 25 & 35 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDiameter1Point(const DRW_Coord &p) { setPt5(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDiameter2Point() const -> DRW_Coord
|
|
|
|
{
|
|
|
|
return getDefPoint();
|
|
|
|
} /*!< Opposite point for diameter, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDiameter2Point(const DRW_Coord &p) { setDefPoint(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getLeaderLength() const -> double { return getRa40(); } /*!< Leader length, code 40 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setLeaderLength(const double d) { setRa40(d); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle angular dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle angular dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimAngular : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimAngular()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMANGULAR;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 2;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimAngular(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMANGULAR;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getFirstLine1() const -> DRW_Coord { return getPt3(); } /*!< Definition point line 1-1, code 13, 23 & 33 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setFirstLine1(const DRW_Coord &p) { setPt3(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getFirstLine2() const -> DRW_Coord { return getPt4(); } /*!< Definition point line 1-2, code 14, 24 & 34 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setFirstLine2(const DRW_Coord &p) { setPt4(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getSecondLine1() const -> DRW_Coord { return getPt5(); } /*!< Definition point line 2-1, code 15, 25 & 35 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setSecondLine1(const DRW_Coord &p) { setPt5(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getSecondLine2() const -> DRW_Coord
|
|
|
|
{
|
|
|
|
return getDefPoint();
|
|
|
|
} /*!< Definition point line 2-2, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setSecondLine2(const DRW_Coord &p) { setDefPoint(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDimPoint() const -> DRW_Coord { return getPt6(); } /*!< Dimension definition point, code 16, 26 & 36 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDimPoint(const DRW_Coord &p) { setPt6(p); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle angular 3p dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle angular 3p dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimAngular3p : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimAngular3p()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMANGULAR3P;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 5;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimAngular3p(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMANGULAR3P;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getFirstLine() const -> DRW_Coord { return getPt3(); } /*!< Definition point line 1, code 13, 23 & 33 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setFirstLine(const DRW_Coord &p) { setPt3(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getSecondLine() const -> DRW_Coord { return getPt4(); } /*!< Definition point line 2, code 14, 24 & 34 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setSecondLine(const DRW_Coord &p) { setPt4(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getVertexPoint() const -> DRW_Coord { return getPt5(); } /*!< Vertex point, code 15, 25 & 35 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void SetVertexPoint(const DRW_Coord &p) { setPt5(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getDimPoint() const -> DRW_Coord { return getDefPoint(); } /*!< Dimension definition point, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setDimPoint(const DRW_Coord &p) { setDefPoint(p); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle ordinate dimension entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle ordinate dimension entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_DimOrdinate : public DRW_Dimension
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_DimOrdinate()
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMORDINATE;
|
2017-06-21 13:54:17 +02:00
|
|
|
type = 6;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
explicit DRW_DimOrdinate(const DRW_Dimension &d)
|
|
|
|
: DRW_Dimension(d)
|
2017-07-06 11:58:26 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::DIMORDINATE;
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getOriginPoint() const -> DRW_Coord { return getDefPoint(); } /*!< Origin definition point, code 10, 20 & 30 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setOriginPoint(const DRW_Coord &p) { setDefPoint(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getFirstLine() const -> DRW_Coord { return getPt3(); } /*!< Feature location point, code 13, 23 & 33 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setFirstLine(const DRW_Coord &p) { setPt3(p); }
|
2023-05-03 13:07:02 +02:00
|
|
|
auto getSecondLine() const -> DRW_Coord { return getPt4(); } /*!< Leader end point, code 14, 24 & 34 */
|
2023-08-21 16:24:10 +02:00
|
|
|
void setSecondLine(const DRW_Coord &p) { setPt4(p); }
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle leader entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle leader entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Leader : public DRW_Entity
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Leader()
|
2023-08-21 16:24:10 +02:00
|
|
|
: style(),
|
|
|
|
arrow(1),
|
|
|
|
leadertype(0),
|
|
|
|
flag(3),
|
|
|
|
hookline(),
|
|
|
|
hookflag(0),
|
|
|
|
textheight(),
|
|
|
|
textwidth(),
|
|
|
|
vertnum(0),
|
|
|
|
coloruse(),
|
|
|
|
annotHandle(),
|
|
|
|
extrusionPoint(DRW_Coord(0, 0, 1.0)),
|
|
|
|
horizdir(),
|
|
|
|
offsetblock(),
|
|
|
|
offsettext(),
|
|
|
|
vertexlist(),
|
|
|
|
vertexpoint()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::LEADER;
|
|
|
|
}
|
2023-08-21 16:24:10 +02:00
|
|
|
~DRW_Leader()
|
|
|
|
{
|
|
|
|
for (DRW_Coord *item : vertexlist)
|
|
|
|
delete item;
|
2017-06-20 10:40:39 +02:00
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
UTF8STRING style; /*!< Dimension style name, code 3 */
|
|
|
|
int arrow; /*!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled */
|
|
|
|
int leadertype; /*!< Leader path type, code 72, 0=Straight line segments; 1=Spline */
|
|
|
|
int flag; /*!< Leader creation flag, code 73, default 3 */
|
|
|
|
int hookline; /*!< Hook line direction flag, code 74, default 1 */
|
|
|
|
int hookflag; /*!< Hook line flag, code 75 */
|
|
|
|
double textheight; /*!< Text annotation height, code 40 */
|
|
|
|
double textwidth; /*!< Text annotation width, code 41 */
|
|
|
|
int vertnum; /*!< Number of vertices, code 76 */
|
|
|
|
int coloruse; /*!< Color to use if leader's DIMCLRD = BYBLOCK, code 77 */
|
|
|
|
duint32 annotHandle; /*!< Hard reference to associated annotation, code 340 */
|
|
|
|
DRW_Coord extrusionPoint; /*!< Normal vector, code 210, 220 & 230 */
|
|
|
|
DRW_Coord horizdir; /*!< "Horizontal" direction for leader, code 211, 221 & 231 */
|
|
|
|
DRW_Coord offsetblock; /*!< Offset of last leader vertex from block, code 212, 222 & 232 */
|
|
|
|
DRW_Coord offsettext; /*!< Offset of last leader vertex from annotation, code 213, 223 & 233 */
|
|
|
|
|
|
|
|
std::vector<DRW_Coord *> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(DRW_Leader) // NOLINT
|
2023-08-21 16:24:10 +02:00
|
|
|
DRW_Coord *vertexpoint; /*!< current control point to add data */
|
2017-06-20 10:40:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//! Class to handle viewport entity
|
|
|
|
/*!
|
2023-08-21 16:24:10 +02:00
|
|
|
* Class to handle viewport entity
|
|
|
|
* @author Rallaz
|
|
|
|
*/
|
|
|
|
class DRW_Viewport : public DRW_Point
|
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
SETENTFRIENDS
|
2023-08-21 16:24:10 +02:00
|
|
|
|
2017-06-20 10:40:39 +02:00
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
DRW_Viewport()
|
2023-08-21 16:24:10 +02:00
|
|
|
: pswidth(205),
|
|
|
|
psheight(156),
|
|
|
|
vpstatus(0),
|
|
|
|
vpID(),
|
|
|
|
centerPX(128.5),
|
|
|
|
centerPY(97.5),
|
|
|
|
snapPX(),
|
|
|
|
snapPY(),
|
|
|
|
snapSpPX(),
|
|
|
|
snapSpPY(),
|
|
|
|
viewDir(),
|
|
|
|
viewTarget(),
|
|
|
|
viewLength(),
|
|
|
|
frontClip(),
|
|
|
|
backClip(),
|
|
|
|
viewHeight(),
|
|
|
|
snapAngle(),
|
|
|
|
twistAngle(),
|
|
|
|
frozenLyCount()
|
2017-07-05 18:35:34 +02:00
|
|
|
{
|
2017-06-20 10:40:39 +02:00
|
|
|
eType = DRW::VIEWPORT;
|
|
|
|
}
|
|
|
|
|
2022-02-07 13:52:41 +01:00
|
|
|
void applyExtrusion() override {}
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
protected:
|
2023-11-20 11:23:56 +01:00
|
|
|
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
public:
|
2023-08-21 16:24:10 +02:00
|
|
|
double pswidth; /*!< Width in paper space units, code 40 */
|
|
|
|
double psheight; /*!< Height in paper space units, code 41 */
|
|
|
|
int vpstatus; /*!< Viewport status, code 68 */
|
|
|
|
int vpID; /*!< Viewport ID, code 69 */
|
|
|
|
double centerPX; /*!< view center point X, code 12 */
|
|
|
|
double centerPY; /*!< view center point Y, code 22 */
|
|
|
|
double snapPX; /*!< Snap base point X, code 13 */
|
|
|
|
double snapPY; /*!< Snap base point Y, code 23 */
|
|
|
|
double snapSpPX; /*!< Snap spacing X, code 14 */
|
|
|
|
double snapSpPY; /*!< Snap spacing Y, code 24 */
|
|
|
|
// TODO: complete in dxf
|
|
|
|
DRW_Coord viewDir; /*!< View direction vector, code 16, 26 & 36 */
|
|
|
|
DRW_Coord viewTarget; /*!< View target point, code 17, 27, 37 */
|
|
|
|
double viewLength; /*!< Perspective lens length, code 42 */
|
|
|
|
double frontClip; /*!< Front clip plane Z value, code 43 */
|
|
|
|
double backClip; /*!< Back clip plane Z value, code 44 */
|
|
|
|
double viewHeight; /*!< View height in model space units, code 45 */
|
|
|
|
double snapAngle; /*!< Snap angle, code 50 */
|
|
|
|
double twistAngle; /*!< view twist angle, code 51 */
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
duint32 frozenLyCount;
|
2023-08-21 16:24:10 +02:00
|
|
|
}; // RLZ: missing 15,25, 72, 331, 90, 340, 1, 281, 71, 74, 110, 120, 130, 111, 121,131, 112,122, 132, 345,346, and
|
|
|
|
// more...
|
|
|
|
|
|
|
|
// used //DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
|
|
|
|
|
|
|
|
// double thickness; /*!< thickness, code 39 */
|
|
|
|
// DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
|
|
|
|
// enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
|
|
|
|
// duint32 handle; /*!< entity identifier, code 5 */
|
|
|
|
// std::list<std::list<DRW_Variant> > appData; /*!< list of application data, code 102 */
|
|
|
|
// duint32 parentHandle; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
|
|
|
|
// DRW::Space space; /*!< space indicator, code 67*/
|
|
|
|
// UTF8STRING layer; /*!< layer name, code 8 */
|
|
|
|
// UTF8STRING lineType; /*!< line type, code 6 */
|
|
|
|
// duint32 material; /*!< hard pointer id to material object, code 347 */
|
|
|
|
// int color; /*!< entity color, code 62 */
|
|
|
|
// enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
|
|
|
|
// double ltypeScale; /*!< linetype scale, code 48 */
|
|
|
|
// bool visible; /*!< entity visibility, code 60 */
|
|
|
|
// int numProxyGraph; /*!< Number of bytes in proxy graphics, code 92 */
|
|
|
|
// std::string proxyGraphics; /*!< proxy graphics bytes, code 310 */
|
|
|
|
// int color24; /*!< 24-bit color, code 420 */
|
|
|
|
// std::string colorName; /*!< color name, code 430 */
|
|
|
|
// int transparency; /*!< transparency, code 440 */
|
|
|
|
// int plotStyle; /*!< hard pointer id to plot style object, code 390 */
|
|
|
|
// DRW::ShadowMode shadow; /*!< shadow mode, code 284 */
|
|
|
|
// bool haveExtrusion; /*!< set to true if the entity have extrusion*/
|
2017-06-20 10:40:39 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// EOF
|