mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
Fix DXF export
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5794 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -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<QetShapeItem *>(qgi)) {
|
||||
list_shapes << dii;
|
||||
} else if (DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user