From 15c30e8d5b7ddbc64d29a877f68079e40726348b Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 30 May 2005 09:40:50 +0000 Subject: [PATCH] Bug 8918: Arrange actors --- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 39 +++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index e734aea3..b3845e82 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -322,36 +322,41 @@ void ArrangeDlg::acceptViewWindow() } } else { float aDist = 0; - bool aInit = true; + float aShift = 0; + float aPrevDist = 0; + // bool aInit = true; int i; QMap::Iterator it; for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) { VISU::Prs3d_i* aPrs = it.key(); if (VISU_Actor* aActor = VisuGUI::GetActor(aPrs, myViewFrame)){ int aAxis = getAxis(); - if (aInit) { - float aBounds[6]; - aActor->GetBounds(aBounds); - switch (aAxis) { - case XAxis: - aDist = fabs(aBounds[1] - aBounds[0]); - break; - case YAxis: - aDist = fabs(aBounds[3] - aBounds[2]); - break; - case ZAxis: - aDist = fabs(aBounds[5] - aBounds[4]); - } - aDist = aDist*getDistance(); - aInit = false; + // if (aInit) { + float aBounds[6]; + aActor->GetBounds(aBounds); + switch (aAxis) { + case XAxis: + aDist = fabs(aBounds[1] - aBounds[0]); + break; + case YAxis: + aDist = fabs(aBounds[3] - aBounds[2]); + break; + case ZAxis: + aDist = fabs(aBounds[5] - aBounds[4]); } + // aInit = false; + // } float aOffset[3]; aOffset[0] = aOffset[1] = aOffset[2] = 0; - aOffset[aAxis] = aDist * i; + + aShift = (i == 0)? 0 : aShift + (aDist + aPrevDist) * getDistance() / 2; + + aOffset[aAxis] = aShift; aActor->SetPosition(aOffset); if (mySaveChk) if (mySaveChk->isChecked()) aPrs->SetOffset(aOffset); + aPrevDist = aDist; } } } -- 2.39.2