From e3214b68d298250cb463df645aecb3d2fdd5627a Mon Sep 17 00:00:00 2001 From: prascle Date: Thu, 13 May 2010 08:07:39 +0000 Subject: [PATCH] PR: debug SMDS memimp --- src/OBJECT/SMESH_Object.cxx | 26 +++++++++++ src/OBJECT/SMESH_Object.h | 1 + src/OBJECT/SMESH_ObjectDef.h | 7 ++- src/SMDS/Notes | 13 ++++++ src/SMDS/SMDS_Mesh.cxx | 65 +++++++++++++++----------- src/SMDS/SMDS_MeshElementIDFactory.cxx | 1 + src/SMDS/SMDS_MeshNode.cxx | 3 +- src/SMDS/SMDS_UnstructuredGrid.cxx | 48 ++++++++++++++----- src/SMDS/SMDS_UnstructuredGrid.hxx | 1 + src/SMDS/SMDS_VtkEdge.cxx | 2 + src/SMESHDS/SMESHDS_Mesh.cxx | 52 +++++++++++++++++++-- src/SMESHDS/SMESHDS_SubMesh.cxx | 2 +- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 1 + src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 23 ++++++++- src/SMESHGUI/SMESHGUI_VTKUtils.h | 7 ++- 15 files changed, 203 insertions(+), 49 deletions(-) diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx index ea86d22c5..58715e251 100644 --- a/src/OBJECT/SMESH_Object.cxx +++ b/src/OBJECT/SMESH_Object.cxx @@ -532,12 +532,20 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId, return true; } +vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid() +{ + MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid); + return myGrid; +} + + //================================================================================= // function : IsValid // purpose : Return true if there are some entities //================================================================================= bool SMESH_VisualObjDef::IsValid() const { + MESSAGE("SMESH_VisualObjDef::IsValid"); return GetNbEntities(SMDSAbs_Node) > 0 || GetNbEntities(SMDSAbs_0DElement) > 0 || GetNbEntities(SMDSAbs_Edge) > 0 || @@ -557,6 +565,7 @@ bool SMESH_VisualObjDef::IsValid() const SMESH_MeshObj::SMESH_MeshObj(SMESH::SMESH_Mesh_ptr theMesh): myClient(SalomeApp_Application::orb(),theMesh) { + myEmptyGrid = 0; if ( MYDEBUG ) MESSAGE("SMESH_MeshObj - this = "<_is_nil() = "<_is_nil()); } @@ -578,6 +587,7 @@ SMESH_MeshObj::~SMESH_MeshObj() bool SMESH_MeshObj::Update( int theIsClear ) { // Update SMDS_Mesh on client part + MESSAGE("SMESH_MeshObj::Update"); if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) { buildPrs(); // Fill unstructured grid return true; @@ -585,6 +595,22 @@ bool SMESH_MeshObj::Update( int theIsClear ) return false; } +bool SMESH_MeshObj::NulData() +{ + MESSAGE ("SMESH_MeshObj::NulData() =================================================================================="); + if (!myEmptyGrid) + { + myEmptyGrid = SMDS_UnstructuredGrid::New(); + myEmptyGrid->Initialize(); + myEmptyGrid->Allocate(); + vtkPoints* points = vtkPoints::New(); + points->SetNumberOfPoints(0); + myEmptyGrid->SetPoints( points ); + points->Delete(); + myEmptyGrid->BuildLinks(); + } + myGrid->ShallowCopy(myEmptyGrid); +} //================================================================================= // function : GetElemDimension // purpose : Get dimension of element diff --git a/src/OBJECT/SMESH_Object.h b/src/OBJECT/SMESH_Object.h index 3bc178eca..5dbf6d5ae 100644 --- a/src/OBJECT/SMESH_Object.h +++ b/src/OBJECT/SMESH_Object.h @@ -55,6 +55,7 @@ class SMESHOBJECT_EXPORT SMESH_VisualObj { public: virtual bool Update( int theIsClear = true ) = 0; + virtual bool NulData() = 0; virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0; virtual int GetElemDimension( const int theObjId ) = 0; diff --git a/src/OBJECT/SMESH_ObjectDef.h b/src/OBJECT/SMESH_ObjectDef.h index ac0bd30c1..ab79b9a01 100644 --- a/src/OBJECT/SMESH_ObjectDef.h +++ b/src/OBJECT/SMESH_ObjectDef.h @@ -61,6 +61,7 @@ public: virtual ~SMESH_VisualObjDef(); virtual bool Update( int theIsClear = true ) = 0; + virtual bool NulData() {return 0; }; virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0; virtual int GetElemDimension( const int theObjId ) = 0; @@ -76,7 +77,7 @@ public: int& theNodeId1, int& theNodeId2 ) const; - virtual vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; } + virtual vtkUnstructuredGrid* GetUnstructuredGrid(); // { return myGrid; } virtual vtkIdType GetNodeObjId( int theVTKID ); virtual vtkIdType GetNodeVTKId( int theObjID ); @@ -90,7 +91,7 @@ protected: // void buildNodePrs(); // void buildElemPrs(); -private: +//private: // TMapOfIds mySMDS2VTKNodes; // TMapOfIds myVTK2SMDSNodes; @@ -114,6 +115,7 @@ public: virtual ~SMESH_MeshObj(); virtual bool Update( int theIsClear = true ); + virtual bool NulData(); virtual int GetNbEntities( const SMDSAbs_ElementType) const; virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const; @@ -128,6 +130,7 @@ public: protected: SMESH_Client myClient; + vtkUnstructuredGrid* myEmptyGrid; }; diff --git a/src/SMDS/Notes b/src/SMDS/Notes index a9bc5a37e..38ac69ae1 100644 --- a/src/SMDS/Notes +++ b/src/SMDS/Notes @@ -1,3 +1,16 @@ +Problemes en cours +================== + +- visualisation de groupe (type d'element): on voit tout le maillage, mais le groupe est OK +- inversion d'un volume (tetra): exception +- script de creation de noeuds et d'elements: OK, mais pas compatible avec version precedente (numerotation noeuds differente) +- affichage numeros noeuds: numeros en trop sur O (enlever dans vtkUnstructuredGrid) + +A tester, non pris en compte +============================ +- engine standalone +- polyedres (attendre vtk) + =============================== Hypothese de refonte de l'API de SMDS diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 1f704a681..ed42389f9 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -2255,47 +2255,52 @@ SMDS_Mesh::~SMDS_Mesh() void SMDS_Mesh::Clear() { - if (myParent!=NULL) { + if (myParent!=NULL) + { SMDS_ElemIteratorPtr eIt = elementsIterator(); while ( eIt->more() ) myElementIDFactory->ReleaseID(eIt->next()->GetID()); SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) myNodeIDFactory->ReleaseID(itn->next()->GetID()); - } - else { + } + else + { myNodeIDFactory->Clear(); myElementIDFactory->Clear(); - } + } SMDS_ElemIteratorPtr itv = elementsIterator(); while (itv->more()) - delete itv->next(); + { + SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next()); + SMDSAbs_ElementType aType = elem->GetType(); + switch (aType) + { + case SMDSAbs_0DElement: + delete elem; + break; + case SMDSAbs_Edge: + myEdgePool->destroy(static_cast(elem)); + break; + case SMDSAbs_Face: + myFacePool->destroy(static_cast(elem)); + break; + case SMDSAbs_Volume: + myVolumePool->destroy(static_cast(elem)); + break; + default: + break; + } + } myCells.clear(); -// SMDS_VolumeIteratorPtr itv = volumesIterator(); -// while (itv->more()) -// delete itv->next(); -// myVolumes.Clear(); -// -// SMDS_FaceIteratorPtr itf = facesIterator(); -// while (itf->more()) -// delete itf->next(); -// myFaces.Clear(); -// -// SMDS_EdgeIteratorPtr ite = edgesIterator(); -// while (ite->more()) -// delete ite->next(); -// myEdges.Clear(); -// -// SMDS_0DElementIteratorPtr it0d = elements0dIterator(); -// while (it0d->more()) -// delete it0d->next(); -// my0DElements.Clear(); - SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) - delete itn->next(); + { + SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next()); + myNodePool->destroy(node); + } myNodes.clear(); list::iterator itc=myChildren.begin(); @@ -2303,6 +2308,14 @@ void SMDS_Mesh::Clear() (*itc)->Clear(); myInfo.Clear(); + + myGrid->Initialize(); + myGrid->Allocate(); + vtkPoints* points = vtkPoints::New(); + points->SetNumberOfPoints(SMDS_Mesh::chunkSize); + myGrid->SetPoints( points ); + points->Delete(); + myGrid->BuildLinks(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/SMDS/SMDS_MeshElementIDFactory.cxx b/src/SMDS/SMDS_MeshElementIDFactory.cxx index 412159a38..e33e75ae9 100644 --- a/src/SMDS/SMDS_MeshElementIDFactory.cxx +++ b/src/SMDS/SMDS_MeshElementIDFactory.cxx @@ -128,6 +128,7 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID) void SMDS_MeshElementIDFactory::ReleaseID(const int ID) { int vtkId = myMesh->myIDElements[ID]; + //MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId); myMesh->myIDElements[ID] = -1; myMesh->myVtkIndex[vtkId] = -1; SMDS_MeshIDFactory::ReleaseID(ID); diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index f1c100046..1752046b0 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -51,18 +51,19 @@ SMDS_MeshNode::SMDS_MeshNode() : SMDS_MeshElement(-1, -1, -1), myPosition(SMDS_SpacePosition::originSpacePosition()) { + nbNodes++; } SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y, double z): SMDS_MeshElement(id, meshId, shapeId), myPosition(SMDS_SpacePosition::originSpacePosition()) { + nbNodes++; init(id, meshId, shapeId, x, y ,z); } void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z) { - nbNodes++; myID = id; myMeshId = meshId; myShapeId = shapeId; diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 7fe994f21..143d54334 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -4,6 +4,7 @@ #include "utilities.h" #include +#include #include #include @@ -33,6 +34,12 @@ unsigned long SMDS_UnstructuredGrid::GetMTime() return mtime; } +void SMDS_UnstructuredGrid::Update() +{ + MESSAGE("SMDS_UnstructuredGrid::Update"); + return vtkUnstructuredGrid::Update(); +} + void SMDS_UnstructuredGrid::UpdateInformation() { MESSAGE("SMDS_UnstructuredGrid::UpdateInformation"); @@ -49,9 +56,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n int startBloc = 0; int endBloc = 0; int alreadyCopied = 0; + typedef enum {lookHoleStart, lookHoleEnd, lookBlocEnd} enumState; enumState compactState = lookHoleStart; +// if (this->Links) +// { +// this->Links->UnRegister(this); +// this->Links = 0; +// } + // --- if newNodeSize, create a new compacted vtkPoints vtkPoints *newPoints = 0; @@ -71,6 +85,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n case lookHoleStart: if (idNodesOldToNew[i] < 0) { + MESSAGE("-------------- newNodeSize, startHole " << i << " " << oldNodeSize); startHole = i; compactState = lookHoleEnd; } @@ -78,6 +93,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n case lookHoleEnd: if (idNodesOldToNew[i] >= 0) { + MESSAGE("-------------- newNodeSize, endHole " << i << " " << oldNodeSize); endHole = i; startBloc = i; compactState = lookBlocEnd; @@ -88,7 +104,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n else if (i == (oldNodeSize-1)) endBloc = i+1; if (endBloc) { - MESSAGE("-------------- newNodeSize, endbloc"); + MESSAGE("-------------- newNodeSize, endbloc " << endBloc << " " << oldNodeSize); void *target = newPoints->GetVoidPointer(3*alreadyCopied); void *source = this->Points->GetVoidPointer(3*startBloc); int nbPoints = endBloc - startBloc; @@ -106,7 +122,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n } if (!alreadyCopied) // no hole, but shorter, no need to modify idNodesOldToNew { - MESSAGE("------------- newNodeSize, shorter") + MESSAGE("------------- newNodeSize, shorter " << oldNodeSize) void *target = newPoints->GetVoidPointer(0); void *source = this->Points->GetVoidPointer(0); int nbPoints = newNodeSize; @@ -151,6 +167,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n case lookHoleStart: if (this->Types->GetValue(i) == VTK_EMPTY_CELL) { + MESSAGE(" -------- newCellSize, startHole " << i << " " << oldCellSize); startHole = i; compactState = lookHoleEnd; } @@ -158,6 +175,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n case lookHoleEnd: if (this->Types->GetValue(i) != VTK_EMPTY_CELL) { + MESSAGE(" -------- newCellSize, EndHole " << i << " " << oldCellSize); endHole = i; startBloc = i; compactState = lookBlocEnd; @@ -168,39 +186,45 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n else if (i == (oldCellSize-1)) endBloc = i+1; if (endBloc) { - MESSAGE(" -------- newCellSize, endBloc"); + MESSAGE(" -------- newCellSize, endBloc " << endBloc << " " << oldCellSize); for (int j=startBloc; jSetValue(alreadyCopied, this->Types->GetValue(j)); idCellsOldToNew[j] = alreadyCopied; - int oldLoc = this->Locations->GetValue(j); - int nbpts; - this->Connectivity->GetCell(oldLoc, nbpts, pointsCell); + vtkIdType oldLoc = this->Locations->GetValue(j); + vtkIdType nbpts; + vtkIdType *oldPtsCell = 0; + this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell); for (int l=0; lInsertNextCell(nbpts, pointsCell); int newLoc = newConnectivity->GetInsertLocation(nbpts); newLocations->SetValue(alreadyCopied, newLoc); alreadyCopied++; } + compactState = lookHoleStart; } break; } } if (!alreadyCopied) // no hole, but shorter { - MESSAGE(" -------- newCellSize, shorter"); + MESSAGE(" -------- newCellSize, shorter " << oldCellSize); for (int j=0; jSetValue(alreadyCopied, this->Types->GetValue(j)); idCellsOldToNew[j] = alreadyCopied; - int oldLoc = this->Locations->GetValue(j); - int nbpts; - this->Connectivity->GetCell(oldLoc, nbpts, pointsCell); + vtkIdType oldLoc = this->Locations->GetValue(j); + vtkIdType nbpts; + vtkIdType *oldPtsCell = 0; + this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell); //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts ); for (int l=0; l& idCellsOldToNew, int newCellSize); virtual unsigned long GetMTime(); + virtual void Update(); virtual void UpdateInformation(); static SMDS_UnstructuredGrid* New(); diff --git a/src/SMDS/SMDS_VtkEdge.cxx b/src/SMDS/SMDS_VtkEdge.cxx index 75a96b966..3b3e25882 100644 --- a/src/SMDS/SMDS_VtkEdge.cxx +++ b/src/SMDS/SMDS_VtkEdge.cxx @@ -6,6 +6,7 @@ #include "utilities.h" #include +#include using namespace std; @@ -48,6 +49,7 @@ int SMDS_VtkEdge::NbNodes() const { vtkUnstructuredGrid* grid =SMDS_Mesh::_meshList[myMeshId]->getGrid(); int nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints(); + assert(nbPoints >=2); return nbPoints; } diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index d3bcea07b..880cda0e3 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -816,6 +816,7 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, SMESHDS_SubMesh * subMesh, bool fromGroups) { + //MESSAGE(" --------------------------------> SMESHDS_Mesh::RemoveFreeElement " << subMesh << " " << fromGroups); if (elt->GetType() == SMDSAbs_Node) { RemoveFreeNode( static_cast(elt), subMesh); return; @@ -1779,9 +1780,12 @@ void SMESHDS_Mesh::compactMesh() { int newNodeSize = 0; int nbNodes = myNodes.size(); + int nbVtkNodes = myGrid->GetNumberOfPoints(); + MESSAGE("nbNodes=" << nbNodes << " nbVtkNodes=" << nbVtkNodes); + if (nbNodes > nbVtkNodes) nbVtkNodes = nbNodes; vector idNodesOldToNew; idNodesOldToNew.clear(); - idNodesOldToNew.resize(nbNodes, -1); // all unused id will be -1 + idNodesOldToNew.resize(nbVtkNodes, -1); // all unused id will be -1 bool areNodesModified = ! myNodeIDFactory->isPoolIdEmpty(); MESSAGE("------------------------------------------------- SMESHDS_Mesh::compactMesh " << areNodesModified); @@ -1804,9 +1808,12 @@ void SMESHDS_Mesh::compactMesh() int newCellSize = 0; int nbCells = myCells.size(); + int nbVtkCells = myGrid->GetNumberOfCells(); + MESSAGE("nbCells=" << nbCells << " nbVtkCells=" << nbVtkCells); + if (nbCells > nbVtkCells) nbVtkCells = nbCells; vector idCellsOldToNew; idCellsOldToNew.clear(); - idCellsOldToNew.resize(nbCells, -1); // all unused id will be -1 + idCellsOldToNew.resize(nbVtkCells, -1); // all unused id will be -1 for (int i=0; imyVtkIndex[oldVtkId]; if (smdsId >=0) { int newVtkId = idCellsOldToNew[oldVtkId]; + if (newVtkId > maxVtkId) maxVtkId = newVtkId; + //MESSAGE("===========> smdsId newVtkId " << smdsId << " " << newVtkId); myCells[smdsId]->setVtkId(newVtkId); myIDElements[smdsId] = newVtkId; myVtkIndex[newVtkId] = smdsId; } } + maxVtkId++; + MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() ); + MESSAGE("maxVtkId=" << maxVtkId); + + SetOfCells newCells; + vector newSmdsToVtk; + vector newVtkToSmds; + + newCells.resize(maxVtkId,0); + newSmdsToVtk.resize(maxVtkId,-1); + newVtkToSmds.resize(maxVtkId,-1); + + int myCellsSize = myCells.size(); + int newSmdsId =0; + for (int i=0; igetVtkId(); + newSmdsToVtk[newSmdsId] = idvtk; + assert(idvtk < maxVtkId); + newVtkToSmds[idvtk] = newSmdsId; + myCells[i]->setId(newSmdsId); + newSmdsId++; + assert(newSmdsId <= maxVtkId); + } + } + + myCells.swap(newCells); + myIDElements.swap(newSmdsToVtk); + myVtkIndex.swap(newVtkToSmds); + MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() ); + + // ---TODO: myNodes, myElements in submeshes diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index 02141893d..d45d9ddb8 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -70,7 +70,7 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele if (!isElemDeleted) // alive element has valid ID and can be found { int idInSubShape = ME->getIdInShape(); - //MESSAGE("SMESHDS_SubMesh::RemoveElement " << idInSubShape << " " << ME->GetID()); + //MESSAGE("SMESHDS_SubMesh::RemoveElement " << idInSubShape << " " << ME->GetID() << " " << myUnusedIdElements); assert(idInSubShape >= 0); assert(idInSubShape < myElements.size()); myElements[idInSubShape] = 0; // this vector entry is no more used diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 600427081..9ca09b1a3 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -693,6 +693,7 @@ void SMESHGUI_BaseComputeOp::computeMesh() #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif + SMESH::UpdateNulData(myIObject, true); if (gen->Compute(myMesh, myMainShape)) computeFailed = false; } diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index d19fa7d1f..97577596f 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -252,7 +252,7 @@ namespace SMESH */ //================================================================================ - TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){ + TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry, bool nulData){ TVisualObjPtr aVisualObj; TVisualObjCont::key_type aKey(theStudyId,theEntry); try{ @@ -326,7 +326,11 @@ namespace SMESH #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - objModified = aVisualObj->Update(); + MESSAGE("GetVisualObj"); + if (nulData) + objModified = aVisualObj->NulData(); + else + objModified = aVisualObj->Update(); } catch (...) { #ifdef _DEBUG_ @@ -662,6 +666,7 @@ namespace SMESH bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry) { + MESSAGE("UpdateView"); bool OK = false; SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd); if (!aViewWnd) @@ -736,6 +741,7 @@ namespace SMESH bool UpdateView(EDisplaing theAction, const char* theEntry){ + MESSAGE("UpdateView"); SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() ); SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView(); @@ -774,6 +780,7 @@ namespace SMESH bool Update(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay) { + MESSAGE("Update"); _PTR(Study) aStudy = GetActiveStudyDocument(); CORBA::Long anId = aStudy->StudyId(); if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry())) { @@ -784,6 +791,18 @@ namespace SMESH return false; } + bool UpdateNulData(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay) + { + MESSAGE("UpdateNulData"); + _PTR(Study) aStudy = GetActiveStudyDocument(); + CORBA::Long anId = aStudy->StudyId(); + if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry(), true)) { + if ( theDisplay ) + UpdateView(SMESH::eDisplay,theIO->getEntry()); + return true; + } + return false; + } void UpdateSelectionProp( SMESHGUI* theModule ) { if( !theModule ) diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index 0d49a4437..12c74459e 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -62,7 +62,7 @@ namespace SMESH typedef std::pair TKeyOfVisualObj; SMESHGUI_EXPORT - TVisualObjPtr GetVisualObj( int, const char* ); + TVisualObjPtr GetVisualObj( int, const char*, bool nulData =false ); SMESHGUI_EXPORT void OnVisuException(); // PAL16631 @@ -119,7 +119,10 @@ SMESHGUI_EXPORT void UpdateView(); SMESHGUI_EXPORT - bool Update( const Handle(SALOME_InteractiveObject)&, bool ); + bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay); + +SMESHGUI_EXPORT + bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay); //---------------------------------------------------------------------------- SMESHGUI_EXPORT -- 2.39.2