VisuGUI_FileDlg.cxx \
VisuGUI_Plot3DDlg.cxx \
VisuGUI_ClippingDlg.cxx \
- VisuGUI_EditContainerDlg.cxx
+ VisuGUI_EditContainerDlg.cxx \
+ VisuGUI_OffsetDlg.cxx
LIB_MOC = \
VisuGUI.h \
VisuGUI_Plot3DDlg.h \
VisuGUI_ClippingDlg.h \
VisuGUI_EditContainerDlg.h \
- VisuGUI_Selection.h
+ VisuGUI_Selection.h \
+ VisuGUI_OffsetDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
VISU_Gen.idl \
msgid "LBL_LABELS"
msgstr "Labels"
+msgid "TIT_OFFSETDLG"
+msgstr "Translate Presentation"
+
+msgid "BTN_RESET"
+msgstr "Reset"
#include "VisuGUI_Selection.h"
#include "VisuGUI_NonIsometricDlg.h"
+#include "VisuGUI_OffsetDlg.h"
+
#include "SALOMEGUI_ImportOperation.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "utilities.h"
}
+ thePopup->insertItem("Translate...", visuGUI, SLOT(TranslatePrs()));
thePopup->insertItem("Clipping planes", visuGUI, SLOT(ClippingPlanes()));
if (isVTKViewer) {
this->myActiveDialogBox = (QDialog*)aDlg ;
return ;
}
+
+void VisuGUI::TranslatePrs()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs");
+ 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())){
+ float aOffset[3];
+ aPrsObject->GetOffset(aOffset);
+ VisuGUI_OffsetDlg aDlg;
+ aDlg.setOffset(aOffset);
+ if (aDlg.exec() == QDialog::Accepted) {
+ aDlg.getOffset(aOffset);
+ aPrsObject->SetOffset(aOffset);
+ RecreateActor(aPrsObject);
+ 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);
+ }
+ }
+ }
+ }
+}
void SelectionInfo();
+ void TranslatePrs();
+
private :
QDialog* myActiveDialogBox;
int myState ;
--- /dev/null
+
+#include "VisuGUI_OffsetDlg.h"
+
+#include "QAD_SpinBoxDbl.h"
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+
+#include <qlayout.h>
+#include <qhbox.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+
+
+#define MAXVAL 1e10
+
+
+VisuGUI_OffsetDlg::VisuGUI_OffsetDlg()
+: QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setName( "VisuGUI_OffsetDlg" );
+ setCaption( tr( "TIT_OFFSETDLG" ) );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QHBox* aOffsetsPane = new QHBox(this);
+ aOffsetsPane->setSpacing(6);
+
+ new QLabel("dX:", aOffsetsPane);
+ myDxEdt = new QAD_SpinBoxDbl( aOffsetsPane, "myDxEdt" );
+ myDxEdt->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("dY:", aOffsetsPane);
+ myDyEdt = new QAD_SpinBoxDbl( aOffsetsPane, "myDyEdt" );
+ myDyEdt->setRange(-MAXVAL, MAXVAL);
+
+ new QLabel("dZ:", aOffsetsPane);
+ myDzEdt = new QAD_SpinBoxDbl( aOffsetsPane, "myDzEdt" );
+ myDzEdt->setRange(-MAXVAL, MAXVAL);
+
+ QPushButton* aResetBtn = new QPushButton(tr("BTN_RESET"), aOffsetsPane);
+ connect(aResetBtn, SIGNAL( clicked() ), this, SLOT( onReset() ) );
+
+ TopLayout->addWidget(aOffsetsPane);
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+
+void VisuGUI_OffsetDlg::setOffset(const float* theOffset)
+{
+ myDxEdt->setValue(theOffset[0]);
+ myDyEdt->setValue(theOffset[1]);
+ myDzEdt->setValue(theOffset[2]);
+}
+
+
+void VisuGUI_OffsetDlg::getOffset(float* theOffset) const
+{
+ theOffset[0] = myDxEdt->value();
+ theOffset[1] = myDyEdt->value();
+ theOffset[2] = myDzEdt->value();
+}
+
+
+void VisuGUI_OffsetDlg::onReset()
+{
+ myDxEdt->setValue(0);
+ myDyEdt->setValue(0);
+ myDzEdt->setValue(0);
+}
--- /dev/null
+
+#ifndef DIALOGBOX_OFFSET_H
+#define DIALOGBOX_OFFSET_H
+
+#include "QAD_SpinBoxDbl.h"
+
+// QT Includes
+#include <qdialog.h>
+
+class QAD_SpinBoxDbl;
+
+class VisuGUI_OffsetDlg: public QDialog
+{
+ Q_OBJECT
+ public:
+ VisuGUI_OffsetDlg();
+ ~VisuGUI_OffsetDlg() {};
+
+ void setOffset(const float* theOffset);
+ void getOffset(float* theOffset) const;
+
+ public slots:
+ void onReset();
+
+ private:
+ QAD_SpinBoxDbl* myDxEdt;
+ QAD_SpinBoxDbl* myDyEdt;
+ QAD_SpinBoxDbl* myDzEdt;
+};
+
+#endif // DIALOGBOX_OFFSET_H
PrsObject_i(theResult->GetStudyDocument()),
myResult(theResult)
{
+ myOffset[0] = myOffset[1] = myOffset[2] = 0;
myResult->Register();
mySObject = SALOMEDS::SObject::_duplicate(theSObject);
myAddToStudy = true;
void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
{
- if(Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin))
+ if(Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin)) {
myPipeLine->SameAs(aOrigin->GetPL());
+ aOrigin->GetOffset(myOffset);
+ }
}
VISU::Prs3d_i::~Prs3d_i() {
}
theActor->SetPipeLine(GetPipeLine());
theActor->SetPrs3d(this);
+ theActor->SetPosition(myOffset);
}catch(std::bad_alloc& ex){
throw std::runtime_error("CreateActor >> No enough memory");
throw ex;
void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+ theActor->SetPosition(myOffset);
theActor->Modified();
}
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
return NULL;
}
+
+void VISU::Prs3d_i::SetOffset(const float* theOffsets)
+{
+ myOffset[0] = theOffsets[0];
+ myOffset[1] = theOffsets[1];
+ myOffset[2] = theOffsets[2];
+}
+
+void VISU::Prs3d_i::SetOffset(float theDx, float theDy, float theDz)
+{
+ myOffset[0] = theDx;
+ myOffset[1] = theDy;
+ myOffset[2] = theDz;
+}
+
+void VISU::Prs3d_i::GetOffset(float* theOffsets)
+{
+ theOffsets[0] = myOffset[0];
+ theOffsets[1] = myOffset[1];
+ theOffsets[2] = myOffset[2];
+}
protected:
bool myAddToStudy;
+ float myOffset[3];
Result_i *myResult;
VISU_PipeLine *myPipeLine;
SALOMEDS::SObject_var mySObject;
void GetBounds(float aBounds[6]);
+ void SetOffset(const float* theOffsets);
+ void SetOffset(float theDx, float theDy, float theDz);
+
+ void GetOffset(float* theOffsets);
+
virtual const char* GetComment() const = 0;
virtual QString GenerateName() = 0;