mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
DXF - Add some color
This commit is contained in:
@@ -437,9 +437,11 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
||||
}
|
||||
return minndx;
|
||||
}
|
||||
|
||||
int Createdxf::dxfColor(QColor color) {
|
||||
return Createdxf::getcolorCode(color.red(), color.green(), color.blue());
|
||||
}
|
||||
|
||||
int Createdxf::dxfColor(QPen pen) {
|
||||
return Createdxf::dxfColor(pen.color());
|
||||
}
|
||||
@@ -984,7 +986,13 @@ void Createdxf::drawPolygon(
|
||||
const QPolygonF &poly,
|
||||
const int &colorcode)
|
||||
{
|
||||
drawPolyline(filepath,poly,colorcode);
|
||||
qDebug() << "PolygonIsClosed: " << poly.isClosed();
|
||||
QPolygonF pg = poly;
|
||||
if(!poly.isClosed()) {
|
||||
pg << poly.at(0);
|
||||
}
|
||||
qDebug() << "PolygonIsClosed: " << poly.isClosed();
|
||||
drawPolyline(filepath,pg,colorcode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -660,7 +660,7 @@ void ExportDialog::generateDxf(
|
||||
qreal offset = fontSize * 1.6;
|
||||
foreach (QString line, lines) {
|
||||
if (line.size() > 0 && line != "_" )
|
||||
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 );
|
||||
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, Createdxf::dxfColor(dti->color()), 0.72 );
|
||||
x += offset * xdir;
|
||||
y -= offset * ydir;
|
||||
}
|
||||
|
||||
@@ -966,29 +966,27 @@ bool QetShapeItem::toDXF(const QString &filepath,const QPen &pen)
|
||||
{
|
||||
case Line:
|
||||
Createdxf::drawLine(filepath,
|
||||
QLineF(mapToScene(m_P1),
|
||||
QLineF( mapToScene(m_P1),
|
||||
mapToScene(m_P2)),
|
||||
Createdxf::getcolorCode(pen.color().red(),
|
||||
pen.color().green(),
|
||||
pen.color().blue()));
|
||||
Createdxf::dxfColor(pen));
|
||||
return true;
|
||||
case Rectangle:
|
||||
Createdxf::drawRectangle(filepath,
|
||||
QRectF(mapToScene(m_P1),
|
||||
mapToScene(m_P2)).normalized(),
|
||||
Createdxf::getcolorCode(pen.color().red(),
|
||||
pen.color().green(),
|
||||
pen.color().blue()));
|
||||
Createdxf::dxfColor(pen));
|
||||
return true;
|
||||
case Ellipse:
|
||||
Createdxf::drawEllipse (filepath,
|
||||
Createdxf::drawEllipse(filepath,
|
||||
QRectF(mapToScene(m_P1),
|
||||
mapToScene(m_P2)).normalized(),
|
||||
Createdxf::getcolorCode(pen.color().red(),
|
||||
pen.color().green(),
|
||||
pen.color().blue()));
|
||||
Createdxf::dxfColor(pen));
|
||||
return true;
|
||||
default: return false;
|
||||
case Polygon:
|
||||
Createdxf::drawPolygon(filepath,m_polygon,Createdxf::dxfColor(pen));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user