Class showing shapes without publishing. More...
Public Member Functions | |
| TShapeDisplayer () | |
| ~TShapeDisplayer () | |
| void | DeleteActors () |
| void | SetVisibility (bool theVisibility) |
| bool | HasReadyActorsFor (int subShapeID, GEOM::GEOM_Object_var aMainShape) |
| void | Show (int subShapeID, GEOM::GEOM_Object_var aMainShape, bool only=false) |
Private Types | |
| typedef std::vector< GEOM_Actor * > | TActorVec |
| typedef SMDS_SetIterator < GEOM_Actor *, TActorVec::const_iterator > | TActorIterator |
Private Member Functions | |
| TActorIterator | actorIterator () |
| TActorIterator | shownIterator () |
| GEOM_Actor * | getActor (const TopoDS_Shape &shape) |
| void | checkTriangulation (const TopoDS_Shape &shape) |
| bool | hasViewWindow () const |
Private Attributes | |
| TActorVec | myActors |
| TActorVec | myShownActors |
| TopTools_IndexedMapOfShape | myIndexToShape |
| std::string | myMainEntry |
| SVTK_ViewWindow * | myViewWindow |
| vtkProperty * | myProperty |
| std::set< int > | myBuiltSubs |
Class showing shapes without publishing.
Definition at line 147 of file SMESHGUI_ComputeDlg.cxx.
typedef SMDS_SetIterator< GEOM_Actor*, TActorVec::const_iterator> SMESH.TShapeDisplayer.TActorIterator [private] |
Definition at line 262 of file SMESHGUI_ComputeDlg.cxx.
typedef std::vector<GEOM_Actor*> SMESH.TShapeDisplayer.TActorVec [private] |
Definition at line 252 of file SMESHGUI_ComputeDlg.cxx.
| SMESH.TShapeDisplayer.TShapeDisplayer | ( | ) |
Definition at line 151 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.myProperty.
: myViewWindow(0) { myProperty = vtkProperty::New(); myProperty->SetRepresentationToWireframe(); myProperty->SetColor( 250, 0, 250 ); myProperty->SetAmbientColor( 250, 0, 250 ); myProperty->SetDiffuseColor( 250, 0, 250 ); //myProperty->SetSpecularColor( 250, 0, 250 ); myProperty->SetLineWidth( 5 ); }
| SMESH.TShapeDisplayer.~TShapeDisplayer | ( | ) |
Definition at line 162 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.DeleteActors(), and SMESH.TShapeDisplayer.myProperty.
{
DeleteActors();
myProperty->Delete();
}
| TActorIterator SMESH.TShapeDisplayer.actorIterator | ( | ) | [private] |
Definition at line 263 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.myActors.
Referenced by SMESH.TShapeDisplayer.DeleteActors().
{
return TActorIterator( myActors.begin(), myActors.end() );
}
| void SMESH.TShapeDisplayer.checkTriangulation | ( | const TopoDS_Shape & | shape | ) | [private] |
Definition at line 293 of file SMESHGUI_ComputeDlg.cxx.
References deflection(), SMESH_test.edge, SMESH.Handle(), Max(), and MESH.
Referenced by SMESH.TShapeDisplayer.Show().
{
TopLoc_Location aLoc;
Standard_Boolean alreadymesh = Standard_True;
TopExp_Explorer ex(shape, TopAbs_FACE);
if ( ex.More() )
for ( ; ex.More(); ex.Next()) {
const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc);
if(aPoly.IsNull()) { alreadymesh = Standard_False; break; }
}
else
for (ex.Init(shape, TopAbs_EDGE); ex.More(); ex.Next()) {
const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D(edge, aLoc);
if(aPoly.IsNull()) { alreadymesh = Standard_False; break; }
}
if (alreadymesh) return;
// Compute default deflection
Bnd_Box B;
BRepBndLib::Add(shape, B);
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
double deflection = Max( aXmax-aXmin, Max ( aYmax-aYmin, aZmax-aZmin)) * 0.01 *4;
BRepMesh_IncrementalMesh MESH(shape,deflection);
}
| void SMESH.TShapeDisplayer.DeleteActors | ( | ) |
Definition at line 168 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.actorIterator(), SMESH.TShapeDisplayer.hasViewWindow(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.more(), SMESH.TShapeDisplayer.myActors, SMESH.TShapeDisplayer.myBuiltSubs, SMESH.TShapeDisplayer.myIndexToShape, SMESH.TShapeDisplayer.myShownActors, SMESH.TShapeDisplayer.myViewWindow, and SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.next().
Referenced by SMESH.TShapeDisplayer.Show(), and SMESH.TShapeDisplayer.~TShapeDisplayer().
{
if ( hasViewWindow() ) {
TActorIterator actorIt = actorIterator();
while ( actorIt.more() )
if (VTKViewer_Actor* anActor = actorIt.next()) {
myViewWindow->RemoveActor( anActor );
//anActor->Delete();
}
}
myIndexToShape.Clear();
myActors.clear();
myShownActors.clear();
myBuiltSubs.clear();
}
| GEOM_Actor* SMESH.TShapeDisplayer.getActor | ( | const TopoDS_Shape & | shape | ) | [private] |
Definition at line 270 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.myActors, SMESH.TShapeDisplayer.myIndexToShape, SMESH.TShapeDisplayer.myProperty, and SMESH.TShapeDisplayer.myViewWindow.
Referenced by SMESH.TShapeDisplayer.Show().
{
int index = myIndexToShape.FindIndex( shape ) - 1;
if ( index < 0 || index >= myActors.size() )
return 0;
GEOM_Actor* & actor = myActors[ index ];
if ( !actor ) {
actor = GEOM_Actor::New();
if ( actor ) {
actor->SetShape(shape,0,0);
actor->SetProperty(myProperty);
actor->SetShadingProperty(myProperty);
actor->SetWireframeProperty(myProperty);
actor->SetPreviewProperty(myProperty);
actor->PickableOff();
// if ( shape.ShapeType() == TopAbs_EDGE )
// actor->SubShapeOn();
myViewWindow->AddActor( actor );
}
}
return actor;
}
Definition at line 193 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.myBuiltSubs, and SMESH.TShapeDisplayer.myMainEntry.
Referenced by SMESHGUI_BaseComputeOp.currentCellChanged().
{
std::string mainEntry;
if ( !aMainShape->_is_nil() )
mainEntry = aMainShape->GetStudyEntry();
return ( myMainEntry == mainEntry &&
myBuiltSubs.find( subShapeID ) != myBuiltSubs.end() );
}
| bool SMESH.TShapeDisplayer.hasViewWindow | ( | ) | const [private] |
Definition at line 320 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.FindVtkViewWindow(), SMESHGUI.GetSMESHGUI(), and SMESH.TShapeDisplayer.myViewWindow.
Referenced by SMESH.TShapeDisplayer.DeleteActors().
{
if ( !myViewWindow ) return false;
if ( SalomeApp_Application* anApp = SMESHGUI::GetSMESHGUI()->getApp() )
return FindVtkViewWindow( anApp->getViewManager(SVTK_Viewer::Type(), false ),
myViewWindow );
return false;
}
| void SMESH.TShapeDisplayer.SetVisibility | ( | bool | theVisibility | ) |
Definition at line 184 of file SMESHGUI_ComputeDlg.cxx.
References SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.more(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.next(), SMESH.RepaintCurrentView(), and SMESH.TShapeDisplayer.shownIterator().
Referenced by SMESHGUI_BaseComputeOp.currentCellChanged(), SMESHGUI_BaseComputeOp.onShowBadMesh(), SMESH.TShapeDisplayer.Show(), and SMESHGUI_BaseComputeOp.stopOperation().
{
TActorIterator actorIt = shownIterator();
while ( actorIt.more() )
if (VTKViewer_Actor* anActor = actorIt.next())
anActor->SetVisibility(theVisibility);
SMESH::RepaintCurrentView();
}
| void SMESH.TShapeDisplayer.Show | ( | int | subShapeID, |
| GEOM::GEOM_Object_var | aMainShape, | ||
| bool | only = false |
||
| ) |
Definition at line 202 of file SMESHGUI_ComputeDlg.cxx.
References SMESH_fixation.aShape, SMESH.TShapeDisplayer.checkTriangulation(), SMESH.TShapeDisplayer.DeleteActors(), SMESH_test.edge, SMESH.TShapeDisplayer.getActor(), SMESHGUI.GetSMESHGUI(), SMESH.GetViewWindow(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.more(), SMESH.TShapeDisplayer.myActors, SMESH.TShapeDisplayer.myBuiltSubs, SMESH.TShapeDisplayer.myIndexToShape, SMESH.TShapeDisplayer.myMainEntry, SMESH.TShapeDisplayer.myShownActors, SMESH.TShapeDisplayer.myViewWindow, SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.next(), SMESH.TShapeDisplayer.SetVisibility(), and SMESH.TShapeDisplayer.shownIterator().
Referenced by SMESHGUI_BaseComputeOp.currentCellChanged(), and SMESHGUI_BaseComputeOp.onPreviewShape().
{
SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() );
std::string mainEntry;
if ( !aMainShape->_is_nil() )
mainEntry = aMainShape->GetStudyEntry();
if ( myMainEntry != mainEntry || aViewWindow != myViewWindow ) { // remove actors
DeleteActors();
TopoDS_Shape aShape;
if ( !aMainShape->_is_nil() && GEOMBase::GetShape(aMainShape, aShape)) {
checkTriangulation( aShape );
TopExp::MapShapes(aShape, myIndexToShape);
myActors.resize( myIndexToShape.Extent(), 0 );
myShownActors.reserve( myIndexToShape.Extent() );
}
myMainEntry = mainEntry;
myViewWindow = aViewWindow;
}
if ( only ) { // hide shown actors
TActorIterator actorIt = shownIterator();
while ( actorIt.more() )
if (VTKViewer_Actor* anActor = actorIt.next())
anActor->SetVisibility(false);
myShownActors.clear();
}
// find actors to show
TopoDS_Shape aShape = myIndexToShape( subShapeID );
if ( !aShape.IsNull() ) {
TopAbs_ShapeEnum type( aShape.ShapeType() >= TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE );
for ( TopExp_Explorer exp( aShape, type ); exp.More(); exp.Next() ) {
//checkTriangulation( exp.Current() );
if ( GEOM_Actor* anActor = getActor( exp.Current() ))
myShownActors.push_back( anActor );
}
if ( type == TopAbs_FACE ) {
for ( TopExp_Explorer exp( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) {
const TopoDS_Edge & edge = TopoDS::Edge( exp.Current() );
if ( !BRep_Tool::Degenerated( edge ))
if ( GEOM_Actor* anActor = getActor( exp.Current() ))
myShownActors.push_back( anActor );
}
}
}
myBuiltSubs.insert( subShapeID );
SetVisibility(true);
}
| TActorIterator SMESH.TShapeDisplayer.shownIterator | ( | ) | [private] |
Definition at line 266 of file SMESHGUI_ComputeDlg.cxx.
References SMESH.TShapeDisplayer.myShownActors.
Referenced by SMESH.TShapeDisplayer.SetVisibility(), and SMESH.TShapeDisplayer.Show().
{
return TActorIterator( myShownActors.begin(), myShownActors.end() );
}
TActorVec SMESH.TShapeDisplayer.myActors [private] |
Definition at line 253 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.actorIterator(), SMESH.TShapeDisplayer.DeleteActors(), SMESH.TShapeDisplayer.getActor(), and SMESH.TShapeDisplayer.Show().
std::set<int> SMESH.TShapeDisplayer.myBuiltSubs [private] |
Definition at line 259 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.DeleteActors(), SMESH.TShapeDisplayer.HasReadyActorsFor(), and SMESH.TShapeDisplayer.Show().
TopTools_IndexedMapOfShape SMESH.TShapeDisplayer.myIndexToShape [private] |
Definition at line 255 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.DeleteActors(), SMESH.TShapeDisplayer.getActor(), and SMESH.TShapeDisplayer.Show().
std::string SMESH.TShapeDisplayer.myMainEntry [private] |
Definition at line 256 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.HasReadyActorsFor(), and SMESH.TShapeDisplayer.Show().
vtkProperty* SMESH.TShapeDisplayer.myProperty [private] |
Definition at line 258 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.getActor(), SMESH.TShapeDisplayer.TShapeDisplayer(), and SMESH.TShapeDisplayer.~TShapeDisplayer().
TActorVec SMESH.TShapeDisplayer.myShownActors [private] |
Definition at line 254 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.DeleteActors(), SMESH.TShapeDisplayer.Show(), and SMESH.TShapeDisplayer.shownIterator().
SVTK_ViewWindow* SMESH.TShapeDisplayer.myViewWindow [private] |
Definition at line 257 of file SMESHGUI_ComputeDlg.cxx.
Referenced by SMESH.TShapeDisplayer.DeleteActors(), SMESH.TShapeDisplayer.getActor(), SMESH.TShapeDisplayer.hasViewWindow(), and SMESH.TShapeDisplayer.Show().