diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 239959b7f..7aae7e5cb 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -438,6 +438,12 @@ 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()); +} /** @brief Createdxf::drawLine diff --git a/sources/createdxf.h b/sources/createdxf.h index f6e0b1367..1c30f5b3c 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -123,6 +123,8 @@ class Createdxf const long green, const long blue); static long RGBcodeTable[]; + static int dxfColor(QColor color); + static int dxfColor(QPen pen); static const double sheetWidth; static const double sheetHeight; diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 15d98de0b..9f45aceb9 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -35,6 +35,7 @@ #include "elementpicturefactory.h" #include "element.h" #include "dynamicelementtextitem.h" +#include "terminal.h" #include @@ -465,6 +466,7 @@ void ExportDialog::generateDxf( //QList list_ellipses; QList list_shapes; QList list_tables; +// QList list_terminals; // Determine les elements a "XMLiser" foreach(QGraphicsItem *qgi, diagram -> items()) { @@ -485,6 +487,7 @@ void ExportDialog::generateDxf( } } + // Draw shapes foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen()); // Draw tables @@ -619,6 +622,19 @@ void ExportDialog::generateDxf( qreal spanAngle = arc .at(5); Createdxf::drawArcEllipse(file_path, x, y, w, h, startAngle, spanAngle, hotspot_x, hotspot_y, rotation_angle, 0); } + if (epw -> exportProperties().draw_terminals) { + // Draw terminals + QList list_terminals = elmt->terminals(); + QColor col("red"); + foreach(Terminal *tp, list_terminals) { + qreal x = (elem_pos_x + tp->dock_elmt_.x()) * Createdxf::xScale; + qreal y = Createdxf::sheetHeight - (elem_pos_y + tp->dock_elmt_.y()) * Createdxf::yScale; + QPointF transformed_point = rotation_transformed(x, y, hotspot_x, hotspot_y, rotation_angle); + x = transformed_point.x(); + y = transformed_point.y(); + Createdxf::drawCircle(file_path, 3.0* Createdxf::xScale, x, y, Createdxf::dxfColor(col)); + } + } } //Draw conductors diff --git a/sources/qetgraphicsitem/terminal.h b/sources/qetgraphicsitem/terminal.h index 1fd66fa1b..6250fe52e 100644 --- a/sources/qetgraphicsitem/terminal.h +++ b/sources/qetgraphicsitem/terminal.h @@ -127,8 +127,10 @@ class Terminal : public QGraphicsObject /// Parent electrical element Element *parent_element_{nullptr}; + public: /// docking point for parent element QPointF dock_elmt_; + private: /// List of conductors attached to the terminal QList conductors_; /**