const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(anIO->getEntry());
- if (aSObj->_is_nil()) return;
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
+ _PTR(GenericAttribute) anAttr;
if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ _PTR(AttributeComment) aComment (anAttr);
string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
+ QString strIn (aComm.c_str());
+ VISU::Storable::StrToMap(strIn, aMap);
bool isExist;
VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
if (aType != VISU::TANIMATION) return;
VisuGUI_TimeAnimationDlg* aAnimationDlg =
-// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
new VisuGUI_TimeAnimationDlg(this, aCStudy);
aAnimationDlg->restoreFromStudy(aSObj);
aAnimationDlg->show();
if (CheckLock(aCStudy))
return;
- //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
if (CORBA::is_nil(anObject)) return;
this, SLOT(OnCreatePlot3D()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
- createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
+ createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
+ tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
this, SLOT(OnCreatePlot2dView()));
- //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- //createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
- // this, SLOT(OnDeleteObject()));
-
createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
this, SLOT(OnDeleteObjects()));
createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
this, SLOT(OnDisplayOnlyPrs()));
- //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- //createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
- // this, SLOT(OnDeletePrs()));
-
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
this, SLOT(OnCopyPresentation()));
mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
// delete
- //mgr->insert( action( VISU_DELETE_OBJS ), -1, -1, -1 );
- //mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // TODO: remove
- //mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // TODO: remove
mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
// table commands
mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
- mgr->insert( action( VISU_SHOW_ANIMATION ), -1, -1, -1 );
mgr->insert( separator(), -1, -1, -1 );
mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
mgr->setRule( action( VISU_PLOT2D ), aRule, true );
- //aRule = aSel_One_ObjBr + " and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
- //mgr->setRule( action( VISU_DELETE ), aRule, true );
-
- //QString aDeletable ("$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' ");
- //aDeletable += aPrsAll + " 'VISU::TRESULT' 'VISU::TMESH'}";
- //mgr->setRule( action( VISU_DELETE_OBJS ), aSel_Some_ObjBr + " and " + aDeletable, true );
-
// timestamp commands
aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'";
mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
- //aRule = "selcount=1 and $type in {'VISU::TTABLE' 'VISU::TCURVE' "
- // "'VISU::TCONTAINER' 'VISU::TMESH' " + aPrsAll + "}";
- //mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
-
// View parameters
//jfa tmp:aRule = "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')";
//jfa tmp:mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), aRule, true );
aRule = "client='ObjectBrowser' and type='MEDFIELD'";
mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
-
- aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TANIMATION'";
- mgr->setRule( action( VISU_SHOW_ANIMATION ), aRule, true );
}
//***************************************************************************
{
SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
- // Check multiple selection
+ // Check if some (nb > 0) removable objects selected
if (IsRemovableSelected(this)) {
action( VISU_DELETE_OBJS )->addTo(theMenu);
}
if (aListIO.Extent() != 1) return;
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
- _PTR(SObject) SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
- if (IsSObjectTable(SO)) {
+ VISU::Storable::TRestoringMap aMap;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
+
+ _PTR(SObject) SO = GetCStudy(GetAppStudy(this))->FindObjectID(anIO->getEntry());
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ if (aType == VISU::TANIMATION) {
+ action( VISU_SHOW_ANIMATION )->addTo(theMenu);
+
+ } else if (IsSObjectTable(SO)) {
action( VISU_SHOW_TABLE )->addTo(theMenu);
action( VISU_CREATE_CURVES )->addTo(theMenu);
action( VISU_EXPORT_TABLE )->addTo(theMenu);
theMenu->insertSeparator();
- //action( VISU_DELETE )->addTo(theMenu);
+
} else {
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
#include <vtkRenderer.h>
#include <qhbox.h>
-#include <qgrid.h>
+#include <qgrid.h>
#include <qlayout.h>
#include <qslider.h>
#include <qthread.h>
aManualPane->setSpacing(10);
myFieldLst = new QListBox(aManualPane);
- connect( myFieldLst, SIGNAL( highlighted(int) ),
+ connect( myFieldLst, SIGNAL( highlighted(int) ),
this, SLOT( onFieldChange(int) ) );
QGrid* aCoordPane = new QGrid(2, aManualPane);
aCoordPane->setSpacing(5);
-
+
new QLabel("X", aCoordPane);
myCoord[0] = new QtxDblSpinBox(aCoordPane);
myCoord[0]->setRange(-MAXVAL, MAXVAL);
-
+
new QLabel("Y", aCoordPane);
myCoord[1] = new QtxDblSpinBox(aCoordPane);
myCoord[1]->setRange(-MAXVAL, MAXVAL);
QDialog::accept();
}
-void ArrangeDlg::onFieldChange(int theCurrent)
+void ArrangeDlg::onFieldChange(int theCurrent)
{
if (myCurrent != theCurrent) {
Offset& aOffs = myOffsets[myCurrent];
aOffs.myOffset[0] = myCoord[0]->value();
aOffs.myOffset[1] = myCoord[1]->value();
aOffs.myOffset[2] = myCoord[2]->value();
-
+
for (int i = 0; i < myAnimator->getNbFields(); i++) {
Offset aOffs = myOffsets[i];
myAnimator->getFieldData(i).myOffset[0] = aOffs.myOffset[0];
case XAxis:
aDist = fabs(aBounds[1] - aBounds[0]);
break;
- case YAxis:
+ case YAxis:
aDist = fabs(aBounds[3] - aBounds[2]);
break;
case ZAxis:
myAnimator->getFieldData(i).myOffset[2] = 0;
myAnimator->getFieldData(i).myOffset[aAxis] = aDist * i;
}
-
+
QApplication::restoreOverrideCursor();
}
}
Offset& aOffs = myOffsets[it.data()];
if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow)) anActor->SetPosition(aOffs.myOffset);
if (mySaveChk)
- if (mySaveChk->isChecked())
+ if (mySaveChk->isChecked())
aPrs->SetOffset(aOffs.myOffset);
}
} else {
case XAxis:
aDist = fabs(aBounds[1] - aBounds[0]);
break;
- case YAxis:
+ case YAxis:
aDist = fabs(aBounds[3] - aBounds[2]);
break;
case ZAxis:
}
}
}
- myViewWindow->getRenderer()->ResetCameraClippingRange();
- myViewWindow->Repaint();
+ myViewWindow->getRenderer()->ResetCameraClippingRange();
+ myViewWindow->Repaint();
}
QVBox* aSetupBox = new QVBox(aPropFrame);
aSetupBox->setSpacing(5);
- QVGroupBox* aPropBox = new QVGroupBox("Properties", aSetupBox);
+ QVGroupBox* aPropBox = new QVGroupBox("Properties", aSetupBox);
//QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
myTypeCombo = new QComboBox(aPropBox);
connect( myTypeCombo, SIGNAL( activated(int) ),
//************************************************************************
-void SetupDlg::onArrangeDlg()
+void SetupDlg::onArrangeDlg()
{
ArrangeDlg aDlg(this, myAnimator);
aDlg.exec();
}
//************************************************************************
-void VisuGUI_TimeAnimationDlg::saveToStudy()
+void VisuGUI_TimeAnimationDlg::saveToStudy()
{
myAnimator->saveAnimation();
myModule->updateObjBrowser( true );
}
//************************************************************************
-void VisuGUI_TimeAnimationDlg::restoreFromStudy(SALOMEDS::SObject_var theAnimation)
+void VisuGUI_TimeAnimationDlg::restoreFromStudy(_PTR(SObject) theAnimation)
{
myAnimator->restoreFromStudy(theAnimation);
mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
//************************************************************************
void VISU_TimeAnimation::restoreFromStudy(SALOMEDS::SObject_ptr theField)
{
- //SALOMEDS::SObject_var aAnimSObject = SALOMEDS::SObject::_duplicate(theField);
_PTR(SObject) aAnimSObject = VISU::GetClientSObject(theField, myStudy);
+ restoreFromStudy(aAnimSObject);
+}
+
+void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
+{
+ _PTR(SObject) aAnimSObject = theField;
VISU::Storable::TRestoringMap aMap;
_PTR(GenericAttribute) anAttr;
//========================================================================
//========================================================================
//========================================================================
-VISU_TimeAnimation_i::VISU_TimeAnimation_i (SALOMEDS::Study_ptr theStudy,
- VISU::View3D_ptr theView3D)
-{
- //myAnim = new VISU_TimeAnimation (theStudy,theView3D);
-
- std::string aStudyName = theStudy->Name();
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- while (SUIT_Application* anApp = anIter.current()) {
- ++anIter;
- if (SUIT_Study* aSStudy = anApp->activeStudy()) {
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
- if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if (aStudyName == aCStudy->Name()) {
- myAnim = new VISU_TimeAnimation (aCStudy, theView3D);
- break;
+struct TNewAnimationEvent: public SALOME_Event
+{
+ std::string myStudyName;
+ VISU::View3D_ptr myView3D;
+
+ typedef VISU_TimeAnimation* TResult;
+ TResult myResult;
+
+ TNewAnimationEvent (std::string theStudyName, VISU::View3D_ptr theView3D):
+ myStudyName(theStudyName),
+ myView3D(VISU::View3D::_duplicate(theView3D)),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* anApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (myStudyName == aCStudy->Name()) {
+ myResult = new VISU_TimeAnimation (aCStudy, myView3D);
+ break;
+ }
}
}
}
}
}
+};
+
+VISU_TimeAnimation_i::VISU_TimeAnimation_i (SALOMEDS::Study_ptr theStudy,
+ VISU::View3D_ptr theView3D)
+{
+ std::string aStudyName = theStudy->Name();
+ myAnim = ProcessEvent(new TNewAnimationEvent (aStudyName, theView3D));
}
VISU_TimeAnimation_i::~VISU_TimeAnimation_i()