Bug PAL7444 - display mesh takes a lot of more memory in 2.1.0 than in 2.0.0.

This commit is contained in:
apo 2005-03-30 14:06:25 +00:00
parent 6bbcf82682
commit 83f19818fc
9 changed files with 162 additions and 101 deletions

View File

@ -101,8 +101,9 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
} }
SMESH_ActorDef::SMESH_ActorDef(){ SMESH_ActorDef::SMESH_ActorDef()
if(MYDEBUG) MESSAGE("SMESH_ActorDef"); {
if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
myTimeStamp = vtkTimeStamp::New(); myTimeStamp = vtkTimeStamp::New();
@ -136,7 +137,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
my2DActor = SMESH_DeviceActor::New(); my2DActor = SMESH_DeviceActor::New();
my2DActor->SetUserMatrix(aMatrix); my2DActor->SetUserMatrix(aMatrix);
my2DActor->SetStoreMapping(true);
my2DActor->PickableOff(); my2DActor->PickableOff();
my2DActor->SetProperty(mySurfaceProp); my2DActor->SetProperty(mySurfaceProp);
my2DActor->SetBackfaceProperty(myBackSurfaceProp); my2DActor->SetBackfaceProperty(myBackSurfaceProp);
@ -149,7 +149,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
my3DActor = SMESH_DeviceActor::New(); my3DActor = SMESH_DeviceActor::New();
my3DActor->SetUserMatrix(aMatrix); my3DActor->SetUserMatrix(aMatrix);
my3DActor->SetStoreMapping(true);
my3DActor->PickableOff(); my3DActor->PickableOff();
my3DActor->SetProperty(mySurfaceProp); my3DActor->SetProperty(mySurfaceProp);
my3DActor->SetBackfaceProperty(myBackSurfaceProp); my3DActor->SetBackfaceProperty(myBackSurfaceProp);
@ -177,7 +176,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
my1DActor = SMESH_DeviceActor::New(); my1DActor = SMESH_DeviceActor::New();
my1DActor->SetUserMatrix(aMatrix); my1DActor->SetUserMatrix(aMatrix);
my1DActor->SetStoreMapping(true);
my1DActor->PickableOff(); my1DActor->PickableOff();
my1DActor->SetHighlited(true); my1DActor->SetHighlited(true);
my1DActor->SetProperty(myEdgeProp); my1DActor->SetProperty(myEdgeProp);
@ -202,7 +200,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
my1DExtActor = SMESH_DeviceActor::New(); my1DExtActor = SMESH_DeviceActor::New();
my1DExtActor->SetUserMatrix(aMatrix); my1DExtActor->SetUserMatrix(aMatrix);
my1DExtActor->SetStoreMapping(true);
my1DExtActor->PickableOff(); my1DExtActor->PickableOff();
my1DExtActor->SetHighlited(true); my1DExtActor->SetHighlited(true);
my1DExtActor->SetVisibility(false); my1DExtActor->SetVisibility(false);
@ -224,7 +221,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
myNodeActor = SMESH_DeviceActor::New(); myNodeActor = SMESH_DeviceActor::New();
myNodeActor->SetUserMatrix(aMatrix); myNodeActor->SetUserMatrix(aMatrix);
myNodeActor->SetStoreMapping(true); myNodeActor->SetStoreClippingMapping(true);
myNodeActor->PickableOff(); myNodeActor->PickableOff();
myNodeActor->SetVisibility(false); myNodeActor->SetVisibility(false);
myNodeActor->SetProperty(myNodeProp); myNodeActor->SetProperty(myNodeProp);
@ -238,9 +235,8 @@ SMESH_ActorDef::SMESH_ActorDef(){
myBaseActor = SMESH_DeviceActor::New(); myBaseActor = SMESH_DeviceActor::New();
myBaseActor->SetUserMatrix(aMatrix); myBaseActor->SetUserMatrix(aMatrix);
myBaseActor->SetStoreMapping(true); myBaseActor->SetStoreGemetryMapping(true);
myBaseActor->GetProperty()->SetOpacity(0.0); myBaseActor->GetProperty()->SetOpacity(0.0);
myBaseActor->myGeomFilter->SetInside(true);
myPickableActor = myBaseActor; myPickableActor = myBaseActor;
@ -268,19 +264,9 @@ SMESH_ActorDef::SMESH_ActorDef(){
myHighlitableActor = SMESH_DeviceActor::New(); myHighlitableActor = SMESH_DeviceActor::New();
myHighlitableActor->SetUserMatrix(aMatrix); myHighlitableActor->SetUserMatrix(aMatrix);
myHighlitableActor->SetStoreMapping(false);
myHighlitableActor->PickableOff(); myHighlitableActor->PickableOff();
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
myNodeHighlitableActor = SMESH_DeviceActor::New();
myNodeHighlitableActor->SetUserMatrix(aMatrix);
myNodeHighlitableActor->SetStoreMapping(false);
myNodeHighlitableActor->PickableOff();
myNodeHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
aFilter = myNodeHighlitableActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
SetShrinkFactor(SMESH::GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.); SetShrinkFactor(SMESH::GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.);
myName = ""; myName = "";
@ -494,8 +480,9 @@ SMESH_ActorDef::SMESH_ActorDef(){
} }
SMESH_ActorDef::~SMESH_ActorDef(){ SMESH_ActorDef::~SMESH_ActorDef()
if(MYDEBUG) MESSAGE("~SMESH_ActorDef"); {
if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
myScalarBarActor->Delete(); myScalarBarActor->Delete();
myLookupTable->Delete(); myLookupTable->Delete();
@ -522,8 +509,6 @@ SMESH_ActorDef::~SMESH_ActorDef(){
myBaseActor->Delete(); myBaseActor->Delete();
myHighlitableActor->Delete(); myHighlitableActor->Delete();
myNodeHighlitableActor->Delete();
//Deleting of pints numbering pipeline //Deleting of pints numbering pipeline
//--------------------------------------- //---------------------------------------
@ -624,8 +609,21 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
} }
void SMESH_ActorDef::SetControlMode(eControl theMode){ void
SMESH_ActorDef::
SetControlMode(eControl theMode)
{
SetControlMode(theMode,true);
}
void
SMESH_ActorDef::
SetControlMode(eControl theMode,
bool theCheckEntityMode)
{
myControlMode = eNone; myControlMode = eNone;
theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
my1DActor->GetMapper()->SetScalarVisibility(false); my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false); my2DActor->GetMapper()->SetScalarVisibility(false);
@ -734,27 +732,36 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
switch(myControlMode){ switch(myControlMode){
case eFreeEdges: case eFreeEdges:
case eFreeBorders: case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor); my1DExtActor->SetExtControlMode(aFunctor);
break; break;
case eLength2D: case eLength2D:
case eMultiConnection2D: case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
break; break;
default: default:
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
} }
} }
if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){ if(theCheckEntityMode){
if(myControlActor == my1DActor) if(myControlActor == my1DActor)
myEntityMode = eEdges; SetEntityMode(eEdges);
else if(myControlActor == my2DActor) else if(myControlActor == my2DActor){
myEntityMode = eFaces; switch(myControlMode){
else if(myControlActor == my3DActor) case eLength2D:
myEntityMode = eVolumes; case eFreeEdges:
case eMultiConnection2D:
//SetEntityMode(eEdges);
SetEntityMode(eFaces);
break;
default:
SetEntityMode(eFaces);
}
}else if(myControlActor == my3DActor)
SetEntityMode(eVolumes);
} }
}else if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){ }else if(theCheckEntityMode){
myEntityMode = eAllEntity; myEntityMode = eAllEntity;
} }
@ -778,7 +785,6 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(my1DExtActor); theRenderer->AddActor(my1DExtActor);
theRenderer->AddActor(myHighlitableActor); theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor(myNodeHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor); theRenderer->AddActor2D(myScalarBarActor);
@ -796,7 +802,6 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
theRenderer->RemoveActor(myBaseActor); theRenderer->RemoveActor(myBaseActor);
theRenderer->RemoveActor(myHighlitableActor); theRenderer->RemoveActor(myHighlitableActor);
theRenderer->RemoveActor(myNodeHighlitableActor);
theRenderer->RemoveActor(my1DActor); theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor); theRenderer->RemoveActor(my1DExtActor);
@ -826,7 +831,6 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myBaseActor->Init(myVisualObj,myImplicitBoolean); myBaseActor->Init(myVisualObj,myImplicitBoolean);
myHighlitableActor->Init(myVisualObj,myImplicitBoolean); myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
myNodeHighlitableActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->Init(myVisualObj,myImplicitBoolean); my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean); my1DExtActor->Init(myVisualObj,myImplicitBoolean);
@ -883,7 +887,6 @@ void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
myBaseActor->SetTransform(theTransform); myBaseActor->SetTransform(theTransform);
myHighlitableActor->SetTransform(theTransform); myHighlitableActor->SetTransform(theTransform);
myNodeHighlitableActor->SetTransform(theTransform);
my1DActor->SetTransform(theTransform); my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform); my1DExtActor->SetTransform(theTransform);
@ -1067,14 +1070,22 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
void SMESH_ActorDef::SetEntityMode(unsigned int theMode){ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) myEntityState = eAllEntity;
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){
myEntityState &= ~eEdges;
theMode &= ~eEdges; theMode &= ~eEdges;
}
if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){
myEntityState &= ~eFaces;
theMode &= ~eFaces; theMode &= ~eFaces;
}
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){
myEntityState &= ~eVolumes;
theMode &= ~eVolumes; theMode &= ~eVolumes;
}
if(!theMode){ if(!theMode){
if(myVisualObj->GetNbEntities(SMDSAbs_Edge)) if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
@ -1087,6 +1098,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
theMode |= eVolumes; theMode |= eVolumes;
} }
myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
myEntityMode = theMode; myEntityMode = theMode;
SALOME_ExtractUnstructuredGrid* aFilter = NULL; SALOME_ExtractUnstructuredGrid* aFilter = NULL;
aFilter = myBaseActor->GetExtractUnstructuredGrid(); aFilter = myBaseActor->GetExtractUnstructuredGrid();
@ -1229,27 +1242,27 @@ void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetVisibility(false); myHighlitableActor->SetVisibility(false);
myHighlitableActor->SetHighlited(false); myHighlitableActor->SetHighlited(false);
myNodeHighlitableActor->SetVisibility(false);
myNodeHighlitableActor->SetHighlited(false);
if(myIsHighlighted){ if(myIsHighlighted){
myHighlitableActor->SetProperty(myHighlightProp); myHighlitableActor->SetProperty(myHighlightProp);
}else if(myIsPreselected){ }else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp); myHighlitableActor->SetProperty(myPreselectProp);
} }
bool isVisible = GetVisibility(); bool anIsVisible = GetVisibility();
if(myIsHighlighted || myIsPreselected){ if(myIsHighlighted || myIsPreselected){
if(GetUnstructuredGrid()->GetNumberOfCells()){ if(GetUnstructuredGrid()->GetNumberOfCells()){
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::eCells);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
myHighlitableActor->SetVisibility(isVisible); }else if(myRepresentation == ePoint || GetPointRepresentation()){
myHighlitableActor->SetHighlited(isVisible); myHighlitableActor->SetHighlited(anIsVisible);
} myHighlitableActor->SetVisibility(anIsVisible);
if(myRepresentation == ePoint || GetPointRepresentation()){ myHighlitableActor->GetExtractUnstructuredGrid()->
myNodeHighlitableActor->SetProperty(myHighlitableActor->GetProperty()); SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
myNodeHighlitableActor->SetVisibility(isVisible); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
myNodeHighlitableActor->SetHighlited(isVisible);
} }
} }
} }
@ -1308,7 +1321,7 @@ void SMESH_ActorDef::Update(){
unsigned long aTime = myTimeStamp->GetMTime(); unsigned long aTime = myTimeStamp->GetMTime();
unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
if (anObjTime > aTime) if (anObjTime > aTime)
SetControlMode(GetControlMode()); SetControlMode(GetControlMode(),false);
} }
if(myIsPointsLabeled){ if(myIsPointsLabeled){
SetPointsLabeled(myIsPointsLabeled); SetPointsLabeled(myIsPointsLabeled);
@ -1461,7 +1474,6 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myNodeHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);

View File

@ -186,6 +186,7 @@ class SMESH_ActorDef : public SMESH_Actor{
virtual long GetControlsPrecision() const { return myControlsPrecision; } virtual long GetControlsPrecision() const { return myControlsPrecision; }
protected: protected:
void SetControlMode(eControl theMode, bool theCheckEntityMode);
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed); void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
bool IsImplicitFunctionUsed() const; bool IsImplicitFunctionUsed() const;
@ -207,7 +208,6 @@ class SMESH_ActorDef : public SMESH_Actor{
vtkProperty* myHighlightProp; vtkProperty* myHighlightProp;
vtkProperty* myPreselectProp; vtkProperty* myPreselectProp;
SMESH_DeviceActor* myHighlitableActor; SMESH_DeviceActor* myHighlitableActor;
SMESH_DeviceActor* myNodeHighlitableActor;
eControl myControlMode; eControl myControlMode;
SMESH_DeviceActor* my2DActor; SMESH_DeviceActor* my2DActor;
@ -220,6 +220,7 @@ class SMESH_ActorDef : public SMESH_Actor{
SMESH_DeviceActor* my1DExtActor; SMESH_DeviceActor* my1DExtActor;
unsigned int myEntityMode; unsigned int myEntityMode;
unsigned int myEntityState;
bool myIsPointsVisible; bool myIsPointsVisible;
bool myIsShrinkable; bool myIsShrinkable;

View File

@ -75,7 +75,10 @@ using namespace std;
vtkStandardNewMacro(SMESH_DeviceActor); vtkStandardNewMacro(SMESH_DeviceActor);
SMESH_DeviceActor::SMESH_DeviceActor(){ SMESH_DeviceActor::SMESH_DeviceActor()
{
if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<<this);
myIsShrunk = false; myIsShrunk = false;
myIsShrinkable = false; myIsShrinkable = false;
myRepresentation = eSurface; myRepresentation = eSurface;
@ -91,17 +94,16 @@ SMESH_DeviceActor::SMESH_DeviceActor(){
myShrinkFilter = vtkShrinkFilter::New(); myShrinkFilter = vtkShrinkFilter::New();
myStoreClippingMapping = false;
myExtractGeometry = SMESH_ExtractGeometry::New(); myExtractGeometry = SMESH_ExtractGeometry::New();
myExtractGeometry->SetReleaseDataFlag(true); myExtractGeometry->SetReleaseDataFlag(true);
myExtractGeometry->SetStoreMapping(true);
myIsImplicitFunctionUsed = false; myIsImplicitFunctionUsed = false;
myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New(); myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
myExtractUnstructuredGrid->SetStoreMapping(true);
myMergeFilter = vtkMergeFilter::New(); myMergeFilter = vtkMergeFilter::New();
myStoreMapping = false;
myGeomFilter = SALOME_GeometryFilter::New(); myGeomFilter = SALOME_GeometryFilter::New();
myTransformFilter = SALOME_TransformFilter::New(); myTransformFilter = SALOME_TransformFilter::New();
@ -112,43 +114,54 @@ SMESH_DeviceActor::SMESH_DeviceActor(){
SMESH_DeviceActor::~SMESH_DeviceActor(){ SMESH_DeviceActor::~SMESH_DeviceActor(){
if(MYDEBUG) MESSAGE("~SMESH_DeviceActor"); if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
myProperty->Delete(); myProperty->Delete();
myMapper->RemoveAllInputs();
myMapper->Delete(); myMapper->Delete();
myShrinkFilter->UnRegisterAllOutputs();
myShrinkFilter->Delete(); myShrinkFilter->Delete();
myExtractUnstructuredGrid->UnRegisterAllOutputs();
myExtractUnstructuredGrid->Delete(); myExtractUnstructuredGrid->Delete();
myMergeFilter->UnRegisterAllOutputs();
myMergeFilter->Delete(); myMergeFilter->Delete();
myGeomFilter->UnRegisterAllOutputs();
myGeomFilter->Delete(); myGeomFilter->Delete();
myExtractGeometry->UnRegisterAllOutputs();
myExtractGeometry->Delete(); myExtractGeometry->Delete();
myTransformFilter->UnRegisterAllOutputs();
myTransformFilter->Delete(); myTransformFilter->Delete();
for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){ for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
myPassFilter[i]->UnRegisterAllOutputs();
myPassFilter[i]->Delete(); myPassFilter[i]->Delete();
} }
} }
void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){ void
if (myStoreMapping == theStoreMapping) SMESH_DeviceActor::
return; SetStoreGemetryMapping(bool theStoreMapping)
myStoreMapping = theStoreMapping; {
myGeomFilter->SetStoreMapping( myStoreMapping ); myGeomFilter->SetStoreMapping(theStoreMapping);
Modified(); SetStoreClippingMapping(theStoreMapping);
}
void
SMESH_DeviceActor::
SetStoreClippingMapping(bool theStoreMapping)
{
myStoreClippingMapping = theStoreMapping;
myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
SetStoreIDMapping(theStoreMapping);
}
void
SMESH_DeviceActor::
SetStoreIDMapping(bool theStoreMapping)
{
myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping);
} }
@ -165,9 +178,6 @@ void
SMESH_DeviceActor:: SMESH_DeviceActor::
SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
{ {
if(myIsImplicitFunctionUsed == theIsImplicitFunctionUsed)
return;
int anId = 0; int anId = 0;
if(theIsImplicitFunctionUsed) if(theIsImplicitFunctionUsed)
myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() ); myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
@ -175,6 +185,7 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() ); myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
myIsImplicitFunctionUsed = theIsImplicitFunctionUsed; myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
SetStoreClippingMapping(myStoreClippingMapping);
} }
@ -190,11 +201,10 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
myExtractGeometry->SetInput(myMergeFilter->GetOutput()); myExtractGeometry->SetInput(myMergeFilter->GetOutput());
int anId = 0; int anId = 0;
myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() ); SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 1 anId++; // 1
myGeomFilter->SetStoreMapping( myStoreMapping );
myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 2 anId++; // 2
@ -239,7 +249,11 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
bool anIsInitialized = theFunctor; bool anIsInitialized = theFunctor;
if(anIsInitialized){ if(anIsInitialized){
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New(); vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
SetStoreIDMapping(true);
myExtractUnstructuredGrid->Update();
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput(); vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
aDataSet->ShallowCopy(aGrid); aDataSet->ShallowCopy(aGrid);
vtkDoubleArray *aScalars = vtkDoubleArray::New(); vtkDoubleArray *aScalars = vtkDoubleArray::New();
@ -280,7 +294,6 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
} }
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable) vtkLookupTable* theLookupTable)
{ {
@ -419,8 +432,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
theScalarBarActor->SetVisibility(anIsInitialized); theScalarBarActor->SetVisibility(anIsInitialized);
} }
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor)
SMESH_DeviceActor* theDeviceActor)
{ {
myExtractUnstructuredGrid->ClearRegisteredCells(); myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType(); myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
@ -553,7 +565,9 @@ void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){
void SMESH_DeviceActor::SetVisibility(int theMode){ void SMESH_DeviceActor::SetVisibility(int theMode){
if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()){ if(!myExtractUnstructuredGrid->GetInput() ||
GetUnstructuredGrid()->GetNumberOfCells())
{
vtkLODActor::SetVisibility(theMode); vtkLODActor::SetVisibility(theMode);
}else{ }else{
vtkLODActor::SetVisibility(false); vtkLODActor::SetVisibility(false);
@ -576,7 +590,7 @@ int SMESH_DeviceActor::GetNodeObjId(int theVtkID){
anID = myExtractGeometry->GetNodeObjId(theVtkID); anID = myExtractGeometry->GetNodeObjId(theVtkID);
vtkIdType aRetID = myVisualObj->GetNodeObjId(anID); vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; aRetID = "<<aRetID); if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
return aRetID; return aRetID;
} }

View File

@ -21,7 +21,7 @@
// //
// //
// //
// File : SMESH_Actor.h // File : SMESH_DeviceActor.h
// Author : Nicolas REJNERI // Author : Nicolas REJNERI
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
@ -61,8 +61,9 @@ class SMESH_DeviceActor: public vtkLODActor{
vtkTypeMacro(SMESH_DeviceActor,vtkLODActor); vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
static SMESH_DeviceActor* New(); static SMESH_DeviceActor* New();
void SetStoreMapping(int theStoreMapping); void SetStoreClippingMapping(bool theStoreMapping);
int GetStoreMapping(){ return myStoreMapping;} void SetStoreGemetryMapping(bool theStoreMapping);
void SetStoreIDMapping(bool theStoreMapping);
virtual int GetNodeObjId(int theVtkID); virtual int GetNodeObjId(int theVtkID);
virtual float* GetNodeCoord(int theObjID); virtual float* GetNodeCoord(int theObjID);
@ -95,11 +96,9 @@ class SMESH_DeviceActor: public vtkLODActor{
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable); vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable); vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
SMESH_DeviceActor* theDeviceActor);
bool IsHighlited() { return myIsHighlited;} bool IsHighlited() { return myIsHighlited;}
void SetHighlited(bool theIsHighlited); void SetHighlited(bool theIsHighlited);
@ -125,7 +124,7 @@ class SMESH_DeviceActor: public vtkLODActor{
vtkMergeFilter* myMergeFilter; vtkMergeFilter* myMergeFilter;
SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid; SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
bool myStoreMapping; bool myStoreClippingMapping;
SALOME_GeometryFilter *myGeomFilter; SALOME_GeometryFilter *myGeomFilter;
SALOME_TransformFilter *myTransformFilter; SALOME_TransformFilter *myTransformFilter;
std::vector<SALOME_PassThroughFilter*> myPassFilter; std::vector<SALOME_PassThroughFilter*> myPassFilter;
@ -153,4 +152,4 @@ class SMESH_DeviceActor: public vtkLODActor{
}; };
#endif //SMESH_ACTOR_H #endif //SMESH_DEVICE_ACTOR_H

View File

@ -287,12 +287,15 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
//================================================================================= //=================================================================================
SMESH_VisualObjDef::SMESH_VisualObjDef() SMESH_VisualObjDef::SMESH_VisualObjDef()
{ {
if(MYDEBUG) MESSAGE("SMESH_MeshObj - "<<this);
myGrid = vtkUnstructuredGrid::New(); myGrid = vtkUnstructuredGrid::New();
} }
SMESH_VisualObjDef::~SMESH_VisualObjDef() SMESH_VisualObjDef::~SMESH_VisualObjDef()
{ {
if ( MYDEBUG ) if(MYDEBUG) {
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() ); MESSAGE("~SMESH_MeshObj - "<<this);
myGrid->DebugOn();
}
myGrid->Delete(); myGrid->Delete();
} }

View File

@ -730,6 +730,8 @@ namespace{
SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection());
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
aStudyBuilder->NewCommand(); // There is a transaction
for(; It.More(); It.Next()){ for(; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){ if(IObject->hasEntry()){
@ -737,7 +739,7 @@ namespace{
/* Erase child graphical objects */ /* Erase child graphical objects */
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
for(; it->More(); it->Next()){ for(it->InitEx(true); it->More(); it->Next()){
SALOMEDS::SObject_var CSO = it->Value(); SALOMEDS::SObject_var CSO = it->Value();
if(CSO->FindAttribute(anAttr, "AttributeIOR")){ if(CSO->FindAttribute(anAttr, "AttributeIOR")){
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
@ -785,6 +787,7 @@ namespace{
} /* IObject->hasEntry() */ } /* IObject->hasEntry() */
} /* more/next */ } /* more/next */
aStudyBuilder->CommitCommand();
/* Clear any previous selection */ /* Clear any previous selection */
Sel->ClearIObjects(); Sel->ClearIObjects();
@ -1274,6 +1277,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
} }
CORBA::Long anId = aStudy->StudyId(); CORBA::Long anId = aStudy->StudyId();
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry()); TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
cout<<"myAutomaticUpdate - "<<myAutomaticUpdate<<endl;
if(myAutomaticUpdate && aVisualObj){ if(myAutomaticUpdate && aVisualObj){
aVisualObj->Update(); aVisualObj->Update();
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry()); SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());

View File

@ -244,6 +244,17 @@ namespace SMESH{
void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){ void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
aViewFrame->RemoveActor(theActor); aViewFrame->RemoveActor(theActor);
if(theActor->hasIO()){
Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
if(anIO->hasEntry()){
std::string anEntry = anIO->getEntry();
QAD_Study* aStudy = theStudyFrame->getStudy();
int aStudyId = aStudy->getStudyId();
TVisualObjCont::key_type aKey(aStudyId,anEntry);
VISUAL_OBJ_CONT.erase(aKey);
}
}
theActor->Delete();
aViewFrame->Repaint(); aViewFrame->Repaint();
} }
} }

View File

@ -498,8 +498,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
ASSERT( meshServant ); ASSERT( meshServant );
meshServant->SetShape( theShapeObject ); meshServant->SetShape( theShapeObject );
// publish mesh in the study // publish mesh in the study
if ( CanPublishInStudy( mesh ) ) if( CanPublishInStudy( mesh ) ){
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
PublishMesh( myCurrentStudy, mesh.in() ); PublishMesh( myCurrentStudy, mesh.in() );
aStudyBuilder->CommitCommand();
}
return mesh._retn(); return mesh._retn();
} }
@ -520,8 +524,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
SMESH::SMESH_Mesh_var aMesh = createMesh(); SMESH::SMESH_Mesh_var aMesh = createMesh();
string aFileName; // = boost::filesystem::path(theFileName).leaf(); string aFileName; // = boost::filesystem::path(theFileName).leaf();
// publish mesh in the study // publish mesh in the study
if ( CanPublishInStudy( aMesh ) ) if ( CanPublishInStudy( aMesh ) ){
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() ); PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
}
SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() ); SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
ASSERT( aServant ); ASSERT( aServant );
@ -553,9 +561,12 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
SMESH::mesh_array_var aResult = new SMESH::mesh_array(); SMESH::mesh_array_var aResult = new SMESH::mesh_array();
theStatus = (SMESH::DriverMED_ReadStatus)aStatus; theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
if(theStatus == SMESH::DRS_OK){ if(theStatus == SMESH::DRS_OK){
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
aResult->length( aNames.size() ); aResult->length( aNames.size() );
int i = 0; int i = 0;
// Iterate through all meshes and create mesh objects // Iterate through all meshes and create mesh objects
for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) { for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
// create mesh // create mesh
@ -575,6 +586,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh ); aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
} }
aStudyBuilder->CommitCommand();
} }
return aResult._retn(); return aResult._retn();
} }
@ -596,8 +608,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName
SMESH::SMESH_Mesh_var aMesh = createMesh(); SMESH::SMESH_Mesh_var aMesh = createMesh();
string aFileName; // = boost::filesystem::path(theFileName).leaf(); string aFileName; // = boost::filesystem::path(theFileName).leaf();
// publish mesh in the study // publish mesh in the study
if ( CanPublishInStudy( aMesh ) ) if( CanPublishInStudy( aMesh ) ){
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() ); PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
}
SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() ); SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
ASSERT( aServant ); ASSERT( aServant );

View File

@ -76,7 +76,8 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
CORBA::Long studyId ) CORBA::Long studyId )
: SALOME::GenericObj_i( thePOA ) : SALOME::GenericObj_i( thePOA )
{ {
INFOS("SMESH_Mesh_i"); INFOS("SMESH_Mesh_i; this = "<<this);
_impl = NULL;
_gen_i = gen_i; _gen_i = gen_i;
_id = myIdGenerator++; _id = myIdGenerator++;
_studyId = studyId; _studyId = studyId;
@ -91,7 +92,7 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
SMESH_Mesh_i::~SMESH_Mesh_i() SMESH_Mesh_i::~SMESH_Mesh_i()
{ {
INFOS("~SMESH_Mesh_i"); INFOS("~SMESH_Mesh_i; this = "<<this);
map<int, SMESH::SMESH_GroupBase_ptr>::iterator it; map<int, SMESH::SMESH_GroupBase_ptr>::iterator it;
for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) { for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() ); SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() );