libdxfrw. C++14 support
This commit is contained in:
parent
d704cf9322
commit
f5256c514c
|
@ -71,7 +71,7 @@ void DRW_Entity::extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const
|
|||
point->z = pz;
|
||||
}
|
||||
|
||||
auto DRW_Entity::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Entity::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ auto DRW_Entity::parseCode(int code, dxfReader *reader) -> bool
|
|||
}
|
||||
|
||||
// parses dxf 102 groups to read entity
|
||||
auto DRW_Entity::parseDxfGroups(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Entity::parseDxfGroups(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
std::list<DRW_Variant> ls;
|
||||
DRW_Variant c;
|
||||
|
@ -206,7 +206,7 @@ auto DRW_Entity::parseDxfGroups(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Point::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Point::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ auto DRW_Point::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_ASTMNotch::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_ASTMNotch::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ auto DRW_ASTMNotch::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Line::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Line::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ void DRW_Circle::applyExtrusion()
|
|||
}
|
||||
}
|
||||
|
||||
auto DRW_Circle::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Circle::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ void DRW_Arc::applyExtrusion()
|
|||
}
|
||||
}
|
||||
|
||||
auto DRW_Arc::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Arc::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ auto DRW_Arc::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Ellipse::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Ellipse::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ void DRW_Trace::applyExtrusion()
|
|||
}
|
||||
}
|
||||
|
||||
auto DRW_Trace::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Trace::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -482,7 +482,7 @@ auto DRW_Trace::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_3Dface::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_3Dface::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -496,7 +496,7 @@ auto DRW_3Dface::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Block::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Block::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -513,7 +513,7 @@ auto DRW_Block::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Insert::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Insert::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ void DRW_LWPolyline::applyExtrusion()
|
|||
}
|
||||
}
|
||||
|
||||
auto DRW_LWPolyline::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_LWPolyline::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -627,7 +627,7 @@ auto DRW_LWPolyline::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Text::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Text::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -665,7 +665,7 @@ auto DRW_Text::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_MText::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_MText::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -758,7 +758,7 @@ void DRW_MText::updateAngle()
|
|||
}
|
||||
}
|
||||
|
||||
auto DRW_Polyline::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Polyline::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -793,7 +793,7 @@ auto DRW_Polyline::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Vertex::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Vertex::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -834,7 +834,7 @@ auto DRW_Vertex::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Hatch::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Hatch::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -974,7 +974,7 @@ auto DRW_Hatch::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Spline::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Spline::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -1072,7 +1072,7 @@ auto DRW_Spline::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Image::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Image::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -1113,7 +1113,7 @@ auto DRW_Image::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Dimension::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Dimension::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -1236,7 +1236,7 @@ auto DRW_Dimension::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Leader::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Leader::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
@ -1331,7 +1331,7 @@ auto DRW_Leader::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_Viewport::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Viewport::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <QtGlobal>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -195,14 +196,14 @@ public:
|
|||
|
||||
protected:
|
||||
// parses dxf pair to read entity
|
||||
virtual auto parseCode(int code, dxfReader *reader) -> bool;
|
||||
virtual auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool;
|
||||
// calculates extrusion axis (normal vector)
|
||||
void calculateAxis(DRW_Coord extPoint);
|
||||
// apply extrusion to @extPoint and return data in @point
|
||||
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const;
|
||||
|
||||
// parses dxf 102 groups to read entity
|
||||
auto parseDxfGroups(int code, dxfReader *reader) -> bool;
|
||||
auto parseDxfGroups(int code, const std::unique_ptr<dxfReader> &reader) -> bool;
|
||||
|
||||
public:
|
||||
DRW::ETYPE eType; /*!< enum: entity type, code 0 */
|
||||
|
@ -249,7 +250,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
DRW_Coord basePoint{}; /*!< base point, code 10, 20 & 30 */
|
||||
|
@ -267,7 +268,7 @@ public:
|
|||
DRW_ASTMNotch() { eType = DRW::ASTMNOTCH; }
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double angle{0}; /*!< angle, code 50 */
|
||||
|
@ -292,7 +293,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
|
||||
|
@ -341,7 +342,7 @@ public:
|
|||
void applyExtrusion() override;
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double radious; /*!< radius, code 40 */
|
||||
|
@ -382,7 +383,7 @@ public:
|
|||
|
||||
protected:
|
||||
//! interpret code in dxf reading process or dispatch to inherited class
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double staangle; /*!< start angle, code 50 in radians*/
|
||||
|
@ -416,7 +417,7 @@ public:
|
|||
|
||||
protected:
|
||||
//! interpret code in dxf reading process or dispatch to inherited class
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
private:
|
||||
void correctAxis();
|
||||
|
@ -448,7 +449,7 @@ public:
|
|||
void applyExtrusion() override;
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
|
||||
|
@ -525,7 +526,7 @@ public:
|
|||
|
||||
protected:
|
||||
//! interpret code in dxf reading process or dispatch to inherited class
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
int invisibleflag; /*!< invisible edge flag, code 70 */
|
||||
|
@ -552,7 +553,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING name; /*!< block name, code 2 */
|
||||
|
@ -584,7 +585,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING name; /*!< block name, code 2 */
|
||||
|
@ -664,7 +665,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
int vertexnum; /*!< number of vertex, code 90 */
|
||||
|
@ -727,7 +728,7 @@ public:
|
|||
void applyExtrusion() override {} // RLZ TODO
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double height; /*!< height text, code 40 */
|
||||
|
@ -775,7 +776,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
void updateAngle(); // recalculate angle if 'haveXAxis' is true
|
||||
|
||||
public:
|
||||
|
@ -828,7 +829,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double stawidth; /*!< Start width, code 40 */
|
||||
|
@ -910,7 +911,7 @@ public:
|
|||
void appendVertex(DRW_Vertex *v) { vertlist.push_back(v); }
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
int flags; /*!< polyline flag, code 70, default 0 */
|
||||
|
@ -1003,7 +1004,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
// double ex; /*!< normal vector x coordinate, code 210 */
|
||||
|
@ -1119,7 +1120,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING name; /*!< hatch pattern name, code 2 */
|
||||
|
@ -1225,7 +1226,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
duint32 ref; /*!< Hard reference to imagedef object, code 340 */
|
||||
|
@ -1307,12 +1308,12 @@ public:
|
|||
eType = DRW::DIMENSION;
|
||||
// RLZ needed a def value for this: hdir = ???
|
||||
}
|
||||
virtual ~DRW_Dimension() = default;
|
||||
~DRW_Dimension() override = default;
|
||||
|
||||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
auto getDefPoint() const -> DRW_Coord { return defPoint; } /*!< Definition point, code 10, 20 & 30 */
|
||||
|
@ -1671,7 +1672,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING style; /*!< Dimension style name, code 3 */
|
||||
|
@ -1734,7 +1735,7 @@ public:
|
|||
void applyExtrusion() override {}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double pswidth; /*!< Width in paper space units, code 40 */
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "drw_header.h"
|
||||
#include "intern/drw_dbg.h"
|
||||
#include "intern/dxfreader.h"
|
||||
#include "intern/dxfwriter.h"
|
||||
#include "intern/drw_dbg.h"
|
||||
|
||||
DRW_Header::DRW_Header()
|
||||
: vars(),
|
||||
|
@ -31,24 +31,28 @@ DRW_Header::DRW_Header()
|
|||
ucsCtrl(0),
|
||||
vportCtrl(0),
|
||||
vpEntHeaderCtrl(0)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void DRW_Header::addComment(const std::string &c){
|
||||
void DRW_Header::addComment(const std::string &c)
|
||||
{
|
||||
if (!comments.empty())
|
||||
comments += '\n';
|
||||
comments += c;
|
||||
}
|
||||
|
||||
auto DRW_Header::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Header::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
if (nullptr == curr && 9 != code)
|
||||
{
|
||||
if (nullptr == curr && 9 != code) {
|
||||
DRW_DBG("invalid header code: ");
|
||||
DRW_DBG(code);
|
||||
DRW_DBG("\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
switch (code)
|
||||
{
|
||||
case 9:
|
||||
curr = new DRW_Variant();
|
||||
name = reader->getString();
|
||||
|
@ -58,7 +62,8 @@ auto DRW_Header::parseCode(int code, dxfReader *reader) -> bool
|
|||
break;
|
||||
case 1:
|
||||
curr->addString(reader->getUtf8String());
|
||||
if (name =="$ACADVER") {
|
||||
if (name == "$ACADVER")
|
||||
{
|
||||
reader->setVersion(*curr->content.s, true);
|
||||
version = reader->getVersion();
|
||||
}
|
||||
|
@ -74,7 +79,8 @@ auto DRW_Header::parseCode(int code, dxfReader *reader) -> bool
|
|||
break;
|
||||
case 3:
|
||||
curr->addString(reader->getUtf8String());
|
||||
if (name =="$DWGCODEPAGE") {
|
||||
if (name == "$DWGCODEPAGE")
|
||||
{
|
||||
reader->setCodePage(*curr->content.s);
|
||||
curr->addString(reader->getCodePage());
|
||||
}
|
||||
|
@ -113,7 +119,8 @@ auto DRW_Header::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
||||
void DRW_Header::write(const std::unique_ptr<dxfWriter> &writer, DRW::Version ver)
|
||||
{
|
||||
/*RLZ: TODO complete all vars to AC1024*/
|
||||
double varDouble;
|
||||
int varInt;
|
||||
|
@ -154,55 +161,71 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
getStr("$ACADVER", &varStr);
|
||||
getStr("$ACADMAINTVER", &varStr);
|
||||
|
||||
if (!getStr("$DWGCODEPAGE", &varStr)) {
|
||||
if (!getStr("$DWGCODEPAGE", &varStr))
|
||||
{
|
||||
varStr = "ANSI_1252";
|
||||
}
|
||||
writer->writeString(9, "$DWGCODEPAGE");
|
||||
writer->setCodePage(varStr);
|
||||
writer->writeString(3, writer->getCodePage());
|
||||
writer->writeString(9, "$INSBASE");
|
||||
if (getCoord("$INSBASE", &varCoord)) {
|
||||
if (getCoord("$INSBASE", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$EXTMIN");
|
||||
if (getCoord("$EXTMIN", &varCoord)) {
|
||||
if (getCoord("$EXTMIN", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 1.0000000000000000E+020);
|
||||
writer->writeDouble(20, 1.0000000000000000E+020);
|
||||
writer->writeDouble(30, 1.0000000000000000E+020);
|
||||
}
|
||||
writer->writeString(9, "$EXTMAX");
|
||||
if (getCoord("$EXTMAX", &varCoord)) {
|
||||
if (getCoord("$EXTMAX", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, -1.0000000000000000E+020);
|
||||
writer->writeDouble(20, -1.0000000000000000E+020);
|
||||
writer->writeDouble(30, -1.0000000000000000E+020);
|
||||
}
|
||||
writer->writeString(9, "$LIMMIN");
|
||||
if (getCoord("$LIMMIN", &varCoord)) {
|
||||
if (getCoord("$LIMMIN", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$LIMMAX");
|
||||
if (getCoord("$LIMMAX", &varCoord)) {
|
||||
if (getCoord("$LIMMAX", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 420.0);
|
||||
writer->writeDouble(20, 297.0);
|
||||
}
|
||||
|
@ -231,7 +254,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(70, varInt);
|
||||
else
|
||||
writer->writeInt16(70, 0);
|
||||
if (ver == DRW::AC1009){
|
||||
if (ver == DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$DRAGMODE");
|
||||
if (getInt("$DRAGMODE", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -243,7 +267,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeDouble(40, varDouble);
|
||||
else
|
||||
writer->writeDouble(40, 1.0);
|
||||
if (ver == DRW::AC1009){
|
||||
if (ver == DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$OSMODE");
|
||||
if (getInt("$OSMODE", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -295,7 +320,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(62, varInt);
|
||||
else
|
||||
writer->writeInt16(62, 256);
|
||||
if (ver > DRW::AC1009){
|
||||
if (ver > DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$CELTSCALE");
|
||||
if (getDouble("$CELTSCALE", &varDouble))
|
||||
writer->writeDouble(40, varDouble);
|
||||
|
@ -537,7 +563,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeDouble(40, 0.625);
|
||||
// post r12 dim vars
|
||||
if (ver > DRW::AC1009) {
|
||||
if (ver > DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$DIMJUST");
|
||||
if (getInt("$DIMJUST", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -650,17 +677,21 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeString(1, "STANDARD");
|
||||
// verify if exist "$DIMLUNIT" or obsolete "$DIMUNIT" (pre v2000)
|
||||
if ( !getInt("$DIMLUNIT", &varInt) ){
|
||||
if (!getInt("$DIMLUNIT", &varInt))
|
||||
{
|
||||
if (!getInt("$DIMUNIT", &varInt))
|
||||
varInt = 2;
|
||||
}
|
||||
// verify valid values from 1 to 6
|
||||
if (varInt < 1 || varInt > 6)
|
||||
varInt = 2;
|
||||
if (ver > DRW::AC1014) {
|
||||
if (ver > DRW::AC1014)
|
||||
{
|
||||
writer->writeString(9, "$DIMLUNIT");
|
||||
writer->writeInt16(70, varInt);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeString(9, "$DIMUNIT");
|
||||
writer->writeInt16(70, varInt);
|
||||
}
|
||||
|
@ -680,7 +711,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(70, 0);
|
||||
|
||||
if (ver > DRW::AC1018) {// and post v2004 dim vars
|
||||
if (ver > DRW::AC1018)
|
||||
{ // and post v2004 dim vars
|
||||
writer->writeString(9, "$DIMFXL");
|
||||
if (getDouble("$DIMFXL", &varDouble))
|
||||
writer->writeDouble(40, varDouble);
|
||||
|
@ -726,7 +758,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeUtf8String(6, varStr);
|
||||
else
|
||||
writer->writeString(6, "");
|
||||
if (ver > DRW::AC1021) {// and post v2007 dim vars
|
||||
if (ver > DRW::AC1021)
|
||||
{ // and post v2007 dim vars
|
||||
writer->writeString(9, "$DIMTXTDIRECTION");
|
||||
if (getInt("$DIMTXTDIRECTION", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -794,7 +827,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(70, varInt);
|
||||
else
|
||||
writer->writeInt16(70, 0);
|
||||
if (ver < DRW::AC1015) {
|
||||
if (ver < DRW::AC1015)
|
||||
{
|
||||
writer->writeString(9, "$BLIPMODE");
|
||||
if (getInt("$BLIPMODE", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -811,7 +845,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeDouble(40, varDouble);
|
||||
else
|
||||
writer->writeDouble(40, 0.0);
|
||||
if (ver > DRW::AC1009) {
|
||||
if (ver > DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$CHAMFERC");
|
||||
if (getDouble("$CHAMFERC", &varDouble))
|
||||
writer->writeDouble(40, varDouble);
|
||||
|
@ -824,15 +859,19 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeDouble(40, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$SKPOLY");
|
||||
if (getInt("$SKPOLY", &varInt)) {
|
||||
if (getInt("$SKPOLY", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 0);
|
||||
// rlz: todo, times
|
||||
writer->writeString(9, "$USRTIMER");
|
||||
if (getInt("$USRTIMER", &varInt)) {
|
||||
if (getInt("$USRTIMER", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 1);
|
||||
writer->writeString(9, "$ANGBASE");
|
||||
if (getDouble("$ANGBASE", &varDouble))
|
||||
|
@ -840,14 +879,18 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeDouble(50, 0.0);
|
||||
writer->writeString(9, "$ANGDIR");
|
||||
if (getInt("$ANGDIR", &varInt)) {
|
||||
if (getInt("$ANGDIR", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 0);
|
||||
writer->writeString(9, "$PDMODE");
|
||||
if (getInt("$PDMODE", &varInt)) {
|
||||
if (getInt("$PDMODE", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 34);
|
||||
writer->writeString(9, "$PDSIZE");
|
||||
if (getDouble("$PDSIZE", &varDouble))
|
||||
|
@ -859,39 +902,52 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeDouble(40, varDouble);
|
||||
else
|
||||
writer->writeDouble(40, 0.0);
|
||||
if (ver < DRW::AC1012) {
|
||||
if (ver < DRW::AC1012)
|
||||
{
|
||||
writer->writeString(9, "$COORDS");
|
||||
if (getInt("$COORDS", &varInt)) {
|
||||
if (getInt("$COORDS", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 2);
|
||||
}
|
||||
writer->writeString(9, "$SPLFRAME");
|
||||
if (getInt("$SPLFRAME", &varInt)) {
|
||||
if (getInt("$SPLFRAME", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 0);
|
||||
writer->writeString(9, "$SPLINETYPE");
|
||||
if (getInt("$SPLINETYPE", &varInt)) {
|
||||
if (getInt("$SPLINETYPE", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 2);
|
||||
writer->writeString(9, "$SPLINESEGS");
|
||||
if (getInt("$SPLINESEGS", &varInt)) {
|
||||
if (getInt("$SPLINESEGS", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 8);
|
||||
if (ver < DRW::AC1012)
|
||||
{
|
||||
writer->writeString(9, "$ATTDIA");
|
||||
if (getInt("$ATTDIA", &varInt)) {
|
||||
if (getInt("$ATTDIA", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 1);
|
||||
writer->writeString(9, "$ATTREQ");
|
||||
if (getInt("$ATTREQ", &varInt)) {
|
||||
if (getInt("$ATTREQ", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 1);
|
||||
|
||||
// A handle is an arbitrary but in your DXF file unique hex value as string like ‘10FF’. It is common to to use
|
||||
|
@ -911,35 +967,47 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
// RLZ dxfHex(5, 0xFFFF);
|
||||
writer->writeString(5, "20000");
|
||||
writer->writeString(9, "$SURFTAB1");
|
||||
if (getInt("$SURFTAB1", &varInt)) {
|
||||
if (getInt("$SURFTAB1", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 6);
|
||||
writer->writeString(9, "$SURFTAB2");
|
||||
if (getInt("$SURFTAB2", &varInt)) {
|
||||
if (getInt("$SURFTAB2", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 6);
|
||||
writer->writeString(9, "$SURFTYPE");
|
||||
if (getInt("$SURFTYPE", &varInt)) {
|
||||
if (getInt("$SURFTYPE", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 6);
|
||||
writer->writeString(9, "$SURFU");
|
||||
if (getInt("$SURFU", &varInt)) {
|
||||
if (getInt("$SURFU", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 6);
|
||||
writer->writeString(9, "$SURFV");
|
||||
if (getInt("$SURFV", &varInt)) {
|
||||
if (getInt("$SURFV", &varInt))
|
||||
{
|
||||
writer->writeInt16(70, varInt);
|
||||
} else
|
||||
}
|
||||
else
|
||||
writer->writeInt16(70, 6);
|
||||
if (getStr("$TDCREATE", &varStr)) {
|
||||
if (getStr("$TDCREATE", &varStr))
|
||||
{
|
||||
writer->writeString(9, "$TDCREATE");
|
||||
writer->writeString(40, varStr);
|
||||
}
|
||||
if (ver > DRW::AC1009) {
|
||||
if (ver > DRW::AC1009)
|
||||
{
|
||||
writer->writeString(9, "$UCSBASE");
|
||||
if (getStr("$UCSBASE", &varStr))
|
||||
writer->writeUtf8String(2, varStr);
|
||||
|
@ -955,36 +1023,46 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeString(2, "");
|
||||
writer->writeString(9, "$UCSORG");
|
||||
if (getCoord("$UCSORG", &varCoord)) {
|
||||
if (getCoord("$UCSORG", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSXDIR");
|
||||
if (getCoord("$UCSXDIR", &varCoord)) {
|
||||
if (getCoord("$UCSXDIR", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 1.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSYDIR");
|
||||
if (getCoord("$UCSYDIR", &varCoord)) {
|
||||
if (getCoord("$UCSYDIR", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 1.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
if (ver > DRW::AC1009) { //begin post r12 UCS vars
|
||||
if (ver > DRW::AC1009)
|
||||
{ // begin post r12 UCS vars
|
||||
writer->writeString(9, "$UCSORTHOREF");
|
||||
if (getStr("$UCSORTHOREF", &varStr))
|
||||
// if (ver == DRW::AC1009)
|
||||
|
@ -999,61 +1077,79 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(70, 0);
|
||||
writer->writeString(9, "$UCSORGTOP");
|
||||
if (getCoord("$UCSORGTOP", &varCoord)) {
|
||||
if (getCoord("$UCSORGTOP", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSORGBOTTOM");
|
||||
if (getCoord("$UCSORGBOTTOM", &varCoord)) {
|
||||
if (getCoord("$UCSORGBOTTOM", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSORGLEFT");
|
||||
if (getCoord("$UCSORGLEFT", &varCoord)) {
|
||||
if (getCoord("$UCSORGLEFT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSORGRIGHT");
|
||||
if (getCoord("$UCSORGRIGHT", &varCoord)) {
|
||||
if (getCoord("$UCSORGRIGHT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSORGFRONT");
|
||||
if (getCoord("$UCSORGFRONT", &varCoord)) {
|
||||
if (getCoord("$UCSORGFRONT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$UCSORGBACK");
|
||||
if (getCoord("$UCSORGBACK", &varCoord)) {
|
||||
if (getCoord("$UCSORGBACK", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
|
@ -1076,36 +1172,46 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeString(2, "");
|
||||
writer->writeString(9, "$PUCSORG");
|
||||
if (getCoord("$PUCSORG", &varCoord)) {
|
||||
if (getCoord("$PUCSORG", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSXDIR");
|
||||
if (getCoord("$PUCSXDIR", &varCoord)) {
|
||||
if (getCoord("$PUCSXDIR", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 1.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSYDIR");
|
||||
if (getCoord("$PUCSYDIR", &varCoord)) {
|
||||
if (getCoord("$PUCSYDIR", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 1.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
if (ver > DRW::AC1009) { //begin post r12 PUCS vars
|
||||
if (ver > DRW::AC1009)
|
||||
{ // begin post r12 PUCS vars
|
||||
writer->writeString(9, "$PUCSORTHOREF");
|
||||
if (getStr("$PUCSORTHOREF", &varStr))
|
||||
// if (ver == DRW::AC1009)
|
||||
|
@ -1120,61 +1226,79 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(70, 0);
|
||||
writer->writeString(9, "$PUCSORGTOP");
|
||||
if (getCoord("$PUCSORGTOP", &varCoord)) {
|
||||
if (getCoord("$PUCSORGTOP", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSORGBOTTOM");
|
||||
if (getCoord("$PUCSORGBOTTOM", &varCoord)) {
|
||||
if (getCoord("$PUCSORGBOTTOM", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSORGLEFT");
|
||||
if (getCoord("$PUCSORGLEFT", &varCoord)) {
|
||||
if (getCoord("$PUCSORGLEFT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSORGRIGHT");
|
||||
if (getCoord("$PUCSORGRIGHT", &varCoord)) {
|
||||
if (getCoord("$PUCSORGRIGHT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSORGFRONT");
|
||||
if (getCoord("$PUCSORGFRONT", &varCoord)) {
|
||||
if (getCoord("$PUCSORGFRONT", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PUCSORGBACK");
|
||||
if (getCoord("$PUCSORGBACK", &varCoord)) {
|
||||
if (getCoord("$PUCSORGBACK", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
|
@ -1256,13 +1380,17 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(70, varInt);
|
||||
else
|
||||
writer->writeInt16(70, 64);
|
||||
if (ver > DRW::AC1009) { //begin post r12 PUCS vars
|
||||
if (ver > DRW::AC1009)
|
||||
{ // begin post r12 PUCS vars
|
||||
writer->writeString(9, "$PINSBASE");
|
||||
if (getCoord("$PINSBASE", &varCoord)) {
|
||||
if (getCoord("$PINSBASE", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
|
@ -1274,41 +1402,51 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(70, 0);
|
||||
writer->writeString(9, "$PEXTMIN");
|
||||
if (getCoord("$PEXTMIN", &varCoord)) {
|
||||
if (getCoord("$PEXTMIN", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PEXTMAX");
|
||||
if (getCoord("$PEXTMAX", &varCoord)) {
|
||||
if (getCoord("$PEXTMAX", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
writer->writeDouble(30, varCoord.z);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
writer->writeDouble(30, 0.0);
|
||||
}
|
||||
|
||||
/* RLZ: moved to active VPORT, but can write in header if present*/
|
||||
if (getInt("$GRIDMODE", &varInt)) {
|
||||
if (getInt("$GRIDMODE", &varInt))
|
||||
{
|
||||
writer->writeString(9, "$GRIDMODE");
|
||||
writer->writeInt16(70, varInt);
|
||||
}
|
||||
if (getInt("$SNAPSTYLE", &varInt)) {
|
||||
if (getInt("$SNAPSTYLE", &varInt))
|
||||
{
|
||||
writer->writeString(9, "$SNAPSTYLE");
|
||||
writer->writeInt16(70, varInt);
|
||||
}
|
||||
if (getCoord("$GRIDUNIT", &varCoord)) {
|
||||
if (getCoord("$GRIDUNIT", &varCoord))
|
||||
{
|
||||
writer->writeString(9, "$GRIDUNIT");
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
}
|
||||
if (getCoord("$VIEWCTR", &varCoord)) {
|
||||
if (getCoord("$VIEWCTR", &varCoord))
|
||||
{
|
||||
writer->writeString(9, "$VIEWCTR");
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
|
@ -1316,18 +1454,24 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
/* RLZ: moved to active VPORT, but can write in header if present*/
|
||||
|
||||
writer->writeString(9, "$PLIMMIN");
|
||||
if (getCoord("$PLIMMIN", &varCoord)) {
|
||||
if (getCoord("$PLIMMIN", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 0.0);
|
||||
writer->writeDouble(20, 0.0);
|
||||
}
|
||||
writer->writeString(9, "$PLIMMAX");
|
||||
if (getCoord("$PLIMMAX", &varCoord)) {
|
||||
if (getCoord("$PLIMMAX", &varCoord))
|
||||
{
|
||||
writer->writeDouble(10, varCoord.x);
|
||||
writer->writeDouble(20, varCoord.y);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->writeDouble(10, 297.0);
|
||||
writer->writeDouble(20, 210.0);
|
||||
}
|
||||
|
@ -1351,7 +1495,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(70, varInt);
|
||||
else
|
||||
writer->writeInt16(70, 1);
|
||||
if (ver > DRW::AC1009){//start port r12 vars
|
||||
if (ver > DRW::AC1009)
|
||||
{ // start port r12 vars
|
||||
writer->writeString(9, "$TREEDEPTH");
|
||||
if (getInt("$TREEDEPTH", &varInt))
|
||||
writer->writeInt16(70, varInt);
|
||||
|
@ -1409,7 +1554,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
writer->writeInt16(290, varInt);
|
||||
else
|
||||
writer->writeInt16(290, 0);
|
||||
if (ver > DRW::AC1014) {
|
||||
if (ver > DRW::AC1014)
|
||||
{
|
||||
writer->writeString(9, "$INSUNITS");
|
||||
writer->writeInt16(70, insunits); // already fetched above for $MEASUREMENT
|
||||
}
|
||||
|
@ -1461,7 +1607,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(290, 0);
|
||||
}
|
||||
if (ver > DRW::AC1015) {// and post v2004 vars
|
||||
if (ver > DRW::AC1015)
|
||||
{ // and post v2004 vars
|
||||
writer->writeString(9, "$SORTENTS");
|
||||
if (getInt("$SORTENTS", &varInt))
|
||||
writer->writeInt16(280, varInt);
|
||||
|
@ -1478,12 +1625,15 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeInt16(280, 1);
|
||||
writer->writeString(9, "$XCLIPFRAME"); // RLZ bool flag, verify in bin version
|
||||
if (ver > DRW::AC1021) {
|
||||
if (ver > DRW::AC1021)
|
||||
{
|
||||
if (getInt("$XCLIPFRAME", &varInt))
|
||||
writer->writeInt16(280, varInt);
|
||||
else
|
||||
writer->writeInt16(280, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getInt("$XCLIPFRAME", &varInt))
|
||||
writer->writeInt16(290, varInt);
|
||||
else
|
||||
|
@ -1525,7 +1675,8 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
else
|
||||
writer->writeString(1, "");
|
||||
}
|
||||
if (ver > DRW::AC1018) {// and post v2007 vars
|
||||
if (ver > DRW::AC1018)
|
||||
{ // and post v2007 vars
|
||||
writer->writeString(9, "$CAMERADISPLAY"); // RLZ bool flag, verify in bin version
|
||||
if (getInt("$CAMERADISPLAY", &varInt))
|
||||
writer->writeInt16(290, varInt);
|
||||
|
@ -1672,34 +1823,40 @@ void DRW_Header::write(dxfWriter *writer, DRW::Version ver){
|
|||
}
|
||||
|
||||
#ifdef DRW_DBG
|
||||
for ( auto it=vars.begin() ; it != vars.end(); ++it ){
|
||||
DRW_DBG((*it).first); DRW_DBG("\n");
|
||||
for (auto it = vars.begin(); it != vars.end(); ++it)
|
||||
{
|
||||
DRW_DBG((*it).first);
|
||||
DRW_DBG("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRW_Header::addDouble(std::string key, double value, int code){
|
||||
void DRW_Header::addDouble(std::string key, double value, int code)
|
||||
{
|
||||
curr = new DRW_Variant();
|
||||
curr->addDouble(value);
|
||||
curr->code = code;
|
||||
vars[key] = curr;
|
||||
}
|
||||
|
||||
void DRW_Header::addInt(std::string key, int value, int code){
|
||||
void DRW_Header::addInt(std::string key, int value, int code)
|
||||
{
|
||||
curr = new DRW_Variant();
|
||||
curr->addInt(value);
|
||||
curr->code = code;
|
||||
vars[key] = curr;
|
||||
}
|
||||
|
||||
void DRW_Header::addStr(std::string key, const std::string &value, int code){
|
||||
void DRW_Header::addStr(std::string key, const std::string &value, int code)
|
||||
{
|
||||
curr = new DRW_Variant();
|
||||
curr->addString(value);
|
||||
curr->code = code;
|
||||
vars[key] = curr;
|
||||
}
|
||||
|
||||
void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code){
|
||||
void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code)
|
||||
{
|
||||
curr = new DRW_Variant();
|
||||
curr->addCoord(value);
|
||||
curr->code = code;
|
||||
|
@ -1742,9 +1899,11 @@ auto DRW_Header::getStr(const std::string &key, std::string *varStr) const -> bo
|
|||
{
|
||||
bool result = false;
|
||||
auto it = vars.find(key);
|
||||
if (it != vars.end()) {
|
||||
if (it != vars.end())
|
||||
{
|
||||
DRW_Variant *var = (*it).second;
|
||||
if (var->type == DRW_Variant::STRING) {
|
||||
if (var->type == DRW_Variant::STRING)
|
||||
{
|
||||
*varStr = *var->content.s;
|
||||
result = true;
|
||||
}
|
||||
|
@ -1770,7 +1929,8 @@ auto DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord) const ->
|
|||
|
||||
auto DRW_Header::measurement(const int unit) -> int
|
||||
{
|
||||
switch (unit) {
|
||||
switch (unit)
|
||||
{
|
||||
case Units::Inch:
|
||||
case Units::Foot:
|
||||
case Units::Mile:
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "drw_base.h"
|
||||
|
||||
class dxfReader;
|
||||
|
@ -111,11 +112,11 @@ public:
|
|||
void addStr(std::string key, const std::string &value, int code);
|
||||
void addCoord(std::string key, const DRW_Coord &value, int code);
|
||||
auto getComments() const -> std::string { return comments; }
|
||||
void write(dxfWriter *writer, DRW::Version ver);
|
||||
void write(const std::unique_ptr<dxfWriter>& writer, DRW::Version ver);
|
||||
void addComment(const std::string &c);
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader>& reader) -> bool;
|
||||
|
||||
private:
|
||||
auto getDouble(const std::string &key, double *varDouble) const -> bool;
|
||||
|
|
|
@ -11,22 +11,23 @@
|
|||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "drw_objects.h"
|
||||
#include "drw_reserve.h"
|
||||
#include "intern/drw_dbg.h"
|
||||
#include "intern/dxfreader.h"
|
||||
#include "intern/dxfwriter.h"
|
||||
#include "intern/drw_dbg.h"
|
||||
#include "drw_reserve.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
//! Base class for tables entries
|
||||
/*!
|
||||
* Base class for tables entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_TableEntry::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_TableEntry::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 5:
|
||||
handle = static_cast<duint32>(reader->getHandleString());
|
||||
break;
|
||||
|
@ -113,9 +114,10 @@ auto DRW_TableEntry::parseCode(int code, dxfReader *reader) -> bool
|
|||
* Class to handle ldim style symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_Dimstyle::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Dimstyle::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 105:
|
||||
handle = static_cast<duint32>(reader->getHandleString());
|
||||
break;
|
||||
|
@ -338,16 +340,18 @@ auto DRW_Dimstyle::parseCode(int code, dxfReader *reader) -> bool
|
|||
* Class to handle line type symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_LType::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_LType::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 3:
|
||||
desc = reader->getUtf8String();
|
||||
break;
|
||||
case 73:
|
||||
size = reader->getInt32();
|
||||
path.clear();
|
||||
if (!DRW::reserve( path, size)) {
|
||||
if (!DRW::reserve(path, size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -374,10 +378,12 @@ auto DRW_LType::parseCode(int code, dxfReader *reader) -> bool
|
|||
* @author Rallaz
|
||||
*/
|
||||
/*TODO: control max length permited */
|
||||
void DRW_LType::update(){
|
||||
void DRW_LType::update()
|
||||
{
|
||||
double d = 0;
|
||||
size = static_cast<int>(path.size());
|
||||
for (int i = 0; i< size; i++){
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
d += fabs(path.at(static_cast<size_t>(i)));
|
||||
}
|
||||
length = d;
|
||||
|
@ -388,9 +394,10 @@ void DRW_LType::update(){
|
|||
* Class to handle layer symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_Layer::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Layer::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 6:
|
||||
lineType = reader->getUtf8String();
|
||||
break;
|
||||
|
@ -424,9 +431,10 @@ auto DRW_Layer::parseCode(int code, dxfReader *reader) -> bool
|
|||
* Class to handle text style symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_Textstyle::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Textstyle::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 3:
|
||||
font = reader->getUtf8String();
|
||||
break;
|
||||
|
@ -463,9 +471,10 @@ auto DRW_Textstyle::parseCode(int code, dxfReader *reader) -> bool
|
|||
* Class to handle vport symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
auto DRW_Vport::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_Vport::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 10:
|
||||
lowerLeft.x = reader->getDouble();
|
||||
break;
|
||||
|
@ -572,9 +581,10 @@ auto DRW_Vport::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_ImageDef::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_ImageDef::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 1:
|
||||
fileName = reader->getUtf8String();
|
||||
break;
|
||||
|
@ -609,9 +619,10 @@ auto DRW_ImageDef::parseCode(int code, dxfReader *reader) -> bool
|
|||
return true;
|
||||
}
|
||||
|
||||
auto DRW_PlotSettings::parseCode(int code, dxfReader *reader) -> bool
|
||||
auto DRW_PlotSettings::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
switch (code) {
|
||||
case 5:
|
||||
handle = static_cast<duint32>(reader->getHandleString());
|
||||
break;
|
||||
|
|
|
@ -14,20 +14,22 @@
|
|||
#ifndef DRW_OBJECTS_H
|
||||
#define DRW_OBJECTS_H
|
||||
|
||||
|
||||
#include "drw_base.h"
|
||||
#include <QtGlobal>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <QtGlobal>
|
||||
#include "drw_base.h"
|
||||
|
||||
class dxfReader;
|
||||
class dxfWriter;
|
||||
|
||||
namespace DRW {
|
||||
namespace DRW
|
||||
{
|
||||
|
||||
//! Table entries type.
|
||||
enum TTYPE {
|
||||
enum TTYPE
|
||||
{
|
||||
UNKNOWNT,
|
||||
LTYPE,
|
||||
LAYER,
|
||||
|
@ -45,7 +47,7 @@ namespace DRW {
|
|||
// DICTIONARYWDFLT, FIELD, IDBUFFER, IMAGEDEF, IMAGEDEFREACTOR, LAYER_INDEX, LAYOUT
|
||||
// MATERIAL, PLACEHOLDER, PLOTSETTINGS, RASTERVARIABLES, SCALE, SORTENTSTABLE,
|
||||
// SPATIAL_INDEX, SPATIAL_FILTER, TABLEGEOMETRY, TABLESTYLES,VISUALSTYLE,
|
||||
}
|
||||
} // namespace DRW
|
||||
|
||||
#define SETOBJFRIENDS friend class dxfRW;
|
||||
|
||||
|
@ -54,10 +56,10 @@ namespace DRW {
|
|||
* Base class for tables entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_TableEntry {
|
||||
class DRW_TableEntry
|
||||
{
|
||||
public:
|
||||
DRW_TableEntry()
|
||||
{}
|
||||
DRW_TableEntry() = default;
|
||||
|
||||
virtual ~DRW_TableEntry()
|
||||
{
|
||||
|
@ -91,7 +93,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual auto parseCode(int code, dxfReader *reader) -> bool;
|
||||
virtual auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool;
|
||||
void reset()
|
||||
{
|
||||
flags = 0;
|
||||
|
@ -116,14 +118,15 @@ private:
|
|||
DRW_Variant *curr{nullptr};
|
||||
};
|
||||
|
||||
|
||||
//! Class to handle dimstyle entries
|
||||
/*!
|
||||
* Class to handle dim style symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_Dimstyle final : public DRW_TableEntry {
|
||||
class DRW_Dimstyle final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_Dimstyle()
|
||||
: dimpost(),
|
||||
|
@ -194,9 +197,12 @@ public:
|
|||
dimldrblk(),
|
||||
dimlwd(),
|
||||
dimlwe()
|
||||
{ reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::DIMSTYLE;
|
||||
dimasz = dimtxt = dimcen = 2.5;
|
||||
dimexe = 1.25;
|
||||
|
@ -227,7 +233,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
// V12
|
||||
|
@ -302,15 +308,16 @@ public:
|
|||
int dimlwe; /*!< code 372 V2000+ */
|
||||
};
|
||||
|
||||
|
||||
//! Class to handle line type entries
|
||||
/*!
|
||||
* Class to handle line type symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
/*TODO: handle complex lineType*/
|
||||
class DRW_LType final : public DRW_TableEntry {
|
||||
class DRW_LType final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_LType()
|
||||
: desc(),
|
||||
|
@ -318,9 +325,12 @@ public:
|
|||
length(),
|
||||
path(),
|
||||
pathIdx()
|
||||
{ reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::LTYPE;
|
||||
desc = "";
|
||||
size = 0;
|
||||
|
@ -330,7 +340,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
void update();
|
||||
|
||||
public:
|
||||
|
@ -340,18 +350,20 @@ public:
|
|||
double length; /*!< total length of pattern, code 40 */
|
||||
// int haveShape; /*!< complex linetype type, code 74 */
|
||||
std::vector<double> path; /*!< trace, point or space length sequence, code 49 */
|
||||
|
||||
private:
|
||||
int pathIdx;
|
||||
};
|
||||
|
||||
|
||||
//! Class to handle layer entries
|
||||
/*!
|
||||
* Class to handle layer symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_Layer final : public DRW_TableEntry {
|
||||
class DRW_Layer final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_Layer()
|
||||
: lineType(),
|
||||
|
@ -361,9 +373,12 @@ public:
|
|||
lWeight(),
|
||||
handlePlotS(),
|
||||
handleMaterialS()
|
||||
{ reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::LAYER;
|
||||
lineType = "CONTINUOUS";
|
||||
color = 7; // default BYLAYER (256)
|
||||
|
@ -374,7 +389,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING lineType; /*!< line type, code 6 */
|
||||
|
@ -391,14 +406,19 @@ public:
|
|||
* Class to handle block record table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_Block_Record : public DRW_TableEntry {
|
||||
class DRW_Block_Record : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_Block_Record()
|
||||
: insUnits()
|
||||
{ reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::BLOCK_RECORD;
|
||||
flags = 0;
|
||||
DRW_TableEntry::reset();
|
||||
|
@ -417,8 +437,10 @@ public:
|
|||
* Class to handle text style symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_Textstyle final : public DRW_TableEntry {
|
||||
class DRW_Textstyle final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_Textstyle()
|
||||
: height(),
|
||||
|
@ -429,9 +451,12 @@ public:
|
|||
font(),
|
||||
bigFont(),
|
||||
fontFamily()
|
||||
{reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::STYLE;
|
||||
height = oblique = 0.0;
|
||||
width = lastHeight = 1.0;
|
||||
|
@ -442,7 +467,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
double height; /*!< Fixed text height (0 not set), code 40 */
|
||||
|
@ -460,8 +485,10 @@ public:
|
|||
* Class to handle vport symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_Vport final : public DRW_TableEntry {
|
||||
class DRW_Vport final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_Vport()
|
||||
: lowerLeft(),
|
||||
|
@ -488,9 +515,12 @@ public:
|
|||
snapStyle(),
|
||||
snapIsopair(),
|
||||
gridBehavior()
|
||||
{ reset();}
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::VPORT;
|
||||
UpperRight.x = UpperRight.y = 1.0;
|
||||
snapSpacing.x = snapSpacing.y = 10.0;
|
||||
|
@ -511,7 +541,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
DRW_Coord lowerLeft; /*!< Lower left corner, code 10 & 20 */
|
||||
|
@ -546,14 +576,15 @@ public:
|
|||
**/
|
||||
};
|
||||
|
||||
|
||||
//! Class to handle imagedef entries
|
||||
/*!
|
||||
* Class to handle image definitions object entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_ImageDef final : public DRW_TableEntry {//
|
||||
class DRW_ImageDef final : public DRW_TableEntry
|
||||
{ //
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_ImageDef()
|
||||
: fileName(),
|
||||
|
@ -569,14 +600,15 @@ public:
|
|||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::IMAGEDEF;
|
||||
imgVersion = 0;
|
||||
DRW_TableEntry::reset();
|
||||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
// std::string handle; /*!< entity identifier, code 5 */
|
||||
|
@ -597,14 +629,15 @@ public:
|
|||
* Class to handle plot settings object entries
|
||||
* @author baranovskiykonstantin@gmail.com
|
||||
*/
|
||||
class DRW_PlotSettings : public DRW_TableEntry {
|
||||
class DRW_PlotSettings : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
public:
|
||||
DRW_PlotSettings() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
public:
|
||||
DRW_PlotSettings() { reset(); }
|
||||
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::PLOTSETTINGS;
|
||||
marginLeft = 0.0;
|
||||
marginBottom = 0.0;
|
||||
|
@ -614,7 +647,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override;
|
||||
|
||||
public:
|
||||
UTF8STRING plotViewName{}; /*!< Plot view name, code 6 */
|
||||
|
@ -629,22 +662,29 @@ public:
|
|||
* Class to handle AppId symbol table entries
|
||||
* @author Rallaz
|
||||
*/
|
||||
class DRW_AppId final : public DRW_TableEntry {
|
||||
class DRW_AppId final : public DRW_TableEntry
|
||||
{
|
||||
SETOBJFRIENDS
|
||||
|
||||
public:
|
||||
DRW_AppId() { reset(); }
|
||||
|
||||
void reset(){
|
||||
void reset()
|
||||
{
|
||||
tType = DRW::APPID;
|
||||
flags = 0;
|
||||
name = "";
|
||||
}
|
||||
|
||||
protected:
|
||||
auto parseCode(int code, dxfReader *reader) -> bool override { return DRW_TableEntry::parseCode(code, reader); }
|
||||
auto parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool override
|
||||
{
|
||||
return DRW_TableEntry::parseCode(code, reader);
|
||||
}
|
||||
};
|
||||
|
||||
namespace DRW {
|
||||
namespace DRW
|
||||
{
|
||||
|
||||
// Extended color palette:
|
||||
// The first entry is only for direct indexing starting with [1]
|
||||
|
@ -661,254 +701,58 @@ const unsigned char dxfColors[][3] = {
|
|||
{128, 128, 128}, // 8 50% gray
|
||||
{192, 192, 192}, // 9 75% gray
|
||||
{255, 0, 0}, // 10
|
||||
{255,127,127},
|
||||
{204, 0, 0},
|
||||
{204,102,102},
|
||||
{153, 0, 0},
|
||||
{153, 76, 76}, // 15
|
||||
{127, 0, 0},
|
||||
{127, 63, 63},
|
||||
{ 76, 0, 0},
|
||||
{ 76, 38, 38},
|
||||
{255, 63, 0}, // 20
|
||||
{255,159,127},
|
||||
{204, 51, 0},
|
||||
{204,127,102},
|
||||
{153, 38, 0},
|
||||
{153, 95, 76}, // 25
|
||||
{127, 31, 0},
|
||||
{127, 79, 63},
|
||||
{ 76, 19, 0},
|
||||
{ 76, 47, 38},
|
||||
{255,127, 0}, // 30
|
||||
{255,191,127},
|
||||
{204,102, 0},
|
||||
{204,153,102},
|
||||
{153, 76, 0},
|
||||
{153,114, 76}, // 35
|
||||
{127, 63, 0},
|
||||
{127, 95, 63},
|
||||
{ 76, 38, 0},
|
||||
{ 76, 57, 38},
|
||||
{255,191, 0}, // 40
|
||||
{255,223,127},
|
||||
{204,153, 0},
|
||||
{204,178,102},
|
||||
{153,114, 0},
|
||||
{153,133, 76}, // 45
|
||||
{127, 95, 0},
|
||||
{127,111, 63},
|
||||
{ 76, 57, 0},
|
||||
{ 76, 66, 38},
|
||||
{255,255, 0}, // 50
|
||||
{255,255,127},
|
||||
{204,204, 0},
|
||||
{204,204,102},
|
||||
{153,153, 0},
|
||||
{153,153, 76}, // 55
|
||||
{127,127, 0},
|
||||
{127,127, 63},
|
||||
{ 76, 76, 0},
|
||||
{ 76, 76, 38},
|
||||
{191,255, 0}, // 60
|
||||
{223,255,127},
|
||||
{153,204, 0},
|
||||
{178,204,102},
|
||||
{114,153, 0},
|
||||
{133,153, 76}, // 65
|
||||
{ 95,127, 0},
|
||||
{111,127, 63},
|
||||
{ 57, 76, 0},
|
||||
{ 66, 76, 38},
|
||||
{127,255, 0}, // 70
|
||||
{191,255,127},
|
||||
{102,204, 0},
|
||||
{153,204,102},
|
||||
{ 76,153, 0},
|
||||
{114,153, 76}, // 75
|
||||
{ 63,127, 0},
|
||||
{ 95,127, 63},
|
||||
{ 38, 76, 0},
|
||||
{ 57, 76, 38},
|
||||
{ 63,255, 0}, // 80
|
||||
{159,255,127},
|
||||
{ 51,204, 0},
|
||||
{127,204,102},
|
||||
{ 38,153, 0},
|
||||
{ 95,153, 76}, // 85
|
||||
{ 31,127, 0},
|
||||
{ 79,127, 63},
|
||||
{ 19, 76, 0},
|
||||
{ 47, 76, 38},
|
||||
{ 0,255, 0}, // 90
|
||||
{127,255,127},
|
||||
{ 0,204, 0},
|
||||
{102,204,102},
|
||||
{ 0,153, 0},
|
||||
{ 76,153, 76}, // 95
|
||||
{ 0,127, 0},
|
||||
{ 63,127, 63},
|
||||
{ 0, 76, 0},
|
||||
{ 38, 76, 38},
|
||||
{ 0,255, 63}, // 100
|
||||
{127,255,159},
|
||||
{ 0,204, 51},
|
||||
{102,204,127},
|
||||
{ 0,153, 38},
|
||||
{ 76,153, 95}, // 105
|
||||
{ 0,127, 31},
|
||||
{ 63,127, 79},
|
||||
{ 0, 76, 19},
|
||||
{ 38, 76, 47},
|
||||
{ 0,255,127}, // 110
|
||||
{127,255,191},
|
||||
{ 0,204,102},
|
||||
{102,204,153},
|
||||
{ 0,153, 76},
|
||||
{ 76,153,114}, // 115
|
||||
{ 0,127, 63},
|
||||
{ 63,127, 95},
|
||||
{ 0, 76, 38},
|
||||
{ 38, 76, 57},
|
||||
{ 0,255,191}, // 120
|
||||
{127,255,223},
|
||||
{ 0,204,153},
|
||||
{102,204,178},
|
||||
{ 0,153,114},
|
||||
{ 76,153,133}, // 125
|
||||
{ 0,127, 95},
|
||||
{ 63,127,111},
|
||||
{ 0, 76, 57},
|
||||
{ 38, 76, 66},
|
||||
{ 0,255,255}, // 130
|
||||
{127,255,255},
|
||||
{ 0,204,204},
|
||||
{102,204,204},
|
||||
{ 0,153,153},
|
||||
{ 76,153,153}, // 135
|
||||
{ 0,127,127},
|
||||
{ 63,127,127},
|
||||
{ 0, 76, 76},
|
||||
{ 38, 76, 76},
|
||||
{ 0,191,255}, // 140
|
||||
{127,223,255},
|
||||
{ 0,153,204},
|
||||
{102,178,204},
|
||||
{ 0,114,153},
|
||||
{ 76,133,153}, // 145
|
||||
{ 0, 95,127},
|
||||
{ 63,111,127},
|
||||
{ 0, 57, 76},
|
||||
{ 38, 66, 76},
|
||||
{ 0,127,255}, // 150
|
||||
{127,191,255},
|
||||
{ 0,102,204},
|
||||
{102,153,204},
|
||||
{ 0, 76,153},
|
||||
{ 76,114,153}, // 155
|
||||
{ 0, 63,127},
|
||||
{ 63, 95,127},
|
||||
{ 0, 38, 76},
|
||||
{ 38, 57, 76},
|
||||
{ 0, 66,255}, // 160
|
||||
{127,159,255},
|
||||
{ 0, 51,204},
|
||||
{102,127,204},
|
||||
{ 0, 38,153},
|
||||
{ 76, 95,153}, // 165
|
||||
{ 0, 31,127},
|
||||
{ 63, 79,127},
|
||||
{ 0, 19, 76},
|
||||
{ 38, 47, 76},
|
||||
{ 0, 0,255}, // 170
|
||||
{127,127,255},
|
||||
{ 0, 0,204},
|
||||
{102,102,204},
|
||||
{ 0, 0,153},
|
||||
{ 76, 76,153}, // 175
|
||||
{ 0, 0,127},
|
||||
{ 63, 63,127},
|
||||
{ 0, 0, 76},
|
||||
{ 38, 38, 76},
|
||||
{ 63, 0,255}, // 180
|
||||
{159,127,255},
|
||||
{ 50, 0,204},
|
||||
{127,102,204},
|
||||
{ 38, 0,153},
|
||||
{ 95, 76,153}, // 185
|
||||
{ 31, 0,127},
|
||||
{ 79, 63,127},
|
||||
{ 19, 0, 76},
|
||||
{ 47, 38, 76},
|
||||
{127, 0,255}, // 190
|
||||
{191,127,255},
|
||||
{102, 0,204},
|
||||
{153,102,204},
|
||||
{ 76, 0,153},
|
||||
{114, 76,153}, // 195
|
||||
{ 63, 0,127},
|
||||
{ 95, 63,127},
|
||||
{ 38, 0, 76},
|
||||
{ 57, 38, 76},
|
||||
{191, 0,255}, // 200
|
||||
{223,127,255},
|
||||
{153, 0,204},
|
||||
{178,102,204},
|
||||
{114, 0,153},
|
||||
{133, 76,153}, // 205
|
||||
{ 95, 0,127},
|
||||
{111, 63,127},
|
||||
{ 57, 0, 76},
|
||||
{ 66, 38, 76},
|
||||
{255, 0,255}, // 210
|
||||
{255,127,255},
|
||||
{204, 0,204},
|
||||
{204,102,204},
|
||||
{153, 0,153},
|
||||
{153, 76,153}, // 215
|
||||
{127, 0,127},
|
||||
{127, 63,127},
|
||||
{ 76, 0, 76},
|
||||
{ 76, 38, 76},
|
||||
{255, 0,191}, // 220
|
||||
{255,127,223},
|
||||
{204, 0,153},
|
||||
{204,102,178},
|
||||
{153, 0,114},
|
||||
{153, 76,133}, // 225
|
||||
{127, 0, 95},
|
||||
{127, 63, 11},
|
||||
{ 76, 0, 57},
|
||||
{ 76, 38, 66},
|
||||
{255, 0,127}, // 230
|
||||
{255,127,191},
|
||||
{204, 0,102},
|
||||
{204,102,153},
|
||||
{153, 0, 76},
|
||||
{153, 76,114}, // 235
|
||||
{127, 0, 63},
|
||||
{127, 63, 95},
|
||||
{ 76, 0, 38},
|
||||
{ 76, 38, 57},
|
||||
{255, 0, 63}, // 240
|
||||
{255,127,159},
|
||||
{204, 0, 51},
|
||||
{204,102,127},
|
||||
{153, 0, 38},
|
||||
{153, 76, 95}, // 245
|
||||
{127, 0, 31},
|
||||
{127, 63, 79},
|
||||
{ 76, 0, 19},
|
||||
{ 76, 38, 47},
|
||||
{ 51, 51, 51}, // 250
|
||||
{ 91, 91, 91},
|
||||
{132,132,132},
|
||||
{173,173,173},
|
||||
{214,214,214},
|
||||
{255,255,255} // 255
|
||||
{255, 127, 127}, {204, 0, 0}, {204, 102, 102}, {153, 0, 0}, {153, 76, 76}, // 15
|
||||
{127, 0, 0}, {127, 63, 63}, {76, 0, 0}, {76, 38, 38}, {255, 63, 0}, // 20
|
||||
{255, 159, 127}, {204, 51, 0}, {204, 127, 102}, {153, 38, 0}, {153, 95, 76}, // 25
|
||||
{127, 31, 0}, {127, 79, 63}, {76, 19, 0}, {76, 47, 38}, {255, 127, 0}, // 30
|
||||
{255, 191, 127}, {204, 102, 0}, {204, 153, 102}, {153, 76, 0}, {153, 114, 76}, // 35
|
||||
{127, 63, 0}, {127, 95, 63}, {76, 38, 0}, {76, 57, 38}, {255, 191, 0}, // 40
|
||||
{255, 223, 127}, {204, 153, 0}, {204, 178, 102}, {153, 114, 0}, {153, 133, 76}, // 45
|
||||
{127, 95, 0}, {127, 111, 63}, {76, 57, 0}, {76, 66, 38}, {255, 255, 0}, // 50
|
||||
{255, 255, 127}, {204, 204, 0}, {204, 204, 102}, {153, 153, 0}, {153, 153, 76}, // 55
|
||||
{127, 127, 0}, {127, 127, 63}, {76, 76, 0}, {76, 76, 38}, {191, 255, 0}, // 60
|
||||
{223, 255, 127}, {153, 204, 0}, {178, 204, 102}, {114, 153, 0}, {133, 153, 76}, // 65
|
||||
{95, 127, 0}, {111, 127, 63}, {57, 76, 0}, {66, 76, 38}, {127, 255, 0}, // 70
|
||||
{191, 255, 127}, {102, 204, 0}, {153, 204, 102}, {76, 153, 0}, {114, 153, 76}, // 75
|
||||
{63, 127, 0}, {95, 127, 63}, {38, 76, 0}, {57, 76, 38}, {63, 255, 0}, // 80
|
||||
{159, 255, 127}, {51, 204, 0}, {127, 204, 102}, {38, 153, 0}, {95, 153, 76}, // 85
|
||||
{31, 127, 0}, {79, 127, 63}, {19, 76, 0}, {47, 76, 38}, {0, 255, 0}, // 90
|
||||
{127, 255, 127}, {0, 204, 0}, {102, 204, 102}, {0, 153, 0}, {76, 153, 76}, // 95
|
||||
{0, 127, 0}, {63, 127, 63}, {0, 76, 0}, {38, 76, 38}, {0, 255, 63}, // 100
|
||||
{127, 255, 159}, {0, 204, 51}, {102, 204, 127}, {0, 153, 38}, {76, 153, 95}, // 105
|
||||
{0, 127, 31}, {63, 127, 79}, {0, 76, 19}, {38, 76, 47}, {0, 255, 127}, // 110
|
||||
{127, 255, 191}, {0, 204, 102}, {102, 204, 153}, {0, 153, 76}, {76, 153, 114}, // 115
|
||||
{0, 127, 63}, {63, 127, 95}, {0, 76, 38}, {38, 76, 57}, {0, 255, 191}, // 120
|
||||
{127, 255, 223}, {0, 204, 153}, {102, 204, 178}, {0, 153, 114}, {76, 153, 133}, // 125
|
||||
{0, 127, 95}, {63, 127, 111}, {0, 76, 57}, {38, 76, 66}, {0, 255, 255}, // 130
|
||||
{127, 255, 255}, {0, 204, 204}, {102, 204, 204}, {0, 153, 153}, {76, 153, 153}, // 135
|
||||
{0, 127, 127}, {63, 127, 127}, {0, 76, 76}, {38, 76, 76}, {0, 191, 255}, // 140
|
||||
{127, 223, 255}, {0, 153, 204}, {102, 178, 204}, {0, 114, 153}, {76, 133, 153}, // 145
|
||||
{0, 95, 127}, {63, 111, 127}, {0, 57, 76}, {38, 66, 76}, {0, 127, 255}, // 150
|
||||
{127, 191, 255}, {0, 102, 204}, {102, 153, 204}, {0, 76, 153}, {76, 114, 153}, // 155
|
||||
{0, 63, 127}, {63, 95, 127}, {0, 38, 76}, {38, 57, 76}, {0, 66, 255}, // 160
|
||||
{127, 159, 255}, {0, 51, 204}, {102, 127, 204}, {0, 38, 153}, {76, 95, 153}, // 165
|
||||
{0, 31, 127}, {63, 79, 127}, {0, 19, 76}, {38, 47, 76}, {0, 0, 255}, // 170
|
||||
{127, 127, 255}, {0, 0, 204}, {102, 102, 204}, {0, 0, 153}, {76, 76, 153}, // 175
|
||||
{0, 0, 127}, {63, 63, 127}, {0, 0, 76}, {38, 38, 76}, {63, 0, 255}, // 180
|
||||
{159, 127, 255}, {50, 0, 204}, {127, 102, 204}, {38, 0, 153}, {95, 76, 153}, // 185
|
||||
{31, 0, 127}, {79, 63, 127}, {19, 0, 76}, {47, 38, 76}, {127, 0, 255}, // 190
|
||||
{191, 127, 255}, {102, 0, 204}, {153, 102, 204}, {76, 0, 153}, {114, 76, 153}, // 195
|
||||
{63, 0, 127}, {95, 63, 127}, {38, 0, 76}, {57, 38, 76}, {191, 0, 255}, // 200
|
||||
{223, 127, 255}, {153, 0, 204}, {178, 102, 204}, {114, 0, 153}, {133, 76, 153}, // 205
|
||||
{95, 0, 127}, {111, 63, 127}, {57, 0, 76}, {66, 38, 76}, {255, 0, 255}, // 210
|
||||
{255, 127, 255}, {204, 0, 204}, {204, 102, 204}, {153, 0, 153}, {153, 76, 153}, // 215
|
||||
{127, 0, 127}, {127, 63, 127}, {76, 0, 76}, {76, 38, 76}, {255, 0, 191}, // 220
|
||||
{255, 127, 223}, {204, 0, 153}, {204, 102, 178}, {153, 0, 114}, {153, 76, 133}, // 225
|
||||
{127, 0, 95}, {127, 63, 11}, {76, 0, 57}, {76, 38, 66}, {255, 0, 127}, // 230
|
||||
{255, 127, 191}, {204, 0, 102}, {204, 102, 153}, {153, 0, 76}, {153, 76, 114}, // 235
|
||||
{127, 0, 63}, {127, 63, 95}, {76, 0, 38}, {76, 38, 57}, {255, 0, 63}, // 240
|
||||
{255, 127, 159}, {204, 0, 51}, {204, 102, 127}, {153, 0, 38}, {153, 76, 95}, // 245
|
||||
{127, 0, 31}, {127, 63, 79}, {76, 0, 19}, {76, 38, 47}, {51, 51, 51}, // 250
|
||||
{91, 91, 91}, {132, 132, 132}, {173, 173, 173}, {214, 214, 214}, {255, 255, 255} // 255
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace DRW
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ dxfRW::dxfRW(const char *name)
|
|||
|
||||
dxfRW::~dxfRW()
|
||||
{
|
||||
delete reader;
|
||||
delete writer;
|
||||
for (auto &it : imageDef)
|
||||
{
|
||||
delete it;
|
||||
|
@ -92,19 +90,19 @@ auto dxfRW::read(DRW_Interface *interface_, bool ext) -> bool
|
|||
binFile = true;
|
||||
// skip sentinel
|
||||
filestr.seekg(22, std::ios::beg);
|
||||
reader = new dxfReaderBinary(&filestr);
|
||||
reader = std::make_unique<dxfReaderBinary>(&filestr);
|
||||
DRW_DBG("dxfRW::read binary file\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
binFile = false;
|
||||
filestr.open(fileName.c_str(), std::ios_base::in);
|
||||
reader = new dxfReaderAscii(&filestr);
|
||||
reader = std::make_unique<dxfReaderAscii>(&filestr);
|
||||
}
|
||||
|
||||
bool isOk = processDxf();
|
||||
filestr.close();
|
||||
delete reader;
|
||||
reader.reset();
|
||||
reader = nullptr;
|
||||
return isOk;
|
||||
}
|
||||
|
@ -124,13 +122,13 @@ auto dxfRW::write(DRW_Interface *interface_, DRW::Version ver, bool bin) -> bool
|
|||
filestr.open(fileName.c_str(), std::ios_base::out | std::ios::binary | std::ios::trunc);
|
||||
// write sentinel
|
||||
filestr << "AutoCAD Binary DXF\r\n" << static_cast<char>(26) << '\0';
|
||||
writer = new dxfWriterBinary(&filestr);
|
||||
writer = std::make_unique<dxfWriterBinary>(&filestr);
|
||||
DRW_DBG("dxfRW::read binary file\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
filestr.open(fileName.c_str(), std::ios_base::out | std::ios::trunc);
|
||||
writer = new dxfWriterAscii(&filestr);
|
||||
writer = std::make_unique<dxfWriterAscii>(&filestr);
|
||||
std::string comm = std::string("dxfrw ") + std::string(DRW_VERSION);
|
||||
writer->writeString(999, comm);
|
||||
}
|
||||
|
@ -174,13 +172,11 @@ auto dxfRW::write(DRW_Interface *interface_, DRW::Version ver, bool bin) -> bool
|
|||
catch (std::ofstream::failure &writeErr)
|
||||
{
|
||||
errorString = writeErr.what();
|
||||
delete writer;
|
||||
writer = nullptr;
|
||||
writer.reset();
|
||||
return isOk;
|
||||
}
|
||||
isOk = true;
|
||||
delete writer;
|
||||
writer = nullptr;
|
||||
writer.reset();
|
||||
return isOk;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ private:
|
|||
std::string codePage{};
|
||||
bool binFile{false};
|
||||
bool m_xSpaceBlock{true};
|
||||
dxfReader *reader{nullptr};
|
||||
dxfWriter *writer{nullptr};
|
||||
std::unique_ptr<dxfReader> reader{};
|
||||
std::unique_ptr<dxfWriter> writer{};
|
||||
DRW_Interface *iface{nullptr};
|
||||
DRW_Header header{};
|
||||
// int section;
|
||||
|
|
Loading…
Reference in New Issue
Block a user