#include <SMESH_PreviewActorsCollection.h>
Public Member Functions | |
| SMESH_PreviewActorsCollection () | |
| ~SMESH_PreviewActorsCollection () | |
| virtual void | AddToRender (vtkRenderer *theRenderer) |
| virtual void | RemoveFromRender (vtkRenderer *theRenderer) |
| bool | Init (const TopoDS_Shape &theShape, TopAbs_ShapeEnum subShapeType=TopAbs_EDGE, const QString &=QString("")) |
| void | SetSelector (SVTK_Selector *) |
| void | HighlightAll (bool) |
| void | HighlightID (int) |
| GEOM_Actor * | GetActorByIndex (int) |
| int | GetIndexByShape (const TopoDS_Shape &) |
| void | SetShown (bool) |
Protected Member Functions | |
| GEOM_Actor * | createActor (const TopoDS_Shape &) |
Protected Attributes | |
| TopoDS_Shape | myMainShape |
| SVTK_Selector * | mySelector |
| vtkRenderer * | myRenderer |
| TopTools_IndexedMapOfShape | myMapOfShapes |
| QMap< int, GEOM_Actor * > | myMapOfActors |
Definition at line 42 of file SMESH_PreviewActorsCollection.h.
| SMESH_PreviewActorsCollection::SMESH_PreviewActorsCollection | ( | ) |
Definition at line 64 of file SMESH_PreviewActorsCollection.cxx.
References MESSAGE.
| SMESH_PreviewActorsCollection::~SMESH_PreviewActorsCollection | ( | ) |
Definition at line 71 of file SMESH_PreviewActorsCollection.cxx.
References MESSAGE.
{
if(MYDEBUG) MESSAGE("~SMESH_PreviewActorsCollection - "<<this);
if (myRenderer)
RemoveFromRender(myRenderer);
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
for ( ; iter != myMapOfActors.end(); ++iter )
if ( GEOM_Actor* anActor = iter.value() )
anActor->Delete();
myMapOfActors.clear();
}
| void SMESH_PreviewActorsCollection::AddToRender | ( | vtkRenderer * | theRenderer | ) | [virtual] |
Definition at line 170 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.updateState().
{
myRenderer = theRenderer;
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
for ( ; iter != myMapOfActors.end(); ++iter )
iter.value()->AddToRender( theRenderer );
}
| GEOM_Actor * SMESH_PreviewActorsCollection::createActor | ( | const TopoDS_Shape & | shape | ) | [protected] |
Definition at line 130 of file SMESH_PreviewActorsCollection.cxx.
{
GEOM_Actor* actor = GEOM_Actor::New();
actor->SetShape(shape,0,0);
//Color Properties
/*
vtkProperty* aProp = vtkProperty::New();
vtkProperty* aHLProp = vtkProperty::New();
vtkProperty* aPHLProp = vtkProperty::New();
aProp->SetColor( 255, 0, 0);
actor->SetProperty(aProp);
aHLProp->SetColor( 255, 255, 255);
actor->SetHighlightProperty(aHLProp);
aPHLProp->SetColor( 155, 155, 155);
aPHLProp->SetLineWidth ( 3 );
aPHLProp->SetOpacity ( 0.75 );
actor->SetPreHighlightProperty(aPHLProp);
aProp->Delete();
aHLProp->Delete();
aPHLProp->Delete();
*/
return actor;
}
| GEOM_Actor * SMESH_PreviewActorsCollection::GetActorByIndex | ( | int | index | ) |
Definition at line 160 of file SMESH_PreviewActorsCollection.cxx.
{
return myMapOfActors.value(index);
}
| int SMESH_PreviewActorsCollection::GetIndexByShape | ( | const TopoDS_Shape & | theShape | ) |
Definition at line 165 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.SelectionIntoArgument().
{
return myMapOfShapes.FindIndex( theShape );
}
| void SMESH_PreviewActorsCollection::HighlightAll | ( | bool | theHighlight | ) |
Definition at line 190 of file SMESH_PreviewActorsCollection.cxx.
{
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
for ( ; iter != myMapOfActors.end(); ++iter )
iter.value()->Highlight( theHighlight );
}
| void SMESH_PreviewActorsCollection::HighlightID | ( | int | index | ) |
Definition at line 196 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.onListSelectionChanged(), and StdMeshersGUI_SubShapeSelectorWdg.SelectionIntoArgument().
{
GEOM_Actor* anActor = GetActorByIndex( index );
if ( anActor && !anActor->isHighlighted() )
anActor->Highlight( true );
}
| bool SMESH_PreviewActorsCollection::Init | ( | const TopoDS_Shape & | theShape, |
| TopAbs_ShapeEnum | subShapeType = TopAbs_EDGE, |
||
| const QString & | theEntry = QString("") |
||
| ) |
Definition at line 84 of file SMESH_PreviewActorsCollection.cxx.
References Handle().
Referenced by StdMeshersGUI_SubShapeSelectorWdg.updateState().
{
myMainShape = theShape;
myMapOfActors.clear();
myMapOfShapes.Clear();
if ( theShape.IsNull() )
return false;
Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
anIO->setEntry( theEntry.toLatin1().constData() );
// get indexes of seleted elements
TopExp::MapShapes(theShape, myMapOfShapes);
TopExp_Explorer exp( theShape, theType );
for ( ; exp.More(); exp.Next() ) {
int index = myMapOfShapes.FindIndex( exp.Current() );
if ( index && !myMapOfActors.contains( index ) ) {
// create actor if the index is present
if ( GEOM_Actor* anActor = createActor( exp.Current().Oriented(TopAbs_FORWARD))) {
// Create new entry for actor
QString aString = theEntry;
aString += QString("_%1").arg( index ); // add index to actor entry
// Create interactive object
Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
anIO->setEntry( aString.toLatin1().constData() );
// Init Actor
anActor->SetVectorMode( theType==TopAbs_EDGE );
anActor->setIO( anIO );
anActor->SetSelector( mySelector );
anActor->SetPickable( true );
anActor->SetResolveCoincidentTopology( true );
// Add Actor to the Actors Map
myMapOfActors.insert(index, anActor);
}
}
}
mySelector->ClearIObjects();
return true;
}
| void SMESH_PreviewActorsCollection::RemoveFromRender | ( | vtkRenderer * | theRenderer | ) | [virtual] |
Definition at line 179 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.~StdMeshersGUI_SubShapeSelectorWdg().
{
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
for ( ; iter != myMapOfActors.end(); ++iter )
iter.value()->RemoveFromRender( theRenderer );
}
| void SMESH_PreviewActorsCollection::SetSelector | ( | SVTK_Selector * | theSelector | ) |
Definition at line 185 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.updateState().
{
mySelector = theSelector;
}
| void SMESH_PreviewActorsCollection::SetShown | ( | bool | shown | ) |
Definition at line 202 of file SMESH_PreviewActorsCollection.cxx.
Referenced by StdMeshersGUI_SubShapeSelectorWdg.showPreview(), and StdMeshersGUI_SubShapeSelectorWdg.updateState().
{
QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
for ( ; iter != myMapOfActors.end(); ++iter )
iter.value()->SetVisibility( shown );
}
TopoDS_Shape SMESH_PreviewActorsCollection.myMainShape [protected] |
Definition at line 68 of file SMESH_PreviewActorsCollection.h.
QMap<int, GEOM_Actor*> SMESH_PreviewActorsCollection.myMapOfActors [protected] |
Definition at line 72 of file SMESH_PreviewActorsCollection.h.
TopTools_IndexedMapOfShape SMESH_PreviewActorsCollection.myMapOfShapes [protected] |
Definition at line 71 of file SMESH_PreviewActorsCollection.h.
vtkRenderer* SMESH_PreviewActorsCollection.myRenderer [protected] |
Definition at line 70 of file SMESH_PreviewActorsCollection.h.
SVTK_Selector* SMESH_PreviewActorsCollection.mySelector [protected] |
Definition at line 69 of file SMESH_PreviewActorsCollection.h.