diff --git a/src/libs/vdxf/dxfdef.h b/src/libs/vdxf/dxfdef.h index b92073651..d9cc7a44b 100644 --- a/src/libs/vdxf/dxfdef.h +++ b/src/libs/vdxf/dxfdef.h @@ -34,4 +34,20 @@ enum class VarMeasurement : unsigned char { English=0, Metric=1 }; //Default drawing units for AutoCAD DesignCenter blocks: enum class VarInsunits : unsigned char { Inches=1, Millimeters=4, Centimeters=5 }; +static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2) +{ + if(qFuzzyIsNull(p1)) + { + return qFuzzyIsNull(p2); + } + else if(qFuzzyIsNull(p2)) + { + return false; + } + else + { + return qFuzzyCompare(p1, p2); + } +} + #endif // DXFDEF_H diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index c25dc359f..7ce27f418 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -3089,13 +3089,13 @@ void DL_Dxf::writeInsert(DL_WriterA& dw, dw.dxfReal(10, data.ipx); dw.dxfReal(20, data.ipy); dw.dxfReal(30, data.ipz); - if (data.sx!=1.0 || data.sy!=1.0) + if (!DL_FuzzyComparePossibleNulls(data.sx, 1.0) || !DL_FuzzyComparePossibleNulls(data.sy, 1.0)) { dw.dxfReal(41, data.sx); dw.dxfReal(42, data.sy); dw.dxfReal(43, 1.0); } - if (data.angle!=0.0) + if (!DL_FuzzyComparePossibleNulls(data.angle, 0.0)) { dw.dxfReal(50, data.angle); } @@ -3104,7 +3104,7 @@ void DL_Dxf::writeInsert(DL_WriterA& dw, dw.dxfInt(70, data.cols); dw.dxfInt(71, data.rows); } - if (data.colSp!=0.0 || data.rowSp!=0.0) + if (!DL_FuzzyComparePossibleNulls(data.colSp, 0.0) || !DL_FuzzyComparePossibleNulls(data.rowSp, 0.0)) { dw.dxfReal(44, data.colSp); dw.dxfReal(45, data.rowSp); diff --git a/src/libs/vdxf/dxflib/dl_entities.h b/src/libs/vdxf/dxflib/dl_entities.h index 84c09b2ed..e9e871be0 100644 --- a/src/libs/vdxf/dxflib/dl_entities.h +++ b/src/libs/vdxf/dxflib/dl_entities.h @@ -26,6 +26,7 @@ #define DL_ENTITIES_H #include "dl_global.h" +#include "dxfdef.h" #include #include @@ -168,9 +169,9 @@ struct DXFLIB_EXPORT DL_StyleData // ignore lastHeightUsed: return (name==other.name && flags==other.flags && - fixedTextHeight==other.fixedTextHeight && - widthFactor==other.widthFactor && - obliqueAngle==other.obliqueAngle && + DL_FuzzyComparePossibleNulls(fixedTextHeight, other.fixedTextHeight) && + DL_FuzzyComparePossibleNulls(widthFactor, other.widthFactor) && + DL_FuzzyComparePossibleNulls(obliqueAngle, other.obliqueAngle) && textGenerationFlags==other.textGenerationFlags && primaryFontFile==other.primaryFontFile && bigFontFile==other.bigFontFile);