GCC warnings.
--HG-- branch : develop
This commit is contained in:
parent
b6e0d97df0
commit
1726b55339
|
@ -293,8 +293,8 @@ GCC_DEBUG_CXXFLAGS += \
|
||||||
-Wno-unused \
|
-Wno-unused \
|
||||||
-ftrapv
|
-ftrapv
|
||||||
|
|
||||||
# Good support Q_NULLPTR come later
|
# Good support Q_NULLPTR came later
|
||||||
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 5) {
|
||||||
GCC_DEBUG_CXXFLAGS += -Wzero-as-null-pointer-constant
|
GCC_DEBUG_CXXFLAGS += -Wzero-as-null-pointer-constant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ class DialogMDataBase : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogMDataBase(const QStringList &list, QWidget *parent = 0);
|
explicit DialogMDataBase(const QStringList &list, QWidget *parent = nullptr);
|
||||||
explicit DialogMDataBase(QWidget *parent = 0);
|
explicit DialogMDataBase(QWidget *parent = nullptr);
|
||||||
virtual ~DialogMDataBase() Q_DECL_OVERRIDE;
|
virtual ~DialogMDataBase() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QStringList GetNewNames() const;
|
QStringList GetNewNames() const;
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DialogNewMeasurements : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogNewMeasurements(QWidget *parent = 0);
|
explicit DialogNewMeasurements(QWidget *parent = nullptr);
|
||||||
~DialogNewMeasurements();
|
~DialogNewMeasurements();
|
||||||
|
|
||||||
MeasurementsType Type() const;
|
MeasurementsType Type() const;
|
||||||
|
|
|
@ -283,7 +283,7 @@ VApplication::VApplication(int &argc, char **argv)
|
||||||
VApplication::~VApplication()
|
VApplication::~VApplication()
|
||||||
{
|
{
|
||||||
qCDebug(vApp, "Application closing.");
|
qCDebug(vApp, "Application closing.");
|
||||||
qInstallMessageHandler(0); // Resore the message handler
|
qInstallMessageHandler(nullptr); // Resore the message handler
|
||||||
delete trVars;
|
delete trVars;
|
||||||
VCommandLine::Reset();
|
VCommandLine::Reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DialogLayoutProgress : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogLayoutProgress(int count, QWidget *parent = 0);
|
explicit DialogLayoutProgress(int count, QWidget *parent = nullptr);
|
||||||
~DialogLayoutProgress();
|
~DialogLayoutProgress();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -338,7 +338,7 @@ QString QmuParserBase::GetVersion(EParserVersionInfo eInfo)
|
||||||
void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback,
|
void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback,
|
||||||
funmap_type &a_Storage, const QString &a_szCharSet )
|
funmap_type &a_Storage, const QString &a_szCharSet )
|
||||||
{
|
{
|
||||||
if (a_Callback.GetAddr()==0)
|
if (a_Callback.GetAddr() == nullptr)
|
||||||
{
|
{
|
||||||
Error(ecINVALID_FUN_PTR);
|
Error(ecINVALID_FUN_PTR);
|
||||||
}
|
}
|
||||||
|
@ -582,7 +582,7 @@ void QmuParserBase::DefineStrConst(const QString &a_strName, const QString &a_st
|
||||||
*/
|
*/
|
||||||
void QmuParserBase::DefineVar(const QString &a_sName, qreal *a_pVar)
|
void QmuParserBase::DefineVar(const QString &a_sName, qreal *a_pVar)
|
||||||
{
|
{
|
||||||
if (a_pVar==0)
|
if (a_pVar == nullptr)
|
||||||
{
|
{
|
||||||
Error(ecINVALID_VAR_PTR);
|
Error(ecINVALID_VAR_PTR);
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ void QmuParserBase::ApplyFunc( QStack<token_type> &a_stOpt, QStack<token_type> &
|
||||||
assert(m_pTokenReader.get());
|
assert(m_pTokenReader.get());
|
||||||
|
|
||||||
// Operator stack empty or does not contain tokens with callback functions
|
// Operator stack empty or does not contain tokens with callback functions
|
||||||
if (a_stOpt.empty() || a_stOpt.top().GetFuncAddr()==0 )
|
if (a_stOpt.empty() || a_stOpt.top().GetFuncAddr() == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1451,7 +1451,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
// The opening bracket was popped from the stack now check if there
|
// The opening bracket was popped from the stack now check if there
|
||||||
// was a function before this bracket
|
// was a function before this bracket
|
||||||
if (stOpt.size() && stOpt.top().GetCode()!=cmOPRT_INFIX && stOpt.top().GetCode()!=cmOPRT_BIN &&
|
if (stOpt.size() && stOpt.top().GetCode()!=cmOPRT_INFIX && stOpt.top().GetCode()!=cmOPRT_BIN &&
|
||||||
stOpt.top().GetFuncAddr()!=0)
|
stOpt.top().GetFuncAddr()!=nullptr)
|
||||||
{
|
{
|
||||||
ApplyFunc(stOpt, stVal, iArgCount);
|
ApplyFunc(stOpt, stVal, iArgCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,8 +296,8 @@ QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti )
|
||||||
* @throw nothrow
|
* @throw nothrow
|
||||||
*/
|
*/
|
||||||
QmuParserCallback::QmuParserCallback()
|
QmuParserCallback::QmuParserCallback()
|
||||||
: m_pFun ( 0 ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), m_iCode ( cmUNKNOWN ), m_iType ( tpVOID ),
|
: m_pFun ( nullptr ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), m_iCode ( cmUNKNOWN ),
|
||||||
m_bAllowOpti ( 0 )
|
m_iType ( tpVOID ), m_bAllowOpti ( 0 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -339,12 +339,12 @@ int QmuParserTester::TestNames()
|
||||||
PARSER_THROWCHECK ( Var, true, "a_min", &a )
|
PARSER_THROWCHECK ( Var, true, "a_min", &a )
|
||||||
PARSER_THROWCHECK ( Var, true, "a_min0", &a )
|
PARSER_THROWCHECK ( Var, true, "a_min0", &a )
|
||||||
PARSER_THROWCHECK ( Var, true, "a_min9", &a )
|
PARSER_THROWCHECK ( Var, true, "a_min9", &a )
|
||||||
PARSER_THROWCHECK ( Var, false, "a_min9", 0 )
|
PARSER_THROWCHECK ( Var, false, "a_min9", nullptr )
|
||||||
// Postfix operators
|
// Postfix operators
|
||||||
// fail
|
// fail
|
||||||
PARSER_THROWCHECK ( PostfixOprt, false, "(k", f1of1 )
|
PARSER_THROWCHECK ( PostfixOprt, false, "(k", f1of1 )
|
||||||
PARSER_THROWCHECK ( PostfixOprt, false, "9+", f1of1 )
|
PARSER_THROWCHECK ( PostfixOprt, false, "9+", f1of1 )
|
||||||
PARSER_THROWCHECK ( PostfixOprt, false, "+", 0 )
|
PARSER_THROWCHECK ( PostfixOprt, false, "+", nullptr )
|
||||||
// pass
|
// pass
|
||||||
PARSER_THROWCHECK ( PostfixOprt, true, "-a", f1of1 )
|
PARSER_THROWCHECK ( PostfixOprt, true, "-a", f1of1 )
|
||||||
PARSER_THROWCHECK ( PostfixOprt, true, "?a", f1of1 )
|
PARSER_THROWCHECK ( PostfixOprt, true, "?a", f1of1 )
|
||||||
|
@ -543,7 +543,7 @@ int QmuParserTester::TestVarConst()
|
||||||
|
|
||||||
for ( item = UsedVar.begin(); item != UsedVar.end(); ++item )
|
for ( item = UsedVar.begin(); item != UsedVar.end(); ++item )
|
||||||
{
|
{
|
||||||
if ( item->second != 0 )
|
if ( item->second != nullptr )
|
||||||
{
|
{
|
||||||
throw false; // all pointers to undefined variables must be null
|
throw false; // all pointers to undefined variables must be null
|
||||||
}
|
}
|
||||||
|
@ -1378,7 +1378,7 @@ int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass
|
||||||
|
|
||||||
// destroy the originals from p2
|
// destroy the originals from p2
|
||||||
vParser.clear(); // delete the vector
|
vParser.clear(); // delete the vector
|
||||||
p1.reset ( 0 );
|
p1.reset ( nullptr );
|
||||||
|
|
||||||
fVal[2] = p2.Eval();
|
fVal[2] = p2.Eval();
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,8 @@ public:
|
||||||
* @sa ECmdCode
|
* @sa ECmdCode
|
||||||
*/
|
*/
|
||||||
QmuParserToken()
|
QmuParserToken()
|
||||||
: m_iCode ( cmUNKNOWN ), m_iType ( tpVOID ), m_pTok ( 0 ), m_iIdx ( -1 ), m_strTok(), m_strVal(), m_fVal(),
|
: m_iCode ( cmUNKNOWN ), m_iType ( tpVOID ), m_pTok ( nullptr ), m_iIdx ( -1 ), m_strTok(), m_strVal(),
|
||||||
m_pCallback()
|
m_fVal(), m_pCallback()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -121,7 +121,7 @@ public:
|
||||||
m_iType = a_Tok.m_iType;
|
m_iType = a_Tok.m_iType;
|
||||||
m_fVal = a_Tok.m_fVal;
|
m_fVal = a_Tok.m_fVal;
|
||||||
// create new callback object if a_Tok has one
|
// create new callback object if a_Tok has one
|
||||||
m_pCallback.reset ( a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0 );
|
m_pCallback.reset ( a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -145,7 +145,7 @@ public:
|
||||||
|
|
||||||
m_iCode = a_iType;
|
m_iCode = a_iType;
|
||||||
m_iType = tpVOID;
|
m_iType = tpVOID;
|
||||||
m_pTok = 0;
|
m_pTok = nullptr;
|
||||||
m_strTok = a_strTok;
|
m_strTok = a_strTok;
|
||||||
m_iIdx = -1;
|
m_iIdx = -1;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
m_strTok = a_sTok;
|
m_strTok = a_sTok;
|
||||||
m_pCallback.reset ( new QmuParserCallback ( a_pCallback ) );
|
m_pCallback.reset ( new QmuParserCallback ( a_pCallback ) );
|
||||||
|
|
||||||
m_pTok = 0;
|
m_pTok = nullptr;
|
||||||
m_iIdx = -1;
|
m_iIdx = -1;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -186,8 +186,8 @@ public:
|
||||||
m_strTok = a_strTok;
|
m_strTok = a_strTok;
|
||||||
m_iIdx = -1;
|
m_iIdx = -1;
|
||||||
|
|
||||||
m_pTok = 0;
|
m_pTok = nullptr;
|
||||||
m_pCallback.reset ( 0 );
|
m_pCallback.reset ( nullptr );
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public:
|
||||||
m_strTok = a_strTok;
|
m_strTok = a_strTok;
|
||||||
m_iIdx = -1;
|
m_iIdx = -1;
|
||||||
m_pTok = reinterpret_cast<void*> ( a_pVar );
|
m_pTok = reinterpret_cast<void*> ( a_pVar );
|
||||||
m_pCallback.reset ( 0 );
|
m_pCallback.reset ( nullptr );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +224,8 @@ public:
|
||||||
m_strTok = a_strTok;
|
m_strTok = a_strTok;
|
||||||
m_iIdx = a_iSize;
|
m_iIdx = a_iSize;
|
||||||
|
|
||||||
m_pTok = 0;
|
m_pTok = nullptr;
|
||||||
m_pCallback.reset ( 0 );
|
m_pCallback.reset ( nullptr );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ public:
|
||||||
generic_fun_type GetFuncAddr() const
|
generic_fun_type GetFuncAddr() const
|
||||||
{
|
{
|
||||||
return ( union_cast<generic_fun_type>( m_pCallback.get() ) ) ?
|
return ( union_cast<generic_fun_type>( m_pCallback.get() ) ) ?
|
||||||
union_cast<generic_fun_type>( m_pCallback->GetAddr() ) : union_cast<generic_fun_type>(0);
|
union_cast<generic_fun_type>( m_pCallback->GetAddr() ) : union_cast<generic_fun_type>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
@ -947,7 +947,7 @@ bool QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a_Tok.SetVar ( &m_fZero, strTok );
|
a_Tok.SetVar ( &m_fZero, strTok );
|
||||||
m_UsedVar[strTok] = 0; // Add variable to used-var-list
|
m_UsedVar[strTok] = nullptr; // Add variable to used-var-list
|
||||||
}
|
}
|
||||||
|
|
||||||
m_iPos = iEnd;
|
m_iPos = iEnd;
|
||||||
|
|
|
@ -54,12 +54,13 @@ class QMUPARSERSHARED_EXPORT QmuTranslation
|
||||||
public:
|
public:
|
||||||
QmuTranslation();
|
QmuTranslation();
|
||||||
~QmuTranslation(){}
|
~QmuTranslation(){}
|
||||||
QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = 0, int n = -1);
|
QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = nullptr,
|
||||||
|
int n = -1);
|
||||||
QmuTranslation &operator=(const QmuTranslation &tr);
|
QmuTranslation &operator=(const QmuTranslation &tr);
|
||||||
QmuTranslation(const QmuTranslation &tr);
|
QmuTranslation(const QmuTranslation &tr);
|
||||||
QString translate() const;
|
QString translate() const;
|
||||||
static QmuTranslation translate(const QString &context, const QString &sourceText,
|
static QmuTranslation translate(const QString &context, const QString &sourceText,
|
||||||
const QString &disambiguation = 0, int n = -1);
|
const QString &disambiguation = nullptr, int n = -1);
|
||||||
QString getMcontext() const;
|
QString getMcontext() const;
|
||||||
QString getMsourceText() const;
|
QString getMsourceText() const;
|
||||||
QString getMdisambiguation() const;
|
QString getMdisambiguation() const;
|
||||||
|
|
|
@ -22,18 +22,32 @@ class QFont;
|
||||||
//class to store image data and path from DRW_ImageDef
|
//class to store image data and path from DRW_ImageDef
|
||||||
class dx_ifaceImg : public DRW_Image {
|
class dx_ifaceImg : public DRW_Image {
|
||||||
public:
|
public:
|
||||||
dx_ifaceImg(){}
|
dx_ifaceImg()
|
||||||
dx_ifaceImg(const DRW_Image& p):DRW_Image(p){}
|
: path()
|
||||||
~dx_ifaceImg(){}
|
{}
|
||||||
|
|
||||||
|
dx_ifaceImg(const DRW_Image& p)
|
||||||
|
: DRW_Image(p),
|
||||||
|
path()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~dx_ifaceImg() = default;
|
||||||
std::string path; //stores the image path
|
std::string path; //stores the image path
|
||||||
};
|
};
|
||||||
|
|
||||||
//container class to store entites.
|
//container class to store entites.
|
||||||
class dx_ifaceBlock : public DRW_Block {
|
class dx_ifaceBlock : public DRW_Block {
|
||||||
public:
|
public:
|
||||||
dx_ifaceBlock(){}
|
dx_ifaceBlock()
|
||||||
dx_ifaceBlock(const DRW_Block& p):DRW_Block(p){}
|
: ent()
|
||||||
~dx_ifaceBlock(){
|
{}
|
||||||
|
|
||||||
|
dx_ifaceBlock(const DRW_Block& p)
|
||||||
|
: DRW_Block(p),
|
||||||
|
ent()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~dx_ifaceBlock(){
|
||||||
for (std::list<DRW_Entity*>::const_iterator it=ent.begin(); it!=ent.end(); ++it)
|
for (std::list<DRW_Entity*>::const_iterator it=ent.begin(); it!=ent.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
@ -44,9 +58,19 @@ public:
|
||||||
//container class to store full dwg/dxf data.
|
//container class to store full dwg/dxf data.
|
||||||
class dx_data {
|
class dx_data {
|
||||||
public:
|
public:
|
||||||
dx_data(){
|
dx_data()
|
||||||
mBlock = new dx_ifaceBlock();
|
: headerC(),
|
||||||
}
|
lineTypes(),
|
||||||
|
layers(),
|
||||||
|
dimStyles(),
|
||||||
|
VPorts(),
|
||||||
|
textStyles(),
|
||||||
|
appIds(),
|
||||||
|
blocks(),
|
||||||
|
images(),
|
||||||
|
mBlock(new dx_ifaceBlock())
|
||||||
|
{}
|
||||||
|
|
||||||
~dx_data(){
|
~dx_data(){
|
||||||
//cleanup,
|
//cleanup,
|
||||||
for (std::list<dx_ifaceBlock*>::const_iterator it=blocks.begin(); it!=blocks.end(); ++it)
|
for (std::list<dx_ifaceBlock*>::const_iterator it=blocks.begin(); it!=blocks.end(); ++it)
|
||||||
|
@ -65,7 +89,8 @@ public:
|
||||||
std::list<dx_ifaceImg*>images; //temporary list to find images for link with DRW_ImageDef. Do not delete it!!
|
std::list<dx_ifaceImg*>images; //temporary list to find images for link with DRW_ImageDef. Do not delete it!!
|
||||||
|
|
||||||
dx_ifaceBlock* mBlock; //container to store model entities
|
dx_ifaceBlock* mBlock; //container to store model entities
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(dx_data)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,6 +121,7 @@ public:
|
||||||
UTF8STRING AddFont(const QFont &f);
|
UTF8STRING AddFont(const QFont &f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dx_iface)
|
||||||
dxfRW* dxfW; //pointer to writer, needed to send data
|
dxfRW* dxfW; //pointer to writer, needed to send data
|
||||||
dx_data cData; // class to store or read data
|
dx_data cData; // class to store or read data
|
||||||
DRW::Version version;
|
DRW::Version version;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#ifdef DRW_ASSERTS
|
#ifdef DRW_ASSERTS
|
||||||
# define drw_assert(a) assert(a)
|
# define drw_assert(a) assert(a)
|
||||||
|
@ -158,6 +159,23 @@ enum TransparencyCodes {
|
||||||
|
|
||||||
} // namespace DRW
|
} // namespace DRW
|
||||||
|
|
||||||
|
Q_REQUIRED_RESULT static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2);
|
||||||
|
static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2)
|
||||||
|
{
|
||||||
|
if(qFuzzyIsNull(p1))
|
||||||
|
{
|
||||||
|
return qFuzzyIsNull(p2);
|
||||||
|
}
|
||||||
|
else if(qFuzzyIsNull(p2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return qFuzzyCompare(p1, p2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! Class to handle 3D coordinate point
|
//! Class to handle 3D coordinate point
|
||||||
/*!
|
/*!
|
||||||
* Class to handle 3D coordinate point
|
* Class to handle 3D coordinate point
|
||||||
|
@ -165,13 +183,27 @@ enum TransparencyCodes {
|
||||||
*/
|
*/
|
||||||
class DRW_Coord {
|
class DRW_Coord {
|
||||||
public:
|
public:
|
||||||
DRW_Coord() { x = 0; y = 0; z = 0; }
|
DRW_Coord()
|
||||||
DRW_Coord(double ix, double iy, double iz) {
|
: x(0),
|
||||||
x = ix; y = iy; z = iz;
|
y(0),
|
||||||
}
|
z(0)
|
||||||
|
{}
|
||||||
|
DRW_Coord(double ix, double iy, double iz)
|
||||||
|
: x(ix),
|
||||||
|
y(iy),
|
||||||
|
z(iz)
|
||||||
|
{}
|
||||||
|
|
||||||
DRW_Coord operator = (const DRW_Coord& data) {
|
DRW_Coord &operator = (const DRW_Coord& data)
|
||||||
x = data.x; y = data.y; z = data.z;
|
{
|
||||||
|
if ( &data == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = data.x;
|
||||||
|
y = data.y;
|
||||||
|
z = data.z;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
/*!< convert to unitary vector */
|
/*!< convert to unitary vector */
|
||||||
|
@ -199,16 +231,22 @@ public:
|
||||||
*/
|
*/
|
||||||
class DRW_Vertex2D {
|
class DRW_Vertex2D {
|
||||||
public:
|
public:
|
||||||
DRW_Vertex2D() {
|
DRW_Vertex2D()
|
||||||
|
: x(),
|
||||||
|
y(),
|
||||||
|
stawidth(0),
|
||||||
|
endwidth(0),
|
||||||
|
bulge(0)
|
||||||
|
{
|
||||||
// eType = DRW::LWPOLYLINE;
|
// eType = DRW::LWPOLYLINE;
|
||||||
stawidth = endwidth = bulge = 0;
|
|
||||||
}
|
|
||||||
DRW_Vertex2D(double sx, double sy, double b) {
|
|
||||||
stawidth = endwidth = 0;
|
|
||||||
x = sx;
|
|
||||||
y =sy;
|
|
||||||
bulge = b;
|
|
||||||
}
|
}
|
||||||
|
DRW_Vertex2D(double sx, double sy, double b)
|
||||||
|
: x(sx),
|
||||||
|
y(sy),
|
||||||
|
stawidth(0),
|
||||||
|
endwidth(0),
|
||||||
|
bulge(b)
|
||||||
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double x; /*!< x coordinate, code 10 */
|
double x; /*!< x coordinate, code 10 */
|
||||||
|
@ -234,41 +272,85 @@ public:
|
||||||
INVALID
|
INVALID
|
||||||
};
|
};
|
||||||
//TODO: add INT64 support
|
//TODO: add INT64 support
|
||||||
DRW_Variant() {
|
DRW_Variant()
|
||||||
type = INVALID;
|
: content(),
|
||||||
|
type(INVALID),
|
||||||
|
code(),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{}
|
||||||
|
|
||||||
|
DRW_Variant(int c, dint32 i)
|
||||||
|
: content(),
|
||||||
|
type(),
|
||||||
|
code(c),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{
|
||||||
|
addInt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Variant(int c, dint32 i) {
|
DRW_Variant(int c, duint32 i)
|
||||||
code = c; addInt(i);
|
: content(),
|
||||||
|
type(),
|
||||||
|
code(c),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{
|
||||||
|
addInt(static_cast<dint32>(i));//RLZ: verify if work with big numbers
|
||||||
}
|
}
|
||||||
DRW_Variant(int c, duint32 i) {
|
|
||||||
code = c; addInt(static_cast<dint32>(i));//RLZ: verify if worrk with big numbers
|
DRW_Variant(int c, double d)
|
||||||
|
: content(),
|
||||||
|
type(),
|
||||||
|
code(c),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{
|
||||||
|
addDouble(d);
|
||||||
}
|
}
|
||||||
DRW_Variant(int c, double d) {
|
|
||||||
code = c; addDouble(d);
|
DRW_Variant(int c, UTF8STRING s)
|
||||||
|
: content(),
|
||||||
|
type(),
|
||||||
|
code(c),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{
|
||||||
|
addString(s);
|
||||||
}
|
}
|
||||||
DRW_Variant(int c, UTF8STRING s) {
|
|
||||||
code = c; addString(s);
|
DRW_Variant(int c, DRW_Coord crd)
|
||||||
|
: content(),
|
||||||
|
type(),
|
||||||
|
code(c),
|
||||||
|
sdata(),
|
||||||
|
vdata()
|
||||||
|
{
|
||||||
|
addCoord(crd);
|
||||||
}
|
}
|
||||||
DRW_Variant(int c, DRW_Coord crd) {
|
|
||||||
code = c; addCoord(crd);
|
DRW_Variant(const DRW_Variant& d)
|
||||||
}
|
: content(d.content),
|
||||||
DRW_Variant(const DRW_Variant& d) {
|
type(d.type),
|
||||||
code = d.code;
|
code(d.code),
|
||||||
type = d.type;
|
sdata(),
|
||||||
content = d.content;
|
vdata()
|
||||||
if (d.type == COORD) {
|
{
|
||||||
|
if (d.type == COORD)
|
||||||
|
{
|
||||||
vdata = d.vdata;
|
vdata = d.vdata;
|
||||||
content.v = &vdata;
|
content.v = &vdata;
|
||||||
}
|
}
|
||||||
if (d.type == STRING) {
|
|
||||||
|
if (d.type == STRING)
|
||||||
|
{
|
||||||
sdata = d.sdata;
|
sdata = d.sdata;
|
||||||
content.s = &sdata;
|
content.s = &sdata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~DRW_Variant() {
|
~DRW_Variant() = default;
|
||||||
}
|
|
||||||
|
|
||||||
void addString(UTF8STRING s) {setType(STRING); sdata = s; content.s = &sdata;}
|
void addString(UTF8STRING s) {setType(STRING); sdata = s; content.s = &sdata;}
|
||||||
void addInt(int i) {setType(INTEGER); content.i = i;}
|
void addInt(int i) {setType(INTEGER); content.i = i;}
|
||||||
|
@ -305,12 +387,14 @@ private:
|
||||||
*/
|
*/
|
||||||
class dwgHandle{
|
class dwgHandle{
|
||||||
public:
|
public:
|
||||||
dwgHandle(){
|
dwgHandle()
|
||||||
code=0;
|
: code(0),
|
||||||
size=0;
|
size(0),
|
||||||
ref=0;
|
ref(0)
|
||||||
}
|
{}
|
||||||
~dwgHandle(){}
|
|
||||||
|
~dwgHandle() = default;
|
||||||
|
|
||||||
duint8 code;
|
duint8 code;
|
||||||
duint8 size;
|
duint8 size;
|
||||||
duint32 ref;
|
duint32 ref;
|
||||||
|
|
|
@ -29,10 +29,19 @@ class dwgBuffer;
|
||||||
*/
|
*/
|
||||||
class DRW_Class {
|
class DRW_Class {
|
||||||
public:
|
public:
|
||||||
DRW_Class() {
|
DRW_Class()
|
||||||
}
|
: recName(),
|
||||||
~DRW_Class() {
|
className(),
|
||||||
}
|
appName(),
|
||||||
|
proxyFlag(),
|
||||||
|
instanceCount(),
|
||||||
|
wasaProxyFlag(),
|
||||||
|
entityFlag(),
|
||||||
|
classNum(),
|
||||||
|
dwgType()
|
||||||
|
{}
|
||||||
|
|
||||||
|
~DRW_Class() = default;
|
||||||
|
|
||||||
void parseCode(int code, dxfReader *reader);
|
void parseCode(int code, dxfReader *reader);
|
||||||
void write(dxfWriter *writer, DRW::Version ver);
|
void write(dxfWriter *writer, DRW::Version ver);
|
||||||
|
|
|
@ -135,7 +135,7 @@ bool DRW_Entity::parseCode(int code, dxfReader *reader){
|
||||||
case 1033:
|
case 1033:
|
||||||
if (curr)
|
if (curr)
|
||||||
curr->setCoordZ(reader->getDouble());
|
curr->setCoordZ(reader->getDouble());
|
||||||
curr=NULL;
|
curr=nullptr;
|
||||||
break;
|
break;
|
||||||
case 1040:
|
case 1040:
|
||||||
case 1041:
|
case 1041:
|
||||||
|
@ -159,7 +159,7 @@ bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
|
||||||
int nc;
|
int nc;
|
||||||
std::string appName= reader->getString();
|
std::string appName= reader->getString();
|
||||||
if (!appName.empty() && appName.at(0)== '{'){
|
if (!appName.empty() && appName.at(0)== '{'){
|
||||||
curr.addString(appName.substr(1, (int) appName.size()-1));
|
curr.addString(appName.substr(1, static_cast<int>(appName.size()-1)));
|
||||||
curr.code = code;
|
curr.code = code;
|
||||||
ls.push_back(curr);
|
ls.push_back(curr);
|
||||||
while (code !=102 && appName.at(0)== '}'){
|
while (code !=102 && appName.at(0)== '}'){
|
||||||
|
@ -205,7 +205,7 @@ bool DRW_Entity::parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer* strBu
|
||||||
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
||||||
}
|
}
|
||||||
if (version > DRW::AC1021) {//2010+
|
if (version > DRW::AC1021) {//2010+
|
||||||
duint32 ms = buf->size();
|
duint32 ms = static_cast<duint32>(buf->size());
|
||||||
objSize = ms*8 - bs;
|
objSize = ms*8 - bs;
|
||||||
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ bool DRW_Entity::parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer* strBu
|
||||||
DRW_DBG("\nDRW_TableEntry::parseDwg string 0x8000 bit is set");
|
DRW_DBG("\nDRW_TableEntry::parseDwg string 0x8000 bit is set");
|
||||||
strBuf->moveBitPos(-33);//RLZ pending to verify
|
strBuf->moveBitPos(-33);//RLZ pending to verify
|
||||||
duint16 hiSize = strBuf->getRawShort16();
|
duint16 hiSize = strBuf->getRawShort16();
|
||||||
strDataSize = ((strDataSize&0x7fff) | (hiSize<<15));
|
strDataSize = static_cast<duint16>((strDataSize&0x7fff) | (hiSize<<15));
|
||||||
}
|
}
|
||||||
strBuf->moveBitPos( -strDataSize -16); //-14
|
strBuf->moveBitPos( -strDataSize -16); //-14
|
||||||
DRW_DBG("strBuf start strDataSize pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: "); DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
DRW_DBG("strBuf start strDataSize pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: "); DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
||||||
|
@ -290,7 +290,7 @@ bool DRW_Entity::parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer* strBu
|
||||||
// entmode = 2;
|
// entmode = 2;
|
||||||
else if(entmode ==2)
|
else if(entmode ==2)
|
||||||
entmode = 0;
|
entmode = 0;
|
||||||
space = (DRW::Space)entmode; //RLZ verify cast values
|
space = static_cast<DRW::Space>(entmode); //RLZ verify cast values
|
||||||
DRW_DBG("entmode: "); DRW_DBG(entmode);
|
DRW_DBG("entmode: "); DRW_DBG(entmode);
|
||||||
numReactors = buf->getBitShort(); //BS
|
numReactors = buf->getBitShort(); //BS
|
||||||
DRW_DBG(", numReactors: "); DRW_DBG(numReactors);
|
DRW_DBG(", numReactors: "); DRW_DBG(numReactors);
|
||||||
|
@ -493,7 +493,7 @@ void DRW_Point::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Point::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Point::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing point *********************************************\n");
|
DRW_DBG("\n***************************** parsing point *********************************************\n");
|
||||||
|
@ -535,7 +535,7 @@ void DRW_Line::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Line::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Line::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing line *********************************************\n");
|
DRW_DBG("\n***************************** parsing line *********************************************\n");
|
||||||
|
@ -573,7 +573,7 @@ bool DRW_Line::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Ray::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Ray::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing ray/xline *********************************************\n");
|
DRW_DBG("\n***************************** parsing ray/xline *********************************************\n");
|
||||||
|
@ -613,7 +613,7 @@ void DRW_Circle::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Circle::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Circle::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing circle *********************************************\n");
|
DRW_DBG("\n***************************** parsing circle *********************************************\n");
|
||||||
|
@ -672,7 +672,7 @@ void DRW_Arc::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Arc::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Arc::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing circle arc *********************************************\n");
|
DRW_DBG("\n***************************** parsing circle arc *********************************************\n");
|
||||||
|
@ -730,7 +730,7 @@ void DRW_Ellipse::applyExtrusion(){
|
||||||
//if ratio > 1 minor axis are greather than major axis, correct it
|
//if ratio > 1 minor axis are greather than major axis, correct it
|
||||||
void DRW_Ellipse::correctAxis(){
|
void DRW_Ellipse::correctAxis(){
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
if (staparam == endparam) {
|
if (DRW_FuzzyComparePossibleNulls(staparam, endparam)) {
|
||||||
staparam = 0.0;
|
staparam = 0.0;
|
||||||
endparam = M_PIx2; //2*M_PI;
|
endparam = M_PIx2; //2*M_PI;
|
||||||
complete = true;
|
complete = true;
|
||||||
|
@ -754,7 +754,7 @@ void DRW_Ellipse::correctAxis(){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Ellipse::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Ellipse::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing ellipse *********************************************\n");
|
DRW_DBG("\n***************************** parsing ellipse *********************************************\n");
|
||||||
|
@ -851,7 +851,7 @@ void DRW_Trace::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Trace::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Trace::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing Trace *********************************************\n");
|
DRW_DBG("\n***************************** parsing Trace *********************************************\n");
|
||||||
|
@ -909,7 +909,7 @@ void DRW_3Dface::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_3Dface::parseDwg(DRW::Version v, dwgBuffer *buf, duint32 bs){
|
bool DRW_3Dface::parseDwg(DRW::Version v, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(v, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(v, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing 3Dface *********************************************\n");
|
DRW_DBG("\n***************************** parsing 3Dface *********************************************\n");
|
||||||
|
@ -943,7 +943,7 @@ bool DRW_3Dface::parseDwg(DRW::Version v, dwgBuffer *buf, duint32 bs){
|
||||||
fourPoint.x = buf->getDefaultDouble(thirdPoint.x);
|
fourPoint.x = buf->getDefaultDouble(thirdPoint.x);
|
||||||
fourPoint.y = buf->getDefaultDouble(thirdPoint.y);
|
fourPoint.y = buf->getDefaultDouble(thirdPoint.y);
|
||||||
fourPoint.z = buf->getDefaultDouble(thirdPoint.z);
|
fourPoint.z = buf->getDefaultDouble(thirdPoint.z);
|
||||||
invisibleflag = has_no_flag ? (int)NoEdge : buf->getBitShort();
|
invisibleflag = has_no_flag ? static_cast<int>(NoEdge) : buf->getBitShort();
|
||||||
}
|
}
|
||||||
drw_assert(invisibleflag>=NoEdge);
|
drw_assert(invisibleflag>=NoEdge);
|
||||||
drw_assert(invisibleflag<=AllEdges);
|
drw_assert(invisibleflag<=AllEdges);
|
||||||
|
@ -1041,7 +1041,7 @@ void DRW_Insert::parseCode(int code, dxfReader *reader){
|
||||||
|
|
||||||
bool DRW_Insert::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Insert::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
dint32 objCount = 0;
|
dint32 objCount = 0;
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n************************** parsing insert/minsert *****************************************\n");
|
DRW_DBG("\n************************** parsing insert/minsert *****************************************\n");
|
||||||
|
@ -1187,7 +1187,7 @@ void DRW_LWPolyline::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_LWPolyline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_LWPolyline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing LWPolyline *******************************************\n");
|
DRW_DBG("\n***************************** parsing LWPolyline *******************************************\n");
|
||||||
|
@ -1307,10 +1307,10 @@ void DRW_Text::parseCode(int code, dxfReader *reader){
|
||||||
textgen = reader->getInt32();
|
textgen = reader->getInt32();
|
||||||
break;
|
break;
|
||||||
case 72:
|
case 72:
|
||||||
alignH = (HAlign)reader->getInt32();
|
alignH = static_cast<HAlign>(reader->getInt32());
|
||||||
break;
|
break;
|
||||||
case 73:
|
case 73:
|
||||||
alignV = (VAlign)reader->getInt32();
|
alignV = static_cast<VAlign>(reader->getInt32());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
text = reader->getUtf8String();
|
text = reader->getUtf8String();
|
||||||
|
@ -1393,11 +1393,11 @@ bool DRW_Text::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
DRW_DBG("textgen: "); DRW_DBG(textgen);
|
DRW_DBG("textgen: "); DRW_DBG(textgen);
|
||||||
}
|
}
|
||||||
if ( !(data_flags & 0x40) ) { /* Horiz align. BS 72 present if !(DataFlags & 0x40) */
|
if ( !(data_flags & 0x40) ) { /* Horiz align. BS 72 present if !(DataFlags & 0x40) */
|
||||||
alignH = (HAlign)buf->getBitShort();
|
alignH = static_cast<HAlign>(buf->getBitShort());
|
||||||
DRW_DBG(", alignH: "); DRW_DBG(alignH);
|
DRW_DBG(", alignH: "); DRW_DBG(alignH);
|
||||||
}
|
}
|
||||||
if ( !(data_flags & 0x80) ) { /* Vert align. BS 73 present if !(DataFlags & 0x80) */
|
if ( !(data_flags & 0x80) ) { /* Vert align. BS 73 present if !(DataFlags & 0x80) */
|
||||||
alignV = (VAlign)buf->getBitShort();
|
alignV = static_cast<VAlign>(buf->getBitShort());
|
||||||
DRW_DBG(", alignV: "); DRW_DBG(alignV);
|
DRW_DBG(", alignV: "); DRW_DBG(alignV);
|
||||||
}
|
}
|
||||||
DRW_DBG("\n");
|
DRW_DBG("\n");
|
||||||
|
@ -1432,7 +1432,10 @@ void DRW_MText::parseCode(int code, dxfReader *reader){
|
||||||
break;
|
break;
|
||||||
case 71: {
|
case 71: {
|
||||||
// Attachment point
|
// Attachment point
|
||||||
Attach a = (Attach)reader->getInt32();
|
Attach a = static_cast<Attach>(reader->getInt32());
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
|
||||||
switch(a) {
|
switch(a) {
|
||||||
case TopLeft:
|
case TopLeft:
|
||||||
|
@ -1472,6 +1475,8 @@ void DRW_MText::parseCode(int code, dxfReader *reader){
|
||||||
alignH = HRight;
|
alignH = HRight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
} break;
|
} break;
|
||||||
case 72:
|
case 72:
|
||||||
// To prevent redirection to DRW_Text::parseCode.
|
// To prevent redirection to DRW_Text::parseCode.
|
||||||
|
@ -1606,7 +1611,7 @@ void DRW_Polyline::parseCode(int code, dxfReader *reader){
|
||||||
//0x10 polyline 3D bit 4(8) set
|
//0x10 polyline 3D bit 4(8) set
|
||||||
//0x1D PFACE bit 5(16) set
|
//0x1D PFACE bit 5(16) set
|
||||||
bool DRW_Polyline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Polyline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing polyline *********************************************\n");
|
DRW_DBG("\n***************************** parsing polyline *********************************************\n");
|
||||||
|
@ -1721,7 +1726,7 @@ void DRW_Vertex::parseCode(int code, dxfReader *reader){
|
||||||
//0x0D PFACE
|
//0x0D PFACE
|
||||||
//0x0E PFACE FACE
|
//0x0E PFACE FACE
|
||||||
bool DRW_Vertex::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs, double el){
|
bool DRW_Vertex::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs, double el){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing pline Vertex *********************************************\n");
|
DRW_DBG("\n***************************** parsing pline Vertex *********************************************\n");
|
||||||
|
@ -2145,7 +2150,7 @@ void DRW_Spline::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Spline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_Spline::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
bool ret = DRW_Entity::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_Entity::parseDwg(version, buf, nullptr, bs);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
DRW_DBG("\n***************************** parsing spline *********************************************\n");
|
DRW_DBG("\n***************************** parsing spline *********************************************\n");
|
||||||
|
@ -2416,7 +2421,7 @@ void DRW_Dimension::parseCode(int code, dxfReader *reader){
|
||||||
break;
|
break;
|
||||||
case 42:
|
case 42:
|
||||||
actual = reader->getDouble();
|
actual = reader->getDouble();
|
||||||
hasActual = (actual != 0.0);
|
hasActual = not qFuzzyIsNull(actual);
|
||||||
break;
|
break;
|
||||||
case 53:
|
case 53:
|
||||||
rot = reader->getDouble();
|
rot = reader->getDouble();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <QtGlobal>
|
||||||
#include "drw_base.h"
|
#include "drw_base.h"
|
||||||
|
|
||||||
class dxfReader;
|
class dxfReader;
|
||||||
|
@ -99,54 +100,87 @@ class DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
//initializes default values
|
//initializes default values
|
||||||
DRW_Entity() {
|
DRW_Entity()
|
||||||
eType = DRW::UNKNOWN;
|
: eType(DRW::UNKNOWN),
|
||||||
handle = parentHandle = DRW::NoHandle; //no handle (0)
|
handle(DRW::NoHandle),
|
||||||
lineType = "BYLAYER";
|
appData(),
|
||||||
color = DRW::ColorByLayer; // default BYLAYER (256)
|
parentHandle(DRW::NoHandle),
|
||||||
ltypeScale = 1.0;
|
space(DRW::ModelSpace),
|
||||||
visible = true;
|
layer("0"),
|
||||||
layer = "0";
|
lineType("BYLAYER"),
|
||||||
lWeight = DRW_LW_Conv::widthByLayer; // default BYLAYER (dxf -1, dwg 29)
|
material(DRW::MaterialByLayer),
|
||||||
space = DRW::ModelSpace; // default ModelSpace (0)
|
color(DRW::ColorByLayer),
|
||||||
haveExtrusion = false;
|
lWeight(DRW_LW_Conv::widthByLayer),
|
||||||
color24 = -1; //default -1 not set
|
ltypeScale(1.0),
|
||||||
numProxyGraph = 0;
|
visible(true),
|
||||||
shadow = DRW::CastAndReceieveShadows;
|
numProxyGraph(0),
|
||||||
material = DRW::MaterialByLayer;
|
proxyGraphics(),
|
||||||
plotStyle = DRW::DefaultPlotStyle;
|
color24(-1),
|
||||||
transparency = DRW::Opaque;
|
colorName(),
|
||||||
nextEntLink = prevEntLink = 0;
|
transparency(DRW::Opaque),
|
||||||
numReactors = xDictFlag = 0;
|
plotStyle(DRW::DefaultPlotStyle),
|
||||||
curr = NULL;
|
shadow(DRW::CastAndReceieveShadows),
|
||||||
ownerHandle= false;
|
haveExtrusion(false),
|
||||||
}
|
extData(),
|
||||||
|
haveNextLinks(),
|
||||||
|
plotFlags(),
|
||||||
|
ltFlags(),
|
||||||
|
materialFlag(),
|
||||||
|
shadowFlag(),
|
||||||
|
lTypeH(),
|
||||||
|
layerH(),
|
||||||
|
nextEntLink(0),
|
||||||
|
prevEntLink(0),
|
||||||
|
ownerHandle(false),
|
||||||
|
xDictFlag(0),
|
||||||
|
numReactors(0),
|
||||||
|
objSize(),
|
||||||
|
oType(),
|
||||||
|
extAxisX(),
|
||||||
|
extAxisY(),
|
||||||
|
curr(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
DRW_Entity(const DRW_Entity& e) {
|
DRW_Entity(const DRW_Entity& e)
|
||||||
eType = e.eType;
|
: eType(e.eType),
|
||||||
handle = e.handle;
|
handle(e.handle),
|
||||||
parentHandle = e.parentHandle; //no handle (0)
|
appData(),
|
||||||
lineType = e.lineType;
|
parentHandle(e.parentHandle),
|
||||||
color = e.color; // default BYLAYER (256)
|
space(e.space),
|
||||||
ltypeScale = e.ltypeScale;
|
layer(e.layer),
|
||||||
visible = e.visible;
|
lineType(e.lineType),
|
||||||
layer = e.layer;
|
material(e.material),
|
||||||
lWeight = e.lWeight;
|
color(e.color),
|
||||||
space = e.space;
|
lWeight(e.lWeight),
|
||||||
haveExtrusion = e.haveExtrusion;
|
ltypeScale(e.ltypeScale),
|
||||||
color24 = e.color24; //default -1 not set
|
visible(e.visible),
|
||||||
numProxyGraph = e.numProxyGraph;
|
numProxyGraph(e.numProxyGraph),
|
||||||
shadow = e.shadow;
|
proxyGraphics(),
|
||||||
material = e.material;
|
color24(e.color24),
|
||||||
plotStyle = e.plotStyle;
|
colorName(),
|
||||||
transparency = e.transparency;
|
transparency(e.transparency),
|
||||||
nextEntLink = e.nextEntLink;
|
plotStyle(e.plotStyle),
|
||||||
prevEntLink = e.prevEntLink;
|
shadow(e.shadow),
|
||||||
numReactors = e.numReactors;
|
haveExtrusion(e.haveExtrusion),
|
||||||
xDictFlag = e.xDictFlag;
|
extData(),
|
||||||
curr = NULL;
|
haveNextLinks(),
|
||||||
ownerHandle= false;
|
plotFlags(),
|
||||||
// curr = e.curr;
|
ltFlags(),
|
||||||
|
materialFlag(),
|
||||||
|
shadowFlag(),
|
||||||
|
lTypeH(),
|
||||||
|
layerH(),
|
||||||
|
nextEntLink(e.nextEntLink),
|
||||||
|
prevEntLink(e.prevEntLink),
|
||||||
|
ownerHandle(false),
|
||||||
|
xDictFlag(e.xDictFlag),
|
||||||
|
numReactors(e.numReactors),
|
||||||
|
objSize(),
|
||||||
|
oType(),
|
||||||
|
extAxisX(),
|
||||||
|
extAxisY(),
|
||||||
|
curr(nullptr/*e.curr*/)
|
||||||
|
{
|
||||||
for (std::vector<DRW_Variant*>::const_iterator it=e.extData.begin(); it!=e.extData.end(); ++it){
|
for (std::vector<DRW_Variant*>::const_iterator it=e.extData.begin(); it!=e.extData.end(); ++it){
|
||||||
extData.push_back(new DRW_Variant(*(*it)));
|
extData.push_back(new DRW_Variant(*(*it)));
|
||||||
}
|
}
|
||||||
|
@ -233,6 +267,7 @@ protected: //only for read dwg
|
||||||
dint16 oType;
|
dint16 oType;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DRW_Entity &operator=(const DRW_Entity &) Q_DECL_EQ_DELETE;
|
||||||
DRW_Coord extAxisX;
|
DRW_Coord extAxisX;
|
||||||
DRW_Coord extAxisY;
|
DRW_Coord extAxisY;
|
||||||
DRW_Variant* curr;
|
DRW_Variant* curr;
|
||||||
|
@ -247,11 +282,12 @@ private:
|
||||||
class DRW_Point : public DRW_Entity {
|
class DRW_Point : public DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Point() {
|
DRW_Point()
|
||||||
|
: basePoint(),
|
||||||
|
thickness(0),
|
||||||
|
extPoint(DRW_Coord(0, 0, 1))
|
||||||
|
{
|
||||||
eType = DRW::POINT;
|
eType = DRW::POINT;
|
||||||
basePoint.z = extPoint.x = extPoint.y = 0;
|
|
||||||
extPoint.z = 1;
|
|
||||||
thickness = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
@ -276,9 +312,10 @@ public:
|
||||||
class DRW_Line : public DRW_Point {
|
class DRW_Line : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Line() {
|
DRW_Line()
|
||||||
|
: secPoint()
|
||||||
|
{
|
||||||
eType = DRW::LINE;
|
eType = DRW::LINE;
|
||||||
secPoint.z = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
@ -326,7 +363,9 @@ public:
|
||||||
class DRW_Circle : public DRW_Point {
|
class DRW_Circle : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Circle() {
|
DRW_Circle()
|
||||||
|
: radious()
|
||||||
|
{
|
||||||
eType = DRW::CIRCLE;
|
eType = DRW::CIRCLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +387,12 @@ public:
|
||||||
class DRW_Arc : public DRW_Circle {
|
class DRW_Arc : public DRW_Circle {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Arc() {
|
DRW_Arc()
|
||||||
|
: staangle(),
|
||||||
|
endangle(),
|
||||||
|
isccw(1)
|
||||||
|
{
|
||||||
eType = DRW::ARC;
|
eType = DRW::ARC;
|
||||||
isccw = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion();
|
virtual void applyExtrusion();
|
||||||
|
@ -390,9 +432,13 @@ public:
|
||||||
class DRW_Ellipse : public DRW_Line {
|
class DRW_Ellipse : public DRW_Line {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Ellipse() {
|
DRW_Ellipse()
|
||||||
|
: ratio(),
|
||||||
|
staparam(),
|
||||||
|
endparam(),
|
||||||
|
isccw(1)
|
||||||
|
{
|
||||||
eType = DRW::ELLIPSE;
|
eType = DRW::ELLIPSE;
|
||||||
isccw = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toPolyline(DRW_Polyline *pol, int parts = 128);
|
void toPolyline(DRW_Polyline *pol, int parts = 128);
|
||||||
|
@ -422,10 +468,11 @@ public:
|
||||||
class DRW_Trace : public DRW_Line {
|
class DRW_Trace : public DRW_Line {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Trace() {
|
DRW_Trace()
|
||||||
|
: thirdPoint(),
|
||||||
|
fourPoint()
|
||||||
|
{
|
||||||
eType = DRW::TRACE;
|
eType = DRW::TRACE;
|
||||||
thirdPoint.z = 0;
|
|
||||||
fourPoint.z = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion();
|
virtual void applyExtrusion();
|
||||||
|
@ -492,9 +539,10 @@ public:
|
||||||
AllEdges = 0x0F
|
AllEdges = 0x0F
|
||||||
};
|
};
|
||||||
|
|
||||||
DRW_3Dface() {
|
DRW_3Dface()
|
||||||
|
: invisibleflag(0)
|
||||||
|
{
|
||||||
eType = DRW::E3DFACE;
|
eType = DRW::E3DFACE;
|
||||||
invisibleflag = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
@ -508,7 +556,7 @@ public:
|
||||||
//! fourth corner in WCS
|
//! fourth corner in WCS
|
||||||
const DRW_Coord & fourthCorner() { return fourPoint; }
|
const DRW_Coord & fourthCorner() { return fourPoint; }
|
||||||
//! edge visibility flags
|
//! edge visibility flags
|
||||||
InvisibleEdgeFlags edgeFlags() { return (InvisibleEdgeFlags)invisibleflag; }
|
InvisibleEdgeFlags edgeFlags() { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! interpret code in dxf reading process or dispatch to inherited class
|
//! interpret code in dxf reading process or dispatch to inherited class
|
||||||
|
@ -529,12 +577,13 @@ public:
|
||||||
class DRW_Block : public DRW_Point {
|
class DRW_Block : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Block() {
|
DRW_Block()
|
||||||
|
: name("*U0"),
|
||||||
|
flags(0),
|
||||||
|
isEnd(false)
|
||||||
|
{
|
||||||
eType = DRW::BLOCK;
|
eType = DRW::BLOCK;
|
||||||
layer = "0";
|
layer = "0";
|
||||||
flags = 0;
|
|
||||||
name = "*U0";
|
|
||||||
isEnd = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
@ -559,16 +608,20 @@ private:
|
||||||
class DRW_Insert : public DRW_Point {
|
class DRW_Insert : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Insert() {
|
DRW_Insert()
|
||||||
|
: name(),
|
||||||
|
xscale(1),
|
||||||
|
yscale(1),
|
||||||
|
zscale(1),
|
||||||
|
angle(0),
|
||||||
|
colcount(1),
|
||||||
|
rowcount(1),
|
||||||
|
colspace(0),
|
||||||
|
rowspace(0),
|
||||||
|
blockRecH(),
|
||||||
|
seqendH()
|
||||||
|
{
|
||||||
eType = DRW::INSERT;
|
eType = DRW::INSERT;
|
||||||
xscale = 1;
|
|
||||||
yscale = 1;
|
|
||||||
zscale = 1;
|
|
||||||
angle = 0;
|
|
||||||
colcount = 1;
|
|
||||||
rowcount = 1;
|
|
||||||
colspace = 0;
|
|
||||||
rowspace = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){DRW_Point::applyExtrusion();}
|
virtual void applyExtrusion(){DRW_Point::applyExtrusion();}
|
||||||
|
@ -600,27 +653,33 @@ public: //only for read dwg
|
||||||
class DRW_LWPolyline : public DRW_Entity {
|
class DRW_LWPolyline : public DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_LWPolyline() {
|
DRW_LWPolyline()
|
||||||
|
: vertexnum(),
|
||||||
|
flags(0),
|
||||||
|
width(0.0),
|
||||||
|
elevation(0.0),
|
||||||
|
thickness(0.0),
|
||||||
|
extPoint(DRW_Coord(0, 0, 1)),
|
||||||
|
vertex(nullptr),
|
||||||
|
vertlist()
|
||||||
|
{
|
||||||
eType = DRW::LWPOLYLINE;
|
eType = DRW::LWPOLYLINE;
|
||||||
elevation = thickness = width = 0.0;
|
|
||||||
flags = 0;
|
|
||||||
extPoint.x = extPoint.y = 0;
|
|
||||||
extPoint.z = 1;
|
|
||||||
vertex = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_LWPolyline(const DRW_LWPolyline& p):DRW_Entity(p){
|
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()
|
||||||
|
{
|
||||||
this->eType = DRW::LWPOLYLINE;
|
this->eType = DRW::LWPOLYLINE;
|
||||||
this->elevation = p.elevation;
|
|
||||||
this->thickness = p.thickness;
|
|
||||||
this->width = p.width;
|
|
||||||
this->flags = p.flags;
|
|
||||||
this->extPoint = p.extPoint;
|
|
||||||
this->vertex = NULL;
|
|
||||||
for (unsigned i=0; i<p.vertlist.size(); i++)// RLZ ok or new
|
for (unsigned i=0; i<p.vertlist.size(); i++)// RLZ ok or new
|
||||||
this->vertlist.push_back( new DRW_Vertex2D( *(p.vertlist.at(i)) ) );
|
this->vertlist.push_back( new DRW_Vertex2D( *(p.vertlist.at(i)) ) );
|
||||||
|
|
||||||
this->vertex = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~DRW_LWPolyline() {
|
~DRW_LWPolyline() {
|
||||||
|
@ -658,6 +717,8 @@ public:
|
||||||
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
|
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
|
||||||
DRW_Vertex2D *vertex; /*!< current vertex to add data */
|
DRW_Vertex2D *vertex; /*!< current vertex to add data */
|
||||||
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
|
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
|
||||||
|
private:
|
||||||
|
DRW_LWPolyline &operator=(const DRW_LWPolyline &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Class to handle insert entries
|
//! Class to handle insert entries
|
||||||
|
@ -686,15 +747,19 @@ public:
|
||||||
HFit /*!< fit into point = 5 (if VAlign==0) */
|
HFit /*!< fit into point = 5 (if VAlign==0) */
|
||||||
};
|
};
|
||||||
|
|
||||||
DRW_Text() {
|
DRW_Text()
|
||||||
|
: height(),
|
||||||
|
text(),
|
||||||
|
angle(0),
|
||||||
|
widthscale(1),
|
||||||
|
oblique(0),
|
||||||
|
style("STANDARD"),
|
||||||
|
textgen(0),
|
||||||
|
alignH(HLeft),
|
||||||
|
alignV(VBaseLine),
|
||||||
|
styleH()
|
||||||
|
{
|
||||||
eType = DRW::TEXT;
|
eType = DRW::TEXT;
|
||||||
angle = 0;
|
|
||||||
widthscale = 1;
|
|
||||||
oblique = 0;
|
|
||||||
style = "STANDARD";
|
|
||||||
textgen = 0;
|
|
||||||
alignH = HLeft;
|
|
||||||
alignV = VBaseLine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){} //RLZ TODO
|
virtual void applyExtrusion(){} //RLZ TODO
|
||||||
|
@ -737,12 +802,13 @@ public:
|
||||||
BottomRight
|
BottomRight
|
||||||
};
|
};
|
||||||
|
|
||||||
DRW_MText() {
|
DRW_MText()
|
||||||
|
: interlin(1),
|
||||||
|
haveXAxis(false)//if true needed to recalculate angle
|
||||||
|
{
|
||||||
eType = DRW::MTEXT;
|
eType = DRW::MTEXT;
|
||||||
interlin = 1;
|
alignV = static_cast<VAlign>(TopLeft);
|
||||||
alignV = (VAlign)TopLeft;
|
textgen = 1;
|
||||||
textgen = 1;
|
|
||||||
haveXAxis = false; //if true needed to recalculate angle
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -764,20 +830,36 @@ private:
|
||||||
class DRW_Vertex : public DRW_Point {
|
class DRW_Vertex : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Vertex() {
|
DRW_Vertex()
|
||||||
|
: stawidth(0),
|
||||||
|
endwidth(0),
|
||||||
|
bulge(0),
|
||||||
|
flags(0),
|
||||||
|
tgdir(),
|
||||||
|
vindex1(0),
|
||||||
|
vindex2(0),
|
||||||
|
vindex3(0),
|
||||||
|
vindex4(0),
|
||||||
|
identifier(0)
|
||||||
|
{
|
||||||
eType = DRW::VERTEX;
|
eType = DRW::VERTEX;
|
||||||
stawidth = endwidth = bulge = 0;
|
|
||||||
vindex1 = vindex2 = vindex3 = vindex4 = 0;
|
|
||||||
flags = identifier = 0;
|
|
||||||
}
|
}
|
||||||
DRW_Vertex(double sx, double sy, double sz, double b) {
|
|
||||||
stawidth = endwidth = 0;
|
DRW_Vertex(double sx, double sy, double sz, double b)
|
||||||
vindex1 = vindex2 = vindex3 = vindex4 = 0;
|
: stawidth(0),
|
||||||
flags = identifier = 0;
|
endwidth(0),
|
||||||
|
bulge(b),
|
||||||
|
flags(0),
|
||||||
|
tgdir(),
|
||||||
|
vindex1(0),
|
||||||
|
vindex2(0),
|
||||||
|
vindex3(0),
|
||||||
|
vindex4(0),
|
||||||
|
identifier(0)
|
||||||
|
{
|
||||||
basePoint.x = sx;
|
basePoint.x = sx;
|
||||||
basePoint.y =sy;
|
basePoint.y = sy;
|
||||||
basePoint.z =sz;
|
basePoint.z = sz;
|
||||||
bulge = b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -808,23 +890,41 @@ public:
|
||||||
class DRW_Polyline : public DRW_Point {
|
class DRW_Polyline : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Polyline() {
|
DRW_Polyline()
|
||||||
|
: flags(0),
|
||||||
|
defstawidth(0.0),
|
||||||
|
defendwidth(0.0),
|
||||||
|
vertexcount(0),
|
||||||
|
facecount(0),
|
||||||
|
smoothM(0),
|
||||||
|
smoothN(0),
|
||||||
|
curvetype(0),
|
||||||
|
vertlist(),
|
||||||
|
hadlesList(),
|
||||||
|
firstEH(),
|
||||||
|
lastEH(),
|
||||||
|
seqEndH()
|
||||||
|
{
|
||||||
eType = DRW::POLYLINE;
|
eType = DRW::POLYLINE;
|
||||||
defstawidth = defendwidth = 0.0;
|
|
||||||
basePoint.x = basePoint.y = 0.0;
|
basePoint.x = basePoint.y = 0.0;
|
||||||
flags = vertexcount = facecount = 0;
|
|
||||||
smoothM = smoothN = curvetype = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Polyline(const DRW_Polyline& p) : DRW_Point(p) {
|
DRW_Polyline(const DRW_Polyline& p)
|
||||||
flags = p.flags ;
|
: DRW_Point(p),
|
||||||
defstawidth = p.defstawidth;
|
flags(p.flags),
|
||||||
defendwidth = p.defendwidth;
|
defstawidth(p.defstawidth),
|
||||||
vertexcount = p.vertexcount;
|
defendwidth(p.defendwidth),
|
||||||
facecount = p.facecount ;
|
vertexcount(p.vertexcount),
|
||||||
smoothM = p.smoothM ;
|
facecount(p.facecount),
|
||||||
smoothN = p.smoothN ;
|
smoothM(p.smoothM),
|
||||||
curvetype = p.curvetype ;
|
smoothN(p.smoothN),
|
||||||
|
curvetype(p.curvetype),
|
||||||
|
vertlist(),
|
||||||
|
hadlesList(),
|
||||||
|
firstEH(),
|
||||||
|
lastEH(),
|
||||||
|
seqEndH()
|
||||||
|
{
|
||||||
for (unsigned i=0; i<p.vertlist.size(); i++)// RLZ ok or new
|
for (unsigned i=0; i<p.vertlist.size(); i++)// RLZ ok or new
|
||||||
this->vertlist.push_back( new DRW_Vertex( *(p.vertlist.at(i)) ) );
|
this->vertlist.push_back( new DRW_Vertex( *(p.vertlist.at(i)) ) );
|
||||||
}
|
}
|
||||||
|
@ -878,26 +978,49 @@ private:
|
||||||
class DRW_Spline : public DRW_Entity {
|
class DRW_Spline : public DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Spline() {
|
DRW_Spline()
|
||||||
|
: 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()
|
||||||
|
{
|
||||||
eType = DRW::SPLINE;
|
eType = DRW::SPLINE;
|
||||||
flags = nknots = ncontrol = nfit = 0;
|
|
||||||
tolknot = tolcontrol = tolfit = 0.0000001;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Spline(const DRW_Spline& p):DRW_Entity(p){
|
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;
|
eType = DRW::SPLINE;
|
||||||
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 ;
|
|
||||||
|
|
||||||
for(double v : p.knotslist) knotslist.push_back(v);
|
for(double v : p.knotslist) knotslist.push_back(v);
|
||||||
for(double v : p.weightlist) weightlist.push_back(v);
|
for(double v : p.weightlist) weightlist.push_back(v);
|
||||||
|
@ -943,6 +1066,7 @@ public:
|
||||||
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
|
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DRW_Spline &operator=(const DRW_Spline &) Q_DECL_EQ_DELETE;
|
||||||
DRW_Coord *controlpoint; /*!< current control point to add data */
|
DRW_Coord *controlpoint; /*!< current control point to add data */
|
||||||
DRW_Coord *fitpoint; /*!< current fit point to add data */
|
DRW_Coord *fitpoint; /*!< current fit point to add data */
|
||||||
};
|
};
|
||||||
|
@ -954,10 +1078,11 @@ private:
|
||||||
*/
|
*/
|
||||||
class DRW_HatchLoop {
|
class DRW_HatchLoop {
|
||||||
public:
|
public:
|
||||||
DRW_HatchLoop(int t) {
|
DRW_HatchLoop(int t)
|
||||||
type = t;
|
: type(t),
|
||||||
numedges = 0;
|
numedges(0),
|
||||||
}
|
objlist()
|
||||||
|
{}
|
||||||
|
|
||||||
~DRW_HatchLoop() {
|
~DRW_HatchLoop() {
|
||||||
// for(DRW_LWPolyline *item : pollist) delete item;
|
// for(DRW_LWPolyline *item : pollist) delete item;
|
||||||
|
@ -965,7 +1090,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
numedges = (int)objlist.size();
|
numedges = static_cast<int>(objlist.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -985,14 +1110,30 @@ public:
|
||||||
class DRW_Hatch : public DRW_Point {
|
class DRW_Hatch : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Hatch() {
|
DRW_Hatch()
|
||||||
|
: 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()
|
||||||
|
{
|
||||||
eType = DRW::HATCH;
|
eType = DRW::HATCH;
|
||||||
angle = scale = 0.0;
|
|
||||||
basePoint.x = basePoint.y = basePoint.z = 0.0;
|
basePoint.x = basePoint.y = basePoint.z = 0.0;
|
||||||
loopsnum = hstyle = associative = 0;
|
|
||||||
solid = hpattern = 1;
|
|
||||||
deflines = doubleflag = 0;
|
|
||||||
loop = NULL;
|
|
||||||
clearEntities();
|
clearEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,13 +1166,14 @@ public:
|
||||||
std::vector<DRW_HatchLoop *> looplist; /*!< polyline list */
|
std::vector<DRW_HatchLoop *> looplist; /*!< polyline list */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(DRW_Hatch)
|
||||||
void clearEntities(){
|
void clearEntities(){
|
||||||
pt = line = NULL;
|
pt = line = nullptr;
|
||||||
pline = NULL;
|
pline = nullptr;
|
||||||
arc = NULL;
|
arc = nullptr;
|
||||||
ellipse = NULL;
|
ellipse = nullptr;
|
||||||
spline = NULL;
|
spline = nullptr;
|
||||||
plvert = NULL;
|
plvert = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLine() {
|
void addLine() {
|
||||||
|
@ -1061,7 +1203,7 @@ private:
|
||||||
void addSpline() {
|
void addSpline() {
|
||||||
clearEntities();
|
clearEntities();
|
||||||
if (loop) {
|
if (loop) {
|
||||||
pt = NULL;
|
pt = nullptr;
|
||||||
spline = new DRW_Spline;
|
spline = new DRW_Spline;
|
||||||
loop->objlist.push_back(spline);
|
loop->objlist.push_back(spline);
|
||||||
}
|
}
|
||||||
|
@ -1086,10 +1228,18 @@ private:
|
||||||
class DRW_Image : public DRW_Line {
|
class DRW_Image : public DRW_Line {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Image() {
|
DRW_Image()
|
||||||
|
: ref(),
|
||||||
|
vVector(),
|
||||||
|
sizeu(),
|
||||||
|
sizev(),
|
||||||
|
dz(),
|
||||||
|
clip(0),
|
||||||
|
brightness(50),
|
||||||
|
contrast(50),
|
||||||
|
fade(0)
|
||||||
|
{
|
||||||
eType = DRW::IMAGE;
|
eType = DRW::IMAGE;
|
||||||
fade = clip = 0;
|
|
||||||
brightness = contrast = 50;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1121,48 +1271,66 @@ public:
|
||||||
class DRW_Dimension : public DRW_Entity {
|
class DRW_Dimension : public DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Dimension() {
|
DRW_Dimension()
|
||||||
|
: 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),
|
||||||
|
dimStyleH(),
|
||||||
|
blockH()
|
||||||
|
{
|
||||||
eType = DRW::DIMENSION;
|
eType = DRW::DIMENSION;
|
||||||
type = 0;
|
|
||||||
linesty = 1;
|
|
||||||
linefactor = extPoint.z = 1.0;
|
|
||||||
angle = oblique = rot = 0.0;
|
|
||||||
align = 5;
|
|
||||||
style = "STANDARD";
|
|
||||||
defPoint.z = extPoint.x = extPoint.y = 0;
|
|
||||||
textPoint.z = rot = 0;
|
|
||||||
clonePoint.x = clonePoint.y = clonePoint.z = 0;
|
|
||||||
length = 0.0;
|
|
||||||
hasActual = false;
|
|
||||||
actual = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Dimension(const DRW_Dimension& d): DRW_Entity(d) {
|
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),
|
||||||
|
dimStyleH(),
|
||||||
|
blockH()
|
||||||
|
{
|
||||||
eType = DRW::DIMENSION;
|
eType = DRW::DIMENSION;
|
||||||
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;
|
|
||||||
clonePoint = d.clonePoint;
|
|
||||||
def1 = d.def1;
|
|
||||||
def2 = d.def2;
|
|
||||||
angle = d.angle;
|
|
||||||
oblique = d.oblique;
|
|
||||||
arcPoint = d.arcPoint;
|
|
||||||
circlePoint = d.circlePoint;
|
|
||||||
length = d.length;
|
|
||||||
hasActual = d.hasActual;
|
|
||||||
actual = d.actual;
|
|
||||||
//RLZ needed a def value for this: hdir = ???
|
//RLZ needed a def value for this: hdir = ???
|
||||||
}
|
}
|
||||||
virtual ~DRW_Dimension() {}
|
virtual ~DRW_Dimension() = default;
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
|
||||||
|
@ -1451,13 +1619,28 @@ protected:
|
||||||
class DRW_Leader : public DRW_Entity {
|
class DRW_Leader : public DRW_Entity {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Leader() {
|
DRW_Leader()
|
||||||
|
: 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(),
|
||||||
|
dimStyleH(),
|
||||||
|
AnnotH()
|
||||||
|
{
|
||||||
eType = DRW::LEADER;
|
eType = DRW::LEADER;
|
||||||
flag = 3;
|
|
||||||
hookflag = vertnum = leadertype = 0;
|
|
||||||
extrusionPoint.x = extrusionPoint.y = 0.0;
|
|
||||||
arrow = 1;
|
|
||||||
extrusionPoint.z = 1.0;
|
|
||||||
}
|
}
|
||||||
~DRW_Leader() {
|
~DRW_Leader() {
|
||||||
for(DRW_Coord *item : vertexlist) delete item;
|
for(DRW_Coord *item : vertexlist) delete item;
|
||||||
|
@ -1489,6 +1672,7 @@ public:
|
||||||
std::vector<DRW_Coord *> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
|
std::vector<DRW_Coord *> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(DRW_Leader)
|
||||||
DRW_Coord *vertexpoint; /*!< current control point to add data */
|
DRW_Coord *vertexpoint; /*!< current control point to add data */
|
||||||
dwgHandle dimStyleH;
|
dwgHandle dimStyleH;
|
||||||
dwgHandle AnnotH;
|
dwgHandle AnnotH;
|
||||||
|
@ -1502,13 +1686,28 @@ private:
|
||||||
class DRW_Viewport : public DRW_Point {
|
class DRW_Viewport : public DRW_Point {
|
||||||
SETENTFRIENDS
|
SETENTFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Viewport() {
|
DRW_Viewport()
|
||||||
|
: 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()
|
||||||
|
{
|
||||||
eType = DRW::VIEWPORT;
|
eType = DRW::VIEWPORT;
|
||||||
vpstatus = 0;
|
|
||||||
pswidth = 205;
|
|
||||||
psheight = 156;
|
|
||||||
centerPX = 128.5;
|
|
||||||
centerPY = 97.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void applyExtrusion(){}
|
virtual void applyExtrusion(){}
|
||||||
|
|
|
@ -16,11 +16,23 @@
|
||||||
#include "intern/drw_dbg.h"
|
#include "intern/drw_dbg.h"
|
||||||
#include "intern/dwgbuffer.h"
|
#include "intern/dwgbuffer.h"
|
||||||
|
|
||||||
DRW_Header::DRW_Header() {
|
DRW_Header::DRW_Header()
|
||||||
linetypeCtrl = layerCtrl = styleCtrl = dimstyleCtrl = appidCtrl = 0;
|
: vars(),
|
||||||
blockCtrl = viewCtrl = ucsCtrl = vportCtrl = vpEntHeaderCtrl = 0;
|
comments(),
|
||||||
version = DRW::AC1021;
|
name(),
|
||||||
}
|
curr(),
|
||||||
|
version(DRW::AC1021),
|
||||||
|
linetypeCtrl(0),
|
||||||
|
layerCtrl(0),
|
||||||
|
styleCtrl(0),
|
||||||
|
dimstyleCtrl(0),
|
||||||
|
appidCtrl(0),
|
||||||
|
blockCtrl(0),
|
||||||
|
viewCtrl(0),
|
||||||
|
ucsCtrl(0),
|
||||||
|
vportCtrl(0),
|
||||||
|
vpEntHeaderCtrl(0)
|
||||||
|
{}
|
||||||
|
|
||||||
void DRW_Header::addComment(std::string c){
|
void DRW_Header::addComment(std::string c){
|
||||||
if (!comments.empty())
|
if (!comments.empty())
|
||||||
|
|
|
@ -35,24 +35,42 @@ class DRW_Header {
|
||||||
SETHDRFRIENDS
|
SETHDRFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Header();
|
DRW_Header();
|
||||||
|
|
||||||
~DRW_Header() {
|
~DRW_Header() {
|
||||||
clearVars();
|
clearVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Header(const DRW_Header& h){
|
DRW_Header(const DRW_Header& h)
|
||||||
this->version = h.version;
|
: vars(),
|
||||||
this->comments = h.comments;
|
comments(h.comments),
|
||||||
for (std::map<std::string,DRW_Variant*>::const_iterator it=h.vars.begin(); it!=h.vars.end(); ++it){
|
name(),
|
||||||
|
curr(nullptr),
|
||||||
|
version(h.version),
|
||||||
|
linetypeCtrl(),
|
||||||
|
layerCtrl(),
|
||||||
|
styleCtrl(),
|
||||||
|
dimstyleCtrl(),
|
||||||
|
appidCtrl(),
|
||||||
|
blockCtrl(),
|
||||||
|
viewCtrl(),
|
||||||
|
ucsCtrl(),
|
||||||
|
vportCtrl(),
|
||||||
|
vpEntHeaderCtrl()
|
||||||
|
{
|
||||||
|
for (std::map<std::string,DRW_Variant*>::const_iterator it=h.vars.begin(); it!=h.vars.end(); ++it)
|
||||||
|
{
|
||||||
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
||||||
}
|
}
|
||||||
this->curr = NULL;
|
|
||||||
}
|
}
|
||||||
DRW_Header& operator=(const DRW_Header &h) {
|
DRW_Header& operator=(const DRW_Header &h)
|
||||||
if(this != &h) {
|
{
|
||||||
|
if(this != &h)
|
||||||
|
{
|
||||||
clearVars();
|
clearVars();
|
||||||
this->version = h.version;
|
this->version = h.version;
|
||||||
this->comments = h.comments;
|
this->comments = h.comments;
|
||||||
for (std::map<std::string,DRW_Variant*>::const_iterator it=h.vars.begin(); it!=h.vars.end(); ++it){
|
for (std::map<std::string,DRW_Variant*>::const_iterator it=h.vars.begin(); it!=h.vars.end(); ++it)
|
||||||
|
{
|
||||||
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +93,8 @@ private:
|
||||||
bool getInt(std::string key, int *varInt);
|
bool getInt(std::string key, int *varInt);
|
||||||
bool getStr(std::string key, std::string *varStr);
|
bool getStr(std::string key, std::string *varStr);
|
||||||
bool getCoord(std::string key, DRW_Coord *varStr);
|
bool getCoord(std::string key, DRW_Coord *varStr);
|
||||||
void clearVars(){
|
void clearVars()
|
||||||
|
{
|
||||||
for (std::map<std::string,DRW_Variant*>::iterator it=vars.begin(); it!=vars.end(); ++it)
|
for (std::map<std::string,DRW_Variant*>::iterator it=vars.begin(); it!=vars.end(); ++it)
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void DRW_TableEntry::parseCode(int code, dxfReader *reader){
|
||||||
case 1033:
|
case 1033:
|
||||||
if (curr)
|
if (curr)
|
||||||
curr->setCoordZ(reader->getDouble());
|
curr->setCoordZ(reader->getDouble());
|
||||||
curr=NULL;
|
curr=nullptr;
|
||||||
break;
|
break;
|
||||||
case 1040:
|
case 1040:
|
||||||
case 1041:
|
case 1041:
|
||||||
|
@ -95,13 +95,14 @@ DRW_DBG("\n***************************** parsing table entry *******************
|
||||||
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
||||||
}
|
}
|
||||||
if (version > DRW::AC1021) {//2010+
|
if (version > DRW::AC1021) {//2010+
|
||||||
duint32 ms = buf->size();
|
duint32 ms =static_cast<duint32>(buf->size());
|
||||||
objSize = ms*8 - bs;
|
objSize = ms*8 - bs;
|
||||||
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
DRW_DBG(" Object size: "); DRW_DBG(objSize); DRW_DBG("\n");
|
||||||
}
|
}
|
||||||
if (strBuf != NULL && version > DRW::AC1018) {//2007+
|
if (strBuf != NULL && version > DRW::AC1018) {//2007+
|
||||||
strBuf->moveBitPos(objSize-1);
|
strBuf->moveBitPos(objSize-1);
|
||||||
DRW_DBG(" strBuf strbit pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: "); DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
DRW_DBG(" strBuf strbit pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: ");
|
||||||
|
DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
||||||
if (strBuf->getBit() == 1){
|
if (strBuf->getBit() == 1){
|
||||||
DRW_DBG("DRW_TableEntry::parseDwg string bit is 1\n");
|
DRW_DBG("DRW_TableEntry::parseDwg string bit is 1\n");
|
||||||
strBuf->moveBitPos(-17);
|
strBuf->moveBitPos(-17);
|
||||||
|
@ -111,7 +112,7 @@ DRW_DBG("\n***************************** parsing table entry *******************
|
||||||
DRW_DBG("\nDRW_TableEntry::parseDwg string 0x8000 bit is set");
|
DRW_DBG("\nDRW_TableEntry::parseDwg string 0x8000 bit is set");
|
||||||
strBuf->moveBitPos(-33);//RLZ pending to verify
|
strBuf->moveBitPos(-33);//RLZ pending to verify
|
||||||
duint16 hiSize = strBuf->getRawShort16();
|
duint16 hiSize = strBuf->getRawShort16();
|
||||||
strDataSize = ((strDataSize&0x7fff) | (hiSize<<15));
|
strDataSize = static_cast<duint16>((strDataSize&0x7fff) | (hiSize<<15));
|
||||||
}
|
}
|
||||||
strBuf->moveBitPos( -strDataSize -16); //-14
|
strBuf->moveBitPos( -strDataSize -16); //-14
|
||||||
DRW_DBG("strBuf start strDataSize pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: "); DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
DRW_DBG("strBuf start strDataSize pos 2007: "); DRW_DBG(strBuf->getPosition()); DRW_DBG(" strBuf bpos 2007: "); DRW_DBG(strBuf->getBitPos()); DRW_DBG("\n");
|
||||||
|
@ -132,7 +133,7 @@ DRW_DBG("\n***************************** parsing table entry *******************
|
||||||
duint8 *tmpExtData = new duint8[extDataSize];
|
duint8 *tmpExtData = new duint8[extDataSize];
|
||||||
buf->getBytes(tmpExtData, extDataSize);
|
buf->getBytes(tmpExtData, extDataSize);
|
||||||
dwgBuffer tmpExtDataBuf(tmpExtData, extDataSize, buf->decoder);
|
dwgBuffer tmpExtDataBuf(tmpExtData, extDataSize, buf->decoder);
|
||||||
int pos = tmpExtDataBuf.getPosition();
|
int pos = static_cast<int>(tmpExtDataBuf.getPosition());
|
||||||
int bpos = tmpExtDataBuf.getBitPos();
|
int bpos = tmpExtDataBuf.getBitPos();
|
||||||
DRW_DBG("ext data pos: "); DRW_DBG(pos); DRW_DBG("."); DRW_DBG(bpos); DRW_DBG("\n");
|
DRW_DBG("ext data pos: "); DRW_DBG(pos); DRW_DBG("."); DRW_DBG(bpos); DRW_DBG("\n");
|
||||||
duint8 dxfCode = tmpExtDataBuf.getRawChar8();
|
duint8 dxfCode = tmpExtDataBuf.getRawChar8();
|
||||||
|
@ -458,7 +459,7 @@ void DRW_LType::parseCode(int code, dxfReader *reader){
|
||||||
/*TODO: control max length permited */
|
/*TODO: control max length permited */
|
||||||
void DRW_LType::update(){
|
void DRW_LType::update(){
|
||||||
double d =0;
|
double d =0;
|
||||||
size = (int)path.size();
|
size = static_cast<int>(path.size());
|
||||||
for (int i = 0; i< size; i++){
|
for (int i = 0; i< size; i++){
|
||||||
d += fabs(path.at(i));
|
d += fabs(path.at(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <QtGlobal>
|
||||||
#include "drw_base.h"
|
#include "drw_base.h"
|
||||||
|
|
||||||
class dxfReader;
|
class dxfReader;
|
||||||
|
@ -56,13 +57,19 @@ namespace DRW {
|
||||||
class DRW_TableEntry {
|
class DRW_TableEntry {
|
||||||
public:
|
public:
|
||||||
//initializes default values
|
//initializes default values
|
||||||
DRW_TableEntry() {
|
DRW_TableEntry()
|
||||||
tType = DRW::UNKNOWNT;
|
: tType(DRW::UNKNOWNT),
|
||||||
flags = 0;
|
handle(),
|
||||||
numReactors = xDictFlag = 0;
|
parentHandle(0),
|
||||||
parentHandle = 0;
|
name(),
|
||||||
curr = NULL;
|
flags(0),
|
||||||
}
|
extData(),
|
||||||
|
curr(nullptr),
|
||||||
|
oType(),
|
||||||
|
xDictFlag(0),
|
||||||
|
numReactors(0),
|
||||||
|
objSize()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual~DRW_TableEntry() {
|
virtual~DRW_TableEntry() {
|
||||||
for (std::vector<DRW_Variant*>::iterator it=extData.begin(); it!=extData.end(); ++it)
|
for (std::vector<DRW_Variant*>::iterator it=extData.begin(); it!=extData.end(); ++it)
|
||||||
|
@ -71,15 +78,19 @@ public:
|
||||||
extData.clear();
|
extData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_TableEntry(const DRW_TableEntry& e) {
|
DRW_TableEntry(const DRW_TableEntry& e)
|
||||||
tType = e.tType;
|
: tType(e.tType),
|
||||||
handle = e.handle;
|
handle(e.handle),
|
||||||
parentHandle = e.parentHandle;
|
parentHandle(e.parentHandle),
|
||||||
name = e.name;
|
name(e.name),
|
||||||
flags = e.flags;
|
flags(e.flags),
|
||||||
numReactors = e.numReactors;
|
extData(),
|
||||||
xDictFlag = e.xDictFlag;
|
curr(e.curr),
|
||||||
curr = e.curr;
|
oType(),
|
||||||
|
xDictFlag(e.xDictFlag),
|
||||||
|
numReactors(e.numReactors),
|
||||||
|
objSize()
|
||||||
|
{
|
||||||
for (std::vector<DRW_Variant*>::const_iterator it=e.extData.begin(); it!=e.extData.end(); ++it){
|
for (std::vector<DRW_Variant*>::const_iterator it=e.extData.begin(); it!=e.extData.end(); ++it){
|
||||||
extData.push_back(new DRW_Variant(*(*it)));
|
extData.push_back(new DRW_Variant(*(*it)));
|
||||||
}
|
}
|
||||||
|
@ -90,7 +101,7 @@ protected:
|
||||||
virtual bool parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs=0) = 0;
|
virtual bool parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs=0) = 0;
|
||||||
bool parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer* strBuf, duint32 bs=0);
|
bool parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer* strBuf, duint32 bs=0);
|
||||||
void reset(){
|
void reset(){
|
||||||
flags =0;
|
flags = 0;
|
||||||
for (std::vector<DRW_Variant*>::iterator it=extData.begin(); it!=extData.end(); ++it)
|
for (std::vector<DRW_Variant*>::iterator it=extData.begin(); it!=extData.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
extData.clear();
|
extData.clear();
|
||||||
|
@ -105,6 +116,7 @@ public:
|
||||||
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DRW_TableEntry &operator=(const DRW_TableEntry &) Q_DECL_EQ_DELETE;
|
||||||
DRW_Variant* curr;
|
DRW_Variant* curr;
|
||||||
|
|
||||||
//***** dwg parse ********/
|
//***** dwg parse ********/
|
||||||
|
@ -124,7 +136,76 @@ protected:
|
||||||
class DRW_Dimstyle : public DRW_TableEntry {
|
class DRW_Dimstyle : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Dimstyle() { reset();}
|
DRW_Dimstyle()
|
||||||
|
: dimpost(),
|
||||||
|
dimapost(),
|
||||||
|
dimblk(),
|
||||||
|
dimblk1(),
|
||||||
|
dimblk2(),
|
||||||
|
dimscale(),
|
||||||
|
dimasz(),
|
||||||
|
dimexo(),
|
||||||
|
dimdli(),
|
||||||
|
dimexe(),
|
||||||
|
dimrnd(),
|
||||||
|
dimdle(),
|
||||||
|
dimtp(),
|
||||||
|
dimtm(),
|
||||||
|
dimfxl(),
|
||||||
|
dimtxt(),
|
||||||
|
dimcen(),
|
||||||
|
dimtsz(),
|
||||||
|
dimaltf(),
|
||||||
|
dimlfac(),
|
||||||
|
dimtvp(),
|
||||||
|
dimtfac(),
|
||||||
|
dimgap(),
|
||||||
|
dimaltrnd(),
|
||||||
|
dimtol(),
|
||||||
|
dimlim(),
|
||||||
|
dimtih(),
|
||||||
|
dimtoh(),
|
||||||
|
dimse1(),
|
||||||
|
dimse2(),
|
||||||
|
dimtad(),
|
||||||
|
dimzin(),
|
||||||
|
dimazin(),
|
||||||
|
dimalt(),
|
||||||
|
dimaltd(),
|
||||||
|
dimtofl(),
|
||||||
|
dimsah(),
|
||||||
|
dimtix(),
|
||||||
|
dimsoxd(),
|
||||||
|
dimclrd(),
|
||||||
|
dimclre(),
|
||||||
|
dimclrt(),
|
||||||
|
dimadec(),
|
||||||
|
dimunit(),
|
||||||
|
dimdec(),
|
||||||
|
dimtdec(),
|
||||||
|
dimaltu(),
|
||||||
|
dimalttd(),
|
||||||
|
dimaunit(),
|
||||||
|
dimfrac(),
|
||||||
|
dimlunit(),
|
||||||
|
dimdsep(),
|
||||||
|
dimtmove(),
|
||||||
|
dimjust(),
|
||||||
|
dimsd1(),
|
||||||
|
dimsd2(),
|
||||||
|
dimtolj(),
|
||||||
|
dimtzin(),
|
||||||
|
dimaltz(),
|
||||||
|
dimaltttz(),
|
||||||
|
dimfit(),
|
||||||
|
dimupt(),
|
||||||
|
dimatfit(),
|
||||||
|
dimfxlon(),
|
||||||
|
dimtxsty(),
|
||||||
|
dimldrblk(),
|
||||||
|
dimlwd(),
|
||||||
|
dimlwe()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset(){
|
void reset(){
|
||||||
tType = DRW::DIMSTYLE;
|
tType = DRW::DIMSTYLE;
|
||||||
|
@ -243,7 +324,13 @@ public:
|
||||||
class DRW_LType : public DRW_TableEntry {
|
class DRW_LType : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_LType() { reset();}
|
DRW_LType()
|
||||||
|
: desc(),
|
||||||
|
size(),
|
||||||
|
length(),
|
||||||
|
path(),
|
||||||
|
pathIdx()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset(){
|
void reset(){
|
||||||
tType = DRW::LTYPE;
|
tType = DRW::LTYPE;
|
||||||
|
@ -279,7 +366,16 @@ private:
|
||||||
class DRW_Layer : public DRW_TableEntry {
|
class DRW_Layer : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Layer() { reset();}
|
DRW_Layer()
|
||||||
|
: lineType(),
|
||||||
|
color(),
|
||||||
|
color24(),
|
||||||
|
plotF(),
|
||||||
|
lWeight(),
|
||||||
|
handlePlotS(),
|
||||||
|
handleMaterialS(),
|
||||||
|
lTypeH()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
tType = DRW::LAYER;
|
tType = DRW::LAYER;
|
||||||
|
@ -315,7 +411,16 @@ public:
|
||||||
class DRW_Block_Record : public DRW_TableEntry {
|
class DRW_Block_Record : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Block_Record() { reset();}
|
DRW_Block_Record()
|
||||||
|
: insUnits(),
|
||||||
|
basePoint(),
|
||||||
|
block(),
|
||||||
|
endBlock(),
|
||||||
|
firstEH(),
|
||||||
|
lastEH(),
|
||||||
|
entMap()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
tType = DRW::BLOCK_RECORD;
|
tType = DRW::BLOCK_RECORD;
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
@ -349,7 +454,16 @@ private:
|
||||||
class DRW_Textstyle : public DRW_TableEntry {
|
class DRW_Textstyle : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Textstyle() { reset();}
|
DRW_Textstyle()
|
||||||
|
: height(),
|
||||||
|
width(),
|
||||||
|
oblique(),
|
||||||
|
genFlag(),
|
||||||
|
lastHeight(),
|
||||||
|
font(),
|
||||||
|
bigFont(),
|
||||||
|
fontFamily()
|
||||||
|
{reset();}
|
||||||
|
|
||||||
void reset(){
|
void reset(){
|
||||||
tType = DRW::STYLE;
|
tType = DRW::STYLE;
|
||||||
|
@ -384,7 +498,32 @@ public:
|
||||||
class DRW_Vport : public DRW_TableEntry {
|
class DRW_Vport : public DRW_TableEntry {
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_Vport() { reset();}
|
DRW_Vport()
|
||||||
|
: lowerLeft(),
|
||||||
|
UpperRight(),
|
||||||
|
center(),
|
||||||
|
snapBase(),
|
||||||
|
snapSpacing(),
|
||||||
|
gridSpacing(),
|
||||||
|
viewDir(),
|
||||||
|
viewTarget(),
|
||||||
|
height(),
|
||||||
|
ratio(),
|
||||||
|
lensHeight(),
|
||||||
|
frontClip(),
|
||||||
|
backClip(),
|
||||||
|
snapAngle(),
|
||||||
|
twistAngle(),
|
||||||
|
viewMode(),
|
||||||
|
circleZoom(),
|
||||||
|
fastZoom(),
|
||||||
|
ucsIcon(),
|
||||||
|
snap(),
|
||||||
|
grid(),
|
||||||
|
snapStyle(),
|
||||||
|
snapIsopair(),
|
||||||
|
gridBehavior()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset(){
|
void reset(){
|
||||||
tType = DRW::VPORT;
|
tType = DRW::VPORT;
|
||||||
|
@ -452,7 +591,17 @@ public:
|
||||||
class DRW_ImageDef : public DRW_TableEntry {//
|
class DRW_ImageDef : public DRW_TableEntry {//
|
||||||
SETOBJFRIENDS
|
SETOBJFRIENDS
|
||||||
public:
|
public:
|
||||||
DRW_ImageDef() {
|
DRW_ImageDef()
|
||||||
|
: name(),
|
||||||
|
imgVersion(),
|
||||||
|
u(),
|
||||||
|
v(),
|
||||||
|
up(),
|
||||||
|
vp(),
|
||||||
|
loaded(),
|
||||||
|
resolution(),
|
||||||
|
reactors()
|
||||||
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
virtual void printHL(int c, int s, int h);
|
virtual void printHL(int c, int s, int h);
|
||||||
virtual void printPT(double x, double y, double z);
|
virtual void printPT(double x, double y, double z);
|
||||||
print_debug();
|
print_debug();
|
||||||
virtual ~print_debug(){}
|
virtual ~print_debug() = default;
|
||||||
private:
|
private:
|
||||||
std::ios_base::fmtflags flags;
|
std::ios_base::fmtflags flags;
|
||||||
};
|
};
|
||||||
|
@ -55,11 +55,11 @@ DRW_dbg *DRW_dbg::getInstance(){
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_dbg::DRW_dbg(){
|
DRW_dbg::DRW_dbg()
|
||||||
level = NONE;
|
: level(NONE),
|
||||||
prClass = new print_none;
|
flags(std::cerr.flags()),
|
||||||
flags = std::cerr.flags();
|
prClass(new print_none)
|
||||||
}
|
{}
|
||||||
|
|
||||||
void DRW_dbg::setLevel(LEVEL lvl){
|
void DRW_dbg::setLevel(LEVEL lvl){
|
||||||
level = lvl;
|
level = lvl;
|
||||||
|
@ -120,9 +120,9 @@ void DRW_dbg::printPT(double x, double y, double z){
|
||||||
prClass->printPT(x, y, z);
|
prClass->printPT(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_debug::print_debug(){
|
print_debug::print_debug()
|
||||||
flags = std::cerr.flags();
|
: flags(std::cerr.flags())
|
||||||
}
|
{}
|
||||||
|
|
||||||
void print_debug::printS(std::string s){
|
void print_debug::printS(std::string s){
|
||||||
std::cerr << s;
|
std::cerr << s;
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "../drw_base.h"
|
#include "../drw_base.h"
|
||||||
|
|
||||||
DRW_TextCodec::DRW_TextCodec() {
|
DRW_TextCodec::DRW_TextCodec()
|
||||||
version = DRW::AC1021;
|
: version(DRW::AC1021),
|
||||||
conv = nullptr;
|
cp(),
|
||||||
}
|
conv(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
void DRW_TextCodec::setVersion(int v, bool dxfFormat){
|
void DRW_TextCodec::setVersion(int v, bool dxfFormat){
|
||||||
if (v == DRW::AC1009 || v == DRW::AC1006) {
|
if (v == DRW::AC1009 || v == DRW::AC1006) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define DRW_TEXTCODEC_H
|
#define DRW_TEXTCODEC_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
class QTextCodec;
|
class QTextCodec;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ private:
|
||||||
std::string correctCodePage(const std::string& s);
|
std::string correctCodePage(const std::string& s);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(DRW_TextCodec)
|
||||||
int version;
|
int version;
|
||||||
std::string cp;
|
std::string cp;
|
||||||
QTextCodec *conv;
|
QTextCodec *conv;
|
||||||
|
|
|
@ -144,32 +144,40 @@ bool dwgCharStream::read(duint8* s, duint64 n){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwgBuffer::dwgBuffer(duint8 *buf, int size, DRW_TextCodec *dc){
|
dwgBuffer::dwgBuffer(duint8 *buf, int size, DRW_TextCodec *dc)
|
||||||
filestr = new dwgCharStream(buf, size);
|
: decoder(dc),
|
||||||
decoder = dc;
|
filestr(new dwgCharStream(buf, size)),
|
||||||
maxSize = size;
|
maxSize(size),
|
||||||
bitPos = 0;
|
currByte(),
|
||||||
}
|
bitPos(0)
|
||||||
|
{}
|
||||||
|
|
||||||
dwgBuffer::dwgBuffer(std::istream *stream, DRW_TextCodec *dc){
|
dwgBuffer::dwgBuffer(std::istream *stream, DRW_TextCodec *dc)
|
||||||
filestr = new dwgFileStream(stream);
|
: decoder(dc),
|
||||||
decoder = dc;
|
filestr(new dwgFileStream(stream)),
|
||||||
maxSize = filestr->size();
|
maxSize(static_cast<int>(filestr->size())),
|
||||||
bitPos = 0;
|
currByte(),
|
||||||
}
|
bitPos(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
dwgBuffer::dwgBuffer( const dwgBuffer& org )
|
||||||
|
: decoder(org.decoder),
|
||||||
|
filestr(org.filestr->clone()),
|
||||||
|
maxSize(static_cast<int>(filestr->size())),
|
||||||
|
currByte(org.currByte),
|
||||||
|
bitPos(org.bitPos)
|
||||||
|
{}
|
||||||
|
|
||||||
|
dwgBuffer& dwgBuffer::operator=( const dwgBuffer& org )
|
||||||
|
{
|
||||||
|
if (&org == this)
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
dwgBuffer::dwgBuffer( const dwgBuffer& org ){
|
|
||||||
filestr = org.filestr->clone();
|
filestr = org.filestr->clone();
|
||||||
decoder = org.decoder;
|
decoder = org.decoder;
|
||||||
maxSize = filestr->size();
|
maxSize = static_cast<int>(filestr->size());
|
||||||
currByte = org.currByte;
|
|
||||||
bitPos = org.bitPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwgBuffer& dwgBuffer::operator=( const dwgBuffer& org ){
|
|
||||||
filestr = org.filestr->clone();
|
|
||||||
decoder = org.decoder;
|
|
||||||
maxSize = filestr->size();
|
|
||||||
currByte = org.currByte;
|
currByte = org.currByte;
|
||||||
bitPos = org.bitPos;
|
bitPos = org.bitPos;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -233,7 +241,7 @@ duint8 dwgBuffer::getBit(){
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = (currByte >> (7 - bitPos) & 1);
|
ret = (currByte >> (7 - bitPos) & 1);
|
||||||
bitPos +=1;
|
++bitPos;
|
||||||
if (bitPos == 8)
|
if (bitPos == 8)
|
||||||
bitPos = 0;
|
bitPos = 0;
|
||||||
|
|
||||||
|
@ -254,15 +262,15 @@ duint8 dwgBuffer::get2Bits(){
|
||||||
currByte = buffer;
|
currByte = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitPos +=2;
|
bitPos = static_cast<duint8>(bitPos+2);
|
||||||
if (bitPos < 9)
|
if (bitPos < 9)
|
||||||
ret = currByte >>(8 - bitPos);
|
ret = static_cast<duint8>(currByte >>(8 - bitPos));
|
||||||
else {//read one bit per byte
|
else {//read one bit per byte
|
||||||
ret = currByte << 1;
|
ret = static_cast<duint8>(currByte << 1);
|
||||||
filestr->read (&buffer,1);
|
filestr->read (&buffer,1);
|
||||||
currByte = buffer;
|
currByte = buffer;
|
||||||
bitPos = 1;
|
bitPos = 1;
|
||||||
ret = ret | currByte >> 7;
|
ret = static_cast<duint8>(ret | currByte >> 7);
|
||||||
}
|
}
|
||||||
if (bitPos == 8)
|
if (bitPos == 8)
|
||||||
bitPos = 0;
|
bitPos = 0;
|
||||||
|
@ -280,15 +288,15 @@ duint8 dwgBuffer::get3Bits(){
|
||||||
currByte = buffer;
|
currByte = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitPos +=3;
|
bitPos = static_cast<duint8>(bitPos + 3);
|
||||||
if (bitPos < 9)
|
if (bitPos < 9)
|
||||||
ret = currByte >>(8 - bitPos);
|
ret = static_cast<duint8>(currByte >>(8 - bitPos));
|
||||||
else {//read one bit per byte
|
else {//read one bit per byte
|
||||||
ret = currByte << 1;
|
ret = static_cast<duint8>(currByte << 1);
|
||||||
filestr->read (&buffer,1);
|
filestr->read (&buffer,1);
|
||||||
currByte = buffer;
|
currByte = buffer;
|
||||||
bitPos = 1;
|
bitPos = 1;
|
||||||
ret = ret | currByte >> 7;
|
ret = static_cast<duint8>(ret | currByte >> 7);
|
||||||
}
|
}
|
||||||
if (bitPos == 8)
|
if (bitPos == 8)
|
||||||
bitPos = 0;
|
bitPos = 0;
|
||||||
|
@ -315,9 +323,9 @@ duint16 dwgBuffer::getBitShort(){
|
||||||
dint16 dwgBuffer::getSBitShort(){
|
dint16 dwgBuffer::getSBitShort(){
|
||||||
duint8 b = get2Bits();
|
duint8 b = get2Bits();
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return (dint16)getRawShort16();
|
return static_cast<dint16>(getRawShort16());
|
||||||
else if (b== 1)
|
else if (b== 1)
|
||||||
return (dint16)getRawChar8();
|
return static_cast<dint16>(getRawChar8());
|
||||||
else if (b == 2)
|
else if (b == 2)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@ -384,9 +392,9 @@ duint8 dwgBuffer::getRawChar8(){
|
||||||
if (bitPos == 0)
|
if (bitPos == 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
else {
|
else {
|
||||||
ret = currByte << bitPos;
|
ret = static_cast<duint8>(currByte << bitPos);
|
||||||
currByte = buffer;
|
currByte = buffer;
|
||||||
ret = ret | (currByte >>(8 - bitPos));
|
ret = static_cast<duint8>(ret | (currByte >>(8 - bitPos)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -399,15 +407,15 @@ duint16 dwgBuffer::getRawShort16(){
|
||||||
filestr->read (buffer,2);
|
filestr->read (buffer,2);
|
||||||
if (bitPos == 0) {
|
if (bitPos == 0) {
|
||||||
/* no offset directly swap bytes for little-endian */
|
/* no offset directly swap bytes for little-endian */
|
||||||
ret = (buffer[1] << 8) | (buffer[0] & 0x00FF);
|
ret = static_cast<duint16>((buffer[1] << 8) | (buffer[0] & 0x00FF));
|
||||||
} else {
|
} else {
|
||||||
ret = (buffer[0] << 8) | (buffer[1] & 0x00FF);
|
ret = static_cast<duint16>((buffer[0] << 8) | (buffer[1] & 0x00FF));
|
||||||
/* apply offset */
|
/* apply offset */
|
||||||
ret = ret >> (8 - bitPos);
|
ret = static_cast<duint16>(ret >> (8 - bitPos));
|
||||||
ret = ret | (currByte << (8 + bitPos));
|
ret = static_cast<duint16>(ret | (currByte << (8 + bitPos)));
|
||||||
currByte = buffer[1];
|
currByte = buffer[1];
|
||||||
/* swap bytes for little-endian */
|
/* swap bytes for little-endian */
|
||||||
ret = (ret << 8) | (ret >> 8);
|
ret = static_cast<duint16>((ret << 8) | (ret >> 8));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -593,10 +601,10 @@ std::string dwgBuffer::get8bitStr(){
|
||||||
std::string dwgBuffer::get16bitStr(duint16 textSize, bool nullTerm){
|
std::string dwgBuffer::get16bitStr(duint16 textSize, bool nullTerm){
|
||||||
if (textSize == 0)
|
if (textSize == 0)
|
||||||
return std::string();
|
return std::string();
|
||||||
textSize *=2;
|
textSize = static_cast<duint16>(textSize*2);
|
||||||
duint16 ts = textSize;
|
duint16 ts = textSize;
|
||||||
if (nullTerm)
|
if (nullTerm)
|
||||||
ts += 2;
|
ts = static_cast<duint16>(ts+2);
|
||||||
duint8 *tmpBuffer = new duint8[textSize + 2];
|
duint8 *tmpBuffer = new duint8[textSize + 2];
|
||||||
bool good = getBytes(tmpBuffer, ts);
|
bool good = getBytes(tmpBuffer, ts);
|
||||||
if (!good)
|
if (!good)
|
||||||
|
@ -664,7 +672,7 @@ duint16 dwgBuffer::getObjType(DRW::Version v){//OT
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return getRawChar8();
|
return getRawChar8();
|
||||||
else if (b== 1){
|
else if (b== 1){
|
||||||
return (getRawChar8() + 0x01F0);
|
return static_cast<duint16>((getRawChar8() + 0x01F0));
|
||||||
} else //b == 2
|
} else //b == 2
|
||||||
return getRawShort16();
|
return getRawShort16();
|
||||||
}
|
}
|
||||||
|
@ -757,7 +765,7 @@ duint32 dwgBuffer::getCmColor(DRW::Version v) {
|
||||||
duint16 idx = getBitShort();
|
duint16 idx = getBitShort();
|
||||||
duint32 rgb = getBitLong();
|
duint32 rgb = getBitLong();
|
||||||
duint8 cb = getRawChar8();
|
duint8 cb = getRawChar8();
|
||||||
duint8 type = rgb >> 24;
|
duint8 type = static_cast<duint8>(rgb >> 24);
|
||||||
DRW_DBG("\ntype COLOR: "); DRW_DBGH(type);
|
DRW_DBG("\ntype COLOR: "); DRW_DBGH(type);
|
||||||
DRW_DBG("\nindex COLOR: "); DRW_DBGH(idx);
|
DRW_DBG("\nindex COLOR: "); DRW_DBGH(idx);
|
||||||
DRW_DBG("\nRGB COLOR: "); DRW_DBGH(rgb);
|
DRW_DBG("\nRGB COLOR: "); DRW_DBGH(rgb);
|
||||||
|
@ -802,7 +810,7 @@ duint32 dwgBuffer::getEnColor(DRW::Version v) {
|
||||||
duint32 cb = 0;
|
duint32 cb = 0;
|
||||||
duint16 idx = getBitShort();
|
duint16 idx = getBitShort();
|
||||||
DRW_DBG("idx reads COLOR: "); DRW_DBGH(idx);
|
DRW_DBG("idx reads COLOR: "); DRW_DBGH(idx);
|
||||||
duint16 flags = idx>>8;
|
duint16 flags = static_cast<duint16>(idx>>8);
|
||||||
idx = idx & 0x1FF; //RLZ: warning this is correct?
|
idx = idx & 0x1FF; //RLZ: warning this is correct?
|
||||||
DRW_DBG("\nflag COLOR: "); DRW_DBGH(flags);
|
DRW_DBG("\nflag COLOR: "); DRW_DBGH(flags);
|
||||||
DRW_DBG(", index COLOR: "); DRW_DBGH(idx);
|
DRW_DBG(", index COLOR: "); DRW_DBGH(idx);
|
||||||
|
@ -835,7 +843,7 @@ duint16 dwgBuffer::getBERawShort16(){
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
buffer[0] = getRawChar8();
|
buffer[0] = getRawChar8();
|
||||||
buffer[1] = getRawChar8();
|
buffer[1] = getRawChar8();
|
||||||
duint16 size = (buffer[0] << 8) | (buffer[1] & 0xFF);
|
duint16 size = static_cast<duint16>((buffer[0] << 8) | (buffer[1] & 0xFF));
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,15 +857,15 @@ bool dwgBuffer::getBytes(unsigned char *buf, int size){
|
||||||
if (bitPos != 0){
|
if (bitPos != 0){
|
||||||
for (int i=0; i<size;i++){
|
for (int i=0; i<size;i++){
|
||||||
tmp = buf[i];
|
tmp = buf[i];
|
||||||
buf[i] = (currByte << bitPos) | (tmp >> (8 - bitPos));
|
buf[i] = static_cast<unsigned char>((currByte << bitPos) | (tmp >> (8 - bitPos)));
|
||||||
currByte = tmp;
|
currByte = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
duint16 dwgBuffer::crc8(duint16 dx,dint32 start,dint32 end){
|
duint16 dwgBuffer::crc8(duint16 dx, dint32 start, dint32 end){
|
||||||
int pos = filestr->getPos();
|
int pos = static_cast<int>(filestr->getPos());
|
||||||
filestr->setPos(start);
|
filestr->setPos(start);
|
||||||
int n = end-start;
|
int n = end-start;
|
||||||
duint8 *tmpBuf = new duint8[n];
|
duint8 *tmpBuf = new duint8[n];
|
||||||
|
@ -870,9 +878,9 @@ duint16 dwgBuffer::crc8(duint16 dx,dint32 start,dint32 end){
|
||||||
duint8 al;
|
duint8 al;
|
||||||
|
|
||||||
while (n-- > 0) {
|
while (n-- > 0) {
|
||||||
al = (duint8)((*p) ^ ((dint8)(dx & 0xFF)));
|
al = static_cast<duint8>((*p) ^ (static_cast<duint8>(dx & 0xFF)));
|
||||||
dx = (dx>>8) & 0xFF;
|
dx = (dx>>8) & 0xFF;
|
||||||
dx = dx ^ crctable[al & 0xFF];
|
dx = static_cast<duint16>(dx ^ crctable[al & 0xFF]);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
delete[]tmpBuf;
|
delete[]tmpBuf;
|
||||||
|
@ -880,7 +888,7 @@ duint16 dwgBuffer::crc8(duint16 dx,dint32 start,dint32 end){
|
||||||
}
|
}
|
||||||
|
|
||||||
duint32 dwgBuffer::crc32(duint32 seed,dint32 start,dint32 end){
|
duint32 dwgBuffer::crc32(duint32 seed,dint32 start,dint32 end){
|
||||||
int pos = filestr->getPos();
|
int pos = static_cast<int>(filestr->getPos());
|
||||||
filestr->setPos(start);
|
filestr->setPos(start);
|
||||||
int n = end-start;
|
int n = end-start;
|
||||||
duint8 *tmpBuf = new duint8[n];
|
duint8 *tmpBuf = new duint8[n];
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <QtGlobal>
|
||||||
#include "../drw_base.h"
|
#include "../drw_base.h"
|
||||||
|
|
||||||
class DRW_Coord;
|
class DRW_Coord;
|
||||||
|
@ -35,13 +36,16 @@ public:
|
||||||
|
|
||||||
class dwgFileStream: public dwgBasicStream{
|
class dwgFileStream: public dwgBasicStream{
|
||||||
public:
|
public:
|
||||||
dwgFileStream(std::istream *s){
|
dwgFileStream(std::istream *s)
|
||||||
stream =s;
|
: stream(nullptr),
|
||||||
|
sz(0)
|
||||||
|
{
|
||||||
|
stream = s;
|
||||||
stream->seekg (0, std::ios::end);
|
stream->seekg (0, std::ios::end);
|
||||||
sz = stream->tellg();
|
sz = stream->tellg();
|
||||||
stream->seekg(0, std::ios_base::beg);
|
stream->seekg(0, std::ios_base::beg);
|
||||||
}
|
}
|
||||||
virtual ~dwgFileStream(){}
|
virtual ~dwgFileStream() = default;
|
||||||
virtual bool read(duint8* s, duint64 n);
|
virtual bool read(duint8* s, duint64 n);
|
||||||
virtual duint64 size(){return sz;}
|
virtual duint64 size(){return sz;}
|
||||||
virtual duint64 getPos(){return stream->tellg();}
|
virtual duint64 getPos(){return stream->tellg();}
|
||||||
|
@ -49,19 +53,21 @@ public:
|
||||||
virtual bool good(){return stream->good();}
|
virtual bool good(){return stream->good();}
|
||||||
virtual dwgBasicStream* clone(){return new dwgFileStream(stream);}
|
virtual dwgBasicStream* clone(){return new dwgFileStream(stream);}
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dwgFileStream)
|
||||||
std::istream *stream;
|
std::istream *stream;
|
||||||
duint64 sz;
|
duint64 sz;
|
||||||
};
|
};
|
||||||
|
|
||||||
class dwgCharStream: public dwgBasicStream{
|
class dwgCharStream: public dwgBasicStream{
|
||||||
public:
|
public:
|
||||||
dwgCharStream(duint8 *buf, int s){
|
dwgCharStream(duint8 *buf, duint64 s)
|
||||||
stream =buf;
|
: stream(buf),
|
||||||
sz = s;
|
sz(s),
|
||||||
pos = 0;
|
pos(0),
|
||||||
isOk = true;
|
isOk(true)
|
||||||
}
|
{}
|
||||||
virtual ~dwgCharStream(){}
|
virtual ~dwgCharStream() = default;
|
||||||
|
|
||||||
virtual bool read(duint8* s, duint64 n);
|
virtual bool read(duint8* s, duint64 n);
|
||||||
virtual duint64 size(){return sz;}
|
virtual duint64 size(){return sz;}
|
||||||
virtual duint64 getPos(){return pos;}
|
virtual duint64 getPos(){return pos;}
|
||||||
|
@ -69,6 +75,7 @@ public:
|
||||||
virtual bool good(){return isOk;}
|
virtual bool good(){return isOk;}
|
||||||
virtual dwgBasicStream* clone(){return new dwgCharStream(stream, sz);}
|
virtual dwgBasicStream* clone(){return new dwgCharStream(stream, sz);}
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dwgCharStream)
|
||||||
duint8 *stream;
|
duint8 *stream;
|
||||||
duint64 sz;
|
duint64 sz;
|
||||||
duint64 pos;
|
duint64 pos;
|
||||||
|
@ -134,7 +141,7 @@ public:
|
||||||
|
|
||||||
bool isGood(){return filestr->good();}
|
bool isGood(){return filestr->good();}
|
||||||
bool getBytes(duint8 *buf, int size);
|
bool getBytes(duint8 *buf, int size);
|
||||||
int numRemainingBytes(){return (maxSize- filestr->getPos());}
|
int numRemainingBytes(){return (maxSize- static_cast<int>(filestr->getPos()));}
|
||||||
|
|
||||||
duint16 crc8(duint16 dx,dint32 start,dint32 end);
|
duint16 crc8(duint16 dx,dint32 start,dint32 end);
|
||||||
duint32 crc32(duint32 seed,dint32 start,dint32 end);
|
duint32 crc32(duint32 seed,dint32 start,dint32 end);
|
||||||
|
|
|
@ -160,7 +160,7 @@ bool dwgReader::readDwgHandles(dwgBuffer *dbuf, duint32 offset, duint32 size) {
|
||||||
DRW_DBG("object map section crc8 read= "); DRW_DBG(crcRead);
|
DRW_DBG("object map section crc8 read= "); DRW_DBG(crcRead);
|
||||||
DRW_DBG("\nobject map section crc8 calculated= "); DRW_DBG(crcCalc);
|
DRW_DBG("\nobject map section crc8 calculated= "); DRW_DBG(crcCalc);
|
||||||
DRW_DBG("\nobject section buf->curPosition()= "); DRW_DBG(dbuf->getPosition()); DRW_DBG("\n");
|
DRW_DBG("\nobject section buf->curPosition()= "); DRW_DBG(dbuf->getPosition()); DRW_DBG("\n");
|
||||||
startPos = dbuf->getPosition();
|
startPos = static_cast<int>(dbuf->getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = dbuf->isGood();
|
bool ret = dbuf->isGood();
|
||||||
|
@ -994,7 +994,7 @@ bool dwgReader::readDwgEntity(dwgBuffer *dbuf, objHandle& obj, DRW_Interface& in
|
||||||
} else {
|
} else {
|
||||||
DRW_Class *cl = it->second;
|
DRW_Class *cl = it->second;
|
||||||
if (cl->dwgType != 0)
|
if (cl->dwgType != 0)
|
||||||
oType = cl->dwgType;
|
oType = static_cast<dint16>(cl->dwgType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1221,7 +1221,7 @@ bool dwgReader::readDwgObject(dwgBuffer *dbuf, objHandle& obj, DRW_Interface& in
|
||||||
}
|
}
|
||||||
dwgBuffer buff(tmpByteStr, size, &decoder);
|
dwgBuffer buff(tmpByteStr, size, &decoder);
|
||||||
//oType are set parsing entities
|
//oType are set parsing entities
|
||||||
dint16 oType = obj.type;
|
dint16 oType = static_cast<dint16>(obj.type);
|
||||||
|
|
||||||
switch (oType){
|
switch (oType){
|
||||||
case 102: {
|
case 102: {
|
||||||
|
@ -1235,7 +1235,11 @@ bool dwgReader::readDwgObject(dwgBuffer *dbuf, objHandle& obj, DRW_Interface& in
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ret){
|
if (!ret){
|
||||||
DRW_DBG("Warning: Object type "); DRW_DBG(oType);DRW_DBG("has failed, handle: "); DRW_DBG(obj.handle); DRW_DBG("\n");
|
DRW_DBG("Warning: Object type ");
|
||||||
|
DRW_DBG(oType);
|
||||||
|
DRW_DBG("has failed, handle: ");
|
||||||
|
DRW_DBG(obj.handle);
|
||||||
|
DRW_DBG("\n");
|
||||||
}
|
}
|
||||||
delete[]tmpByteStr;
|
delete[]tmpByteStr;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1245,8 +1249,8 @@ bool dwgReader::readDwgObject(dwgBuffer *dbuf, objHandle& obj, DRW_Interface& in
|
||||||
|
|
||||||
bool DRW_ObjControl::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
bool DRW_ObjControl::parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs){
|
||||||
int unkData=0;
|
int unkData=0;
|
||||||
bool ret = DRW_TableEntry::parseDwg(version, buf, NULL, bs);
|
bool ret = DRW_TableEntry::parseDwg(version, buf, nullptr, bs);
|
||||||
DRW_DBG("\n***************************** parsing object control entry *********************************************\n");
|
DRW_DBG("\n***************************** parsing object control entry *****************************************\n");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
//last parsed is: XDic Missing Flag 2004+
|
//last parsed is: XDic Missing Flag 2004+
|
||||||
|
|
|
@ -22,12 +22,18 @@
|
||||||
|
|
||||||
class objHandle{
|
class objHandle{
|
||||||
public:
|
public:
|
||||||
objHandle(){ handle = type = loc = 0; }
|
objHandle()
|
||||||
objHandle(duint32 t, duint32 h, duint32 l){
|
: type(0),
|
||||||
type = t;
|
handle(0),
|
||||||
handle = h;
|
loc(0)
|
||||||
loc = l;
|
{}
|
||||||
}
|
|
||||||
|
objHandle(duint32 t, duint32 h, duint32 l)
|
||||||
|
: type(t),
|
||||||
|
handle(h),
|
||||||
|
loc(l)
|
||||||
|
{}
|
||||||
|
|
||||||
duint32 type;
|
duint32 type;
|
||||||
duint32 handle;
|
duint32 handle;
|
||||||
duint32 loc;
|
duint32 loc;
|
||||||
|
@ -55,11 +61,27 @@ public:
|
||||||
* */
|
* */
|
||||||
class dwgPageInfo {
|
class dwgPageInfo {
|
||||||
public:
|
public:
|
||||||
dwgPageInfo(){}
|
dwgPageInfo()
|
||||||
dwgPageInfo(duint64 i, duint64 ad, duint32 sz){
|
: Id(),
|
||||||
Id=i; address=ad; size=sz;
|
address(),
|
||||||
}
|
size(),
|
||||||
~dwgPageInfo(){}
|
dataSize(),
|
||||||
|
startOffset(),
|
||||||
|
cSize(),
|
||||||
|
uSize()
|
||||||
|
{}
|
||||||
|
|
||||||
|
dwgPageInfo(duint64 i, duint64 ad, duint32 sz)
|
||||||
|
: Id(i),
|
||||||
|
address(ad),
|
||||||
|
size(sz),
|
||||||
|
dataSize(),
|
||||||
|
startOffset(),
|
||||||
|
cSize(),
|
||||||
|
uSize()
|
||||||
|
{}
|
||||||
|
|
||||||
|
~dwgPageInfo() = default;
|
||||||
duint64 Id;
|
duint64 Id;
|
||||||
duint64 address; //in file stream, for rd18, rd21
|
duint64 address; //in file stream, for rd18, rd21
|
||||||
duint64 size; //in file stream, for rd18, rd21
|
duint64 size; //in file stream, for rd18, rd21
|
||||||
|
@ -82,13 +104,19 @@ public:
|
||||||
* */
|
* */
|
||||||
class dwgSectionInfo {
|
class dwgSectionInfo {
|
||||||
public:
|
public:
|
||||||
dwgSectionInfo(){
|
dwgSectionInfo()
|
||||||
compresed = 1;//1=no, 2=yes
|
: Id(-1),
|
||||||
encrypted = 0;//???
|
name(),
|
||||||
pageCount = 0;
|
compresed(1),//1=no, 2=yes
|
||||||
Id=-1;
|
encrypted(0),//???
|
||||||
}
|
pages(),
|
||||||
~dwgSectionInfo(){}
|
size(),
|
||||||
|
pageCount(0),
|
||||||
|
maxSize(),
|
||||||
|
address()
|
||||||
|
{}
|
||||||
|
|
||||||
|
~dwgSectionInfo() = default;
|
||||||
dint32 Id; //section Id, 2000- rd15 rd18
|
dint32 Id; //section Id, 2000- rd15 rd18
|
||||||
std::string name; //section name rd18
|
std::string name; //section name rd18
|
||||||
duint32 compresed;//is compresed? 1=no, 2=yes rd18, rd21(encoding)
|
duint32 compresed;//is compresed? 1=no, 2=yes rd18, rd21(encoding)
|
||||||
|
@ -108,10 +136,11 @@ public:
|
||||||
*/
|
*/
|
||||||
class DRW_ObjControl : public DRW_TableEntry {
|
class DRW_ObjControl : public DRW_TableEntry {
|
||||||
public:
|
public:
|
||||||
DRW_ObjControl() { reset();}
|
DRW_ObjControl()
|
||||||
|
: hadlesList()
|
||||||
|
{ reset();}
|
||||||
|
|
||||||
void reset(){
|
void reset(){}
|
||||||
}
|
|
||||||
bool parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs=0);
|
bool parseDwg(DRW::Version version, dwgBuffer *buf, duint32 bs=0);
|
||||||
std::list<duint32>hadlesList;
|
std::list<duint32>hadlesList;
|
||||||
};
|
};
|
||||||
|
@ -120,16 +149,31 @@ public:
|
||||||
class dwgReader {
|
class dwgReader {
|
||||||
friend class dwgR;
|
friend class dwgR;
|
||||||
public:
|
public:
|
||||||
dwgReader(std::istream *stream, dwgR *p){
|
dwgReader(std::istream *stream, dwgR *p)
|
||||||
fileBuf = new dwgBuffer(stream);
|
: ObjectMap(),
|
||||||
parent = p;
|
objObjectMap(),
|
||||||
|
remainingMap(),
|
||||||
|
ltypemap(),
|
||||||
|
layermap(),
|
||||||
|
blockmap(),
|
||||||
|
stylemap(),
|
||||||
|
dimstylemap(),
|
||||||
|
vportmap(),
|
||||||
|
blockRecordmap(),
|
||||||
|
appIdmap(),
|
||||||
|
maintenanceVersion(0),
|
||||||
|
fileBuf(new dwgBuffer(stream)),
|
||||||
|
parent(p),
|
||||||
|
version(),
|
||||||
|
previewImagePos(),
|
||||||
|
sections(),
|
||||||
|
classesmap(),
|
||||||
|
decoder(),
|
||||||
|
nextEntLink(0),
|
||||||
|
prevEntLink(0)
|
||||||
|
{
|
||||||
decoder.setVersion(DRW::AC1021, false);//default 2007 in utf8(no convert)
|
decoder.setVersion(DRW::AC1021, false);//default 2007 in utf8(no convert)
|
||||||
decoder.setCodePage("UTF-16", false);
|
decoder.setCodePage("UTF-16", false);
|
||||||
// blockCtrl=0; //RLZ: temporary
|
|
||||||
// blockCtrl=layerCtrl=styleCtrl=linetypeCtrl=viewCtrl=0;
|
|
||||||
// ucsCtrl=vportCtrl=appidCtrl=dimstyleCtrl=vpEntHeaderCtrl=0;
|
|
||||||
nextEntLink = prevEntLink = 0;
|
|
||||||
maintenanceVersion=0;
|
|
||||||
}
|
}
|
||||||
virtual ~dwgReader();
|
virtual ~dwgReader();
|
||||||
|
|
||||||
|
@ -196,6 +240,8 @@ protected:
|
||||||
// duint32 blockCtrl;
|
// duint32 blockCtrl;
|
||||||
duint32 nextEntLink;
|
duint32 nextEntLink;
|
||||||
duint32 prevEntLink;
|
duint32 prevEntLink;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(dwgReader)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,12 @@ bool dwgReader15::readFileHeader() {
|
||||||
return false;
|
return false;
|
||||||
DRW_DBG("\nposition after read section locator records= "); DRW_DBG(fileBuf->getPosition());
|
DRW_DBG("\nposition after read section locator records= "); DRW_DBG(fileBuf->getPosition());
|
||||||
DRW_DBG(", bit are= "); DRW_DBG(fileBuf->getBitPos());
|
DRW_DBG(", bit are= "); DRW_DBG(fileBuf->getBitPos());
|
||||||
duint32 ckcrc = fileBuf->crc8(0,0,fileBuf->getPosition());
|
duint32 ckcrc = static_cast<duint32>(fileBuf->crc8(0, 0, static_cast<dint32>(fileBuf->getPosition())));
|
||||||
DRW_DBG("\nfile header crc8 0 result= "); DRW_DBG(ckcrc);
|
DRW_DBG("\nfile header crc8 0 result= "); DRW_DBG(ckcrc);
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
|
||||||
switch (count){
|
switch (count){
|
||||||
case 3:
|
case 3:
|
||||||
ckcrc = ckcrc ^ 0xA598;
|
ckcrc = ckcrc ^ 0xA598;
|
||||||
|
@ -103,6 +107,9 @@ bool dwgReader15::readFileHeader() {
|
||||||
case 6:
|
case 6:
|
||||||
ckcrc = ckcrc ^ 0x8461;
|
ckcrc = ckcrc ^ 0x8461;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
DRW_DBG("\nfile header crc8 xor result= "); DRW_DBG(ckcrc);
|
DRW_DBG("\nfile header crc8 xor result= "); DRW_DBG(ckcrc);
|
||||||
DRW_DBG("\nfile header CRC= "); DRW_DBG(fileBuf->getRawShort16());
|
DRW_DBG("\nfile header CRC= "); DRW_DBG(fileBuf->getRawShort16());
|
||||||
DRW_DBG("\nfile header sentinel= ");
|
DRW_DBG("\nfile header sentinel= ");
|
||||||
|
@ -123,8 +130,8 @@ bool dwgReader15::readDwgHeader(DRW_Header& hdr){
|
||||||
if (!fileBuf->setPosition(si.address))
|
if (!fileBuf->setPosition(si.address))
|
||||||
return false;
|
return false;
|
||||||
duint8 *tmpByteStr = new duint8[si.size];
|
duint8 *tmpByteStr = new duint8[si.size];
|
||||||
fileBuf->getBytes(tmpByteStr, si.size);
|
fileBuf->getBytes(tmpByteStr, static_cast<int>(si.size));
|
||||||
dwgBuffer buff(tmpByteStr, si.size, &decoder);
|
dwgBuffer buff(tmpByteStr, static_cast<int>(si.size), &decoder);
|
||||||
DRW_DBG("Header section sentinel= ");
|
DRW_DBG("Header section sentinel= ");
|
||||||
checkSentinel(&buff, secEnum::HEADER, true);
|
checkSentinel(&buff, secEnum::HEADER, true);
|
||||||
bool ret = dwgReader::readDwgHeader(hdr, &buff, &buff);
|
bool ret = dwgReader::readDwgHeader(hdr, &buff, &buff);
|
||||||
|
@ -172,7 +179,7 @@ bool dwgReader15::readDwgHandles() {
|
||||||
if (si.Id<0)//not found, ends
|
if (si.Id<0)//not found, ends
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ret = dwgReader::readDwgHandles(fileBuf, si.address, si.size);
|
bool ret = dwgReader::readDwgHandles(fileBuf, static_cast<duint32>(si.address), static_cast<duint32>(si.size));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,10 @@ bool dwgReader18::parseDataPage(dwgSectionInfo si/*, duint8 *dData*/){
|
||||||
//decript section header
|
//decript section header
|
||||||
duint8 hdrData[32];
|
duint8 hdrData[32];
|
||||||
fileBuf->getBytes(hdrData, 32);
|
fileBuf->getBytes(hdrData, 32);
|
||||||
dwgCompressor::decrypt18Hdr(hdrData, 32, pi.address);
|
dwgCompressor::decrypt18Hdr(hdrData, 32, static_cast<duint32>(pi.address));
|
||||||
DRW_DBG("Section "); DRW_DBG(si.name); DRW_DBG(" page header=\n");
|
DRW_DBG("Section "); DRW_DBG(si.name); DRW_DBG(" page header=\n");
|
||||||
for (unsigned int i=0, j=0; i< 32;i++) {
|
for (unsigned int i=0, j=0; i< 32;i++) {
|
||||||
DRW_DBGH( (unsigned char)hdrData[i]);
|
DRW_DBGH( static_cast<unsigned char>(hdrData[i]));
|
||||||
if (j == 7) {
|
if (j == 7) {
|
||||||
DRW_DBG("\n");
|
DRW_DBG("\n");
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -150,10 +150,10 @@ bool dwgReader18::parseDataPage(dwgSectionInfo si/*, duint8 *dData*/){
|
||||||
duint8 *cData = new duint8[pi.cSize];
|
duint8 *cData = new duint8[pi.cSize];
|
||||||
if (!fileBuf->setPosition(pi.address+32))
|
if (!fileBuf->setPosition(pi.address+32))
|
||||||
return false;
|
return false;
|
||||||
fileBuf->getBytes(cData, pi.cSize);
|
fileBuf->getBytes(cData, static_cast<int>(pi.cSize));
|
||||||
|
|
||||||
//calculate checksum
|
//calculate checksum
|
||||||
duint32 calcsD = checksum(0, cData, pi.cSize);
|
duint32 calcsD = checksum(0, cData, static_cast<duint32>(pi.cSize));
|
||||||
for (duint8 i= 24; i<28; ++i)
|
for (duint8 i= 24; i<28; ++i)
|
||||||
hdrData[i]=0;
|
hdrData[i]=0;
|
||||||
duint32 calcsH = checksum(calcsD, hdrData, 32);
|
duint32 calcsH = checksum(calcsD, hdrData, 32);
|
||||||
|
@ -164,7 +164,7 @@ bool dwgReader18::parseDataPage(dwgSectionInfo si/*, duint8 *dData*/){
|
||||||
pi.uSize = si.maxSize;
|
pi.uSize = si.maxSize;
|
||||||
DRW_DBG("decompresing "); DRW_DBG(pi.cSize); DRW_DBG(" bytes in "); DRW_DBG(pi.uSize); DRW_DBG(" bytes\n");
|
DRW_DBG("decompresing "); DRW_DBG(pi.cSize); DRW_DBG(" bytes in "); DRW_DBG(pi.uSize); DRW_DBG(" bytes\n");
|
||||||
dwgCompressor comp;
|
dwgCompressor comp;
|
||||||
comp.decompress18(cData, oData, pi.cSize, pi.uSize);
|
comp.decompress18(cData, oData, static_cast<duint32>(pi.cSize), static_cast<duint32>(pi.uSize));
|
||||||
delete[]cData;
|
delete[]cData;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -222,14 +222,14 @@ bool dwgReader18::readFileHeader() {
|
||||||
DRW_DBG(", ");
|
DRW_DBG(", ");
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
byteStr[i] = DRW_magicNum18[i] ^ ch;
|
byteStr[i] = static_cast<duint8>(DRW_magicNum18[i] ^ ch);
|
||||||
}
|
}
|
||||||
DRW_DBG("\n");
|
DRW_DBG("\n");
|
||||||
|
|
||||||
// size =0x6C;
|
// size =0x6C;
|
||||||
DRW_DBG("Decripted Header Data=\n");
|
DRW_DBG("Decripted Header Data=\n");
|
||||||
for (int i=0, j = 0; i< size;i++) {
|
for (int i=0, j = 0; i< size;i++) {
|
||||||
DRW_DBGH( (unsigned char)byteStr[i]);
|
DRW_DBGH( static_cast<unsigned char>(byteStr[i]));
|
||||||
if (j == 15) {
|
if (j == 15) {
|
||||||
DRW_DBG("\n");
|
DRW_DBG("\n");
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -277,8 +277,8 @@ bool dwgReader18::readFileHeader() {
|
||||||
|
|
||||||
DRW_DBG("\nEnd Encrypted Data. Reads 0x14 bytes, equal to magic number:\n");
|
DRW_DBG("\nEnd Encrypted Data. Reads 0x14 bytes, equal to magic number:\n");
|
||||||
for (int i=0, j=0; i< 0x14;i++) {
|
for (int i=0, j=0; i< 0x14;i++) {
|
||||||
DRW_DBG("magic num: "); DRW_DBGH( (unsigned char)DRW_magicNumEnd18[i]);
|
DRW_DBG("magic num: "); DRW_DBGH( static_cast<unsigned char>(DRW_magicNumEnd18[i]));
|
||||||
DRW_DBG(",read "); DRW_DBGH( (unsigned char)fileBuf->getRawChar8());
|
DRW_DBG(",read "); DRW_DBGH( static_cast<unsigned char>(fileBuf->getRawChar8()));
|
||||||
if (j == 3) {
|
if (j == 3) {
|
||||||
DRW_DBG("\n");
|
DRW_DBG("\n");
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -382,7 +382,7 @@ bool dwgReader18::readFileHeader() {
|
||||||
dwgPageInfo pi = sectionPageMapTmp[pn]; //get a copy
|
dwgPageInfo pi = sectionPageMapTmp[pn]; //get a copy
|
||||||
DRW_DBG(" reading pag num = "); DRW_DBGH(pn);
|
DRW_DBG(" reading pag num = "); DRW_DBGH(pn);
|
||||||
pi.dataSize = buff3.getRawLong32();
|
pi.dataSize = buff3.getRawLong32();
|
||||||
pi.startOffset = buff3.getRawLong64();
|
pi.startOffset = static_cast<duint32>(buff3.getRawLong64());
|
||||||
secInfo.pages[pn]= pi;//complete copy in secInfo
|
secInfo.pages[pn]= pi;//complete copy in secInfo
|
||||||
DRW_DBG("\n Page number= "); DRW_DBGH(secInfo.pages[pn].Id);
|
DRW_DBG("\n Page number= "); DRW_DBGH(secInfo.pages[pn].Id);
|
||||||
DRW_DBG("\n size in file= "); DRW_DBGH(secInfo.pages[pn].size);
|
DRW_DBG("\n size in file= "); DRW_DBGH(secInfo.pages[pn].size);
|
||||||
|
@ -413,20 +413,20 @@ bool dwgReader18::readDwgHeader(DRW_Header& hdr){
|
||||||
//global store for uncompressed data of all pages
|
//global store for uncompressed data of all pages
|
||||||
uncompSize=si.size;
|
uncompSize=si.size;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dwgBuffer dataBuf(objData, si.size, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(si.size), &decoder);
|
||||||
DRW_DBG("Header section sentinel= ");
|
DRW_DBG("Header section sentinel= ");
|
||||||
checkSentinel(&dataBuf, secEnum::HEADER, true);
|
checkSentinel(&dataBuf, secEnum::HEADER, true);
|
||||||
if (version == DRW::AC1018){
|
if (version == DRW::AC1018){
|
||||||
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &dataBuf);
|
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &dataBuf);
|
||||||
} else {
|
} else {
|
||||||
dwgBuffer handleBuf(objData, si.size, &decoder);
|
dwgBuffer handleBuf(objData, static_cast<int>(si.size), &decoder);
|
||||||
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &handleBuf);
|
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &handleBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Cleanup: global store for uncompressed data of all pages
|
//Cleanup: global store for uncompressed data of all pages
|
||||||
if (objData != NULL){
|
if (objData != nullptr){
|
||||||
delete[] objData;
|
delete[] objData;
|
||||||
objData = NULL;
|
objData = nullptr;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ bool dwgReader18::readDwgClasses(){
|
||||||
uncompSize=si.size;
|
uncompSize=si.size;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
|
|
||||||
DRW_DBG("classes section sentinel= ");
|
DRW_DBG("classes section sentinel= ");
|
||||||
checkSentinel(&dataBuf, secEnum::CLASSES, true);
|
checkSentinel(&dataBuf, secEnum::CLASSES, true);
|
||||||
|
@ -466,7 +466,7 @@ bool dwgReader18::readDwgClasses(){
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
dwgBuffer *strBuf = &dataBuf;
|
dwgBuffer *strBuf = &dataBuf;
|
||||||
dwgBuffer strBuff(objData, uncompSize, &decoder);
|
dwgBuffer strBuff(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
//prepare string stream for 2007+
|
//prepare string stream for 2007+
|
||||||
if (version > DRW::AC1021) {//2007+
|
if (version > DRW::AC1021) {//2007+
|
||||||
strBuf = &strBuff;
|
strBuf = &strBuff;
|
||||||
|
@ -529,9 +529,9 @@ bool dwgReader18::readDwgClasses(){
|
||||||
ret = strBuf->isGood();
|
ret = strBuf->isGood();
|
||||||
}
|
}
|
||||||
//Cleanup: global store for uncompressed data of all pages
|
//Cleanup: global store for uncompressed data of all pages
|
||||||
if (objData != NULL){
|
if (objData != nullptr){
|
||||||
delete[] objData;
|
delete[] objData;
|
||||||
objData = NULL;
|
objData = nullptr;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -554,14 +554,14 @@ bool dwgReader18::readDwgHandles() {
|
||||||
uncompSize=si.size;
|
uncompSize=si.size;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
|
|
||||||
ret = dwgReader::readDwgHandles(&dataBuf, 0, si.size);
|
ret = dwgReader::readDwgHandles(&dataBuf, 0, static_cast<duint32>(si.size));
|
||||||
}
|
}
|
||||||
//Cleanup: global store for uncompressed data of all pages
|
//Cleanup: global store for uncompressed data of all pages
|
||||||
if (objData != NULL){
|
if (objData != nullptr){
|
||||||
delete[] objData;
|
delete[] objData;
|
||||||
objData = NULL;
|
objData = nullptr;
|
||||||
uncompSize = 0;
|
uncompSize = 0;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -584,7 +584,7 @@ bool dwgReader18::readDwgTables(DRW_Header& hdr) {
|
||||||
uncompSize=si.size;
|
uncompSize=si.size;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
|
|
||||||
ret = dwgReader::readDwgTables(hdr, &dataBuf);
|
ret = dwgReader::readDwgTables(hdr, &dataBuf);
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,15 @@ static const int DRW_magicNumEnd18[] = {
|
||||||
|
|
||||||
class dwgReader18 : public dwgReader {
|
class dwgReader18 : public dwgReader {
|
||||||
public:
|
public:
|
||||||
dwgReader18(std::istream *stream, dwgR *p):dwgReader(stream, p){
|
dwgReader18(std::istream *stream, dwgR *p)
|
||||||
objData = NULL;
|
: dwgReader(stream, p),
|
||||||
}
|
objData(nullptr),
|
||||||
|
uncompSize(),
|
||||||
|
securityFlags()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual ~dwgReader18(){
|
virtual ~dwgReader18(){
|
||||||
if (objData != NULL)
|
if (objData != nullptr)
|
||||||
delete[] objData;
|
delete[] objData;
|
||||||
}
|
}
|
||||||
bool readMetaData();
|
bool readMetaData();
|
||||||
|
@ -58,20 +62,20 @@ public:
|
||||||
bool readDwgTables(DRW_Header& hdr);
|
bool readDwgTables(DRW_Header& hdr);
|
||||||
bool readDwgBlocks(DRW_Interface& intfa){
|
bool readDwgBlocks(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool readDwgEntities(DRW_Interface& intfa){
|
virtual bool readDwgEntities(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgObjects(DRW_Interface& intfa){
|
virtual bool readDwgObjects(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +90,7 @@ protected:
|
||||||
duint64 uncompSize;
|
duint64 uncompSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dwgReader18)
|
||||||
void genMagicNumber();
|
void genMagicNumber();
|
||||||
// dwgBuffer* bufObj;
|
// dwgBuffer* bufObj;
|
||||||
void parseSysPage(duint8 *decompSec, duint32 decompSize); //called: Section page map: 0x41630e3b
|
void parseSysPage(duint8 *decompSec, duint32 decompSize); //called: Section page map: 0x41630e3b
|
||||||
|
|
|
@ -59,16 +59,17 @@ bool dwgReader21::parseSysPage(duint64 sizeCompressed, duint64 sizeUncompressed,
|
||||||
//round to 8
|
//round to 8
|
||||||
duint64 alsize = (sizeCompressed + 7) &(-8);
|
duint64 alsize = (sizeCompressed + 7) &(-8);
|
||||||
//minimum RS chunk:
|
//minimum RS chunk:
|
||||||
duint32 chunks = (((alsize * correctionFactor)+238)/239);
|
duint32 chunks = static_cast<duint32>(((alsize * correctionFactor)+238)/239);
|
||||||
duint64 fpsize = chunks * 255;
|
duint64 fpsize = chunks * 255;
|
||||||
|
|
||||||
if (! fileBuf->setPosition(offset))
|
if (! fileBuf->setPosition(offset))
|
||||||
return false;
|
return false;
|
||||||
duint8 *tmpDataRaw = new duint8[fpsize];
|
duint8 *tmpDataRaw = new duint8[fpsize];
|
||||||
fileBuf->getBytes(tmpDataRaw, fpsize);
|
fileBuf->getBytes(tmpDataRaw, static_cast<int>(fpsize));
|
||||||
duint8 *tmpDataRS = new duint8[fpsize];
|
duint8 *tmpDataRS = new duint8[fpsize];
|
||||||
dwgRSCodec::decode239I(tmpDataRaw, tmpDataRS, fpsize/255);
|
dwgRSCodec::decode239I(tmpDataRaw, tmpDataRS, static_cast<duint32>(fpsize/255));
|
||||||
dwgCompressor::decompress21(tmpDataRS, decompData, sizeCompressed, sizeUncompressed);
|
dwgCompressor::decompress21(tmpDataRS, decompData, static_cast<duint32>(sizeCompressed),
|
||||||
|
static_cast<duint32>(sizeUncompressed));
|
||||||
delete[]tmpDataRaw;
|
delete[]tmpDataRaw;
|
||||||
delete[]tmpDataRS;
|
delete[]tmpDataRS;
|
||||||
return true;
|
return true;
|
||||||
|
@ -82,7 +83,7 @@ bool dwgReader21::parseDataPage(dwgSectionInfo si, duint8 *dData){
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
duint8 *tmpPageRaw = new duint8[pi.size];
|
duint8 *tmpPageRaw = new duint8[pi.size];
|
||||||
fileBuf->getBytes(tmpPageRaw, pi.size);
|
fileBuf->getBytes(tmpPageRaw, static_cast<int>(pi.size));
|
||||||
#ifdef DRW_DBG_DUMP
|
#ifdef DRW_DBG_DUMP
|
||||||
DRW_DBG("\nSection OBJECTS raw data=\n");
|
DRW_DBG("\nSection OBJECTS raw data=\n");
|
||||||
for (unsigned int i=0, j=0; i< pi.size;i++) {
|
for (unsigned int i=0, j=0; i< pi.size;i++) {
|
||||||
|
@ -93,7 +94,7 @@ bool dwgReader21::parseDataPage(dwgSectionInfo si, duint8 *dData){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
duint8 *tmpPageRS = new duint8[pi.size];
|
duint8 *tmpPageRS = new duint8[pi.size];
|
||||||
duint8 chunks =pi.size / 255;
|
duint8 chunks = static_cast<duint8>(pi.size / 255);
|
||||||
dwgRSCodec::decode251I(tmpPageRaw, tmpPageRS, chunks);
|
dwgRSCodec::decode251I(tmpPageRaw, tmpPageRS, chunks);
|
||||||
#ifdef DRW_DBG_DUMP
|
#ifdef DRW_DBG_DUMP
|
||||||
DRW_DBG("\nSection OBJECTS RS data=\n");
|
DRW_DBG("\nSection OBJECTS RS data=\n");
|
||||||
|
@ -107,7 +108,8 @@ bool dwgReader21::parseDataPage(dwgSectionInfo si, duint8 *dData){
|
||||||
DRW_DBG("\npage uncomp size: "); DRW_DBG(pi.uSize); DRW_DBG(" comp size: "); DRW_DBG(pi.cSize);
|
DRW_DBG("\npage uncomp size: "); DRW_DBG(pi.uSize); DRW_DBG(" comp size: "); DRW_DBG(pi.cSize);
|
||||||
DRW_DBG("\noffset: "); DRW_DBG(pi.startOffset);
|
DRW_DBG("\noffset: "); DRW_DBG(pi.startOffset);
|
||||||
duint8 *pageData = dData + pi.startOffset;
|
duint8 *pageData = dData + pi.startOffset;
|
||||||
dwgCompressor::decompress21(tmpPageRS, pageData, pi.cSize, pi.uSize);
|
dwgCompressor::decompress21(tmpPageRS, pageData, static_cast<duint32>(pi.cSize),
|
||||||
|
static_cast<duint32>(pi.uSize));
|
||||||
|
|
||||||
#ifdef DRW_DBG_DUMP
|
#ifdef DRW_DBG_DUMP
|
||||||
DRW_DBG("\n\nSection OBJECTS decompresed data=\n");
|
DRW_DBG("\n\nSection OBJECTS decompresed data=\n");
|
||||||
|
@ -236,7 +238,7 @@ bool dwgReader21::readFileHeader() {
|
||||||
|
|
||||||
duint64 address = 0x480;
|
duint64 address = 0x480;
|
||||||
duint64 i = 0;
|
duint64 i = 0;
|
||||||
dwgBuffer PagesMapBuf(PagesMapData, PagesMapSizeUncompressed, &decoder);
|
dwgBuffer PagesMapBuf(PagesMapData, static_cast<int>(PagesMapSizeUncompressed), &decoder);
|
||||||
//stores temporaly info of all pages:
|
//stores temporaly info of all pages:
|
||||||
std::map<duint32, dwgPageInfo >sectionPageMapTmp;
|
std::map<duint32, dwgPageInfo >sectionPageMapTmp;
|
||||||
|
|
||||||
|
@ -249,7 +251,7 @@ bool dwgReader21::readFileHeader() {
|
||||||
|
|
||||||
DRW_DBG("Page gap= "); DRW_DBG(id); DRW_DBG(" Page num= "); DRW_DBG(ind); DRW_DBG(" size= "); DRW_DBGH(size);
|
DRW_DBG("Page gap= "); DRW_DBG(id); DRW_DBG(" Page num= "); DRW_DBG(ind); DRW_DBG(" size= "); DRW_DBGH(size);
|
||||||
DRW_DBG(" address= "); DRW_DBGH(address); DRW_DBG("\n");
|
DRW_DBG(" address= "); DRW_DBGH(address); DRW_DBG("\n");
|
||||||
sectionPageMapTmp[ind] = dwgPageInfo(ind, address,size);
|
sectionPageMapTmp[static_cast<duint32>(ind)] = dwgPageInfo(ind, address, static_cast<duint32>(size));
|
||||||
address += size;
|
address += size;
|
||||||
//TODO num can be negative indicating gap
|
//TODO num can be negative indicating gap
|
||||||
// seek += offset;
|
// seek += offset;
|
||||||
|
@ -258,15 +260,16 @@ bool dwgReader21::readFileHeader() {
|
||||||
|
|
||||||
DRW_DBG("\n*** dwgReader21: Processing Section Map ***\n");
|
DRW_DBG("\n*** dwgReader21: Processing Section Map ***\n");
|
||||||
duint8 *SectionsMapData = new duint8[SectionsMapSizeUncompressed];
|
duint8 *SectionsMapData = new duint8[SectionsMapSizeUncompressed];
|
||||||
dwgPageInfo sectionMap = sectionPageMapTmp[SectionsMapId];
|
dwgPageInfo sectionMap = sectionPageMapTmp[static_cast<duint32>(SectionsMapId)];
|
||||||
ret = parseSysPage(SectionsMapSizeCompressed, SectionsMapSizeUncompressed, SectionsMapCorrectionFactor, sectionMap.address, SectionsMapData);
|
ret = parseSysPage(SectionsMapSizeCompressed, SectionsMapSizeUncompressed, SectionsMapCorrectionFactor,
|
||||||
|
sectionMap.address, SectionsMapData);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//reads sections:
|
//reads sections:
|
||||||
//Note: compressed value are not stored in file then, commpresed field are use to store
|
//Note: compressed value are not stored in file then, commpresed field are use to store
|
||||||
// encoding value
|
// encoding value
|
||||||
dwgBuffer SectionsMapBuf(SectionsMapData, SectionsMapSizeUncompressed, &decoder);
|
dwgBuffer SectionsMapBuf(SectionsMapData, static_cast<int>(SectionsMapSizeUncompressed), &decoder);
|
||||||
duint8 nextId =1;
|
duint8 nextId =1;
|
||||||
while(SectionsMapBuf.getPosition() < SectionsMapBuf.size()){
|
while(SectionsMapBuf.getPosition() < SectionsMapBuf.size()){
|
||||||
dwgSectionInfo secInfo;
|
dwgSectionInfo secInfo;
|
||||||
|
@ -274,28 +277,28 @@ bool dwgReader21::readFileHeader() {
|
||||||
DRW_DBG("\nSize of section (data size)= "); DRW_DBGH(secInfo.size);
|
DRW_DBG("\nSize of section (data size)= "); DRW_DBGH(secInfo.size);
|
||||||
secInfo.maxSize = SectionsMapBuf.getRawLong64();
|
secInfo.maxSize = SectionsMapBuf.getRawLong64();
|
||||||
DRW_DBG("\nMax Decompressed Size= "); DRW_DBGH(secInfo.maxSize);
|
DRW_DBG("\nMax Decompressed Size= "); DRW_DBGH(secInfo.maxSize);
|
||||||
secInfo.encrypted = SectionsMapBuf.getRawLong64();
|
secInfo.encrypted = static_cast<duint32>(SectionsMapBuf.getRawLong64());
|
||||||
//encrypted (doc: 0 no, 1 yes, 2 unkn) on read: objects 0 and encrypted yes
|
//encrypted (doc: 0 no, 1 yes, 2 unkn) on read: objects 0 and encrypted yes
|
||||||
DRW_DBG("\nencription= "); DRW_DBGH(secInfo.encrypted);
|
DRW_DBG("\nencription= "); DRW_DBGH(secInfo.encrypted);
|
||||||
DRW_DBG("\nHashCode = "); DRW_DBGH(SectionsMapBuf.getRawLong64());
|
DRW_DBG("\nHashCode = "); DRW_DBGH(SectionsMapBuf.getRawLong64());
|
||||||
duint64 SectionNameLength = SectionsMapBuf.getRawLong64();
|
duint64 SectionNameLength = SectionsMapBuf.getRawLong64();
|
||||||
DRW_DBG("\nSectionNameLength = "); DRW_DBG(SectionNameLength);
|
DRW_DBG("\nSectionNameLength = "); DRW_DBG(SectionNameLength);
|
||||||
DRW_DBG("\nUnknown = "); DRW_DBGH(SectionsMapBuf.getRawLong64());
|
DRW_DBG("\nUnknown = "); DRW_DBGH(SectionsMapBuf.getRawLong64());
|
||||||
secInfo.compresed = SectionsMapBuf.getRawLong64();
|
secInfo.compresed = static_cast<duint32>(SectionsMapBuf.getRawLong64());
|
||||||
DRW_DBG("\nEncoding (compresed) = "); DRW_DBGH(secInfo.compresed);
|
DRW_DBG("\nEncoding (compresed) = "); DRW_DBGH(secInfo.compresed);
|
||||||
secInfo.pageCount = SectionsMapBuf.getRawLong64();
|
secInfo.pageCount = SectionsMapBuf.getRawLong64();
|
||||||
DRW_DBG("\nPage count= "); DRW_DBGH(secInfo.pageCount);
|
DRW_DBG("\nPage count= "); DRW_DBGH(secInfo.pageCount);
|
||||||
secInfo.name = SectionsMapBuf.getUCSStr(SectionNameLength);
|
secInfo.name = SectionsMapBuf.getUCSStr(static_cast<duint16>(SectionNameLength));
|
||||||
DRW_DBG("\nSection name = "); DRW_DBG(secInfo.name); DRW_DBG("\n");
|
DRW_DBG("\nSection name = "); DRW_DBG(secInfo.name); DRW_DBG("\n");
|
||||||
|
|
||||||
for (unsigned int i=0; i< secInfo.pageCount; i++){
|
for (unsigned int i=0; i< secInfo.pageCount; i++){
|
||||||
duint64 po = SectionsMapBuf.getRawLong64();
|
duint64 po = SectionsMapBuf.getRawLong64();
|
||||||
duint32 ds = SectionsMapBuf.getRawLong64();
|
duint32 ds = static_cast<duint32>(SectionsMapBuf.getRawLong64());
|
||||||
duint32 pn = SectionsMapBuf.getRawLong64();
|
duint32 pn = static_cast<duint32>(SectionsMapBuf.getRawLong64());
|
||||||
DRW_DBG(" pag Id = "); DRW_DBGH(pn); DRW_DBG(" data size = "); DRW_DBGH(ds);
|
DRW_DBG(" pag Id = "); DRW_DBGH(pn); DRW_DBG(" data size = "); DRW_DBGH(ds);
|
||||||
dwgPageInfo pi = sectionPageMapTmp[pn]; //get a copy
|
dwgPageInfo pi = sectionPageMapTmp[pn]; //get a copy
|
||||||
pi.dataSize = ds;
|
pi.dataSize = ds;
|
||||||
pi.startOffset = po;
|
pi.startOffset = static_cast<duint32>(po);
|
||||||
pi.uSize = SectionsMapBuf.getRawLong64();
|
pi.uSize = SectionsMapBuf.getRawLong64();
|
||||||
pi.cSize = SectionsMapBuf.getRawLong64();
|
pi.cSize = SectionsMapBuf.getRawLong64();
|
||||||
secInfo.pages[pn]= pi;//complete copy in secInfo
|
secInfo.pages[pn]= pi;//complete copy in secInfo
|
||||||
|
@ -339,8 +342,8 @@ bool dwgReader21::readDwgHeader(DRW_Header& hdr){
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwgBuffer dataBuf(tmpHeaderData, si.size, &decoder);
|
dwgBuffer dataBuf(tmpHeaderData, static_cast<int>(si.size), &decoder);
|
||||||
dwgBuffer handleBuf(tmpHeaderData, si.size, &decoder);
|
dwgBuffer handleBuf(tmpHeaderData, static_cast<int>(si.size), &decoder);
|
||||||
DRW_DBG("Header section sentinel= ");
|
DRW_DBG("Header section sentinel= ");
|
||||||
checkSentinel(&dataBuf, secEnum::HEADER, true);
|
checkSentinel(&dataBuf, secEnum::HEADER, true);
|
||||||
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &handleBuf);
|
ret = dwgReader::readDwgHeader(hdr, &dataBuf, &handleBuf);
|
||||||
|
@ -360,7 +363,7 @@ bool dwgReader21::readDwgClasses(){
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dwgBuffer buff(tmpClassesData, si.size, &decoder);
|
dwgBuffer buff(tmpClassesData, static_cast<int>(si.size), &decoder);
|
||||||
DRW_DBG("classes section sentinel= ");
|
DRW_DBG("classes section sentinel= ");
|
||||||
checkSentinel(&buff, secEnum::CLASSES, true);
|
checkSentinel(&buff, secEnum::CLASSES, true);
|
||||||
|
|
||||||
|
@ -378,7 +381,7 @@ bool dwgReader21::readDwgClasses(){
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
//prepare string stream
|
//prepare string stream
|
||||||
dwgBuffer strBuff(tmpClassesData, si.size, &decoder);
|
dwgBuffer strBuff(tmpClassesData, static_cast<int>(si.size), &decoder);
|
||||||
duint32 strStartPos = bitSize + 159;//size in bits + 20 bytes (sn+size) - 1 bit (endbit)
|
duint32 strStartPos = bitSize + 159;//size in bits + 20 bytes (sn+size) - 1 bit (endbit)
|
||||||
DRW_DBG("\nstrStartPos: "); DRW_DBG(strStartPos);
|
DRW_DBG("\nstrStartPos: "); DRW_DBG(strStartPos);
|
||||||
strBuff.setPosition(strStartPos >> 3);
|
strBuff.setPosition(strStartPos >> 3);
|
||||||
|
@ -444,9 +447,9 @@ bool dwgReader21::readDwgHandles(){
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dwgBuffer dataBuf(tmpHandlesData, si.size, &decoder);
|
dwgBuffer dataBuf(tmpHandlesData, static_cast<int>(si.size), &decoder);
|
||||||
|
|
||||||
ret = dwgReader::readDwgHandles(&dataBuf, 0, si.size);
|
ret = dwgReader::readDwgHandles(&dataBuf, 0, static_cast<duint32>(si.size));
|
||||||
delete[]tmpHandlesData;
|
delete[]tmpHandlesData;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +473,7 @@ bool dwgReader21::readDwgTables(DRW_Header& hdr) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
DRW_DBG("readDwgTables total data size= "); DRW_DBG(dataSize); DRW_DBG("\n");
|
DRW_DBG("readDwgTables total data size= "); DRW_DBG(dataSize); DRW_DBG("\n");
|
||||||
dwgBuffer dataBuf(objData, dataSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(dataSize), &decoder);
|
||||||
ret = dwgReader::readDwgTables(hdr, &dataBuf);
|
ret = dwgReader::readDwgTables(hdr, &dataBuf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -479,7 +482,7 @@ bool dwgReader21::readDwgTables(DRW_Header& hdr) {
|
||||||
|
|
||||||
bool dwgReader21::readDwgBlocks(DRW_Interface& intfa){
|
bool dwgReader21::readDwgBlocks(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, dataSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(dataSize), &decoder);
|
||||||
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,14 @@
|
||||||
//reader for AC1021 aka v2007, chapter 5
|
//reader for AC1021 aka v2007, chapter 5
|
||||||
class dwgReader21 : public dwgReader {
|
class dwgReader21 : public dwgReader {
|
||||||
public:
|
public:
|
||||||
dwgReader21(std::istream *stream, dwgR *p):dwgReader(stream, p){
|
dwgReader21(std::istream *stream, dwgR *p)
|
||||||
objData = NULL;
|
: dwgReader(stream, p),
|
||||||
dataSize = 0;
|
objData(nullptr),
|
||||||
}
|
dataSize(0)
|
||||||
|
{}
|
||||||
|
|
||||||
virtual ~dwgReader21(){
|
virtual ~dwgReader21(){
|
||||||
if (objData != NULL)
|
if (objData != nullptr)
|
||||||
delete[] objData;
|
delete[] objData;
|
||||||
}
|
}
|
||||||
bool readMetaData();
|
bool readMetaData();
|
||||||
|
@ -39,13 +41,13 @@ public:
|
||||||
bool readDwgBlocks(DRW_Interface& intfa);
|
bool readDwgBlocks(DRW_Interface& intfa);
|
||||||
virtual bool readDwgEntities(DRW_Interface& intfa){
|
virtual bool readDwgEntities(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, dataSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(dataSize), &decoder);
|
||||||
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgObjects(DRW_Interface& intfa){
|
virtual bool readDwgObjects(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, dataSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(dataSize), &decoder);
|
||||||
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +56,9 @@ public:
|
||||||
//}
|
//}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool parseSysPage(duint64 sizeCompressed, duint64 sizeUncompressed, duint64 correctionFactor, duint64 offset, duint8 *decompData);
|
Q_DISABLE_COPY(dwgReader21)
|
||||||
|
bool parseSysPage(duint64 sizeCompressed, duint64 sizeUncompressed, duint64 correctionFactor, duint64 offset,
|
||||||
|
duint8 *decompData);
|
||||||
bool parseDataPage(dwgSectionInfo si, duint8 *dData);
|
bool parseDataPage(dwgSectionInfo si, duint8 *dData);
|
||||||
|
|
||||||
duint8 *objData;
|
duint8 *objData;
|
||||||
|
|
|
@ -30,19 +30,19 @@ public:
|
||||||
// bool readDwgTables(){return false;}
|
// bool readDwgTables(){return false;}
|
||||||
bool readDwgBlocks(DRW_Interface& intfa){
|
bool readDwgBlocks(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgEntities(DRW_Interface& intfa){
|
virtual bool readDwgEntities(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgObjects(DRW_Interface& intfa){
|
virtual bool readDwgObjects(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,19 +30,19 @@ public:
|
||||||
// bool readDwgTables(){return false;}
|
// bool readDwgTables(){return false;}
|
||||||
bool readDwgBlocks(DRW_Interface& intfa){
|
bool readDwgBlocks(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
ret = dwgReader::readDwgBlocks(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgEntities(DRW_Interface& intfa){
|
virtual bool readDwgEntities(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
ret = dwgReader::readDwgEntities(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
virtual bool readDwgObjects(DRW_Interface& intfa){
|
virtual bool readDwgObjects(DRW_Interface& intfa){
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
dwgBuffer dataBuf(objData, uncompSize, &decoder);
|
dwgBuffer dataBuf(objData, static_cast<int>(uncompSize), &decoder);
|
||||||
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
ret = dwgReader::readDwgObjects(intfa, &dataBuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,9 +219,9 @@ void dwgCompressor::decompress18(duint8 *cbuf, duint8 *dbuf, duint32 csize, duin
|
||||||
|
|
||||||
|
|
||||||
void dwgCompressor::decrypt18Hdr(duint8 *buf, duint32 size, duint32 offset){
|
void dwgCompressor::decrypt18Hdr(duint8 *buf, duint32 size, duint32 offset){
|
||||||
duint8 max = size / 4;
|
duint8 max = static_cast<duint8>(size / 4);
|
||||||
duint32 secMask = 0x4164536b ^ offset;
|
duint32 secMask = 0x4164536b ^ offset;
|
||||||
duint32* pHdr = (duint32*)buf;
|
duint32* pHdr = reinterpret_cast<duint32*>(buf);
|
||||||
for (duint8 j = 0; j < max; j++)
|
for (duint8 j = 0; j < max; j++)
|
||||||
*pHdr++ ^= secMask;
|
*pHdr++ ^= secMask;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ duint32 dwgCompressor::litLength21(duint8 *cbuf, duint8 oc, duint32 *si){
|
||||||
if (n == 0xff) {
|
if (n == 0xff) {
|
||||||
do {
|
do {
|
||||||
n = cbuf[srcIndex++];
|
n = cbuf[srcIndex++];
|
||||||
n |= (duint32)(cbuf[srcIndex++] << 8);
|
n |= static_cast<duint32>(cbuf[srcIndex++] << 8);
|
||||||
length += n;
|
length += n;
|
||||||
} while (n == 0xffff);
|
} while (n == 0xffff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,16 @@ public:
|
||||||
|
|
||||||
class dwgCompressor {
|
class dwgCompressor {
|
||||||
public:
|
public:
|
||||||
dwgCompressor(){}
|
dwgCompressor()
|
||||||
~dwgCompressor(){}
|
: bufC(),
|
||||||
|
bufD(),
|
||||||
|
sizeC(),
|
||||||
|
sizeD(),
|
||||||
|
pos(),
|
||||||
|
rpos()
|
||||||
|
{}
|
||||||
|
|
||||||
|
~dwgCompressor() = default;
|
||||||
|
|
||||||
void decompress18(duint8 *cbuf, duint8 *dbuf, duint32 csize, duint32 dsize);
|
void decompress18(duint8 *cbuf, duint8 *dbuf, duint32 csize, duint32 dsize);
|
||||||
static void decrypt18Hdr(duint8 *buf, duint32 size, duint32 offset);
|
static void decrypt18Hdr(duint8 *buf, duint32 size, duint32 offset);
|
||||||
|
|
|
@ -105,13 +105,13 @@ bool dxfReaderBinary::readCode(int *code) {
|
||||||
unsigned short *int16p;
|
unsigned short *int16p;
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
filestr->read(buffer,2);
|
filestr->read(buffer,2);
|
||||||
int16p = (unsigned short *) buffer;
|
int16p = reinterpret_cast<unsigned short *>(buffer);
|
||||||
//exist a 32bits int (code 90) with 2 bytes???
|
//exist a 32bits int (code 90) with 2 bytes???
|
||||||
if ((*code == 90) && (*int16p>2000)){
|
if ((*code == 90) && (*int16p>2000)){
|
||||||
DRW_DBG(*code); DRW_DBG(" de 16bits\n");
|
DRW_DBG(*code); DRW_DBG(" de 16bits\n");
|
||||||
filestr->seekg(-4, std::ios_base::cur);
|
filestr->seekg(-4, std::ios_base::cur);
|
||||||
filestr->read(buffer,2);
|
filestr->read(buffer,2);
|
||||||
int16p = (unsigned short *) buffer;
|
int16p = reinterpret_cast<unsigned short *>(buffer);
|
||||||
}
|
}
|
||||||
*code = *int16p;
|
*code = *int16p;
|
||||||
DRW_DBG(*code); DRW_DBG("\n");
|
DRW_DBG(*code); DRW_DBG("\n");
|
||||||
|
@ -137,7 +137,7 @@ bool dxfReaderBinary::readInt16() {
|
||||||
type = INT32;
|
type = INT32;
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
filestr->read(buffer,2);
|
filestr->read(buffer,2);
|
||||||
intData = (int)((buffer[1] << 8) | buffer[0]);
|
intData = static_cast<int>((buffer[1] << 8) | buffer[0]);
|
||||||
DRW_DBG(intData); DRW_DBG("\n");
|
DRW_DBG(intData); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ bool dxfReaderBinary::readInt32() {
|
||||||
unsigned int *int32p;
|
unsigned int *int32p;
|
||||||
char buffer[4];
|
char buffer[4];
|
||||||
filestr->read(buffer,4);
|
filestr->read(buffer,4);
|
||||||
int32p = (unsigned int *) buffer;
|
int32p = reinterpret_cast<unsigned int *>(buffer);
|
||||||
intData = *int32p;
|
intData = *int32p;
|
||||||
DRW_DBG(intData); DRW_DBG("\n");
|
DRW_DBG(intData); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
|
@ -158,7 +158,7 @@ bool dxfReaderBinary::readInt64() {
|
||||||
unsigned long long int *int64p; //64 bits integer pointer
|
unsigned long long int *int64p; //64 bits integer pointer
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
filestr->read(buffer,8);
|
filestr->read(buffer,8);
|
||||||
int64p = (unsigned long long int *) buffer;
|
int64p = reinterpret_cast<unsigned long long int *>(buffer);
|
||||||
int64 = *int64p;
|
int64 = *int64p;
|
||||||
DRW_DBG(int64); DRW_DBG(" int64\n");
|
DRW_DBG(int64); DRW_DBG(" int64\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
|
@ -169,7 +169,7 @@ bool dxfReaderBinary::readDouble() {
|
||||||
double *result;
|
double *result;
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
filestr->read(buffer,8);
|
filestr->read(buffer,8);
|
||||||
result = (double *) buffer;
|
result = reinterpret_cast<double *>(buffer);
|
||||||
doubleData = *result;
|
doubleData = *result;
|
||||||
DRW_DBG(doubleData); DRW_DBG("\n");
|
DRW_DBG(doubleData); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
|
@ -179,7 +179,7 @@ bool dxfReaderBinary::readDouble() {
|
||||||
bool dxfReaderBinary::readBool() {
|
bool dxfReaderBinary::readBool() {
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
filestr->read(buffer,1);
|
filestr->read(buffer,1);
|
||||||
intData = (int)(buffer[0]);
|
intData = static_cast<int>(buffer[0]);
|
||||||
DRW_DBG(intData); DRW_DBG("\n");
|
DRW_DBG(intData); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,18 @@ public:
|
||||||
};
|
};
|
||||||
enum TYPE type;
|
enum TYPE type;
|
||||||
public:
|
public:
|
||||||
dxfReader(std::istream *stream){
|
dxfReader(std::istream *stream)
|
||||||
filestr = stream;
|
: type(INVALID),
|
||||||
type = INVALID;
|
filestr(stream),
|
||||||
}
|
strData(),
|
||||||
virtual ~dxfReader(){}
|
doubleData(),
|
||||||
|
intData(),
|
||||||
|
int64(),
|
||||||
|
skip(),
|
||||||
|
decoder()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~dxfReader() = default;
|
||||||
bool readRec(int *code);
|
bool readRec(int *code);
|
||||||
|
|
||||||
std::string getString() {return strData;}
|
std::string getString() {return strData;}
|
||||||
|
@ -65,6 +72,7 @@ protected:
|
||||||
unsigned long long int int64; //64 bits integer
|
unsigned long long int int64; //64 bits integer
|
||||||
bool skip; //set to true for ascii dxf, false for binary
|
bool skip; //set to true for ascii dxf, false for binary
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dxfReader)
|
||||||
DRW_TextCodec decoder;
|
DRW_TextCodec decoder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ bool dxfWriter::writeUtf8Caps(int code, std::string text) {
|
||||||
|
|
||||||
bool dxfWriterBinary::writeString(int code, std::string text) {
|
bool dxfWriterBinary::writeString(int code, std::string text) {
|
||||||
char bufcode[2];
|
char bufcode[2];
|
||||||
bufcode[0] =code & 0xFF;
|
bufcode[0] = static_cast<char>(code & 0xFF);
|
||||||
bufcode[1] =code >> 8;
|
bufcode[1] = static_cast<char>(code >> 8);
|
||||||
filestr->write(bufcode, 2);
|
filestr->write(bufcode, 2);
|
||||||
*filestr << text << '\0';
|
*filestr << text << '\0';
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
|
@ -145,10 +145,10 @@ bool dxfWriterBinary::writeString(int code, std::string text) {
|
||||||
bool dxfWriterBinary::writeInt16(int code, int data) {
|
bool dxfWriterBinary::writeInt16(int code, int data) {
|
||||||
char bufcode[2];
|
char bufcode[2];
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
bufcode[0] =code & 0xFF;
|
bufcode[0] = static_cast<char>(code & 0xFF);
|
||||||
bufcode[1] =code >> 8;
|
bufcode[1] = static_cast<char>(code >> 8);
|
||||||
buffer[0] =data & 0xFF;
|
buffer[0] = static_cast<char>(data & 0xFF);
|
||||||
buffer[1] =data >> 8;
|
buffer[1] = static_cast<char>(data >> 8);
|
||||||
filestr->write(bufcode, 2);
|
filestr->write(bufcode, 2);
|
||||||
filestr->write(buffer, 2);
|
filestr->write(buffer, 2);
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
|
@ -156,32 +156,32 @@ bool dxfWriterBinary::writeInt16(int code, int data) {
|
||||||
|
|
||||||
bool dxfWriterBinary::writeInt32(int code, int data) {
|
bool dxfWriterBinary::writeInt32(int code, int data) {
|
||||||
char buffer[4];
|
char buffer[4];
|
||||||
buffer[0] =code & 0xFF;
|
buffer[0] = static_cast<char>(code & 0xFF);
|
||||||
buffer[1] =code >> 8;
|
buffer[1] = static_cast<char>(code >> 8);
|
||||||
filestr->write(buffer, 2);
|
filestr->write(buffer, 2);
|
||||||
|
|
||||||
buffer[0] =data & 0xFF;
|
buffer[0] = static_cast<char>(data & 0xFF);
|
||||||
buffer[1] =data >> 8;
|
buffer[1] = static_cast<char>(data >> 8);
|
||||||
buffer[2] =data >> 16;
|
buffer[2] = static_cast<char>(data >> 16);
|
||||||
buffer[3] =data >> 24;
|
buffer[3] = static_cast<char>(data >> 24);
|
||||||
filestr->write(buffer, 4);
|
filestr->write(buffer, 4);
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfWriterBinary::writeInt64(int code, unsigned long long int data) {
|
bool dxfWriterBinary::writeInt64(int code, unsigned long long int data) {
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
buffer[0] =code & 0xFF;
|
buffer[0] = static_cast<char>(code & 0xFF);
|
||||||
buffer[1] =code >> 8;
|
buffer[1] = static_cast<char>(code >> 8);
|
||||||
filestr->write(buffer, 2);
|
filestr->write(buffer, 2);
|
||||||
|
|
||||||
buffer[0] =data & 0xFF;
|
buffer[0] = static_cast<char>(data & 0xFF);
|
||||||
buffer[1] =data >> 8;
|
buffer[1] = static_cast<char>(data >> 8);
|
||||||
buffer[2] =data >> 16;
|
buffer[2] = static_cast<char>(data >> 16);
|
||||||
buffer[3] =data >> 24;
|
buffer[3] = static_cast<char>(data >> 24);
|
||||||
buffer[4] =data >> 32;
|
buffer[4] = static_cast<char>(data >> 32);
|
||||||
buffer[5] =data >> 40;
|
buffer[5] = static_cast<char>(data >> 40);
|
||||||
buffer[6] =data >> 48;
|
buffer[6] = static_cast<char>(data >> 48);
|
||||||
buffer[7] =data >> 56;
|
buffer[7] = static_cast<char>(data >> 56);
|
||||||
filestr->write(buffer, 8);
|
filestr->write(buffer, 8);
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
@ -189,12 +189,12 @@ bool dxfWriterBinary::writeInt64(int code, unsigned long long int data) {
|
||||||
bool dxfWriterBinary::writeDouble(int code, double data) {
|
bool dxfWriterBinary::writeDouble(int code, double data) {
|
||||||
char bufcode[2];
|
char bufcode[2];
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
bufcode[0] =code & 0xFF;
|
bufcode[0] = static_cast<char>(code & 0xFF);
|
||||||
bufcode[1] =code >> 8;
|
bufcode[1] = static_cast<char>(code >> 8);
|
||||||
filestr->write(bufcode, 2);
|
filestr->write(bufcode, 2);
|
||||||
|
|
||||||
unsigned char *val;
|
unsigned char *val;
|
||||||
val = (unsigned char *) &data;
|
val = reinterpret_cast<unsigned char *>(&data);
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
buffer[i] =val[i];
|
buffer[i] =val[i];
|
||||||
}
|
}
|
||||||
|
@ -206,8 +206,8 @@ bool dxfWriterBinary::writeDouble(int code, double data) {
|
||||||
bool dxfWriterBinary::writeBool(int code, bool data) {
|
bool dxfWriterBinary::writeBool(int code, bool data) {
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
char bufcode[2];
|
char bufcode[2];
|
||||||
bufcode[0] =code & 0xFF;
|
bufcode[0] = static_cast<char>(code & 0xFF);
|
||||||
bufcode[1] =code >> 8;
|
bufcode[1] = static_cast<char>(code >> 8);
|
||||||
filestr->write(bufcode, 2);
|
filestr->write(bufcode, 2);
|
||||||
buffer[0] = data;
|
buffer[0] = data;
|
||||||
filestr->write(buffer, 1);
|
filestr->write(buffer, 1);
|
||||||
|
|
|
@ -17,8 +17,12 @@
|
||||||
|
|
||||||
class dxfWriter {
|
class dxfWriter {
|
||||||
public:
|
public:
|
||||||
dxfWriter(std::ofstream *stream){filestr = stream; /*count =0;*/}
|
dxfWriter(std::ofstream *stream)
|
||||||
virtual ~dxfWriter(){}
|
: filestr(stream),
|
||||||
|
encoder()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~dxfWriter() = default;
|
||||||
virtual bool writeString(int code, std::string text) = 0;
|
virtual bool writeString(int code, std::string text) = 0;
|
||||||
bool writeUtf8String(int code, std::string text);
|
bool writeUtf8String(int code, std::string text);
|
||||||
bool writeUtf8Caps(int code, std::string text);
|
bool writeUtf8Caps(int code, std::string text);
|
||||||
|
@ -34,6 +38,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
std::ofstream *filestr;
|
std::ofstream *filestr;
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dxfWriter)
|
||||||
DRW_TextCodec encoder;
|
DRW_TextCodec encoder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,20 +29,19 @@
|
||||||
#include <new> // std::nothrow
|
#include <new> // std::nothrow
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
RScodec::RScodec(unsigned int pp, int mm, int tt) {
|
RScodec::RScodec(unsigned int pp, int mm, int tt)
|
||||||
this->mm = mm;
|
: mm(mm),
|
||||||
this->tt = tt;
|
tt(tt),
|
||||||
nn = (1<<mm) -1; //mm==8 nn=255
|
nn((1<<mm) -1), //mm==8 nn=255
|
||||||
kk = nn -(tt*2);
|
kk(nn -(tt*2)),
|
||||||
isOk = true;
|
gg(new (std::nothrow) int[nn-kk+1]),
|
||||||
|
isOk(true),
|
||||||
alpha_to = new (std::nothrow) int[nn+1];
|
index_of(new (std::nothrow) unsigned int[nn+1]),
|
||||||
index_of = new (std::nothrow) unsigned int[nn+1];
|
alpha_to(new (std::nothrow) int[nn+1])
|
||||||
gg = new (std::nothrow) int[nn-kk+1];
|
{
|
||||||
|
RSgenerate_gf(pp);
|
||||||
RSgenerate_gf(pp) ;
|
|
||||||
/* compute the generator polynomial for this RS code */
|
/* compute the generator polynomial for this RS code */
|
||||||
RSgen_poly() ;
|
RSgen_poly();
|
||||||
}
|
}
|
||||||
|
|
||||||
RScodec::~RScodec() {
|
RScodec::~RScodec() {
|
||||||
|
@ -304,7 +303,7 @@ int RScodec::calcDecode(unsigned char* data, int* recd, int** elp, int* d, int*
|
||||||
}
|
}
|
||||||
q = q % nn;
|
q = q % nn;
|
||||||
err[loc[i]] = alpha_to[(err[loc[i]] - q + nn) % nn];
|
err[loc[i]] = alpha_to[(err[loc[i]] - q + nn) % nn];
|
||||||
data[loc[i]] ^= err[loc[i]]; /*change errors by correct data, in polynomial form */
|
data[loc[i]] ^= static_cast<unsigned char>(err[loc[i]]);/*change errors by correct data, in polynomial form */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -330,10 +329,10 @@ bool RScodec::encode(unsigned char *data, unsigned char *parity) {
|
||||||
if (feedback != -1) {
|
if (feedback != -1) {
|
||||||
for (j=bb-1; j>0; j--)
|
for (j=bb-1; j>0; j--)
|
||||||
if (gg[j] != -1)
|
if (gg[j] != -1)
|
||||||
bd[j] = bd[j-1]^alpha_to[(gg[j]+feedback)%nn] ;
|
bd[j] = static_cast<unsigned char>(bd[j-1]^alpha_to[(gg[j]+feedback)%nn]);
|
||||||
else
|
else
|
||||||
bd[j] = bd[j-1] ;
|
bd[j] = bd[j-1] ;
|
||||||
bd[0] = alpha_to[(gg[0]+feedback)%nn] ;
|
bd[0] = static_cast<unsigned char>(alpha_to[(gg[0]+feedback)%nn]);
|
||||||
} else {
|
} else {
|
||||||
for (j=bb-1; j>0; j--)
|
for (j=bb-1; j>0; j--)
|
||||||
bd[j] = bd[j-1] ;
|
bd[j] = bd[j-1] ;
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
#ifndef RSCODEC_H
|
#ifndef RSCODEC_H
|
||||||
#define RSCODEC_H
|
#define RSCODEC_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
mm: RS code over GF(2^4)
|
mm: RS code over GF(2^4)
|
||||||
nn: nn= (2^mm) - 1 length of codeword
|
nn: nn= (2^mm) - 1 length of codeword
|
||||||
|
@ -55,6 +58,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(RScodec)
|
||||||
int mm; //RS code over GF(2^4)
|
int mm; //RS code over GF(2^4)
|
||||||
int tt; //number of errors that can be corrected
|
int tt; //number of errors that can be corrected
|
||||||
int nn; //(2^mm) - 1 length of codeword
|
int nn; //(2^mm) - 1 length of codeword
|
||||||
|
|
|
@ -35,17 +35,20 @@
|
||||||
secObjects
|
secObjects
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
dwgR::dwgR(){
|
dwgR::dwgR()
|
||||||
|
: version(DRW::UNKNOWNV),
|
||||||
|
error(DRW::BAD_NONE),
|
||||||
|
fileName(),
|
||||||
|
applyExt(false),
|
||||||
|
codePage(),
|
||||||
|
iface(),
|
||||||
|
reader(nullptr)
|
||||||
|
{
|
||||||
DRW_DBGSL(DRW_dbg::NONE);
|
DRW_DBGSL(DRW_dbg::NONE);
|
||||||
reader = NULL;
|
|
||||||
// writer = NULL;
|
|
||||||
applyExt = false;
|
|
||||||
version = DRW::UNKNOWNV;
|
|
||||||
error = DRW::BAD_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dwgR::~dwgR(){
|
dwgR::~dwgR(){
|
||||||
if (reader != NULL)
|
if (reader != nullptr)
|
||||||
delete reader;
|
delete reader;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,9 +77,9 @@ bool dwgR::getPreview(std::istream &stream){
|
||||||
} else
|
} else
|
||||||
error = DRW::BAD_READ_METADATA;
|
error = DRW::BAD_READ_METADATA;
|
||||||
|
|
||||||
if (reader != NULL) {
|
if (reader != nullptr) {
|
||||||
delete reader;
|
delete reader;
|
||||||
reader = NULL;
|
reader = nullptr;
|
||||||
}
|
}
|
||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +104,9 @@ bool dwgR::read(std::istream &stream, DRW_Interface *interface_, bool ext){
|
||||||
} else
|
} else
|
||||||
error = DRW::BAD_READ_METADATA;
|
error = DRW::BAD_READ_METADATA;
|
||||||
|
|
||||||
if (reader != NULL) {
|
if (reader != nullptr) {
|
||||||
delete reader;
|
delete reader;
|
||||||
reader = NULL;
|
reader = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isOk;
|
return isOk;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define LIBDWGR_H
|
#define LIBDWGR_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
//#include <deque>
|
#include <QtGlobal>
|
||||||
#include "drw_entities.h"
|
#include "drw_entities.h"
|
||||||
#include "drw_objects.h"
|
#include "drw_objects.h"
|
||||||
#include "drw_classes.h"
|
#include "drw_classes.h"
|
||||||
|
@ -37,6 +37,7 @@ private:
|
||||||
bool open(std::istream *stream);
|
bool open(std::istream *stream);
|
||||||
bool processDwg();
|
bool processDwg();
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dwgR)
|
||||||
DRW::Version version;
|
DRW::Version version;
|
||||||
DRW::error error;
|
DRW::error error;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
|
|
|
@ -32,18 +32,33 @@
|
||||||
secObjects
|
secObjects
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
dxfRW::dxfRW(const char* name){
|
dxfRW::dxfRW(const char* name)
|
||||||
|
: version(),
|
||||||
|
fileName(name),
|
||||||
|
codePage(),
|
||||||
|
binFile(),
|
||||||
|
reader(nullptr),
|
||||||
|
writer(nullptr),
|
||||||
|
iface(),
|
||||||
|
header(),
|
||||||
|
nextentity(),
|
||||||
|
entCount(),
|
||||||
|
wlayer0(),
|
||||||
|
dimstyleStd(),
|
||||||
|
applyExt(false),
|
||||||
|
writingBlock(),
|
||||||
|
elParts(128), //parts munber when convert ellipse to polyline
|
||||||
|
blockMap(),
|
||||||
|
imageDef(),
|
||||||
|
currHandle()
|
||||||
|
{
|
||||||
DRW_DBGSL(DRW_dbg::NONE);
|
DRW_DBGSL(DRW_dbg::NONE);
|
||||||
fileName = name;
|
|
||||||
reader = NULL;
|
|
||||||
writer = NULL;
|
|
||||||
applyExt = false;
|
|
||||||
elParts = 128; //parts munber when convert ellipse to polyline
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dxfRW::~dxfRW(){
|
dxfRW::~dxfRW(){
|
||||||
if (reader != NULL)
|
if (reader != nullptr)
|
||||||
delete reader;
|
delete reader;
|
||||||
if (writer != NULL)
|
if (writer != nullptr)
|
||||||
delete writer;
|
delete writer;
|
||||||
for (std::vector<DRW_ImageDef*>::iterator it=imageDef.begin(); it!=imageDef.end(); ++it)
|
for (std::vector<DRW_ImageDef*>::iterator it=imageDef.begin(); it!=imageDef.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
|
@ -66,7 +81,7 @@ bool dxfRW::read(DRW_Interface *interface_, bool ext){
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
applyExt = ext;
|
applyExt = ext;
|
||||||
std::ifstream filestr;
|
std::ifstream filestr;
|
||||||
if ( interface_ == NULL )
|
if ( interface_ == nullptr )
|
||||||
return isOk;
|
return isOk;
|
||||||
DRW_DBG("dxfRW::read 1def\n");
|
DRW_DBG("dxfRW::read 1def\n");
|
||||||
filestr.open (fileName.c_str(), std::ios_base::in | std::ios::binary);
|
filestr.open (fileName.c_str(), std::ios_base::in | std::ios::binary);
|
||||||
|
@ -77,7 +92,7 @@ bool dxfRW::read(DRW_Interface *interface_, bool ext){
|
||||||
|
|
||||||
char line[22];
|
char line[22];
|
||||||
char line2[22] = "AutoCAD Binary DXF\r\n";
|
char line2[22] = "AutoCAD Binary DXF\r\n";
|
||||||
line2[20] = (char)26;
|
line2[20] = static_cast<char>(26);
|
||||||
line2[21] = '\0';
|
line2[21] = '\0';
|
||||||
filestr.read (line, 22);
|
filestr.read (line, 22);
|
||||||
filestr.close();
|
filestr.close();
|
||||||
|
@ -99,7 +114,7 @@ bool dxfRW::read(DRW_Interface *interface_, bool ext){
|
||||||
isOk = processDxf();
|
isOk = processDxf();
|
||||||
filestr.close();
|
filestr.close();
|
||||||
delete reader;
|
delete reader;
|
||||||
reader = NULL;
|
reader = nullptr;
|
||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +127,7 @@ bool dxfRW::write(DRW_Interface *interface_, DRW::Version ver, bool bin){
|
||||||
if (binFile) {
|
if (binFile) {
|
||||||
filestr.open (fileName.c_str(), std::ios_base::out | std::ios::binary | std::ios::trunc);
|
filestr.open (fileName.c_str(), std::ios_base::out | std::ios::binary | std::ios::trunc);
|
||||||
//write sentinel
|
//write sentinel
|
||||||
filestr << "AutoCAD Binary DXF\r\n" << (char)26 << '\0';
|
filestr << "AutoCAD Binary DXF\r\n" << static_cast<char>(26) << '\0';
|
||||||
writer = new dxfWriterBinary(&filestr);
|
writer = new dxfWriterBinary(&filestr);
|
||||||
DRW_DBG("dxfRW::read binary file\n");
|
DRW_DBG("dxfRW::read binary file\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +172,7 @@ bool dxfRW::write(DRW_Interface *interface_, DRW::Version ver, bool bin){
|
||||||
filestr.close();
|
filestr.close();
|
||||||
isOk = true;
|
isOk = true;
|
||||||
delete writer;
|
delete writer;
|
||||||
writer = NULL;
|
writer = nullptr;
|
||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +545,7 @@ bool dxfRW::writePoint(DRW_Point *ent) {
|
||||||
}
|
}
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -544,7 +559,7 @@ bool dxfRW::writeLine(DRW_Line *ent) {
|
||||||
}
|
}
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0 || ent->secPoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z) || not qFuzzyIsNull(ent->secPoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
writer->writeDouble(11, ent->secPoint.x);
|
writer->writeDouble(11, ent->secPoint.x);
|
||||||
writer->writeDouble(21, ent->secPoint.y);
|
writer->writeDouble(21, ent->secPoint.y);
|
||||||
|
@ -566,7 +581,7 @@ bool dxfRW::writeRay(DRW_Ray *ent) {
|
||||||
crd.unitize();
|
crd.unitize();
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0 || ent->secPoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z) || not qFuzzyIsNull(ent->secPoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
writer->writeDouble(11, crd.x);
|
writer->writeDouble(11, crd.x);
|
||||||
writer->writeDouble(21, crd.y);
|
writer->writeDouble(21, crd.y);
|
||||||
|
@ -588,7 +603,7 @@ bool dxfRW::writeXline(DRW_Xline *ent) {
|
||||||
crd.unitize();
|
crd.unitize();
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0 || ent->secPoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z) || not qFuzzyIsNull(ent->secPoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
writer->writeDouble(11, crd.x);
|
writer->writeDouble(11, crd.x);
|
||||||
writer->writeDouble(21, crd.y);
|
writer->writeDouble(21, crd.y);
|
||||||
|
@ -608,7 +623,7 @@ bool dxfRW::writeCircle(DRW_Circle *ent) {
|
||||||
}
|
}
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
}
|
}
|
||||||
writer->writeDouble(40, ent->radious);
|
writer->writeDouble(40, ent->radious);
|
||||||
|
@ -623,7 +638,7 @@ bool dxfRW::writeArc(DRW_Arc *ent) {
|
||||||
}
|
}
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0) {
|
if (not qFuzzyIsNull(ent->basePoint.z)) {
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
}
|
}
|
||||||
writer->writeDouble(40, ent->radious);
|
writer->writeDouble(40, ent->radious);
|
||||||
|
@ -733,23 +748,23 @@ bool dxfRW::writeLWPolyline(DRW_LWPolyline *ent){
|
||||||
if (version > DRW::AC1009) {
|
if (version > DRW::AC1009) {
|
||||||
writer->writeString(100, "AcDbPolyline");
|
writer->writeString(100, "AcDbPolyline");
|
||||||
}
|
}
|
||||||
ent->vertexnum = (int)ent->vertlist.size();
|
ent->vertexnum = static_cast<int>(ent->vertlist.size());
|
||||||
writer->writeInt32(90, ent->vertexnum);
|
writer->writeInt32(90, ent->vertexnum);
|
||||||
writer->writeInt16(70, ent->flags);
|
writer->writeInt16(70, ent->flags);
|
||||||
writer->writeDouble(43, ent->width);
|
writer->writeDouble(43, ent->width);
|
||||||
if (ent->elevation != 0)
|
if (not qFuzzyIsNull(ent->elevation))
|
||||||
writer->writeDouble(38, ent->elevation);
|
writer->writeDouble(38, ent->elevation);
|
||||||
if (ent->thickness != 0)
|
if (not qFuzzyIsNull(ent->thickness))
|
||||||
writer->writeDouble(39, ent->thickness);
|
writer->writeDouble(39, ent->thickness);
|
||||||
for (int i = 0; i< ent->vertexnum; i++){
|
for (int i = 0; i< ent->vertexnum; i++){
|
||||||
DRW_Vertex2D *v = ent->vertlist.at(i);
|
DRW_Vertex2D *v = ent->vertlist.at(i);
|
||||||
writer->writeDouble(10, v->x);
|
writer->writeDouble(10, v->x);
|
||||||
writer->writeDouble(20, v->y);
|
writer->writeDouble(20, v->y);
|
||||||
if (v->stawidth != 0)
|
if (not qFuzzyIsNull(v->stawidth))
|
||||||
writer->writeDouble(40, v->stawidth);
|
writer->writeDouble(40, v->stawidth);
|
||||||
if (v->endwidth != 0)
|
if (not qFuzzyIsNull(v->endwidth))
|
||||||
writer->writeDouble(41, v->endwidth);
|
writer->writeDouble(41, v->endwidth);
|
||||||
if (v->bulge != 0)
|
if (not qFuzzyIsNull(v->bulge))
|
||||||
writer->writeDouble(42, v->bulge);
|
writer->writeDouble(42, v->bulge);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -774,14 +789,14 @@ bool dxfRW::writePolyline(DRW_Polyline *ent) {
|
||||||
writer->writeDouble(10, 0.0);
|
writer->writeDouble(10, 0.0);
|
||||||
writer->writeDouble(20, 0.0);
|
writer->writeDouble(20, 0.0);
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
if (ent->thickness != 0) {
|
if (not qFuzzyIsNull(ent->thickness)) {
|
||||||
writer->writeDouble(39, ent->thickness);
|
writer->writeDouble(39, ent->thickness);
|
||||||
}
|
}
|
||||||
writer->writeInt16(70, ent->flags);
|
writer->writeInt16(70, ent->flags);
|
||||||
if (ent->defstawidth != 0) {
|
if (not qFuzzyIsNull(ent->defstawidth)) {
|
||||||
writer->writeDouble(40, ent->defstawidth);
|
writer->writeDouble(40, ent->defstawidth);
|
||||||
}
|
}
|
||||||
if (ent->defendwidth != 0) {
|
if (not qFuzzyIsNull(ent->defendwidth)) {
|
||||||
writer->writeDouble(41, ent->defendwidth);
|
writer->writeDouble(41, ent->defendwidth);
|
||||||
}
|
}
|
||||||
if (ent->flags & 16 || ent->flags & 32) {
|
if (ent->flags & 16 || ent->flags & 32) {
|
||||||
|
@ -798,7 +813,7 @@ bool dxfRW::writePolyline(DRW_Polyline *ent) {
|
||||||
writer->writeInt16(75, ent->curvetype);
|
writer->writeInt16(75, ent->curvetype);
|
||||||
}
|
}
|
||||||
DRW_Coord crd = ent->extPoint;
|
DRW_Coord crd = ent->extPoint;
|
||||||
if (crd.x != 0 || crd.y != 0 || crd.z != 1) {
|
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not DRW_FuzzyComparePossibleNulls(crd.z, 1)) {
|
||||||
writer->writeDouble(210, crd.x);
|
writer->writeDouble(210, crd.x);
|
||||||
writer->writeDouble(220, crd.y);
|
writer->writeDouble(220, crd.y);
|
||||||
writer->writeDouble(230, crd.z);
|
writer->writeDouble(230, crd.z);
|
||||||
|
@ -827,11 +842,11 @@ bool dxfRW::writePolyline(DRW_Polyline *ent) {
|
||||||
writer->writeDouble(20, v->basePoint.y);
|
writer->writeDouble(20, v->basePoint.y);
|
||||||
writer->writeDouble(30, v->basePoint.z);
|
writer->writeDouble(30, v->basePoint.z);
|
||||||
}
|
}
|
||||||
if (v->stawidth != 0)
|
if (not qFuzzyIsNull(v->stawidth))
|
||||||
writer->writeDouble(40, v->stawidth);
|
writer->writeDouble(40, v->stawidth);
|
||||||
if (v->endwidth != 0)
|
if (not qFuzzyIsNull(v->endwidth))
|
||||||
writer->writeDouble(41, v->endwidth);
|
writer->writeDouble(41, v->endwidth);
|
||||||
if (v->bulge != 0)
|
if (not qFuzzyIsNull(v->bulge))
|
||||||
writer->writeDouble(42, v->bulge);
|
writer->writeDouble(42, v->bulge);
|
||||||
if (v->flags != 0) {
|
if (v->flags != 0) {
|
||||||
writer->writeInt16(70, ent->flags);
|
writer->writeInt16(70, ent->flags);
|
||||||
|
@ -883,7 +898,7 @@ bool dxfRW::writeSpline(DRW_Spline *ent){
|
||||||
for (int i = 0; i< ent->nknots; i++){
|
for (int i = 0; i< ent->nknots; i++){
|
||||||
writer->writeDouble(40, ent->knotslist.at(i));
|
writer->writeDouble(40, ent->knotslist.at(i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i< (int)ent->weightlist.size(); i++) {
|
for (int i = 0; i< static_cast<int>(ent->weightlist.size()); i++) {
|
||||||
writer->writeDouble(41, ent->weightlist.at(i));
|
writer->writeDouble(41, ent->weightlist.at(i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i< ent->ncontrol; i++){
|
for (int i = 0; i< ent->ncontrol; i++){
|
||||||
|
@ -912,7 +927,7 @@ bool dxfRW::writeHatch(DRW_Hatch *ent){
|
||||||
writer->writeString(2, ent->name);
|
writer->writeString(2, ent->name);
|
||||||
writer->writeInt16(70, ent->solid);
|
writer->writeInt16(70, ent->solid);
|
||||||
writer->writeInt16(71, ent->associative);
|
writer->writeInt16(71, ent->associative);
|
||||||
ent->loopsnum = (int)ent->looplist.size();
|
ent->loopsnum = static_cast<int>(ent->looplist.size());
|
||||||
writer->writeInt16(91, ent->loopsnum);
|
writer->writeInt16(91, ent->loopsnum);
|
||||||
//write paths data
|
//write paths data
|
||||||
for (int i = 0; i< ent->loopsnum; i++){
|
for (int i = 0; i< ent->loopsnum; i++){
|
||||||
|
@ -928,7 +943,7 @@ bool dxfRW::writeHatch(DRW_Hatch *ent){
|
||||||
switch ( (loop->objlist.at(j))->eType) {
|
switch ( (loop->objlist.at(j))->eType) {
|
||||||
case DRW::LINE: {
|
case DRW::LINE: {
|
||||||
writer->writeInt16(72, 1);
|
writer->writeInt16(72, 1);
|
||||||
DRW_Line* l = (DRW_Line*)loop->objlist.at(j);
|
DRW_Line* l = static_cast<DRW_Line*>(loop->objlist.at(j));
|
||||||
writer->writeDouble(10, l->basePoint.x);
|
writer->writeDouble(10, l->basePoint.x);
|
||||||
writer->writeDouble(20, l->basePoint.y);
|
writer->writeDouble(20, l->basePoint.y);
|
||||||
writer->writeDouble(11, l->secPoint.x);
|
writer->writeDouble(11, l->secPoint.x);
|
||||||
|
@ -936,7 +951,7 @@ bool dxfRW::writeHatch(DRW_Hatch *ent){
|
||||||
break; }
|
break; }
|
||||||
case DRW::ARC: {
|
case DRW::ARC: {
|
||||||
writer->writeInt16(72, 2);
|
writer->writeInt16(72, 2);
|
||||||
DRW_Arc* a = (DRW_Arc*)loop->objlist.at(j);
|
DRW_Arc* a = static_cast<DRW_Arc*>(loop->objlist.at(j));
|
||||||
writer->writeDouble(10, a->basePoint.x);
|
writer->writeDouble(10, a->basePoint.x);
|
||||||
writer->writeDouble(20, a->basePoint.y);
|
writer->writeDouble(20, a->basePoint.y);
|
||||||
writer->writeDouble(40, a->radious);
|
writer->writeDouble(40, a->radious);
|
||||||
|
@ -946,7 +961,7 @@ bool dxfRW::writeHatch(DRW_Hatch *ent){
|
||||||
break; }
|
break; }
|
||||||
case DRW::ELLIPSE: {
|
case DRW::ELLIPSE: {
|
||||||
writer->writeInt16(72, 3);
|
writer->writeInt16(72, 3);
|
||||||
DRW_Ellipse* a = (DRW_Ellipse*)loop->objlist.at(j);
|
DRW_Ellipse* a = static_cast<DRW_Ellipse*>(loop->objlist.at(j));
|
||||||
a->correctAxis();
|
a->correctAxis();
|
||||||
writer->writeDouble(10, a->basePoint.x);
|
writer->writeDouble(10, a->basePoint.x);
|
||||||
writer->writeDouble(20, a->basePoint.y);
|
writer->writeDouble(20, a->basePoint.y);
|
||||||
|
@ -1000,7 +1015,7 @@ bool dxfRW::writeLeader(DRW_Leader *ent){
|
||||||
writer->writeDouble(40, ent->textheight);
|
writer->writeDouble(40, ent->textheight);
|
||||||
writer->writeDouble(41, ent->textwidth);
|
writer->writeDouble(41, ent->textwidth);
|
||||||
writer->writeDouble(76, ent->vertnum);
|
writer->writeDouble(76, ent->vertnum);
|
||||||
writer->writeDouble(76, ent->vertexlist.size());
|
writer->writeDouble(76, static_cast<double>(ent->vertexlist.size()));
|
||||||
for (unsigned int i=0; i<ent->vertexlist.size(); i++) {
|
for (unsigned int i=0; i<ent->vertexlist.size(); i++) {
|
||||||
DRW_Coord *vert = ent->vertexlist.at(i);
|
DRW_Coord *vert = ent->vertexlist.at(i);
|
||||||
writer->writeDouble(10, vert->x);
|
writer->writeDouble(10, vert->x);
|
||||||
|
@ -1034,10 +1049,10 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeInt16(71, ent->getAlign());
|
writer->writeInt16(71, ent->getAlign());
|
||||||
if ( ent->getTextLineStyle() != 1)
|
if ( ent->getTextLineStyle() != 1)
|
||||||
writer->writeInt16(72, ent->getTextLineStyle());
|
writer->writeInt16(72, ent->getTextLineStyle());
|
||||||
if ( ent->getTextLineFactor() != 1)
|
if ( not DRW_FuzzyComparePossibleNulls(ent->getTextLineFactor(), 1))
|
||||||
writer->writeDouble(41, ent->getTextLineFactor());
|
writer->writeDouble(41, ent->getTextLineFactor());
|
||||||
writer->writeUtf8String(3, ent->getStyle());
|
writer->writeUtf8String(3, ent->getStyle());
|
||||||
if ( ent->getTextLineFactor() != 0)
|
if ( not qFuzzyIsNull(ent->getTextLineFactor()))
|
||||||
writer->writeDouble(53, ent->getDir());
|
writer->writeDouble(53, ent->getDir());
|
||||||
writer->writeDouble(210, ent->getExtrusion().x);
|
writer->writeDouble(210, ent->getExtrusion().x);
|
||||||
writer->writeDouble(220, ent->getExtrusion().y);
|
writer->writeDouble(220, ent->getExtrusion().y);
|
||||||
|
@ -1048,10 +1063,10 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
switch (ent->eType) {
|
switch (ent->eType) {
|
||||||
case DRW::DIMALIGNED:
|
case DRW::DIMALIGNED:
|
||||||
case DRW::DIMLINEAR: {
|
case DRW::DIMLINEAR: {
|
||||||
DRW_DimAligned * dd = (DRW_DimAligned*)ent;
|
DRW_DimAligned * dd = static_cast<DRW_DimAligned*>(ent);
|
||||||
writer->writeString(100, "AcDbAlignedDimension");
|
writer->writeString(100, "AcDbAlignedDimension");
|
||||||
DRW_Coord crd = dd->getClonepoint();
|
DRW_Coord crd = dd->getClonepoint();
|
||||||
if (crd.x != 0 || crd.y != 0 || crd.z != 0) {
|
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not qFuzzyIsNull(crd.z)) {
|
||||||
writer->writeDouble(12, crd.x);
|
writer->writeDouble(12, crd.x);
|
||||||
writer->writeDouble(22, crd.y);
|
writer->writeDouble(22, crd.y);
|
||||||
writer->writeDouble(32, crd.z);
|
writer->writeDouble(32, crd.z);
|
||||||
|
@ -1063,16 +1078,16 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeDouble(24, dd->getDef2Point().y);
|
writer->writeDouble(24, dd->getDef2Point().y);
|
||||||
writer->writeDouble(34, dd->getDef2Point().z);
|
writer->writeDouble(34, dd->getDef2Point().z);
|
||||||
if (ent->eType == DRW::DIMLINEAR) {
|
if (ent->eType == DRW::DIMLINEAR) {
|
||||||
DRW_DimLinear * dl = (DRW_DimLinear*)ent;
|
DRW_DimLinear * dl = static_cast<DRW_DimLinear*>(ent);
|
||||||
if (dl->getAngle() != 0)
|
if (not qFuzzyIsNull(dl->getAngle()))
|
||||||
writer->writeDouble(50, dl->getAngle());
|
writer->writeDouble(50, dl->getAngle());
|
||||||
if (dl->getOblique() != 0)
|
if (not qFuzzyIsNull(dl->getOblique()))
|
||||||
writer->writeDouble(52, dl->getOblique());
|
writer->writeDouble(52, dl->getOblique());
|
||||||
writer->writeString(100, "AcDbRotatedDimension");
|
writer->writeString(100, "AcDbRotatedDimension");
|
||||||
}
|
}
|
||||||
break; }
|
break; }
|
||||||
case DRW::DIMRADIAL: {
|
case DRW::DIMRADIAL: {
|
||||||
DRW_DimRadial * dd = (DRW_DimRadial*)ent;
|
DRW_DimRadial * dd = static_cast<DRW_DimRadial*>(ent);
|
||||||
writer->writeString(100, "AcDbRadialDimension");
|
writer->writeString(100, "AcDbRadialDimension");
|
||||||
writer->writeDouble(15, dd->getDiameterPoint().x);
|
writer->writeDouble(15, dd->getDiameterPoint().x);
|
||||||
writer->writeDouble(25, dd->getDiameterPoint().y);
|
writer->writeDouble(25, dd->getDiameterPoint().y);
|
||||||
|
@ -1080,7 +1095,7 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeDouble(40, dd->getLeaderLength());
|
writer->writeDouble(40, dd->getLeaderLength());
|
||||||
break; }
|
break; }
|
||||||
case DRW::DIMDIAMETRIC: {
|
case DRW::DIMDIAMETRIC: {
|
||||||
DRW_DimDiametric * dd = (DRW_DimDiametric*)ent;
|
DRW_DimDiametric * dd = static_cast<DRW_DimDiametric*>(ent);
|
||||||
writer->writeString(100, "AcDbDiametricDimension");
|
writer->writeString(100, "AcDbDiametricDimension");
|
||||||
writer->writeDouble(15, dd->getDiameter1Point().x);
|
writer->writeDouble(15, dd->getDiameter1Point().x);
|
||||||
writer->writeDouble(25, dd->getDiameter1Point().y);
|
writer->writeDouble(25, dd->getDiameter1Point().y);
|
||||||
|
@ -1088,7 +1103,7 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeDouble(40, dd->getLeaderLength());
|
writer->writeDouble(40, dd->getLeaderLength());
|
||||||
break; }
|
break; }
|
||||||
case DRW::DIMANGULAR: {
|
case DRW::DIMANGULAR: {
|
||||||
DRW_DimAngular * dd = (DRW_DimAngular*)ent;
|
DRW_DimAngular * dd = static_cast<DRW_DimAngular*>(ent);
|
||||||
writer->writeString(100, "AcDb2LineAngularDimension");
|
writer->writeString(100, "AcDb2LineAngularDimension");
|
||||||
writer->writeDouble(13, dd->getFirstLine1().x);
|
writer->writeDouble(13, dd->getFirstLine1().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine1().y);
|
writer->writeDouble(23, dd->getFirstLine1().y);
|
||||||
|
@ -1104,7 +1119,7 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeDouble(36, dd->getDimPoint().z);
|
writer->writeDouble(36, dd->getDimPoint().z);
|
||||||
break; }
|
break; }
|
||||||
case DRW::DIMANGULAR3P: {
|
case DRW::DIMANGULAR3P: {
|
||||||
DRW_DimAngular3p * dd = (DRW_DimAngular3p*)ent;
|
DRW_DimAngular3p * dd = static_cast<DRW_DimAngular3p*>(ent);
|
||||||
writer->writeDouble(13, dd->getFirstLine().x);
|
writer->writeDouble(13, dd->getFirstLine().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine().y);
|
writer->writeDouble(23, dd->getFirstLine().y);
|
||||||
writer->writeDouble(33, dd->getFirstLine().z);
|
writer->writeDouble(33, dd->getFirstLine().z);
|
||||||
|
@ -1116,7 +1131,7 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) {
|
||||||
writer->writeDouble(35, dd->getVertexPoint().z);
|
writer->writeDouble(35, dd->getVertexPoint().z);
|
||||||
break; }
|
break; }
|
||||||
case DRW::DIMORDINATE: {
|
case DRW::DIMORDINATE: {
|
||||||
DRW_DimOrdinate * dd = (DRW_DimOrdinate*)ent;
|
DRW_DimOrdinate * dd = static_cast<DRW_DimOrdinate*>(ent);
|
||||||
writer->writeString(100, "AcDbOrdinateDimension");
|
writer->writeString(100, "AcDbOrdinateDimension");
|
||||||
writer->writeDouble(13, dd->getFirstLine().x);
|
writer->writeDouble(13, dd->getFirstLine().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine().y);
|
writer->writeDouble(23, dd->getFirstLine().y);
|
||||||
|
@ -1238,7 +1253,7 @@ bool dxfRW::writeViewport(DRW_Viewport *ent) {
|
||||||
}
|
}
|
||||||
writer->writeDouble(10, ent->basePoint.x);
|
writer->writeDouble(10, ent->basePoint.x);
|
||||||
writer->writeDouble(20, ent->basePoint.y);
|
writer->writeDouble(20, ent->basePoint.y);
|
||||||
if (ent->basePoint.z != 0.0)
|
if (not qFuzzyIsNull(ent->basePoint.z))
|
||||||
writer->writeDouble(30, ent->basePoint.z);
|
writer->writeDouble(30, ent->basePoint.z);
|
||||||
writer->writeDouble(40, ent->pswidth);
|
writer->writeDouble(40, ent->pswidth);
|
||||||
writer->writeDouble(41, ent->psheight);
|
writer->writeDouble(41, ent->psheight);
|
||||||
|
@ -1352,7 +1367,7 @@ bool dxfRW::writeBlock(DRW_Block *bk){
|
||||||
writer->writeInt16(70, bk->flags);
|
writer->writeInt16(70, bk->flags);
|
||||||
writer->writeDouble(10, bk->basePoint.x);
|
writer->writeDouble(10, bk->basePoint.x);
|
||||||
writer->writeDouble(20, bk->basePoint.y);
|
writer->writeDouble(20, bk->basePoint.y);
|
||||||
if (bk->basePoint.z != 0.0) {
|
if (not qFuzzyIsNull(bk->basePoint.z)) {
|
||||||
writer->writeDouble(30, bk->basePoint.z);
|
writer->writeDouble(30, bk->basePoint.z);
|
||||||
}
|
}
|
||||||
if (version > DRW::AC1009)
|
if (version > DRW::AC1009)
|
||||||
|
@ -2667,6 +2682,10 @@ bool dxfRW::processDimension() {
|
||||||
nextentity = reader->getString();
|
nextentity = reader->getString();
|
||||||
DRW_DBG(nextentity); DRW_DBG("\n");
|
DRW_DBG(nextentity); DRW_DBG("\n");
|
||||||
int type = dim.type & 0x0F;
|
int type = dim.type & 0x0F;
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0: {
|
case 0: {
|
||||||
DRW_DimLinear d(dim);
|
DRW_DimLinear d(dim);
|
||||||
|
@ -2697,6 +2716,9 @@ bool dxfRW::processDimension() {
|
||||||
iface->addDimOrdinate(&d);
|
iface->addDimOrdinate(&d);
|
||||||
break; }
|
break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
return true; //found new entity or ENDSEC, terminate
|
return true; //found new entity or ENDSEC, terminate
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
void setEllipseParts(int parts){elParts = parts;} /*!< set parts munber when convert ellipse to polyline */
|
void setEllipseParts(int parts){elParts = parts;} /*!< set parts munber when convert ellipse to polyline */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(dxfRW)
|
||||||
/// used by read() to parse the content of the file
|
/// used by read() to parse the content of the file
|
||||||
bool processDxf();
|
bool processDxf();
|
||||||
bool processHeader();
|
bool processHeader();
|
||||||
|
|
|
@ -264,10 +264,10 @@ void VTextManager::Update(const QString& qsName, const VPieceLabelData& data)
|
||||||
}
|
}
|
||||||
// MCP
|
// MCP
|
||||||
QStringList qslMaterials;
|
QStringList qslMaterials;
|
||||||
qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
qslMaterials << QApplication::translate("Detail", "Fabric", nullptr)
|
||||||
<< QApplication::translate("Detail", "Lining", 0)
|
<< QApplication::translate("Detail", "Lining", nullptr)
|
||||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
<< QApplication::translate("Detail", "Interfacing", nullptr)
|
||||||
<< QApplication::translate("Detail", "Interlining", 0);
|
<< QApplication::translate("Detail", "Interlining", nullptr);
|
||||||
QString qsText = QLatin1String("%1, ") + tr("cut") + QLatin1String(" %2%3");
|
QString qsText = QLatin1String("%1, ") + tr("cut") + QLatin1String(" %2%3");
|
||||||
QStringList qslPlace;
|
QStringList qslPlace;
|
||||||
qslPlace << "" << QLatin1String(" ") + tr("on fold");
|
qslPlace << "" << QLatin1String(" ") + tr("on fold");
|
||||||
|
|
|
@ -155,7 +155,7 @@ void SetOverrideCursor(Qt::CursorShape shape)
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QPixmap oldPixmap;
|
QPixmap oldPixmap;
|
||||||
QCursor* pOldCursor = QGuiApplication::overrideCursor();
|
QCursor* pOldCursor = QGuiApplication::overrideCursor();
|
||||||
if (pOldCursor != 0)
|
if (pOldCursor != nullptr)
|
||||||
{
|
{
|
||||||
oldPixmap = pOldCursor->pixmap();
|
oldPixmap = pOldCursor->pixmap();
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ void RestoreOverrideCursor(Qt::CursorShape shape)
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QPixmap oldPixmap;
|
QPixmap oldPixmap;
|
||||||
QCursor* pOldCursor = QGuiApplication::overrideCursor();
|
QCursor* pOldCursor = QGuiApplication::overrideCursor();
|
||||||
if (pOldCursor != 0)
|
if (pOldCursor != nullptr)
|
||||||
{
|
{
|
||||||
oldPixmap = pOldCursor->pixmap();
|
oldPixmap = pOldCursor->pixmap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class VSettings : public VCommonSettings
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = 0);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
QString GetLabelLanguage() const;
|
QString GetLabelLanguage() const;
|
||||||
void SetLabelLanguage(const QString &value);
|
void SetLabelLanguage(const QString &value);
|
||||||
|
|
|
@ -44,7 +44,7 @@ class VTapeSettings : public VCommonSettings
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = 0);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
QByteArray GetDataBaseGeometry() const;
|
QByteArray GetDataBaseGeometry() const;
|
||||||
void SetDataBaseGeometry(const QByteArray &value);
|
void SetDataBaseGeometry(const QByteArray &value);
|
||||||
|
|
|
@ -132,7 +132,7 @@ static point2d_t* point_alloc()
|
||||||
point2d_t* p;
|
point2d_t* p;
|
||||||
|
|
||||||
p = (point2d_t*)malloc(sizeof(point2d_t));
|
p = (point2d_t*)malloc(sizeof(point2d_t));
|
||||||
assert( p != NULL );
|
assert( p != nullptr );
|
||||||
// cppcheck-suppress memsetClassFloat
|
// cppcheck-suppress memsetClassFloat
|
||||||
memset(p, 0, sizeof(point2d_t));
|
memset(p, 0, sizeof(point2d_t));
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ static point2d_t* point_alloc()
|
||||||
*/
|
*/
|
||||||
static void point_free( point2d_t* p )
|
static void point_free( point2d_t* p )
|
||||||
{
|
{
|
||||||
assert( p != NULL );
|
assert( p != nullptr );
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ static halfedge_t* halfedge_alloc()
|
||||||
halfedge_t* d;
|
halfedge_t* d;
|
||||||
|
|
||||||
d = (halfedge_t*)malloc(sizeof(halfedge_t));
|
d = (halfedge_t*)malloc(sizeof(halfedge_t));
|
||||||
assert( d != NULL );
|
assert( d != nullptr );
|
||||||
memset(d, 0, sizeof(halfedge_t));
|
memset(d, 0, sizeof(halfedge_t));
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
@ -167,7 +167,7 @@ static halfedge_t* halfedge_alloc()
|
||||||
*/
|
*/
|
||||||
static void halfedge_free( halfedge_t* d )
|
static void halfedge_free( halfedge_t* d )
|
||||||
{
|
{
|
||||||
assert( d != NULL );
|
assert( d != nullptr );
|
||||||
memset(d, 0, sizeof(halfedge_t));
|
memset(d, 0, sizeof(halfedge_t));
|
||||||
free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
|
@ -182,21 +182,21 @@ void del_free_halfedges( delaunay_t *del )
|
||||||
halfedge_t *d, *sig;
|
halfedge_t *d, *sig;
|
||||||
|
|
||||||
/* if there is nothing to do */
|
/* if there is nothing to do */
|
||||||
if( del->points == NULL )
|
if( del->points == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( i = 0; i <= (del->end_point - del->start_point); i++ )
|
for( i = 0; i <= (del->end_point - del->start_point); i++ )
|
||||||
{
|
{
|
||||||
/* free all the halfedges around the point */
|
/* free all the halfedges around the point */
|
||||||
d = del->points[i]->he;
|
d = del->points[i]->he;
|
||||||
if( d != NULL )
|
if( d != nullptr )
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
sig = d->next;
|
sig = d->next;
|
||||||
halfedge_free( d );
|
halfedge_free( d );
|
||||||
d = sig;
|
d = sig;
|
||||||
} while( d != del->points[i]->he );
|
} while( d != del->points[i]->he );
|
||||||
del->points[i]->he = NULL;
|
del->points[i]->he = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ void del_free_halfedges( delaunay_t *del )
|
||||||
//static face_t* face_alloc()
|
//static face_t* face_alloc()
|
||||||
//{
|
//{
|
||||||
// face_t *f = (face_t*)malloc(sizeof(face_t));
|
// face_t *f = (face_t*)malloc(sizeof(face_t));
|
||||||
// assert( f != NULL );
|
// assert( f != nullptr );
|
||||||
// memset(f, 0, sizeof(face_t));
|
// memset(f, 0, sizeof(face_t));
|
||||||
// return f;
|
// return f;
|
||||||
//}
|
//}
|
||||||
|
@ -217,7 +217,7 @@ void del_free_halfedges( delaunay_t *del )
|
||||||
*/
|
*/
|
||||||
//static void face_free(face_t *f)
|
//static void face_free(face_t *f)
|
||||||
//{
|
//{
|
||||||
// assert( f != NULL );
|
// assert( f != nullptr );
|
||||||
// free(f);
|
// free(f);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -622,8 +622,8 @@ static void del_remove_edge( halfedge_t *d )
|
||||||
prev = d->prev;
|
prev = d->prev;
|
||||||
pair = d->pair;
|
pair = d->pair;
|
||||||
|
|
||||||
assert(next != NULL);
|
assert(next != nullptr);
|
||||||
assert(prev != NULL);
|
assert(prev != nullptr);
|
||||||
|
|
||||||
next->prev = prev;
|
next->prev = prev;
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
|
@ -631,23 +631,23 @@ static void del_remove_edge( halfedge_t *d )
|
||||||
|
|
||||||
/* check to see if we have already removed pair */
|
/* check to see if we have already removed pair */
|
||||||
if( pair )
|
if( pair )
|
||||||
pair->pair = NULL;
|
pair->pair = nullptr;
|
||||||
|
|
||||||
/* check to see if the vertex points to this halfedge */
|
/* check to see if the vertex points to this halfedge */
|
||||||
if( d->vertex->he == d )
|
if( d->vertex->he == d )
|
||||||
d->vertex->he = next;
|
d->vertex->he = next;
|
||||||
|
|
||||||
d->vertex = NULL;
|
d->vertex = nullptr;
|
||||||
d->next = NULL;
|
d->next = nullptr;
|
||||||
d->prev = NULL;
|
d->prev = nullptr;
|
||||||
d->pair = NULL;
|
d->pair = nullptr;
|
||||||
|
|
||||||
next = orig_pair->next;
|
next = orig_pair->next;
|
||||||
prev = orig_pair->prev;
|
prev = orig_pair->prev;
|
||||||
pair = orig_pair->pair;
|
pair = orig_pair->pair;
|
||||||
|
|
||||||
assert(next != NULL);
|
assert(next != nullptr);
|
||||||
assert(prev != NULL);
|
assert(prev != nullptr);
|
||||||
|
|
||||||
next->prev = prev;
|
next->prev = prev;
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
|
@ -655,16 +655,16 @@ static void del_remove_edge( halfedge_t *d )
|
||||||
|
|
||||||
/* check to see if we have already removed pair */
|
/* check to see if we have already removed pair */
|
||||||
if( pair )
|
if( pair )
|
||||||
pair->pair = NULL;
|
pair->pair = nullptr;
|
||||||
|
|
||||||
/* check to see if the vertex points to this halfedge */
|
/* check to see if the vertex points to this halfedge */
|
||||||
if( orig_pair->vertex->he == orig_pair )
|
if( orig_pair->vertex->he == orig_pair )
|
||||||
orig_pair->vertex->he = next;
|
orig_pair->vertex->he = next;
|
||||||
|
|
||||||
orig_pair->vertex = NULL;
|
orig_pair->vertex = nullptr;
|
||||||
orig_pair->next = NULL;
|
orig_pair->next = nullptr;
|
||||||
orig_pair->prev = NULL;
|
orig_pair->prev = nullptr;
|
||||||
orig_pair->pair = NULL;
|
orig_pair->pair = nullptr;
|
||||||
|
|
||||||
|
|
||||||
/* finally free the halfedges */
|
/* finally free the halfedges */
|
||||||
|
@ -946,7 +946,7 @@ static void build_halfedge_face( delaunay_t *del, halfedge_t *d )
|
||||||
halfedge_t *curr;
|
halfedge_t *curr;
|
||||||
|
|
||||||
/* test if the halfedge has already a pointing face */
|
/* test if the halfedge has already a pointing face */
|
||||||
if( d->face != NULL )
|
if( d->face != nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
del->faces = (face_t*)realloc(del->faces, (del->num_faces + 1) * sizeof(face_t));
|
del->faces = (face_t*)realloc(del->faces, (del->num_faces + 1) * sizeof(face_t));
|
||||||
|
@ -987,7 +987,7 @@ void del_build_faces( delaunay_t *del )
|
||||||
halfedge_t *curr;
|
halfedge_t *curr;
|
||||||
|
|
||||||
del->num_faces = 0;
|
del->num_faces = 0;
|
||||||
del->faces = NULL;
|
del->faces = nullptr;
|
||||||
|
|
||||||
/* build external face first */
|
/* build external face first */
|
||||||
build_halfedge_face(del, del->rightmost_he->pair);
|
build_halfedge_face(del, del->rightmost_he->pair);
|
||||||
|
@ -1006,10 +1006,10 @@ void del_build_faces( delaunay_t *del )
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
delaunay2d_t* delaunay2d_from(del_point2d_t *points, quint32 num_points) {
|
delaunay2d_t* delaunay2d_from(del_point2d_t *points, quint32 num_points) {
|
||||||
delaunay2d_t* res = NULL;
|
delaunay2d_t* res = nullptr;
|
||||||
delaunay_t del;
|
delaunay_t del;
|
||||||
quint32 i;
|
quint32 i;
|
||||||
quint32* faces = NULL;
|
quint32* faces = nullptr;
|
||||||
|
|
||||||
del.num_faces = 0; //Warning using uninitialized value
|
del.num_faces = 0; //Warning using uninitialized value
|
||||||
|
|
||||||
|
@ -1019,7 +1019,7 @@ delaunay2d_t* delaunay2d_from(del_point2d_t *points, quint32 num_points) {
|
||||||
|
|
||||||
/* allocate the points */
|
/* allocate the points */
|
||||||
del.points = (point2d_t**)malloc(num_points * sizeof(point2d_t*));
|
del.points = (point2d_t**)malloc(num_points * sizeof(point2d_t*));
|
||||||
assert( del.points != NULL );
|
assert( del.points != nullptr );
|
||||||
memset(del.points, 0, num_points * sizeof(point2d_t*));
|
memset(del.points, 0, num_points * sizeof(point2d_t*));
|
||||||
|
|
||||||
/* copy the points */
|
/* copy the points */
|
||||||
|
|
|
@ -111,10 +111,10 @@ QString VPE::VFileEditWidget::getFile() const
|
||||||
|
|
||||||
void VPE::VFileEditWidget::onToolButtonClicked()
|
void VPE::VFileEditWidget::onToolButtonClicked()
|
||||||
{
|
{
|
||||||
QString filepath = (Directory ? QFileDialog::getExistingDirectory(0, tr("Directory"), CurrentFilePath,
|
QString filepath = (Directory ? QFileDialog::getExistingDirectory(nullptr, tr("Directory"), CurrentFilePath,
|
||||||
QFileDialog::ShowDirsOnly
|
QFileDialog::ShowDirsOnly
|
||||||
| QFileDialog::DontUseNativeDialog)
|
| QFileDialog::DontUseNativeDialog)
|
||||||
: QFileDialog::getOpenFileName(0, tr("Open File"), CurrentFilePath,
|
: QFileDialog::getOpenFileName(nullptr, tr("Open File"), CurrentFilePath,
|
||||||
FileDialogFilter, nullptr,
|
FileDialogFilter, nullptr,
|
||||||
QFileDialog::DontUseNativeDialog));
|
QFileDialog::DontUseNativeDialog));
|
||||||
if (filepath.isNull() == false)
|
if (filepath.isNull() == false)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPropertyDelegate : public QStyledItemDeleg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VPropertyDelegate(QObject *parent = 0);
|
explicit VPropertyDelegate(QObject *parent = nullptr);
|
||||||
virtual ~VPropertyDelegate() Q_DECL_OVERRIDE;
|
virtual ~VPropertyDelegate() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
//! Creates the editor widget
|
//! Creates the editor widget
|
||||||
|
|
|
@ -53,7 +53,7 @@ VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
|
||||||
delete d_ptr;
|
delete d_ptr;
|
||||||
if (this == DefaultManager)
|
if (this == DefaultManager)
|
||||||
{
|
{
|
||||||
DefaultManager = NULL;
|
DefaultManager = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void VPE::VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* f
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Only remove one type
|
// Only remove one type
|
||||||
if (d_ptr->Factories.value(type, NULL) == factory)
|
if (d_ptr->Factories.value(type, nullptr) == factory)
|
||||||
{
|
{
|
||||||
d_ptr->Factories.remove(type);
|
d_ptr->Factories.remove(type);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ bool VPE::VPropertyFactoryManager::isRegistered(VAbstractPropertyFactory* factor
|
||||||
|
|
||||||
VPE::VAbstractPropertyFactory* VPE::VPropertyFactoryManager::getFactory(const QString& type)
|
VPE::VAbstractPropertyFactory* VPE::VPropertyFactoryManager::getFactory(const QString& type)
|
||||||
{
|
{
|
||||||
return d_ptr->Factories.value(type, NULL);
|
return d_ptr->Factories.value(type, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ void VPE::VPropertyFormView::removeModelAndSet()
|
||||||
{
|
{
|
||||||
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model)
|
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model)
|
||||||
{
|
{
|
||||||
disconnect(static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model, 0, this, 0);
|
disconnect(static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model, nullptr, this, nullptr);
|
||||||
static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model = nullptr;
|
static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,13 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFormView : public VPropertyFormWid
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit VPropertyFormView(QWidget *parent = 0);
|
explicit VPropertyFormView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit VPropertyFormView(VPropertyModel* model, QWidget *parent = 0);
|
explicit VPropertyFormView(VPropertyModel* model, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit VPropertyFormView(VPropertySet* property_set, QWidget *parent = 0);
|
explicit VPropertyFormView(VPropertySet* property_set, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~VPropertyFormView() Q_DECL_OVERRIDE;
|
virtual ~VPropertyFormView() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -48,17 +48,17 @@ public:
|
||||||
bool IgnoreDataChangedSignal;
|
bool IgnoreDataChangedSignal;
|
||||||
|
|
||||||
VPropertyFormViewPrivate()
|
VPropertyFormViewPrivate()
|
||||||
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false),
|
: VPropertyFormWidgetPrivate(), Model(nullptr), PropertySet(nullptr), NeedsRebuild(false),
|
||||||
IgnoreDataChangedSignal(false)
|
IgnoreDataChangedSignal(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit VPropertyFormViewPrivate(VPropertyModel* prop_model)
|
explicit VPropertyFormViewPrivate(VPropertyModel* prop_model)
|
||||||
: VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false),
|
: VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(nullptr), NeedsRebuild(false),
|
||||||
IgnoreDataChangedSignal(false)
|
IgnoreDataChangedSignal(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit VPropertyFormViewPrivate(VPropertySet* prop_set)
|
explicit VPropertyFormViewPrivate(VPropertySet* prop_set)
|
||||||
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false),
|
: VPropertyFormWidgetPrivate(), Model(nullptr), PropertySet(prop_set), NeedsRebuild(false),
|
||||||
IgnoreDataChangedSignal(false)
|
IgnoreDataChangedSignal(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void VPE::VPropertyFormWidget::build()
|
||||||
if (layout())
|
if (layout())
|
||||||
{
|
{
|
||||||
QLayoutItem *child;
|
QLayoutItem *child;
|
||||||
while (layout()->count() > 0 && (child = layout()->takeAt(0)) != 0)
|
while (layout()->count() > 0 && (child = layout()->takeAt(0)) != nullptr)
|
||||||
{
|
{
|
||||||
if (child->widget())
|
if (child->widget())
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,7 +160,7 @@ protected:
|
||||||
virtual QModelIndex getIndexFromProperty(VProperty* property, int column = 0) const;
|
virtual QModelIndex getIndexFromProperty(VProperty* property, int column = 0) const;
|
||||||
|
|
||||||
//! Protected constructor passing the private object
|
//! Protected constructor passing the private object
|
||||||
explicit VPropertyModel(VPropertyModelPrivate* d, QObject* parent = 0);
|
explicit VPropertyModel(VPropertyModelPrivate* d, QObject* parent = nullptr);
|
||||||
|
|
||||||
//! The model data
|
//! The model data
|
||||||
VPropertyModelPrivate* d_ptr;
|
VPropertyModelPrivate* d_ptr;
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool VPE::VPropertySet::addProperty(VProperty *property, const QString &id, cons
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
VProperty* tmpParent = parentid.isEmpty() ? NULL : getProperty(parentid);
|
VProperty* tmpParent = parentid.isEmpty() ? nullptr : getProperty(parentid);
|
||||||
return addProperty(property, id, tmpParent);
|
return addProperty(property, id, tmpParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ bool VPE::VPropertySet::hasProperty(VProperty *property) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasProperty(property, NULL);
|
return hasProperty(property, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VProperty *VPE::VPropertySet::getProperty(const QString &id) const
|
VPE::VProperty *VPE::VPropertySet::getProperty(const QString &id) const
|
||||||
{
|
{
|
||||||
return d_ptr->Properties.value(id, NULL);
|
return d_ptr->Properties.value(id, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VProperty *VPE::VPropertySet::takeProperty(const QString &id)
|
VPE::VProperty *VPE::VPropertySet::takeProperty(const QString &id)
|
||||||
|
@ -125,7 +125,7 @@ void VPE::VPropertySet::removeProperty(VProperty* prop, bool delete_property)
|
||||||
removePropertyFromSet(prop);
|
removePropertyFromSet(prop);
|
||||||
|
|
||||||
// Remove from parent and optionally delete
|
// Remove from parent and optionally delete
|
||||||
prop->setParent(NULL);
|
prop->setParent(nullptr);
|
||||||
|
|
||||||
if (delete_property)
|
if (delete_property)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ const QList<VPE::VProperty *> &VPE::VPropertySet::getRootProperties() const
|
||||||
|
|
||||||
VPE::VProperty *VPE::VPropertySet::getRootProperty(int row) const
|
VPE::VProperty *VPE::VPropertySet::getRootProperty(int row) const
|
||||||
{
|
{
|
||||||
return d_ptr->RootProperties.value(row, NULL);
|
return d_ptr->RootProperties.value(row, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int VPE::VPropertySet::getRootPropertyCount() const
|
int VPE::VPropertySet::getRootPropertyCount() const
|
||||||
|
@ -204,7 +204,7 @@ VPE::VPropertySet* VPE::VPropertySet::clone() const
|
||||||
VPropertySet* tmpResult = new VPropertySet();
|
VPropertySet* tmpResult = new VPropertySet();
|
||||||
|
|
||||||
foreach(VProperty* tmpProperty, d_ptr->RootProperties)
|
foreach(VProperty* tmpProperty, d_ptr->RootProperties)
|
||||||
cloneProperty(tmpProperty, NULL, tmpResult);
|
cloneProperty(tmpProperty, nullptr, tmpResult);
|
||||||
|
|
||||||
|
|
||||||
return tmpResult;
|
return tmpResult;
|
||||||
|
@ -217,7 +217,7 @@ bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) cons
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<VProperty*>& tmpChildrenList = (parent != NULL ? parent->getChildren() : d_ptr->RootProperties);
|
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
|
||||||
foreach(VProperty* tmpProp, tmpChildrenList)
|
foreach(VProperty* tmpProp, tmpChildrenList)
|
||||||
{
|
{
|
||||||
if (!tmpProp)
|
if (!tmpProp)
|
||||||
|
|
|
@ -42,11 +42,11 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPropertyTreeView : public QTreeView
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
explicit VPropertyTreeView(QWidget *parent = 0);
|
explicit VPropertyTreeView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! The destructor, taking a model and setting it to the tree view
|
//! The destructor, taking a model and setting it to the tree view
|
||||||
//! \param model The model to set as model for this tree view
|
//! \param model The model to set as model for this tree view
|
||||||
explicit VPropertyTreeView(VPropertyModel* model, QWidget *parent = 0);
|
explicit VPropertyTreeView(VPropertyModel* model, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~VPropertyTreeView() Q_DECL_OVERRIDE;
|
virtual ~VPropertyTreeView() Q_DECL_OVERRIDE;
|
||||||
|
@ -60,7 +60,7 @@ protected:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
//! protected constructor
|
//! protected constructor
|
||||||
VPropertyTreeView(VPropertyTreeViewPrivate* d, bool init_, QWidget *parent = 0);
|
VPropertyTreeView(VPropertyTreeViewPrivate* d, bool init_, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! The protected data
|
//! The protected data
|
||||||
VPropertyTreeViewPrivate* d_ptr;
|
VPropertyTreeViewPrivate* d_ptr;
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DialogPointFromArcAndTangent : public DialogTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogPointFromArcAndTangent(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
DialogPointFromArcAndTangent(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
~DialogPointFromArcAndTangent();
|
~DialogPointFromArcAndTangent();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DialogPointFromCircleAndTangent : public DialogTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogPointFromCircleAndTangent(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
DialogPointFromCircleAndTangent(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
~DialogPointFromCircleAndTangent();
|
~DialogPointFromCircleAndTangent();
|
||||||
|
|
||||||
void SetPointName(const QString &value);
|
void SetPointName(const QString &value);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DialogPointOfIntersectionArcs : public DialogTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogPointOfIntersectionArcs(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
DialogPointOfIntersectionArcs(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
virtual ~DialogPointOfIntersectionArcs() Q_DECL_OVERRIDE;
|
virtual ~DialogPointOfIntersectionArcs() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetPointName(const QString &value);
|
void SetPointName(const QString &value);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DialogPointOfIntersectionCircles : public DialogTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogPointOfIntersectionCircles(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
DialogPointOfIntersectionCircles(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
virtual ~DialogPointOfIntersectionCircles() Q_DECL_OVERRIDE;
|
virtual ~DialogPointOfIntersectionCircles() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetPointName(const QString &value);
|
void SetPointName(const QString &value);
|
||||||
|
|
|
@ -48,7 +48,7 @@ class DialogPointOfIntersectionCurves : public DialogTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
explicit DialogPointOfIntersectionCurves(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
virtual ~DialogPointOfIntersectionCurves() Q_DECL_OVERRIDE;
|
virtual ~DialogPointOfIntersectionCurves() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void SetPointName(const QString &value);
|
void SetPointName(const QString &value);
|
||||||
|
|
|
@ -2649,10 +2649,10 @@ void DialogSeamAllowance::InitPatternPieceDataTab()
|
||||||
|
|
||||||
connect(uiTabLabels->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
|
connect(uiTabLabels->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
|
||||||
|
|
||||||
m_qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
m_qslMaterials << QApplication::translate("Detail", "Fabric", nullptr)
|
||||||
<< QApplication::translate("Detail", "Lining", 0)
|
<< QApplication::translate("Detail", "Lining", nullptr)
|
||||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
<< QApplication::translate("Detail", "Interfacing", nullptr)
|
||||||
<< QApplication::translate("Detail", "Interlining", 0);
|
<< QApplication::translate("Detail", "Interlining", nullptr);
|
||||||
|
|
||||||
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1505,15 +1505,15 @@ void VToolSeamAllowance::DeleteTool(bool ask)
|
||||||
// Deleting inside UnionDetails cause crash.
|
// Deleting inside UnionDetails cause crash.
|
||||||
// Because this object should be inactive from no one we disconnect all signals that may cause a crash
|
// Because this object should be inactive from no one we disconnect all signals that may cause a crash
|
||||||
// KEEP THIS LIST ACTUALL!!!
|
// KEEP THIS LIST ACTUALL!!!
|
||||||
disconnect(doc, 0, this, 0);
|
disconnect(doc, nullptr, this, nullptr);
|
||||||
if (QGraphicsScene *toolScene = scene())
|
if (QGraphicsScene *toolScene = scene())
|
||||||
{
|
{
|
||||||
disconnect(toolScene, 0, this, 0);
|
disconnect(toolScene, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
disconnect(m_dataLabel, 0, this, 0);
|
disconnect(m_dataLabel, nullptr, this, nullptr);
|
||||||
disconnect(m_patternInfo, 0, this, 0);
|
disconnect(m_patternInfo, nullptr, this, nullptr);
|
||||||
disconnect(m_grainLine, 0, this, 0);
|
disconnect(m_grainLine, nullptr, this, nullptr);
|
||||||
disconnect(m_sceneDetails, 0, this, 0);
|
disconnect(m_sceneDetails, nullptr, this, nullptr);
|
||||||
|
|
||||||
hide();// User shouldn't see this object
|
hide();// User shouldn't see this object
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class AddDetNode : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AddDetNode(const QDomElement &xml, VAbstractPattern *doc, const QString &drawName, QUndoCommand *parent = 0);
|
AddDetNode(const QDomElement &xml, VAbstractPattern *doc, const QString &drawName, QUndoCommand *parent = nullptr);
|
||||||
virtual ~AddDetNode() Q_DECL_OVERRIDE;
|
virtual ~AddDetNode() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -42,7 +42,8 @@ class AddPatternPiece : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AddPatternPiece(const QDomElement &xml, VAbstractPattern *doc, const QString &namePP, QUndoCommand *parent = 0);
|
AddPatternPiece(const QDomElement &xml, VAbstractPattern *doc, const QString &namePP,
|
||||||
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~AddPatternPiece() Q_DECL_OVERRIDE;
|
virtual ~AddPatternPiece() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class AddToCalc : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AddToCalc(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0);
|
AddToCalc(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
|
||||||
virtual ~AddToCalc() Q_DECL_OVERRIDE;
|
virtual ~AddToCalc() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DeletePatternPiece : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DeletePatternPiece(VAbstractPattern *doc, const QString &namePP, QUndoCommand *parent = 0);
|
DeletePatternPiece(VAbstractPattern *doc, const QString &namePP, QUndoCommand *parent = nullptr);
|
||||||
virtual ~DeletePatternPiece() Q_DECL_OVERRIDE;
|
virtual ~DeletePatternPiece() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DelTool : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DelTool(VAbstractPattern *doc, quint32 id, QUndoCommand *parent = 0);
|
DelTool(VAbstractPattern *doc, quint32 id, QUndoCommand *parent = nullptr);
|
||||||
virtual ~DelTool() Q_DECL_OVERRIDE;
|
virtual ~DelTool() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -44,7 +44,7 @@ class MoveDoubleLabel : public MoveAbstractLabel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MoveDoubleLabel(VAbstractPattern *doc, const double &x, const double &y, DoublePoint type,
|
MoveDoubleLabel(VAbstractPattern *doc, const double &x, const double &y, DoublePoint type,
|
||||||
quint32 toolId, quint32 pointId, QUndoCommand *parent = 0);
|
quint32 toolId, quint32 pointId, QUndoCommand *parent = nullptr);
|
||||||
virtual ~MoveDoubleLabel() Q_DECL_OVERRIDE;
|
virtual ~MoveDoubleLabel() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -41,7 +41,8 @@ class MoveLabel : public MoveAbstractLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MoveLabel(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QUndoCommand *parent = 0);
|
MoveLabel(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id,
|
||||||
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~MoveLabel();
|
virtual ~MoveLabel();
|
||||||
|
|
||||||
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -44,7 +44,7 @@ class MoveSPoint : public VUndoCommand
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MoveSPoint(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
|
MoveSPoint(VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene,
|
||||||
QUndoCommand *parent = 0);
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~MoveSPoint() Q_DECL_OVERRIDE;
|
virtual ~MoveSPoint() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RenamePP :public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RenamePP(VAbstractPattern *doc, const QString &newPPname, QComboBox *combo, QUndoCommand *parent = 0);
|
RenamePP(VAbstractPattern *doc, const QString &newPPname, QComboBox *combo, QUndoCommand *parent = nullptr);
|
||||||
virtual ~RenamePP() Q_DECL_OVERRIDE;
|
virtual ~RenamePP() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SaveToolOptions : public VUndoCommand
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VAbstractPattern *doc, const quint32 &id,
|
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VAbstractPattern *doc, const quint32 &id,
|
||||||
QUndoCommand *parent = 0);
|
QUndoCommand *parent = nullptr);
|
||||||
virtual ~SaveToolOptions() Q_DECL_OVERRIDE;
|
virtual ~SaveToolOptions() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -68,7 +68,7 @@ class VUndoCommand : public QObject, public QUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0);
|
VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
|
||||||
virtual ~VUndoCommand() Q_DECL_OVERRIDE;
|
virtual ~VUndoCommand() Q_DECL_OVERRIDE;
|
||||||
signals:
|
signals:
|
||||||
void ClearScene();
|
void ClearScene();
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
class VNoBrushScalePathItem : public QGraphicsPathItem
|
class VNoBrushScalePathItem : public QGraphicsPathItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VNoBrushScalePathItem(QGraphicsItem *parent = 0);
|
explicit VNoBrushScalePathItem(QGraphicsItem *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
|
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option,
|
||||||
|
|
|
@ -66,7 +66,7 @@ void VWidgetPopup::SetWidget(QWidget *widget, bool own)
|
||||||
|
|
||||||
if (mOwn)
|
if (mOwn)
|
||||||
{
|
{
|
||||||
mWidget->setParent(0);
|
mWidget->setParent(nullptr);
|
||||||
delete mWidget;
|
delete mWidget;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -77,7 +77,7 @@ void VWidgetPopup::SetWidget(QWidget *widget, bool own)
|
||||||
|
|
||||||
mWidget = widget;
|
mWidget = widget;
|
||||||
mOwn = own;
|
mOwn = own;
|
||||||
mOldParent = 0;
|
mOldParent = nullptr;
|
||||||
|
|
||||||
if (mWidget)
|
if (mWidget)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
If \a parent not specified (default), then popup widget gets
|
If \a parent not specified (default), then popup widget gets
|
||||||
attribute Qt::WA_DeleteOnClose and will be deleted after close.
|
attribute Qt::WA_DeleteOnClose and will be deleted after close.
|
||||||
*/
|
*/
|
||||||
explicit VWidgetPopup(QWidget *parent = 0);
|
explicit VWidgetPopup(QWidget *parent = nullptr);
|
||||||
|
|
||||||
/** Sets widget to be popped up to \a widget.
|
/** Sets widget to be popped up to \a widget.
|
||||||
If \a own is true then the widget will be reparented to the popup widget.
|
If \a own is true then the widget will be reparented to the popup widget.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user