From: apo Date: Wed, 1 Nov 2006 12:19:07 +0000 (+0000) Subject: 1. Implement publishing new presentations in corresponding sub-tree. X-Git-Tag: WP1_2_3_06-10-2006~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af60fbcb59866c39a5cd59aaf1d65d0b165fe290;p=modules%2Fvisu.git 1. Implement publishing new presentations in corresponding sub-tree. 2. To move ColoredPrs3d attributes in private section --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index aee24b7f..ab1727f5 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1727,21 +1727,21 @@ OnCopyPresentation() case VISU::TMESH: { VISU::Mesh_i* aMeshPrs = dynamic_cast(aPrsObject); - VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult()); + VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetCResult()); aSameMesh->SameAs(aMeshPrs); } break; case VISU::TSCALARMAP: { VISU::ScalarMap_i* aScalarPrs = dynamic_cast(aPrsObject); - VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true); + VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetCResult()); aSameScalar->SameAs(aScalarPrs); } break; case VISU::TDEFORMEDSHAPE: { VISU::DeformedShape_i* aDefPrs = dynamic_cast(aPrsObject); - VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true); + VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetCResult()); aSameDeformed->SameAs(aDefPrs); } break; @@ -1750,49 +1750,49 @@ OnCopyPresentation() VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast(aPrsObject); VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = - new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true); + new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetCResult()); aSameScalarMapOnDeformed->SameAs(aDefPrs); } break; case VISU::TCUTPLANES: { VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject); - VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true); + VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetCResult()); aSameCut->SameAs(aCutPrs); } break; case VISU::TCUTLINES: { VISU::CutLines_i* aCutPrs = dynamic_cast(aPrsObject); - VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true); + VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetCResult()); aSameCut->SameAs(aCutPrs); } break; case VISU::TISOSURFACE: { VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast(aPrsObject); - VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true); + VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetCResult()); aSameIso->SameAs(aIsoPrs); } break; case VISU::TSTREAMLINES: { VISU::StreamLines_i* aLinesPrs = dynamic_cast(aPrsObject); - VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true); + VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetCResult()); aSameLines->SameAs(aLinesPrs); } break; case VISU::TVECTORS: { VISU::Vectors_i* aVectorsPrs = dynamic_cast(aPrsObject); - VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true); + VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetCResult()); aSameVectors->SameAs(aVectorsPrs); } break; case VISU::TPLOT3D: { VISU::Plot3D_i* aPlot3DPrs = dynamic_cast(aPrsObject); - VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult(),true); + VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetCResult()); aSamePlot3D->SameAs(aPlot3DPrs); } break; diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index d3cd143e..48360aad 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -950,7 +950,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() if (myPlanes.empty() || myIsSelectPlane || !WidgetIJKTab->isEnabled()) return; - VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0; + VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0; if (!result) return; @@ -1020,7 +1020,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() //================================================================================= void VisuGUI_ClippingDlg::setIJKByNonStructured() { - if (!myPrs3d || myPlanes.empty() || !myPrs3d->GetResult()) + if (!myPrs3d || myPlanes.empty() || !myPrs3d->GetCResult()) return; // get plane normal @@ -1036,7 +1036,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() gp_Dir dir, gridDir; double maxDot = 0; const vector *curValues, *values = 0; - VISU::Result_i* result = myPrs3d->GetResult(); + VISU::Result_i* result = myPrs3d->GetCResult(); for (i = 0; i < 3; ++i) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i; CORBA::String_var aMeshName = myPrs3d->GetMeshName(); @@ -1089,7 +1089,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() //================================================================================= bool VisuGUI_ClippingDlg::isStructured() const { - VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0; + VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0; if (result) { gp_Dir dir; CORBA::String_var aMeshName = myPrs3d->GetMeshName(); @@ -1108,7 +1108,7 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId) { // set index range int maxIndex = 0; - VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0; + VISU::Result_i* result = myPrs3d ? myPrs3d->GetCResult() : 0; if (result) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axisId; gp_Dir dir; diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 4ff285f3..fad1a6ae 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -301,7 +301,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs) setOrientation2(thePrs->GetOrientationType2()); hasInit = true; - myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false); + myCutLines = new VISU::CutLines_i(thePrs->GetCResult(), + VISU::ColoredPrs3d_i::EDoNotPublish); myCutLines->SameAs(thePrs); myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted()); if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true); diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index c7c9f190..d7b4aeb7 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -185,7 +185,8 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs) myPosSpn->setValue(thePrs->GetDisplacement()); hasInit = true; // init table - myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false); + myCutPlanes = new VISU::CutPlanes_i(thePrs->GetCResult(), + VISU::ColoredPrs3d_i::EDoNotPublish); myCutPlanes->SameAs(thePrs); DrawTable(); diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index e93bedef..10ae96f3 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -464,7 +464,7 @@ float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(const char* const int theIter, const VISU::TEntity theEntity){ float ret=1; - VISU::Result_i* theResult = myPrs->GetResult(); + VISU::Result_i* theResult = myPrs->GetCResult(); VISU::PField aField = theResult->GetInput()->GetField(theMeshName,theEntity,theFieldName); if(!aField) return ret; VISU::TValField& aValField = aField->myValField; diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index 72c1635d..91624f8f 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -97,7 +97,10 @@ namespace VISU{ //=========================================================================== static Storable::TCallbackMap VisuStoreMap; - string Storable::ToString(){ + std::string + Storable + ::ToString() + { ostringstream strOut; Storable::DataToStream( strOut, "myComment", GetComment() ); ToStream(strOut); @@ -106,7 +109,10 @@ namespace VISU{ return strOut.str(); } - void Storable::Registry(const char* theComment, TStorableEngine theEngine) + void + Storable + ::Registry(const std::string& theComment, + TStorableEngine theEngine) { if(!VisuStoreMap.insert(TCallbackMap::value_type(theComment,theEngine)).second){ if(MYDEBUG) MESSAGE("Storable::Registry >> dupliacte registring !!!"); @@ -114,7 +120,11 @@ namespace VISU{ } } - void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){ + void + Storable + ::StrToMap(const QString& theStr, + VISU::Storable::TRestoringMap& theMap) + { if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<NewChildIterator(theStudyDocument->FindObjectID(theStartEntry)); + theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry.c_str())); anIter->InitEx(IsAllLevels); SALOMEDS::SObject_var aFieldSO; for(;anIter->More();anIter->Next()) { @@ -280,41 +326,45 @@ namespace VISU{ return ""; } //=========================================================================== - string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, - const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, - const char* thePersistentRef, const char* theComment, - CORBA::Boolean theCreateNew) + std::string + CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + const std::string& theFatherEntry, + const std::string& theRefFatherEntry, + const std::string& theIOR, + const std::string& theName, + const std::string& thePersistentRef, + const std::string& theComment, + CORBA::Boolean theCreateNew) { SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder(); - SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry); + SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str()); SALOMEDS::SObject_var newObj; if (theCreateNew) newObj = aStudyBuilder->NewObject(aFather); else newObj = aFather; SALOMEDS::GenericAttribute_var anAttr; - if(strcmp(theIOR,"") != 0){ + if(theIOR != ""){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(theIOR); + anIOR->SetValue(theIOR.c_str()); } - if(strcmp(theName,"") != 0){ + if(theName != ""){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theName); + aName->SetValue(theName.c_str()); } - if(strcmp(thePersistentRef,"") != 0){ + if(thePersistentRef != ""){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef"); SALOMEDS::AttributePersistentRef_var aPRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr); - aPRef->SetValue(thePersistentRef); + aPRef->SetValue(thePersistentRef.c_str()); } - if(strcmp(theComment,"") != 0){ + if(theComment != ""){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); - aCmnt->SetValue(theComment); + aCmnt->SetValue(theComment.c_str()); if(MYDEBUG) INFOS("CreateAttributes - Comment = "<FindObjectID(theRefFatherEntry); + if(theRefFatherEntry != ""){ + SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry.c_str()); SALOMEDS::SObject_var anObj = aStudyBuilder->NewObject(aRefFather); aStudyBuilder->Addreference(anObj,newObj); } @@ -324,11 +374,16 @@ namespace VISU{ INFOS("CreateAttributes - StudyId = "<StudyId()<<"; anEntry = "<NewBuilder(); _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry); @@ -339,28 +394,28 @@ namespace VISU{ newObj = aFather; _PTR(GenericAttribute) anAttr; - if (strcmp(theIOR, "") != 0) { + if (theIOR != "") { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); _PTR(AttributeIOR) anIOR (anAttr); anIOR->SetValue(theIOR); } - if (strcmp(theName, "") != 0) { + if (theName != "") { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); _PTR(AttributeName) aName (anAttr); aName->SetValue(theName); } - if (strcmp(thePersistentRef, "") != 0) { + if (thePersistentRef != "") { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef"); _PTR(AttributePersistentRef) aPRef (anAttr); aPRef->SetValue(thePersistentRef); } - if (strcmp(theComment, "") != 0) { + if (theComment != "") { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); _PTR(AttributeComment) aCmnt (anAttr); aCmnt->SetValue(theComment); if (MYDEBUG) INFOS("CreateAttributes - Comment = " << theComment); } - if (strcmp(theRefFatherEntry, "") != 0) { + if (theRefFatherEntry != "") { _PTR(SObject) aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry); _PTR(SObject) anObj = aStudyBuilder->NewObject(aRefFather); aStudyBuilder->Addreference(anObj, newObj); @@ -372,7 +427,9 @@ namespace VISU{ return aRet; } - QString GenerateName(const string& theFmt, int theId){ + QString + GenerateName(const string& theFmt, int theId) + { static QString aName; if(theId > 0) aName.sprintf("%s:%d",theFmt.c_str(),theId); @@ -382,7 +439,8 @@ namespace VISU{ } - SALOMEDS::StudyManager_var GetStudyManager() + SALOMEDS::StudyManager_var + GetStudyManager() { static SALOMEDS::StudyManager_var aStudyManager; if(CORBA::is_nil(aStudyManager)){ @@ -394,7 +452,8 @@ namespace VISU{ } - SALOMEDS::Study_var GetDSStudy(_PTR(Study) theStudy) + SALOMEDS::Study_var + GetDSStudy(_PTR(Study) theStudy) { //std::string aStudyName = theStudy->Name(); //return GetStudyManager()->GetStudyByName(aStudyName.c_str()); @@ -402,7 +461,8 @@ namespace VISU{ return GetStudyManager()->GetStudyByID(aStudyID); } - SALOMEDS::SObject_var GetSObject( _PTR(SObject) obj ) + SALOMEDS::SObject_var + GetSObject( _PTR(SObject) obj ) { _PTR(Study) aStudy = obj->GetStudy(); SALOMEDS::Study_var aSalomeDSStudy = GetDSStudy( aStudy ); @@ -410,17 +470,19 @@ namespace VISU{ return aSalomeDSStudy->FindObjectID( id.c_str() ); } - _PTR(SObject) GetClientSObject( SALOMEDS::SObject_var obj, - _PTR(Study) study ) + _PTR(SObject) + GetClientSObject( SALOMEDS::SObject_var obj, + _PTR(Study) study ) { return study->FindObjectID( obj->GetID() ); } - void RemoveFromStudy (SALOMEDS::SObject_ptr theSObject, - bool theIsAttrOnly, - bool theDestroySubObjects) + void + RemoveFromStudy (SALOMEDS::SObject_ptr theSObject, + bool theIsAttrOnly, + bool theDestroySubObjects) { if (theSObject->_is_nil()) return; @@ -460,9 +522,10 @@ namespace VISU{ aStudyBuilder->RemoveObjectWithChildren(theSObject); } - void RemoveFromStudy (_PTR(SObject) theSObject, - bool theIsAttrOnly, - bool theDestroySubObjects) + void + RemoveFromStudy (_PTR(SObject) theSObject, + bool theIsAttrOnly, + bool theDestroySubObjects) { if (!theSObject) return; diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index 48ea0f5f..c3326194 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -115,21 +115,69 @@ namespace VISU protected: virtual void ToStream(std::ostringstream& theStr) = 0; public: - std::string ToString(); - virtual const char* GetComment() const = 0; + std::string + ToString(); + + virtual + const char* + GetComment() const = 0; + typedef std::map TRestoringMap; + typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, - const std::string& thePrefix, const TRestoringMap& theMap); + const std::string& thePrefix, + const TRestoringMap& theMap); typedef std::map TCallbackMap; - static void Registry(const char* theComment, TStorableEngine theEngine); - static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString); - static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL); - static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue); - static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap); - static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject); - static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal); - static void DataToStream(std::ostringstream& theStr, const QString& theName, const int theVal); - static void DataToStream(std::ostringstream& theStr, const QString& theName, const double theVal); + + static + void + Registry(const std::string& theComment, + TStorableEngine theEngine); + + static + Storable* + Create(SALOMEDS::SObject_ptr, + const std::string& thePrefix, + const std::string& theString); + + static + QString + FindValue(const TRestoringMap& theMap, + const std::string& theArg, + bool* isFind = NULL); + + static + QString + FindValue(const TRestoringMap& theMap, + const std::string& theArg, + const QString& theDefaultValue); + + static + void + StrToMap(const QString& theStr, + VISU::Storable::TRestoringMap& theMap); + + static + SALOMEDS::SObject_ptr + GetResultSO(SALOMEDS::SObject_ptr theSObject); + + static + void + DataToStream(std::ostringstream& theStr, + const QString& theName, + const QString& theVal); + + static + void + DataToStream(std::ostringstream& theStr, + const QString& theName, + const int theVal); + + static + void + DataToStream(std::ostringstream& theStr, + const QString& theName, + const double theVal); }; //=========================================================================== @@ -151,32 +199,49 @@ namespace VISU _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument); SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument); - std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, - const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, - const char* thePersistentRef, const char* theComment, - CORBA::Boolean theCreateNew = true); - - std::string CreateAttributes(_PTR(Study) theStudyDocument, - const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, - const char* thePersistentRef, const char* theComment, - CORBA::Boolean theCreateNew = true); - - std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, - const char* theComment, int IsAllLevels = true); - - SALOMEDS::SObject_var GetSObject(_PTR(SObject)); - _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study)); - - SALOMEDS::Study_var GetDSStudy(_PTR(Study)); - - void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, - bool theIsAttrOnly = true, - bool theDestroySubObjects = false); - void RemoveFromStudy(_PTR(SObject) theSObject, - bool theIsAttrOnly = true, - bool theDestroySubObjects = false); + std::string + CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + const std::string& theFatherEntry, + const std::string& theRefFatherEntry, + const std::string& theIOR, + const std::string& theName, + const std::string& thePersistentRef, + const std::string& theComment, + CORBA::Boolean theCreateNew = true); + + std::string + CreateAttributes(_PTR(Study) theStudyDocument, + const std::string& theFatherEntry, + const std::string& theRefFatherEntry, + const std::string& theIOR, + const std::string& theName, + const std::string& thePersistentRef, + const std::string& theComment, + CORBA::Boolean theCreateNew = true); + + std::string + FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, + const std::string& theStartEntry, + const std::string& theComment, + int IsAllLevels = true); + + SALOMEDS::SObject_var + GetSObject(_PTR(SObject)); + + _PTR(SObject) + GetClientSObject(SALOMEDS::SObject_var, _PTR(Study)); + + SALOMEDS::Study_var + GetDSStudy(_PTR(Study)); + + void + RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, + bool theIsAttrOnly = true, + bool theDestroySubObjects = false); + void + RemoveFromStudy(_PTR(SObject) theSObject, + bool theIsAttrOnly = true, + bool theDestroySubObjects = false); } #endif diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 7a06e9f9..4041be75 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -46,9 +46,10 @@ static int MYDEBUG = 0; //============================================================================ VISU::ColoredPrs3d_i:: ColoredPrs3d_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), + Prs3d_i(theResult), + myPublishInStudyMode(thePublishInStudyMode), myScalarMapPL(NULL), myIsFixedRange(false) {} @@ -57,9 +58,10 @@ ColoredPrs3d_i(Result_i* theResult, //--------------------------------------------------------------- VISU::ColoredPrs3d_i:: ColoredPrs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), + myPublishInStudyMode(EDoNotPublish), myScalarMapPL(NULL), myIsFixedRange(false) {} @@ -104,7 +106,7 @@ VISU::ColoredPrs3d_i if(TSuperClass::SetInput()){ if(CheckIsPossible()){ if(OnSetInput()){ - if(Create(GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber())) + if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber())) return true; }else return true; @@ -149,6 +151,17 @@ VISU::ColoredPrs3d_i return myEntity; } + +//---------------------------------------------------------------------------- +VISU::TEntity +VISU::ColoredPrs3d_i +::GetTEntity() const +{ + return VISU::TEntity(int(myEntity)); +} + + +//---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i ::SetFieldName(const char* theFieldName) @@ -159,6 +172,8 @@ VISU::ColoredPrs3d_i } } + +//---------------------------------------------------------------------------- char* VISU::ColoredPrs3d_i ::GetFieldName() @@ -166,6 +181,35 @@ VISU::ColoredPrs3d_i return CORBA::string_dup(myFieldName.c_str()); } + +//---------------------------------------------------------------------------- +std::string +VISU::ColoredPrs3d_i +::GetCFieldName() const +{ + return myFieldName; +} + + +//---------------------------------------------------------------------------- +const VISU::PField& +VISU::ColoredPrs3d_i +::GetField() const +{ + return myField; +} + + +//--------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetField(VISU::PField theField) +{ + myField = theField; +} + + +//---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i ::SetTimeStampNumber(CORBA::Long theTimeStampNumber) @@ -176,6 +220,8 @@ VISU::ColoredPrs3d_i } } + +//---------------------------------------------------------------------------- CORBA::Long VISU::ColoredPrs3d_i ::GetTimeStampNumber() @@ -192,9 +238,9 @@ VISU::ColoredPrs3d_i if(const ColoredPrs3d_i* aPrs3d = dynamic_cast(theOrigin)){ ColoredPrs3d_i* anOrigin = const_cast(aPrs3d); - SetMeshName(anOrigin->GetMeshName()); + SetMeshName(anOrigin->GetCMeshName().c_str()); SetEntity(anOrigin->GetEntity()); - SetFieldName(anOrigin->GetFieldName()); + SetFieldName(anOrigin->GetCFieldName().c_str()); SetTimeStampNumber(anOrigin->GetTimeStampNumber()); OnSetInput(); @@ -245,6 +291,7 @@ VISU::ColoredPrs3d::TimeStampsRange* VISU::ColoredPrs3d_i ::GetTimeStampsRange() { + // To exclude timstamps with repeated time typedef std::map TTimeStampsRange; TTimeStampsRange aRange; { @@ -257,13 +304,27 @@ VISU::ColoredPrs3d_i aRange[aTime] = aTimeStampNumber; } } - VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange(); + + // To sort timestamps according to their timestamp number + typedef std::map TTimeStampsSortedRange; + TTimeStampsSortedRange aSortedRange; { - aTimeStampsRange->length(aRange.size()); TTimeStampsRange::const_iterator anIter = aRange.begin(); for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){ vtkIdType aTimeStampNumber = anIter->second; const std::string& aTime = anIter->first; + aSortedRange[aTimeStampNumber] = aTime; + } + } + + // To map the C++ data structures to the corresponding CORBA ones + VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange(); + { + aTimeStampsRange->length(aRange.size()); + TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin(); + for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){ + vtkIdType aTimeStampNumber = anIter->first; + const std::string& aTime = anIter->second; VISU::ColoredPrs3d::TimeStampInfo anInfo; anInfo.myNumber = aTimeStampNumber; anInfo.myTime = aTime.c_str(); @@ -398,10 +459,10 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetTitle(const char* theName) +::SetTitle(const char* theTitle) { - if(myTitle != theName){ - myTitle = theName; + if(myTitle != theTitle){ + myTitle = theTitle; myParamsTime.Modified(); } } @@ -413,6 +474,13 @@ VISU::ColoredPrs3d_i return CORBA::string_dup(myTitle.c_str()); } +std::string +VISU::ColoredPrs3d_i +::GetCTitle() +{ + return myTitle; +} + bool VISU::ColoredPrs3d_i ::IsBoldTitle() @@ -596,20 +664,35 @@ VISU::ColoredPrs3d_i } +//---------------------------------------------------------------------------- +bool +VISU::ColoredPrs3d_i +::IsRangeFixed() +{ + return myIsFixedRange; +} + +void +VISU::ColoredPrs3d_i +::UseFixedRange(bool theUseFixedRange) +{ + myIsFixedRange = theUseFixedRange; +} + //---------------------------------------------------------------------------- /** * Creates ColoredPrs3d and initialises it from resources */ VISU::Storable* VISU::ColoredPrs3d_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { - SetMeshName(theMeshName); + SetMeshName(theMeshName.c_str()); SetEntity(theEntity); - SetFieldName(theFieldName); + SetFieldName(theFieldName.c_str()); SetTimeStampNumber(theTimeStampNumber); OnSetInput(); @@ -723,8 +806,6 @@ VISU::ColoredPrs3d_i SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt()); OnSetInput(); - myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study. - Build(ERestore); TSuperClass::Restore(theMap); @@ -769,10 +850,10 @@ VISU::ColoredPrs3d_i Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) ); Storable::DataToStream( theStr, "myOrientation", myOrientation ); - Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); - Storable::DataToStream( theStr, "myEntity", myEntity ); - Storable::DataToStream( theStr, "myFieldName", myFieldName.c_str() ); - Storable::DataToStream( theStr, "myIteration", int(myTimeStampNumber) ); + Storable::DataToStream( theStr, "myMeshName", GetCMeshName() ); + Storable::DataToStream( theStr, "myEntity", GetEntity() ); + Storable::DataToStream( theStr, "myFieldName", GetCFieldName() ); + Storable::DataToStream( theStr, "myIteration", int(GetTimeStampNumber()) ); Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); @@ -814,6 +895,30 @@ VISU::ColoredPrs3d_i SetPipeLine(myScalarMapPL); } +//---------------------------------------------------------------------------- +std::string +FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy) +{ + static char aFolderName[] = "3D Presentations"; + CORBA::String_var anEntry; + SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName); + if(!CORBA::is_nil(aSObject) && aSObject->Depth() == 3){ + anEntry = aSObject->GetID(); + return anEntry.in(); + } + SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy); + CORBA::String_var aFatherEntry = aSComponent->GetID(); + anEntry = VISU::CreateAttributes(theStudy, + aFatherEntry.in(), + "", + "", + aFolderName, + "", + "", + true).c_str(); + return anEntry.in(); +} + //---------------------------------------------------------------------------- VISU::Storable* VISU::ColoredPrs3d_i @@ -822,7 +927,7 @@ VISU::ColoredPrs3d_i if(MYDEBUG) MESSAGE("ColoredPrs3d_i::Build - "<myTime).c_str()); + const VISU::TValField& aValField = GetField()->myValField; + const VISU::PValForTime aValForTime = aValField.find(GetTimeStampNumber())->second; + aComment.sprintf("%s %s", + GetCFieldName().c_str(), + VISU_Convertor::GenerateName(aValForTime->myTime).c_str()); if(theBuildMode == ECreateNew) myTitle = aComment.simplifyWhiteSpace().latin1(); } - if(myAddToStudy){ + if(myPublishInStudyMode == EPublishUnderTimeStamp){ myName = GenerateName().latin1(); aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", - VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myTimeStampNumber,myField->myNbComp); - std::string aResultEntry = myResult->GetEntry(); - std::string aRefFatherEntry = myResult->GetRefFatherEntry(); - std::string anEntry = myResult->GetEntry(aComment.latin1()); + VISU::TTIMESTAMP, + GetCMeshName().c_str(), + GetEntity(), + GetCFieldName().c_str(), + GetTimeStampNumber(), + GetField()->myNbComp); + std::string aResultEntry = GetCResult()->GetEntry(); + std::string aRefFatherEntry = GetCResult()->GetRefFatherEntry(); + std::string anEntry = GetCResult()->GetEntry(aComment.latin1()); 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", - GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myTimeStampNumber,myField->myNbComp); + GetComment(), + GetCMeshName().c_str(), + GetEntity(), + GetCFieldName().c_str(), + GetTimeStampNumber(), + GetField()->myNbComp); CORBA::String_var anIOR = GetID(); - CreateAttributes(GetStudyDocument(),anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); - mySObject = GetStudyDocument()->FindObjectIOR(anIOR); + CreateAttributes(GetStudyDocument(), + anEntry, + aRefFatherEntry, + anIOR.in(), + myName, + "", + aComment.latin1(), + true); + SetSObject(GetStudyDocument()->FindObjectIOR(anIOR)); + }else if(myPublishInStudyMode == EPublishIndependently){ + myName = GenerateName().latin1(); + CORBA::String_var anIOR = GetID(); + std::string aFatherEntry = FindOrCreate3DPresentationsFolder(GetStudyDocument()); + CreateAttributes(GetStudyDocument(), + aFatherEntry, + "", + anIOR.in(), + myName, + "", + "", + true); + SetSObject(GetStudyDocument()->FindObjectIOR(anIOR)); } #ifndef _DEXCEPT_ }catch(std::exception& exc){ @@ -862,23 +999,7 @@ VISU::ColoredPrs3d_i throw; } #endif - if(myAddToStudy) + if(myPublishInStudyMode != EDoNotPublish) aStudyBuilder->CommitCommand(); return this; } - - -//---------------------------------------------------------------------------- -const VISU::PField& -VISU::ColoredPrs3d_i -::GetField() const -{ - return myField; -} - -VISU::TEntity -VISU::ColoredPrs3d_i -::GetTEntity() const -{ - return VISU::TEntity(int(myEntity)); -} diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 9c28c902..afd7f67e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -43,12 +43,17 @@ namespace VISU //---------------------------------------------------------------------------- typedef Prs3d_i TSuperClass; + /*! + The enumeration allow to define what mode should be used for the presentation building. + */ + enum EPublishInStudyMode {EPublishUnderTimeStamp, EPublishIndependently, EDoNotPublish}; + explicit ColoredPrs3d_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit ColoredPrs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~ColoredPrs3d_i(); @@ -66,6 +71,9 @@ namespace VISU Entity GetEntity(); + TEntity + GetTEntity() const; + virtual void SetFieldName(const char* theFieldName); @@ -74,6 +82,13 @@ namespace VISU char* GetFieldName(); + std::string + GetCFieldName() const; + + virtual + const VISU::PField& + GetField() const; + virtual void SetTimeStampNumber(CORBA::Long theTimeStampNumber); @@ -153,28 +168,25 @@ namespace VISU virtual void - SetTitle(const char* theName); + SetTitle(const char* theTitle); virtual char* GetTitle(); - //---------------------------------------------------------------------------- - protected: - VISU::ScalarMap::Orientation myOrientation; - std::string myTitle; - int myNumberOfLabels; - vtkFloatingPointType myPosition[2], myWidth, myHeight; + std::string + GetCTitle(); + //---------------------------------------------------------------------------- public: /*! Initlizes the in first time presentation */ virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); /*! @@ -206,12 +218,6 @@ namespace VISU void SameAsParams(const ColoredPrs3d_i* theOrigin); - TEntity - GetTEntity() const; - - virtual const VISU::PField& - GetField() const; - virtual bool IsBoldTitle(); @@ -300,6 +306,10 @@ namespace VISU vtkFloatingPointType theG, vtkFloatingPointType theB); + virtual + bool + IsRangeFixed(); + VISU_ScalarMapPL* GetSpecificPL() const { @@ -360,14 +370,26 @@ namespace VISU Storable* Build(EBuildMode theBuildMode); - protected: + void + SetField(VISU::PField theField); + + void + UseFixedRange(bool theUseFixedRange); + + private: // Decalare basic input parameters Entity myEntity; std::string myFieldName; CORBA::Long myTimeStampNumber; PField myField; - + EPublishInStudyMode myPublishInStudyMode; + + std::string myTitle; + int myNumberOfLabels; + VISU::ScalarMap::Orientation myOrientation; + vtkFloatingPointType myPosition[2], myWidth, myHeight; + //Font management bool myIsBoldTitle; bool myIsItalicTitle; diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 2b8bbd22..0957d2bc 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -49,9 +49,9 @@ static int MYDEBUG = 0; int VISU::CutLines_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -88,11 +88,11 @@ VISU::CutLines_i //--------------------------------------------------------------- VISU::CutLines_i:: CutLines_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myCutLinesPL(NULL) {} @@ -100,7 +100,7 @@ CutLines_i(Result_i* theResult, //--------------------------------------------------------------- VISU::CutLines_i:: CutLines_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -123,9 +123,9 @@ VISU::CutLines_i //--------------------------------------------------------------- VISU::Storable* VISU::CutLines_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -478,7 +478,7 @@ bool VISU::CutLines_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } @@ -500,7 +500,7 @@ VISU::CutLines_i //--------------------------------------------------------------- void VISU::CutLines_i -::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject) +::BuildTableOfReal(SALOMEDS::SObject_var theSObject) { try{ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal"); @@ -516,7 +516,7 @@ VISU::CutLines_i typedef map TLineIdCont; QString aTitle; - aTitle.sprintf("%s",myTitle.c_str()); + aTitle.sprintf("%s",GetCTitle().c_str()); aTitle = aTitle.simplifyWhiteSpace(); aTableOfReal->SetTitle(aTitle.latin1()); @@ -659,10 +659,10 @@ VISU::CutLines_i { aTableOfReal->SetRowTitle(1,"X"); aTableOfReal->SetRowUnit(1,"-"); - QString aUnitName = myField->myUnitNames[0].c_str(); + QString aUnitName = GetField()->myUnitNames[0].c_str(); int aScalarMode = myCutLinesPL->GetScalarMode(); if(aScalarMode != 0) - aUnitName = myField->myUnitNames[aScalarMode-1].c_str(); + aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str(); aUnitName = aUnitName.simplifyWhiteSpace(); if(aUnitName.isEmpty()) aUnitName = "-"; TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin(); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 7bf3291a..c9c7b726 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -45,10 +45,10 @@ namespace VISU explicit CutLines_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit CutLines_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~CutLines_i(); @@ -206,18 +206,18 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Extends VISU_ColoredPrs3d_i::Create virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); //! Extends VISU_ColoredPrs3d_i::ToStream @@ -235,7 +235,7 @@ namespace VISU VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject); + void BuildTableOfReal(SALOMEDS::SObject_var theSObject); static const std::string myComment; diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 70d0fc17..c9286737 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -42,9 +42,9 @@ static int MYDEBUG = 0; int VISU::CutPlanes_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -78,11 +78,11 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU::CutPlanes_i ::CutPlanes_i(Result_i* theResult, - bool theAddToStudy): + EPublishInStudyMode thePublishInStudyMode): PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myCutPlanesPL(NULL) {} @@ -90,7 +90,7 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU::CutPlanes_i ::CutPlanes_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject): + SALOMEDS::SObject_var theSObject): PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -102,9 +102,9 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU::Storable* VISU::CutPlanes_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -286,7 +286,7 @@ bool VISU::CutPlanes_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 6ce30b04..f011b773 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -45,10 +45,10 @@ namespace VISU explicit CutPlanes_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit CutPlanes_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~CutPlanes_i(); @@ -135,18 +135,18 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Redefines VISU_ColoredPrs3d_i::Create virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); //! Redefines VISU_ColoredPrs3d_i::ToStream diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 0776e8d7..9552cb48 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -47,9 +47,9 @@ static int MYDEBUG = 0; int VISU::DeformedShape_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -102,11 +102,11 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU::DeformedShape_i ::DeformedShape_i(Result_i* theResult, - bool theAddToStudy): + EPublishInStudyMode thePublishInStudyMode): PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myDeformedShapePL(NULL) { if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i"); @@ -116,7 +116,7 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU::DeformedShape_i ::DeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject): + SALOMEDS::SObject_var theSObject): PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -145,9 +145,9 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU::Storable* VISU::DeformedShape_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { myIsColored = false; @@ -272,7 +272,7 @@ bool VISU::DeformedShape_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 3e768bcd..ae6ae789 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -45,10 +45,10 @@ namespace VISU explicit DeformedShape_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit DeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual void SameAs(const Prs3d_i* theOrigin); @@ -114,17 +114,17 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); static const std::string myComment; diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 251abdd7..1c4337f6 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -180,12 +180,10 @@ namespace VISU break; } - CORBA::String_var aMeshName = theServant->GetMeshName(); - CORBA::String_var aFieldName = theServant->GetFieldName(); theStr<GetCMeshName()<<"'"<< ","<GetCFieldName()<<"'"<< ","<GetTimeStampNumber()<< ")"<(GetServant(anObj).in())){ VISU::Entity anEntity = aServant->GetEntity(); const std::string& aSubMeshName = aServant->GetSubMeshName(); - CORBA::String_var aMeshName = aServant->GetMeshName(); if(anEntity >= 0){ std::string aParam; switch(anEntity){ @@ -639,18 +636,18 @@ namespace VISU if(aSubMeshName == "") theStr<GetCMeshName()<<"'"<< ","<GetCMeshName()<<"'"<< ","<GetCMeshName()<<"'"<< ",'"<GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -131,9 +131,9 @@ GaussPoints_i(Result_i* theResult, //---------------------------------------------------------------------------- VISU::Storable* VISU::GaussPoints_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theIteration) { TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); @@ -506,25 +506,25 @@ void VISU::GaussPoints_i ::DoSetInput() { - VISU::Result_i::TInput* anInput = myResult->GetInput(); + VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); if(!anInput) throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); - myField = anInput->GetField(GetMeshName(),GetTEntity(),GetFieldName()); - if(!myField) + SetField(anInput->GetField(GetCMeshName(),GetTEntity(),GetCFieldName())); + if(!GetField()) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PGaussPtsIDMapper aGaussPtsIDMapper = - anInput->GetTimeStampOnGaussPts(GetMeshName(),GetTEntity(),GetFieldName(),GetTimeStampNumber()); + anInput->GetTimeStampOnGaussPts(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber()); if(!aGaussPtsIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); - myGaussPointsPL->SetGaussPtsIDMapper(aGaussPtsIDMapper); - myGaussPointsPL->Init(); - myGaussPointsPL->Build(); + GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper); + GetSpecificPL()->Init(); + GetSpecificPL()->Build(); - myResult->MinMaxConnect(this); + GetCResult()->MinMaxConnect(this); } @@ -533,7 +533,7 @@ bool VISU::GaussPoints_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } @@ -631,28 +631,36 @@ VISU::GaussPoints_i ::UpdateScalarBar(vtkScalarBarActor *theScalarBar, vtkLookupTable* theLookupTable) { - theScalarBar->SetTitle(myTitle.c_str()); - theScalarBar->SetOrientation(myOrientation); - theScalarBar->SetNumberOfLabels(myNumberOfLabels); + theScalarBar->SetTitle(GetCTitle().c_str()); + theScalarBar->SetOrientation(GetBarOrientation()); + theScalarBar->SetNumberOfLabels(GetLabels()); vtkLookupTable* aLookupTable = GetSpecificPL()->GetBarTable(); theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors()); theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors()); + vtkFloatingPointType anRGB[3]; + vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty(); - aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]); - (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); - (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); - (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); + aTitleProp->SetFontFamily(GetTitFontType()); + + GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]); + aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + + IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff(); + IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); + IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty(); - aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]); - (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); - (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); - (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + aLabelProp->SetFontFamily(GetLblFontType()); + + GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]); + aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + + IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff(); + IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); + IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); theScalarBar->Modified(); } @@ -676,7 +684,7 @@ VISU::GaussPoints_i TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT); bool anIsMinMaxDone = IsGlobalRangeDefined(); if(anIsMinMaxDone) - aTMinMax = myField->GetMinMax(GetScalarMode()); + aTMinMax = GetField()->GetMinMax(GetScalarMode()); aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone); aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); @@ -701,9 +709,11 @@ VISU::GaussPoints_i aScalarBarCtrl->SetMode(aScalarBarMode); // Position - aScalarBarCtrl->SetWidth(myWidth); - aScalarBarCtrl->SetHeight(myHeight); - aScalarBarCtrl->SetPosition(myPosition); + aScalarBarCtrl->SetWidth(GetWidth()); + aScalarBarCtrl->SetHeight(GetHeight()); + + vtkFloatingPointType aPosition[] = {GetPosX(), GetPosY()}; + aScalarBarCtrl->SetPosition(aPosition); aScalarBarCtrl->SetSpacing(mySpacing); @@ -796,7 +806,7 @@ bool VISU::GaussPoints_i ::IsGlobalRangeDefined() const { - return myResult->IsMinMaxDone(); + return GetCResult()->IsMinMaxDone(); } bool diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 8e8a9bcf..e14bf9c5 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -54,10 +54,10 @@ namespace VISU explicit GaussPoints_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit GaussPoints_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~GaussPoints_i(); @@ -298,16 +298,16 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theIteration, int isMemoryCheck = true); virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theIteration); static const std::string myComment; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index b6c2c82a..0ba7f8cf 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -253,7 +253,7 @@ namespace VISU if(!theStudy->GetProperties()->IsLocked()){ typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d; - if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,true)){ + if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){ return aPresent->_this(); } } @@ -294,9 +294,9 @@ namespace VISU bool CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, CORBA::Double theIteration) { #ifndef _DEXCEPT_ @@ -821,7 +821,7 @@ namespace VISU } void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, - const char* theMeshName, + const char* theMeshName, const char* theGroupName, const char* theNewName) { @@ -889,7 +889,7 @@ namespace VISU const char* theFieldName, CORBA::Double theIteration) { - return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn(); + return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, @@ -898,7 +898,7 @@ namespace VISU const char* theFieldName, CORBA::Double theIteration) { - return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn(); + return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 1faf9ca2..1b7b5e89 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -28,6 +28,7 @@ #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" +#include "VISU_ColoredPrs3d_i.hh" #include @@ -38,9 +39,9 @@ namespace VISU bool CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, CORBA::Double theIteration); class VISU_Gen_i : public virtual POA_VISU::VISU_Gen, @@ -131,7 +132,7 @@ namespace VISU virtual void RenameGroupInStudy(Result_ptr theResult, - const char* theMeshName, + const char* theMeshName, const char* theGroupName, const char* theNewName); @@ -162,11 +163,10 @@ namespace VISU //Create 3D collored Presentation Of Different Types template TPrs3d_i* CreatePrs3d(Result_ptr theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration, - bool theAddToStudy = true) + const std::string& theFieldName, + CORBA::Double theIteration) { if(myStudyDocument->GetProperties()->IsLocked()) return NULL; @@ -176,7 +176,7 @@ namespace VISU Mutex mt(myMutex); if(Result_i* aResult = dynamic_cast(GetServant(theResult).in())){ if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){ - TPrs3d_i* aPresent = new TPrs3d_i(aResult,theAddToStudy); + TPrs3d_i* aPresent = new TPrs3d_i(aResult); if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration)) return aPresent; aPresent->_remove_ref(); @@ -187,15 +187,14 @@ namespace VISU template typename TPrs3d_i::TInterface::_var_type Prs3dOnField(Result_ptr theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration, - bool theAddToStudy = true) + const std::string& theFieldName, + CORBA::Double theIteration) { typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d; - if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy)) + if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult,theMeshName,theEntity,theFieldName,theIteration)) return aPrs3d->_this(); return TPrs3d::_nil(); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 18994dfc..5ef29a5d 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -41,9 +41,9 @@ static int MYDEBUG = 0; int VISU::IsoSurfaces_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -79,11 +79,11 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU::IsoSurfaces_i ::IsoSurfaces_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myIsoSurfacesPL(NULL) {} @@ -91,7 +91,7 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU::IsoSurfaces_i ::IsoSurfaces_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -103,9 +103,9 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU::Storable* VISU::IsoSurfaces_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -211,7 +211,7 @@ bool VISU::IsoSurfaces_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 96195365..ce1b0526 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -45,10 +45,10 @@ namespace VISU explicit IsoSurfaces_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit IsoSurfaces_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~IsoSurfaces_i(); @@ -104,17 +104,17 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); static const std::string myComment; diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index dfc8499c..7d924cff 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -48,16 +48,31 @@ static int MYDEBUG = 0; static int INCMEMORY = 4; +//---------------------------------------------------------------------------- int VISU::Mesh_i::myNbPresent = 0; -QString VISU::Mesh_i::GenerateName() { return VISU::GenerateName("Mesh",myNbPresent++);} +//---------------------------------------------------------------------------- +QString +VISU::Mesh_i +::GenerateName() +{ + return VISU::GenerateName("Mesh",myNbPresent++); +} +//---------------------------------------------------------------------------- const string VISU::Mesh_i::myComment = "MESH"; -const char* VISU::Mesh_i::GetComment() const { return myComment.c_str();} +//---------------------------------------------------------------------------- +const char* +VISU::Mesh_i +::GetComment() const +{ + return myComment.c_str(); +} -VISU::Mesh_i:: -Mesh_i(Result_i* theResult) : +//---------------------------------------------------------------------------- +VISU::Mesh_i +::Mesh_i(Result_i* theResult) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,false), myMeshPL(VISU_MeshPL::New()) @@ -66,8 +81,9 @@ Mesh_i(Result_i* theResult) : } -VISU::Mesh_i:: -Mesh_i(Result_i* theResult, +//---------------------------------------------------------------------------- +VISU::Mesh_i +::Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), @@ -78,7 +94,9 @@ Mesh_i(Result_i* theResult, //--------------------------------------------------------------- -void VISU::Mesh_i::RemoveFromStudy() +void +VISU::Mesh_i +::RemoveFromStudy() { struct TRemoveFromStudy: public SALOME_Event { @@ -100,15 +118,23 @@ void VISU::Mesh_i::RemoveFromStudy() } -void VISU::Mesh_i::SameAs (const Prs3d_i* theOrigin) +//---------------------------------------------------------------------------- +void +VISU::Mesh_i +::SameAs(const Prs3d_i* theOrigin) { return; // "SameAs" command for mesh is not valid in current architecture } -int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, - Entity theEntity, const char* theFamilyName) +//---------------------------------------------------------------------------- +int +VISU::Mesh_i +::IsPossible(Result_i* theResult, + const std::string& theMeshName, + Entity theEntity, + const char* theFamilyName) { try{ MESSAGE("Mesh_i::IsPossible - theMeshName = '"<NewBuilder(); aStudyBuilder->NewCommand(); // There is a transaction try { - if (myResult->GetInput() == NULL) - throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); + if (GetCResult()->GetInput() == NULL) + throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!"); if (!theRestoring) { myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2)); if(myEntity == VISU::NODE_ENTITY) @@ -250,28 +290,41 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) QString aComment,aTmp; VISU::PIDMapper anIDMapper; + VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); switch(myType){ case VISU::TENTITY : - anIDMapper = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284 + 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(myMeshName);aComment.append(";"); + aComment.append("myMeshName="); + aComment.append(GetCMeshName().c_str()); + aComment.append(";"); aComment.append(aTmp.sprintf("myId=%d",myEntity)); break; case VISU::TFAMILY : - anIDMapper = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName); + anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(), + (VISU::TEntity)myEntity, + mySubMeshName); aComment = ""; aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY)); - aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";"); + aComment.append("myMeshName="); + aComment.append(GetCMeshName().c_str()); + aComment.append(";"); aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity)); - aComment.append("myName=");aComment.append(mySubMeshName); + aComment.append("myName="); + aComment.append(mySubMeshName); break; case VISU::TGROUP : - anIDMapper = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName); + anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(), + mySubMeshName); aComment = ""; aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP)); - aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";"); - aComment.append("myName=");aComment.append(mySubMeshName); + aComment.append("myMeshName="); + aComment.append(GetCMeshName().c_str()); + aComment.append(";"); + aComment.append("myName="); + aComment.append(mySubMeshName); break; } @@ -283,16 +336,17 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) if(!theRestoring) { //Setting IOR on the label myMeshPL->Init(); - string aResultEntry = myResult->GetEntry(); - string anEntry = myResult->GetEntry(aComment.latin1()); + string aResultEntry = GetCResult()->GetEntry(); + string anEntry = GetCResult()->GetEntry(aComment.latin1()); if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); - mySObject = GetStudyDocument()->FindObjectID(anEntry.c_str()); + SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str()); SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR"); + SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aString = GetID(); anIOR->SetValue(aString); + SetSObject(aSObject); } }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<(theActor)){ if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor"); VISU::Prs3d_i::UpdateActor(anActor); diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index ed769cff..2f87b943 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -84,12 +84,12 @@ namespace VISU struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, + static int IsPossible(Result_i* theResult, const std::string& theMeshName, Entity theEntity, const char* theFamilyName = ""); - virtual Storable* Create(const char* theMeshName, Entity theEntity, const char* theFamilyName = ""); + virtual Storable* Create(const std::string& theMeshName, Entity theEntity, const char* theFamilyName = ""); - static int IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName); - virtual Storable* Create(const char* theMeshName, const char* theGroupName); + static int IsPossible(Result_i* theResult, const std::string& theMeshName, const char* theGroupName); + virtual Storable* Create(const std::string& theMeshName, const char* theGroupName); VISU::Entity GetEntity() const { return VISU::Entity(myEntity);} const string& GetSubMeshName() const { return mySubMeshName;} diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 238d47d5..5ef41c89 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -35,9 +35,9 @@ static int MYDEBUG = 0; int VISU::Plot3D_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -75,11 +75,11 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU::Plot3D_i ::Plot3D_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myPlot3DPL(NULL) {} @@ -87,7 +87,7 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU::Plot3D_i ::Plot3D_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -99,9 +99,9 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU::Storable* VISU::Plot3D_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -295,7 +295,7 @@ bool VISU::Plot3D_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index cf64efe8..d7c6bb29 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -39,10 +39,10 @@ namespace VISU explicit Plot3D_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit Plot3D_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~Plot3D_i(); @@ -133,17 +133,17 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); virtual diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index dfa1c78f..6e6f9424 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -50,12 +50,10 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- VISU::Prs3d_i -::Prs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theSObject->GetStudy()), - mySObject(SALOMEDS::SObject::_duplicate(theSObject)), +::Prs3d_i(Result_i* theResult) : + PrsObject_i(SALOMEDS::Study::_nil()), myActorCollection(vtkActorCollection::New()), - myAddToStudy(true), + mySObject(SALOMEDS::SObject::_nil()), myResult(theResult), myPipeLine(NULL) { @@ -72,11 +70,10 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- VISU::Prs3d_i ::Prs3d_i(Result_i* theResult, - bool theAddToStudy) : - PrsObject_i(SALOMEDS::Study::_nil()), + SALOMEDS::SObject_var theSObject) : + PrsObject_i(theSObject->GetStudy()), + mySObject(theSObject), myActorCollection(vtkActorCollection::New()), - mySObject(SALOMEDS::SObject::_nil()), - myAddToStudy(theAddToStudy), myResult(theResult), myPipeLine(NULL) { @@ -129,9 +126,15 @@ CORBA::Boolean VISU::Prs3d_i ::Apply() { - if(SetInput()){ - UpdateActors(); - return true; + try{ + if(SetInput()){ + UpdateActors(); + return true; + } + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<_is_nil()) return dynamic_cast(VISU::GetServant(aResult.in()).in()); return NULL; } - diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index c9c29049..1852c1c7 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -76,13 +76,12 @@ namespace VISU //---------------------------------------------------------------------------- //! A constructor to create a fresh instance of the class explicit - Prs3d_i(Result_i* theResult, - bool theAddToStudy); + Prs3d_i(Result_i* theResult); //! A constructor to restore an instance of the class explicit Prs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); //! To create a deep copy from another instance of the class virtual @@ -105,6 +104,10 @@ namespace VISU VISU::Result_ptr GetResultObject(); + //! Get corresponding Result_i + Result_i* + GetCResult() const; + virtual void SetMeshName(const char* theMeshName); @@ -113,6 +116,9 @@ namespace VISU char* GetMeshName(); + std::string + GetCMeshName() const; + //---------------------------------------------------------------------------- //! To generate an unique type name for the class (used into persistent functionality) virtual @@ -135,10 +141,6 @@ namespace VISU ToStream(std::ostringstream& theStr); //---------------------------------------------------------------------------- - //! Get corresponding Result_i - Result_i* - GetResult() const; - //! Get corresponding SALOMEDS::SObject virtual SALOMEDS::SObject_var @@ -261,29 +263,31 @@ namespace VISU void CheckDataSet(); + void + SetSObject(SALOMEDS::SObject_var theSObject); + protected: vtkTimeStamp myUpdateTime; + vtkTimeStamp myParamsTime; + private: Result_i *myResult; std::string myMeshName; CORBA::Float myOffset[3]; - vtkTimeStamp myParamsTime; SALOMEDS::SObject_var mySObject; - bool myAddToStudy; boost::signal0 myUpdateActorsSignal; boost::signal0 myRemoveActorsFromRendererSignal; vtkSmartPointer myActorCollection; - private: VISU_PipeLine *myPipeLine; }; //---------------------------------------------------------------------------- Result_i* - GetResult(SALOMEDS::SObject_ptr theSObject); + GetResult(SALOMEDS::SObject_var theSObject); //---------------------------------------------------------------------------- template @@ -292,10 +296,10 @@ namespace VISU const std::string& thePrefix, const Storable::TRestoringMap& theMap) { - VISU::Result_i* pResult = GetResult(theSObject); - if(pResult != NULL){ - TPrs3d* pPrs3d = new TPrs3d(pResult,theSObject); - return pPrs3d->Restore(theMap); + if(VISU::Result_i* aResult = GetResult(theSObject)){ + SALOMEDS::SObject_var aSObject = SALOMEDS::SObject::_duplicate(theSObject); + TPrs3d* aPrs3d = new TPrs3d(aResult,aSObject); + return aPrs3d->Restore(theMap); } return NULL; } diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index e47dc9ee..8ce68939 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -52,7 +52,7 @@ VISU::PrsObject_i //--------------------------------------------------------------- void VISU::PrsObject_i -::SetName(const char* theName) +::SetName(const std::string& theName) { myName = theName; SALOMEDS::SObject_var aSObject = myStudy->FindObjectID( GetEntry() ); @@ -60,7 +60,7 @@ VISU::PrsObject_i SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" ); SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); - aNameAttr->SetValue( theName ); + aNameAttr->SetValue( theName.c_str() ); } } diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index cae05117..4fc64ebd 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -56,7 +56,7 @@ namespace VISU virtual void - SetName(const char* theName); + SetName(const std::string& theName); const SALOMEDS::Study_var& GetStudyDocument() const; diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index db7457fb..367f24bf 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -139,7 +139,7 @@ namespace VISU //--------------------------------------------------------------- QString - GenerateName (const char* theName) + GenerateName (const std::string& theName) { TLock aLock(myMutex); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index c5da5978..7d4cc211 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -53,20 +53,20 @@ static int INCMEMORY = 4+12; int VISU::ScalarMapOnDeformedShape_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { bool aResult = false; try{ - aResult = VISU::ScalarMap_i::IsPossible(theResult, - theMeshName, - theEntity, - theFieldName, - theTimeStampNumber, - false); + aResult = TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + false); if(isMemoryCheck && aResult){ VISU::Result_i::TInput* anInput = theResult->GetInput(); const VISU::PField aField = anInput->GetField(theMeshName, @@ -115,11 +115,11 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU::ScalarMapOnDeformedShape_i ::ScalarMapOnDeformedShape_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) {} @@ -127,7 +127,7 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU::ScalarMapOnDeformedShape_i ::ScalarMapOnDeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject): + SALOMEDS::SObject_var theSObject): PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -139,9 +139,9 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU::Storable* VISU::ScalarMapOnDeformedShape_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { myIsColored = true; @@ -344,7 +344,7 @@ bool VISU::ScalarMapOnDeformedShape_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } @@ -387,13 +387,13 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i -::SetScalarField(const char* theMeshName, - const char* theFieldName, +::SetScalarField(const std::string& theMeshName, + const std::string& theFieldName, int theIteration, VISU::TEntity theEntity) { - VISU::Result_i::TInput* anInput = myResult->GetInput(); - myScalarField = anInput->GetField(theMeshName,theEntity,theFieldName); + VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); + SetField(anInput->GetField(theMeshName,theEntity,theFieldName)); VISU::PIDMapper anIDMapper = anInput->GetTimeStampOnMesh(theMeshName, theEntity, theFieldName, @@ -424,7 +424,7 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i -::SetScalarMeshName(const char* theName) +::SetScalarMeshName(const std::string& theName) { if(myScalarMeshName != theName){ myScalarMeshName = theName; @@ -443,7 +443,7 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i -::SetScalarFieldName(const char* theName) +::SetScalarFieldName(const std::string& theName) { if(myScalarFieldName != theName){ myScalarFieldName = theName; @@ -517,11 +517,3 @@ VISU::ScalarMapOnDeformedShape_i { return VISU::Entity(myScalarEntity); } - -//--------------------------------------------------------------- -const VISU::PField& -VISU::ScalarMapOnDeformedShape_i -::GetField() const -{ - return myScalarField; -} diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index d3fa40c1..10b770d8 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -48,10 +48,10 @@ namespace VISU explicit ScalarMapOnDeformedShape_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit ScalarMapOnDeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~ScalarMapOnDeformedShape_i(); @@ -101,9 +101,6 @@ namespace VISU void SameAs(const Prs3d_i* theOrigin); - virtual const VISU::PField& - GetField() const; - typedef VISU::ScalarMapOnDeformedShape TInterface; VISU_ScalarMapOnDeformedShapePL* @@ -130,25 +127,24 @@ namespace VISU std::string myScalarFieldName; VISU::TEntity myScalarEntity; int myScalarIteration; - PField myScalarField; public: //! Redefines VISU_ColoredPrs3d_i::IsPossible static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Redefines VISU_ColoredPrs3d_i::IsPossible virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); //! Redefines VISU_ColoredPrs3d_i::ToStream @@ -187,8 +183,8 @@ namespace VISU virtual void - SetScalarField(const char* theMeshName, - const char* theFieldName, + SetScalarField(const std::string& theMeshName, + const std::string& theFieldName, int theIteration, VISU::TEntity theEntity); @@ -201,7 +197,7 @@ namespace VISU virtual void - SetScalarFieldName(const char* theName); + SetScalarFieldName(const std::string& theName); virtual std::string @@ -217,7 +213,7 @@ namespace VISU virtual void - SetScalarMeshName(const char* theName); + SetScalarMeshName(const std::string& theName); virtual std::string diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 8f8cc517..cb3e6b08 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -51,9 +51,9 @@ static int INCMEMORY = 4; int VISU::ScalarMap_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -106,16 +106,16 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU::ScalarMap_i:: ScalarMap_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy) + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode) {} //---------------------------------------------------------------------------- VISU::ScalarMap_i:: ScalarMap_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject) @@ -138,7 +138,7 @@ VISU::ScalarMap_i ScalarMap_i* anOrigin = const_cast(aPrs3d); SetRange(anOrigin->GetMin(), anOrigin->GetMax()); - myIsFixedRange = anOrigin->IsRangeFixed(); + UseFixedRange(anOrigin->IsRangeFixed()); SetScaling(anOrigin->GetScaling()); @@ -153,9 +153,9 @@ VISU::ScalarMap_i */ VISU::Storable* VISU::ScalarMap_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -164,14 +164,13 @@ VISU::ScalarMap_i // Scalar Range int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); - myIsFixedRange = (aRangeType == 1) ? true : false; - - if(myIsFixedRange){ + if(aRangeType == 1){ float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); SetRange(aMin,aMax); } + UseFixedRange((aRangeType == 1) ? true : false); bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false); if( isLog ) @@ -195,7 +194,7 @@ VISU::ScalarMap_i float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble(); SetRange(aMin,aMax); - myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt(); + UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt()); return this; } @@ -209,7 +208,7 @@ VISU::ScalarMap_i Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() ); Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() ); - Storable::DataToStream( theStr, "myIsFixedRange", myIsFixedRange ); + Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() ); Storable::DataToStream( theStr, "myScaling", GetScaling() ); } @@ -235,7 +234,7 @@ VISU::Scaling VISU::ScalarMap_i ::GetScaling() { - return VISU::Scaling(myScalarMapPL->GetScaling()); + return VISU::Scaling(GetSpecificPL()->GetScaling()); } //---------------------------------------------------------------------------- @@ -243,7 +242,7 @@ void VISU::ScalarMap_i ::SetScaling(VISU::Scaling theScaling) { - myScalarMapPL->SetScaling(theScaling); + GetSpecificPL()->SetScaling(theScaling); } //---------------------------------------------------------------------------- @@ -254,8 +253,8 @@ VISU::ScalarMap_i if(theMin > theMax) return; vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; - myScalarMapPL->SetScalarRange(aScalarRange); - myIsFixedRange = true; + GetSpecificPL()->SetScalarRange(aScalarRange); + UseFixedRange(true); } @@ -264,23 +263,23 @@ void VISU::ScalarMap_i ::DoSetInput() { - VISU::Result_i::TInput* anInput = myResult->GetInput(); + VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); if(!anInput) - throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); + throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!"); - myField = anInput->GetField(GetMeshName(),GetTEntity(),GetFieldName()); - if(!myField) + SetField(anInput->GetField(GetCMeshName(),GetTEntity(),GetCFieldName())); + if(!GetField()) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PIDMapper anIDMapper = - anInput->GetTimeStampOnMesh(GetMeshName(),GetTEntity(),GetFieldName(),GetTimeStampNumber()); + anInput->GetTimeStampOnMesh(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber()); if(!anIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); - myScalarMapPL->SetIDMapper(anIDMapper); - myScalarMapPL->Init(); - myScalarMapPL->Build(); + GetSpecificPL()->SetIDMapper(anIDMapper); + GetSpecificPL()->Init(); + GetSpecificPL()->Build(); } @@ -289,7 +288,7 @@ bool VISU::ScalarMap_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } @@ -298,15 +297,7 @@ void VISU::ScalarMap_i ::SetMapScale(double theMapScale) { - myScalarMapPL->SetMapScale(theMapScale); -} - -//---------------------------------------------------------------------------- -bool -VISU::ScalarMap_i -::IsRangeFixed() -{ - return myIsFixedRange; + GetSpecificPL()->SetMapScale(theMapScale); } //---------------------------------------------------------------------------- @@ -314,8 +305,8 @@ void VISU::ScalarMap_i ::SetSourceRange() { - myScalarMapPL->SetSourceRange(); - myIsFixedRange = false; + GetSpecificPL()->SetSourceRange(); + UseFixedRange(false); } //---------------------------------------------------------------------------- @@ -357,28 +348,36 @@ VISU::ScalarMap_i { if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); - aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable()); - aScalarBar->SetTitle(myTitle.c_str()); - aScalarBar->SetOrientation(myOrientation); + aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable()); + aScalarBar->SetTitle(GetCTitle().c_str()); + aScalarBar->SetOrientation(GetBarOrientation()); aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport(); - aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]); - aScalarBar->SetWidth(myWidth); - aScalarBar->SetHeight(myHeight); - aScalarBar->SetNumberOfLabels(myNumberOfLabels); + aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY()); + aScalarBar->SetWidth(GetWidth()); + aScalarBar->SetHeight(GetHeight()); + aScalarBar->SetNumberOfLabels(GetLabels()); + + vtkFloatingPointType anRGB[3]; vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); - aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]); - (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); - (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); - (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); + aTitleProp->SetFontFamily(GetTitFontType()); + + GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]); + aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + + IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff(); + IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); + IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); - aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]); - (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); - (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); - (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + aLabelProp->SetFontFamily(GetLblFontType()); + + GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]); + aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + + IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff(); + IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); + IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); aScalarBar->Modified(); } diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 8f507dca..34f2266a 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -46,10 +46,10 @@ namespace VISU explicit ScalarMap_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit ScalarMap_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual ~ScalarMap_i(); @@ -102,18 +102,18 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Redefines VISU_ColoredPrs3d_i::Create virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); virtual @@ -144,10 +144,6 @@ namespace VISU void SetMapScale(double theMapScale = 1.0); - virtual - bool - IsRangeFixed(); - virtual void SetSourceRange(); diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 9ca45daf..a8035927 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -48,9 +48,9 @@ static int MYDEBUG = 0; int VISU::StreamLines_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -99,12 +99,12 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU::StreamLines_i ::StreamLines_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), - DeformedShape_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), + DeformedShape_i(theResult,thePublishInStudyMode), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) {} @@ -113,7 +113,7 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU::StreamLines_i ::StreamLines_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -141,9 +141,9 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU::Storable* VISU::StreamLines_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -354,7 +354,7 @@ bool VISU::StreamLines_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 0329f3a4..41fd93cb 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -46,10 +46,10 @@ namespace VISU explicit StreamLines_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit StreamLines_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual void @@ -137,18 +137,18 @@ namespace VISU static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Extends VISU_ColoredPrs3d_i::Create virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); //! Extends VISU_ColoredPrs3d_i::ToStream diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 309cfbae..77bd7333 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -223,8 +223,8 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO) { if(MYDEBUG) MESSAGE(GetComment()); - myName = (const char*)(VISU::Storable::FindValue(theMap,"myName")); - myTitle = (const char*)(VISU::Storable::FindValue(theMap,"myTitle")); + myName = VISU::Storable::FindValue(theMap,"myName").latin1(); + myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() ); mySObj = SALOMEDS::SObject::_duplicate(SO); return Build( true ); diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index ceb9eade..ec13b30b 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -46,7 +46,7 @@ namespace VISU{ virtual ~Table_i(); virtual VISU::VISUType GetType() { return VISU::TTABLE;}; - virtual void SetTitle( const char* theName ) { SetName( theName ); } + virtual void SetTitle( const char* theTitle ) { SetName( theTitle ); } virtual char* GetTitle() { return CORBA::string_dup( GetName() ); } virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; } @@ -96,7 +96,7 @@ namespace VISU{ virtual ~Curve_i(); virtual VISU::VISUType GetType() { return VISU::TCURVE;}; - virtual void SetTitle( const char* theName ) { SetName( theName ); } + virtual void SetTitle( const char* theTitle ) { SetName( theTitle ); } virtual char* GetTitle() { return CORBA::string_dup( GetName() ); } virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; } diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index fa7f6c99..cbea1cb7 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -48,9 +48,9 @@ static int INCMEMORY = 4+12; int VISU::Vectors_i ::IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck) { @@ -106,12 +106,12 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU::Vectors_i ::Vectors_i(Result_i* theResult, - bool theAddToStudy) : + EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), - DeformedShape_i(theResult,theAddToStudy), + Prs3d_i(theResult), + ColoredPrs3d_i(theResult,thePublishInStudyMode), + ScalarMap_i(theResult,thePublishInStudyMode), + DeformedShape_i(theResult,thePublishInStudyMode), myLineWidth(1.0), myVectorsPL(NULL) {} @@ -120,7 +120,7 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU::Vectors_i ::Vectors_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -148,9 +148,9 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU::Storable* VISU::Vectors_i -::Create(const char* theMeshName, +::Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber) { return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); @@ -276,7 +276,7 @@ bool VISU::Vectors_i ::CheckIsPossible() { - return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 09432446..019110cd 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -45,10 +45,10 @@ namespace VISU explicit Vectors_i(Result_i* theResult, - bool theAddToStudy); + EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); explicit Vectors_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + SALOMEDS::SObject_var theSObject); virtual void @@ -118,18 +118,18 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::IsPossible static int IsPossible(Result_i* theResult, - const char* theMeshName, + const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber, int isMemoryCheck = true); //! Redefines VISU_ColoredPrs3d_i::Create virtual Storable* - Create(const char* theMeshName, + Create(const std::string& theMeshName, VISU::Entity theEntity, - const char* theFieldName, + const std::string& theFieldName, int theTimeStampNumber); //! Redefines VISU_ColoredPrs3d_i::ToStream diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 421c4552..1553fe8d 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1582,11 +1582,11 @@ namespace VISU { ProcessVoidEvent(new TEvent(aViewWindow)); } - bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName) + bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const std::string& theName) { MESSAGE("View3D_i::SaveViewParams()"); - if (!theViewManager || !theName) + if (!theViewManager || theName == "") return false; _PTR(Study) aCStudy; @@ -1598,8 +1598,8 @@ namespace VISU { if (!aCStudy) return false; - if (strcmp(theName, "") != 0) { - std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU"); + if (theName != "") { + std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName.c_str(), "VISU"); _PTR(GenericAttribute) anAttr; int iEnd = aList.size(); for (int i = 0; i < iEnd; i++) { @@ -1619,7 +1619,12 @@ namespace VISU { } _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy); string aSComponentEntry = aSComponent->GetID(); - string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "", + string anEntry = CreateAttributes(aCStudy, + aSComponentEntry.c_str(), + "", + "", + theName, + "", ToString(theViewManager->getActiveView()).c_str()); return true; } @@ -1627,10 +1632,10 @@ namespace VISU { class TSaveViewParamsEvent: public SALOME_Event { SUIT_ViewManager* myViewMgr; - const char* myName; + std::string myName; public: TSaveViewParamsEvent (SUIT_ViewManager* theViewManager, - const char* theName): + const std::string& theName): myViewMgr(theViewManager), myName(theName) {} @@ -1643,12 +1648,12 @@ namespace VISU { TResult myResult; }; - CORBA::Boolean View3D_i::SaveViewParams (const char* theName) + CORBA::Boolean View3D_i::SaveViewParams (const char* theViewParamsName) { - return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName)); + return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theViewParamsName)); } - bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName) + bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const std::string& theName) { _PTR(Study) aCStudy; if (SUIT_Study* aSStudy = theViewManager->study()) { @@ -1686,10 +1691,10 @@ namespace VISU { class TRestoreViewParamsEvent: public SALOME_Event { SUIT_ViewManager* myViewMgr; - const char* myName; + std::string myName; public: TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager, - const char* theName): + const std::string& theName): myViewMgr(theViewManager), myName(theName) {} @@ -1702,9 +1707,9 @@ namespace VISU { TResult myResult; }; - CORBA::Boolean View3D_i::RestoreViewParams (const char* theName) + CORBA::Boolean View3D_i::RestoreViewParams (const char* theViewParamsName) { - return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName)); + return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theViewParamsName)); } void View3D_i::Restore (SUIT_ViewWindow* theViewWindow, diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 2000ab79..0c1cf1f0 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -278,12 +278,12 @@ namespace VISU static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr); static bool SaveViewParams (SUIT_ViewManager* theViewManager, - const char* theName); - virtual CORBA::Boolean SaveViewParams (const char* theName); + const std::string& theName); + virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName); static bool RestoreViewParams (SUIT_ViewManager* theViewManager, - const char* theName); - virtual CORBA::Boolean RestoreViewParams (const char* theName); + const std::string& theName); + virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName); static QString GenerateViewParamsName();