mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 10:37:28 +05:00
23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe
Use my1DActor only to show edge numbers and controls of all edges => 10% decrease memory usage
This commit is contained in:
parent
270d55cf05
commit
d053feed93
@ -323,6 +323,10 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||||
myEdgeProp->SetLineWidth(aLineWidth);
|
myEdgeProp->SetLineWidth(aLineWidth);
|
||||||
|
|
||||||
|
// my1DActor is used to
|
||||||
|
// - show numbers
|
||||||
|
// - show controls on all edges (eg Length)
|
||||||
|
// since edges are shown by myHighlitableActor
|
||||||
my1DActor = SMESH_CellLabelActor::New();
|
my1DActor = SMESH_CellLabelActor::New();
|
||||||
my1DActor->SetStoreClippingMapping(true);
|
my1DActor->SetStoreClippingMapping(true);
|
||||||
my1DActor->SetUserMatrix(aMatrix);
|
my1DActor->SetUserMatrix(aMatrix);
|
||||||
@ -350,6 +354,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
|
my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
|
||||||
my1DExtProp->SetPointSize(aElem0DSize);
|
my1DExtProp->SetPointSize(aElem0DSize);
|
||||||
|
|
||||||
|
// my1DExtActor is used to show filtered edges or links between nodes
|
||||||
my1DExtActor = SMESH_DeviceActor::New();
|
my1DExtActor = SMESH_DeviceActor::New();
|
||||||
my1DExtActor->SetUserMatrix(aMatrix);
|
my1DExtActor->SetUserMatrix(aMatrix);
|
||||||
my1DExtActor->PickableOff();
|
my1DExtActor->PickableOff();
|
||||||
@ -995,8 +1000,7 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
|
int aNbCells = myFunctor ? myVisualObj->GetNbEntities( myFunctor->GetType() ) : 0;
|
||||||
vtkIdType aNbCells = aGrid->GetNumberOfCells();
|
|
||||||
bool aShowOnlyScalarBarTitle = false;
|
bool aShowOnlyScalarBarTitle = false;
|
||||||
if(aNbCells) {
|
if(aNbCells) {
|
||||||
myControlMode = theMode;
|
myControlMode = theMode;
|
||||||
@ -1055,25 +1059,13 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
SetEntityMode(eEdges);
|
SetEntityMode(eEdges);
|
||||||
}
|
}
|
||||||
else if(myControlActor == my2DActor) {
|
else if(myControlActor == my2DActor) {
|
||||||
switch(myControlMode) {
|
if (!myIsEntityModeCache){
|
||||||
case eLength2D:
|
myEntityModeCache = GetEntityMode();
|
||||||
case eFreeEdges:
|
myIsEntityModeCache=true;
|
||||||
case eFreeFaces:
|
|
||||||
case eMultiConnection2D:
|
|
||||||
if (!myIsEntityModeCache){
|
|
||||||
myEntityModeCache = GetEntityMode();
|
|
||||||
myIsEntityModeCache=true;
|
|
||||||
}
|
|
||||||
SetEntityMode(eFaces);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!myIsEntityModeCache){
|
|
||||||
myEntityModeCache = GetEntityMode();
|
|
||||||
myIsEntityModeCache=true;
|
|
||||||
}
|
|
||||||
SetEntityMode(eFaces);
|
|
||||||
}
|
}
|
||||||
}else if(myControlActor == my3DActor) {
|
SetEntityMode(eFaces);
|
||||||
|
}
|
||||||
|
else if(myControlActor == my3DActor) {
|
||||||
if (!myIsEntityModeCache){
|
if (!myIsEntityModeCache){
|
||||||
myEntityModeCache = GetEntityMode();
|
myEntityModeCache = GetEntityMode();
|
||||||
myIsEntityModeCache=true;
|
myIsEntityModeCache=true;
|
||||||
@ -1487,9 +1479,15 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation)
|
|||||||
case eCoincidentNodes:
|
case eCoincidentNodes:
|
||||||
myNodeExtActor->VisibilityOn();
|
myNodeExtActor->VisibilityOn();
|
||||||
break;
|
break;
|
||||||
|
case eLength:
|
||||||
|
case eMultiConnection:
|
||||||
|
my1DActor->VisibilityOn();
|
||||||
|
break;
|
||||||
case eFreeEdges:
|
case eFreeEdges:
|
||||||
case eFreeBorders:
|
case eFreeBorders:
|
||||||
case eCoincidentElems1D:
|
case eCoincidentElems1D:
|
||||||
|
case eLength2D:
|
||||||
|
case eMultiConnection2D:
|
||||||
my1DExtActor->VisibilityOn();
|
my1DExtActor->VisibilityOn();
|
||||||
break;
|
break;
|
||||||
case eFreeFaces:
|
case eFreeFaces:
|
||||||
@ -1503,39 +1501,31 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation)
|
|||||||
case eCoincidentElems3D:
|
case eCoincidentElems3D:
|
||||||
my3DExtActor->VisibilityOn();
|
my3DExtActor->VisibilityOn();
|
||||||
break;
|
break;
|
||||||
case eLength2D:
|
|
||||||
case eMultiConnection2D:
|
|
||||||
my1DExtActor->VisibilityOn();
|
|
||||||
break;
|
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
|
if ( myFunctor && myVisualObj->GetNbEntities( myFunctor->GetType() ))
|
||||||
myScalarBarActor->VisibilityOn();
|
myScalarBarActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myRepresentation != ePoint)
|
myPickableActor->VisibilityOn();
|
||||||
myPickableActor->VisibilityOn();
|
|
||||||
else {
|
|
||||||
myNodeActor->VisibilityOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
|
if ( GetRepresentation() != ePoint )
|
||||||
my0DActor->VisibilityOn();
|
{
|
||||||
}
|
if(myEntityMode & e0DElements ){
|
||||||
if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
|
my0DActor->VisibilityOn();
|
||||||
myBallActor->VisibilityOn();
|
}
|
||||||
}
|
if(myEntityMode & eBallElem ){
|
||||||
|
myBallActor->VisibilityOn();
|
||||||
if(myEntityMode & eEdges && GetRepresentation() != ePoint){
|
}
|
||||||
my1DActor->VisibilityOn();
|
if(myEntityMode & eEdges && GetCellsLabeled() ){ // my1DActor shows labels only
|
||||||
}
|
my1DActor->VisibilityOn();
|
||||||
|
}
|
||||||
if(myEntityMode & eFaces && GetRepresentation() != ePoint){
|
if(myEntityMode & eFaces ){
|
||||||
my2DActor->VisibilityOn();
|
my2DActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
|
if(myEntityMode & eVolumes ){
|
||||||
if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
|
my3DActor->VisibilityOn();
|
||||||
my3DActor->VisibilityOn();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myNodeActor->GetPointsLabeled()){
|
if(myNodeActor->GetPointsLabeled()){
|
||||||
@ -1750,8 +1740,6 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myPickableActor = myBaseActor;
|
myPickableActor = myBaseActor;
|
||||||
myNodeActor->SetVisibility(false);
|
|
||||||
myNodeExtActor->SetVisibility(false);
|
|
||||||
vtkProperty *aProp = NULL, *aBackProp = NULL;
|
vtkProperty *aProp = NULL, *aBackProp = NULL;
|
||||||
vtkProperty *aPropVN = NULL, *aPropVR = NULL;
|
vtkProperty *aPropVN = NULL, *aPropVR = NULL;
|
||||||
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
|
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
|
||||||
@ -1759,7 +1747,6 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
|
|||||||
switch (myRepresentation) {
|
switch (myRepresentation) {
|
||||||
case ePoint:
|
case ePoint:
|
||||||
myPickableActor = myNodeActor;
|
myPickableActor = myNodeActor;
|
||||||
myNodeActor->SetVisibility(true);
|
|
||||||
aQuadraticMode = SMESH_Actor::eLines;
|
aQuadraticMode = SMESH_Actor::eLines;
|
||||||
aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
|
aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
|
||||||
aReperesent = SMESH_DeviceActor::ePoint;
|
aReperesent = SMESH_DeviceActor::ePoint;
|
||||||
@ -1777,54 +1764,50 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
my2DActor->SetProperty(aProp);
|
if ( myRepresentation != ePoint )
|
||||||
my2DActor->SetBackfaceProperty(aBackProp);
|
{
|
||||||
my2DActor->SetRepresentation(aReperesent);
|
my2DActor->SetProperty(aProp);
|
||||||
|
my2DActor->SetBackfaceProperty(aBackProp);
|
||||||
|
my2DActor->SetRepresentation(aReperesent);
|
||||||
|
|
||||||
if(aQuadraticMode == SMESH_Actor::eLines)
|
if(aQuadraticMode == SMESH_Actor::eLines)
|
||||||
my2DActor->SetQuadraticArcMode(false);
|
my2DActor->SetQuadraticArcMode(false);
|
||||||
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
||||||
my2DActor->SetQuadraticArcMode(true);
|
my2DActor->SetQuadraticArcMode(true);
|
||||||
|
|
||||||
my2DExtActor->SetRepresentation(aReperesent);
|
my2DExtActor->SetRepresentation(aReperesent);
|
||||||
|
|
||||||
my3DActor->SetProperty(aPropVN);
|
my3DActor->SetProperty(aPropVN);
|
||||||
my3DActor->SetBackfaceProperty(aPropVR);
|
my3DActor->SetBackfaceProperty(aPropVR);
|
||||||
my3DActor->SetRepresentation(aReperesent);
|
my3DActor->SetRepresentation(aReperesent);
|
||||||
|
|
||||||
|
my0DActor->SetRepresentation(aReperesent);
|
||||||
|
myBallActor->SetRepresentation(aReperesent);
|
||||||
|
|
||||||
my1DExtActor->SetVisibility(false);
|
switch ( myControlMode ) {
|
||||||
my2DExtActor->SetVisibility(false);
|
case eLength:
|
||||||
my3DExtActor->SetVisibility(false);
|
case eMultiConnection:
|
||||||
|
aProp = aBackProp = my1DProp;
|
||||||
|
if(myRepresentation != ePoint)
|
||||||
|
aReperesent = SMESH_DeviceActor::eInsideframe;
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
|
||||||
my0DActor->SetRepresentation(aReperesent);
|
if(aQuadraticMode == SMESH_Actor::eLines)
|
||||||
myBallActor->SetRepresentation(aReperesent);
|
my1DActor->SetQuadraticArcMode(false);
|
||||||
|
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
||||||
|
my1DActor->SetQuadraticArcMode(true);
|
||||||
|
|
||||||
switch ( myControlMode ) {
|
my1DActor->SetProperty(aProp);
|
||||||
case eLength:
|
my1DActor->SetBackfaceProperty(aBackProp);
|
||||||
case eMultiConnection:
|
my1DActor->SetRepresentation(aReperesent);
|
||||||
aProp = aBackProp = my1DProp;
|
|
||||||
if(myRepresentation != ePoint)
|
my1DExtActor->SetRepresentation(aReperesent);
|
||||||
aReperesent = SMESH_DeviceActor::eInsideframe;
|
|
||||||
break;
|
|
||||||
default:;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aQuadraticMode == SMESH_Actor::eLines)
|
|
||||||
my1DActor->SetQuadraticArcMode(false);
|
|
||||||
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
|
||||||
my1DActor->SetQuadraticArcMode(true);
|
|
||||||
|
|
||||||
my1DActor->SetProperty(aProp);
|
|
||||||
my1DActor->SetBackfaceProperty(aBackProp);
|
|
||||||
my1DActor->SetRepresentation(aReperesent);
|
|
||||||
|
|
||||||
my1DExtActor->SetRepresentation(aReperesent);
|
|
||||||
|
|
||||||
if(myIsPointsVisible)
|
if(myIsPointsVisible)
|
||||||
myPickableActor = myNodeActor;
|
myPickableActor = myNodeActor;
|
||||||
if(GetPointRepresentation())
|
|
||||||
myNodeActor->SetVisibility(true);
|
|
||||||
|
|
||||||
SetMapper(myPickableActor->GetMapper());
|
SetMapper(myPickableActor->GetMapper());
|
||||||
|
|
||||||
@ -1886,6 +1869,7 @@ void SMESH_ActorDef::UpdateHighlight()
|
|||||||
}
|
}
|
||||||
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
||||||
myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
|
myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
|
||||||
|
myNodeActor->GetProperty()->Modified();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,8 @@ void SMESH_CellLabelActor::RemoveFromRender(vtkRenderer* theRenderer)
|
|||||||
SMESH_DeviceActor::RemoveFromRender(theRenderer);
|
SMESH_DeviceActor::RemoveFromRender(theRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESH_CellLabelActor::UpdateLabels() {
|
void SMESH_CellLabelActor::UpdateLabels()
|
||||||
|
{
|
||||||
if(myIsCellsLabeled)
|
if(myIsCellsLabeled)
|
||||||
SetCellsLabeled(myIsCellsLabeled);
|
SetCellsLabeled(myIsCellsLabeled);
|
||||||
}
|
}
|
||||||
@ -207,7 +208,8 @@ void SMESH_CellLabelActor::UpdateLabels() {
|
|||||||
void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
|
void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
|
||||||
unsigned long theEvent,
|
unsigned long theEvent,
|
||||||
void* theClientData,
|
void* theClientData,
|
||||||
void* vtkNotUsed(theCallData)) {
|
void* vtkNotUsed(theCallData))
|
||||||
|
{
|
||||||
SMESH_CellLabelActor* self = reinterpret_cast<SMESH_CellLabelActor*>(theClientData);
|
SMESH_CellLabelActor* self = reinterpret_cast<SMESH_CellLabelActor*>(theClientData);
|
||||||
if(self)
|
if(self)
|
||||||
self->UpdateLabels();
|
self->UpdateLabels();
|
||||||
|
@ -88,7 +88,7 @@ SMESH_DeviceActor
|
|||||||
myIsShrunk = false;
|
myIsShrunk = false;
|
||||||
myIsHighlited = false;
|
myIsHighlited = false;
|
||||||
|
|
||||||
myRepresentation = eSurface;
|
myRepresentation = SMESH_DeviceActor::EReperesent(-1);
|
||||||
|
|
||||||
myProperty = vtkProperty::New();
|
myProperty = vtkProperty::New();
|
||||||
myMapper = VTKViewer_PolyDataMapper::New();
|
myMapper = VTKViewer_PolyDataMapper::New();
|
||||||
@ -306,7 +306,7 @@ SMESH_DeviceActor
|
|||||||
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
|
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
|
||||||
|
|
||||||
// SetStoreIDMapping(true);
|
// SetStoreIDMapping(true);
|
||||||
// myExtractUnstructuredGrid->Update();
|
myExtractUnstructuredGrid->Update();
|
||||||
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
|
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
|
||||||
|
|
||||||
aDataSet->ShallowCopy(aGrid);
|
aDataSet->ShallowCopy(aGrid);
|
||||||
@ -619,7 +619,19 @@ unsigned long int
|
|||||||
SMESH_DeviceActor
|
SMESH_DeviceActor
|
||||||
::GetMTime()
|
::GetMTime()
|
||||||
{
|
{
|
||||||
// cout << this->myExtractUnstructuredGrid
|
// cout << "DA " << this
|
||||||
|
// << " GF " << myGeomFilter;
|
||||||
|
// if ( this->Property )
|
||||||
|
// cout << " P " << this->Property->GetMTime();
|
||||||
|
// if ( this->BackfaceProperty != NULL )
|
||||||
|
// cout << " BP " << BackfaceProperty->GetMTime();
|
||||||
|
// if ( this->Texture != NULL )
|
||||||
|
// cout << " T " << this->Texture->GetMTime();
|
||||||
|
// cout << " U " << this->GetUserTransformMatrixMTime()
|
||||||
|
// << " M " << this->MTime.GetMTime() << endl;
|
||||||
|
|
||||||
|
// cout << "DA " << this
|
||||||
|
// << " GF " << myGeomFilter
|
||||||
// << " " << this->Superclass::GetMTime()
|
// << " " << this->Superclass::GetMTime()
|
||||||
// << " " << myExtractGeometry->GetMTime()
|
// << " " << myExtractGeometry->GetMTime()
|
||||||
// << " " << myExtractUnstructuredGrid->GetMTime()
|
// << " " << myExtractUnstructuredGrid->GetMTime()
|
||||||
@ -745,6 +757,8 @@ void
|
|||||||
SMESH_DeviceActor
|
SMESH_DeviceActor
|
||||||
::SetRepresentation(EReperesent theMode)
|
::SetRepresentation(EReperesent theMode)
|
||||||
{
|
{
|
||||||
|
if ( myRepresentation == theMode )
|
||||||
|
return;
|
||||||
switch(theMode){
|
switch(theMode){
|
||||||
case ePoint:
|
case ePoint:
|
||||||
myGeomFilter->SetInside(true);
|
myGeomFilter->SetInside(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user