vtkActorCollection *aCollection = myViewWindow->getRenderer()->GetActors();
aCollection->InitTraversal();
while(vtkActor* anActor = aCollection->GetNextActor()){
- if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+ if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor)) {
if(anVISUActor->GetVisibility() != 0){
if (VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d()){
if(!myPrsMap.contains(aPrs)){
}
}
}
- }
+ }
}
+ } else { //if PointMap3d Actor
+ if (VISU_ActorBase* anActorBase = dynamic_cast<VISU_ActorBase*>(anActor))
+ if(anActorBase->GetVisibility() != 0)
+ if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anActorBase->GetFactory())) {
+ if(!myPointMapPrsMap.contains(aPrs)){
+ Handle(SALOME_InteractiveObject) anIO = aPrs->GetIO();
+ if(!anIO->hasEntry())
+ continue;
+ SalomeApp_Study* aStudy = VISU::GetAppStudy(theModule);
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anIO->getEntry());
+ if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName(anAttr);
+ QString strIn(aName->Value().c_str());
+ aPrsNames.append(strIn);
+ myPointMapPrsMap[aPrs] = myOffsets.count();
+ Offset aOffs;
+ anActorBase->GetPosition(aOffs.myOffset);
+ myOffsets.append(aOffs);
+ }
+ }
+ }
+ }
+ }
}
myFieldLst->insertStringList(aPrsNames);
myFieldLst->setSelected(0, true);
if (mySaveChk->isChecked())
aPrs->SetOffset(aOffs.myOffset[0],aOffs.myOffset[1],aOffs.myOffset[2]);
}
+ QMap<VISU::PointMap3d_i*, int>::Iterator itt;
+ for (itt = myPointMapPrsMap.begin(); itt != myPointMapPrsMap.end(); ++itt) {
+ VISU::PointMap3d_i* aPrs = itt.key();
+ Offset& aOffs = myOffsets[itt.data()];
+ if (VISU_ActorBase* anActor = VISU::FindActorBase(myViewWindow, aPrs))
+ anActor->SetPosition(aOffs.myOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffs.myOffset[0],aOffs.myOffset[1],aOffs.myOffset[2]);
+ }
} else {
vtkFloatingPointType aDist = 0;
vtkFloatingPointType aShift = 0;
vtkFloatingPointType aPrevDist = 0;
vtkFloatingPointType aPrevShift = 0;
- int i;
+ int i = 0;
QMap<VISU::Prs3d_i*, int>::Iterator it;
- for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) {
+ for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it, i++) {
VISU::Prs3d_i* aPrs = it.key();
if (VISU_Actor* aActor = VISU::FindActor(myViewWindow, aPrs)) {
int aAxis = getAxis();
aPrevDist = aDist;
aPrevShift = aShift;
}
- }
+ } // end of myPrsMap loop
+ // Loop in PointMap3D the same as previous loop
+ QMap<VISU::PointMap3d_i*, int>::Iterator itt;
+ for (itt = myPointMapPrsMap.begin(); itt != myPointMapPrsMap.end(); ++itt, i++) {
+ VISU::PointMap3d_i* aPrs = itt.key();
+ if (VISU_ActorBase* aActor = VISU::FindActorBase(myViewWindow, aPrs)) {
+ int aAxis = getAxis();
+
+ vtkFloatingPointType aZeroOffset[3];
+ aZeroOffset[0] = aZeroOffset[1] = aZeroOffset[2] = 0;
+ aActor->SetPosition(aZeroOffset);
+ aActor->GetMapper()->Update();
+
+ vtkFloatingPointType 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]);
+ }
+ vtkFloatingPointType aOffset[3];
+ aOffset[0] = aOffset[1] = aOffset[2] = 0;
+ aOffset[aAxis] =
+ (aBounds[2*aAxis+1] < aBounds[2*aAxis]) ? -aBounds[2*aAxis+1] : -aBounds[2*aAxis];
+
+ if (i > 0) {
+ vtkFloatingPointType aCCDist = (aDist + aPrevDist) / 2.0;
+
+ vtkFloatingPointType dx = fabs(aBounds[1] - aBounds[0]);
+ vtkFloatingPointType dy = fabs(aBounds[3] - aBounds[2]);
+ vtkFloatingPointType dz = fabs(aBounds[5] - aBounds[4]);
+ vtkFloatingPointType max = (dx > dy) ? dx : dy;
+ max = (dz > max) ? dz : max;
+ max /= 100.0;
+
+ if (aCCDist < max) {
+ // set base distance between centers of bounding boxes
+ // to minimal (but big enough) size of current bounding box
+ if (dx < max) dx = FLT_MAX;
+ if (dy < max) dy = FLT_MAX;
+ if (dz < max) dz = FLT_MAX;
+
+ aCCDist = (dx < dy) ? dx : dy;
+ aCCDist = (dz < aCCDist) ? dz : aCCDist;
+ }
+ aShift = aPrevShift + aPrevDist/2.0 + aCCDist*getDistance() - aDist/2.0;
+ }
+
+ aOffset[aAxis] += aShift;
+ aActor->SetPosition(aOffset);
+ if (mySaveChk)
+ if (mySaveChk->isChecked())
+ aPrs->SetOffset(aOffset[0],aOffset[1],aOffset[2]);
+
+ aPrevDist = aDist;
+ aPrevShift = aShift;
+ }
+ } // end of myPointMapPrsMap loop
+
}
myViewWindow->getRenderer()->ResetCameraClippingRange();
myViewWindow->Repaint();