X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_Actor.cxx;h=f46baed8c209f16c2f12169b01fbb0a9e4bf338f;hp=28cd31fc00e2f30fe85733dbccacce3a69241c3b;hb=d4a710ce52f6e76786a7b3845e2f7975dc9a00b1;hpb=44a302322ae982588a6422a45f710069950faafd diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 28cd31fc0..f46baed8c 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -172,6 +172,7 @@ SMESH_ActorDef::SMESH_ActorDef() aFilter->RegisterCellsWithType(VTK_QUAD); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); my2DExtProp = vtkProperty::New(); my2DExtProp->DeepCopy(mySurfaceProp); @@ -193,6 +194,7 @@ SMESH_ActorDef::SMESH_ActorDef() aFilter->RegisterCellsWithType(VTK_QUAD); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); my3DActor = SMESH_CellLabelActor::New(); my3DActor->SetStoreGemetryMapping(true); @@ -201,6 +203,7 @@ SMESH_ActorDef::SMESH_ActorDef() my3DActor->SetProperty(mySurfaceProp); my3DActor->SetBackfaceProperty(myBackSurfaceProp); my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface); + my3DActor->SetCoincident3DAllowed(true); aFilter = my3DActor->GetExtractUnstructuredGrid(); aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); aFilter->RegisterCellsWithType(VTK_TETRA); @@ -208,8 +211,10 @@ SMESH_ActorDef::SMESH_ActorDef() aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_WEDGE); aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); @@ -224,6 +229,7 @@ SMESH_ActorDef::SMESH_ActorDef() my3DExtActor->SetProperty(my2DExtProp); my3DExtActor->SetBackfaceProperty(my2DExtProp); my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface); + my3DExtActor->SetCoincident3DAllowed(true); aFilter = my3DExtActor->GetExtractUnstructuredGrid(); aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); aFilter->RegisterCellsWithType(VTK_TETRA); @@ -231,8 +237,10 @@ SMESH_ActorDef::SMESH_ActorDef() aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_WEDGE); aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); @@ -370,7 +378,7 @@ SMESH_ActorDef::SMESH_ActorDef() myBaseActor->SetStoreGemetryMapping(true); myBaseActor->GetProperty()->SetOpacity(0.0); myPickableActor = myBaseActor; - + myHighlightProp = vtkProperty::New(); myHighlightProp->SetAmbient(1.0); myHighlightProp->SetDiffuse(0.0); @@ -378,6 +386,7 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) ); myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myHighlightProp->SetPointSize(aElem0DSize); // ?? + myHighlightProp->SetLineWidth(aLineWidth); myHighlightProp->SetRepresentation(1); myOutLineProp = vtkProperty::New(); @@ -387,6 +396,7 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) ); myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myOutLineProp->SetPointSize(aElem0DSize); // ?? + myOutLineProp->SetLineWidth(aLineWidth); myOutLineProp->SetRepresentation(1); myPreselectProp = vtkProperty::New(); @@ -396,12 +406,14 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) ); myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreselectProp->SetPointSize(aElem0DSize); // ?? + myPreselectProp->SetLineWidth(aLineWidth); myPreselectProp->SetRepresentation(1); myHighlitableActor = SMESH_DeviceActor::New(); myHighlitableActor->SetUserMatrix(aMatrix); myHighlitableActor->PickableOff(); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); + myHighlitableActor->SetCoincident3DAllowed(true); aMatrix->Delete(); @@ -480,9 +492,6 @@ SMESH_ActorDef::~SMESH_ActorDef() } #endif - // caught by SMESHGUI::ProcessEvents() static method - this->InvokeEvent( SMESH::DeleteActorEvent, NULL ); - myScalarBarActor->Delete(); myLookupTable->Delete(); @@ -526,6 +535,17 @@ SMESH_ActorDef::~SMESH_ActorDef() myTimeStamp->Delete(); } +void SMESH_ActorDef::Delete() +{ + // This is just to guarantee that the DeleteActorEvent (which was previously invoked + // from the actor's destructor) will be thrown before removing the actor's observers, + // that is done inside the Superclass::Delete() method but before the destructor itself + // (see the issue 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash). + // The event is caught by SMESHGUI::ProcessEvents() static method. + this->InvokeEvent( SMESH::DeleteActorEvent, NULL ); + + Superclass::Delete(); +} void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled ) { @@ -685,6 +705,27 @@ SetControlMode(eControl theMode, myFunctor.reset(new SMESH::Controls::FreeFaces()); myControlActor = my2DActor; break; + case eCoincidentNodes: + { + SMESH::Controls::CoincidentNodes* cn = new SMESH::Controls::CoincidentNodes(); + double tol = mgr->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 ); + cn->SetTolerance( tol ); + myFunctor.reset(cn); + myControlActor = myNodeActor; + break; + } + case eCoincidentElems1D: + myFunctor.reset(new SMESH::Controls::CoincidentElements1D()); + myControlActor = my1DActor; + break; + case eCoincidentElems2D: + myFunctor.reset(new SMESH::Controls::CoincidentElements2D()); + myControlActor = my2DActor; + break; + case eCoincidentElems3D: + myFunctor.reset(new SMESH::Controls::CoincidentElements3D()); + myControlActor = my3DActor; + break; case eBareBorderFace: myFunctor.reset(new SMESH::Controls::BareBorderFace()); myControlActor = my2DActor; @@ -803,19 +844,23 @@ SetControlMode(eControl theMode, myControlMode = theMode; switch(myControlMode){ case eFreeNodes: + case eCoincidentNodes: myNodeExtActor->SetExtControlMode(myFunctor); break; case eFreeEdges: case eFreeBorders: + case eCoincidentElems1D: my1DExtActor->SetExtControlMode(myFunctor); break; case eFreeFaces: case eBareBorderFace: case eOverConstrainedFace: + case eCoincidentElems2D: my2DExtActor->SetExtControlMode(myFunctor); break; case eBareBorderVolume: case eOverConstrainedVolume: + case eCoincidentElems3D: my3DExtActor->SetExtControlMode(myFunctor); break; case eLength2D: @@ -846,21 +891,21 @@ SetControlMode(eControl theMode, if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eFaces); break; default: if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eFaces); } }else if(myControlActor == my3DActor) { if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eVolumes); } } @@ -1193,19 +1238,23 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ if(myControlMode != eNone){ switch(myControlMode){ case eFreeNodes: + case eCoincidentNodes: myNodeExtActor->VisibilityOn(); break; case eFreeEdges: case eFreeBorders: + case eCoincidentElems1D: my1DExtActor->VisibilityOn(); break; case eFreeFaces: case eBareBorderFace: case eOverConstrainedFace: + case eCoincidentElems2D: my2DExtActor->VisibilityOn(); break; case eBareBorderVolume: case eOverConstrainedVolume: + case eCoincidentElems3D: my3DExtActor->VisibilityOn(); break; case eLength2D: @@ -1336,12 +1385,14 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) aFilter->RegisterCellsWithType(VTK_QUAD); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); aHightFilter->RegisterCellsWithType(VTK_TRIANGLE); aHightFilter->RegisterCellsWithType(VTK_POLYGON); aHightFilter->RegisterCellsWithType(VTK_QUAD); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); } if (myEntityMode & eVolumes) { @@ -1351,8 +1402,10 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_WEDGE); aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); //#ifdef VTK_HAVE_POLYHEDRON @@ -1364,8 +1417,10 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON); aHightFilter->RegisterCellsWithType(VTK_WEDGE); aHightFilter->RegisterCellsWithType(VTK_PYRAMID); + aHightFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aHightFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); @@ -1772,8 +1827,11 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){ myEdgeProp->SetLineWidth(theVal); my1DProp->SetLineWidth(theVal + aLineWidthInc); - my1DExtProp->SetLineWidth(theVal + aLineWidthInc); - + my1DExtProp->SetLineWidth(theVal + aLineWidthInc); + my2DExtProp->SetLineWidth(theVal + aLineWidthInc); + myOutLineProp->SetLineWidth(theVal); + myHighlightProp->SetLineWidth(theVal); + myPreselectProp->SetLineWidth(theVal); Modified(); }