int SALOME_POINT_SIZE = 5;
int SALOME_LINE_WIDTH = 3;
-//----------------------------------------------------------------------------
namespace
{
int
{
int anEdgeId = 0;
if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
- float aPickPosition[3];
+ vtkFloatingPointType aPickPosition[3];
thePicker->GetPickPosition(aPickPosition);
- float aMinDist = 1000000.0, aDist = 0;
+ vtkFloatingPointType aMinDist = 1000000.0, aDist = 0;
for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
- int subId; float pcoords[3], closestPoint[3], weights[3];
+ int subId;
+ vtkFloatingPointType pcoords[3], closestPoint[3], weights[3];
aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
if (aDist < aMinDist) {
aMinDist = aDist;
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SALOME_Actor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SALOME_Actor
::SALOME_Actor():
myRenderer(NULL),
myOutlineActor->SetVisibility( false );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SALOME_Actor
::~SALOME_Actor()
{}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the SALOME_Actor has a reference to SALOME_InteractiveObject
+*/
Standard_Boolean
SALOME_Actor
::hasIO()
return !myIO.IsNull();
}
+/*!
+ \return correspoinding reference to SALOME_InteractiveObject
+*/
const Handle(SALOME_InteractiveObject)&
SALOME_Actor
::getIO()
return myIO;
}
+/*!
+ Sets reference to SALOME_InteractiveObject
+ \param theIO - new SALOME_InteractiveObject
+*/
void
SALOME_Actor
::setIO(const Handle(SALOME_InteractiveObject)& theIO)
myIO = theIO;
}
+/*!
+ Sets name the SALOME_Actor
+ \param theName - new name
+*/
void
SALOME_Actor
::setName(const char* theName)
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes the actor in all its internal devices
+*/
void
SALOME_Actor
::AddToRender(vtkRenderer* theRenderer)
theRenderer->AddActor( myOutlineActor.GetPointer() );
}
+/*!
+ Removes the actor from all its internal devices
+*/
void
SALOME_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
theRenderer->RemoveActor( myOutlineActor.GetPointer() );
}
+/*!
+ \return reference on renderer where it is published
+*/
vtkRenderer*
SALOME_Actor
::GetRenderer()
return myRenderer;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Sets interactor in order to use vtkInteractorObserver devices
+ \param theInteractor - new interactor
+*/
void
SALOME_Actor
::SetInteractor(vtkRenderWindowInteractor* theInteractor)
myInteractor = theInteractor;
}
+/*!
+ Put a request to redraw the view
+*/
void
SALOME_Actor
::Update()
myInteractor->CreateTimer(VTKI_TIMER_UPDATE);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply view transformation
+ \param theTransform - transformation
+*/
void
SALOME_Actor
::SetTransform(VTKViewer_Transform* theTransform)
myOutlineActor->SetTransform(theTransform);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
-::SetPosition(float _arg1, float _arg2, float _arg3)
+::SetPosition(vtkFloatingPointType _arg1,
+ vtkFloatingPointType _arg2,
+ vtkFloatingPointType _arg3)
{
Superclass::SetPosition(_arg1,_arg2,_arg3);
myOutlineActor->SetPosition(_arg1,_arg2,_arg3);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
-::SetPosition(float _arg[3])
+::SetPosition(vtkFloatingPointType _arg[3])
{
SetPosition(_arg[0],_arg[1],_arg[2]);
}
-
-//----------------------------------------------------------------
+/*!
+ Shows/hides actor
+ \param theVisibility - new visibility state
+*/
void
SALOME_Actor
::SetVisibility( int theVisibility )
}
}
-
-//----------------------------------------------------------------
+/*!
+ Set selector in order to the actor at any time can restore current selection
+ \param theSelector - new selector
+*/
void
SALOME_Actor
::SetSelector(SVTK_Selector* theSelector)
mySelector = theSelector;
}
+/*!
+ To map current selection to VTK representation
+*/
void
SALOME_Actor
::Highlight(bool theIsHighlight)
highlight(theIsHighlight);
}
+/*!
+ Updates visibility of the highlight devices
+*/
void
SALOME_Actor
::highlight(bool theIsHighlight)
{
- float aBounds[6];
+ vtkFloatingPointType aBounds[6];
GetInput()->GetBounds(aBounds);
myOutline->SetBounds(aBounds);
myOutlineActor->SetVisibility( GetVisibility() && theIsHighlight );
}
-//----------------------------------------------------------------
+/*!
+ To process prehighlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::PreHighlight(vtkInteractorStyle *theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if ( !GetPickable() )
+ return false;
+
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
//
myPreHighlightActor->SetVisibility( false );
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
bool anIsChanged = (mySelectionMode != aSelectionMode);
- float x = theSelectionEvent->myX;
- float y = theSelectionEvent->myY;
- float z = 0.0;
+ vtkFloatingPointType x = theSelectionEvent->myX;
+ vtkFloatingPointType y = theSelectionEvent->myY;
+ vtkFloatingPointType z = 0.0;
if( !theIsHighlight ) {
SetPreSelected( false );
return anIsChanged;
}
-
-//----------------------------------------------------------------
+/*!
+ To process highlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::Highlight(vtkInteractorStyle *theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if ( !GetPickable() )
+ return false;
+
myOutlineActor->SetVisibility( false );
myHighlightActor->SetVisibility( false );
//
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
bool anIsShift = theSelectionEvent->myIsShift;
- if( !anIsShift ) {
+ if( !anIsShift || !theIsHighlight ) {
mySelector->RemoveIObject( this );
}
- float x = theSelectionEvent->myX;
- float y = theSelectionEvent->myY;
- float z = 0.0;
+ if ( !theIsHighlight )
+ return true;
+
+ vtkFloatingPointType x = theSelectionEvent->myX;
+ vtkFloatingPointType y = theSelectionEvent->myY;
+ vtkFloatingPointType z = 0.0;
if( !theSelectionEvent->myIsRectangle ) {
switch(aSelectionMode){
break;
}
}else{
- float xLast = theSelectionEvent->myLastX;
- float yLast = theSelectionEvent->myLastY;
- float zLast = 0.0;
+ vtkFloatingPointType xLast = theSelectionEvent->myLastX;
+ vtkFloatingPointType yLast = theSelectionEvent->myLastY;
+ vtkFloatingPointType zLast = 0.0;
- float x1 = x < xLast ? x : xLast;
- float y1 = y < yLast ? y : yLast;
- float z1 = z < zLast ? z : zLast;
- float x2 = x > xLast ? x : xLast;
- float y2 = y > yLast ? y : yLast;
- float z2 = z > zLast ? z : zLast;
+ vtkFloatingPointType x1 = x < xLast ? x : xLast;
+ vtkFloatingPointType y1 = y < yLast ? y : yLast;
+ vtkFloatingPointType z1 = z < zLast ? z : zLast;
+ vtkFloatingPointType x2 = x > xLast ? x : xLast;
+ vtkFloatingPointType y2 = y > yLast ? y : yLast;
+ vtkFloatingPointType z2 = z > zLast ? z : zLast;
switch(aSelectionMode){
case NodeSelection: {
if(aMapIter != aVectorIdsMap.end()){
const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
vtkIdType anEnd = aVectorIds.size();
- SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
int aPointId = aVectorIds[anId];
if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
}
case ActorSelection :
{
- float aPnt[3];
- float* aBounds = GetBounds();
+ vtkFloatingPointType aPnt[3];
+ vtkFloatingPointType* aBounds = GetBounds();
bool anIsPicked = true;
for( int i = 0; i <= 1; i++ ) {
if(aMapIter != aVectorIdsMap.end()){
const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
vtkIdType anEnd = aVectorIds.size();
- SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
int aCellId = aVectorIds[anId];
if ( !mySelector->IsValid( this, aCellId ) )
return true;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a picker for nodal selection (initialized by SVTK_Renderer::AddActor)
+ \param thePointPicker - new picker
+*/
void
SALOME_Actor
::SetPointPicker(vtkPointPicker* thePointPicker)
myPointPicker = thePointPicker;
}
+/*!
+ To set up a picker for cell selection (initialized by SVTK_Renderer::AddActor)
+ \param theCellPicker - new picker
+*/
void
SALOME_Actor
::SetCellPicker(vtkCellPicker* theCellPicker)
myCellPicker = theCellPicker;
}
+/*!
+ To set up a picker for point rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetPointRectPicker(SVTK_RectPicker* theRectPicker)
myPointRectPicker = theRectPicker;
}
+/*!
+ To set up a picker for cell rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetCellRectPicker(SVTK_RectPicker* theRectPicker)
myCellRectPicker = theRectPicker;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a prehighlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetPreHighlightProperty(vtkProperty* theProperty)
myPreHighlightActor->SetProperty(theProperty);
}
+/*!
+ To set up a highlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetHighlightProperty(vtkProperty* theProperty)