linkablemapobj.cpp
branchqt4-port
changeset 17 557239819c45
parent 0 7a96bd401351
child 20 9ad3d0391be1
     1.1 --- a/linkablemapobj.cpp	Sun Jan 30 12:58:47 2005 +0000
     1.2 +++ b/linkablemapobj.cpp	Wed Aug 30 12:16:25 2006 +0000
     1.3 @@ -1,10 +1,12 @@
     1.4 -//#include <math.h>
     1.5 +#include <math.h>
     1.6  
     1.7  #include "linkablemapobj.h"
     1.8  #include "branchobj.h"
     1.9  #include "mapeditor.h"
    1.10  
    1.11  #include "version.h"
    1.12 +//Added by qt3to4:
    1.13 +#include <Q3PointArray>
    1.14  
    1.15  
    1.16  /////////////////////////////////////////////////////////////////
    1.17 @@ -17,7 +19,7 @@
    1.18      init ();
    1.19  }
    1.20  
    1.21 -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
    1.22 +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
    1.23  {
    1.24  //    cout << "Const LinkableMapObj\n";
    1.25      init ();
    1.26 @@ -62,6 +64,7 @@
    1.27  void LinkableMapObj::init ()
    1.28  {
    1.29      depth=-1;	
    1.30 +	mapEditor=NULL;
    1.31      childObj=NULL;
    1.32      parObj=NULL;
    1.33      parObjTmpBuf=NULL;
    1.34 @@ -76,35 +79,45 @@
    1.35  	linkpos=LinkBottom;
    1.36      segment.setAutoDelete (TRUE);
    1.37      arcsegs=13;
    1.38 -	QPointArray pa(arcsegs*2+2);
    1.39 +	Q3PointArray pa(arcsegs*2+2);
    1.40      
    1.41 -    bottomline=new QCanvasLine(canvas);
    1.42 +    bottomline=new Q3CanvasLine(canvas);
    1.43      bottomline->setPen( QPen(linkcolor, 1) );
    1.44      bottomline->setZ(Z_LINK);
    1.45      bottomline->show();
    1.46  
    1.47      // Prepare showing the selection of a MapObj
    1.48 -    selbox = new QCanvasRectangle (canvas);
    1.49 +    selbox = new Q3CanvasRectangle (canvas);
    1.50      selbox->setZ(Z_SELBOX);
    1.51      selbox->setBrush( QColor(255,255,0) );
    1.52      selbox->setPen( QPen(QColor(255,255,0) ));
    1.53      selbox->hide();
    1.54      selected=false;
    1.55  
    1.56 +	hideLinkUnselected=false;
    1.57 +
    1.58 +	topPad=botPad=leftPad=rightPad=0;
    1.59 +
    1.60  	// initialize frame
    1.61  	frame = new FrameObj (canvas);
    1.62  	
    1.63  	repositionRequest=false;
    1.64 +
    1.65 +	// Rel Positions
    1.66 +	relPos=QPoint(0,0);
    1.67 +	useRelPos=false;
    1.68 +	useOrientation=true;
    1.69  }
    1.70  
    1.71  void LinkableMapObj::copy (LinkableMapObj* other)
    1.72  {
    1.73      MapObj::copy(other);
    1.74  	bboxTotal=other->bboxTotal;
    1.75 -//    linkwidth=other->linkwidth;		
    1.76 -
    1.77      setLinkStyle(other->style);
    1.78      setLinkColor (other->linkcolor);
    1.79 +	relPos=other->relPos;
    1.80 +	useOrientation=other->useOrientation;
    1.81 +
    1.82  }
    1.83  
    1.84  void LinkableMapObj::setChildObj(LinkableMapObj* o)
    1.85 @@ -126,8 +139,57 @@
    1.86  {
    1.87  }
    1.88  
    1.89 +bool LinkableMapObj::hasParObjTmp()
    1.90 +{
    1.91 +	if (parObjTmpBuf) return true;
    1.92 +	return false;
    1.93 +}
    1.94 +
    1.95 +void LinkableMapObj::setUseRelPos (const bool &b)
    1.96 +{
    1.97 +	useRelPos=b;
    1.98 +}
    1.99 +
   1.100 +void LinkableMapObj::setRelPos()
   1.101 +{
   1.102 +	if (parObj)
   1.103 +	{	
   1.104 +		relPos.setX (absPos.x() - parObj->getChildPos().x() );
   1.105 +		relPos.setY (absPos.y() - parObj->getChildPos().y() );
   1.106 +
   1.107 +		parObj->calcBBoxSize();
   1.108 +		parObj->requestReposition();
   1.109 +	}	
   1.110 +}
   1.111 +
   1.112 +void LinkableMapObj::setRelPos(const QPoint &p)
   1.113 +{
   1.114 +	relPos=p;
   1.115 +	if (parObj)
   1.116 +	{	parObj->calcBBoxSize();
   1.117 +		parObj->requestReposition();
   1.118 +	}	
   1.119 +}
   1.120 +
   1.121 +int LinkableMapObj::getTopPad()
   1.122 +{
   1.123 +	return topPad;
   1.124 +}
   1.125 +
   1.126 +int LinkableMapObj::getLeftPad()
   1.127 +{
   1.128 +	return leftPad;
   1.129 +}
   1.130 +
   1.131 +int LinkableMapObj::getRightPad()
   1.132 +{
   1.133 +	return rightPad;
   1.134 +}
   1.135 +
   1.136  LinkStyle LinkableMapObj::getDefLinkStyle ()
   1.137  {
   1.138 +	if (!mapEditor) return StyleUndef;
   1.139 +
   1.140  	LinkStyle ls=mapEditor->getLinkStyle();
   1.141  	switch (ls)
   1.142  	{
   1.143 @@ -157,6 +219,7 @@
   1.144  
   1.145  void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
   1.146  {
   1.147 +	//if (newstyle=style) return;
   1.148  	delLink();
   1.149  		
   1.150  	style=newstyle;
   1.151 @@ -164,14 +227,14 @@
   1.152      if (childObj!=NULL && parObj != NULL)
   1.153      {
   1.154  		int i;
   1.155 -		QCanvasLine* cl;
   1.156 +		Q3CanvasLine* cl;
   1.157  		switch (style)
   1.158  		{
   1.159  			case StyleUndef:
   1.160  				bottomline->hide();
   1.161  				break;
   1.162  			case StyleLine: 
   1.163 -				l = new QCanvasLine(canvas);
   1.164 +				l = new Q3CanvasLine(canvas);
   1.165  				l->setPen( QPen(linkcolor, 1) );
   1.166  				l->setZ(Z_LINK);
   1.167  				if (visible)
   1.168 @@ -182,7 +245,7 @@
   1.169  			case StyleParabel:
   1.170  				for (i=0;i<arcsegs;i++)
   1.171  				{
   1.172 -					cl = new QCanvasLine(canvas);
   1.173 +					cl = new Q3CanvasLine(canvas);
   1.174  					cl->setPen( QPen(linkcolor, 1) );
   1.175  					cl->setPoints( 0,0,i*10,100);
   1.176  					cl->setZ(Z_LINK);
   1.177 @@ -195,7 +258,7 @@
   1.178  				pa0.resize (arcsegs+1);
   1.179  				break;
   1.180  			case StylePolyLine:	
   1.181 -				p = new QCanvasPolygon(canvas);
   1.182 +				p = new Q3CanvasPolygon(canvas);
   1.183  				p->setBrush( linkcolor );
   1.184  				p->setZ(Z_LINK);
   1.185  				if (visible)
   1.186 @@ -203,10 +266,9 @@
   1.187  				else
   1.188  					p->hide();
   1.189  				pa0.resize (3);
   1.190 -				// TODO
   1.191 -				// a bit awkward: draw the lines additionally to polygon, to avoid
   1.192 +				// TODO a bit awkward: draw the lines additionally to polygon, to avoid
   1.193  				// missing pixels, when polygon is extremly flat
   1.194 -				l = new QCanvasLine(canvas);
   1.195 +				l = new Q3CanvasLine(canvas);
   1.196  				l->setPen( QPen(linkcolor, 1) );
   1.197  				l->setZ(Z_LINK);
   1.198  				if (visible)
   1.199 @@ -215,7 +277,7 @@
   1.200  					l->hide();
   1.201  				break;
   1.202  			case StylePolyParabel:	
   1.203 -				p = new QCanvasPolygon(canvas);
   1.204 +				p = new Q3CanvasPolygon(canvas);
   1.205  				p->setBrush( linkcolor );
   1.206  				p->setZ(Z_LINK);
   1.207  				if (visible)
   1.208 @@ -226,13 +288,12 @@
   1.209  				pa1.resize (arcsegs+1);
   1.210  				pa2.resize (arcsegs+1);
   1.211  
   1.212 -				// TODO
   1.213 -				// a bit awkward: draw the lines additionally 
   1.214 +				// TODO a bit awkward: draw the lines additionally 
   1.215  				// to polygon, to avoid missing pixels, 
   1.216  				// if polygon is extremly flat
   1.217  				for (i=0;i<arcsegs;i++)
   1.218  				{
   1.219 -					cl = new QCanvasLine(canvas);
   1.220 +					cl = new Q3CanvasLine(canvas);
   1.221  					cl->setPen( QPen(linkcolor, 1) );
   1.222  					cl->setPoints( 0,0,i*10,100);
   1.223  					cl->setZ(Z_LINK);
   1.224 @@ -246,10 +307,7 @@
   1.225  			default: 
   1.226  				break;	
   1.227  		}	
   1.228 -	} else
   1.229 -	{
   1.230 -		cout << "Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n";
   1.231 -	}
   1.232 +	} 
   1.233  }
   1.234  
   1.235  LinkStyle LinkableMapObj::getLinkStyle()
   1.236 @@ -257,6 +315,18 @@
   1.237  	return style;
   1.238  }
   1.239  
   1.240 +void LinkableMapObj::setHideLinkUnselected(bool b)
   1.241 +{
   1.242 +	hideLinkUnselected=b;
   1.243 +	setVisibility (visible);
   1.244 +	updateLink();
   1.245 +}
   1.246 +
   1.247 +bool LinkableMapObj::getHideLinkUnselected()
   1.248 +{
   1.249 +	return hideLinkUnselected;
   1.250 +}
   1.251 +
   1.252  void LinkableMapObj::setLinkPos(LinkPos lp)
   1.253  {
   1.254  	linkpos=lp;
   1.255 @@ -272,14 +342,15 @@
   1.256  {
   1.257  	// Overloaded in BranchObj and childs
   1.258  	// here only set default color
   1.259 -	setLinkColor (mapEditor->getDefLinkColor());
   1.260 +	if (mapEditor)
   1.261 +		setLinkColor (mapEditor->getDefLinkColor());
   1.262  }
   1.263  
   1.264  void LinkableMapObj::setLinkColor(QColor col)
   1.265  {
   1.266  	linkcolor=col;
   1.267      bottomline->setPen( QPen(linkcolor, 1) );
   1.268 -	QCanvasLine *cl;
   1.269 +	Q3CanvasLine *cl;
   1.270  	switch (style)
   1.271  	{
   1.272  		case StyleLine:
   1.273 @@ -301,7 +372,6 @@
   1.274  		default:
   1.275  			break;
   1.276  	} // switch (style)	
   1.277 -	updateLink();
   1.278  }
   1.279  
   1.280  QColor LinkableMapObj::getLinkColor()
   1.281 @@ -332,32 +402,62 @@
   1.282  
   1.283  void LinkableMapObj::setVisibility (bool v)
   1.284  {
   1.285 +	Q3CanvasLine* cl;
   1.286  	MapObj::setVisibility (v);
   1.287 -	if (visible) 
   1.288 +	bool visnow=visible;
   1.289 +
   1.290 +	// We can hide the link, while object is not selected
   1.291 +	if (hideLinkUnselected && !selected)
   1.292 +		visnow=false;
   1.293 +
   1.294 +	if (visnow) 
   1.295  	{
   1.296  		bottomline->show();
   1.297 -		// FIXME lines and segments should be done in LMO?
   1.298 -		if (style==StyleLine && l) 
   1.299 +		switch (style)
   1.300  		{
   1.301 -			l->show();
   1.302 -		} else
   1.303 -		{
   1.304 -			QCanvasLine* cl;
   1.305 -			for (cl=segment.first(); cl; cl=segment.next() )
   1.306 -				cl->show();
   1.307 -		} 
   1.308 +			case StyleLine:
   1.309 +				if (l) l->show();
   1.310 +				break;
   1.311 +			case StyleParabel:	
   1.312 +				for (cl=segment.first(); cl; cl=segment.next() )
   1.313 +					cl->show();
   1.314 +				break;	
   1.315 +			case StylePolyLine:
   1.316 +				if (p) p->show();
   1.317 +				if (l) l->show();
   1.318 +				break;
   1.319 +			case StylePolyParabel:	
   1.320 +				for (cl=segment.first(); cl; cl=segment.next() )
   1.321 +					cl->show();
   1.322 +				if (p) p->show();
   1.323 +				break;
   1.324 +			default:
   1.325 +				break;
   1.326 +		}
   1.327  	} else 
   1.328  	{
   1.329  		bottomline->hide();
   1.330 -		if (style==StyleLine && l) 
   1.331 +		switch (style)
   1.332  		{
   1.333 -			l->hide();
   1.334 -		} else
   1.335 -		{
   1.336 -			QCanvasLine* cl;
   1.337 -			for (cl=segment.first(); cl; cl=segment.next() )
   1.338 -				cl->hide();
   1.339 -		} 
   1.340 +			case StyleLine:
   1.341 +				if (l) l->hide();
   1.342 +				break;
   1.343 +			case StyleParabel:	
   1.344 +				for (cl=segment.first(); cl; cl=segment.next() )
   1.345 +					cl->hide();
   1.346 +				break;	
   1.347 +			case StylePolyLine:
   1.348 +				if (p) p->hide();
   1.349 +				if (l) l->hide();
   1.350 +				break;
   1.351 +			case StylePolyParabel:	
   1.352 +				for (cl=segment.first(); cl; cl=segment.next() )
   1.353 +					cl->hide();
   1.354 +				if (p) p->hide();
   1.355 +				break;
   1.356 +			default:
   1.357 +				break;
   1.358 +		}
   1.359  	}	
   1.360  }
   1.361  
   1.362 @@ -370,12 +470,11 @@
   1.363      // 
   1.364      // sets:
   1.365      //	orientation
   1.366 -    //	childPos
   1.367 -    //	parPos
   1.368 -	//  offset
   1.369 +    //	childPos	(by calling setDockPos())
   1.370 +    //	parPos		(by calling setDockPos())
   1.371 +	//  bottomlineY
   1.372      //	drawing of the link itself
   1.373  
   1.374 -
   1.375  	// updateLink is called from move, but called from constructor we don't
   1.376  	// have parents yet...
   1.377  	if (style==StyleUndef) return;	
   1.378 @@ -387,10 +486,10 @@
   1.379  	switch (linkpos)
   1.380  	{
   1.381  		case LinkMiddle:
   1.382 -			offset=bbox.height() /2;
   1.383 +			bottomlineY=bbox.top()+bbox.height() /2;	// draw link to middle (of frame)
   1.384  			break;
   1.385  		default :
   1.386 -			offset=bbox.height()-1;			// draw link to bottom of bbox
   1.387 +			bottomlineY=bbox.bottom()-1;	// draw link to bottom of box
   1.388  			break;
   1.389  	}
   1.390  	
   1.391 @@ -431,23 +530,7 @@
   1.392  		reposition();
   1.393  	}
   1.394  	
   1.395 -    if (orientation==OrientLeftOfCenter )
   1.396 -    {
   1.397 -		childPos=QPoint (absPos.x(),absPos.y()+offset);
   1.398 -		parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
   1.399 -    } else
   1.400 -    {
   1.401 -		childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); 
   1.402 -		parPos=QPoint (absPos.x(),absPos.y()+offset);
   1.403 -    }
   1.404 -	/* FIXME
   1.405 -		cout << "      LMO::updateLink   absPos="<<absPos<<endl;
   1.406 -		cout << "      LMO::updateLink childPos="<<childPos<<endl;
   1.407 -		cout << "      LMO::updateLink   parPos="<<parPos<<endl;
   1.408 -		cout << "      LMO::updateLink   offset="<<offset<<endl;
   1.409 -		cout << "      LMO::updateLink   bbox.w="<<bbox.width()<<endl;
   1.410 -		cout << "      LMO::updateLink   bbox.h="<<bbox.height()<<endl;
   1.411 -	*/	
   1.412 +	setDockPos();
   1.413  
   1.414  	double p1x=parPos.x();	// Link is drawn from P1 to P2
   1.415  	double p1y=parPos.y();
   1.416 @@ -456,10 +539,10 @@
   1.417  	double vy=p2y - p1y;
   1.418  
   1.419  	// Draw the horizontal line below heading (from ChildPos to ParPos)
   1.420 -	bottomline->setPoints (lrint(childPos.x()),
   1.421 -		lrint(childPos.y()),
   1.422 -		lrint(p1x),
   1.423 -		lrint(p1y) );
   1.424 +	bottomline->setPoints (qRound(childPos.x()),
   1.425 +		qRound(childPos.y()),
   1.426 +		qRound(p1x),
   1.427 +		qRound(p1y) );
   1.428  
   1.429  	double a;	// angle
   1.430  	if (vx > -0.000001 && vx < 0.000001)
   1.431 @@ -467,9 +550,9 @@
   1.432  	else
   1.433  		a=atan( vy / vx );
   1.434  	// "turning point" for drawing polygonal links
   1.435 -	QPoint tp (-lrint(sin (a)*thickness_start), lrint(cos (a)*thickness_start));	
   1.436 +	QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));	
   1.437  	
   1.438 -	QCanvasLine *cl;
   1.439 +	Q3CanvasLine *cl;
   1.440  
   1.441  	int i;
   1.442  
   1.443 @@ -477,10 +560,10 @@
   1.444  	switch (style)
   1.445  	{
   1.446  		case StyleLine:
   1.447 -			l->setPoints( lrint (parPos.x()),
   1.448 -				lrint(parPos.y()),
   1.449 -				lrint(p2x),
   1.450 -				lrint(p2y) );
   1.451 +			l->setPoints( qRound (parPos.x()),
   1.452 +				qRound(parPos.y()),
   1.453 +				qRound(p2x),
   1.454 +				qRound(p2y) );
   1.455  			break;	
   1.456  		case StyleParabel:	
   1.457  			parabel (pa0, p1x,p1y,p2x,p2y);
   1.458 @@ -492,15 +575,15 @@
   1.459  			}
   1.460  			break;
   1.461  		case StylePolyLine:
   1.462 -			pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
   1.463 -			pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
   1.464 -			pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
   1.465 +			pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
   1.466 +			pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
   1.467 +			pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
   1.468  			p->setPoints (pa0);
   1.469  			// here too, draw line to avoid missing pixels
   1.470 -			l->setPoints( lrint (parPos.x()),
   1.471 -				lrint(parPos.y()),
   1.472 -				lrint(p2x),
   1.473 -				lrint(p2y) );
   1.474 +			l->setPoints( qRound (parPos.x()),
   1.475 +				qRound(parPos.y()),
   1.476 +				qRound(p2x),
   1.477 +				qRound(p2y) );
   1.478  			break;
   1.479  		case StylePolyParabel:	
   1.480  			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
   1.481 @@ -534,6 +617,44 @@
   1.482      return parObj;
   1.483  }
   1.484  
   1.485 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
   1.486 +{
   1.487 +	LinkableMapObj *lmo=this;
   1.488 +	QString part;
   1.489 +	QString typ;
   1.490 +	QString num;
   1.491 +	while (!s.isEmpty() )
   1.492 +	{
   1.493 +		part=s.section(",",0,0);
   1.494 +		typ=part.left (3);
   1.495 +		num=part.right(part.length() - 3);
   1.496 +		if (typ=="mc:")
   1.497 +		{
   1.498 +			if (depth>0)
   1.499 +				return false;	// in a subtree there is no center
   1.500 +			else
   1.501 +				break;
   1.502 +		} else
   1.503 +			if (typ=="bo:")
   1.504 +				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
   1.505 +			else
   1.506 +				if (typ=="fi:")
   1.507 +					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
   1.508 +		if (!lmo) break;
   1.509 +		
   1.510 +		if (s.contains(","))
   1.511 +			s=s.right(s.length() - part.length() -1 );
   1.512 +		else	
   1.513 +			break;
   1.514 +	}
   1.515 +	return lmo;
   1.516 +}
   1.517 +
   1.518 +void LinkableMapObj::setDockPos()
   1.519 +{
   1.520 +	cout <<"LMO::setDockPos()\n";
   1.521 +}
   1.522 +
   1.523  QPoint LinkableMapObj::getChildPos()
   1.524  {
   1.525      return childPos;
   1.526 @@ -546,11 +667,26 @@
   1.527  
   1.528  QPoint LinkableMapObj::getRelPos()
   1.529  {
   1.530 +	return relPos;
   1.531 +/* FIXME not needed? relPos was moved in 1.7.10 from
   1.532 +   floatobj to linkablemapobj. Before we had:
   1.533 +	
   1.534  	if (!parObj) return QPoint (0,0);
   1.535      return QPoint(
   1.536  		absPos.x() - parObj->x(),
   1.537  		absPos.y() - parObj->y()
   1.538  	);
   1.539 +*/	
   1.540 +}
   1.541 +
   1.542 +
   1.543 +void LinkableMapObj::setUseOrientation (const bool &b)
   1.544 +{	
   1.545 +	if (useOrientation!=b)
   1.546 +	{
   1.547 +		useOrientation=b;
   1.548 +		requestReposition();
   1.549 +	}	
   1.550  }
   1.551  
   1.552  LinkOrient LinkableMapObj::getOrientation()
   1.553 @@ -583,11 +719,12 @@
   1.554  
   1.555  void LinkableMapObj::alignRelativeTo (QPoint ref)
   1.556  {
   1.557 +	// FIXME testing, seems not to be used right now...
   1.558 +	cout << "LMO::alignRelTo   ref="<<ref<<endl;
   1.559  }
   1.560  
   1.561  void LinkableMapObj::reposition()
   1.562  {
   1.563 -cout << "LMO::reposition  ???"<<endl;
   1.564  	if (depth==0)
   1.565  	{
   1.566  		// only calculate the sizes once. If the deepest LMO changes its height,
   1.567 @@ -626,14 +763,15 @@
   1.568  	// we want to block expensive repositioning, but just do it once at
   1.569  	// the end, thus check first:
   1.570  
   1.571 -	if (mapEditor->blockReposition()) return;
   1.572 +	if (mapEditor->isRepositionBlocked()) return;
   1.573  	
   1.574  	// Pass on the request to parental objects, if this hasn't been done yet
   1.575  	
   1.576  	if (parObj) 
   1.577  		parObj->forceReposition(); 
   1.578  	else 
   1.579 -		reposition(); }
   1.580 +		reposition(); 
   1.581 +}
   1.582  
   1.583  bool LinkableMapObj::repositionRequested()
   1.584  {
   1.585 @@ -643,9 +781,9 @@
   1.586  
   1.587  void LinkableMapObj::setSelBox()
   1.588  {
   1.589 -    selbox->setX (bbox.x() );
   1.590 -    selbox->setY (bbox.y() );
   1.591 -    selbox->setSize (bbox.width(), bbox.height() );
   1.592 +    selbox->setX (clickBox.x() );
   1.593 +    selbox->setY (clickBox.y() );
   1.594 +    selbox->setSize (clickBox.width(), clickBox.height() );
   1.595  }
   1.596  
   1.597  void LinkableMapObj::select()
   1.598 @@ -653,6 +791,8 @@
   1.599  	setSelBox();
   1.600      selected=true;
   1.601      selbox->show();
   1.602 +// FIXME not needed?	
   1.603 +	setVisibility (visible);
   1.604  }
   1.605  
   1.606  
   1.607 @@ -660,9 +800,11 @@
   1.608  {
   1.609      selected=false;
   1.610      selbox->hide();
   1.611 +	// Maybe we have to hide the link:
   1.612 +	setVisibility (visible);
   1.613  }
   1.614  
   1.615 -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
   1.616 +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
   1.617  
   1.618  {
   1.619  	double vx=p2x - p1x;	// V=P2-P1
   1.620 @@ -680,14 +822,22 @@
   1.621  		m=(vy / (vx*vx));
   1.622  	dx=vx/(arcsegs);
   1.623  	int i;
   1.624 -	ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
   1.625 +	ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
   1.626  	for (i=1;i<=arcsegs;i++)
   1.627  	{	
   1.628  		pnx=p1x+dx;
   1.629  		pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
   1.630 -		ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
   1.631 +		ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
   1.632  		p1x=pnx;
   1.633  		p1y=pny;
   1.634  	}	
   1.635  }
   1.636  
   1.637 +QString LinkableMapObj::getLinkAttr ()
   1.638 +{
   1.639 +	if (hideLinkUnselected)
   1.640 +		return attribut ("hideLink","true");
   1.641 +	else
   1.642 +		return attribut ("hideLink","false");
   1.643 +	
   1.644 +}