mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 09:40:52 +01:00
DXF - Add terminals to plot (optional)
This commit is contained in:
@@ -438,6 +438,12 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
|||||||
}
|
}
|
||||||
return minndx;
|
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
|
@brief Createdxf::drawLine
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ class Createdxf
|
|||||||
const long green,
|
const long green,
|
||||||
const long blue);
|
const long blue);
|
||||||
static long RGBcodeTable[];
|
static long RGBcodeTable[];
|
||||||
|
static int dxfColor(QColor color);
|
||||||
|
static int dxfColor(QPen pen);
|
||||||
|
|
||||||
static const double sheetWidth;
|
static const double sheetWidth;
|
||||||
static const double sheetHeight;
|
static const double sheetHeight;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "elementpicturefactory.h"
|
#include "elementpicturefactory.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "dynamicelementtextitem.h"
|
#include "dynamicelementtextitem.h"
|
||||||
|
#include "terminal.h"
|
||||||
|
|
||||||
#include <QGraphicsSimpleTextItem>
|
#include <QGraphicsSimpleTextItem>
|
||||||
|
|
||||||
@@ -465,6 +466,7 @@ void ExportDialog::generateDxf(
|
|||||||
//QList<QRectF *> list_ellipses;
|
//QList<QRectF *> list_ellipses;
|
||||||
QList <QetShapeItem *> list_shapes;
|
QList <QetShapeItem *> list_shapes;
|
||||||
QList <QetGraphicsTableItem *> list_tables;
|
QList <QetGraphicsTableItem *> list_tables;
|
||||||
|
// QList <Terminal *> list_terminals;
|
||||||
|
|
||||||
// Determine les elements a "XMLiser"
|
// Determine les elements a "XMLiser"
|
||||||
foreach(QGraphicsItem *qgi, diagram -> items()) {
|
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());
|
foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen());
|
||||||
|
|
||||||
// Draw tables
|
// Draw tables
|
||||||
@@ -619,6 +622,19 @@ void ExportDialog::generateDxf(
|
|||||||
qreal spanAngle = arc .at(5);
|
qreal spanAngle = arc .at(5);
|
||||||
Createdxf::drawArcEllipse(file_path, x, y, w, h, startAngle, spanAngle, hotspot_x, hotspot_y, rotation_angle, 0);
|
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<Terminal *> 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
|
//Draw conductors
|
||||||
|
|||||||
@@ -127,8 +127,10 @@ class Terminal : public QGraphicsObject
|
|||||||
|
|
||||||
/// Parent electrical element
|
/// Parent electrical element
|
||||||
Element *parent_element_{nullptr};
|
Element *parent_element_{nullptr};
|
||||||
|
public:
|
||||||
/// docking point for parent element
|
/// docking point for parent element
|
||||||
QPointF dock_elmt_;
|
QPointF dock_elmt_;
|
||||||
|
private:
|
||||||
/// List of conductors attached to the terminal
|
/// List of conductors attached to the terminal
|
||||||
QList<Conductor *> conductors_;
|
QList<Conductor *> conductors_;
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user