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:
blacksun
2019-03-16 19:13:46 +00:00
parent d8894809ad
commit 66ef773c53
3 changed files with 17 additions and 9 deletions

View File

@@ -34,6 +34,7 @@
#include "diagramfoliolist.h" #include "diagramfoliolist.h"
#include "elementpicturefactory.h" #include "elementpicturefactory.h"
#include "element.h" #include "element.h"
#include "dynamicelementtextitem.h"
/** /**
Constructeur Constructeur
@@ -479,6 +480,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
list_images << dii; list_images << dii;
} else if (QetShapeItem *dii = qgraphicsitem_cast<QetShapeItem *>(qgi)) { } else if (QetShapeItem *dii = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
list_shapes << dii; 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()); foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen());
//Draw elements //Draw elements
foreach(Element *elmt, list_elements) { foreach(Element *elmt, list_elements)
{
double rotation_angle = elmt -> orientation() * 90; double rotation_angle = elmt -> orientation() * 90;
qreal elem_pos_x = elmt -> pos().x(); 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) if (fontSize < 0)
fontSize = dti -> font().pixelSize(); fontSize = dti -> font().pixelSize();
fontSize *= Createdxf::yScale; fontSize *= Createdxf::yScale;
qreal x = (dti -> pos().x()) * Createdxf::xScale; qreal x = (dti->scenePos().x()) * Createdxf::xScale;
qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05; qreal y = Createdxf::sheetHeight - (dti->scenePos().y() * Createdxf::yScale) - fontSize*1.05;
QStringList lines = dti -> toPlainText().split('\n'); QStringList lines = dti -> toPlainText().split('\n');
foreach (QString line, lines) { foreach (QString line, lines) {
qreal angle = 360 - (dti -> rotation()); qreal angle = 360 - (dti -> rotation());

View File

@@ -145,7 +145,7 @@ void ExportPropertiesWidget::build() {
format -> addItem(tr("JPEG (*.jpg)"), "JPG"); format -> addItem(tr("JPEG (*.jpg)"), "JPG");
format -> addItem(tr("Bitmap (*.bmp)"), "BMP"); format -> addItem(tr("Bitmap (*.bmp)"), "BMP");
format -> addItem(tr("SVG (*.svg)"), "SVG"); format -> addItem(tr("SVG (*.svg)"), "SVG");
//format -> addItem(tr("DXF (*.dxf)"), "DXF"); format -> addItem(tr("DXF (*.dxf)"), "DXF");
hboxLayout1 -> addStretch(); hboxLayout1 -> addStretch();
vboxLayout -> addLayout(hboxLayout1); vboxLayout -> addLayout(hboxLayout1);

View File

@@ -170,8 +170,6 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi
painter.begin(picture); painter.begin(picture);
} }
else { else {
m_pictures_H.insert(location.uuid(), pic);
m_primitives_H.insert(location.uuid(), primitives_);
painter.begin(&pic); painter.begin(&pic);
} }
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
@@ -185,8 +183,6 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi
low_painter.begin(low_picture); low_painter.begin(low_picture);
} }
else { else {
m_low_pictures_H.insert(location.uuid(), low_pic);
m_primitives_H.insert(location.uuid(), primitives_);
low_painter.begin(&low_pic); low_painter.begin(&low_pic);
} }
low_painter.setRenderHint(QPainter::Antialiasing, true); low_painter.setRenderHint(QPainter::Antialiasing, true);
@@ -225,6 +221,15 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *pi
//End of the drawing //End of the drawing
painter.end(); painter.end();
low_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; return true;
} }