// Module : VISU
#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h"
+
#include "VisuGUI_Tools.h"
+
#include "VISU_Result_i.hh"
#include "VISU_ScalarMapOnDeformedShape_i.hh"
+
+#include "VISU_ScalarMapPL.hxx"
#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+
+#include "VISU_Convertor.hxx"
+
#include "SalomeApp_Module.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Desktop.h"
-#include "VISU_ScalarMapPL.hxx"
#include "SALOME_ListIO.hxx"
-#include "VISU_Convertor.hxx"
-
#include "SALOMEDSClient_AttributeComment.hxx"
#include "SALOMEDSClient_AttributeName.hxx"
TopGroupLayout->addWidget(FieldLabel, 1, 0);
TopGroupLayout->addWidget(myFieldsCombo,1,1);
-
+
// TimeStamps combo box
QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup, "TimeStampLabel");
myTimeStampsCombo = new QComboBox (TopGroup,"TimeStamp");
TopGroupLayout->addWidget(TimeStampLabel, 2, 0);
TopGroupLayout->addWidget(myTimeStampsCombo,2,1);
-
+
//
aTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int)));
connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int)));
-
}
-void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim)
+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(myPrs->GetScale());
myTimeStampsCombo->setDisabled(isAnim);
-
+
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)
{
// find all fields and time stamps on it
Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()) {
_PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+
_PTR(GenericAttribute) anTmpAttr;
- if(aSObject->FindAttribute(anTmpAttr, "AttributeComment")){
+ if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) {
_PTR(AttributeComment) aTmpComment (anTmpAttr);
string aTmpComm = aTmpComment->Value();
QString aTmpstrIn (aTmpComm.c_str());
VISU::Storable::TRestoringMap aTmpaMap;
VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
bool aTmpisExist;
- VISU::VISUType aTmpType = (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
+ VISU::VISUType aTmpType =
+ (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
switch(aTmpType){
case VISU::TTIMESTAMP:
{
}
}
}
+
aSObject = aSObject->GetFather();
aSObject = aSObject->GetFather();
+
mySelectionObj = aSObject;
CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
- VISU::Result_var aResult;
if (CORBA::is_nil(anObject)) {
mySelectionObj = mySelectionObj->GetFather();
}
- _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
-
- for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
- _PTR(SObject) aChildSObj = aIter->Value();
- CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
-
- _PTR(GenericAttribute) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
- _PTR(AttributeComment) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::TRestoringMap aMap;
- VISU::Storable::StrToMap(strIn,aMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if (isExist) {
- if ((aType == VISU::TTIMESTAMP)) {
- _PTR(GenericAttribute) aNameAttr;
- if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
- _PTR(AttributeName) aName (aNameAttr);
- VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
- QString aMeshName = VISU::getValue(aChildSObj,"myMeshName");
- if(QString(myPrs->GetMeshName().c_str()) != aMeshName) continue;
- myCurrMeshName = aMeshName;
- QString aFieldName = VISU::getValue(aChildSObj,"myFieldName");
- QString aTimeIter = VISU::getValue(aChildSObj,"myTimeStampId");
- QString aEntity = VISU::getValue(aChildSObj,"myEntityId");
- VISU::TEntity anEntity;
- switch(aEntity.toInt()){
- case 0: anEntity = VISU::NODE_ENTITY; break;
- case 1: anEntity = VISU::EDGE_ENTITY; break;
- case 2: anEntity = VISU::FACE_ENTITY; break;
- case 3: anEntity = VISU::CELL_ENTITY; break;
- }
- TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
- TFE aKey(aFieldName.latin1(),anEntity);
- aFieldsMap[aKey][aTimeIter.toInt()] =
- GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
- aFieldName.latin1(),
- aTimeIter.toInt(),
- anEntity);
- }
- }
- }
- }
- }
}
}
-
- AddAllFieldNames();
+ if (mySelectionObj) {
+ _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
+
+ for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+ _PTR(SObject) aChildSObj = aIter->Value();
+ CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
+
+ _PTR(GenericAttribute) anAttr;
+ if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::TRestoringMap aMap;
+ VISU::Storable::StrToMap(strIn,aMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ if (isExist) {
+ if ((aType == VISU::TTIMESTAMP)) {
+ _PTR(GenericAttribute) aNameAttr;
+ if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (aNameAttr);
+ VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+ QString aMeshName = VISU::getValue(aChildSObj, "myMeshName");
+ if (QString(myPrs->GetMeshName().c_str()) != aMeshName) continue;
+ myCurrMeshName = aMeshName;
+ QString aFieldName = VISU::getValue(aChildSObj, "myFieldName");
+ QString aTimeIter = VISU::getValue(aChildSObj, "myTimeStampId");
+ QString aEntity = VISU::getValue(aChildSObj, "myEntityId");
+ VISU::TEntity anEntity;
+ switch (aEntity.toInt()) {
+ case 0: anEntity = VISU::NODE_ENTITY; break;
+ case 1: anEntity = VISU::EDGE_ENTITY; break;
+ case 2: anEntity = VISU::FACE_ENTITY; break;
+ case 3: anEntity = VISU::CELL_ENTITY; break;
+ }
+ TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
+ TFE aKey (aFieldName.latin1(), anEntity);
+ aFieldsMap[aKey][aTimeIter.toInt()] =
+ GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(),
+ aFieldName.latin1(),
+ aTimeIter.toInt(),
+ anEntity);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ AddAllFieldNames();
}
myFieldsCombo->setCurrentText(aFieldName);
AddAllTimes(myFieldsCombo->currentText());
myScalarPane->initFromPrsObject(myPrs);
}
-int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars, int theIter) {
- if(MYDEBUG) cout << "VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject:"<<__LINE__<<endl;
+int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject
+ (VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalars, int theIter)
+{
thePrs->SetScale(getFactor());
-
- if(myIsAnimation)
+
+ if (myIsAnimation)
thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
getCurrentScalarFieldName().latin1(),
theIter,
else
thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(),
getCurrentScalarFieldName().latin1(),
- myTimeStampsCombo->currentItem()+1,
+ myTimeStampsCombo->currentItem() + 1,
myPrs->GetScalarEntity());
if (theUpdateScalars) SetScalarField();
thePrs->ShowColored(true);
myScalarPane->storeToPrsObject(thePrs);
-
+
myPrs = thePrs;
return 1;
connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
- // Find All prs obj
- //SUIT_Study* aActiveStudy = VISU::(myVisuGUI);
+ // Find all fields and time stamps on it
_PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
SALOME_ListIO selected;
Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()) {
_PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+
+ _PTR(GenericAttribute) anTmpAttr;
+ if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aTmpComment (anTmpAttr);
+ string aTmpComm = aTmpComment->Value();
+ QString aTmpstrIn (aTmpComm.c_str());
+ VISU::Storable::TRestoringMap aTmpaMap;
+ VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
+ bool aTmpisExist;
+ VISU::VISUType aTmpType =
+ (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
+ switch (aTmpType) {
+ case VISU::TTIMESTAMP:
+ {
+ aSObject = aSObject->GetFather();
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TFIELD:
+ {
+ _PTR(SObject) newSObject;
+ if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TANIMATION:
+ {
+ _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+ for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+ _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+ _PTR(SObject) newSObject;
+ if(aTmpChildSObj->ReferencedObject(newSObject)){
+ aSObject = newSObject;
+ aSObject->GetFather();
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
aSObject = aSObject->GetFather();
aSObject = aSObject->GetFather();
- aSObject = aSObject->GetFather();
- aSObject = aSObject->GetFather();
+
mySelectionObj = aSObject;
CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
- VISU::Result_var aResult;
if (CORBA::is_nil(anObject)) {
mySelectionObj = mySelectionObj->GetFather();
}
- _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
-
- for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
- _PTR(SObject) aChildSObj = aIter->Value();
- CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
-
- if (!CORBA::is_nil(aChildObject)) {
- VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
- if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object
- if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
- (aPrsObj->GetType() != VISU::TMESH)) {
- _PTR(GenericAttribute) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
- _PTR(AttributeName) aName (anAttr);
- myPrsLst += QString(aName->Value().c_str());
- myPrsList.append(aPrsObj);
- continue;
- }
- }
- }
- }
- // else { // This is not a Prs object
- _PTR(GenericAttribute) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
- _PTR(AttributeComment) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::TRestoringMap aMap;
- VISU::Storable::StrToMap(strIn,aMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if (isExist) {
- if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
- _PTR(GenericAttribute) aNameAttr;
- if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
- _PTR(AttributeName) aName (aNameAttr);
- VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
- switch (aType) {
- case VISU::TFAMILY:
- myFamilisLst += QString(aName->Value().c_str());
- myFamilyList.append(aPrsObj);
- break;
- case VISU::TGROUP:
- myGroupsLst += QString(aName->Value().c_str());
- myGroupList.append(aPrsObj);
- break;
- case VISU::TENTITY:
- myEntitiesLst += QString(aName->Value().c_str());
- myEntityList.append(aPrsObj);
- break;
- }
- }
- }
- }
- }
+ }
+ }
+
+ if (mySelectionObj) {
+ _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
+
+ for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+ _PTR(SObject) aChildSObj = aIter->Value();
+ CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
+
+ if (!CORBA::is_nil(aChildObject)) {
+ VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+ if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object
+ if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
+ (aPrsObj->GetType() != VISU::TMESH)) {
+ _PTR(GenericAttribute) anAttr;
+ if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ myPrsLst += QString(aName->Value().c_str());
+ myPrsList.append(aPrsObj);
+ continue;
+ }
+ }
+ }
+ }
+
+ _PTR(GenericAttribute) anAttr;
+ if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::TRestoringMap aMap;
+ VISU::Storable::StrToMap(strIn,aMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ if (isExist) {
+ if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
+ _PTR(GenericAttribute) aNameAttr;
+ if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (aNameAttr);
+ VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+ switch (aType) {
+ case VISU::TFAMILY:
+ myFamilisLst += QString(aName->Value().c_str());
+ myFamilyList.append(aPrsObj);
+ break;
+ case VISU::TGROUP:
+ myGroupsLst += QString(aName->Value().c_str());
+ myGroupList.append(aPrsObj);
+ break;
+ case VISU::TENTITY:
+ myEntitiesLst += QString(aName->Value().c_str());
+ myEntityList.append(aPrsObj);
+ break;
+ }
+ }
+ }
+ }
}
}
}
}
-
void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
{
myScalarPane->initFromPrsObject(thePrs);