Correct line types.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-06-23 22:11:25 +03:00
parent 4c2c4ae7a2
commit d9353df43a
4 changed files with 58 additions and 40 deletions

View File

@ -180,6 +180,10 @@ void dx_iface::InitHeader(VarMeasurement varMeasurement, VarInsunits varInsunits
// explicitly.
cData.headerC.addDouble("$DIMLFAC", 1.0, 40);
cData.headerC.addDouble("$LTSCALE", 0.5, 40);
cData.headerC.addDouble("$PSLTSCALE", 1.0, 70);
cData.headerC.addInt("$PLINEGEN", 1, 70);
QString dateTime = QDateTime::currentDateTime().toString("yyyyMMdd.HHmmsszzz");
dateTime.chop(1);// we need hundredths of a second
cData.headerC.addStr("$TDCREATE", dateTime.toStdString(), 40);
@ -187,29 +191,47 @@ void dx_iface::InitHeader(VarMeasurement varMeasurement, VarInsunits varInsunits
void dx_iface::InitLTypes()
{
cData.lineTypes.push_back(DRW_LType("ACAD_ISO02W100", "ACAD_ISO02W100"));
cData.lineTypes.push_back(DRW_LType("ACAD_ISO02W100", "ACAD_ISO02W100"));
cData.lineTypes.push_back(DRW_LType("ACAD_ISO03W100", "ACAD_ISO03W100"));
cData.lineTypes.push_back(DRW_LType("ACAD_ISO04W100", "ACAD_ISO04W100"));
cData.lineTypes.push_back(DRW_LType("ACAD_ISO05W100", "ACAD_ISO05W100"));
cData.lineTypes.push_back(DRW_LType("BORDER", "BORDER"));
cData.lineTypes.push_back(DRW_LType("BORDER2", "BORDER2"));
cData.lineTypes.push_back(DRW_LType("BORDERX2", "BORDERX2"));
cData.lineTypes.push_back(DRW_LType("CENTER", "CENTER"));
cData.lineTypes.push_back(DRW_LType("CENTER2", "CENTER2"));
cData.lineTypes.push_back(DRW_LType("CENTERX2", "CENTERX2"));
cData.lineTypes.push_back(DRW_LType("DASHDOT", "DASHDOT"));
cData.lineTypes.push_back(DRW_LType("DASHDOT2", "DASHDOT2"));
cData.lineTypes.push_back(DRW_LType("DASHDOTX2", "DASHDOTX2"));
cData.lineTypes.push_back(DRW_LType("DASHED", "DASHED"));
cData.lineTypes.push_back(DRW_LType("DASHED2", "DASHED2"));
cData.lineTypes.push_back(DRW_LType("DASHEDX2", "DASHEDX2"));
cData.lineTypes.push_back(DRW_LType("DIVIDE", "DIVIDE"));
cData.lineTypes.push_back(DRW_LType("DIVIDE2", "DIVIDE2"));
cData.lineTypes.push_back(DRW_LType("DIVIDEX2", "DIVIDEX2"));
cData.lineTypes.push_back(DRW_LType("DOT", "DOT"));
cData.lineTypes.push_back(DRW_LType("DOT2", "DOT2"));
cData.lineTypes.push_back(DRW_LType("DOTX2", "DOTX2"));
DRW_LType ltype;
ltype.name = "DOT";
ltype.desc = "Dot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .";
ltype.size = 2;
ltype.length = 0.125;
ltype.path.push_back(0.0);
ltype.path.push_back(-0.125);
cData.lineTypes.push_back(ltype);
ltype.path.clear();
ltype.name = "DASHEDTINY";
ltype.desc = "Dashed (.15x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
ltype.size = 2;
ltype.length = 2.8575;
ltype.path.push_back(1.905);
ltype.path.push_back(-0.9525);
cData.lineTypes.push_back(ltype);
ltype.path.clear();
ltype.name = "DASHDOT2";
ltype.desc = "Dash dot2 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.";
ltype.size = 4;
ltype.length = 0.5;
ltype.path.push_back(0.25);
ltype.path.push_back(-0.125);
ltype.path.push_back(0.0);
ltype.path.push_back(-0.125);
cData.lineTypes.push_back(ltype);
ltype.path.clear();
ltype.name = "DIVIDE2";
ltype.desc = "Divide2 __..__..__..__..__..__..__..__..__..__..__..__..__..__..__..__..";
ltype.size = 6;
ltype.length = 0.625;
ltype.path.push_back(0.25);
ltype.path.push_back(-0.125);
ltype.path.push_back(0.0);
ltype.path.push_back(-0.125);
ltype.path.push_back(0.0);
ltype.path.push_back(-0.125);
cData.lineTypes.push_back(ltype);
}
void dx_iface::InitLayers()

View File

@ -244,12 +244,6 @@ class DRW_LType : public DRW_TableEntry {
SETOBJFRIENDS
public:
DRW_LType() { reset();}
DRW_LType(const UTF8STRING &name, const UTF8STRING &desc)
{
reset();
this->name = name;
this->desc = desc;
}
void reset(){
tType = DRW::LTYPE;

View File

@ -808,12 +808,14 @@ bool dxfRW::writePolyline(DRW_Polyline *ent) {
writer->writeString(0, "VERTEX");
writeEntity(ent);
if (version > DRW::AC1009)
{
writer->writeString(100, "AcDbVertex");
if(is3d) {
writer->writeString(100, "AcDb3dPolylineVertex");
} else {
writer->writeString(100, "AcDb2dVertex");
}
}
if ( (v->flags & 128) && !(v->flags & 64) ) {
writer->writeDouble(10, 0);
writer->writeDouble(20, 0);

View File

@ -138,7 +138,10 @@ void VDxfEngine::drawPath(const QPainterPath &path)
poly->color = getPenColor();
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = getPenStyle();
poly->ltypeScale = 1.0;
if (polygon.size() > 1 && polygon.first() == polygon.last())
{
poly->flags = 1; // closed
}
for (int i=0; i < polygon.count(); ++i)
{
@ -155,7 +158,10 @@ void VDxfEngine::drawPath(const QPainterPath &path)
poly->color = getPenColor();
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = getPenStyle();
poly->ltypeScale = 1.0;
if (polygon.size() > 1 && polygon.first() == polygon.last())
{
poly->flags = 1; // closed
}
for (int i=0; i < polygon.count(); ++i)
{
@ -185,7 +191,6 @@ void VDxfEngine::drawLines(const QLineF * lines, int lineCount)
line->color = getPenColor();
line->lWeight = DRW_LW_Conv::widthByLayer;
line->lineType = getPenStyle();
line->ltypeScale = 1.0;
input->AddEntity(line);
}
@ -214,7 +219,6 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
poly->color = getPenColor();
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = getPenStyle();
poly->ltypeScale = 1.0;
for (int i = 0; i < pointCount; ++i)
{
@ -232,7 +236,6 @@ void VDxfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
poly->color = getPenColor();
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = getPenStyle();
poly->ltypeScale = 1.0;
for (int i = 0; i < pointCount; ++i)
{
@ -288,7 +291,6 @@ void VDxfEngine::drawEllipse(const QRectF & rect)
ellipse->color = getPenColor();
ellipse->lWeight = DRW_LW_Conv::widthByLayer;
ellipse->lineType = getPenStyle();
ellipse->ltypeScale = 1.0;
input->AddEntity(ellipse);
}
@ -324,7 +326,6 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem)
text->color = getPenColor();
text->lWeight = DRW_LW_Conv::widthByLayer;
text->lineType = getPenStyle();
text->ltypeScale = 1.0;
input->AddEntity(text);
}
@ -344,7 +345,6 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem)
text->color = getPenColor();
text->lWeight = DRW_LW_Conv::widthByLayer;
text->lineType = getPenStyle();
text->ltypeScale = 1.0;
input->AddEntity(text);
}
@ -423,13 +423,13 @@ std::string VDxfEngine::getPenStyle()
switch (state->pen().style())
{
case Qt::DashLine:
return "DASHED";
return "DASHEDTINY";
case Qt::DotLine:
return "DOT";
case Qt::DashDotLine:
return "DASHDOT";
return "DASHDOT2";
case Qt::DashDotDotLine:
return "DIVIDE";
return "DIVIDE2";
case Qt::SolidLine:
default:
return "BYLAYER";