branchobj.cpp
changeset 688 d0086df58648
parent 682 16af22e2c155
child 721 12958f987bcf
     1.1 --- a/branchobj.cpp	Thu Apr 10 19:56:11 2008 +0000
     1.2 +++ b/branchobj.cpp	Mon May 05 13:46:42 2008 +0000
     1.3 @@ -1307,12 +1307,14 @@
     1.4  	qreal th = bboxTotal.height();	
     1.5  // TODO testing
     1.6  /*
     1.7 -	cout << "BO::alignRelTo "<<qPrintable (getHeading())<<endl;
     1.8 -	cout << "  d="<<depth<<
     1.9 +	QPointF pp; if (parObj) pp=parObj->getChildPos();
    1.10 +	cout << "BO::alignRelTo "<<qPrintable (getHeading());
    1.11 +	cout << "    d="<<depth<<
    1.12  		"  ref="<<ref<<
    1.13  //		"  bbox.topLeft="<<bboxTotal.topLeft()<<
    1.14  		"  absPos="<<absPos<<
    1.15  		"  relPos="<<relPos<<
    1.16 +		"  parPos="<<pp<<
    1.17  		"  orient="<<orientation<<
    1.18  //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.19  //		"  hidden="<<hidden<<
    1.20 @@ -1341,20 +1343,27 @@
    1.21      {
    1.22  		// Align myself depending on orientation and parent, but
    1.23  		// only if I am not a mainbranch or mapcenter itself
    1.24 -		LinkableMapObj::Orientation o;
    1.25 -		o=parObj->getOrientation();
    1.26 -		switch (orientation) 
    1.27 +
    1.28 +		if (anim.isAnimated())
    1.29  		{
    1.30 -			case LinkableMapObj::LeftOfCenter:
    1.31 -				move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
    1.32 -			break;
    1.33 -			case LinkableMapObj::RightOfCenter:	
    1.34 -				move (ref.x() , ref.y() + (th-bbox.height())/2  );
    1.35 -			break;
    1.36 -			default:
    1.37 -				qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
    1.38 -			break;
    1.39 -		}		
    1.40 +			move2RelPos(anim);
    1.41 +		} else
    1.42 +		{
    1.43 +			LinkableMapObj::Orientation o;
    1.44 +			o=parObj->getOrientation();
    1.45 +			switch (orientation) 
    1.46 +			{
    1.47 +				case LinkableMapObj::LeftOfCenter:
    1.48 +					move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
    1.49 +				break;
    1.50 +				case LinkableMapObj::RightOfCenter:	
    1.51 +					move (ref.x() , ref.y() + (th-bbox.height())/2  );
    1.52 +				break;
    1.53 +				default:
    1.54 +					qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
    1.55 +				break;
    1.56 +			}	
    1.57 +		}
    1.58      }		
    1.59  
    1.60  	if (scrolled) return;
    1.61 @@ -1592,9 +1601,15 @@
    1.62  	return mapEditor->getModel()->getSelectString (this);
    1.63  }
    1.64  
    1.65 -void BranchObj::animate()
    1.66 +void BranchObj::setAnimation(const AnimPoint &ap)
    1.67  {
    1.68 -	//relPos.animate();
    1.69 -	cout << "BO::animate  x,y="<<relPos.x()<<","<<relPos.y()<<endl;
    1.70 +	anim=ap;
    1.71  }
    1.72  
    1.73 +bool BranchObj::animate()
    1.74 +{
    1.75 +	anim.animate ();
    1.76 +	setRelPos (anim);
    1.77 +	return anim.isAnimated();
    1.78 +}
    1.79 +