if( aTblObj ) {
_PTR(GenericAttribute) anAttr;
if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
-
_PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
SalomeApp_Study* salome_study = GetAppStudy( theModule );
for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
salome_study->deleteReferencesTo( aChildIter->Value() );
_PTR(SObject) aSO = aChildIter->Value();
if(aSO){
- if (getValue(aSO, "myComment") == QString("CURVE")) {
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
+ if (aRestoringMap["myComment"] == "CURVE") {
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
if(!CORBA::is_nil(aCORBAObject)){
PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(aServant.in());
- if(pCrv){
- PlotRemoveCurve(theModule,pCrv);
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
+ PlotRemoveCurve(theModule, aCurve);
}
}
}
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
_PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
- if (!aSObj) return;
-
- VISU::Storable::TRestoringMap aMap;
- _PTR(GenericAttribute) anAttr;
- if (!aSObj->FindAttribute(anAttr, "AttributeString")) return;
+ if (!aSObj)
+ return;
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- 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;
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
+ if (aType != VISU::TANIMATION)
+ return;
VisuGUI_TimeAnimationDlg* aAnimationDlg =
new VisuGUI_TimeAnimationDlg(this, aCStudy);
OB_Browser* ob = getApp()->objectBrowser();
bool isOBClient = (ob && theClient == ob->popupClientType());
-
+
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
SALOME_ListIteratorOfListIO It (aListIO);
for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject)& anIO = It.Value();
-
+
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
continue;
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
if (CORBA::is_nil(aCORBAObject)) {
- _PTR(GenericAttribute) anAttr;
- if (aSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::TRestoringMap pMap;
- VISU::Storable::StrToMap(strIn, pMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if (isExist && aType == VISU::TTIMESTAMP) {
- _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
- _PTR(SObject) aPrs;
- for (; anIter->More(); anIter->Next()) {
- aPrs = anIter->Value();
- if (!aPrs) continue;
- std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
- nbPrs += aSubList.size();
- }
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ if (aType == VISU::TTIMESTAMP) {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
+ _PTR(SObject) aPrs;
+ for (; anIter->More(); anIter->Next()) {
+ aPrs = anIter->Value();
+ if (!aPrs)
+ continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
+ nbPrs += aSubList.size();
+ }
+ }
}
}
}
SALOME_ListIteratorOfListIO It1 (aListIO);
for (; It1.More() && !isCurves; It1.Next()) {
Handle(SALOME_InteractiveObject)& anIO = It1.Value();
-
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
continue;
- _PTR(GenericAttribute) anAttr;
- if (aSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::TRestoringMap pMap;
- VISU::Storable::StrToMap(strIn, pMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if (isExist && aType == VISU::TCURVE) {
- isCurves = true;
- } else {
- VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
- if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
- if (aPrsObject->GetType() == VISU::TCUTPLANES) {
- VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
- if (aCutPrs) {
- isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ if (aType == VISU::TCURVE) {
+ isCurves = true;
+ } else {
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
+ isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
}
}
}
VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
_PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
- VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(aSObject);
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
if (aListIO.Extent() != 1)
return;
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
if (aType == VISU::TANIMATION) {
action( VISU_SHOW_ANIMATION )->addTo(theMenu);
if (aCutPrs) {
_PTR(SObject) aTimeStampSObj = aSObject->GetFather();
if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
- QString aType = aViewManager->getType();
- bool isVVTK = aType == VVTK_Viewer::Type();
+ QString aViewType = aViewManager->getType();
+ bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
- Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj);
- bool isExist;
- aType = Storable::FindValue(aMap,"myType",&isExist);
- if (!isExist || aType.toInt() != TTIMESTAMP )
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
+ if (aType != TTIMESTAMP )
return;
- QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+ QString aMeshName = aRestoringMap["myMeshName"];
+ QString anEntity = aRestoringMap["myEntityId"];
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeStampId = aRestoringMap["myTimeStampId"];
int aPos;
SUIT_ViewWindow* aViewWindow = 0;
- if (isVVTK) {
+ if (anIsVVTK) {
aViewWindow = GetViewWindow<VVTK_Viewer>(this);
aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
} else {
if( !aSObject )
return false;
- _PTR(GenericAttribute) anAttr;
- if( !aSObject->FindAttribute( anAttr, "AttributeString" ) )
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap( aSObject );
+ if( aRestoringMap.empty() )
return false;
- _PTR(AttributeString) aComment( anAttr );
- string aComm = aComment->Value();
- QString strIn( aComm.c_str() );
-
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- VISU::Storable::StrToMap( strIn, aMap );
- VISU::VISUType aType = ( VISU::VISUType )VISU::Storable::FindValue( aMap, "myType", &isExist ).toInt();
-
- if( aType == VISU::TFIELD )
- {
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
+ if( aType == VISU::TFIELD ) {
VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
- QString aMeshName = VISU::getValue( aSObject, "myMeshName" );
- int anEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
- QString aFieldName = VISU::getValue( aSObject, "myName" );
+ QString aMeshName = aRestoringMap["myMeshName"];
+ int anEntity = aRestoringMap["myEntityId"].toInt();
+ QString aFieldName = aRestoringMap["myName"];
VISU::ColoredPrs3dHolder::BasicInput anInput;
anInput.myResult = aResult;
if (!aSObject)
return;
- VISU::Storable::TRestoringMap aMap;
- _PTR(GenericAttribute) anAttr;
- if (!aSObject->FindAttribute(anAttr, "AttributeString"))
- return;
-
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::StrToMap(strIn, aMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
if (aType == VISU::TFIELD)
{
_PTR(SObject) aMedObject = aSObject->GetFather()->GetFather()->GetFather();
anEntityName = aRefObj->GetName().c_str();
}
- if( VISU::getValue(aChildObj, "myComment") == "TIMESTAMP" )
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildObj);
+ if( aRestoringMap["myComment"] == "TIMESTAMP" )
{
aTimeStampName = aChildObj->GetName().c_str();
myTimeStamps->insertItem( aTimeStampName );
myResult = VISU::FindResult( VISU::GetSObject( aSObject ).in() );
- myEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+ myEntity = aRestoringMap["myEntityId"].toInt();
QString aMedFile = aMedObject->GetName().c_str();
- QString aMeshName = VISU::getValue(aSObject, "myMeshName");
- QString aFieldName = VISU::getValue(aSObject, "myName");
+ QString aMeshName = aRestoringMap["myMeshName"];
+ QString aFieldName = aRestoringMap["myName"];
myMedFile->setText( aMedFile );
myMeshName->setText( aMeshName );
anIsFirst = false;
// To update selection
- _PTR(GenericAttribute) anAttr;
- if(aChildSObject->FindAttribute(anAttr,"AttributeString")){
- _PTR(AttributeString) aComment(anAttr);
-
- QString aStream(aComment->Value().c_str());
- Storable::TRestoringMap aMap;
- Storable::StrToMap(aStream,aMap);
-
- bool anIsSelected = Storable::FindValue(aMap,"myIsSelected").toInt();
- bool aHasSubId = Storable::FindValue(aMap,"myHasSubId").toInt();
- int aSubId = Storable::FindValue(aMap,"mySubId").toInt();
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
+ if(!aMap.empty()){
+ bool anIsSelected = aMap["myIsSelected"].toInt();
+ bool aHasSubId = aMap["myHasSubId"].toInt();
+ int aSubId = aMap["mySubId"].toInt();
if(anIsSelected){
std::string anEntry = aSObject->GetID();
{
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
- _PTR(GenericAttribute) anAttr;
- if(theSObject->FindAttribute(anAttr,"AttributeString")){
- _PTR(AttributeString) aComment(anAttr);
- QString aStream(aComment->Value().c_str());
- Storable::TRestoringMap aMap;
- Storable::StrToMap(aStream,aMap);
- SetViewParams(theMainWindow,aMap);
- }
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
+ if(!aMap.empty())
+ SetViewParams(theMainWindow, aMap);
}
}
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
myConfigSObject = aSObject;
- _PTR(GenericAttribute) anAttr;
- if(aSObject->FindAttribute(anAttr,"AttributeString")){
- _PTR(AttributeString) aComment(anAttr);
- QString aStream(aComment->Value().c_str());
- Storable::TRestoringMap aMap;
- Storable::StrToMap(aStream,aMap);
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
+ if(!aMap.empty()){
SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
return aResStr;
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
- VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
VISU::Base_i* aBase = anObjectInfo.myBase;
if(aBase){
}
if(aResStr.isNull()){
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue( aMap, "myType", &isExist).toInt();
- if( isExist ){
- switch (aType) {
- ENUM2STRING( aResStr, VISU::TENTITY );
- ENUM2STRING( aResStr, VISU::TFAMILY );
- ENUM2STRING( aResStr, VISU::TGROUP );
- ENUM2STRING( aResStr, VISU::TVIEW3D );
- ENUM2STRING( aResStr, VISU::TFIELD );
- ENUM2STRING( aResStr, VISU::TTIMESTAMP );
- }
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap);
+ switch (aType) {
+ ENUM2STRING( aResStr, VISU::TENTITY );
+ ENUM2STRING( aResStr, VISU::TFAMILY );
+ ENUM2STRING( aResStr, VISU::TGROUP );
+ ENUM2STRING( aResStr, VISU::TVIEW3D );
+ ENUM2STRING( aResStr, VISU::TFIELD );
+ ENUM2STRING( aResStr, VISU::TTIMESTAMP );
}
}
if(aResStr.isNull()){
- bool isExist;
- QString aVal = VISU::Storable::FindValue(aMap,"myComment",&isExist);
- if ( isExist && aVal!="MESH" )
+ bool anIsExist;
+ QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+ if ( anIsExist && aVal != "MESH" )
aResStr = "VISU::T" + aVal;
}
return aResStr;
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
- VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
bool isExist;
QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
return QString();
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
- VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
bool isExist;
QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
return aResStr;
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
- VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
bool isExist;
const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
_PTR(SObject) theTimeStamp,
ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
{
- Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
-
- bool isExist;
- QString aType = Storable::FindValue(aMap,"myType",&isExist);
- if (!isExist || aType.toInt() != TTIMESTAMP )
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(theTimeStamp);
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+ if ( aType != TTIMESTAMP )
return NULL;
- QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+ QString aMeshName = aRestoringMap["myMeshName"];
+ QString anEntity = aRestoringMap["myEntityId"];
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeStampId = aRestoringMap["myTimeStampId"];
// Create new TViewWindow instance, if it does not exist.
typedef typename TViewer::TViewWindow TViewWindow;
Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()) {
_PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
-
- _PTR(GenericAttribute) anTmpAttr;
- if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) {
- _PTR(AttributeString) 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;
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ switch(aType){
+ 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();
for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
_PTR(SObject) aChildSObj = aIter->Value();
- _PTR(GenericAttribute) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) 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) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
- _PTR(AttributeName) aNameAttr(anAttr);
- QString aMeshName = VISU::getValue(aChildSObj, "myMeshName");
- CORBA::String_var aName = myPrsCopy->GetMeshName();
- if (aMeshName != aName.in())
- continue;
- QString aFieldName = VISU::getValue(aChildSObj, "myFieldName");
- QString aTimeIter = VISU::getValue(aChildSObj, "myTimeStampId");
- QString aEntity = VISU::getValue(aChildSObj, "myEntityId");
- VISU::Entity anEntity;
- switch (aEntity.toInt()) {
- case 0: anEntity = VISU::NODE; break;
- case 1: anEntity = VISU::EDGE; break;
- case 2: anEntity = VISU::FACE; break;
- case 3: anEntity = VISU::CELL; break;
- }
- TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
- TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
- aTimeStampNumber2Time[aTimeIter.toInt()] =
- GetFloatValueOfTimeStamp(anEntity,
- aFieldName.latin1(),
- aTimeIter.toInt());
- }
- }
- }
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj);
+ if (!aRestoringMap.empty()) {
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+ if (aType == VISU::TTIMESTAMP) {
+ QString aMeshName = aRestoringMap["myMeshName"];
+ CORBA::String_var aName = myPrsCopy->GetMeshName();
+ if (aMeshName != aName.in())
+ continue;
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeIter = aRestoringMap["myTimeStampId"];
+ QString aEntity = aRestoringMap["myEntityId"];
+ VISU::Entity anEntity;
+ switch (aEntity.toInt()) {
+ case 0: anEntity = VISU::NODE; break;
+ case 1: anEntity = VISU::EDGE; break;
+ case 2: anEntity = VISU::FACE; break;
+ case 3: anEntity = VISU::CELL; break;
+ }
+ TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
+ TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
+ aTimeStampNumber2Time[aTimeIter.toInt()] =
+ GetFloatValueOfTimeStamp(anEntity,
+ aFieldName.latin1(),
+ aTimeIter.toInt());
+ }
}
}
}
-
AddAllFieldNames();
}
myFieldsCombo->setCurrentText(aFieldName.in());
if (aPrs3d) {
- VISU::Storable::TRestoringMap aMap;
+ QString aMeshName("NULL"), aFieldName("NULL");
if (aSObject) {
- _PTR(GenericAttribute) anAttr;
- if (aSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- std::string aString = aComment->Value();
- QString strIn( aString.c_str() );
- VISU::Storable::StrToMap(strIn, aMap);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject);
+ if (!aMap.empty()) {
+ aMeshName = VISU::Storable::FindValue(aMap, "myMeshName");
+ aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
}
}
- QString aMeshName("NULL"), aFieldName("NULL");
- if (!aMap.empty()) {
- aMeshName = VISU::Storable::FindValue(aMap, "myMeshName");
- aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
- }
-
myMeshName ->setText((aMeshName == "NULL") ? QString("No name") : aMeshName);
myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()) {
_PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
-
- _PTR(GenericAttribute) anTmpAttr;
- if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) {
- _PTR(AttributeString) 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;
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
+ switch (aType) {
+ 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();
}
}
- _PTR(GenericAttribute) anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) 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;
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type(aChildSObj);
+ 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;
}
}
}
VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
{
return VISU::Mesh::_nil();
-/*
- CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
- VISU::Result_var aResult;
- if (!CORBA::is_nil(anObject)) {
- aResult = VISU::Result::_narrow(anObject);
- }
- if (CORBA::is_nil(aResult)) {
- SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
- tr("WRN_NO_AVAILABLE_DATA"),
- tr("BUT_OK"));
- return VISU::Mesh::_nil();
- }
- SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
- VISU::Storable::TRestoringMap aMap;
-
- for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
- SALOMEDSClient_SObject* aChildSObj = aIter->Value();
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
- SALOMEDSClient_AttributeString* aComment = dynamic_cast<SALOMEDSClient_AttributeString*>( anAttr );
- CORBA::String_var aComm = aComment->Value().c_str();
- QString strIn(aComm.in());
- aMap.clear();
- VISU::Storable::StrToMap(strIn,aMap);
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if (isExist) {
- if (aType != theType) continue;
-
- SALOMEDSClient_GenericAttribute* aNameAttr;
- if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
- SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>(aNameAttr);
- if (QString(aName->Value()) == theName) break; //use current map
- }
- }
- }
- }
- VISU::Mesh_var aMesh;
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
- switch (theType) {
- case VISU::TFAMILY:
- {
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1());
- }
- break;
- case VISU::TGROUP:
- {
- aMesh = VisuGUI::GetVisuGen()->GroupMesh(aResult,aMeshName.latin1(), theName.latin1());
- }
- break;
- case VISU::TENTITY:
- {
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- aMesh = VisuGUI::GetVisuGen()->MeshOnEntity(aResult,aMeshName.latin1(),anEntity);
- }
- break;
- }
- if(!CORBA::is_nil(aMesh)){ // Create Actor
- VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){
- try{
- pPresent->SetPresentationType(VISU::POINT);
- VISU_Actor *anActor = pPresent->CreateActor();
- vf->AddActor(anActor);
- }catch(...){
- SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"),
- tr("ERR_CANT_CREATE_ACTOR"),
- tr("BUT_OK") );
- }
- }
- } else {
- SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
- tr("ERR_CANT_BUILD_PRESENTATION"),
- tr("BUT_OK"));
- }
- return aMesh._retn();
-*/
}
void VisuGUI_StreamLinesDlg::accept() {
QStringList aFieldNames;
// Find names of fields
for (int i = 0; i < myAnimator->getNbFields(); i++) {
- aFieldNames.append(VISU::getValue(myAnimator->getFieldData(i).myField, "myName"));
+ _PTR(SObject) aSObject = myAnimator->getFieldData(i).myField;
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+ aFieldNames.append(aRestoringMap["myName"]);
Offset aOffs;
aOffs.myOffset[0] = myAnimator->getFieldData(i).myOffset[0];
aOffs.myOffset[1] = myAnimator->getFieldData(i).myOffset[1];
// Find names of fields
for (int i = 0; i < myAnimator->getNbFields(); i++) {
_PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
- QString aFieldName(VISU::getValue(aSO, "myName"));
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
+ QString aFieldName(aRestoringMap["myName"]);
if ( myAnimator->getAnimationMode() == 0 )
aFieldNames.append(aFieldName);
else if ( myAnimator->getAnimationMode() == 1 ) {
- QString aFileName(VISU::getValue(aSO->GetFather()->GetFather()->GetFather(),"myInitFileName"));
+ _PTR(SObject) aSObject = aSO->GetFather()->GetFather()->GetFather();
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+ QString aFileName(aRestoringMap["myInitFileName"]);
aFileName = aFileName.right(aFileName.length() - (aFileName.findRev("/") + 1));
aFieldNames.append(aFileName + QString(" : ") + aFieldName);
}
FieldData& aData = myAnimator->getFieldData(theIndex);
_PTR(SObject) aSObject = aData.myField;
- long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong();
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+ long aNumComp = aRestoringMap["myNumComponent"].toLong();
anEnableItems = (aNumComp > 1);
- long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong();
+ long anEntityId = aRestoringMap["myEntityId"].toLong();
anEnableGP = (anEntityId == VISU::CELL);
aPrsType = aData.myPrsType;
for (int i = 0; i < myAnimator->getNbFields(); i++) {
_PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
- long aNumComp = VISU::getValue(aSO, "myNumComponent").toLong();
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
+ long aNumComp = aRestoringMap["myNumComponent"].toLong();
anEnableItems = (aNumComp > 1);
- long anEntityId = VISU::getValue(aSO, "myEntityId").toLong();
+ long anEntityId = aRestoringMap["myEntityId"].toLong();
anEnableGP = (anEntityId == VISU::CELL);
if ( !anEnableItems && !anEnableGP ) break;
}
- //------------------------------------------------------------
- VISU::Storable::TRestoringMap
- getMapOfValue(_PTR(SObject) theSObject)
- {
- VISU::Storable::TRestoringMap aMap;
- if (theSObject) {
- _PTR(GenericAttribute) anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- std::string aValue = aComment->Value();
- QString aString (aValue.c_str());
- VISU::Storable::StrToMap(aString, aMap);
- }
- }
- return aMap;
- }
-
- //------------------------------------------------------------
- QString
- getValue(_PTR(SObject) theSObject, QString theKey)
- {
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if (!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
- return aStr;
- }
-
-
//----------------------------------------------------------------------------
// Selection
TSelectionInfo
return dynamic_cast<VISU::Prs3d_i*>(theBase);
}
- //----------------------------------------------------------------------------
- Storable::TRestoringMap
- GetStorableMap(_PTR(SObject) theSObject)
- {
- Storable::TRestoringMap aMap;
- if(theSObject){
- _PTR(GenericAttribute) anAttr;
- if(theSObject->FindAttribute(anAttr,"AttributeString")){
- _PTR(AttributeString) aComment (anAttr);
- std::string aValue = aComment->Value();
- VISU::Storable::StrToMap(aValue.c_str(), aMap);
- }
- }
- return aMap;
- }
//----------------------------------------------------------------------------
bool
return true;
}
+
//----------------------------------------------------------------------------
void
Add(LightApp_SelectionMgr* theSelectionMgr,
_PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
if (!aStudy) return false;
- // In some cases single selection can have its own popup-menu item for deletion
- /*if (aListIO.Extent() == 1) {
- Handle(SALOME_InteractiveObject) anIO = aListIO.First();
- _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
- if (aSObject) {
- VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
- if (aType == VISU::TVIEW3D) {
- return false; // special case
- }
- }
- }*/
-
SALOME_ListIteratorOfListIO anIter (aListIO);
for (; anIter.More(); anIter.Next()) {
Handle(SALOME_InteractiveObject) anIO = anIter.Value();
TSelectionItem aSelectionItem = aSelectionInfo.front();
theIO = aSelectionItem.myIO;
theSObject = aSelectionItem.myObjectInfo.mySObject;
- QString aValue = getValue(theSObject,"myType");
- if (aValue.toInt() == int(VISU::TTIMESTAMP)){
+ VISU::VISUType aType = VISU::Storable::SObject2Type(theSObject);
+ if (VISU::TTIMESTAMP == aType){
thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp;
return true;
}
- if (aValue.toInt() == int(VISU::TFIELD)){
+ if (VISU::TFIELD == aType){
thePublishInStudyMode = ColoredPrs3d_i::EPublishIndependently;
if(theSObject->FindSubObject(2,theSObject))
return true;
if (pResult == NULL)
return;
- Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
- bool isExist;
- string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if (!isExist)
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(aResultSObj);
+ if (aMap.empty())
return;
CORBA::Object_var aMesh;
+ string aComment = Storable::FindValue(aMap,"myComment").latin1();
string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
#ifdef CHECKTIME
Utils_Timer timer;
}
}
} else {
- _PTR(GenericAttribute) anAttr;
- if (theObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::TRestoringMap pMap;
- VISU::Storable::StrToMap(strIn, pMap);
- bool isExist;
- VISU::VISUType aType =
- (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if (isExist) {
- switch (aType) {
- case VISU::TFIELD:
- {
- _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
- _PTR(SObject) aTimeStamp;
- anIter->Next(); // First is reference on support
- for (; anIter->More(); anIter->Next()) {
- aTimeStamp = anIter->Value();
- if (!aTimeStamp) continue;
- std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
- if (!aSubList.empty()) {
- int n = aSubList.size();
- aList.resize(k+n);
- for (int i = 0; i < n; i++) {
- aList[k] = aSubList[i];
- k++;
- }
- }
- }
- }
- break;
- case VISU::TTIMESTAMP:
- {
- _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
- _PTR(SObject) aPrs;
- for (; anIter->More(); anIter->Next()) {
- aPrs = anIter->Value();
- if (!aPrs) continue;
- std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aPrs);
- if (!aSubList.empty()) {
- int n = aSubList.size();
- aList.resize(k+n);
- for (int i = 0; i < n; i++) {
- aList[k] = aSubList[i];
- k++;
- }
- }
- }
- }
- break;
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type(theObject);
+ switch (aType) {
+ case VISU::TFIELD: {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
+ _PTR(SObject) aTimeStamp;
+ anIter->Next(); // First is reference on support
+ for (; anIter->More(); anIter->Next()) {
+ aTimeStamp = anIter->Value();
+ if (!aTimeStamp) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
+ if (!aSubList.empty()) {
+ int n = aSubList.size();
+ aList.resize(k+n);
+ for (int i = 0; i < n; i++) {
+ aList[k] = aSubList[i];
+ k++;
+ }
+ }
+ }
+ break;
}
+ case VISU::TTIMESTAMP: {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
+ _PTR(SObject) aPrs;
+ for (; anIter->More(); anIter->Next()) {
+ aPrs = anIter->Value();
+ if (!aPrs) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aPrs);
+ if (!aSubList.empty()) {
+ int n = aSubList.size();
+ aList.resize(k+n);
+ for (int i = 0; i < n; i++) {
+ aList[k] = aSubList[i];
+ k++;
+ }
+ }
+ }
+ break;
+ }}
}
return aList;
}
VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
SALOME_MED::MED_Gen_var GetMEDEngine();
- VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject);
- QString getValue(_PTR(SObject) theSObject, QString theKey);
-
// Selection
LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
Base_i* theBase);
VISU::Prs3d_i* GetPrs3dFromBase(Base_i* theBase);
-
- Storable::TRestoringMap GetStorableMap(_PTR(SObject) theSObject);
//----------------------------------------------------------------------------
void Add(LightApp_SelectionMgr* theSelectionMgr,
static int mySCnt = 0;
static QMutex aMutex(TRUE);
- Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex){
+ Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex)
+ {
if(MYDEBUG) MESSAGE("Mutex::Mutex : "<<!mySCnt);
if(!mySCnt++)
myMutex->lock();
}
- Mutex::~Mutex(){
+ Mutex::~Mutex()
+ {
if(!(--mySCnt))
myMutex->unlock();
if(MYDEBUG) MESSAGE("Mutex::~Mutex : "<<!mySCnt);
//===========================================================================
static Storable::TCallbackMap VisuStoreMap;
+
std::string
Storable
::ToString()
{
- ostringstream strOut;
- Storable::DataToStream( strOut, "myComment", GetComment() );
- ToStream(strOut);
- strOut<<ends;
- if(MYDEBUG) MESSAGE("Storable::ToString - "<<strOut.str());
- return strOut.str();
+ ostringstream anOutputStream;
+ Storable::DataToStream( anOutputStream, "myComment", GetComment() );
+ ToStream(anOutputStream);
+ anOutputStream<<ends;
+ if(MYDEBUG) MESSAGE("Storable::ToString - "<<anOutputStream.str());
+ return anOutputStream.str();
}
+
+ //---------------------------------------------------------------
void
Storable
::Registry(const std::string& theComment,
}
}
+
+ //---------------------------------------------------------------
+ VISU::VISUType
+ Storable
+ ::Comment2Type(const std::string& theComment)
+ {
+ if ( theComment == "CURVE" )
+ return VISU::TCURVE;
+ if ( theComment == "TABLE" )
+ return VISU::TTABLE;
+ if ( theComment == "CONTAINER" )
+ return VISU::TCONTAINER;
+ if ( theComment == "MESH" )
+ return VISU::TMESH;
+ if ( theComment == "SCALARMAP" )
+ return VISU::TSCALARMAP;
+ if ( theComment == "PRSMERGER" )
+ return VISU::TSCALARMAP;
+ if ( theComment == "ISOSURFACE" )
+ return VISU::TISOSURFACES;
+ if ( theComment == "DEFORMEDSHAPE" )
+ return VISU::TDEFORMEDSHAPE;
+ if ( theComment == "SCALARMAPONDEFORMEDSHAPE" )
+ return VISU::TSCALARMAPONDEFORMEDSHAPE;
+ if ( theComment == "GAUSSPOINTS" )
+ return VISU::TGAUSSPOINTS;
+ if ( theComment == "PLOT3D" )
+ return VISU::TPLOT3D;
+ if ( theComment == "CUTPLANES" )
+ return VISU::TCUTPLANES;
+ if ( theComment == "CUTLINES" )
+ return VISU::TCUTLINES;
+ if ( theComment == "VECTORS" )
+ return VISU::TVECTORS;
+ if ( theComment == "STREAMLINES" )
+ return VISU::TSTREAMLINES;
+ if ( theComment == "VISUGEN" )
+ return VISU::TVISUGEN;
+ if ( theComment == "VIEWMANAGER" )
+ return VISU::TVIEWMANAGER;
+ if ( theComment == "RESULT" )
+ return VISU::TRESULT;
+ if ( theComment == "XYPLOT" )
+ return VISU::TXYPLOT;
+ if ( theComment == "TABLEVIEW" )
+ return VISU::TTABLEVIEW;
+ if ( theComment == "VIEW3D" )
+ return VISU::TVIEW3D;
+ if ( theComment == "GAUSSVIEW" )
+ return VISU::TGAUSSVIEW;
+ if ( theComment == "ENTITY" )
+ return VISU::TENTITY;
+ if ( theComment == "FAMILY" )
+ return VISU::TFAMILY;
+ if ( theComment == "PART" )
+ return VISU::TPART; // MULTIPR
+ if ( theComment == "GROUP" )
+ return VISU::TGROUP;
+ if ( theComment == "FIELD" )
+ return VISU::TFIELD;
+ if ( theComment == "TIMESTAMP" )
+ return VISU::TTIMESTAMP;
+ if ( theComment == "ANIMATION" )
+ return VISU::TANIMATION;
+ if ( theComment == "ALL" )
+ return VISU::TALL;
+
+ return VISU::TNONE;
+ }
+
+
+ //---------------------------------------------------------------
+ VISU::VISUType
+ Storable
+ ::RestoringMap2Type(const TRestoringMap& theRestoringMap)
+ {
+ QString aComment = Storable::FindValue( theRestoringMap, "myComment", "" );
+ return Comment2Type(aComment.latin1());
+ }
+
+
+ //---------------------------------------------------------------
+ VISU::VISUType
+ Storable
+ ::Stream2Type(const std::string& thePersistentString)
+ {
+ QString aString(thePersistentString.c_str());
+ if(aString.isEmpty())
+ return VISU::TNONE;
+
+ VISU::Storable::TRestoringMap aRestoringMap;
+ Storable::StringToMap( aString, aRestoringMap );
+ return RestoringMap2Type( aRestoringMap );
+ }
+
+
+ //---------------------------------------------------------------
+ VISU::VISUType
+ Storable
+ ::SObject2Type(const _PTR(SObject)& theSObject)
+ {
+ _PTR(GenericAttribute) anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeString")) {
+ _PTR(AttributeString) aDataAttr(anAttr);
+ std::string aData = aDataAttr->Value();
+ return Stream2Type(aData);
+ }
+
+ return VISU::TNONE;
+ }
+
+
+ //---------------------------------------------------------------
std::string
Storable
::CorrectPersistentString(const std::string& thePersistentString)
return aString.latin1();
VISU::Storable::TRestoringMap aRestoringMap;
- Storable::StrToMap( aString, aRestoringMap );
+ Storable::StringToMap( aString, aRestoringMap );
bool anIsFound = false;
QString aComment = Storable::FindValue( aRestoringMap, "myComment", &anIsFound );
if ( anIsFound ) {
- QString aType = Storable::FindValue( aRestoringMap, "myType", &anIsFound );
- VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() );
- if ( anIsFound ) {
- if ( aComment == "NONE" )
- aVISUType = VISU::TNONE;
- else if ( aComment == "CURVE" )
- aVISUType = VISU::TCURVE;
- else if ( aComment == "TABLE" )
- aVISUType = VISU::TTABLE;
- else if ( aComment == "CONTAINER" )
- aVISUType = VISU::TCONTAINER;
- else if ( aComment == "MESH" )
- aVISUType = VISU::TMESH;
- else if ( aComment == "SCALARMAP" )
- aVISUType = VISU::TSCALARMAP;
- else if ( aComment == "PRSMERGER" )
- aVISUType = VISU::TSCALARMAP;
- else if ( aComment == "ISOSURFACE" )
- aVISUType = VISU::TISOSURFACES;
- else if ( aComment == "DEFORMEDSHAPE" )
- aVISUType = VISU::TDEFORMEDSHAPE;
- else if ( aComment == "SCALARMAPONDEFORMEDSHAPE" )
- aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE;
- else if ( aComment == "GAUSSPOINTS" )
- aVISUType = VISU::TGAUSSPOINTS;
- else if ( aComment == "PLOT3D" )
- aVISUType = VISU::TPLOT3D;
- else if ( aComment == "CUTPLANES" )
- aVISUType = VISU::TCUTPLANES;
- else if ( aComment == "CUTLINES" )
- aVISUType = VISU::TCUTLINES;
- else if ( aComment == "VECTORS" )
- aVISUType = VISU::TVECTORS;
- else if ( aComment == "STREAMLINES" )
- aVISUType = VISU::TSTREAMLINES;
- else if ( aComment == "VISUGEN" )
- aVISUType = VISU::TVISUGEN;
- else if ( aComment == "VIEWMANAGER" )
- aVISUType = VISU::TVIEWMANAGER;
- else if ( aComment == "RESULT" )
- aVISUType = VISU::TRESULT;
- else if ( aComment == "XYPLOT" )
- aVISUType = VISU::TXYPLOT;
- else if ( aComment == "TABLEVIEW" )
- aVISUType = VISU::TTABLEVIEW;
- else if ( aComment == "VIEW3D" )
- aVISUType = VISU::TVIEW3D;
- else if ( aComment == "GAUSSVIEW" )
- aVISUType = VISU::TGAUSSVIEW;
- else if ( aComment == "ENTITY" )
- aVISUType = VISU::TENTITY;
- else if ( aComment == "FAMILY" )
- aVISUType = VISU::TFAMILY;
- else if ( aComment == "PART" )
- aVISUType = VISU::TPART; // MULTIPR
- else if ( aComment == "GROUP" )
- aVISUType = VISU::TGROUP;
- else if ( aComment == "FIELD" )
- aVISUType = VISU::TFIELD;
- else if ( aComment == "TIMESTAMP" )
- aVISUType = VISU::TTIMESTAMP;
- else if ( aComment == "ANIMATION" )
- aVISUType = VISU::TANIMATION;
- else if ( aComment == "ALL" )
- aVISUType = VISU::TALL;
- else
- INFOS("Error : Unknown type of VISU object!");
- }
- if(aType != QString::number(aVISUType))
- aString.replace( QString("myType=") + aType + ";",
- QString("myType=") + QString::number(aVISUType) + ";");
+ if ( aComment == "PRSMERGER" )
+ aString.replace( "myComment=PRSMERGER", "myComment=SCALARMAP" );
}
- if ( aComment == "PRSMERGER" )
- aString.replace( "myComment=PRSMERGER", "myComment=SCALARMAP" );
-
return aString.latin1();
}
+
+ //---------------------------------------------------------------
+ std::string
+ Storable
+ ::FindEntry(SALOMEDS::Study_ptr theStudyDocument,
+ const std::string& theStartEntry,
+ const TRestoringMap& theRestoringMap,
+ int IsAllLevels)
+ {
+ SALOMEDS::SObject_var aSObject = theStudyDocument->FindObjectID(theStartEntry.c_str());
+ SALOMEDS::ChildIterator_var anIter = theStudyDocument->NewChildIterator(aSObject);
+ anIter->InitEx(IsAllLevels);
+ for(; anIter->More(); anIter->Next()) {
+ aSObject = anIter->Value();
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aSObject->FindAttribute(anAttr,"AttributeString")) {
+ SALOMEDS::AttributeString_var aDataAttr = SALOMEDS::AttributeString::_narrow(anAttr);
+ CORBA::String_var aString = aDataAttr->Value();
+ VISU::Storable::TRestoringMap aRestoringMap;
+ Storable::StringToMap( aString.in(), aRestoringMap );
+ bool anIsSame = true;
+ TRestoringMap::const_iterator anIter = theRestoringMap.begin();
+ for(; anIter != theRestoringMap.end(); anIter++){
+ const TRestoringMap::key_type& aKey = anIter->first;
+ TRestoringMap::const_iterator anIter2 = aRestoringMap.find(aKey);
+ if(anIter2 != aRestoringMap.end()){
+ if (anIter->second == anIter2->second)
+ continue;
+ }
+ anIsSame = false;
+ break;
+ }
+ if(anIsSame){
+ CORBA::String_var anEntry = aSObject->GetID();
+ return anEntry.in();
+ }
+ }
+ }
+ return "";
+ }
+
+
+ //----------------------------------------------------------------------------
void
Storable
- ::StrToMap(const QString& theStr,
- VISU::Storable::TRestoringMap& theMap)
+ ::StringToMap(const QString& theString,
+ TRestoringMap& theMap)
{
- if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<<theStr);
- QStringList strList = QStringList::split( ";", theStr, false );
+ if(0 && MYDEBUG) MESSAGE("Storable::StringToMap : string="<<theString);
+ QStringList strList = QStringList::split( ";", theString, false );
for ( int i = 0; i < strList.count(); i++ ) {
QString next = strList[ i ];
int pos = next.find("=");
}
}
+
+ //----------------------------------------------------------------------------
+ Storable::TRestoringMap
+ Storable
+ ::GetStorableMap(_PTR(SObject) theSObject)
+ {
+ Storable::TRestoringMap aRestoringMap;
+ if(theSObject){
+ _PTR(GenericAttribute) anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeString")){
+ _PTR(AttributeString) aComment (anAttr);
+ std::string aValue = aComment->Value();
+ VISU::Storable::StringToMap(aValue.c_str(), aRestoringMap);
+ }
+ }
+ return aRestoringMap;
+ }
+
+
+ //----------------------------------------------------------------------------
void
Storable
::DataToStream(std::ostringstream& theStr,
try{
QString aString( CorrectPersistentString( theLocalPersistentID ) );
TRestoringMap aRestoringMap;
- StrToMap(aString, aRestoringMap);
+ StringToMap(aString, aRestoringMap);
bool anIsExists;
QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists);
if ( anIsExists ) {
//===========================================================================
- std::string
- FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument,
- const std::string& theStartEntry,
- const std::string& theComment,
- int IsAllLevels)
- {
- SALOMEDS::ChildIterator_var anIter =
- theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry.c_str()));
- anIter->InitEx(IsAllLevels);
- SALOMEDS::SObject_var aFieldSO;
- for(;anIter->More();anIter->Next()) {
- SALOMEDS::GenericAttribute_var anAttr;
- if (anIter->Value()->FindAttribute(anAttr,"AttributeString")) {
- SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr);
- CORBA::String_var aString = aCmnt->Value();
- string aValue(aString);
- if (aValue == theComment) {
- aFieldSO = anIter->Value();
- aString = aFieldSO->GetID();
- aValue = aString;
- return aValue;
- }
- }
- }
- return "";
- }
//===========================================================================
std::string
CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
const char*
GetComment() const = 0;
- typedef std::map<std::string,QString> TRestoringMap;
+ typedef std::map<std::string, QString> TRestoringMap;
typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
const std::string& thePrefix,
const TRestoringMap& theMap);
typedef std::map<std::string,TStorableEngine> TCallbackMap;
+ static
+ VISU::VISUType
+ Comment2Type(const std::string& theComment);
+
+ static
+ VISU::VISUType
+ RestoringMap2Type(const TRestoringMap& theRestoringMap);
+
+ static
+ VISU::VISUType
+ Stream2Type(const std::string& thePersistentString);
+
+ static
+ VISU::VISUType
+ SObject2Type(const _PTR(SObject)& theSObject);
+
static
std::string
CorrectPersistentString(const std::string& thePersistentString);
+ static
+ std::string
+ FindEntry(SALOMEDS::Study_ptr theStudyDocument,
+ const std::string& theStartEntry,
+ const TRestoringMap& theRestoringMap,
+ int IsAllLevels = true);
+
static
void
Registry(const std::string& theComment,
QString
FindValue(const TRestoringMap& theMap,
const std::string& theArg,
- bool* isFind = NULL);
+ bool* theIsFind = NULL);
static
QString
static
void
- StrToMap(const QString& theStr,
- VISU::Storable::TRestoringMap& theMap);
+ StringToMap(const QString& theString,
+ TRestoringMap& theMap);
+
+ static
+ TRestoringMap
+ GetStorableMap(_PTR(SObject) theSObject);
static
SALOMEDS::SObject_ptr
const std::string& theComment,
CORBA::Boolean theCreateNew = true);
- VISU_I_EXPORT
- std::string
- FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument,
- const std::string& theStartEntry,
- const std::string& theComment,
- int IsAllLevels = true);
-
VISU_I_EXPORT
SALOMEDS::SObject_var
GetSObject(_PTR(SObject));
}
if(myPublishInStudyMode == EPublishUnderTimeStamp){
SetName(GenerateName().latin1(), false);
- aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
- VISU::TTIMESTAMP,
- GetCMeshName().c_str(),
- GetEntity(),
- GetCFieldName().c_str(),
- GetTimeStampNumber(),
- GetField()->myNbComp);
- std::string aResultEntry = GetCResult()->GetEntry();
- std::string anEntry = GetCResult()->GetEntry(aComment.latin1());
+ VISU::Storable::TRestoringMap aRestoringMap;
+ aRestoringMap["myComment"] = "TIMESTAMP";
+ aRestoringMap["myMeshName"] = GetCMeshName();
+ aRestoringMap["myEntityId"] = QString::number(GetEntity());
+ aRestoringMap["myFieldName"] = GetCFieldName();
+ aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber());
+ aRestoringMap["myNumComponent"] = QString::number(GetField()->myNbComp);
+ std::string anEntry = GetCResult()->GetEntry(aRestoringMap);
if(anEntry == "")
throw std::runtime_error("There is no Entry for binding the presentation !!!");
aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
SALOMEDS::AttributeString::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
Storable::TRestoringMap aMap;
- Storable::StrToMap(aValue.in(),aMap);
+ Storable::StringToMap(aValue.in(),aMap);
bool anIsExist;
QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
if(anIsExist){
AttributeString_var aComment = AttributeString::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
Storable::TRestoringMap aMap;
- Storable::StrToMap(aValue.in(),aMap);
+ Storable::StringToMap(aValue.in(),aMap);
bool anIsExist;
QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
if(anIsExist){
SALOMEDS::AttributeString::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
Storable::TRestoringMap aMap;
- Storable::StrToMap(aValue.in(),aMap);
+ Storable::StringToMap(aValue.in(),aMap);
bool anIsExist;
QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
if (anIsExist) {
if(value.isEmpty()) continue;
VISU::Storable::TRestoringMap aMap;
- VISU::Storable::StrToMap(value, aMap);
+ VISU::Storable::StringToMap(value, aMap);
bool isExist;
QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&isExist);
const std::string& theSubMeshName, // Family or Group name
const std::string& theNewName)
{
- if (myStudyDocument->GetProperties()->IsLocked()) return;
- Mutex mt(myMutex);
+ if (myStudyDocument->GetProperties()->IsLocked())
+ return;
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
- if (!pResult) return;
+ Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+ if (!aResult)
+ return;
QString aComment;
VISU::VISUType aType;
else
aType = VISU::TGROUP;
+ VISU::Storable::TRestoringMap aRestoringMap;
+ aRestoringMap["myMeshName"] = theMeshName;
+
switch (aType) {
case VISU::TENTITY:
- aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
- VISU::TENTITY, theMeshName.c_str(), theEntity);
+ aRestoringMap["myComment"] = "ENTITY";
+ aRestoringMap["myId"] = QString::number(theEntity);
break;
case VISU::TFAMILY:
- aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- VISU::TFAMILY, theMeshName.c_str(), theEntity, theSubMeshName.c_str());
+ aRestoringMap["myComment"] = "FAMILY";
+ aRestoringMap["myEntityId"] = QString::number(theEntity);
+ aRestoringMap["myName"] = theSubMeshName;
break;
case VISU::TGROUP:
- aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
- VISU::TGROUP, theMeshName.c_str(), theSubMeshName.c_str());
+ aRestoringMap["myComment"] = "GROUP";
+ aRestoringMap["myName"] = theSubMeshName;
break;
}
- string aResultEntry = pResult->GetEntry();
- string anEntry = pResult->GetEntry(aComment.latin1());
- if (anEntry == "") return;
+ string anEntry = aResult->GetEntry(aRestoringMap);
+ if (anEntry == "")
+ return;
SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str());
-#endif
\ No newline at end of file
+#endif
}
-//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
VISU::Mesh_i
::~Mesh_i()
if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
QString aComment,aTmp;
+ std::string aMeshName = GetCMeshName();
+ VISU::TEntity anEntity = VISU::TEntity(myEntity);
+
+ VISU::Storable::TRestoringMap aRestoringMap;
+ aRestoringMap["myMeshName"] = GetCMeshName();
+
VISU::PUnstructuredGridIDMapper anIDMapper;
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
switch(myType){
case VISU::TENTITY :
- anIDMapper = anInput->GetMeshOnEntity(GetCMeshName(),
- (VISU::TEntity)myEntity);//jfa IPAL9284
- aComment = "";
- aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
- aComment.append("myMeshName=");
- aComment.append(GetCMeshName().c_str());
- aComment.append(";");
- aComment.append(aTmp.sprintf("myId=%d",myEntity));
+ anIDMapper = anInput->GetMeshOnEntity(aMeshName,
+ anEntity);//jfa IPAL9284
+ aRestoringMap["myComment"] = "ENTITY";
+ aRestoringMap["myId"] = QString::number(anEntity);
break;
case VISU::TFAMILY :
- anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(),
- (VISU::TEntity)myEntity,
+ anIDMapper = anInput->GetFamilyOnEntity(aMeshName,
+ anEntity,
mySubMeshName);
- aComment = "";
- aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY));
- aComment.append("myMeshName=");
- aComment.append(GetCMeshName().c_str());
- aComment.append(";");
- aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity));
- aComment.append("myName=");
- aComment.append(mySubMeshName);
+ aRestoringMap["myComment"] = "FAMILY";
+ aRestoringMap["myEntityId"] = QString::number(anEntity);
+ aRestoringMap["myName"] = mySubMeshName;
break;
case VISU::TGROUP :
anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
mySubMeshName);
- aComment = "";
- aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP));
- aComment.append("myMeshName=");
- aComment.append(GetCMeshName().c_str());
- aComment.append(";");
- aComment.append("myName=");
- aComment.append(mySubMeshName);
-
+ aRestoringMap["myComment"] = "GROUP";
+ aRestoringMap["myName"] = mySubMeshName;
break;
}
if(!anIDMapper)
myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
- string anEntry = GetCResult()->GetEntry(aComment.latin1());
+ string anEntry = GetCResult()->GetEntry(aRestoringMap);
if(anEntry == "")
throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
continue;
- aComment = "";
- aComment.append("myComment=MESH;");
- aComment.append("myName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append(aTmp.sprintf("myDim=%d",aMesh->myDim));
+ aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+ aMeshName.c_str(),
+ aMesh->myDim);
aMesh->myEntry =
CreateAttributes(theStudy,
theResultEntry,
aComment.latin1(),
true);
- aComment = "";
- aComment.append("myComment=FAMILIES;");
- aComment.append("myMeshName=");aComment.append(aMeshName);
+ aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
+ aMeshName.c_str());
string aSubMeshesEntry =
CreateAttributes(theStudy,
aMesh->myEntry,
continue;
}
- aComment = "";
- aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
- aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append(aTmp.sprintf("myId=%d",anEntity));
-
+ aComment.sprintf("myComment=ENTITY;myMeshName=%s;myId=%d",
+ aMeshName.c_str(),
+ anEntity);
aMeshOnEntity->myEntry =
CreateAttributes(theStudy,
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const string& aFamilyName = aFamilyMapIter->first;
const PFamily& aFamily = aFamilyMapIter->second;
- aComment = "";
- aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",TFAMILY));
- aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
- aComment.append("myName=");aComment.append(aFamilyName);
+ aComment.sprintf("myComment=FAMILY;myMeshName=%s;myEntityId=%d;myName=%s",
+ aMeshName.c_str(),
+ anEntity,
+ aFamilyName.c_str());
aFamily->myEntry =
CreateAttributes(theStudy,
//Importing groups
const TGroupMap& aGroupMap = aMesh->myGroupMap;
if(!aGroupMap.empty()){
- aComment = "";
- aComment.append("myComment=GROUPS;");
- aComment.append("myMeshName=");aComment.append(aMeshName);
-
+ aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+ aMeshName.c_str());
+
UpdateAttributes(theStudy,
aMesh->myGroupsEntry,
"",
for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
const string& aGroupName = aGroupMapIter->first;
const PGroup& aGroup = aGroupMapIter->second;
- aComment = "";
- aComment.sprintf("myComment=GROUP;myType=%d;",
- TGROUP);
- aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append("myName=");aComment.append(aGroupName);
+ aComment.sprintf("myComment=GROUP;myMeshName=%s;myName=%s",
+ aMeshName.c_str(),
+ aGroupName.c_str());
aGroup->myEntry =
CreateAttributes(theStudy,
aMesh->myGroupsEntry,
const PField& aField = aFieldMapIter->second;
const TValField& aValField = aField->myValField;
QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
- aComment = "";
- aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD);
- aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
- aComment.append("myName=");aComment.append(aFieldName);aComment.append(";");
- aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size()));
- aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp));
-
+ aComment.sprintf("myComment=FIELD;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aValField.size(),
+ aField->myNbComp);
+
aField->myEntry = CreateAttributes(
theStudy,
aMesh->myFieldsEntry,
{
int aTimeStamp = aValFieldIter->first;
const PValForTime& aValForTime = aValFieldIter->second;
- aComment = "";
- aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP);
- aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
- aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
- aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";");
- aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp));
+ aComment.sprintf("myComment=TIMESTAMP;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aTimeStamp,
+ aField->myNbComp);
string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
CORBA::String_var aSComponentEntry = mySComponent->GetID();
CORBA::String_var anIOR(GetID());
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+ aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
GetComment(),
- VISU::TRESULT,
myFileInfo.filePath().latin1(),
myInitFileName.c_str()); // Restoring of Python dump
string aResultEntry =
mySComponent = mySObject->GetFatherComponent();
myName = VISU::Storable::FindValue(theMap, "myName").latin1();
myInitFileName = VISU::Storable::FindValue(theMap, "myInitFileName").latin1();
-
+
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
if (mySObject->FindSubObject(1, aRefSObj) &&
aRefSObj->ReferencedObject(aTargetRefSObj))
}
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
- GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
+ aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
+ GetComment(),
+ myFileInfo.filePath().latin1(),
myInitFileName.c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if (!theSObject->FindAttribute(anAttr, "AttributeString"))
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
- ECreationId aCreationId = ECreationId(Storable::FindValue(theMap,"myCreationId").toInt());
+ ECreationId aCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
ESourceId aSourceId = eRestoredFile;
if(aCreationId == eImportMed || aCreationId == eImportMedField)
aSourceId = eRestoredComponent;
std::string
VISU::Result_i
-::GetEntry(const std::string& theComment)
+::GetEntry(const Storable::TRestoringMap& theRestoringMap)
{
- return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
+ return Storable::FindEntry(myStudyDocument,
+ GetEntry(),
+ theRestoringMap);
}
#include <stdio.h>
const SALOMEDS::SObject_var& GetSObject() const;
const SALOMEDS::Study_var& GetStudyDocument() const;
const SALOMEDS::SComponent_var& GetSComponent() const;
- std::string GetEntry(const std::string& theComment);
+ std::string GetEntry(const Storable::TRestoringMap& theRestoringMap);
// Info on structured mesh contained in TInput
public:
// create SObject and set attributes
QString aComment;
if(pCutLines)
- aComment.sprintf("myComment=%s;myType=%d;mySourceId=CutLines",GetComment(),VISU::TTABLE);
+ aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment());
else{
- aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableAttr",GetComment(),VISU::TTABLE);
+ aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment());
SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){
SALOMEDS::AttributeString_var aCommentAttr =
SALOMEDS::AttributeString::_narrow(anAttr);
CORBA::String_var aValue = aCommentAttr->Value();
Storable::TRestoringMap aMap;
- Storable::StrToMap(aValue.in(),aMap);
+ Storable::StringToMap(aValue.in(),aMap);
bool anIsExist;
QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
if(anIsExist){
if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
- aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableFile",GetComment(),VISU::TTABLE);
+ aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
}
}
}
SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
// create SObject and set attributes
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
+ aComment.sprintf("myComment=%s",GetComment());
string anEntry = CreateAttributes( GetStudyDocument(),
myTable->GetObjectEntry(),
"",
SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
// create SObject and set attributes
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER);
+ aComment.sprintf("myComment=%s",GetComment());
string anEntry = CreateAttributes( GetStudyDocument(),
SComponent->GetID(),
"",
aNewData.myNbFrames = 0;
aNewData.myPrsType = VISU::TSCALARMAP;
aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0;
- VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
- if(VISU::Storable::FindValue(aMap,"myComment") != QString("FIELD"))
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aNewData.myField);
+ if(VISU::Storable::FindValue(aMap,"myComment") != "FIELD")
return false;
aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
long aNumCompCurr = VISU::Storable::FindValue(aMap, "myNumComponent").toLong();
if ( !myFieldsLst.isEmpty() ) {
- VISU::Storable::TRestoringMap aFMap = getMapOfValue(myFieldsLst.first().myField);
+ VISU::Storable::TRestoringMap aFMap = VISU::Storable::GetStorableMap(myFieldsLst.first().myField);
long aNumComp = VISU::Storable::FindValue(aFMap, "myNumComponent").toLong();
if ( aNumCompCurr != aNumComp )
return false;
break;
}
- VISU::Storable::TRestoringMap aTimeMap = VISU_TimeAnimation::getMapOfValue(aTimeStamp);
+ VISU::Storable::TRestoringMap aTimeMap = VISU::Storable::GetStorableMap(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");
clearData(aData);
VISU::Result_i* aResult = createPresent(aData.myField);
- VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aData.myField);
aData.myNbFrames = aData.myNbTimes;
//VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
-//------------------------------------------------------------------------
-VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) theSObject)
-{
- VISU::Storable::TRestoringMap aMap;
- if (theSObject) {
- _PTR(GenericAttribute) anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aComment (anAttr);
- std::string aString = aComment->Value();
- QString strIn (aString.c_str());
- VISU::Storable::StrToMap(strIn, aMap);
- }
- }
- return aMap;
-}
-
//------------------------------------------------------------------------
double VISU_TimeAnimation::getTimeValue (_PTR(SObject) theTimeStamp)
{
std::string aSComponentEntry = aSComponent->GetID();
QString aComment;
- aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
- VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode);
+ aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
+ myTimeMinVal,
+ myTimeMaxVal,
+ myAnimationMode);
string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","",
GenerateName(),"",aComment,true);
std::string aSComponentEntry = aSComponent->GetID();
QString aComment;
- aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
- VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode);
+ aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
+ myTimeMinVal,
+ myTimeMaxVal,
+ myAnimationMode);
_PTR(GenericAttribute) anAttr;
anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeString");
{
_PTR(SObject) aAnimSObject = theField;
- VISU::Storable::TRestoringMap aMap;
- _PTR(GenericAttribute) anAttr;
- if (!aAnimSObject->FindAttribute(anAttr, "AttributeString")) return;
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aAnimSObject);
+ if (aMap.empty())
+ return;
- _PTR(AttributeString) aComment (anAttr);
- string aComm = aComment->Value();
- QString strIn (aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
bool isExist;
-
myTimeMinVal = VISU::Storable::FindValue(aMap,"myTimeMinVal",&isExist).toDouble();
myTimeMaxVal = VISU::Storable::FindValue(aMap,"myTimeMaxVal",&isExist).toDouble();
myAnimationMode = VISU::Storable::FindValue(aMap,"myMode",&isExist).toInt();
// Get Presentation object
_PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj);
anPrsIter->Init();
- if (!anPrsIter->More()) continue;
+ if (!anPrsIter->More())
+ continue;
_PTR(SObject) aPrsObj = anPrsIter->Value();
+ _PTR(GenericAttribute) anAttr;
if (!aPrsObj->FindAttribute(anAttr, "AttributeName"))
continue;
_PTR(AttributeName) aName (anAttr);
continue;
generatePresentations(getNbFields()-1);
- if (!aPrsObj->FindAttribute(anAttr, "AttributeString"))
+ VISU::Storable::TRestoringMap aPrsMap = VISU::Storable::GetStorableMap(aPrsObj);
+ if (aPrsMap.empty())
continue;
- _PTR(AttributeString) aPrsComment (anAttr);
- string aPrsComm = aPrsComment->Value();
- if (aPrsComm.length() > 0) {
- QString strPrsIn (aPrsComm.c_str());
- VISU::Storable::TRestoringMap aPrsMap;
- VISU::Storable::StrToMap(strPrsIn,aPrsMap);
-
- aData.myPrs[0]->Restore(VISU::GetSObject(aData.myField), aPrsMap);
- }
+ aData.myPrs[0]->Restore(VISU::GetSObject(aData.myField), aPrsMap);
aData.myPrs[0]->GetOffset(aData.myOffset);
for (int i = 1; i < aData.myNbFrames; i++) {
bool anIsFixedRange = false;
//static double getTimeValue (SALOMEDS::SObject_var theTimestamp);
static VISU::Result_i* createPresent (_PTR(SObject) theField);
- static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject);
static double getTimeValue (_PTR(SObject) theTimestamp);
VISU_TimeAnimation(_PTR(Study) theStudy,
_PTR(SObject) anObj = aList[i];
string anEntry = anObj->GetID();
if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
- if (anObj->FindAttribute(anAttr, "AttributeString")) {
- _PTR(AttributeString) aCmnt (anAttr);
- QString strIn(aCmnt->Value().c_str());
- Storable::TRestoringMap aMap;
- Storable::StrToMap(strIn, aMap);
- if (Storable::FindValue(aMap, "myComment").compare
- (View3D_i::myComment.c_str()) >= 0) {
- if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
- Restore(theViewManager->getActiveView(), aMap);
- return true;
- }
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj);
+ if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment) {
+ Restore(theViewManager->getActiveView(), aMap);
+ return true;
}
}
return false;
void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
{
- Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
-
vtkFloatingPointType backint[3];
GetRenderer(theViewWindow)->GetBackground(backint);
Storable::DataToStream(theStr,"myColor.R",backint[0]);