linkablemapobj.cpp
changeset 104 270593ab83b2
parent 97 0b048b6bb6f4
child 106 4083860dd82e
     1.1 --- a/linkablemapobj.cpp	Mon May 23 15:28:20 2005 +0000
     1.2 +++ b/linkablemapobj.cpp	Mon May 30 05:39:10 2005 +0000
     1.3 @@ -1,5 +1,3 @@
     1.4 -#include <cmath>
     1.5 -
     1.6  #include "linkablemapobj.h"
     1.7  #include "branchobj.h"
     1.8  #include "mapeditor.h"
     1.9 @@ -449,10 +447,10 @@
    1.10  	double vy=p2y - p1y;
    1.11  
    1.12  	// Draw the horizontal line below heading (from ChildPos to ParPos)
    1.13 -	bottomline->setPoints (lrint(childPos.x()),
    1.14 -		lrint(childPos.y()),
    1.15 -		lrint(p1x),
    1.16 -		lrint(p1y) );
    1.17 +	bottomline->setPoints (qRound(childPos.x()),
    1.18 +		qRound(childPos.y()),
    1.19 +		qRound(p1x),
    1.20 +		qRound(p1y) );
    1.21  
    1.22  	double a;	// angle
    1.23  	if (vx > -0.000001 && vx < 0.000001)
    1.24 @@ -460,7 +458,7 @@
    1.25  	else
    1.26  		a=atan( vy / vx );
    1.27  	// "turning point" for drawing polygonal links
    1.28 -	QPoint tp (-lrint(sin (a)*thickness_start), lrint(cos (a)*thickness_start));	
    1.29 +	QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));	
    1.30  	
    1.31  	QCanvasLine *cl;
    1.32  
    1.33 @@ -470,10 +468,10 @@
    1.34  	switch (style)
    1.35  	{
    1.36  		case StyleLine:
    1.37 -			l->setPoints( lrint (parPos.x()),
    1.38 -				lrint(parPos.y()),
    1.39 -				lrint(p2x),
    1.40 -				lrint(p2y) );
    1.41 +			l->setPoints( qRound (parPos.x()),
    1.42 +				qRound(parPos.y()),
    1.43 +				qRound(p2x),
    1.44 +				qRound(p2y) );
    1.45  			break;	
    1.46  		case StyleParabel:	
    1.47  			parabel (pa0, p1x,p1y,p2x,p2y);
    1.48 @@ -485,15 +483,15 @@
    1.49  			}
    1.50  			break;
    1.51  		case StylePolyLine:
    1.52 -			pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
    1.53 -			pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
    1.54 -			pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
    1.55 +			pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
    1.56 +			pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
    1.57 +			pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
    1.58  			p->setPoints (pa0);
    1.59  			// here too, draw line to avoid missing pixels
    1.60 -			l->setPoints( lrint (parPos.x()),
    1.61 -				lrint(parPos.y()),
    1.62 -				lrint(p2x),
    1.63 -				lrint(p2y) );
    1.64 +			l->setPoints( qRound (parPos.x()),
    1.65 +				qRound(parPos.y()),
    1.66 +				qRound(p2x),
    1.67 +				qRound(p2y) );
    1.68  			break;
    1.69  		case StylePolyParabel:	
    1.70  			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
    1.71 @@ -709,12 +707,12 @@
    1.72  		m=(vy / (vx*vx));
    1.73  	dx=vx/(arcsegs);
    1.74  	int i;
    1.75 -	ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
    1.76 +	ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
    1.77  	for (i=1;i<=arcsegs;i++)
    1.78  	{	
    1.79  		pnx=p1x+dx;
    1.80  		pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
    1.81 -		ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
    1.82 +		ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
    1.83  		p1x=pnx;
    1.84  		p1y=pny;
    1.85  	}