From 777aad1f889cc3fe09e75a5dfaf46919076f117c Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 29 Jul 2005 08:06:41 +0000 Subject: [PATCH] Improve Actors auto-arrangement --- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 509694ec..3f9c440b 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -278,7 +278,7 @@ void ArrangeDlg::acceptAnimation() FieldData& aData = myAnimator->getFieldData(0); if (aData.myPrs.empty()) myAnimator->generatePresentations(0); - VISU_Actor* aActor = aActor = aData.myPrs[0]->CreateActor(); + VISU_Actor* aActor = aData.myPrs[0]->CreateActor(); float aBounds[6]; aActor->GetBounds(aBounds); aActor->Delete(); @@ -337,7 +337,8 @@ void ArrangeDlg::acceptViewWindow() for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it) { VISU::Prs3d_i* aPrs = it.key(); Offset& aOffs = myOffsets[it.data()]; - if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow)) anActor->SetPosition(aOffs.myOffset); + if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow)) + anActor->SetPosition(aOffs.myOffset); if (mySaveChk) if (mySaveChk->isChecked()) aPrs->SetOffset(aOffs.myOffset); @@ -347,14 +348,12 @@ void ArrangeDlg::acceptViewWindow() float aShift = 0; float aPrevDist = 0; float aPrevShift = 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 = VISU::GetActor(aPrs, myViewWindow)){ + if (VISU_Actor* aActor = VISU::GetActor(aPrs, myViewWindow)) { int aAxis = getAxis(); - // if (aInit) { float aBounds[6]; aActor->GetBounds(aBounds); switch (aAxis) { @@ -367,10 +366,10 @@ void ArrangeDlg::acceptViewWindow() case ZAxis: aDist = fabs(aBounds[5] - aBounds[4]); } - // aInit = false; - // } float aOffset[3]; - aOffset[0] = aOffset[1] = aOffset[2] = 0; + aOffset[0] = (aBounds[1] < aBounds[0]) ? -aBounds[1] : -aBounds[0]; + aOffset[1] = (aBounds[3] < aBounds[2]) ? -aBounds[3] : -aBounds[2]; + aOffset[2] = (aBounds[5] < aBounds[4]) ? -aBounds[5] : -aBounds[4]; if (i > 0) { float aCCDist = (aDist + aPrevDist) / 2.0; @@ -409,7 +408,7 @@ void ArrangeDlg::acceptViewWindow() aShift = aPrevShift + aPrevDist/2.0 + aCCDist*getDistance() - aDist/2.0; } - aOffset[aAxis] = aShift; + aOffset[aAxis] += aShift; aActor->SetPosition(aOffset); if (mySaveChk) if (mySaveChk->isChecked()) -- 2.39.2