From: vsv Date: Mon, 30 May 2005 09:40:50 +0000 (+0000) Subject: Bug 8918: Arrange actors X-Git-Tag: JFA_MERGE_TO_3_0_0__2005-07-07~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=15c30e8d5b7ddbc64d29a877f68079e40726348b;p=modules%2Fvisu.git Bug 8918: Arrange actors --- 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; } } }