linkablemapobj.cpp
changeset 218 160459d924a1
parent 175 728f51b71e71
child 225 d5c70aaca22d
     1.1 --- a/linkablemapobj.cpp	Tue Feb 21 16:18:23 2006 +0000
     1.2 +++ b/linkablemapobj.cpp	Thu Feb 23 08:37:39 2006 +0000
     1.3 @@ -100,6 +100,10 @@
     1.4  	frame = new FrameObj (canvas);
     1.5  	
     1.6  	repositionRequest=false;
     1.7 +
     1.8 +	// Rel Positions
     1.9 +	relPos=QPoint(0,0);
    1.10 +	useOrientation=true;
    1.11  }
    1.12  
    1.13  void LinkableMapObj::copy (LinkableMapObj* other)
    1.14 @@ -108,6 +112,9 @@
    1.15  	bboxTotal=other->bboxTotal;
    1.16      setLinkStyle(other->style);
    1.17      setLinkColor (other->linkcolor);
    1.18 +	relPos=other->relPos;
    1.19 +	useOrientation=other->useOrientation;
    1.20 +
    1.21  }
    1.22  
    1.23  void LinkableMapObj::setChildObj(LinkableMapObj* o)
    1.24 @@ -135,6 +142,39 @@
    1.25  	return false;
    1.26  }
    1.27  
    1.28 +void LinkableMapObj::setUseRelPos (const bool &b)
    1.29 +{
    1.30 +	useRelPos=b;
    1.31 +}
    1.32 +
    1.33 +void LinkableMapObj::setRelPos()
    1.34 +{
    1.35 +	if (useOrientation)
    1.36 +	{
    1.37 +		if (parObj->getOrientation()==OrientLeftOfCenter)
    1.38 +			relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
    1.39 +		else	
    1.40 +			relPos.setX (absPos.x() - parObj->x() );
    1.41 +	}
    1.42 +	else
    1.43 +		relPos.setX (absPos.x() - parObj->x() );
    1.44 +	relPos.setY (absPos.y() - parObj->y() );
    1.45 +	if (parObj)
    1.46 +	{	
    1.47 +		parObj->calcBBoxSize();
    1.48 +		parObj->requestReposition();
    1.49 +	}	
    1.50 +}
    1.51 +
    1.52 +void LinkableMapObj::setRelPos(const QPoint &p)
    1.53 +{
    1.54 +	relPos=p;
    1.55 +	if (parObj)
    1.56 +	{	parObj->calcBBoxSize();
    1.57 +		parObj->requestReposition();
    1.58 +	}	
    1.59 +}
    1.60 +
    1.61  int LinkableMapObj::getTopPad()
    1.62  {
    1.63  	return topPad;
    1.64 @@ -640,6 +680,16 @@
    1.65  	);
    1.66  }
    1.67  
    1.68 +
    1.69 +void LinkableMapObj::setUseOrientation (const bool &b)
    1.70 +{	
    1.71 +	if (useOrientation!=b)
    1.72 +	{
    1.73 +		useOrientation=b;
    1.74 +		requestReposition();
    1.75 +	}	
    1.76 +}
    1.77 +
    1.78  LinkOrient LinkableMapObj::getOrientation()
    1.79  {
    1.80      return orientation;