#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI_IsoSurfacesDlg.h"
#include "VisuGUI_StreamLinesDlg.h"
+#include "VisuGUI_GaussPointsDlg.h"
#include "VISU_TimeAnimation.h"
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_GaussPoints_i.hh"
#include "VISU_ViewManager_i.hh"
}
-//*****************************************************************************************************
-//*****************************************************************************************************
-//*****************************************************************************************************
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
SetupDlg::SetupDlg (VisuGUI* theModule, VISU_TimeAnimation* theAnimator)
: QDialog(VISU::GetDesktop(theModule), "SetupDlg", true, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
aMainLayout->addWidget(aBtnBox);
}
-//************************************************************************
+//------------------------------------------------------------------------
enum PrsComboItem {
TSCALARMAP_ITEM = 0, // VISU::TSCALARMAP
TISOSURFACE_ITEM = 1, // VISU::TISOSURFACE
TPLOT3D_ITEM = 3, // VISU::TPLOT3D
TDEFORMEDSHAPE_ITEM = 4, // VISU::TDEFORMEDSHAPE
TVECTORS_ITEM = 5, // VISU::TVECTORS
- TSTREAMLINES_ITEM = 6 // VISU::TSTREAMLINES
+ TSTREAMLINES_ITEM = 6, // VISU::TSTREAMLINES
+ TGAUSSPOINTS_ITEM = 7 // VISU::TGAUSSPOINTS
};
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onFieldChange (int theIndex)
{
FieldData& aData = myAnimator->getFieldData(theIndex);
myTypeCombo->clear();
+ myComboId2TypeId.clear();
+
// ATTENTION: append items in the same order like it is done in the PrsComboItem enumeration
myTypeCombo->insertItem("Scalar Map"); // item 0
+ myComboId2TypeId.push_back(TSCALARMAP_ITEM);;
+
myTypeCombo->insertItem("Iso Surfaces"); // item 1
+ myComboId2TypeId.push_back(TISOSURFACE_ITEM);;
+
myTypeCombo->insertItem("Cut Planes"); // item 2
+ myComboId2TypeId.push_back(TCUTPLANES_ITEM);;
+
myTypeCombo->insertItem("Plot 3D"); // item 3
+ myComboId2TypeId.push_back(TPLOT3D_ITEM);;
_PTR(SObject) aSObject = aData.myField;
long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong();
if (aNumComp > 1) {
myTypeCombo->insertItem("Deformed Shape"); // item 4
+ myComboId2TypeId.push_back(TDEFORMEDSHAPE_ITEM);;
+
myTypeCombo->insertItem("Vectors"); // item 5
+ myComboId2TypeId.push_back(TVECTORS_ITEM);;
+
myTypeCombo->insertItem("Stream Lines"); // item 6
+ myComboId2TypeId.push_back(TSTREAMLINES_ITEM);;
+ }
+
+ long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong();
+ if(anEntityId == VISU::CELL){
+ myTypeCombo->insertItem("Gauss Points"); // item 7
+ myComboId2TypeId.push_back(TGAUSSPOINTS_ITEM);;
}
+
switch (aData.myPrsType) {
case VISU::TSCALARMAP: //Scalar Map
myTypeCombo->setCurrentItem(TSCALARMAP_ITEM);
myTypeCombo->setCurrentItem(TSTREAMLINES_ITEM);
aData.myPrsType = VISU::TSTREAMLINES;
break;
+ case VISU::TGAUSSPOINTS: //Gauss Points
+ myTypeCombo->setCurrentItem(TGAUSSPOINTS_ITEM);
+ aData.myPrsType = VISU::TGAUSSPOINTS;
+ break;
}
//myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
}
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onTypeChanged (int theIndex)
{
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
- switch (theIndex) {
+ int aType = myComboId2TypeId[theIndex];
+ switch (aType) {
case TSCALARMAP_ITEM: //Scalar Map
aData.myPrsType = VISU::TSCALARMAP;
break;
case TSTREAMLINES_ITEM: //Stream Lines
aData.myPrsType = VISU::TSTREAMLINES;
break;
+ case TGAUSSPOINTS_ITEM: //Gauss Points
+ aData.myPrsType = VISU::TGAUSSPOINTS;
+ break;
}
myAnimator->clearData(aData);
//myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
//myAnimator->generatePresentations(myFieldLst->currentItem());
}
-//************************************************************************
-/*void SetupDlg::onScalarBarDlg() {
- QApplication::setOverrideCursor( Qt::waitCursor );
- FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
- if (aData.myPrs == 0)
- myAnimator->generatePresentations(myFieldLst->currentItem());
- QApplication::restoreOverrideCursor();
- VisuGUI_ScalarBarDlg* aScalarBarDlg = new VisuGUI_ScalarBarDlg();
- aScalarBarDlg->initFromPrsObject(aData.myPrs[0]);
- if (aScalarBarDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- aScalarBarDlg->storeToPrsObject(aData.myPrs[i]);
+//------------------------------------------------------------------------
+namespace
+{
+ template<class TPrs3d, class TDialog>
+ void
+ EditPrs(VisuGUI* theModule,
+ FieldData& theData)
+ {
+ TDialog* aDlg = new TDialog(theModule);
+ aDlg->initFromPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+ if (aDlg->exec())
+ for (int i = 0; i < theData.myNbFrames; i++)
+ aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[i]));
+ delete aDlg;
}
}
-*/
-
-//************************************************************************
+
void SetupDlg::onPreferencesDlg()
{
SUIT_OverrideCursor c;
if (aData.myPrs.empty())
myAnimator->generatePresentations(myFieldLst->currentItem());
-// BUG VISU5725 : Compatibility gcc 2.95
-// #define EDITPRS(TYPE, DLG) \
-// { \
-// DLG* aDlg = new DLG(); \
-// aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs.at(0))); \
-// if (aDlg->exec()) { \
-// for (int i = 0; i < aData.myNbFrames; i++) \
-// aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs.at(i))); \
-// } \
-// delete aDlg; \
-// }
-
-
-#define EDITPRS(TYPE, DLG) {\
- DLG* aDlg = new DLG (myModule);\
- aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]));\
- if (aDlg->exec())\
- { \
- for (int i = 0; i < aData.myNbFrames; i++)\
- aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs[i]));\
- } \
- delete aDlg;}
-
- switch (myTypeCombo->currentItem()) {
+ int aType = myComboId2TypeId[myTypeCombo->currentItem()];
+ switch (aType) {
case TSCALARMAP_ITEM: //Scalar Map
c.suspend();
- EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
+ EditPrs<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg>(myModule,aData);
break;
case TISOSURFACE_ITEM: //Iso Surfaces
c.suspend();
- EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
+ EditPrs<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg>(myModule,aData);
break;
case TCUTPLANES_ITEM: //Cut Planes
c.suspend();
- EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
- /*{
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg (myModule);
- //_CS_PhB :operator [] .at aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs.at(0)));
- aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[0]));
-
- if (aDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- //_CS_PhB:operator [] .at aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs.at(i)));
- aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[i]));
- }
- delete aDlg;
- }*/
+ EditPrs<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg>(myModule,aData);
break;
case TPLOT3D_ITEM: //Plot 3D
c.suspend();
- EDITPRS(VISU::Plot3D_i, VisuGUI_Plot3DDlg);
+ EditPrs<VISU::Plot3D_i,VisuGUI_Plot3DDlg>(myModule,aData);
break;
case TDEFORMEDSHAPE_ITEM: //Deformed Shape
c.suspend();
- EDITPRS(VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg);
+ EditPrs<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg>(myModule,aData);
break;
case TVECTORS_ITEM: //Vectors
c.suspend();
- EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
+ EditPrs<VISU::Vectors_i,VisuGUI_VectorsDlg>(myModule,aData);
break;
case TSTREAMLINES_ITEM: //Stream Lines
c.suspend();
- EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
+ EditPrs<VISU::StreamLines_i,VisuGUI_StreamLinesDlg>(myModule,aData);
+ break;
+ case TGAUSSPOINTS_ITEM: //Gauss Points
+ c.suspend();
+ EditPrs<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg>(myModule,aData);
break;
}
-#undef EDITPRS
}
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onArrangeDlg()
{
ArrangeDlg aDlg(this, myAnimator);
aDlg.exec();
}
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onRangeCheck (bool theCheck)
{
for (int i = 0; i < myAnimator->getNbFields(); i++)
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onMinValue (double theVal)
{
if (theVal > myAnimator->getMaxRange()) {
myAnimator->setAnimationRange(theVal, myAnimator->getMaxRange());
}
-//************************************************************************
+//------------------------------------------------------------------------
void SetupDlg::onMaxValue (double theVal)
{
if (theVal < myAnimator->getMinRange()) {
myPlayFrame->setEnabled(false);
}
-//************************************************************************
+//------------------------------------------------------------------------
VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg()
{
delete myAnimator;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onTypeChange (int index)
{
stopAnimation();
myPlayFrame->setEnabled(false);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject)
{
myPlayFrame->setEnabled(false);
myAnimator->addField(theSObject);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::createFrames()
{
stopAnimation();
//myPlayFrame->setEnabled(true);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onPlayPressed()
{
if (myPlayBtn->isOn() && (!myAnimator->running())) {
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onBackPressed()
{
//stopAnimation();
myAnimator->prevFrame();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onForvardPressed()
{
myAnimator->nextFrame();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onLastPressed()
{
myAnimator->lastFrame();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onFirstPressed()
{
myAnimator->firstFrame();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::clearView()
{
myAnimator->clearView();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent)
{
myAnimator->stopAnimation();
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onWindowChanged (int index)
{
if (myAnimator->isRunning()) return;
myAnimator->gotoFrame(index);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onSpeedChange (double theSpeed)
{
myAnimator->setSpeed((int)theSpeed);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::stopAnimation()
{
myAnimator->stopAnimation();
myGenBtn->setEnabled(true);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onExecution (long theNewFrame, double theTime)
{
myTimeLbl->setText(QString("%1").arg(theTime));
mySlider->setValue(theNewFrame);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onSetupDlg()
{
if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame();
delete aDlg;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onBrowse()
{
QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/","Select path");
myPathEdit->setText(aPath);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onStop()
{
if (isClosing) {
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::saveToStudy()
{
myAnimator->saveAnimation();
VISU::UpdateObjBrowser(myModule, true);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::publishToStudy()
{
myAnimator->publishInStudy();
mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
}
-//************************************************************************
+//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::restoreFromStudy(_PTR(SObject) theAnimation)
{
myAnimator->restoreFromStudy(theAnimation);
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_GaussPoints_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_View_i.hh"
using namespace std;
-//************************************************************************
+//------------------------------------------------------------------------
VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
VISU::View3D_ptr theView3D)
{
}
-//************************************************************************
+//------------------------------------------------------------------------
VISU_TimeAnimation::~VISU_TimeAnimation()
{
if (!myView) {
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::addField (_PTR(SObject) theField)
{
FieldData aNewData;
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
{
SALOMEDS::SObject_var theFieldDup = SALOMEDS::SObject::_duplicate(theField);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::clearData(FieldData& theData) {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
}
-//************************************************************************
+namespace
+{
+ //------------------------------------------------------------------------
+ template<class TPrs3d>
+ void
+ GeneratePresentations(_PTR(Study) theStudy,
+ FieldData& theData,
+ VISU::Result_i* theResult,
+ bool theIsRangeDefined,
+ CORBA::Double theMinVal,
+ CORBA::Double theMaxVal)
+ {
+ double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
+ _PTR(ChildIterator) anIter = theStudy->NewChildIterator(theData.myField);
+ anIter->Next(); // First is reference on support
+
+ long aFrameId = 0;
+ for(; anIter->More(); anIter->Next()){
+ if (aFrameId == theData.myNbTimes) {
+ MESSAGE("There are extra timestamps in field");
+ return;
+ }
+ _PTR(SObject) aTimeStamp = anIter->Value();
+ if(!aTimeStamp)
+ continue;
+
+ theData.myTiming[aFrameId] = VISU_TimeAnimation::getTimeValue(aTimeStamp);
+ if (theIsRangeDefined) {
+ if (theData.myTiming[aFrameId] < theMinVal)
+ continue;
+ if (theData.myTiming[aFrameId] > theMaxVal)
+ break;
+ }
+
+ VISU::Storable::TRestoringMap aTimeMap = VISU_TimeAnimation::getMapOfValue(aTimeStamp);
+ QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName");
+ VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt();
+ QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName");
+ int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt();
+
+ TPrs3d* aPresent = new TPrs3d(theResult, false);
+ aPresent->Create(aMeshName.latin1(), anEntity,
+ aFieldName.latin1(), aTimeStampId);
+ theData.myPrs[aFrameId++] = aPresent;
+
+ aMin = std::min(aPresent->GetMin(),aMin);
+ aMax = std::min(aPresent->GetMax(),aMax);
+ }
+ theData.myNbFrames = aFrameId;
+
+ if (theData.myPrsType != VISU::TGAUSSPOINTS){
+ int aRangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0);
+ if( aRangeType != 1 ){
+ for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) {
+ if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(theData.myPrs[aFrameId])){
+ aPrs->SetRange(aMin, aMax);
+ aPrs->SetOffset(theData.myOffset);
+ }
+ }
+ }
+ if (theData.myPrsType == VISU::TISOSURFACE)
+ for (long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++)
+ if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(theData.myPrs[aFrameId]))
+ aPrs->SetSubRange(aMin, aMax);
+ }
+ }
+}
+
void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
FieldData& aData = myFieldsLst[theFieldNum];
// Delete previous presentations
clearData(aData);
- VISU::Result_i* pResult = createPresent(aData.myField);
+ VISU::Result_i* aResult = createPresent(aData.myField);
VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
aData.myNbFrames = aData.myNbTimes;
- //VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
+ //VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
aData.myPrs.resize(aData.myNbTimes,NULL);
aData.myTiming.resize(aData.myNbTimes);
- _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aData.myField);
- _PTR(SObject) aTimeStamp;
- anIter->Next(); // First is reference on support
- long i = 0;
- double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
- for (; anIter->More(); anIter->Next()) {
- if (i == aData.myNbTimes) {
- MESSAGE("There are extra timestamps in field");
- return;
- }
- aTimeStamp = anIter->Value();
- if (!aTimeStamp) continue;
-
- aData.myTiming[i] = getTimeValue(aTimeStamp);
- if (isRangeDefined()) {
- if (aData.myTiming[i] < myMinVal) continue;
- if (aData.myTiming[i] > myMaxVal) break;
- }
-
- VISU::Storable::TRestoringMap aTimeMap = getMapOfValue(aTimeStamp);
- QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName");
- VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt();
- QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName");
- int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt();
-
- switch (aData.myPrsType) {
- case VISU::TSCALARMAP: // ScalarMap
- {
- VISU::ScalarMap_i* aPresent = new VISU::ScalarMap_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::ScalarMap_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TISOSURFACE: // Iso Surfaces
- {
- VISU::IsoSurfaces_i* aPresent = new VISU::IsoSurfaces_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::IsoSurfaces_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TCUTPLANES: // Cut Planes
- {
- VISU::CutPlanes_i* aPresent = new VISU::CutPlanes_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::CutPlanes_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TPLOT3D: // Plot3d
- {
- VISU::Plot3D_i* aPresent = new VISU::Plot3D_i (pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TDEFORMEDSHAPE: // Deformed Shape
- {
- VISU::DeformedShape_i* aPresent = new VISU::DeformedShape_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::DeformedShape_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TVECTORS: // Vectors
- {
- VISU::Vectors_i* aPresent = new VISU::Vectors_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::Vectors_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
-
- case VISU::TSTREAMLINES: // Stream Lines
- {
- VISU::StreamLines_i* aPresent = new VISU::StreamLines_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
- aFieldName.latin1(), aTimeStampId);
- //VISU::StreamLines_var aTmp = aPresent->_this();
- //aPresent->_remove_ref();
- aData.myPrs[i] = aPresent;
- }
- break;
- default:
- MESSAGE("Not implemented for this presentation type: " << aData.myPrsType);
- return;
- }
- if (aData.myPrs[i]->GetMin() < aMin) aMin = aData.myPrs[i]->GetMin();
- if (aData.myPrs[i]->GetMax() > aMax) aMax = aData.myPrs[i]->GetMax();
- i++;
- }
- aData.myNbFrames = i;
-
- int rangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0);
- if ( rangeType != 1 ) {
- for (i = 0; i < aData.myNbFrames; i++) {
- aData.myPrs[i]->SetRange(aMin, aMax);
- aData.myPrs[i]->SetOffset(aData.myOffset);
- }
- if (aData.myPrsType == VISU::TISOSURFACE)
- for (i = 0; i < aData.myNbFrames; i++)
- if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]))
- aPrs->SetSubRange(aMin, aMax);
+ using namespace VISU;
+ switch (aData.myPrsType) {
+ case VISU::TSCALARMAP: // ScalarMap
+ GeneratePresentations<ScalarMap_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TISOSURFACE: // Iso Surfaces
+ GeneratePresentations<IsoSurfaces_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TCUTPLANES: // Cut Planes
+ GeneratePresentations<CutPlanes_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TPLOT3D: // Plot3d
+ GeneratePresentations<Plot3D_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TDEFORMEDSHAPE: // Deformed Shape
+ GeneratePresentations<DeformedShape_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TVECTORS: // Vectors
+ GeneratePresentations<Vectors_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TSTREAMLINES: // Stream Lines
+ GeneratePresentations<StreamLines_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ case VISU::TGAUSSPOINTS: // Gauss Points
+ GeneratePresentations<GaussPoints_i>(myStudy,aData,aResult,isRangeDefined(),myMinVal,myMaxVal);
+ break;
+ default:
+ MESSAGE("Not implemented for this presentation type: " << aData.myPrsType);
+ return;
}
}
-//************************************************************************
+//------------------------------------------------------------------------
CORBA::Boolean VISU_TimeAnimation::generateFrames() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
return aNoError;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::clearView() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
VISU::RepaintView(myView);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::stopAnimation() {
myIsActive = false;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::startAnimation() {
if (!myIsActive) {
myIsActive = true;
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::nextFrame() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::prevFrame() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::firstFrame() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
}
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::lastFrame() {
if (!myView) {
MESSAGE("Viewer is not defined for animation");
}
-//************************************************************************
+//------------------------------------------------------------------------
// For Batchmode using
void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) {
if (!myView) {
}
-//************************************************************************
-VISU::ScalarMap_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField, CORBA::Long theFrame) {
+//------------------------------------------------------------------------
+VISU::ColoredPrs3d_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField, CORBA::Long theFrame) {
if ((theField > getNbFields()) || (theField < 0))
- return VISU::ScalarMap::_nil();
+ return VISU::ColoredPrs3d::_nil();
if ((theFrame < 0) || (theFrame > (myFieldsLst[theField].myNbFrames - 1)))
- return VISU::ScalarMap::_nil();
+ return VISU::ColoredPrs3d::_nil();
return myFieldsLst[theField].myPrs[theFrame]->_this();
}
-//************************************************************************
+//------------------------------------------------------------------------
CORBA::Long VISU_TimeAnimation::getNbFrames() {
return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::run()
{
if (!myView) {
QThread::exit();
}
-//************************************************************************
+//------------------------------------------------------------------------
VISU::Result_i* VISU_TimeAnimation::createPresent (_PTR(SObject) theField)
{
_PTR(SObject) aSObj = theField->GetFather();
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
-//************************************************************************
+//------------------------------------------------------------------------
VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) theSObject)
{
VISU::Storable::TRestoringMap aMap;
return aMap;
}
-//************************************************************************
+//------------------------------------------------------------------------
double VISU_TimeAnimation::getTimeValue (_PTR(SObject) theTimeStamp)
{
_PTR(GenericAttribute) anAttr;
return -1.0;
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed)
{
mySpeed = (theSpeed<1)? 1 : theSpeed;
}
-//************************************************************************
+//------------------------------------------------------------------------
int VISU_TimeAnimation::myNBAnimations = 0;
QString VISU_TimeAnimation::GenerateName()
{
return VISU::GenerateName("Animation", myNBAnimations++);
}
-//************************************************************************
+//------------------------------------------------------------------------
std::string GetPresentationComment (VISU::VISUType thePrsType)
{
std::string aPrsCmt;
case VISU::TSTREAMLINES:
aPrsCmt = VISU::StreamLines_i::myComment;
break;
+ case VISU::TGAUSSPOINTS:
+ aPrsCmt = VISU::GaussPoints_i::myComment;
+ break;
default:
aPrsCmt = "Unknown presentation";
break;
return aPrsCmt;
}
-//************************************************************************
+//------------------------------------------------------------------------
SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
{
if (myStudy->GetProperties()->IsLocked())
return VISU::GetSObject(aAnimSObject);
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::saveAnimation()
{
if (myStudy->GetProperties()->IsLocked()) return;
aStudyBuilder->CommitCommand();
}
-//************************************************************************
+//------------------------------------------------------------------------
void VISU_TimeAnimation::restoreFromStudy(SALOMEDS::SObject_ptr theField)
{
_PTR(SObject) aAnimSObject = VISU::GetClientSObject(theField, myStudy);
aData.myPrsType = VISU::TVECTORS;
else if (strName == VISU::StreamLines_i::myComment.c_str())
aData.myPrsType = VISU::TSTREAMLINES;
+ else if (strName == VISU::GaussPoints_i::myComment.c_str())
+ aData.myPrsType = VISU::TGAUSSPOINTS;
else
continue;
generatePresentations(getNbFields()-1);
return myAnim->getCurrentFrame();
}
-VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation
+VISU::ColoredPrs3d_ptr VISU_TimeAnimation_i::getPresentation
(CORBA::Long theField, CORBA::Long theFrame)
{
return myAnim->getPresentation(theField,theFrame);