[qet] [2746] DXF Export: Added Ellipse and Element Text Document for export.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2746
Author:   abhishekm71
Date:     2014-01-18 13:23:35 +0100 (Sat, 18 Jan 2014)
Log Message:
-----------
DXF Export: Added Ellipse and Element Text Document for export.

Modified Paths:
--------------
    trunk/sources/exportdialog.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp

Modified: trunk/sources/exportdialog.cpp
===================================================================
--- trunk/sources/exportdialog.cpp	2014-01-18 12:21:27 UTC (rev 2745)
+++ trunk/sources/exportdialog.cpp	2014-01-18 12:23:35 UTC (rev 2746)
@@ -422,7 +422,8 @@
 			QStringList lines = dti -> toPlainText().split('\n');
 			y += (fontSize/2) * (lines.count()-1);
 			foreach (QString line, lines) {
-				Createdxf::drawText(file_path, line, x, y, fontSize, dti -> rotationAngle(), 0 );
+				if (line.size() > 0)
+					Createdxf::drawText(file_path, line, x, y, fontSize, dti -> rotationAngle(), 0 );
 				y -= fontSize*1.06;
 			}
 
@@ -486,7 +487,10 @@
 			qreal center_y = y - w/2;
 			qreal radius = (w+h)/4;
 			qreal endAngle = startAngle + spanAngle;
-			Createdxf::drawArc(file_path, center_x, center_y, radius, endAngle, startAngle, 0);
+			if (startAngle == 0 && spanAngle == 360)
+				Createdxf::drawCircle(file_path, radius, center_x, center_y, 0);
+			else
+				Createdxf::drawArc(file_path, center_x, center_y, radius, endAngle, startAngle, 0);
 		}
 	}
 

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2014-01-18 12:21:27 UTC (rev 2745)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2014-01-18 12:23:35 UTC (rev 2746)
@@ -634,6 +634,18 @@
 	QTextDocument text_document;
 	text_document.setDefaultFont(used_font);
 	text_document.setPlainText(e.attribute("text"));
+
+	//Add element to list of texts.
+	ElementTextItem *eti = new ElementTextItem(e.attribute("text"));
+	eti -> setFont(QETApp::diagramTextsFont(size));
+	eti -> setOriginalPos(QPointF(pos_x, pos_y));
+	eti -> setPos(pos_x, pos_y);
+	qreal original_rotation_angle = 0.0;
+	QET::attributeIsAReal(e, "rotation", &original_rotation_angle);
+	eti -> setOriginalRotationAngle(original_rotation_angle);
+	eti -> setRotationAngle(original_rotation_angle);
+	eti -> setFollowParentRotations(e.attribute("rotate") == "true");
+	list_texts_ << eti;
 	
 	// Se positionne aux coordonnees indiquees dans la description du texte	
 	qp.setTransform(QTransform(), false);
@@ -669,7 +681,7 @@
 	QAbstractTextDocumentLayout::PaintContext ctx;
 	ctx.palette.setColor(QPalette::Text, text_color);
 	text_document.documentLayout() -> draw(&qp, ctx);
-	
+
 	qp.restore();
 	return(true);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/