}
else if ( selMode == homoPresentations ) {
if (isVTKViewer) {
+ if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) )
+ thePopup->insertItem("Translate...", visuGUI, SLOT(TranslatePrs()));
thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
thePopup->insertSeparator();
{
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs");
- CORBA::Object_var anObject = GetSelectedObj();
+ VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg();
+
+ SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+ SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
+ SALOME_ListIteratorOfListIO It ( Sel->StoredIObjects() );
+ for ( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ if ( anIO->hasEntry() ) {
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
+ if ( !aSObject->_is_nil() ) {
+ CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
+ if ( !CORBA::is_nil( aCORBAObject ) ) {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
+ aDlg->addPresentation(aPrsObject);
+ }
+ }
+ }
+ }
+ }
+ if (aDlg->getPrsCount() > 0)
+ aDlg->show();
+ else
+ delete aDlg;
+ /* CORBA::Object_var anObject = GetSelectedObj();
if ( !CORBA::is_nil( anObject ) ) {
// is it Prs3d object ?
PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
- VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg(aPrsObject);
aDlg->show();
}
- }
- /* float aOffset[3];
- aPrsObject->GetOffset(aOffset);
- VisuGUI_OffsetDlg aDlg;
- aDlg.setOffset(aOffset);
- if (aDlg.exec() == QDialog::Accepted) {
- aDlg.getOffset(aOffset);
- if (aDlg.isToSave())
- aPrsObject->SetOffset(aOffset);
- // RecreateActor(aPrsObject);
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++){
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(aPrsObject,aViewFrame))
- anActor->SetPosition(aOffset);
- }
- }
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) )
- vf->highlight(anIO, 1);
- }
- }
- }
}*/
}
VISU::Storable::TRestoringMap* pMap=NULL);
-VisuGUI_OffsetDlg::VisuGUI_OffsetDlg(VISU::Prs3d_i* thePrs)
+VisuGUI_OffsetDlg::VisuGUI_OffsetDlg()
: QDialog( QAD_Application::getDesktop(), 0, false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
- myPrs = thePrs;
+ myPrsList.setAutoDelete(false);
+
setName( "VisuGUI_OffsetDlg" );
setCaption( tr( "TIT_OFFSETDLG" ) );
setSizeGripEnabled( TRUE );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( updateOffset() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- float aOffset[3];
- myPrs->GetOffset(aOffset);
- myOldOffset[0] = aOffset[0];
- myOldOffset[1] = aOffset[1];
- myOldOffset[2] = aOffset[2];
- setOffset(aOffset);
+
}
+void VisuGUI_OffsetDlg::addPresentation(VISU::Prs3d_i* thePrs)
+{
+ myPrsList.append(thePrs);
+ OffcetStruct aOffs;
+ thePrs->GetOffset(aOffs.myOffcet);
+ myOldOffsets.append(aOffs);
+ if (myPrsList.count() == 1)
+ setOffset(aOffs.myOffcet);
+ else if (myPrsList.count() == 2) {
+ float aOffset[3];
+ aOffset[0] = aOffset[1] = aOffset[2] = 0;
+ setOffset(aOffset);
+ }
+}
void VisuGUI_OffsetDlg::setOffset(const float* theOffset)
}
-void VisuGUI_OffsetDlg::updateOffset()
+void VisuGUI_OffsetDlg::updateOffset(VISU::Prs3d_i* thePrs, float* theOffset)
{
- float aOffset[3];
- getOffset(aOffset);
- if (isToSave())
- myPrs->SetOffset(aOffset);
+ if (myPrsList.count() == 0) return;
+ if (isToSave()) thePrs->SetOffset(theOffset);
for(int i = 0, nbFrames = VisuGUI::GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++){
if(QAD_StudyFrame* aFrame = VisuGUI::GetActiveStudy()->getStudyFrame(i)){
QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)) {
aViewFrame->onAdjustTrihedron();
- if(VISU_Actor* anActor = VisuGUI::GetActor(myPrs,aViewFrame)) {
- anActor->SetPosition(aOffset);
+ if(VISU_Actor* anActor = VisuGUI::GetActor(thePrs,aViewFrame)) {
+ anActor->SetPosition(theOffset);
aViewFrame->getRenderer()->ResetCameraClippingRange();
aViewFrame->Repaint();
-
+
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(&anIO);
if ( !CORBA::is_nil( anObject ) )
void VisuGUI_OffsetDlg::accept()
{
- updateOffset();
+ float aOffset[3];
+ getOffset(aOffset);
+ for (int i = 0; i < myPrsList.count(); i++) {
+ updateOffset(myPrsList.at(i), aOffset);
+ }
QDialog::accept();
}
void VisuGUI_OffsetDlg::reject()
{
- setOffset(myOldOffset);
- updateOffset();
+ for (int i = 0; i < myPrsList.count(); i++) {
+ updateOffset(myPrsList.at(i), myOldOffsets[i].myOffcet);
+ }
QDialog::reject();
}
// QT Includes
#include <qdialog.h>
+#include <qptrlist.h>
class QAD_SpinBoxDbl;
class QCheckBox;
+struct OffcetStruct {
+ float myOffcet[3];
+};
+
class VisuGUI_OffsetDlg: public QDialog
{
Q_OBJECT
public:
- VisuGUI_OffsetDlg(VISU::Prs3d_i* thePrs);
+ VisuGUI_OffsetDlg();
~VisuGUI_OffsetDlg() {};
+
+ void addPresentation(VISU::Prs3d_i* thePrs);
+ int getPrsCount() const { return myPrsList.count(); }
void setOffset(const float* theOffset);
void getOffset(float* theOffset) const;
protected slots:
virtual void accept();
virtual void reject();
- void updateOffset();
+ void updateOffset(VISU::Prs3d_i* thePrs, float* theOffset);
private:
- VISU::Prs3d_i* myPrs;
+ // VISU::Prs3d_i* myPrs;
+ QPtrList<VISU::Prs3d_i> myPrsList;
QAD_SpinBoxDbl* myDxEdt;
QAD_SpinBoxDbl* myDyEdt;
QCheckBox* mySaveChk;
- float myOldOffset[3];
+ QValueList<OffcetStruct> myOldOffsets;
+ //float myOldOffset[3];
};
#endif // DIALOGBOX_OFFSET_H