Sync libdxf code with last from QCAD project.
--HG-- branch : develop
This commit is contained in:
parent
146c936ccf
commit
2921276cad
|
@ -91,7 +91,7 @@ public:
|
|||
* @param layer Layer name for this entity or NULL for no layer
|
||||
* (every entity should be on a named layer!).
|
||||
* @param color Color number (0..256). 0 = BYBLOCK, 256 = BYLAYER.
|
||||
* @param color24 24 bit color (see DXF reference).
|
||||
* @param color24 24 bit color (0x00RRGGBB, see DXF reference).
|
||||
* @param width Line thickness. Defaults to zero. -1 = BYLAYER,
|
||||
* -2 = BYBLOCK, -3 = default width
|
||||
* @param linetype Line type name or "BYLAYER" or "BYBLOCK". Defaults
|
||||
|
|
|
@ -417,7 +417,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface,
|
|||
int color24;
|
||||
color24 = getIntValue(420, -1);
|
||||
int handle;
|
||||
handle = getIntValue(5, -1);
|
||||
handle = getInt16Value(5, -1);
|
||||
|
||||
std::string linetype = getStringValue(6, "BYLAYER");
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ void DL_Dxf::addRay(DL_CreationInterface* creationInterface)
|
|||
*/
|
||||
void DL_Dxf::addPolyline(DL_CreationInterface* creationInterface)
|
||||
{
|
||||
DL_PolylineData pd(maxVertices, getIntValue(71, 0), getIntValue(72, 0), getIntValue(70, 0));
|
||||
DL_PolylineData pd(maxVertices, getIntValue(71, 0), getIntValue(72, 0), getIntValue(70, 0), getRealValue(38, 0));
|
||||
creationInterface->addPolyline(pd);
|
||||
|
||||
maxVertices = std::min(maxVertices, vertexIndex+1);
|
||||
|
@ -1406,7 +1406,7 @@ void DL_Dxf::addMText(DL_CreationInterface* creationInterface)
|
|||
{
|
||||
if (libVersion<=0x02000200)
|
||||
{
|
||||
// wrong but compatible with dxflib <=2.0.2.0:
|
||||
// wrong but compatible with dxflib <=2.0.2.0 (angle stored in rad):
|
||||
angle = getRealValue(50, 0.0);
|
||||
}
|
||||
else
|
||||
|
@ -1578,7 +1578,12 @@ bool DL_Dxf::handleXData(DL_CreationInterface* creationInterface)
|
|||
creationInterface->addXDataReal(static_cast<int>(groupCode), toReal(groupValue));
|
||||
return true;
|
||||
}
|
||||
else if (groupCode>=1060 && groupCode<=1071)
|
||||
else if (groupCode>=1060 && groupCode<=1070)
|
||||
{
|
||||
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
|
||||
return true;
|
||||
}
|
||||
else if (groupCode==1071)
|
||||
{
|
||||
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
|
||||
return true;
|
||||
|
@ -2629,9 +2634,12 @@ void DL_Dxf::writePoint(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbPoint");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbPoint");
|
||||
}
|
||||
dw.coord(DL_POINT_COORD_CODE, data.x, data.y, data.z);
|
||||
}
|
||||
|
||||
|
@ -2652,9 +2660,12 @@ void DL_Dxf::writeLine(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.coord(DL_LINE_START_CODE, data.x1, data.y1, data.z1);
|
||||
dw.coord(DL_LINE_END_CODE, data.x2, data.y2, data.z2);
|
||||
}
|
||||
|
@ -2676,9 +2687,12 @@ void DL_Dxf::writeXLine(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.coord(DL_LINE_START_CODE, data.bx, data.by, data.bz);
|
||||
dw.coord(DL_LINE_END_CODE, data.dx, data.dy, data.dz);
|
||||
}
|
||||
|
@ -2700,9 +2714,12 @@ void DL_Dxf::writeRay(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbLine");
|
||||
}
|
||||
dw.coord(DL_LINE_START_CODE, data.bx, data.by, data.bz);
|
||||
dw.coord(DL_LINE_END_CODE, data.dx, data.dy, data.dz);
|
||||
}
|
||||
|
@ -2724,8 +2741,8 @@ void DL_Dxf::writePolyline(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.entity("LWPOLYLINE");
|
||||
dw.entityAttributes(attrib);
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.entityAttributes(attrib);
|
||||
dw.dxfString(100, "AcDbPolyline");
|
||||
dw.dxfInt(90, static_cast<int>(data.number));
|
||||
dw.dxfInt(70, data.flags);
|
||||
|
@ -2808,10 +2825,13 @@ void DL_Dxf::writeSpline(DL_WriterA& dw,
|
|||
{
|
||||
|
||||
dw.entity("SPLINE");
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbSpline");
|
||||
}
|
||||
dw.dxfInt(70, data.flags);
|
||||
|
@ -2887,9 +2907,12 @@ void DL_Dxf::writeCircle(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbCircle");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbCircle");
|
||||
}
|
||||
dw.coord(10, data.cx, data.cy, data.cz);
|
||||
dw.dxfReal(40, data.radius);
|
||||
}
|
||||
|
@ -2947,9 +2970,12 @@ void DL_Dxf::writeEllipse(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbEllipse");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEllipse");
|
||||
}
|
||||
dw.coord(10, data.cx, data.cy, data.cz);
|
||||
dw.coord(11, data.mx, data.my, data.mz);
|
||||
dw.dxfReal(40, data.ratio);
|
||||
|
@ -2975,9 +3001,12 @@ void DL_Dxf::writeSolid(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbTrace");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbTrace");
|
||||
}
|
||||
dw.coord(10, data.x[0], data.y[0], data.z[0]);
|
||||
dw.coord(11, data.x[1], data.y[1], data.z[1]);
|
||||
dw.coord(12, data.x[2], data.y[2], data.z[2]);
|
||||
|
@ -3000,9 +3029,12 @@ void DL_Dxf::writeTrace(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbTrace");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbTrace");
|
||||
}
|
||||
dw.coord(10, data.x[0], data.y[0], data.z[0]);
|
||||
dw.coord(11, data.x[1], data.y[1], data.z[1]);
|
||||
dw.coord(12, data.x[2], data.y[2], data.z[2]);
|
||||
|
@ -3027,9 +3059,12 @@ void DL_Dxf::write3dFace(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbFace");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbFace");
|
||||
}
|
||||
dw.coord(10, data.x[0], data.y[0], data.z[0]);
|
||||
dw.coord(11, data.x[1], data.y[1], data.z[1]);
|
||||
dw.coord(12, data.x[2], data.y[2], data.z[2]);
|
||||
|
@ -3061,6 +3096,10 @@ void DL_Dxf::writeInsert(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
if (data.cols!=1 || data.rows!=1)
|
||||
{
|
||||
dw.dxfString(100, "AcDbMInsertBlock");
|
||||
|
@ -3070,7 +3109,6 @@ void DL_Dxf::writeInsert(DL_WriterA& dw,
|
|||
dw.dxfString(100, "AcDbBlockReference");
|
||||
}
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
dw.dxfString(2, data.name);
|
||||
dw.dxfReal(10, data.ipx);
|
||||
dw.dxfReal(20, data.ipy);
|
||||
|
@ -3115,9 +3153,12 @@ void DL_Dxf::writeMText(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbMText");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbMText");
|
||||
}
|
||||
dw.dxfReal(10, data.ipx);
|
||||
dw.dxfReal(20, data.ipy);
|
||||
dw.dxfReal(30, data.ipz);
|
||||
|
@ -3176,9 +3217,12 @@ void DL_Dxf::writeText(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbText");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbText");
|
||||
}
|
||||
dw.dxfReal(10, data.ipx);
|
||||
dw.dxfReal(20, data.ipy);
|
||||
dw.dxfReal(30, data.ipz);
|
||||
|
@ -3197,6 +3241,7 @@ void DL_Dxf::writeText(DL_WriterA& dw,
|
|||
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
// required twice for some reason:
|
||||
dw.dxfString(100, "AcDbText");
|
||||
}
|
||||
|
||||
|
@ -3212,9 +3257,12 @@ void DL_Dxf::writeAttribute(DL_WriterA& dw,
|
|||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbText");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbText");
|
||||
}
|
||||
dw.dxfReal(10, data.ipx);
|
||||
dw.dxfReal(20, data.ipy);
|
||||
dw.dxfReal(30, data.ipz);
|
||||
|
@ -3749,10 +3797,13 @@ void DL_Dxf::writeLeader(DL_WriterA& dw,
|
|||
if (version>DL_VERSION_R12)
|
||||
{
|
||||
dw.entity("LEADER");
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbLeader");
|
||||
}
|
||||
dw.dxfString(3, "Standard");
|
||||
|
@ -3802,10 +3853,13 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw,
|
|||
{
|
||||
|
||||
dw.entity("HATCH");
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbHatch");
|
||||
}
|
||||
dw.dxfReal(10, 0.0); // elevation
|
||||
|
@ -4020,10 +4074,13 @@ int DL_Dxf::writeImage(DL_WriterA& dw,
|
|||
|
||||
dw.entity("IMAGE");
|
||||
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
}
|
||||
dw.entityAttributes(attrib);
|
||||
if (version==DL_VERSION_2000)
|
||||
{
|
||||
dw.dxfString(100, "AcDbRasterImage");
|
||||
dw.dxfInt(90, 0);
|
||||
}
|
||||
|
|
|
@ -414,6 +414,21 @@ public:
|
|||
return static_cast<int>(strtol(str.c_str(), &p, 10));
|
||||
}
|
||||
|
||||
int getInt16Value(int code, int def)
|
||||
{
|
||||
if (!hasValue(code))
|
||||
{
|
||||
return def;
|
||||
}
|
||||
return toInt16(values[code]);
|
||||
}
|
||||
|
||||
static int toInt16(const std::string& str)
|
||||
{
|
||||
char* p;
|
||||
return static_cast<int>(strtol(str.c_str(), &p, 16));
|
||||
}
|
||||
|
||||
static bool toBool(const std::string& str)
|
||||
{
|
||||
char* p;
|
||||
|
|
|
@ -390,10 +390,12 @@ struct DXFLIB_EXPORT DL_PolylineData
|
|||
* Constructor.
|
||||
* Parameters: see member variables.
|
||||
*/
|
||||
DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags)
|
||||
DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags, double pElevation = 0.0)
|
||||
: number(static_cast<quint32>(pNumber)),
|
||||
m(static_cast<quint32>(pMVerteces)),
|
||||
n(static_cast<quint32>(pNVerteces)), flags(pFlags)
|
||||
n(static_cast<quint32>(pNVerteces)),
|
||||
elevation(pElevation),
|
||||
flags(pFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -406,6 +408,9 @@ struct DXFLIB_EXPORT DL_PolylineData
|
|||
/*! Number of vertices in n direction if polyline is a polygon mesh. */
|
||||
quint32 n;
|
||||
|
||||
/*! elevation of the polyline. */
|
||||
double elevation;
|
||||
|
||||
/*! Flags */
|
||||
int flags;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user