theData.myActors.clear();
}
if (!theData.myPrs.empty()) {
- for (int i = 0, iEnd = theData.myPrs.size(); i < iEnd; i++)
+ for (int i = 0, iEnd = theData.myPrs.size(); i < iEnd; i++)
if (theData.myPrs[i] != 0) {
theData.myPrs[i]->_remove_ref();
}
theData.myPrs.clear();
- }
+ }
theData.myNbFrames = 0;
myView->update();
}
// Delete previous presentations
clearData(aData);
- VISU::Result_i* pResult = createPresent(aData.myField);
+ VISU::Result_i* pResult = createPresent(aData.myField);
VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
aData.myNbFrames = aData.myNbTimes;
//VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
}
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();
-
+ 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,
+ 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,
+ 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,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::CutPlanes_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
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,
+ 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,
+ 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,
+ 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();
aData.myNbFrames = i;
QString aFixRange = QAD_CONFIG->getSetting("Visu:SBImposeRange");
if (aFixRange.compare("true") != 0) {
- for (i = 0; i < aData.myNbFrames; i++)
+ for (i = 0; i < aData.myNbFrames; i++)
aData.myPrs[i]->SetRange(aMin, aMax);
if(aData.myPrsType == VISU::TISOSURFACE)
for (i = 0; i < aData.myNbFrames; i++)
//************************************************************************
CORBA::Boolean VISU_TimeAnimation::generateFrames() {
if (!myView) {
- MESSAGE("Viewer is nod defined for animation");
+ MESSAGE("Viewer is not defined for animation");
return false;
}
//************************************************************************
void VISU_TimeAnimation::clearView() {
if (!myView) {
- MESSAGE("Viewer is nod defined for animation");
+ MESSAGE("Viewer is not defined for animation");
return;
}
vtkRenderer* aRen = myView->getRenderer();
aData.myActors[i]->RemoveFromRender(aRen);
aData.myActors[i]->Delete();
}
- }
+ }
aData.myActors.clear();
}
}
stopAnimation();
if (myFrame < (myFieldsLst[0].myNbFrames-1)) {
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame++;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
-
+
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
}
stopAnimation();
if (myFrame > 0) {
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame--;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- myFieldsLst[i].myActors[myFrame]->VisibilityOn();
-
+ myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
}
void VISU_TimeAnimation::firstFrame() {
stopAnimation();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if(!myFieldsLst[i].myActors.empty())
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = 0;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if(!myFieldsLst[i].myActors.empty())
if (myFieldsLst[i].myActors[myFrame] != 0)
- myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+ myFieldsLst[i].myActors[myFrame]->VisibilityOn();
if(!myFieldsLst[0].myTiming.empty()){
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
void VISU_TimeAnimation::lastFrame() {
stopAnimation();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = myFieldsLst[0].myNbFrames-1;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
//************************************************************************
// For Batchmode using
void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) {
- if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
+ if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
return;
stopAnimation();
qApp->lock();
qApp->syncX();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = theFrame;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
- qApp->flushX();
+ qApp->flushX();
qApp->processEvents(3);
qApp->unlock();
}
//************************************************************************
-CORBA::Long VISU_TimeAnimation::getNbFrames() {
+CORBA::Long VISU_TimeAnimation::getNbFrames() {
return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0;
}
//************************************************************************
void VISU_TimeAnimation::run() {
if (!myView) {
- MESSAGE("Viewer is nod defined for animation");
+ MESSAGE("Viewer is not defined for animation");
return;
}
double k=1;
- double aOneVal;
bool isDumping = !myDumpPath.isEmpty();
- aOneVal = (myFieldsLst[0].myNbFrames > 2) ?
- myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0] : 1;
- qApp->lock();
+ double aOneVal = 1;
+ if (myFieldsLst[0].myNbFrames > 2)
+ aOneVal = myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0];
+ qApp->lock();
while (myIsActive) {
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
for (int i = 0; i < getNbFields(); i++) {
FieldData& aData = myFieldsLst[i];
if (myFrame > 0) {
- if (aData.myActors[myFrame-1] != 0)
+ if (aData.myActors[myFrame-1] != 0)
aData.myActors[myFrame-1]->VisibilityOff();
- } else {
+ } else {
if (aData.myActors[aData.myNbFrames-1] != 0)
aData.myActors[aData.myNbFrames-1]->VisibilityOff();
}
}
}
myView->Repaint(false);
+
+ int delay = 100;
if (isDumping) {
QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
QString aFile(myDumpPath);
aFile += aName;
aFile += ".jpeg";
px.save(aFile, "JPEG");
- }
- if (!isDumping) {
+ } else {
+ k = 1;
if (myProportional) {
switch (myFrame) {
case 0:
- k=1;
- break;
+ break;
case 1:
if (myFieldsLst[0].myNbFrames > 2)
- k = (myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal;
- else
- k = 1;
- break;
+ k = (myFieldsLst[0].myTiming[myFrame+1] -
+ myFieldsLst[0].myTiming[myFrame]) / aOneVal;
+ break;
default:
- k = (myFrame < (myFieldsLst[0].myNbFrames-1))?
- (myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal : 1;
+ if (myFrame < (myFieldsLst[0].myNbFrames - 1))
+ k = (myFieldsLst[0].myTiming[myFrame+1] -
+ myFieldsLst[0].myTiming[myFrame]) / aOneVal;
}
- } else
- k = 1;
- qApp->unlock();
- msleep((int)(1000.*k/mySpeed));
- qApp->lock();
- } else {
- qApp->unlock();
- msleep(100);
- qApp->lock();
+ }
+ delay = (int)(1000. * k / mySpeed);
}
+ qApp->unlock();
+ msleep(delay);
+ qApp->lock();
+
if (!myIsActive) break;
myFrame++;
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
-
//************************************************************************
VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue(SALOMEDS::SObject_var theSObject) {
VISU::Storable::TRestoringMap aMap;
SALOMEDS::GenericAttribute_var anAttr;
if(theTimeStamp->FindAttribute(anAttr, "AttributeName")) {
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- QString aNameString(aName->Value());
- return aNameString.toDouble();
+ QString aNameString (aName->Value());
+ int time_len = aNameString.find(',');
+ if (time_len > -1)
+ return aNameString.left(time_len).toDouble();
+ else
+ return aNameString.toDouble();
}
return -1.0;
}
-
+
//************************************************************************
-void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed) {
- mySpeed = (theSpeed<1)? 1 : theSpeed;
+void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed) {
+ mySpeed = (theSpeed<1)? 1 : theSpeed;
}
myAnim = new VISU_TimeAnimation(theStudy,theView3D);
}
-
-VISU_TimeAnimation_i::~VISU_TimeAnimation_i(){
+VISU_TimeAnimation_i::~VISU_TimeAnimation_i()
+{
delete myAnim;
}
-
-void VISU_TimeAnimation_i::addField(SALOMEDS::SObject_ptr theField){
+void VISU_TimeAnimation_i::addField(SALOMEDS::SObject_ptr theField)
+{
myAnim->addField(theField);
}
-
-CORBA::Boolean VISU_TimeAnimation_i::generateFrames(){
- return ProcessEvent(new TMemFunEvent<VISU_TimeAnimation,bool>(myAnim,&VISU_TimeAnimation::generateFrames));
+CORBA::Boolean VISU_TimeAnimation_i::generateFrames()
+{
+ return ProcessEvent(new TMemFunEvent<VISU_TimeAnimation,bool>
+ (myAnim,&VISU_TimeAnimation::generateFrames));
}
-
-void VISU_TimeAnimation_i::generatePresentations(CORBA::Long theFieldNum){
+void VISU_TimeAnimation_i::generatePresentations(CORBA::Long theFieldNum)
+{
myAnim->generatePresentations(theFieldNum);
}
-
-void VISU_TimeAnimation_i::clearView(){
+void VISU_TimeAnimation_i::clearView()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::clearView));
}
-
-void VISU_TimeAnimation_i::stopAnimation(){
+void VISU_TimeAnimation_i::stopAnimation()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::stopAnimation));
}
-
-void VISU_TimeAnimation_i::startAnimation(){
+void VISU_TimeAnimation_i::startAnimation()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::startAnimation));
}
-
-void VISU_TimeAnimation_i::nextFrame(){
+void VISU_TimeAnimation_i::nextFrame()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::nextFrame));
}
-
-void VISU_TimeAnimation_i::prevFrame(){
+void VISU_TimeAnimation_i::prevFrame()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::prevFrame));
}
-
-void VISU_TimeAnimation_i::firstFrame(){
+void VISU_TimeAnimation_i::firstFrame()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::firstFrame));
}
-
-void VISU_TimeAnimation_i::lastFrame(){
+void VISU_TimeAnimation_i::lastFrame()
+{
ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::lastFrame));
}
-
-void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_TimeAnimation,CORBA::Long>(myAnim,&VISU_TimeAnimation::gotoFrame,theFrame));
+void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_TimeAnimation,CORBA::Long>
+ (myAnim,&VISU_TimeAnimation::gotoFrame,theFrame));
}
-
-CORBA::Long VISU_TimeAnimation_i::getNbFields(){
+CORBA::Long VISU_TimeAnimation_i::getNbFields()
+{
return myAnim->getNbFields();
}
-
-CORBA::Long VISU_TimeAnimation_i::getNbFrames(){
+CORBA::Long VISU_TimeAnimation_i::getNbFrames()
+{
return myAnim->getNbFrames();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isRunning(){
+CORBA::Boolean VISU_TimeAnimation_i::isRunning()
+{
return myAnim->isRunning();
}
-
-CORBA::Long VISU_TimeAnimation_i::getCurrentFrame(){
+CORBA::Long VISU_TimeAnimation_i::getCurrentFrame()
+{
return myAnim->getCurrentFrame();
}
-
-VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation(CORBA::Long theField, CORBA::Long theFrame){
+VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation(CORBA::Long theField, CORBA::Long theFrame)
+{
return myAnim->getPresentation(theField,theFrame);
}
-
-void VISU_TimeAnimation_i::setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType){
+void VISU_TimeAnimation_i::setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType)
+{
myAnim->setPresentationType(theFieldNum,theType);
}
-
-VISU::VISUType VISU_TimeAnimation_i::getPresentationType(CORBA::Long theFieldNum){
+VISU::VISUType VISU_TimeAnimation_i::getPresentationType(CORBA::Long theFieldNum)
+{
return myAnim->getPresentationType(theFieldNum);
}
-
-void VISU_TimeAnimation_i::setSpeed(CORBA::Long theSpeed){
+void VISU_TimeAnimation_i::setSpeed(CORBA::Long theSpeed)
+{
myAnim->setSpeed(theSpeed);
}
-
-CORBA::Long VISU_TimeAnimation_i::getSpeed(){
+CORBA::Long VISU_TimeAnimation_i::getSpeed()
+{
return myAnim->getSpeed();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isProportional(){
+CORBA::Boolean VISU_TimeAnimation_i::isProportional()
+{
return myAnim->isProportional();
}
-
-void VISU_TimeAnimation_i::setAnimationRange(CORBA::Double theMin, CORBA::Double theMax){
+void VISU_TimeAnimation_i::setAnimationRange(CORBA::Double theMin, CORBA::Double theMax)
+{
myAnim->setAnimationRange(theMin,theMax);
}
-
-CORBA::Double VISU_TimeAnimation_i::getMinRange(){
+CORBA::Double VISU_TimeAnimation_i::getMinRange()
+{
return myAnim->getMinRange();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMaxRange(){
+CORBA::Double VISU_TimeAnimation_i::getMaxRange()
+{
return myAnim->getMaxRange();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isRangeDefined(){
+CORBA::Boolean VISU_TimeAnimation_i::isRangeDefined()
+{
return myAnim->isRangeDefined();
}
-
-void VISU_TimeAnimation_i::dumpTo(const char* thePath){
+void VISU_TimeAnimation_i::dumpTo(const char* thePath)
+{
myAnim->dumpTo(thePath);
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isCycling(){
+CORBA::Boolean VISU_TimeAnimation_i::isCycling()
+{
return myAnim->isCycling();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMinTime(){
+CORBA::Double VISU_TimeAnimation_i::getMinTime()
+{
return myAnim->getMinTime();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMaxTime(){
+CORBA::Double VISU_TimeAnimation_i::getMaxTime()
+{
return myAnim->getMaxTime();
}
-
-void VISU_TimeAnimation_i::setProportional(CORBA::Boolean theProp){
+void VISU_TimeAnimation_i::setProportional(CORBA::Boolean theProp)
+{
myAnim->setProportional(theProp);
}
-
-void VISU_TimeAnimation_i::setCycling(CORBA::Boolean theCycle){
+void VISU_TimeAnimation_i::setCycling(CORBA::Boolean theCycle)
+{
myAnim->setCycling(theCycle);
}
-
-