diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index d7307d86a..c1142066a 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -34,6 +34,7 @@ #include "diagramfoliolist.h" #include "elementpicturefactory.h" #include "element.h" +#include "dynamicelementtextitem.h" /** Constructeur @@ -479,6 +480,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee list_images << dii; } else if (QetShapeItem *dii = qgraphicsitem_cast(qgi)) { list_shapes << dii; + } else if (DynamicElementTextItem *deti = qgraphicsitem_cast(qgi)) { + list_texts << deti; } } } @@ -486,8 +489,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen()); //Draw elements - foreach(Element *elmt, list_elements) { - + foreach(Element *elmt, list_elements) + { double rotation_angle = elmt -> orientation() * 90; qreal elem_pos_x = elmt -> pos().x(); @@ -627,8 +630,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee if (fontSize < 0) fontSize = dti -> font().pixelSize(); fontSize *= Createdxf::yScale; - qreal x = (dti -> pos().x()) * Createdxf::xScale; - qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05; + qreal x = (dti->scenePos().x()) * Createdxf::xScale; + qreal y = Createdxf::sheetHeight - (dti->scenePos().y() * Createdxf::yScale) - fontSize*1.05; QStringList lines = dti -> toPlainText().split('\n'); foreach (QString line, lines) { qreal angle = 360 - (dti -> rotation()); diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp index 1d478d7f0..97e614aaf 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -145,7 +145,7 @@ void ExportPropertiesWidget::build() { format -> addItem(tr("JPEG (*.jpg)"), "JPG"); format -> addItem(tr("Bitmap (*.bmp)"), "BMP"); format -> addItem(tr("SVG (*.svg)"), "SVG"); - //format -> addItem(tr("DXF (*.dxf)"), "DXF"); + format -> addItem(tr("DXF (*.dxf)"), "DXF"); hboxLayout1 -> addStretch(); vboxLayout -> addLayout(hboxLayout1); diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index 0520113df..778706e82 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -170,8 +170,6 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi painter.begin(picture); } else { - m_pictures_H.insert(location.uuid(), pic); - m_primitives_H.insert(location.uuid(), primitives_); painter.begin(&pic); } painter.setRenderHint(QPainter::Antialiasing, true); @@ -185,8 +183,6 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi low_painter.begin(low_picture); } else { - m_low_pictures_H.insert(location.uuid(), low_pic); - m_primitives_H.insert(location.uuid(), primitives_); low_painter.begin(&low_pic); } low_painter.setRenderHint(QPainter::Antialiasing, true); @@ -225,6 +221,15 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi //End of the drawing painter.end(); low_painter.end(); + + if (!picture) { + m_pictures_H.insert(location.uuid(), pic); + m_primitives_H.insert(location.uuid(), primitives_); + } + if (!low_picture) { + m_low_pictures_H.insert(location.uuid(), low_pic); + m_primitives_H.insert(location.uuid(), primitives_); + } return true; }