[qet] [3362] dxfTOelmt ellipse center point fixed

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


Revision: 3362
Author:   rdsivd
Date:     2014-10-07 00:06:26 +0200 (Tue, 07 Oct 2014)
Log Message:
-----------
dxfTOelmt ellipse center point fixed

Modified Paths:
--------------
    branches/dxftoelmt/src/ui/dxf_ellipse.cpp

Modified: branches/dxftoelmt/src/ui/dxf_ellipse.cpp
===================================================================
--- branches/dxftoelmt/src/ui/dxf_ellipse.cpp	2014-10-06 21:02:59 UTC (rev 3361)
+++ branches/dxftoelmt/src/ui/dxf_ellipse.cpp	2014-10-06 22:06:26 UTC (rev 3362)
@@ -30,6 +30,7 @@
 	double ratio_of_minor;
 	double start;
 	double end;
+	double end2;
 
 	double begin1;
 	double einde1;
@@ -39,8 +40,27 @@
 
 	double hoek;
 
+	double width;
+	double height;
 
+	double N;
+	double O;
+	double J;
+	double K;
+	double L;
+	double M;
+	double R;
+	double S;
+	double T;
+	double U;
+	double V;
+	double W;
+	double hoek2;
 
+
+
+
+
 	for (x=0;x<Counter;x++)
 	{
 		if (LineTable4[x].Line1.contains(" 10", Qt::CaseSensitive) )
@@ -73,6 +93,7 @@
 		if (LineTable4[x].Line1.contains(" 42", Qt::CaseSensitive))
 		{
 			end=LineTable4[x].Line2.toDouble();
+			//end=2*end2;
 		}
 
 
@@ -99,23 +120,136 @@
 	LineStyle1= Check_LineType.Check_LType(LTypeDXF, LayerDXF);
 
 
-	begin=start-90;
-	hoek=end-begin;
+	begin=start+270;
+	hoek=-end;
 
+	/* hoek ACAD omrekenen naar QET */
 
 
+	/*begin1=450-start;
+	einde1=450-end;
+
+
+	if (begin1>360)
+	{
+		begin=begin1-360;
+	}
+	else
+	{
+		if(begin1<0)
+		{
+			begin=360-begin1;
+		}
+		else
+		{
+			begin=begin1;
+		}
+	}
+
+	if (einde1>360)
+	{
+		einde=einde1-360;
+	}
+	else
+	{
+		if (einde1<0)
+		{
+			einde=einde1-360;
+		}
+		else
+		{
+			einde=einde1;
+		}
+	}*/
+
+
+
+	/* calculate hoek */
+
+	/*if (begin>einde)
+	{
+		N=einde-begin;
+	}
+	else
+	{
+		N=einde-begin-360;
+	}
+
+	if (N<0)
+	{
+		O=-N;
+	}
+	else
+	{
+		O=N;
+	}
+
+	J=end-start+N;
+	K=360-end;
+	L=360-start;
+	M=K-L;
+	R=-O;
+	S=J-O;
+
+	if (S < -360)
+	{
+		T=S+360;
+	}
+	else
+	{
+		T=S;
+	}
+
+	if (begin<einde)
+	{
+		U=M;
+	}
+	else
+	{
+		U=T;
+	}
+
+	if (U<0)
+	{
+		V=-U;
+	}
+	else
+	{
+		V=U;
+	}
+
+	W=U+V;
+
+	if (W==0)
+	{
+		hoek2=-V;
+	}
+	else
+	{
+		hoek2=T;
+	}
+
+	hoek=hoek2;*/
+
 	//<arc x="27.00" y="5.40" antialias="false" width="4.20" height="4.20" style="line-style:normal;line-weight:thin;filling:none;color:black" start="30" angle="299" />
 
-	x_center=QString::number ((center_x ),'f',2);
-	y_center=QString::number ((center_y ),'f',2);
+	width=2*(sqrt(pow((major_radius_x-center_x),2)-pow((major_radius_y-center_y),2)));
+	height=2*(sqrt(pow((major_radius_x-center_x),2)-pow((major_radius_y-center_y),2)) *ratio_of_minor);
 
 
+	x_center=QString::number ((center_x-(width/2) ),'f',2);
+	y_center=QString::number ((center_y-(height/2) ),'f',2);
 
-	breedte=QString::number (2*(sqrt(pow((major_radius_x-center_x),2)-pow((major_radius_y-center_y),2))),'f',2);
-	hoogte=QString::number (2*(sqrt(pow((major_radius_x-center_x),2)-pow((major_radius_y-center_y),2)) *ratio_of_minor) ,'f',2);
+
+
+	breedte=QString::number (width,'f',2);
+	hoogte=QString::number (height ,'f',2);
 	BeginHoek=QString::number ((begin ),'f',0);
 	Hoek2=QString::number ((hoek),'f',0);
 
+
+
+
 	Lineout="   ";
 	Lineout.append("   ");
 	Lineout.append("   ");


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