From ed8fde1621d36a91f39b7c3f7b31f06ef678bf0d Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 27 Oct 2006 13:40:24 +0000 Subject: [PATCH] To introduce first version of the functionality --- idl/VISU_Gen.idl | 41 ++- src/ENGINE/VISU_Engine_i.cc | 6 + src/ENGINE/VISU_Engine_i.hh | 7 +- src/VISUGUI/VisuGUI.cxx | 2 +- src/VISUGUI/VisuGUI_ClippingDlg.cxx | 12 +- src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 8 +- src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 2 +- src/VISUGUI/VisuGUI_Plot3DDlg.cxx | 7 +- .../VisuGUI_ScalarMapOnDeformedShapeDlg.cxx | 18 +- src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 2 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 209 ++++++++----- src/VISU_I/VISU_ColoredPrs3d_i.hh | 135 ++++++-- src/VISU_I/VISU_CutLines_i.cc | 291 ++++++++++++++---- src/VISU_I/VISU_CutLines_i.hh | 213 ++++++++++--- src/VISU_I/VISU_CutPlanes_i.cc | 186 ++++++++--- src/VISU_I/VISU_CutPlanes_i.hh | 137 +++++++-- src/VISU_I/VISU_DeformedShape_i.cc | 160 +++++++--- src/VISU_I/VISU_DeformedShape_i.hh | 121 ++++++-- src/VISU_I/VISU_DumpPython.cc | 15 +- src/VISU_I/VISU_GaussPoints_i.cc | 28 +- src/VISU_I/VISU_GaussPoints_i.hh | 21 +- src/VISU_I/VISU_Gen_i.cc | 50 ++- src/VISU_I/VISU_Gen_i.hh | 4 + src/VISU_I/VISU_IsoSurfaces_i.cc | 148 +++++++-- src/VISU_I/VISU_IsoSurfaces_i.hh | 97 ++++-- src/VISU_I/VISU_Mesh_i.cc | 6 +- src/VISU_I/VISU_Mesh_i.hh | 2 - src/VISU_I/VISU_Plot3D_i.cc | 202 +++++++++--- src/VISU_I/VISU_Plot3D_i.hh | 139 +++++++-- src/VISU_I/VISU_Prs3d_i.cc | 134 +++++--- src/VISU_I/VISU_Prs3d_i.hh | 35 ++- src/VISU_I/VISU_PrsObject_i.cc | 69 ++++- src/VISU_I/VISU_PrsObject_i.hh | 28 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 275 +++++++++++++---- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 205 +++++++++--- src/VISU_I/VISU_ScalarMap_i.cc | 75 +++-- src/VISU_I/VISU_ScalarMap_i.hh | 25 +- src/VISU_I/VISU_StreamLines_i.cc | 209 +++++++++---- src/VISU_I/VISU_StreamLines_i.hh | 161 +++++++--- src/VISU_I/VISU_Table_i.cc | 94 +++--- src/VISU_I/VISU_Vectors_i.cc | 184 ++++++++--- src/VISU_I/VISU_Vectors_i.hh | 116 +++++-- src/VISU_I/VISU_View_i.cc | 21 +- src/VISU_SWIG/visu_change_input.py | 41 +++ 44 files changed, 2996 insertions(+), 945 deletions(-) create mode 100644 src/VISU_SWIG/visu_change_input.py diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 2f1d27f9..986f8ea3 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -307,13 +307,34 @@ module VISU { }; //------------------------------------------------------- + interface Result; /*! \brief 3D presentation interface * * This is a root class for all 3D presentations, which can be displayed in %VISU module. */ interface Prs3d : PrsObject, SALOME::GenericObj { - //interface Prs3d : PrsObject{ + /*! + * Applies a set basic input parameters to the 3D presentation + * \return True of the set of input parameters is correct and was succesfully applied, + * False otherwise + */ + boolean Apply(); + + void SetResultObject(in Result theResult); + Result GetResultObject(); + + void SetMeshName(in string theMeshName); + string GetMeshName(); + + /*! + * Move the 3D presentation according to the given offset parameters + */ void SetOffset(in float theDx, in float theDy, in float theDz); + + + /*! + * Gets offset parameters for the 3D presentation + */ void GetOffset(out float theDx, out float theDy, out float theDz); }; @@ -392,7 +413,17 @@ module VISU { * bar is displayed along with each colored field presentation and serves for * consulting the correspondance between colors and data values. */ - interface ColoredPrs3d : Prs3d { + interface ColoredPrs3d : Prs3d + { + void SetEntity(in Entity theEntity); + Entity GetEntity(); + + void SetFieldName(in string theName); + string GetFieldName(); + + void SetTimeStampNumber(in long theTimeStampNumber); + long GetTimeStampNumber(); + /*! Sets the method of coloring of the elements composing a 3D presentation. */ void SetScalarMode(in long theScalarMode); @@ -1435,6 +1466,12 @@ module VISU { in string theSubMeshName, in string theNewName); + /*! + * Creates a VISU 3D presentation according to the given type + * \param theType Type that defines what kind of 3D presentation should be created + */ + Prs3d CreatePrs3d(in VISUType theType, in SALOMEDS::Study theStudy); + /*! * Creates a mesh on the basis of the data generated in other sources (MED object or file). * \param theResult Data generated in other sources. (MED object or file) diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index 0563dad2..fcce515b 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -189,6 +189,12 @@ namespace VISU{ return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity); } + Prs3d_ptr VISU_Gen_i::CreatePrs3d(VISUType theType, + SALOMEDS::Study_ptr theStudy) + { + return myVisuGen->CreatePrs3d(theType,theStudy); + } + Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 3f605b43..0b6727a1 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -29,7 +29,8 @@ #include "SALOME_Component_i.hxx" -namespace VISU{ +namespace VISU +{ class VISU_Gen_i : public virtual POA_VISU::VISU_Gen, public virtual ::Engines_Component_i { @@ -62,6 +63,10 @@ namespace VISU{ virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject); virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField); + Prs3d_ptr + CreatePrs3d(VISUType theType, + SALOMEDS::Study_ptr theStudy); + //Create Presentation Of Submeshes virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity); virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 8266ce94..aee24b7f 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1792,7 +1792,7 @@ OnCopyPresentation() case VISU::TPLOT3D: { VISU::Plot3D_i* aPlot3DPrs = dynamic_cast(aPrsObject); - VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult()); + VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult(),true); aSamePlot3D->SameAs(aPlot3DPrs); } break; diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 87195d31..f0b526a0 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -958,8 +958,9 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->selected()); VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axId; gp_Dir dir; + CORBA::String_var aMeshName = myPrs3d->GetMeshName(); const vector * values = - result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir); + result->GetAxisInfo(aMeshName.in(), axis, dir); if (!values) return; @@ -1038,7 +1039,8 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() VISU::Result_i* result = myPrs3d->GetResult(); for (i = 0; i < 3; ++i) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i; - curValues = result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir); + CORBA::String_var aMeshName = myPrs3d->GetMeshName(); + curValues = result->GetAxisInfo(aMeshName.in(), axis, dir); if (curValues) { double dot = normal * dir; if (Abs(dot) > Abs(maxDot)) { @@ -1090,7 +1092,8 @@ bool VisuGUI_ClippingDlg::isStructured() const VISU::Result_i* result = myPrs3d ? myPrs3d->GetResult() : 0; if (result) { gp_Dir dir; - return result->GetAxisInfo(myPrs3d->GetMeshName(), + CORBA::String_var aMeshName = myPrs3d->GetMeshName(); + return result->GetAxisInfo(aMeshName.in(), VISU::Result_i::AXIS_X, dir); } @@ -1109,7 +1112,8 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId) if (result) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axisId; gp_Dir dir; - const vector * indices = result->GetAxisInfo(myPrs3d->GetMeshName(), + CORBA::String_var aMeshName = myPrs3d->GetMeshName(); + const vector * indices = result->GetAxisInfo(aMeshName.in(), axis, dir); if (indices) maxIndex = indices->size() - 1; diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index d189683f..96d8cddf 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -355,7 +355,7 @@ void VisuGUI_CutLinesDlg::createPlanes() storeToPrsObject(myCutLines); myCutLines->GetPL()->Update(); - vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); + vtkAppendPolyData* aPolyData = myCutLines->GetSpecificPL()->GetAppendPolyData(); vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); aPlaneMapper->SetInput(aPolyData->GetOutput()); aPlaneMapper->ScalarVisibilityOff(); @@ -562,12 +562,12 @@ void VisuGUI_CutLinesDlg::DrawTable() void VisuGUI_CutLinesDlg::updateGlyphs(bool update){ if (myPreviewActorGlyphs == 0 ) return; - const vtkFloatingPointType *aDirLn = myCutLines->GetCutLinesPL()->GetRealDirLn(); - const vtkFloatingPointType *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt(); + const vtkFloatingPointType *aDirLn = myCutLines->GetSpecificPL()->GetRealDirLn(); + const vtkFloatingPointType *aBasePnt = myCutLines->GetSpecificPL()->GetBasePnt(); vtkFloatingPointType aSecondPnt[3]; vtkFloatingPointType aBoundCenter[3]; - vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); + vtkAppendPolyData* aPolyData = myCutLines->GetSpecificPL()->GetAppendPolyData(); vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); aPlaneMapper->SetInput(aPolyData->GetOutput()); vtkFloatingPointType bounds[6]; diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 2666f0cf..aadb2de3 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -201,7 +201,7 @@ void VisuGUI_CutPlanesPane::createPlanes() if (myCutPlanes == NULL) return; if (myPreviewActor != 0) return; - vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData(); + vtkAppendPolyData* aPolyData = myCutPlanes->GetSpecificPL()->GetAppendPolyData(); if (!aPolyData->GetOutput()->GetNumberOfCells()) { onPreviewCheck(false); return; diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 79564c95..b49e8a54 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -287,7 +287,7 @@ void VisuGUI_Plot3DPane::onPositionSpn() if (myPrs && !RelativeChkB->isChecked()) { vtkFloatingPointType minPos, maxPos; storePrsParams(); - myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos); + myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos); restorePrsParams(); if (minPos > PositionSpn->value()) minPos = PositionSpn->value(); @@ -326,7 +326,7 @@ void VisuGUI_Plot3DPane::onRelativePos(bool isRelativePos) vtkFloatingPointType minPos = 0., maxPos = 1., pos = PositionSpn->value(); if (myPrs) { storePrsParams(); - myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos); + myPrs->GetSpecificPL()->GetMinMaxPosition(minPos, maxPos); restorePrsParams(); if (-1e-7 < (maxPos - minPos) && (maxPos - minPos) < 1e-7) { pos = 0; @@ -382,7 +382,7 @@ void VisuGUI_Plot3DPane::updatePreview() // set plane parameters corresponding to control values storePrsParams(); vtkFloatingPointType normal[3], origin[3]; - myPrs->GetPlot3DPL()->GetBasePlane(origin, normal, true); + myPrs->GetSpecificPL()->GetBasePlane(origin, normal, true); planePreview->Set(origin, normal); restorePrsParams(); } @@ -496,7 +496,6 @@ bool VisuGUI_Plot3DPane::check() { if(!myPreviewActor) return true; - SVTK_ViewWindow* aView; vtkRenderer* aRend = myPreviewActor->GetRenderer(); vtkRenderWindow* aWnd = aRend->GetRenderWindow(); if(aRend && aWnd){ diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index b65bf0c2..1160cc6e 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -169,7 +169,8 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject myTimeStampsCombo->setDisabled(isAnim); QString aFieldName(myPrs->GetScalarFieldName().c_str()); - float aIterFloat = GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(), + CORBA::String_var aMeshName = myPrs->GetMeshName(); + float aIterFloat = GetFloatValueOfTimeStamp(aMeshName.in(), myPrs->GetScalarFieldName().c_str(), myPrs->GetScalarIteration(), myPrs->GetScalarEntity()); @@ -257,12 +258,13 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); if (isExist) { if ((aType == VISU::TTIMESTAMP)) { - _PTR(GenericAttribute) aNameAttr; - if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { - _PTR(AttributeName) aName (aNameAttr); + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeName")) { + _PTR(AttributeName) aNameAttr(anAttr); VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); - QString aMeshName = VISU::getValue(aChildSObj, "myMeshName"); - if (QString(myPrs->GetMeshName().c_str()) != aMeshName) continue; + QString aName = VISU::getValue(aChildSObj, "myMeshName"); + CORBA::String_var aMeshName = aPrsObj->GetMeshName(); + if (QString(aMeshName.in()) != aName) continue; myCurrMeshName = aMeshName; QString aFieldName = VISU::getValue(aChildSObj, "myFieldName"); QString aTimeIter = VISU::getValue(aChildSObj, "myTimeStampId"); @@ -274,10 +276,10 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject case 2: anEntity = VISU::FACE_ENTITY; break; case 3: anEntity = VISU::CELL_ENTITY; break; } - TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()]; + TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.in()]; TFE aKey (aFieldName.latin1(), anEntity); aFieldsMap[aKey][aTimeIter.toInt()] = - GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(), + GetFloatValueOfTimeStamp(aMeshName.in(), aFieldName.latin1(), aTimeIter.toInt(), anEntity); diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index 7a1820c1..4f81711e 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -313,7 +313,7 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs) myPrs = thePrs; static int aNbOfSteps = 30; - VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL(); + VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetSpecificPL(); float aMin, aMax; aMin = aStreamLinesPL->GetMinPropagationTime(); aMax = aStreamLinesPL->GetMaxPropagationTime(); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 275d3e2e..89f06a2e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -35,9 +35,6 @@ #include -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; //#define _DEXCEPT_ @@ -50,21 +47,25 @@ static int MYDEBUG = 0; VISU::ColoredPrs3d_i:: ColoredPrs3d_i(Result_i* theResult, bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), myScalarMapPL(NULL), myIsFixedRange(false) {} + +//--------------------------------------------------------------- VISU::ColoredPrs3d_i:: ColoredPrs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), myScalarMapPL(NULL), myIsFixedRange(false) {} + +//--------------------------------------------------------------- VISU::ColoredPrs3d_i ::~ColoredPrs3d_i() {} @@ -95,23 +96,100 @@ VISU::ColoredPrs3d_i ProcessVoidEvent(new TRemoveFromStudy(this)); } +//--------------------------------------------------------------- +bool +VISU::ColoredPrs3d_i +::SetInput() +{ + if(TSuperClass::SetInput()){ + if(CheckIsPossible()){ + if(ApplyInput()){ + if(Create(GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber())) + return true; + }else + return true; + } + } + return false; +} + + +//--------------------------------------------------------------- +bool +VISU::ColoredPrs3d_i +::ApplyInput() +{ + bool anIsNotCreated = GetPL() == NULL; + if(anIsNotCreated) + CreatePipeLine(); // to create proper pipeline + + DoSetInput(); + + return anIsNotCreated; +} + + +//--------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetEntity(VISU::Entity theEntity) +{ + myEntity = theEntity; +} + + +//--------------------------------------------------------------- +VISU::Entity +VISU::ColoredPrs3d_i +::GetEntity() +{ + return myEntity; +} + +void +VISU::ColoredPrs3d_i +::SetFieldName(const char* theFieldName) +{ + myFieldName = theFieldName; +} + +char* +VISU::ColoredPrs3d_i +::GetFieldName() +{ + return CORBA::string_dup(myFieldName.c_str()); +} + +void +VISU::ColoredPrs3d_i +::SetTimeStampNumber(CORBA::Long theTimeStampNumber) +{ + myTimeStampNumber = theTimeStampNumber; +} + +CORBA::Long +VISU::ColoredPrs3d_i +::GetTimeStampNumber() +{ + return myTimeStampNumber; +} + + //--------------------------------------------------------------- void VISU::ColoredPrs3d_i ::SameAs(const Prs3d_i* theOrigin) { if(const ColoredPrs3d_i* aPrs3d = dynamic_cast(theOrigin)){ - DoHook(); - ColoredPrs3d_i* anOrigin = const_cast(aPrs3d); - myField = anOrigin->GetField(); - myMeshName = myField->myMeshName; - myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity; - myIteration = anOrigin->GetIteration(); - myFieldName = anOrigin->GetFieldName(); - - Build(-1); + SetMeshName(anOrigin->GetMeshName()); + SetEntity(anOrigin->GetEntity()); + SetFieldName(anOrigin->GetFieldName()); + SetTimeStampNumber(anOrigin->GetTimeStampNumber()); + ApplyInput(); + + Build(ESameAs); TSuperClass::SameAs(theOrigin); @@ -145,11 +223,12 @@ void VISU::ColoredPrs3d_i ::SameAsParams(const ColoredPrs3d_i* theOrigin) { - int anIteration = GetIteration(); + int aTimeStampNumber = GetTimeStampNumber(); SameAs(theOrigin); - myIteration = anIteration; + SetTimeStampNumber(aTimeStampNumber); + ApplyInput(); - Build(-1); + Build(ESameAs); Update(); } @@ -449,16 +528,15 @@ VISU::ColoredPrs3d_i ::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - int theIteration) + int theTimeStampNumber) { - DoHook(); // to create proper pipeline - - myMeshName = theMeshName; - myEntity = (VISU::TEntity)theEntity; - myFieldName =theFieldName; - myIteration = theIteration; + SetMeshName(theMeshName); + SetEntity(theEntity); + SetFieldName(theFieldName); + SetTimeStampNumber(theTimeStampNumber); + ApplyInput(); - Build(false); // to get corresponding input from result and initilize the pipeline + Build(ECreateNew); // to get corresponding input from result and initilize the pipeline SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); @@ -562,16 +640,15 @@ VISU::Storable* VISU::ColoredPrs3d_i ::Restore(const Storable::TRestoringMap& theMap) { - DoHook(); - - myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); - myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt(); - myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1(); - myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt(); + SetMeshName(VISU::Storable::FindValue(theMap,"myMeshName").latin1()); + SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt()); + SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1()); + SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt()); + ApplyInput(); myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study. - Build(true); + Build(ERestore); TSuperClass::Restore(theMap); @@ -618,7 +695,7 @@ VISU::ColoredPrs3d_i Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); Storable::DataToStream( theStr, "myEntity", myEntity ); Storable::DataToStream( theStr, "myFieldName", myFieldName.c_str() ); - Storable::DataToStream( theStr, "myIteration", myIteration ); + Storable::DataToStream( theStr, "myIteration", int(myTimeStampNumber) ); Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); @@ -648,9 +725,9 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::DoHook() +::CreatePipeLine() { - if(MYDEBUG) MESSAGE("ColoredPrs3d_i::DoHook() - "<GetMapper()->SetScalarVisibility(1); @@ -661,40 +738,41 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- VISU::Storable* VISU::ColoredPrs3d_i -::Build(int theRestoring) +::Build(EBuildMode theBuildMode) { if(MYDEBUG) - MESSAGE("ColoredPrs3d_i::Build - "<Init(); - if(!myIsFixedRange) myScalarMapPL->SetSourceRange(); + if(theBuildMode == ECreateNew || theBuildMode == ESameAs){ + if(!myIsFixedRange) + myScalarMapPL->SetSourceRange(); const VISU::TValField& aValField = myField->myValField; - const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; + const VISU::PValForTime aValForTime = aValField.find(myTimeStampNumber)->second; aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str()); - if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1(); + if(theBuildMode == ECreateNew) + myTitle = aComment.simplifyWhiteSpace().latin1(); } if(myAddToStudy){ 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(),myIteration,myField->myNbComp); - string aResultEntry = myResult->GetEntry(); - string aRefFatherEntry = myResult->GetRefFatherEntry(); - string anEntry = myResult->GetEntry(aComment.latin1()); - if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!"); + 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()); + 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(),myIteration,myField->myNbComp); + GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myTimeStampNumber,myField->myNbComp); CORBA::String_var anIOR = GetID(); - CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); - mySObject = myStudy->FindObjectIOR(anIOR); + CreateAttributes(GetStudyDocument(),anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); + mySObject = GetStudyDocument()->FindObjectIOR(anIOR); } #ifndef _DEXCEPT_ }catch(std::exception& exc){ @@ -719,32 +797,11 @@ VISU::ColoredPrs3d_i return myField; } -const std::string& -VISU::ColoredPrs3d_i -::GetMeshName() const -{ - return myMeshName; -} - -VISU::Entity -VISU::ColoredPrs3d_i -::GetEntity() const -{ - return VISU::Entity(myEntity); -} - -const std::string& -VISU::ColoredPrs3d_i -::GetFieldName() const -{ - return myFieldName; -} - -int +VISU::TEntity VISU::ColoredPrs3d_i -::GetIteration() const +::GetTEntity() const { - return myIteration; + return VISU::TEntity(int(myEntity)); } VISU_ScalarMapPL* diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index b5417b22..b131e325 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -57,6 +57,31 @@ namespace VISU void RemoveFromStudy(); + //---------------------------------------------------------------------------- + virtual + void + SetEntity(Entity theEntity); + + virtual + Entity + GetEntity(); + + virtual + void + SetFieldName(const char* theFieldName); + + virtual + char* + GetFieldName(); + + virtual + void + SetTimeStampNumber(CORBA::Long theTimeStampNumber); + + virtual + CORBA::Long + GetTimeStampNumber(); + //---------------------------------------------------------------------------- virtual CORBA::Long @@ -138,49 +163,51 @@ namespace VISU vtkFloatingPointType myPosition[2], myWidth, myHeight; public: - //---------------------------------------------------------------------------- + /*! + Initlizes the in first time presentation + */ virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - int theIteration); + int theTimeStampNumber); + /*! + Retores state of the presentation + */ virtual Storable* Restore(const Storable::TRestoringMap& theMap); + /*! + Writes persistent params of the presentation into the given stream + */ virtual void ToStream(std::ostringstream& theStr); + /*! + Update state of the presentation according to the input. + */ virtual void SameAs(const Prs3d_i* theOrigin); /*! - * \brief Works like SameAs() method, but keep myIteration value unchanged. + * \brief Works like SameAs() method, but keep myTimeStampNumber value unchanged. * * Is used in VISU_TimeAnimation class implementation. */ void SameAsParams(const ColoredPrs3d_i* theOrigin); + TEntity + GetTEntity() const; + virtual const VISU::PField& GetField() const; - const std::string& - GetMeshName() const; - - VISU::Entity - GetEntity() const; - - const std::string& - GetFieldName() const; - - int - GetIteration() const; - VISU_ScalarMapPL* GetScalarMapPL(); @@ -272,13 +299,74 @@ namespace VISU vtkFloatingPointType theG, vtkFloatingPointType theB); + VISU_ScalarMapPL* + GetSpecificPL() const + { + return myScalarMapPL; + } + //---------------------------------------------------------------------------- protected: - PField myField; - TEntity myEntity; + /*! + Applyes basic input parameters to the presentation. + Returns true if all are right. + */ + virtual + bool + SetInput(); + + /*! + Checks whether it is possible to create presentation + with the given basic parameters or not. + */ + virtual + bool + CheckIsPossible() = 0; + + /*! + Creates proper instance of VTK pipeline. + */ + virtual + void + CreatePipeLine(); + + /*! + First checks whether corresponding VTK pipeline exists and create it if not. + Then calls VISU_ColoredPrs3d_i::DoSetInput. + Returns true if during the call corresponding VTK pipeline was created, + false otherwise. + */ + virtual + bool + ApplyInput(); + + /*! + Sets input data set according to basic input parameters - + Result, MeshName, Entity, FieldName and TimeStampNumber. + */ + virtual + void + DoSetInput() = 0; + + /*! + The enumeration allow to define what mode should be used for the presentation building. + */ + enum EBuildMode {ECreateNew, ESameAs, ERestore}; + + /*! + The enumeration allow to define what mode should be used for the presentation building. + */ + Storable* + Build(EBuildMode theBuildMode); + + protected: + // Decalare basic input parameters + Entity myEntity; std::string myFieldName; - int myIteration; + CORBA::Long myTimeStampNumber; + PField myField; + //Font management bool myIsBoldTitle; bool myIsItalicTitle; @@ -294,17 +382,6 @@ namespace VISU VISU_ScalarMapPL* myScalarMapPL; bool myIsFixedRange; - - virtual - void - DoSetInput(Result_i* theResult) = 0; - - Storable* - Build(int theRestoring); - - virtual - void - DoHook(); }; } diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index a44b5216..8af03cfb 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -36,9 +36,6 @@ #include -using namespace VISU; -using namespace std; - static vtkFloatingPointType EPS_machine = 1.0E-7; #ifdef _DEBUG_ @@ -47,23 +44,52 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::CutLines_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + isMemoryCheck); } +//--------------------------------------------------------------- int VISU::CutLines_i::myNbPresent = 0; -QString VISU::CutLines_i::GenerateName() { return VISU::GenerateName("CutLines",myNbPresent++);} +//--------------------------------------------------------------- +QString +VISU::CutLines_i::GenerateName() +{ + return VISU::GenerateName("CutLines",myNbPresent++); +} + +//--------------------------------------------------------------- const string VISU::CutLines_i::myComment = "CUTLINES"; -const char* VISU::CutLines_i::GetComment() const { return myComment.c_str();} + +//--------------------------------------------------------------- +const char* +VISU::CutLines_i +::GetComment() const +{ + return myComment.c_str(); +} +//--------------------------------------------------------------- VISU::CutLines_i:: CutLines_i(Result_i* theResult, bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), @@ -71,33 +97,45 @@ CutLines_i(Result_i* theResult, {} +//--------------------------------------------------------------- VISU::CutLines_i:: CutLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myCutLinesPL(NULL) -{ -} +{} /*! Copy map to /a myMapCurvesInverted. * \param theCurves - map */ -void VISU::CutLines_i::CopyCurvesInverted(const TCurvesInv& theCurves){ +void +VISU::CutLines_i +::CopyCurvesInverted(const TCurvesInv& theCurves) +{ myMapCurvesInverted = theCurves; } -VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) + +//--------------------------------------------------------------- +VISU::Storable* +VISU::CutLines_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap) +//--------------------------------------------------------------- +VISU::Storable* +VISU::CutLines_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -139,8 +177,12 @@ VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap) } -void VISU::CutLines_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); +//--------------------------------------------------------------- +void +VISU::CutLines_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); int aNbLines = GetNbLines(); @@ -171,91 +213,187 @@ void VISU::CutLines_i::ToStream(std::ostringstream& theStr){ Storable::DataToStream( theStr, "myMapCurvesInverted", aStrCurvesInverted.latin1()); } -VISU::CutLines_i::~CutLines_i(){ + +//--------------------------------------------------------------- +VISU::CutLines_i +::~CutLines_i() +{ if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()"); } -void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle) +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetOrientation(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle) { myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle); + theXAngle, + theYAngle); } -void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle) + +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetOrientation2(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle) { myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle,1); + theXAngle, + theYAngle, + 1); } -VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() { +//--------------------------------------------------------------- +VISU::CutPlanes::Orientation +VISU::CutLines_i +::GetOrientationType() +{ return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation()); } -VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType2() { + +//--------------------------------------------------------------- +VISU::CutPlanes::Orientation +VISU::CutLines_i +::GetOrientationType2() +{ return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1)); } -CORBA::Double VISU::CutLines_i::GetRotateX(){ +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetRotateX() +{ return myCutLinesPL->GetRotateX(); } -CORBA::Double VISU::CutLines_i::GetRotateY(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetRotateY() +{ return myCutLinesPL->GetRotateY(); } -CORBA::Double VISU::CutLines_i::GetRotateX2(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetRotateX2() +{ return myCutLinesPL->GetRotateX(1); } -CORBA::Double VISU::CutLines_i::GetRotateY2(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetRotateY2() +{ return myCutLinesPL->GetRotateY(1); } -void VISU::CutLines_i::SetDisplacement(CORBA::Double theDisp) { +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetDisplacement(CORBA::Double theDisp) +{ myCutLinesPL->SetDisplacement(theDisp); } -void VISU::CutLines_i::SetDisplacement2(CORBA::Double theDisp) { + +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetDisplacement2(CORBA::Double theDisp) +{ myCutLinesPL->SetDisplacement(theDisp,1); } -CORBA::Double VISU::CutLines_i::GetDisplacement() { + +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetDisplacement() +{ return myCutLinesPL->GetDisplacement(); } -CORBA::Double VISU::CutLines_i::GetDisplacement2() { + +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetDisplacement2() +{ return myCutLinesPL->GetDisplacement(1); } -void VISU::CutLines_i::SetBasePlanePosition(CORBA::Double thePlanePosition){ +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetBasePlanePosition(CORBA::Double thePlanePosition) +{ myCutLinesPL->SetPosition(thePlanePosition); } -CORBA::Double VISU::CutLines_i::GetBasePlanePosition(){ +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetBasePlanePosition() +{ return myCutLinesPL->GetPosition(); } -void VISU::CutLines_i::SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){ +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetLinePosition(CORBA::Long thePlaneNumber, + CORBA::Double thePlanePosition) +{ myCutLinesPL->SetPartPosition(thePlaneNumber,thePlanePosition); } -CORBA::Double VISU::CutLines_i::GetLinePosition(CORBA::Long thePlaneNumber){ +//--------------------------------------------------------------- +CORBA::Double +VISU::CutLines_i +::GetLinePosition(CORBA::Long thePlaneNumber) +{ return myCutLinesPL->GetPartPosition(thePlaneNumber,1); } -void VISU::CutLines_i::SetDefault(){ +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetDefault() +{ myCutLinesPL->SetDefault(); } -CORBA::Boolean VISU::CutLines_i::IsDefault(){ +//--------------------------------------------------------------- +CORBA::Boolean +VISU::CutLines_i +::IsDefault() +{ return myCutLinesPL->IsDefault(); } -void VISU::CutLines_i::SetDefaultPosition(CORBA::Long thePlaneNumber){ +//--------------------------------------------------------------- +void +VISU::CutLines_i +::SetDefaultPosition(CORBA::Long thePlaneNumber) +{ myCutLinesPL->SetPartDefault(thePlaneNumber); } -CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){ +//--------------------------------------------------------------- +CORBA::Boolean +VISU::CutLines_i +::IsDefaultPosition(CORBA::Long thePlaneNumber) +{ return myCutLinesPL->IsPartDefault(thePlaneNumber); } @@ -263,14 +401,20 @@ CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){ * see void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert) * \param theInvert - Invert all curves, if value is TRUE, else not. */ -void VISU::CutLines_i::SetAllCurvesInverted(CORBA::Boolean theInvert){ +void +VISU::CutLines_i +::SetAllCurvesInverted(CORBA::Boolean theInvert) +{ for (int i=0; iSetNbParts(theNb); } -CORBA::Long VISU::CutLines_i::GetNbLines() { + +//--------------------------------------------------------------- +CORBA::Long +VISU::CutLines_i +::GetNbLines() +{ return myCutLinesPL->GetNbParts(); } -void VISU::CutLines_i::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New(); +//--------------------------------------------------------------- +void +VISU::CutLines_i +::CreatePipeLine() +{ + if(!myPipeLine) + myPipeLine = VISU_CutLinesPL::New(); myCutLinesPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::CreatePipeLine(); } + +//---------------------------------------------------------------------------- +bool +VISU::CutLines_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); +} + + +//--------------------------------------------------------------- VISU_Actor* VISU::CutLines_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2); @@ -321,12 +496,16 @@ VISU::CutLines_i return NULL; } -void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ +//--------------------------------------------------------------- +void +VISU::CutLines_i +::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject) +{ try{ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal"); Update(); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal"); SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 6464d210..9ccf7082 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -31,7 +31,8 @@ class VISU_CutLinesPL; -namespace VISU{ +namespace VISU +{ class CutLines_i : public virtual POA_VISU::CutLines, public virtual ScalarMap_i { @@ -48,72 +49,188 @@ namespace VISU{ explicit CutLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual ~CutLines_i(); + virtual + ~CutLines_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TCUTLINES; + } + + virtual + void + SetOrientation(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle); + + virtual + void + SetOrientation2(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle); + + virtual + VISU::CutPlanes::Orientation + GetOrientationType(); + + virtual + VISU::CutPlanes::Orientation + GetOrientationType2(); - virtual VISU::VISUType GetType() { return VISU::TCUTLINES;}; + virtual + CORBA::Double + GetRotateX(); - virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle); - virtual void SetOrientation2(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle); + virtual + CORBA::Double + GetRotateY(); - virtual VISU::CutPlanes::Orientation GetOrientationType(); - virtual VISU::CutPlanes::Orientation GetOrientationType2(); + virtual + CORBA::Double + GetRotateX2(); - virtual CORBA::Double GetRotateX(); - virtual CORBA::Double GetRotateY(); + virtual + CORBA::Double + GetRotateY2(); - virtual CORBA::Double GetRotateX2(); - virtual CORBA::Double GetRotateY2(); + virtual + void + SetDisplacement(CORBA::Double theDisp); - virtual void SetDisplacement(CORBA::Double theDisp); - virtual CORBA::Double GetDisplacement(); + virtual + CORBA::Double + GetDisplacement(); - virtual void SetDisplacement2(CORBA::Double theDisp); - virtual CORBA::Double GetDisplacement2(); + virtual + void + SetDisplacement2(CORBA::Double theDisp); - virtual void SetBasePlanePosition(CORBA::Double thePlanePosition); - virtual CORBA::Double GetBasePlanePosition(); + virtual + CORBA::Double + GetDisplacement2(); - virtual void SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition); - virtual CORBA::Double GetLinePosition(CORBA::Long thePlaneNumber); + virtual + void + SetBasePlanePosition(CORBA::Double thePlanePosition); - virtual void SetDefault(); - virtual CORBA::Boolean IsDefault(); + virtual + CORBA::Double + GetBasePlanePosition(); - virtual void SetDefaultPosition(CORBA::Long thePlaneNumber); - virtual CORBA::Boolean IsDefaultPosition(CORBA::Long thePlaneNumber); + virtual + void + SetLinePosition(CORBA::Long thePlaneNumber, + CORBA::Double thePlanePosition); - virtual void SetAllCurvesInverted(CORBA::Boolean theInvert); - virtual CORBA::Boolean IsAllCurvesInverted(); - virtual void SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert); - virtual CORBA::Boolean IsCurveInverted(CORBA::Long theCurveNumber); + virtual + CORBA::Double + GetLinePosition(CORBA::Long thePlaneNumber); + + virtual + void + SetDefault(); + + virtual + CORBA::Boolean + IsDefault(); + + virtual + void + SetDefaultPosition(CORBA::Long thePlaneNumber); + + virtual + CORBA::Boolean + IsDefaultPosition(CORBA::Long thePlaneNumber); + + virtual + void + SetAllCurvesInverted(CORBA::Boolean theInvert); + + virtual + CORBA::Boolean + IsAllCurvesInverted(); + + virtual + void + SetCurveInverted(CORBA::Long theCurveNumber, + CORBA::Boolean theInvert); + + virtual + CORBA::Boolean + IsCurveInverted(CORBA::Long theCurveNumber); + + virtual + void + SetNbLines(CORBA::Long theNb); + + virtual + CORBA::Long + GetNbLines(); - virtual void SetNbLines(CORBA::Long theNb); - virtual CORBA::Long GetNbLines(); - typedef VISU::CutLines TInterface; - VISU_CutLinesPL* GetCutLinesPL(){ return myCutLinesPL;} - typedef std::map TCurvesInv; - TCurvesInv GetCurvesInverted() {return myMapCurvesInverted;} - void CopyCurvesInverted(const TCurvesInv& theCurves); + TCurvesInv + GetCurvesInverted() + { + return myMapCurvesInverted; + } + void + CopyCurvesInverted(const TCurvesInv& theCurves); + + typedef VISU::CutLines TInterface; + + VISU_CutLinesPL* + GetSpecificPL() const + { + return myCutLinesPL; + } + protected: - virtual void DoHook(); + //! Extends VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Extends VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); VISU_CutLinesPL *myCutLinesPL; TCurvesInv myMapCurvesInverted; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); + //! Extends VISU_ColoredPrs3d_i::IsPossible + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + //! Extends VISU_ColoredPrs3d_i::Create + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); - virtual void ToStream(std::ostringstream& theStr); + //! Extends VISU_ColoredPrs3d_i::ToStream + virtual + void + ToStream(std::ostringstream& theStr); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + //! Extends VISU_ColoredPrs3d_i::Restore + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + //! Extends VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); @@ -121,8 +238,14 @@ namespace VISU{ void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); + + virtual + const char* + GetComment() const; + + virtual + QString + GenerateName(); }; } diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index c4b952e5..cfcc4ce4 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -31,34 +31,55 @@ #include "SUIT_ResourceMgr.h" -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif -int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//---------------------------------------------------------------------------- +int +VISU::CutPlanes_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,isMemoryCheck); } +//---------------------------------------------------------------------------- int VISU::CutPlanes_i::myNbPresent = 0; -QString VISU::CutPlanes_i::GenerateName() { return VISU::GenerateName("CutPlanes",myNbPresent++);} +//---------------------------------------------------------------------------- +QString +VISU::CutPlanes_i +::GenerateName() +{ + return VISU::GenerateName("CutPlanes",myNbPresent++); +} +//---------------------------------------------------------------------------- const string VISU::CutPlanes_i::myComment = "CUTPLANES"; -const char* VISU::CutPlanes_i::GetComment() const { return myComment.c_str();} + +//---------------------------------------------------------------------------- +const char* +VISU::CutPlanes_i +::GetComment() const +{ + return myComment.c_str(); +} -VISU::CutPlanes_i:: -CutPlanes_i(Result_i* theResult, - bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), +//---------------------------------------------------------------------------- +VISU::CutPlanes_i +::CutPlanes_i(Result_i* theResult, + bool theAddToStudy): + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), @@ -66,26 +87,34 @@ CutPlanes_i(Result_i* theResult, {} -VISU::CutPlanes_i:: -CutPlanes_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//---------------------------------------------------------------------------- +VISU::CutPlanes_i +::CutPlanes_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject): + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myCutPlanesPL(NULL) -{ -} +{} -VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//---------------------------------------------------------------------------- +VISU::Storable* +VISU::CutPlanes_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap) +//---------------------------------------------------------------------------- +VISU::Storable* +VISU::CutPlanes_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -104,6 +133,7 @@ VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap } +//---------------------------------------------------------------------------- void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){ ScalarMap_i::ToStream(theStr); @@ -123,73 +153,147 @@ void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){ } -VISU::CutPlanes_i::~CutPlanes_i(){ +//---------------------------------------------------------------------------- +VISU::CutPlanes_i +::~CutPlanes_i() +{ if(MYDEBUG) MESSAGE("CutPlanes_i::~CutPlanes_i()"); } -void VISU::CutPlanes_i::SetOrientation(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle) +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::SetOrientation(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle) { myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle); + theXAngle, + theYAngle); } -VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() { +//---------------------------------------------------------------------------- +VISU::CutPlanes::Orientation +VISU::CutPlanes_i +::GetOrientationType() +{ return VISU::CutPlanes::Orientation(myCutPlanesPL->GetPlaneOrientation()); } -CORBA::Double VISU::CutPlanes_i::GetRotateX(){ + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::CutPlanes_i +::GetRotateX() +{ return myCutPlanesPL->GetRotateX(); } -CORBA::Double VISU::CutPlanes_i::GetRotateY(){ + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::CutPlanes_i +::GetRotateY() +{ return myCutPlanesPL->GetRotateY(); } -void VISU::CutPlanes_i::SetDisplacement(CORBA::Double theDisp) { +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::SetDisplacement(CORBA::Double theDisp) +{ myCutPlanesPL->SetDisplacement(theDisp); } -CORBA::Double VISU::CutPlanes_i::GetDisplacement() { + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::CutPlanes_i +::GetDisplacement() +{ return myCutPlanesPL->GetDisplacement(); } -void VISU::CutPlanes_i::SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){ +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::SetPlanePosition(CORBA::Long thePlaneNumber, + CORBA::Double thePlanePosition) +{ myCutPlanesPL->SetPartPosition(thePlaneNumber,thePlanePosition); } -CORBA::Double VISU::CutPlanes_i::GetPlanePosition(CORBA::Long thePlaneNumber){ + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::CutPlanes_i +::GetPlanePosition(CORBA::Long thePlaneNumber) +{ return myCutPlanesPL->GetPartPosition(thePlaneNumber); } -void VISU::CutPlanes_i::SetDefault(CORBA::Long thePlaneNumber){ +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::SetDefault(CORBA::Long thePlaneNumber) +{ myCutPlanesPL->SetPartDefault(thePlaneNumber); } -CORBA::Boolean VISU::CutPlanes_i::IsDefault(CORBA::Long thePlaneNumber){ + +//---------------------------------------------------------------------------- +CORBA::Boolean +VISU::CutPlanes_i +::IsDefault(CORBA::Long thePlaneNumber) +{ return myCutPlanesPL->IsPartDefault(thePlaneNumber); } -void VISU::CutPlanes_i::SetNbPlanes(CORBA::Long theNb) { +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::SetNbPlanes(CORBA::Long theNb) +{ myCutPlanesPL->SetNbParts(theNb); } -CORBA::Long VISU::CutPlanes_i::GetNbPlanes() { + +//---------------------------------------------------------------------------- +CORBA::Long +VISU::CutPlanes_i +::GetNbPlanes() +{ return myCutPlanesPL->GetNbParts(); } -void VISU::CutPlanes_i::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New(); +//---------------------------------------------------------------------------- +void +VISU::CutPlanes_i +::CreatePipeLine() +{ + if(!myPipeLine) + myPipeLine = VISU_CutPlanesPL::New(); myCutPlanesPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::CreatePipeLine(); +} + + +//--------------------------------------------------------------- +bool +VISU::CutPlanes_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } +//---------------------------------------------------------------------------- VISU_Actor* VISU::CutPlanes_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_planes_represent", 1); diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index de65dbb7..006c8c7e 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -31,7 +31,8 @@ class VISU_CutPlanesPL; -namespace VISU{ +namespace VISU +{ class CutPlanes_i : public virtual POA_VISU::CutPlanes, public virtual ScalarMap_i { @@ -48,54 +49,132 @@ namespace VISU{ explicit CutPlanes_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual ~CutPlanes_i(); + virtual + ~CutPlanes_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TCUTPLANES; + } + + virtual + void + SetOrientation(VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle); - virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;}; + virtual + VISU::CutPlanes::Orientation + GetOrientationType(); + + virtual + CORBA::Double + GetRotateX(); - virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle); + virtual + CORBA::Double + GetRotateY(); - virtual VISU::CutPlanes::Orientation GetOrientationType(); - virtual CORBA::Double GetRotateX(); - virtual CORBA::Double GetRotateY(); + virtual + void + SetDisplacement(CORBA::Double theDisp); - virtual void SetDisplacement(CORBA::Double theDisp); - virtual CORBA::Double GetDisplacement(); + virtual + CORBA::Double + GetDisplacement(); + + virtual + void + SetPlanePosition(CORBA::Long thePlaneNumber, + CORBA::Double thePlanePosition); + virtual + CORBA::Double + GetPlanePosition(CORBA::Long thePlaneNumber); - virtual void SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition); - virtual CORBA::Double GetPlanePosition(CORBA::Long thePlaneNumber); + virtual + void + SetDefault(CORBA::Long thePlaneNumber); - virtual void SetDefault(CORBA::Long thePlaneNumber); - virtual CORBA::Boolean IsDefault(CORBA::Long thePlaneNumber); + virtual + CORBA::Boolean + IsDefault(CORBA::Long thePlaneNumber); - virtual void SetNbPlanes(CORBA::Long theNb); - virtual CORBA::Long GetNbPlanes(); + virtual + void + SetNbPlanes(CORBA::Long theNb); + + virtual + CORBA::Long + GetNbPlanes(); typedef VISU::CutPlanes TInterface; - VISU_CutPlanesPL* GetCutPlanesPL(){ return myCutPlanesPL;} + VISU_CutPlanesPL* + GetSpecificPL() const + { + return myCutPlanesPL; + } + protected: - virtual void DoHook(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); VISU_CutPlanesPL *myCutPlanesPL; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); - - virtual void ToStream(std::ostringstream& theStr); - - virtual Storable* Restore(const Storable::TRestoringMap& theMap); - + //! Redefines VISU_ColoredPrs3d_i::IsPossible + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + //! Redefines VISU_ColoredPrs3d_i::Create + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); + + //! Redefines VISU_ColoredPrs3d_i::ToStream + virtual + void + ToStream(std::ostringstream& theStr); + + //! Redefines VISU_ColoredPrs3d_i::Restore + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + //! Redefines VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); + + //! Redefines VISU_ColoredPrs3d_i::GetComment + virtual + const char* + GetComment() const; + + //! Redefines VISU_ColoredPrs3d_i::GenerateName + virtual + QString + GenerateName(); }; } diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 8c2920dc..0dbfdbe3 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -36,22 +36,37 @@ #include #include -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif -int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::DeformedShape_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { try{ - if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0; - const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName); - return aField->myNbComp > 1; + bool aResult = TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + isMemoryCheck); + if(aResult){ + VISU::Result_i::TInput* anInput = theResult->GetInput(); + VISU::PField aField = anInput->GetField(theMeshName, + (VISU::TEntity)theEntity, + theFieldName); + return aField->myNbComp > 1; + } }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<GetStudyDocument()), + +//--------------------------------------------------------------- +VISU::DeformedShape_i +::DeformedShape_i(Result_i* theResult, + bool theAddToStudy): + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), @@ -80,10 +113,11 @@ DeformedShape_i(Result_i* theResult, } -VISU::DeformedShape_i:: -DeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::DeformedShape_i +::DeformedShape_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject): + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), @@ -93,7 +127,10 @@ DeformedShape_i(Result_i* theResult, } -void VISU::DeformedShape_i::SameAs(const Prs3d_i* theOrigin) +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::SameAs(const Prs3d_i* theOrigin) { TSuperClass::SameAs(theOrigin); @@ -105,16 +142,24 @@ void VISU::DeformedShape_i::SameAs(const Prs3d_i* theOrigin) } -VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//--------------------------------------------------------------- +VISU::Storable* +VISU::DeformedShape_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { myIsColored = false; myColor.R = myColor.G = myColor.B = 0.5; - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap) +//--------------------------------------------------------------- +VISU::Storable* +VISU::DeformedShape_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -128,8 +173,12 @@ VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& th } -void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myFactor", GetScale() ); @@ -140,38 +189,70 @@ void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){ } -VISU::DeformedShape_i::~DeformedShape_i(){ +//--------------------------------------------------------------- +VISU::DeformedShape_i +::~DeformedShape_i() +{ if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()"); } -void VISU::DeformedShape_i::SetScale(CORBA::Double theScale) { +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::SetScale(CORBA::Double theScale) +{ myDeformedShapePL->SetScale(theScale); } -CORBA::Double VISU::DeformedShape_i::GetScale(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::DeformedShape_i +::GetScale() +{ return myDeformedShapePL->GetScale(); } -void VISU::DeformedShape_i::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_DeformedShapePL::New(); +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::CreatePipeLine() +{ + if(!myPipeLine) + myPipeLine = VISU_DeformedShapePL::New(); myDeformedShapePL = dynamic_cast(myPipeLine); myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); - ScalarMap_i::DoHook(); + TSuperClass::CreatePipeLine(); +} + + +//--------------------------------------------------------------- +bool +VISU::DeformedShape_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } -void VISU::DeformedShape_i::SetMapScale(double theMapScale){ +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::SetMapScale(double theMapScale) +{ myDeformedShapePL->SetMapScale(theMapScale); } +//--------------------------------------------------------------- VISU_Actor* VISU::DeformedShape_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, + bool toSupressShrinking) { - VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO, true); + VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true); anActor->SetVTKMapping(false); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1); @@ -182,6 +263,8 @@ VISU::DeformedShape_i return anActor; } + +//--------------------------------------------------------------- VISU_Actor* VISU::DeformedShape_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) @@ -189,7 +272,12 @@ VISU::DeformedShape_i return CreateActor(theIO, false); } -void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) { + +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::UpdateActor(VISU_Actor* theActor) +{ if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ if(IsColored()){ anActor->SetBarVisibility(true); @@ -199,6 +287,6 @@ void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) { myPipeLine->GetMapper()->SetScalarVisibility(0); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); } - VISU::ScalarMap_i::UpdateActor(theActor); + TSuperClass::UpdateActor(theActor); } } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 42854699..be727c74 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -31,7 +31,8 @@ class VISU_DeformedShapePL; -namespace VISU{ +namespace VISU +{ class DeformedShape_i : public virtual POA_VISU::DeformedShape, public virtual ScalarMap_i { @@ -48,45 +49,116 @@ namespace VISU{ explicit DeformedShape_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Prs3d_i* theOrigin); - virtual ~DeformedShape_i(); + virtual + void + SameAs(const Prs3d_i* theOrigin); - virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;}; + virtual + ~DeformedShape_i(); - virtual void SetScale(CORBA::Double theScale); - virtual CORBA::Double GetScale(); + virtual + VISU::VISUType + GetType() + { + return VISU::TDEFORMEDSHAPE; + } - virtual CORBA::Boolean IsColored() { return myIsColored; } - virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; } + virtual + void + SetScale(CORBA::Double theScale); - virtual SALOMEDS::Color GetColor() { return myColor;} - virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;} + virtual + CORBA::Double + GetScale(); + + virtual + CORBA::Boolean + IsColored() + { + return myIsColored; + } + + virtual + void + ShowColored(CORBA::Boolean theColored) + { + myIsColored = theColored; + } + + virtual + SALOMEDS::Color GetColor() + { + return myColor; + } + + virtual + void + SetColor(const SALOMEDS::Color& theColor) + { + myColor = theColor; + } typedef VISU::DeformedShape TInterface; - VISU_DeformedShapePL* GetDeformedShapePL(){ return myDeformedShapePL;} + VISU_DeformedShapePL* + GetSpecificPL() const + { + return myDeformedShapePL; + } + protected: - virtual void DoHook(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); VISU_DeformedShapePL *myDeformedShapePL; SALOMEDS::Color myColor; bool myIsColored; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - virtual void ToStream(std::ostringstream& theStr); + virtual + const char* + GetComment() const; + + virtual + QString + GenerateName(); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + void + ToStream(std::ostringstream& theStr); - virtual void SetMapScale(double theMapScale = 1.0); + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + virtual + void + SetMapScale(double theMapScale = 1.0); virtual VISU_Actor* @@ -94,9 +166,12 @@ namespace VISU{ virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); + CreateActor(const Handle(SALOME_InteractiveObject)& theIO, + bool toSupressShrinking); - virtual void UpdateActor(VISU_Actor* theActor) ; + virtual + void + UpdateActor(VISU_Actor* theActor) ; }; } diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index a2e810a8..251abdd7 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -180,11 +180,13 @@ namespace VISU break; } + CORBA::String_var aMeshName = theServant->GetMeshName(); + CORBA::String_var aFieldName = theServant->GetFieldName(); theStr<GetMeshName()<<"'"<< + ",'"<GetFieldName()<<"'"<< - ","<GetIteration()<< + ",'"<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){ @@ -636,18 +639,18 @@ namespace VISU if(aSubMeshName == "") theStr<GetMeshName()<<"'"<< + ",'"<GetMeshName()<<"'"<< + ",'"<GetMeshName()<<"'"<< + ",'"< #include -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else @@ -510,18 +507,18 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- void VISU::GaussPoints_i -::DoSetInput(Result_i* theResult) +::DoSetInput() { - VISU::Result_i::TInput* anInput = theResult->GetInput(); + VISU::Result_i::TInput* anInput = myResult->GetInput(); if(!anInput) - throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); + throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); - myField = anInput->GetField(myMeshName,myEntity,myFieldName); + myField = anInput->GetField(GetMeshName(),GetTEntity(),GetFieldName()); if(!myField) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PGaussPtsIDMapper aGaussPtsIDMapper = - anInput->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration); + anInput->GetTimeStampOnGaussPts(GetMeshName(),GetTEntity(),GetFieldName(),GetTimeStampNumber()); if(!aGaussPtsIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); @@ -530,21 +527,30 @@ VISU::GaussPoints_i myGaussPointsPL->Init(); myGaussPointsPL->Build(); - theResult->MinMaxConnect(this); + myResult->MinMaxConnect(this); +} + + +//---------------------------------------------------------------------------- +bool +VISU::GaussPoints_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } //---------------------------------------------------------------------------- void VISU::GaussPoints_i -::DoHook() +::CreatePipeLine() { if(!myPipeLine) myPipeLine = VISU_GaussPointsPL::New(); myGaussPointsPL = dynamic_cast(myPipeLine); - TSuperClass::DoHook(); + TSuperClass::CreatePipeLine(); } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index c80ef747..3a907582 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -246,14 +246,27 @@ namespace VISU void UpdateMinMax(); + VISU_GaussPointsPL* + GetSpecificPL() const + { + return myGaussPointsPL; + } + protected: + //! Redefines VISU_ColoredPrs3d_i::DoSetInput virtual void - DoSetInput(Result_i* theResult); + DoSetInput(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - DoHook(); + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); virtual VISU_PipeLine* @@ -273,9 +286,9 @@ namespace VISU UpdateScalarBar(vtkScalarBarActor *theScalarBar, vtkLookupTable* theLookupTable); - + protected: VISU_GaussPointsPL *myGaussPointsPL; - + bool myIsColored; bool myIsDispGlobalScalarBar; bool myIsActiveLocalScalarBar; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index ebac78cb..5d599352 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -219,8 +219,9 @@ namespace VISU //=========================================================================== - VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex) : + VISU_Gen_i:: + VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, + SALOME_NamingService* theNamingService, QMutex* theMutex) : Engines_Component_i() { if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "< + Prs3d_ptr + CreatePrs3d(SALOMEDS::Study_ptr theStudy) + { + if(!theStudy->GetProperties()->IsLocked()){ + typedef typename TPrs3d_i::TInterface TPrs3d; + typename TPrs3d::_var_type aPrs3d; + if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,true)){ + return aPresent->_this(); + } + } + return Prs3d::_nil(); + } + + + Prs3d_ptr + VISU_Gen_i:: + CreatePrs3d(VISUType theType, + SALOMEDS::Study_ptr theStudy) + { + switch(theType){ + case TSCALARMAP: + return VISU::CreatePrs3d(theStudy); + case TGAUSSPOINTS: + return VISU::CreatePrs3d(theStudy); + case TDEFORMEDSHAPE: + return VISU::CreatePrs3d(theStudy); + case TSCALARMAPONDEFORMEDSHAPE: + return VISU::CreatePrs3d(theStudy); + case TISOSURFACE: + return VISU::CreatePrs3d(theStudy); + case TSTREAMLINES: + return VISU::CreatePrs3d(theStudy); + case TPLOT3D: + return VISU::CreatePrs3d(theStudy); + case TCUTPLANES: + return VISU::CreatePrs3d(theStudy); + case TCUTLINES: + return VISU::CreatePrs3d(theStudy); + } + return Prs3d::_nil(); + } + + bool CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, const char* theMeshName, diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 1a5f6f82..1faf9ca2 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -155,6 +155,10 @@ namespace VISU const char* theMeshName, const char* theGroupName); + Prs3d_ptr + CreatePrs3d(VISUType theType, + SALOMEDS::Study_ptr theStudy); + //Create 3D collored Presentation Of Different Types template TPrs3d_i* CreatePrs3d(Result_ptr theResult, diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 0f0077bc..b165af57 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -31,32 +31,56 @@ #include "SUIT_ResourceMgr.h" -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif -int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) +//--------------------------------------------------------------- +int +VISU::IsoSurfaces_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + isMemoryCheck); } +//--------------------------------------------------------------- int VISU::IsoSurfaces_i::myNbPresent = 0; -QString VISU::IsoSurfaces_i::GenerateName() { return VISU::GenerateName("IsoSurfaces",myNbPresent++);} +//--------------------------------------------------------------- +QString VISU::IsoSurfaces_i::GenerateName() +{ + return VISU::GenerateName("IsoSurfaces",myNbPresent++); +} + +//--------------------------------------------------------------- const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES"; -const char* VISU::IsoSurfaces_i::GetComment() const { return myComment.c_str();} + +//--------------------------------------------------------------- +const char* +VISU::IsoSurfaces_i +::GetComment() const +{ + return myComment.c_str(); +} -VISU::IsoSurfaces_i:: -IsoSurfaces_i(Result_i* theResult, - bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::IsoSurfaces_i +::IsoSurfaces_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), @@ -64,26 +88,34 @@ IsoSurfaces_i(Result_i* theResult, {} -VISU::IsoSurfaces_i:: -IsoSurfaces_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::IsoSurfaces_i +::IsoSurfaces_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject) : + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myIsoSurfacesPL(NULL) -{ -} +{} -VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//--------------------------------------------------------------- +VISU::Storable* +VISU::IsoSurfaces_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap) +//--------------------------------------------------------------- +VISU::Storable* +VISU::IsoSurfaces_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -95,8 +127,13 @@ VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theM return this; } -void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); + +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) ); Storable::DataToStream( theStr, "myRange[0]", GetSubMin() ); @@ -104,46 +141,84 @@ void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){ } -VISU::IsoSurfaces_i::~IsoSurfaces_i(){ +//--------------------------------------------------------------- +VISU::IsoSurfaces_i +::~IsoSurfaces_i() +{ if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()"); } -void VISU::IsoSurfaces_i::SetNbSurfaces(CORBA::Long theNb){ +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::SetNbSurfaces(CORBA::Long theNb) +{ myIsoSurfacesPL->SetNbParts(theNb); } -CORBA::Long VISU::IsoSurfaces_i::GetNbSurfaces(){ + +//--------------------------------------------------------------- +CORBA::Long +VISU::IsoSurfaces_i +::GetNbSurfaces() +{ return myIsoSurfacesPL->GetNbParts(); } -void VISU::IsoSurfaces_i::SetSubRange(CORBA::Double theMin, CORBA::Double theMax) +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::SetSubRange(CORBA::Double theMin, CORBA::Double theMax) { vtkFloatingPointType aRange[2] = {theMin, theMax}; myIsoSurfacesPL->SetRange(aRange); } -CORBA::Double VISU::IsoSurfaces_i::GetSubMin(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::IsoSurfaces_i +::GetSubMin() +{ return myIsoSurfacesPL->GetMin(); } -CORBA::Double VISU::IsoSurfaces_i::GetSubMax(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::IsoSurfaces_i +::GetSubMax() +{ return myIsoSurfacesPL->GetMax(); } -void VISU::IsoSurfaces_i::DoHook(){ +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::CreatePipeLine() +{ if(MYDEBUG) MESSAGE("IsoSurfaces_i::DoHook()- "<(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::CreatePipeLine(); } +//--------------------------------------------------------------- +bool +VISU::IsoSurfaces_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); +} + +//--------------------------------------------------------------- VISU_Actor* VISU::IsoSurfaces_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2); @@ -153,6 +228,11 @@ VISU::IsoSurfaces_i return NULL; } -void VISU::IsoSurfaces_i::SetMapScale(double theMapScale){ + +//--------------------------------------------------------------- +void +VISU::IsoSurfaces_i +::SetMapScale(double theMapScale) +{ myIsoSurfacesPL->SetMapScale(theMapScale); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 56db9093..bcbb8662 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -31,7 +31,8 @@ class VISU_IsoSurfacesPL; -namespace VISU{ +namespace VISU +{ class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces, public virtual ScalarMap_i { @@ -48,43 +49,99 @@ namespace VISU{ explicit IsoSurfaces_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual ~IsoSurfaces_i(); + virtual + ~IsoSurfaces_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TISOSURFACE; + } - virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;}; + virtual + void + SetNbSurfaces(CORBA::Long theNb); - virtual void SetNbSurfaces(CORBA::Long theNb); - virtual CORBA::Long GetNbSurfaces(); + virtual + CORBA::Long + GetNbSurfaces(); + + virtual + void + SetSubRange(CORBA::Double theMin, CORBA::Double theMax); - virtual void SetSubRange(CORBA::Double theMin, CORBA::Double theMax); - virtual CORBA::Double GetSubMin(); - virtual CORBA::Double GetSubMax(); + virtual + CORBA::Double + GetSubMin(); + + virtual + CORBA::Double + GetSubMax(); typedef VISU::IsoSurfaces TInterface; - VISU_IsoSurfacesPL* GetIsoSurfacesPL(){ return myIsoSurfacesPL;} + VISU_IsoSurfacesPL* + GetSpecificPL() const + { + return myIsoSurfacesPL; + } + protected: - virtual void DoHook(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); + VISU_IsoSurfacesPL* myIsoSurfacesPL; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - virtual void ToStream(std::ostringstream& theStr); + virtual + const char* + GetComment() const; + + virtual + QString + GenerateName(); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + void + ToStream(std::ostringstream& theStr); + + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - - virtual void SetMapScale(double theMapScale = 1.0); + + virtual + void + SetMapScale(double theMapScale = 1.0); }; } diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index ababd507..a848763f 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -223,7 +223,7 @@ VISU::Mesh_i::~Mesh_i(){ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) { - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); aStudyBuilder->NewCommand(); // There is a transaction try { if (myResult->GetInput() == NULL) @@ -287,8 +287,8 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) string anEntry = myResult->GetEntry(aComment.latin1()); if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); - mySObject = myStudy->FindObjectID(anEntry.c_str()); - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + mySObject = GetStudyDocument()->FindObjectID(anEntry.c_str()); + SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aString = GetID(); diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index c7e43098..ed769cff 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -76,7 +76,6 @@ namespace VISU VISU_MeshPL* myMeshPL; - // std::string myMeshName; move it to Prs3d_i int myEntity;//jfa IPAL9284: TEntity myEntity; std::string mySubMeshName; VISU::VISUType myType; @@ -92,7 +91,6 @@ namespace VISU static int IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName); virtual Storable* Create(const char* theMeshName, const char* theGroupName); - const std::string& GetMeshName() const { return myMeshName;} 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 d86ca318..7484a710 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -19,64 +19,99 @@ // #include "VISU_Plot3D_i.hh" - #include "VISU_Result_i.hh" - #include "VISU_Plot3DPL.hxx" - #include "VISU_Actor.h" - #include "SUIT_ResourceMgr.h" -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif -int VISU::Plot3D_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::Plot3D_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible - (theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + isMemoryCheck); } +//--------------------------------------------------------------- int VISU::Plot3D_i::myNbPresent = 0; -QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNbPresent++); } +//--------------------------------------------------------------- +QString +VISU::Plot3D_i +::GenerateName() +{ + return VISU::GenerateName("Plot3D",myNbPresent++); +} + +//--------------------------------------------------------------- const string VISU::Plot3D_i::myComment = "PLOT3D"; -const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); } +//--------------------------------------------------------------- +const char* +VISU::Plot3D_i +::GetComment() const +{ + return myComment.c_str(); +} + + +//--------------------------------------------------------------- VISU::Plot3D_i ::Plot3D_i(Result_i* theResult, bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myPlot3DPL(NULL) {} + +//--------------------------------------------------------------- VISU::Plot3D_i ::Plot3D_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myPlot3DPL(NULL) {} -VISU::Storable* VISU::Plot3D_i::Create (const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) + +//--------------------------------------------------------------- +VISU::Storable* +VISU::Plot3D_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap) + +//--------------------------------------------------------------- +VISU::Storable* +VISU::Plot3D_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -92,9 +127,13 @@ VISU::Storable* VISU::Plot3D_i::Restore (const Storable::TRestoringMap& theMap) return this; } -void VISU::Plot3D_i::ToStream (std::ostringstream& theStr) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::ToStream(std::ostringstream& theStr) { - ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); Storable::DataToStream(theStr, "myBasePlane", int(GetOrientationType())); Storable::DataToStream(theStr, "aRot[0]", GetRotateX()); @@ -106,91 +145,164 @@ void VISU::Plot3D_i::ToStream (std::ostringstream& theStr) Storable::DataToStream(theStr, "myNbOfContours", int(GetNbOfContours())); } -VISU::Plot3D_i::~Plot3D_i(){ + +//--------------------------------------------------------------- +VISU::Plot3D_i +::~Plot3D_i() +{ if(MYDEBUG) MESSAGE("Plot3D_i::~Plot3D_i()"); } -void VISU::Plot3D_i::SetOrientation (VISU::Plot3D::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetOrientation(VISU::Plot3D::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle) { myPlot3DPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle); + theXAngle, + theYAngle); } -VISU::Plot3D::Orientation VISU::Plot3D_i::GetOrientationType() + +//--------------------------------------------------------------- +VISU::Plot3D::Orientation +VISU::Plot3D_i +::GetOrientationType() { return VISU::Plot3D::Orientation(myPlot3DPL->GetPlaneOrientation()); } -CORBA::Double VISU::Plot3D_i::GetRotateX() + +//--------------------------------------------------------------- +CORBA::Double +VISU::Plot3D_i +::GetRotateX() { return myPlot3DPL->GetRotateX(); } -CORBA::Double VISU::Plot3D_i::GetRotateY() + +//--------------------------------------------------------------- +CORBA::Double +VISU::Plot3D_i +::GetRotateY() { return myPlot3DPL->GetRotateY(); } -void VISU::Plot3D_i::SetPlanePosition (CORBA::Double thePlanePosition, - CORBA::Boolean theIsRelative) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetPlanePosition(CORBA::Double thePlanePosition, + CORBA::Boolean theIsRelative) { myPlot3DPL->SetPlanePosition(thePlanePosition, theIsRelative); } -CORBA::Double VISU::Plot3D_i::GetPlanePosition() + +//--------------------------------------------------------------- +CORBA::Double +VISU::Plot3D_i +::GetPlanePosition() { return myPlot3DPL->GetPlanePosition(); } -CORBA::Boolean VISU::Plot3D_i::IsPositionRelative() + +//--------------------------------------------------------------- +CORBA::Boolean +VISU::Plot3D_i +::IsPositionRelative() { return myPlot3DPL->IsPositionRelative(); } -void VISU::Plot3D_i::SetScaleFactor (CORBA::Double theScaleFactor) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetScaleFactor(CORBA::Double theScaleFactor) { myPlot3DPL->SetScaleFactor(theScaleFactor); } -CORBA::Double VISU::Plot3D_i::GetScaleFactor() + +//--------------------------------------------------------------- +CORBA::Double +VISU::Plot3D_i +::GetScaleFactor() { return myPlot3DPL->GetScaleFactor(); } -void VISU::Plot3D_i::SetNbOfContours (CORBA::Long theNb) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetNbOfContours(CORBA::Long theNb) { myPlot3DPL->SetNumberOfContours(theNb); } -CORBA::Long VISU::Plot3D_i::GetNbOfContours() + +//--------------------------------------------------------------- +CORBA::Long +VISU::Plot3D_i +::GetNbOfContours() { return myPlot3DPL->GetNumberOfContours(); } -void VISU::Plot3D_i::SetContourPrs (CORBA::Boolean theIsContourPrs ) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetContourPrs(CORBA::Boolean theIsContourPrs) { myPlot3DPL->SetContourPrs( theIsContourPrs ); } -CORBA::Boolean VISU::Plot3D_i::GetIsContourPrs() + +//--------------------------------------------------------------- +CORBA::Boolean +VISU::Plot3D_i +::GetIsContourPrs() { return myPlot3DPL->GetIsContourPrs(); } -void VISU::Plot3D_i::DoHook() + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::CreatePipeLine() { - if (!myPipeLine) myPipeLine = VISU_Plot3DPL::New(); + if (!myPipeLine) + myPipeLine = VISU_Plot3DPL::New(); myPlot3DPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::CreatePipeLine(); } + +//--------------------------------------------------------------- +bool +VISU::Plot3D_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); +} + +//--------------------------------------------------------------- VISU_Actor* VISU::Plot3D_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "plot3d_represent", 2); @@ -200,7 +312,11 @@ VISU::Plot3D_i return NULL; } -void VISU::Plot3D_i::SetMapScale(double theMapScale) + +//--------------------------------------------------------------- +void +VISU::Plot3D_i +::SetMapScale(double theMapScale) { myPlot3DPL->SetMapScale(theMapScale); } diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index d509b545..8a1ce19e 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -25,7 +25,8 @@ class VISU_Plot3DPL; -namespace VISU { +namespace VISU +{ class Plot3D_i : public virtual POA_VISU::Plot3D, public virtual ScalarMap_i { @@ -37,64 +38,138 @@ namespace VISU { typedef ScalarMap_i TSuperClass; explicit - Plot3D_i (Result_i* theResult, bool theAddToStudy = true); + Plot3D_i(Result_i* theResult, + bool theAddToStudy); explicit - Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject); + Plot3D_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject); - virtual ~Plot3D_i(); + virtual + ~Plot3D_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TPLOT3D; + } + + virtual + void + SetOrientation (VISU::Plot3D::Orientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle); + + virtual + VISU::Plot3D::Orientation + GetOrientationType(); + + virtual + CORBA::Double + GetRotateX(); - virtual VISU::VISUType GetType() { return VISU::TPLOT3D; }; + virtual + CORBA::Double + GetRotateY(); - virtual void SetOrientation (VISU::Plot3D::Orientation theOrient, - CORBA::Double theXAngle, CORBA::Double theYAngle); + virtual + void + SetPlanePosition(CORBA::Double thePlanePosition, + CORBA::Boolean theIsRelative); - virtual VISU::Plot3D::Orientation GetOrientationType(); + virtual + CORBA::Double + GetPlanePosition(); - virtual CORBA::Double GetRotateX(); - virtual CORBA::Double GetRotateY(); + virtual + CORBA::Boolean + IsPositionRelative(); - virtual void SetPlanePosition (CORBA::Double thePlanePosition, - CORBA::Boolean theIsRelative); - virtual CORBA::Double GetPlanePosition(); - virtual CORBA::Boolean IsPositionRelative(); + virtual + void + SetScaleFactor(CORBA::Double theScaleFactor); - virtual void SetScaleFactor (CORBA::Double theScaleFactor); - virtual CORBA::Double GetScaleFactor(); + virtual + CORBA::Double + GetScaleFactor(); - virtual void SetContourPrs (CORBA::Boolean theIsContourPrs ); - CORBA::Boolean GetIsContourPrs(); + virtual + void + SetContourPrs(CORBA::Boolean theIsContourPrs); - virtual void SetNbOfContours (CORBA::Long theNb); - virtual CORBA::Long GetNbOfContours(); + CORBA::Boolean + GetIsContourPrs(); - typedef VISU::Plot3D TInterface; - VISU_Plot3DPL* GetPlot3DPL() { return myPlot3DPL; } + virtual + void + SetNbOfContours(CORBA::Long theNb); - void SetMapScale(double theMapScale); + virtual + CORBA::Long + GetNbOfContours(); + typedef VISU::Plot3D TInterface; + + VISU_Plot3DPL* + GetSpecificPL() const + { + return myPlot3DPL; + } + protected: - virtual void DoHook(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); VISU_Plot3DPL *myPlot3DPL; public: - static int IsPossible (Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); - virtual Storable* Create (const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); - virtual void ToStream (std::ostringstream& theStr); + virtual + void + ToStream (std::ostringstream& theStr); - virtual Storable* Restore (const Storable::TRestoringMap& theMap); + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); + + virtual + const char* + GetComment() const; + + virtual + QString + GenerateName(); + + void + SetMapScale(double theMapScale); }; } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 70d0e429..a74b9531 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -52,23 +52,26 @@ static int MYDEBUG = 0; VISU::Prs3d_i ::Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), mySObject(SALOMEDS::SObject::_duplicate(theSObject)), myActorCollection(vtkActorCollection::New()), - myResult(theResult), myAddToStudy(true), + myResult(theResult), myPipeLine(NULL) { if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<Delete(); - myResult->Register(); + if(theResult){ + SetStudyDocument(theResult->GetStudyDocument()); + theResult->Register(); + } } VISU::Prs3d_i ::Prs3d_i(Result_i* theResult, bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), myActorCollection(vtkActorCollection::New()), mySObject(SALOMEDS::SObject::_nil()), myAddToStudy(theAddToStudy), @@ -78,16 +81,19 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<Delete(); - myResult->Register(); + if(theResult){ + SetStudyDocument(theResult->GetStudyDocument()); + theResult->Register(); + } } void VISU::Prs3d_i ::SameAs(const Prs3d_i* theOrigin) { - if (Prs3d_i* aOrigin = const_cast(theOrigin)) { - myPipeLine->SameAs(aOrigin->GetPL()); - aOrigin->GetOffset(myOffset); + if(Prs3d_i* anOrigin = const_cast(theOrigin)){ + myPipeLine->SameAs(anOrigin->GetPL()); + anOrigin->GetOffset(myOffset); } } @@ -97,7 +103,63 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<Delete(); - myResult->Destroy(); + if(myResult) + myResult->Destroy(); +} + + +//---------------------------------------------------------------------------- +bool +VISU::Prs3d_i +::SetInput() +{ + return true; +} + +CORBA::Boolean +VISU::Prs3d_i +::Apply() +{ + if(SetInput()){ + UpdateActors(); + return true; + } + return false; +} + +void +VISU::Prs3d_i +::SetResultObject(VISU::Result_ptr theResult) +{ + Result_i* aResult = dynamic_cast(GetServant(theResult).in()); + if(myResult != aResult){ + if(myResult) + myResult->Destroy(); + if(aResult) + aResult->Register(); + myResult = aResult; + } +} + +VISU::Result_ptr +VISU::Prs3d_i +::GetResultObject() +{ + return myResult->_this(); +} + +void +VISU::Prs3d_i +::SetMeshName(const char* theMeshName) +{ + myMeshName = theMeshName; +} + +char* +VISU::Prs3d_i +::GetMeshName() +{ + return CORBA::string_dup(myMeshName.c_str()); } @@ -144,14 +206,6 @@ VISU::Prs3d_i return myResult; } -const std::string& -VISU::Prs3d_i -::GetMeshName() const -{ - return myMeshName; -} - - //---------------------------------------------------------------------------- void VISU::Prs3d_i @@ -159,7 +213,8 @@ VISU::Prs3d_i { if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<Update(); + if(myPipeLine) + myPipeLine->Update(); }catch(...){ throw std::runtime_error("Prs3d_i::Update >> unexpected exception was caught!!!"); } @@ -183,31 +238,32 @@ VISU::Prs3d_i throw std::runtime_error("Diagonal of the actor is too large !!!"); } + +struct TRemoveFromStudy: public SALOME_Event +{ + VISU::Prs3d_i* myRemovable; + typedef boost::signal0 TRemoveFromStudySignal; + const TRemoveFromStudySignal& myRemoveFromStudySignal; + + TRemoveFromStudy(VISU::Prs3d_i* theRemovable, + const TRemoveFromStudySignal& theRemoveFromStudySignal): + myRemovable(theRemovable), + myRemoveFromStudySignal(theRemoveFromStudySignal) + {} + + virtual + void + Execute() + { + myRemoveFromStudySignal(); + myRemovable->Destroy(); + } +}; + void VISU::Prs3d_i ::RemoveFromStudy() { - struct TRemoveFromStudy: public SALOME_Event - { - VISU::Prs3d_i* myRemovable; - typedef boost::signal0 TRemoveFromStudySignal; - const TRemoveFromStudySignal& myRemoveFromStudySignal; - - TRemoveFromStudy(VISU::Prs3d_i* theRemovable, - const TRemoveFromStudySignal& theRemoveFromStudySignal): - myRemovable(theRemovable), - myRemoveFromStudySignal(theRemoveFromStudySignal) - {} - - virtual - void - Execute() - { - myRemoveFromStudySignal(); - myRemovable->Destroy(); - } - }; - ProcessVoidEvent(new TRemoveFromStudy(this,myRemoveActorsFromRendererSignal)); } diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index d7bf7628..a5e24053 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -91,6 +91,27 @@ namespace VISU virtual ~Prs3d_i(); + //---------------------------------------------------------------------------- + virtual + CORBA::Boolean + Apply(); + + virtual + void + SetResultObject(VISU::Result_ptr theResult); + + virtual + VISU::Result_ptr + GetResultObject(); + + virtual + void + SetMeshName(const char* theMeshName); + + virtual + char* + GetMeshName(); + //---------------------------------------------------------------------------- //! To generate an unique type name for the class (used into persistent functionality) virtual @@ -122,9 +143,6 @@ namespace VISU SALOMEDS::SObject_var GetSObject(); - const std::string& - GetMeshName() const; - //---------------------------------------------------------------------------- //! To update is internal state virtual @@ -214,6 +232,10 @@ namespace VISU //---------------------------------------------------------------------------- protected: + virtual + bool + SetInput(); + void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL); @@ -227,17 +249,18 @@ namespace VISU void CheckDataSet(); + protected: + Result_i *myResult; + std::string myMeshName; + bool myAddToStudy; CORBA::Float myOffset[3]; - Result_i *myResult; VISU_PipeLine *myPipeLine; SALOMEDS::SObject_var mySObject; - std::string myMeshName; boost::signal0 myUpdateActorsSignal; boost::signal0 myRemoveActorsFromRendererSignal; vtkSmartPointer myActorCollection; - }; //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index 3a1126ca..e47dc9ee 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -25,29 +25,78 @@ // Module : VISU #include "VISU_PrsObject_i.hh" -using namespace VISU; -using namespace std; #ifdef _DEBUG_ -static int MYDEBUG = 1; -static int MYDEBUGWITHFILES = 0; +static int MYDEBUG = 0; #else static int MYDEBUG = 0; -static int MYDEBUGWITHFILES = 0; #endif -void VISU::PrsObject_i::SetName( const char* theName ) +//--------------------------------------------------------------- +VISU::PrsObject_i +::PrsObject_i(SALOMEDS::Study_ptr theStudy): + myStudy(SALOMEDS::Study::_duplicate(theStudy)) +{ + if(MYDEBUG) MESSAGE("PrsObject_i::PrsObject_i - this = "<FindOrCreateAttribute( aSObject, "AttributeName" ); SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); aNameAttr->SetValue( theName ); } } -QString VISU::PrsObject_i::GetEntry() { + + +//--------------------------------------------------------------- +const char* +VISU::PrsObject_i +::GetName() const +{ + return myName.c_str(); +} + + +//--------------------------------------------------------------- +const SALOMEDS::Study_var& +VISU::PrsObject_i +::GetStudyDocument() const +{ + return myStudy; +} + + +//--------------------------------------------------------------- +void +VISU::PrsObject_i +::SetStudyDocument(SALOMEDS::Study_ptr theStudy) +{ + myStudy = SALOMEDS::Study::_duplicate(theStudy); +} + + +//--------------------------------------------------------------- +QString +VISU::PrsObject_i +::GetEntry() +{ CORBA::String_var anIOR = GetID(); SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in()); CORBA::String_var anEntry; diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index 31e7f714..cae05117 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -29,24 +29,38 @@ #include "VISUConfig.hh" -namespace VISU{ +namespace VISU +{ class PrsObject_i : public virtual POA_VISU::PrsObject, public virtual RemovableObject_i { PrsObject_i(const PrsObject_i&); + SALOMEDS::Study_var myStudy; public: - PrsObject_i(SALOMEDS::Study_ptr theStudy) : myStudy(SALOMEDS::Study::_duplicate(theStudy)) {}; - virtual ~PrsObject_i() {} + PrsObject_i(SALOMEDS::Study_ptr theStudy = SALOMEDS::Study::_nil()); + + virtual + ~PrsObject_i(); protected: + void + SetStudyDocument(SALOMEDS::Study_ptr theStudy); + std::string myName; - SALOMEDS::Study_var myStudy; public: - virtual const char* GetName() const { return myName.c_str();} - virtual void SetName( const char* theName ); - const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;} + virtual + const char* + GetName() const; + + virtual + void + SetName(const char* theName); + + const SALOMEDS::Study_var& + GetStudyDocument() const; + QString GetEntry(); }; } diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index d2c7a7d3..27a73866 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -48,18 +48,37 @@ static int MYDEBUG = 0; static int INCMEMORY = 4+12; -int VISU::ScalarMapOnDeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::ScalarMapOnDeformedShape_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { bool aResult = false; try{ - aResult = VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false); + aResult = VISU::ScalarMap_i::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + false); if(isMemoryCheck && aResult){ - const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName); + VISU::Result_i::TInput* anInput = theResult->GetInput(); + const VISU::PField aField = anInput->GetField(theMeshName, + (VISU::TEntity)theEntity, + theFieldName); if(aField->myNbComp <= 1) return false; - float aSize = INCMEMORY* - theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration); + float aSize = anInput->GetTimeStampSize(theMeshName, + (VISU::TEntity)theEntity, + theFieldName, + theTimeStampNumber); + aSize *= INCMEMORY; aResult = VISU_PipeLine::CheckAvailableMemory(aSize); MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<GetStudyDocument()), +//--------------------------------------------------------------- +const char* +VISU::ScalarMapOnDeformedShape_i +::GetComment() const +{ + return myComment.c_str(); +} + +//--------------------------------------------------------------- +VISU::ScalarMapOnDeformedShape_i +::ScalarMapOnDeformedShape_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) -{ -} +{} -VISU::ScalarMapOnDeformedShape_i:: -ScalarMapOnDeformedShape_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::ScalarMapOnDeformedShape_i +::ScalarMapOnDeformedShape_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject): + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) -{ -} +{} -VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//--------------------------------------------------------------- +VISU::Storable* +VISU::ScalarMapOnDeformedShape_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Create:"<<__LINE__<GetScalarIteration(); string theScalarMeshName = this->GetScalarMeshName(); string theScalarFieldName = this->GetScalarFieldName(); - if(MYDEBUG) cout << "SameAs:"<(theOrigin)){ ScalarMapOnDeformedShape_i* anOrigin = const_cast(aPrs3d); - + this->SetScalarField(anOrigin->GetScalarMeshName().c_str(), anOrigin->GetScalarFieldName().c_str(), theScalarIter, @@ -186,34 +233,63 @@ VISU::ScalarMapOnDeformedShape_i } } -void VISU::ScalarMapOnDeformedShape_i::SetScale(CORBA::Double theScale) { + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetScale(CORBA::Double theScale) +{ myScalarMapOnDeformedShapePL->SetScale(theScale); } -CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetScale(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetScale() +{ return myScalarMapOnDeformedShapePL->GetScale(); } -void VISU::ScalarMapOnDeformedShape_i::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange){ + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange) +{ vtkFloatingPointType aRange[2]; aRange[0] = vtkFloatingPointType(theMinRange); aRange[1] = vtkFloatingPointType(theMaxRange); myScalarMapOnDeformedShapePL->SetScalarRange(aRange); } -CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMin(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetSourceRangeMin() +{ vtkFloatingPointType aRange[2]; myScalarMapOnDeformedShapePL->GetSourceRange(aRange); return aRange[0]; } -CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMax(){ + +//--------------------------------------------------------------- +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetSourceRangeMax() +{ vtkFloatingPointType aRange[2]; myScalarMapOnDeformedShapePL->GetSourceRange(aRange); return aRange[1]; } -void VISU::ScalarMapOnDeformedShape_i::DoHook() + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::CreatePipeLine() { if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::DoHook:"<<__LINE__<(myPipeLine); myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); - TSuperClass::DoHook(); + TSuperClass::CreatePipeLine(); +} + + +//--------------------------------------------------------------- +bool +VISU::ScalarMapOnDeformedShape_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } -VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) + +//--------------------------------------------------------------- +VISU_Actor* +VISU::ScalarMapOnDeformedShape_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::CreateActor:"<<__LINE__<integerValue("VISU", "scalar_def_represent", 2); @@ -240,8 +328,11 @@ VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_In } -void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) { - if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::UpdateActor:"<<__LINE__<(theActor)){ if(IsColored()){ anActor->SetBarVisibility(true); @@ -255,14 +346,15 @@ void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) { } } -void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName, - const char* theFieldName, - int theIteration, - VISU::TEntity theEntity) + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetScalarField(const char* theMeshName, + const char* theFieldName, + int theIteration, + VISU::TEntity theEntity) { - if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SetScalarField:"<<__LINE__<GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy) {} +//---------------------------------------------------------------------------- VISU::ScalarMap_i:: ScalarMap_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject) {} +//---------------------------------------------------------------------------- VISU::ScalarMap_i ::~ScalarMap_i() {} @@ -175,6 +182,7 @@ VISU::ScalarMap_i return this; } +//---------------------------------------------------------------------------- VISU::Storable* VISU::ScalarMap_i ::Restore(const Storable::TRestoringMap& theMap) @@ -192,6 +200,7 @@ VISU::ScalarMap_i return this; } +//---------------------------------------------------------------------------- void VISU::ScalarMap_i ::ToStream(std::ostringstream& theStr) @@ -213,6 +222,7 @@ VISU::ScalarMap_i TSuperClass::SetBarOrientation(theOrientation); } +//---------------------------------------------------------------------------- VISU::ScalarMap::Orientation VISU::ScalarMap_i ::GetBarOrientation() @@ -220,6 +230,7 @@ VISU::ScalarMap_i return TSuperClass::GetBarOrientation(); } +//---------------------------------------------------------------------------- VISU::Scaling VISU::ScalarMap_i ::GetScaling() @@ -227,6 +238,7 @@ VISU::ScalarMap_i return VISU::Scaling(myScalarMapPL->GetScaling()); } +//---------------------------------------------------------------------------- void VISU::ScalarMap_i ::SetScaling(VISU::Scaling theScaling) @@ -234,6 +246,7 @@ VISU::ScalarMap_i myScalarMapPL->SetScaling(theScaling); } +//---------------------------------------------------------------------------- void VISU::ScalarMap_i ::SetRange(CORBA::Double theMin, CORBA::Double theMax) @@ -249,18 +262,18 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- void VISU::ScalarMap_i -::DoSetInput(Result_i* theResult) +::DoSetInput() { - VISU::Result_i::TInput* anInput = theResult->GetInput(); + VISU::Result_i::TInput* anInput = myResult->GetInput(); if(!anInput) - throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); + throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); - myField = anInput->GetField(myMeshName,myEntity,myFieldName); + myField = anInput->GetField(GetMeshName(),GetTEntity(),GetFieldName()); if(!myField) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PIDMapper anIDMapper = - anInput->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration); + anInput->GetTimeStampOnMesh(GetMeshName(),GetTEntity(),GetFieldName(),GetTimeStampNumber()); if(!anIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); @@ -270,11 +283,13 @@ VISU::ScalarMap_i myScalarMapPL->Build(); } -void + +//---------------------------------------------------------------------------- +bool VISU::ScalarMap_i -::Update() +::CheckIsPossible() { - TSuperClass::Update(); + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } @@ -286,6 +301,7 @@ VISU::ScalarMap_i myScalarMapPL->SetMapScale(theMapScale); } +//---------------------------------------------------------------------------- bool VISU::ScalarMap_i ::IsRangeFixed() @@ -293,6 +309,7 @@ VISU::ScalarMap_i return myIsFixedRange; } +//---------------------------------------------------------------------------- void VISU::ScalarMap_i ::SetSourceRange() @@ -325,6 +342,7 @@ VISU::ScalarMap_i return anActor; } +//---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) @@ -332,6 +350,7 @@ VISU::ScalarMap_i return CreateActor(theIO, false); } +//---------------------------------------------------------------------------- void VISU::ScalarMap_i ::UpdateActor(VISU_Actor* theActor) diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index ef29f65f..8f507dca 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -84,25 +84,37 @@ namespace VISU typedef VISU::ScalarMap TInterface; protected: + //! Redefines VISU_ColoredPrs3d_i::DoSetInput virtual void - DoSetInput(Result_i* theResult); + DoSetInput(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); public: + /*! + Checks staticaly, whether it is possible to create presentation + with the given basic parameters or not. + */ static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - int theIteration, + int theTimeStampNumber, int isMemoryCheck = true); + + //! Redefines VISU_ColoredPrs3d_i::Create virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - int theIteration); + int theTimeStampNumber); virtual void @@ -128,10 +140,6 @@ namespace VISU const std::string& thePrefix, const Storable::TRestoringMap& theMap); - virtual - void - Update() ; - virtual void SetMapScale(double theMapScale = 1.0); @@ -154,7 +162,8 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); + CreateActor(const Handle(SALOME_InteractiveObject)& theIO, + bool toSupressShrinking); virtual void diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 7aa8273b..8bd4ebf1 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -37,24 +37,30 @@ #include #include -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif -int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::StreamLines_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { try{ - if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) + if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,false)) return 0; + VISU::Result_i::TInput* anInput = theResult->GetInput(); VISU::PIDMapper anIDMapper = - theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration); + anInput->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theTimeStampNumber); VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); bool aResult = VISU_StreamLinesPL::IsPossible(aDataSet); MESSAGE("StreamLines_i::IsPossible - aResult = "<GetStudyDocument()), +//--------------------------------------------------------------- +VISU::StreamLines_i +::StreamLines_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) -{ -} +{} -VISU::StreamLines_i:: -StreamLines_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::StreamLines_i +::StreamLines_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject) : + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) -{ -} +{} -void VISU::StreamLines_i::SameAs(const Prs3d_i* theOrigin) +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::SameAs(const Prs3d_i* theOrigin) { TSuperClass::SameAs(theOrigin); @@ -115,14 +138,22 @@ void VISU::StreamLines_i::SameAs(const Prs3d_i* theOrigin) } -VISU::Storable* VISU::StreamLines_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//--------------------------------------------------------------- +VISU::Storable* +VISU::StreamLines_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { - return DeformedShape_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theMap) +//--------------------------------------------------------------- +VISU::Storable* +VISU::StreamLines_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -143,8 +174,12 @@ VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theM } -void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){ - DeformedShape_i::ToStream(theStr); +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myIntegrationStep", GetIntegrationStep()); Storable::DataToStream( theStr, "myPropagationTime", GetPropagationTime()); @@ -157,20 +192,25 @@ void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){ } -VISU::StreamLines_i::~StreamLines_i(){ +//--------------------------------------------------------------- +VISU::StreamLines_i +::~StreamLines_i() +{ if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()"); myAppendFilter->UnRegisterAllOutputs(); myAppendFilter->Delete(); } +//--------------------------------------------------------------- CORBA::Boolean -VISU::StreamLines_i::SetParams(CORBA::Double theIntStep, - CORBA::Double thePropogationTime, - CORBA::Double theStepLength, - VISU::Prs3d_ptr thePrs3d, - CORBA::Double thePercents, - VISU::StreamLines::Direction theDirection) +VISU::StreamLines_i +::SetParams(CORBA::Double theIntStep, + CORBA::Double thePropogationTime, + CORBA::Double theStepLength, + VISU::Prs3d_ptr thePrs3d, + CORBA::Double thePercents, + VISU::StreamLines::Direction theDirection) { VISU::Prs3d_i* aPrs3di = NULL; vtkPointSet* aSource = NULL; @@ -193,13 +233,22 @@ VISU::StreamLines_i::SetParams(CORBA::Double theIntStep, } -void VISU::StreamLines_i::SetSource(VISU::Prs3d_ptr thePrs3d){ +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::SetSource(VISU::Prs3d_ptr thePrs3d) +{ if(!thePrs3d->_is_nil()){ VISU::Prs3d_i* aPrs3di = dynamic_cast(VISU::GetServant(thePrs3d).in()); SetSource(aPrs3di); } } -void VISU::StreamLines_i::SetSource(VISU::Prs3d_i* thePrs3d){ + +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::SetSource(VISU::Prs3d_i* thePrs3d) +{ mySourceEntry = ""; if(thePrs3d){ SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject(); @@ -207,7 +256,12 @@ void VISU::StreamLines_i::SetSource(VISU::Prs3d_i* thePrs3d){ mySourceEntry = aString.in(); } } -void VISU::StreamLines_i::SetSource(){ + +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::SetSource() +{ if(!myStreamLinesPL->GetSource() && mySourceEntry == "") return; if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) return; VISU::Prs3d_var aPrs3d = GetSource(); @@ -220,58 +274,101 @@ void VISU::StreamLines_i::SetSource(){ } -CORBA::Double VISU::StreamLines_i::GetIntegrationStep() { +//--------------------------------------------------------------- +CORBA::Double +VISU::StreamLines_i +::GetIntegrationStep() +{ return myStreamLinesPL->GetIntegrationStep(); } -CORBA::Double VISU::StreamLines_i::GetPropagationTime() { +//--------------------------------------------------------------- +CORBA::Double +VISU::StreamLines_i +::GetPropagationTime() +{ return myStreamLinesPL->GetPropagationTime(); } -CORBA::Double VISU::StreamLines_i::GetStepLength() { +//--------------------------------------------------------------- +CORBA::Double +VISU::StreamLines_i +::GetStepLength() +{ return myStreamLinesPL->GetStepLength(); } -VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() { +//--------------------------------------------------------------- +VISU::StreamLines::Direction +VISU::StreamLines_i +::GetDirection() +{ return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection()); } -VISU::Prs3d_ptr VISU::StreamLines_i::GetSource(){ +//--------------------------------------------------------------- +VISU::Prs3d_ptr +VISU::StreamLines_i +::GetSource() +{ VISU::Prs3d_var aPrs3d; if(MYDEBUG) MESSAGE("StreamLines_i::GetSource() mySourceEntry = '"<FindObjectID(mySourceEntry.c_str()); + SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(mySourceEntry.c_str()); CORBA::Object_var anObj = SObjectToObject(aSObject); if(!CORBA::is_nil(anObj)) aPrs3d = VISU::Prs3d::_narrow(anObj); } return aPrs3d._retn(); } -CORBA::Double VISU::StreamLines_i::GetUsedPoints() { +//--------------------------------------------------------------- +CORBA::Double +VISU::StreamLines_i +::GetUsedPoints() +{ return myStreamLinesPL->GetUsedPoints(); } -void VISU::StreamLines_i::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New(); +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::CreatePipeLine() +{ + if(!myPipeLine) + myPipeLine = VISU_StreamLinesPL::New(); myStreamLinesPL = dynamic_cast(myPipeLine); - DeformedShape_i::DoHook(); + TSuperClass::CreatePipeLine(); +} + + +//---------------------------------------------------------------------------- +bool +VISU::StreamLines_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); } -void VISU::StreamLines_i::Update() { +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::Update() +{ SetSource(); - VISU::DeformedShape_i::Update(); + TSuperClass::Update(); } +//--------------------------------------------------------------- VISU_Actor* VISU::StreamLines_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO, true)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "stream_lines_represent", 1); @@ -282,6 +379,10 @@ VISU::StreamLines_i } -void VISU::StreamLines_i::UpdateActor(VISU_Actor* theActor) { - VISU::DeformedShape_i::UpdateActor(theActor); +//--------------------------------------------------------------- +void +VISU::StreamLines_i +::UpdateActor(VISU_Actor* theActor) +{ + TSuperClass::UpdateActor(theActor); } diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 9c4af6fe..db99dd99 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -32,7 +32,8 @@ class VISU_StreamLinesPL; class vtkAppendFilter; -namespace VISU{ +namespace VISU +{ class StreamLines_i : public virtual POA_VISU::StreamLines, public virtual DeformedShape_i { @@ -49,60 +50,148 @@ namespace VISU{ explicit StreamLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Prs3d_i* theOriginal); - virtual ~StreamLines_i(); - - virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;} - - virtual CORBA::Boolean SetParams(CORBA::Double theIntStep, - CORBA::Double thePropogationTime, - CORBA::Double theStepLength, - VISU::Prs3d_ptr thePrs3d, - CORBA::Double thePercents, - VISU::StreamLines::Direction theDirection); - virtual CORBA::Double GetIntegrationStep(); - virtual CORBA::Double GetPropagationTime(); - virtual CORBA::Double GetStepLength(); - virtual CORBA::Double GetUsedPoints(); - virtual VISU::Prs3d_ptr GetSource(); - virtual VISU::StreamLines::Direction GetDirection(); + + virtual + void + SameAs(const Prs3d_i* theOriginal); + + virtual + ~StreamLines_i(); + + virtual + VISU::VISUType GetType() + { + return VISU::TSTREAMLINES; + } + + virtual + CORBA::Boolean + SetParams(CORBA::Double theIntStep, + CORBA::Double thePropogationTime, + CORBA::Double theStepLength, + VISU::Prs3d_ptr thePrs3d, + CORBA::Double thePercents, + VISU::StreamLines::Direction theDirection); + + virtual + CORBA::Double + GetIntegrationStep(); + + virtual + CORBA::Double + GetPropagationTime(); + + virtual + CORBA::Double + GetStepLength(); + + virtual + CORBA::Double + GetUsedPoints(); + + virtual + VISU::Prs3d_ptr + GetSource(); + + virtual + VISU::StreamLines::Direction + GetDirection(); typedef VISU::StreamLines TInterface; - VISU_StreamLinesPL* GetStreamLinesPL(){ return myStreamLinesPL;} + VISU_StreamLinesPL* + GetSpecificPL() const + { + return myStreamLinesPL; + } + protected: - virtual void DoHook(); - virtual void SetSource(VISU::Prs3d_ptr thePrs3d); - virtual void SetSource(VISU::Prs3d_i* thePrs3d); - virtual void SetSource(); + //! Extends VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Extends VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); + + virtual + void + SetSource(VISU::Prs3d_ptr thePrs3d); + + virtual + void + SetSource(VISU::Prs3d_i* thePrs3d); + + virtual + void + SetSource(); VISU_StreamLinesPL* myStreamLinesPL; vtkAppendFilter* myAppendFilter; std::string mySourceEntry; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); - - virtual void ToStream(std::ostringstream& theStr); + //! Extends VISU_ColoredPrs3d_i::IsPossible + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + //! Extends VISU_ColoredPrs3d_i::Create + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); + + //! Extends VISU_ColoredPrs3d_i::ToStream + virtual + void + ToStream(std::ostringstream& theStr); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + const char* + GetComment() const; - virtual void Update(); + virtual + QString + GenerateName(); + //! Extends VISU_ColoredPrs3d_i::Restore + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + //! Extends VISU_ColoredPrs3d_i::Update + virtual + void + Update(); + + //! Extends VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - virtual void UpdateActor(VISU_Actor* theActor); - - virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); } + //! Extends VISU_ColoredPrs3d_i::UpdateActor + virtual + void + UpdateActor(VISU_Actor* theActor); + + virtual + QString + GetSourceEntry() + { + return QString(mySourceEntry.c_str()); + } }; } diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index cb642126..309cfbae 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -90,7 +90,7 @@ VISU::Table_i::~Table_i() CORBA::Long VISU::Table_i::GetNbRows() { SALOMEDS::SObject_var SO = mySObj; - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); if ( !SO->_is_nil() ) { SALOMEDS::GenericAttribute_var anAttr; if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { @@ -110,7 +110,7 @@ CORBA::Long VISU::Table_i::GetNbRows() CORBA::Long VISU::Table_i::GetNbColumns() { SALOMEDS::SObject_var SO = mySObj; - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); if ( !SO->_is_nil() ) { SALOMEDS::GenericAttribute_var anAttr; if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { @@ -168,11 +168,11 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) if(!aCutLines->_is_nil()) pCutLines = dynamic_cast(GetServant(aCutLines).in()); } - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; // look for component if ( !theRestoring ) { - SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy ); + SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() ); // create SObject and set attributes QString aComment; if(pCutLines) @@ -196,7 +196,7 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) } } - string anEntry = CreateAttributes( myStudy, + string anEntry = CreateAttributes( GetStudyDocument(), SO->GetID(),//SComponent->GetID(), "", GetID(), @@ -205,7 +205,7 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) aComment.latin1(), pCutLines ); // create SObject referenced to real table object - mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID( anEntry.c_str() )); + mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() )); if(pCutLines) { pCutLines->BuildTableOfReal(mySObj); } @@ -254,7 +254,7 @@ VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject, const char* VISU::Table_i::GetTableTitle() { SALOMEDS::SObject_var SO = mySObj; - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -371,11 +371,11 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring ) if ( myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) { if ( !theRestoring ) { // look for component - SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy ); + SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() ); // create SObject and set attributes QString aComment; aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE); - string anEntry = CreateAttributes( myStudy, + string anEntry = CreateAttributes( GetStudyDocument(), myTable->GetObjectEntry(), "", GetID(), @@ -384,7 +384,7 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring ) aComment.latin1(), true ); // create SObject referenced to real table object - mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str())); + mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str())); } return this; } @@ -398,8 +398,8 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring ) CORBA::Boolean VISU::Curve_i::IsValid() { // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -426,8 +426,8 @@ string VISU::Curve_i::GetHorTitle() { string title; // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -456,8 +456,8 @@ string VISU::Curve_i::GetVerTitle() { string title; // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -484,8 +484,8 @@ string VISU::Curve_i::GetHorUnits() { string units; // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -512,8 +512,8 @@ string VISU::Curve_i::GetVerUnits() { string units; // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -540,8 +540,8 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringLis { theHorList = 0; theVerList = 0; // getting table SObject by it's entry - SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry()); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry()); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; @@ -790,19 +790,19 @@ VISU::Container_i::~Container_i() */ void VISU::Container_i::AddCurve( Curve_ptr theCurve ) { - if ( myStudy->_is_nil() ) + if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); if ( mySO->_is_nil() ) return; PortableServer::POA_ptr aPOA = GetPOA(); Curve_i* pCurve = dynamic_cast( aPOA->reference_to_servant( theCurve ) ); if( pCurve ) { QString entry = pCurve->GetEntry(); - SALOMEDS::SObject_var SO = myStudy->FindObjectID( entry.latin1() ); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( entry.latin1() ); if ( !SO->_is_nil() && myCurves.find( entry ) == myCurves.end() ) { myCurves.append( entry ); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::SObject_var newSO = Builder->NewObject( mySO ); Builder->Addreference( newSO, SO ); } @@ -813,9 +813,9 @@ void VISU::Container_i::AddCurve( Curve_ptr theCurve ) */ void VISU::Container_i::RemoveCurve( Curve_ptr theCurve ) { - if ( myStudy->_is_nil() ) + if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); if ( mySO->_is_nil() ) return; PortableServer::POA_ptr aPOA = GetPOA(); @@ -825,8 +825,8 @@ void VISU::Container_i::RemoveCurve( Curve_ptr theCurve ) if ( myCurves.find( entry ) != myCurves.end() ) { // found !!! myCurves.remove( entry ); - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); - SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO ); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO ); for ( ; CI->More(); CI->Next() ) { SALOMEDS::SObject_var childSO = CI->Value(); SALOMEDS::SObject_var refSO; @@ -850,19 +850,19 @@ CORBA::Long VISU::Container_i::GetNbCurves() */ void VISU::Container_i::Clear() { - if ( myStudy->_is_nil() ) + if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); if ( mySO->_is_nil() ) return; QStringList toDelete; - SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO ); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO ); for ( ; CI->More(); CI->Next() ) { toDelete.append( CI->Value()->GetID() ); } - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); for ( int i = 0; i < toDelete.count(); i++ ) { - SALOMEDS::SObject_var SO = myStudy->FindObjectID( toDelete[i].latin1() ); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( toDelete[i].latin1() ); Builder->RemoveObject( SO ); } myCurves.clear(); @@ -884,11 +884,11 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring ) { if ( !theRestoring ) { // looking for component - SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy ); + SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() ); // create SObject and set attributes QString aComment; aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER); - string anEntry = CreateAttributes( myStudy, + string anEntry = CreateAttributes( GetStudyDocument(), SComponent->GetID(), "", GetID(), @@ -896,7 +896,7 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring ) "", aComment.latin1(), true ); - mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str())); + mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str())); } return this; } @@ -905,19 +905,19 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring ) */ void VISU::Container_i::Update() { - if ( myStudy->_is_nil() ) + if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); - SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() ); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); SALOMEDS::GenericAttribute_var anAttr; if ( !mySO->_is_nil() ) { QStringList toDelete; int i; for ( i = 0; i < myCurves.count(); i++ ) { - SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[i].latin1() ); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( myCurves[i].latin1() ); if ( !SO->_is_nil() && Builder->FindAttribute( SO, anAttr, "AttributeIOR" ) ) { // if real Curve Object still exists - SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO ); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO ); bool bFound = false; for ( ; CI->More(); CI->Next() ) { SALOMEDS::SObject_var childSO = CI->Value(); @@ -941,7 +941,7 @@ void VISU::Container_i::Update() myCurves.remove( toDelete[i] ); } toDelete.clear(); - SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO ); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO ); for ( ; CI->More(); CI->Next() ) { SALOMEDS::SObject_var childSO = CI->Value(); SALOMEDS::SObject_var refSO; @@ -951,7 +951,7 @@ void VISU::Container_i::Update() } } for ( i = 0; i < toDelete.count(); i++ ) { - SALOMEDS::ChildIterator_var CI = myStudy->NewChildIterator( mySO ); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( mySO ); for ( ; CI->More(); CI->Next() ) { SALOMEDS::SObject_var childSO = CI->Value(); if ( toDelete[i] == CI->Value()->GetID() ) { @@ -968,9 +968,9 @@ void VISU::Container_i::Update() VISU::Curve_i* VISU::Container_i::GetCurve( CORBA::Long theIndex ) { if ( theIndex > 0 && theIndex <= myCurves.count() ) { - SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::SObject_var SO = myStudy->FindObjectID( myCurves[ theIndex-1 ].latin1() ); + SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID( myCurves[ theIndex-1 ].latin1() ); CORBA::Object_var anObject = VISU::SObjectToObject( SO ); if( !CORBA::is_nil( anObject ) ) { // if real Curve Object exists diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index c8bd8a59..d7e6fedd 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -35,9 +35,6 @@ #include -using namespace VISU; -using namespace std; - #ifdef _DEBUG_ static int MYDEBUG = 0; #else @@ -46,15 +43,32 @@ static int MYDEBUG = 0; static int INCMEMORY = 4+12; -int VISU::Vectors_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//--------------------------------------------------------------- +int +VISU::Vectors_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck) { bool aResult = false; try{ - aResult = DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false); + aResult = TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + false); if(isMemoryCheck && aResult){ - float aSize = INCMEMORY* - theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration); + VISU::Result_i::TInput* anInput = theResult->GetInput(); + float aSize = anInput->GetTimeStampSize(theMeshName, + (VISU::TEntity)theEntity, + theFieldName, + theTimeStampNumber); + aSize *= INCMEMORY; aResult = VISU_PipeLine::CheckAvailableMemory(aSize); MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<GetStudyDocument()), +//--------------------------------------------------------------- +VISU::Vectors_i +::Vectors_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myVectorsPL(NULL) -{ -} +{} -VISU::Vectors_i:: -Vectors_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), +//--------------------------------------------------------------- +VISU::Vectors_i +::Vectors_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject) : + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myVectorsPL(NULL) -{ -} +{} -void VISU::Vectors_i::SameAs(const VISU::Prs3d_i* theOrigin) +//--------------------------------------------------------------- +void +VISU::Vectors_i +::SameAs(const VISU::Prs3d_i* theOrigin) { TSuperClass::SameAs(theOrigin); @@ -112,15 +143,23 @@ void VISU::Vectors_i::SameAs(const VISU::Prs3d_i* theOrigin) } -VISU::Storable* VISU::Vectors_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +//--------------------------------------------------------------- +VISU::Storable* +VISU::Vectors_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber) { myLineWidth = 1.0; - return DeformedShape_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } -VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap) +//--------------------------------------------------------------- +VISU::Storable* +VISU::Vectors_i +::Restore(const Storable::TRestoringMap& theMap) { TSuperClass::Restore(theMap); @@ -132,8 +171,12 @@ VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap) } -void VISU::Vectors_i::ToStream(std::ostringstream& theStr){ - DeformedShape_i::ToStream(theStr); +//--------------------------------------------------------------- +void +VISU::Vectors_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myTypeGlyph", int(GetGlyphType())); Storable::DataToStream( theStr, "myPosGlyph", int(GetGlyphPos())); @@ -141,44 +184,82 @@ void VISU::Vectors_i::ToStream(std::ostringstream& theStr){ } -VISU::Vectors_i::~Vectors_i(){ +//--------------------------------------------------------------- +VISU::Vectors_i +::~Vectors_i() +{ if(MYDEBUG) MESSAGE("Vectors_i::~Vectors_i()"); } -void VISU::Vectors_i::SetLineWidth(CORBA::Double theWidth) { +//--------------------------------------------------------------- +void +VISU::Vectors_i +::SetLineWidth(CORBA::Double theWidth) +{ myLineWidth = theWidth; } -CORBA::Double VISU::Vectors_i::GetLineWidth() { + +//--------------------------------------------------------------- +CORBA::Double +VISU::Vectors_i +::GetLineWidth() +{ return myLineWidth; } -void VISU::Vectors_i::SetGlyphType(VISU::Vectors::GlyphType theType) { +//--------------------------------------------------------------- +void +VISU::Vectors_i +::SetGlyphType(VISU::Vectors::GlyphType theType) +{ myVectorsPL->SetGlyphType(VISU_VectorsPL::GlyphType(theType)); } -VISU::Vectors::GlyphType VISU::Vectors_i::GetGlyphType() { + +//--------------------------------------------------------------- +VISU::Vectors::GlyphType +VISU::Vectors_i +::GetGlyphType() +{ return VISU::Vectors::GlyphType(myVectorsPL->GetGlyphType()); } -void VISU::Vectors_i::SetGlyphPos(VISU::Vectors::GlyphPos thePos) { +//--------------------------------------------------------------- +void +VISU::Vectors_i +::SetGlyphPos(VISU::Vectors::GlyphPos thePos) +{ myVectorsPL->SetGlyphPos(VISU_VectorsPL::GlyphPos(thePos)); } -VISU::Vectors::GlyphPos VISU::Vectors_i::GetGlyphPos() { + +//--------------------------------------------------------------- +VISU::Vectors::GlyphPos +VISU::Vectors_i::GetGlyphPos() +{ return VISU::Vectors::GlyphPos(myVectorsPL->GetGlyphPos()); } -void VISU::Vectors_i::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_VectorsPL::New(); +//--------------------------------------------------------------- +void +VISU::Vectors_i +::CreatePipeLine() +{ + if(!myPipeLine) + myPipeLine = VISU_VectorsPL::New(); myVectorsPL = dynamic_cast(myPipeLine); - DeformedShape_i::DoHook(); + TSuperClass::CreatePipeLine(); } -VISU_PipeLine* VISU::Vectors_i::GetPipeLine(){ +//--------------------------------------------------------------- +VISU_PipeLine* +VISU::Vectors_i +::GetPipeLine() +{ VISU_PipeLine* aPipeLine = VISU_VectorsPL::New(); aPipeLine->SetIDMapper(myPipeLine->GetIDMapper()); aPipeLine->ShallowCopy(myPipeLine); @@ -187,7 +268,18 @@ VISU_PipeLine* VISU::Vectors_i::GetPipeLine(){ } -VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +//--------------------------------------------------------------- +bool +VISU::Vectors_i +::CheckIsPossible() +{ + return IsPossible(GetResult(),GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber()); +} + +//--------------------------------------------------------------- +VISU_Actor* +VISU::Vectors_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { VISU_VectorsAct* anActor = VISU_VectorsAct::New(); try{ @@ -210,9 +302,13 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& } -void VISU::Vectors_i::UpdateActor(VISU_Actor* theActor) { +//--------------------------------------------------------------- +void +VISU::Vectors_i +::UpdateActor(VISU_Actor* theActor) +{ if(VISU_VectorsAct* anActor = dynamic_cast(theActor)){ - VISU::DeformedShape_i::UpdateActor(anActor); + TSuperClass::UpdateActor(anActor); anActor->GetProperty()->SetLineWidth(GetLineWidth()); if(VISU_VectorsPL* aVectorsPL = dynamic_cast(anActor->GetPipeLine())){ aVectorsPL->ShallowCopy(myPipeLine); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 9177228d..901e6032 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -31,7 +31,8 @@ class VISU_VectorsPL; -namespace VISU{ +namespace VISU +{ class Vectors_i : public virtual POA_VISU::Vectors, public virtual DeformedShape_i { @@ -48,49 +49,120 @@ namespace VISU{ explicit Vectors_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Prs3d_i* theOrigin); - virtual ~Vectors_i(); - virtual VISU::VISUType GetType() { return VISU::TVECTORS;}; + virtual + void + SameAs(const Prs3d_i* theOrigin); + + virtual + ~Vectors_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TVECTORS; + } + + virtual + void + SetLineWidth(CORBA::Double theWidth); + + virtual + CORBA::Double + GetLineWidth(); - virtual void SetLineWidth(CORBA::Double theWidth); - virtual CORBA::Double GetLineWidth(); + virtual + void + SetGlyphType(VISU::Vectors::GlyphType theType); - virtual void SetGlyphType(VISU::Vectors::GlyphType theType); - virtual VISU::Vectors::GlyphType GetGlyphType(); + virtual + VISU::Vectors::GlyphType + GetGlyphType(); + + virtual + void + SetGlyphPos(VISU::Vectors::GlyphPos thePos); - virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos); - virtual VISU::Vectors::GlyphPos GetGlyphPos(); + virtual + VISU::Vectors::GlyphPos + GetGlyphPos(); typedef VISU::Vectors TInterface; - VISU_VectorsPL* GetVectorsPL(){ return myVectorsPL;} + VISU_VectorsPL* + GetSpecificPL() const + { + return myVectorsPL; + } + protected: - virtual void DoHook(); - virtual VISU_PipeLine* GetPipeLine(); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); + + virtual + VISU_PipeLine* + GetPipeLine(); VISU_VectorsPL *myVectorsPL; float myLineWidth; public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); + //! Redefines VISU_ColoredPrs3d_i::IsPossible + static + int IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber, + int isMemoryCheck = true); + + //! Redefines VISU_ColoredPrs3d_i::Create + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theTimeStampNumber); - virtual void ToStream(std::ostringstream& theStr); + //! Redefines VISU_ColoredPrs3d_i::ToStream + virtual + void + ToStream(std::ostringstream& theStr); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + //! Redefines VISU_ColoredPrs3d_i::Restore + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); + //! Redefines VISU_ColoredPrs3d_i::GetComment + virtual + const char* + GetComment() const; + + //! Redefines VISU_ColoredPrs3d_i::GenerateName + virtual + QString + GenerateName(); + + //! Redefines VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - virtual void UpdateActor(VISU_Actor* theActor) ; + //! Redefines VISU_ColoredPrs3d_i::UpdateActor + virtual + void + UpdateActor(VISU_Actor* theActor) ; }; } diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index abb6ad9b..df7bbd6f 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1557,18 +1557,18 @@ namespace VISU { { class TEvent: public SALOME_Event { - SUIT_ViewWindow* myVW; + SUIT_ViewWindow* myViewWindow; public: TEvent(SUIT_ViewWindow* theViewWindow): - myVW(theViewWindow) + myViewWindow(theViewWindow) {} virtual void Execute() { - SVTK_ViewWindow* vf = dynamic_cast(myVW); - vtkRenderer* Renderer = vf->getRenderer(); - vtkActorCollection* theActors = Renderer->GetActors(); - theActors->InitTraversal(); - while (vtkActor *anAct = theActors->GetNextActor()) { + SVTK_ViewWindow* aViewWindow = dynamic_cast(myViewWindow); + vtkRenderer* aRenderer = aViewWindow->getRenderer(); + vtkActorCollection* anActors = aRenderer->GetActors(); + anActors->InitTraversal(); + while (vtkActor *anAct = anActors->GetNextActor()) { if (VISU_Actor* anActor = dynamic_cast(anAct)) { VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d(); if (anActor->GetVisibility() && aPrs3d) { @@ -1577,13 +1577,12 @@ namespace VISU { } } } - RepaintView(myVW); + RepaintView(myViewWindow); } }; - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - ProcessVoidEvent(new TEvent(aVW)); + if (SUIT_ViewWindow* aViewWindow = GetViewWindow()) + ProcessVoidEvent(new TEvent(aViewWindow)); } bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName) diff --git a/src/VISU_SWIG/visu_change_input.py b/src/VISU_SWIG/visu_change_input.py new file mode 100644 index 00000000..3cda8dde --- /dev/null +++ b/src/VISU_SWIG/visu_change_input.py @@ -0,0 +1,41 @@ +import os +import time +import VISU +import SALOMEDS +from batchmode_visu import * + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be soon destroyed!") + +medFile = "TimeStamps.med" +myFieldName = "vitesse"; + +aMeshName ="dom" +anEntity = VISU.NODE +aTimeStampId = 1 + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +aPrs3d = myVisu.IsoSurfacesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) + +aPrs3d = myVisu.CreatePrs3d(VISU.TISOSURFACE,myVisu.GetCurrentStudy()) +aPrs3d.SetResultObject(myResult) +aPrs3d.SetMeshName(aMeshName) +aPrs3d.SetEntity(anEntity) +aPrs3d.SetFieldName(myFieldName) +aPrs3d.SetTimeStampNumber(aTimeStampId) +print aPrs3d.Apply() + +myView.Display(aPrs3d); +print "myView.Display(aPrs3d)" +myView.FitAll() + +aDelay = 0.0 +for aTimeStampId in xrange(1,100): + aPrs3d.SetTimeStampNumber(aTimeStampId) + print aPrs3d.Apply() + myView.Update(); + time.sleep(aDelay) -- 2.39.2