CRASH after trying to "Show..." animation, based on "Scalar map on Deformad shape".
VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
: QDialog(VISU::GetDesktop(theModule), "VisuGUI_ScalarMapOnDeformedShapeDlg", false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myIsAnimation(false),
myVisuGUI(theModule)
{
myPrs = NULL;
void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim)
{
+ if(MYDEBUG) cout << "VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject:"<<__LINE__<<endl;
+ if(MYDEBUG) cout << "\tthePrs->GetScalarIteration()="<<thePrs->GetScalarIteration()<<endl;
+ if(MYDEBUG) cout << "\tthePrs->GetScale()="<<thePrs->GetScale()<<endl;
+ myIsAnimation = isAnim;
myPrs = thePrs;
-
- setFactor(thePrs->GetScale());
+ setFactor(myPrs->GetScale());
myTimeStampsCombo->setDisabled(isAnim);
- QString aFieldName(thePrs->GetScalarFieldName());
- float aIterFloat = GetFloatValueOfTimeStamp(thePrs->GetMeshName().c_str(),
- thePrs->GetScalarFieldName().c_str(),
- thePrs->GetScalarIteration(),
- thePrs->GetScalarEntity());
+ QString aFieldName(myPrs->GetScalarFieldName());
+ float aIterFloat = GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
+ myPrs->GetScalarFieldName().c_str(),
+ myPrs->GetScalarIteration(),
+ myPrs->GetScalarEntity());
QString aIteration(QString("%1").arg(aIterFloat));
if (myMeshFieldsTimes.size() == 0)
_PTR(AttributeName) aName (aNameAttr);
VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
QString aMeshName = VISU::getValue(aChildSObj,"myMeshName");
- if(QString(thePrs->GetMeshName().c_str()) != aMeshName) continue;
+ if(QString(myPrs->GetMeshName().c_str()) != aMeshName) continue;
myCurrMeshName = aMeshName;
QString aFieldName = VISU::getValue(aChildSObj,"myFieldName");
QString aTimeIter = VISU::getValue(aChildSObj,"myTimeStampId");
myScalarPane->initFromPrsObject(myPrs);
}
-int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalar) {
-
+int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars, int theIter) {
+ if(MYDEBUG) cout << "VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject:"<<__LINE__<<endl;
thePrs->SetScale(getFactor());
- thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
- myPrs->GetScalarFieldName().c_str(),
- myPrs->GetScalarIteration(),
- myPrs->GetScalarEntity());
+ if(myIsAnimation)
+ thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
+ getCurrentScalarFieldName().latin1(),
+ theIter,
+ myPrs->GetScalarEntity());
+ else
+ thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
+ getCurrentScalarFieldName().latin1(),
+ myTimeStampsCombo->currentItem()+1,
+ myPrs->GetScalarEntity());
- if (theUpdateScalar) SetScalarField();
+ if (theUpdateScalars) SetScalarField();
thePrs->ShowColored(true);
aFieldName.latin1(),
theIter,
anEntity);
-
+
myScalarPane->storeToPrsObject(myPrs);
UpdateScalarField();
void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false);
- int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalar=true);
+ int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars=true,int theIter=1);
int getCurrentScalarFieldNamePos();
QString getCurrentScalarFieldName();
TMF myMeshFieldsTimes;
QString myCurrMeshName;
+ int myCurrScalarIter;
+ bool myIsAnimation;
_PTR(SObject) mySelectionObj;
VISU::ScalarMapOnDeformedShape_i* myPrs;
if (aDlg->exec())
{
int anbFrames=aDlg->getCurrentScalarNbIterations();
+ int aIter = 0;
for (int i = 0; i < aData.myNbFrames; i++){
TYPE* aCurrPrs_i = dynamic_cast<TYPE*>(aData.myPrs[i]);
+ aIter = i+1;
if(i+1 > anbFrames)
- aDlg->SetScalarField(anbFrames);
- else
- aDlg->SetScalarField(i+1);
- aDlg->storeToPrsObject(aCurrPrs_i,false);
+ aIter=anbFrames;
+ aDlg->storeToPrsObject(aCurrPrs_i,false,aIter);
}
}
delete aDlg;
myField = anOrigin->GetField();
myMeshName = myField->myMeshName;
- myEntity = myField->myEntity;
+ myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity;
myIteration = anOrigin->GetIteration();
myFieldName = anOrigin->GetFieldName();
void
SameAsParams(const ColoredPrs3d_i* theOrigin);
- const VISU::PField&
+ virtual const VISU::PField&
GetField() const;
const std::string&
VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration)
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Create:"<<__LINE__<<endl;
myIsColored = true;
myColor.R = myColor.G = myColor.B = 0.5;
VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Restore:"<<__LINE__<<endl;
TSuperClass::Restore(theMap);
SetScalarFieldName(VISU::Storable::FindValue(theMap,"myScalarFieldName"));
void VISU::ScalarMapOnDeformedShape_i::ToStream(std::ostringstream& theStr)
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::ToStream:"<<__LINE__<<endl;
TSuperClass::ToStream(theStr);
Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
VISU::ScalarMapOnDeformedShape_i
::SameAs(const Prs3d_i* theOrigin)
{
- int theScalarIter = GetScalarIteration();
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SameAs:"<<__LINE__<<endl;
+ int theScalarIter = this->GetScalarIteration();
+ string theScalarMeshName = this->GetScalarMeshName();
+ string theScalarFieldName = this->GetScalarFieldName();
+ if(MYDEBUG) cout << "SameAs:"<<endl
+ << "\t"<<theScalarIter<<":"<<theScalarMeshName.c_str()<<":"<<theScalarFieldName.c_str()<<endl;
TSuperClass::SameAs(theOrigin);
if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
- // increment the scalar iteration for using in VISU_TimeAnimation class implementation.
- int anOriginScalarIter = anOrigin->GetScalarIteration();
this->SetScalarField(anOrigin->GetScalarMeshName().c_str(),
anOrigin->GetScalarFieldName().c_str(),
theScalarIter,
void VISU::ScalarMapOnDeformedShape_i::DoHook()
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::DoHook:"<<__LINE__<<endl;
if(!myPipeLine)
myPipeLine = VISU_ScalarMapOnDeformedShapePL::New();
VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::CreateActor:"<<__LINE__<<endl;
VISU_Actor* anActor = TSuperClass::CreateActor(theIO);
anActor->SetRepresentation(2);
anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) {
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::UpdateActor:"<<__LINE__<<endl;
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
if(IsColored()){
anActor->SetBarVisibility(true);
const int theIteration,
const VISU::TEntity theEntity)
{
+ if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SetScalarField:"<<__LINE__<<endl;
+ if(MYDEBUG) cout << "\ttheFieldName="<<theFieldName<<endl;
+ if(MYDEBUG) cout << "\ttheIteration="<<theIteration<<endl;
+ myScalarField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
+ TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration)->GetVTKOutput();
if (myScalarMapOnDeformedShapePL){
- myField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
- TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
- theEntity,
- theFieldName,
- theIteration)->GetVTKOutput();
myScalarMapOnDeformedShapePL->SetScalars(aOut);
}
this->SetScalarMeshName(theMeshName);
VISU::TEntity VISU::ScalarMapOnDeformedShape_i::GetScalarEntity(){
return myScalarEntity;
}
+
+const VISU::PField&
+VISU::ScalarMapOnDeformedShape_i
+::GetField() const
+{
+ return myScalarField;
+}
void
SameAs(const Prs3d_i* theOrigin);
+ virtual const VISU::PField&
+ GetField() const;
+
VISU_ScalarMapOnDeformedShapePL* GetScalarMapOnDeformedShapePL(){ return myScalarMapOnDeformedShapePL;}
protected:
std::string myScalarFieldName;
VISU::TEntity myScalarEntity;
int myScalarIteration;
+ PField myScalarField;
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,