Porting to BR-D5-38-2003 branch

This commit is contained in:
apo 2005-09-19 12:06:06 +00:00
parent fe629a0269
commit b2744d014d
6 changed files with 58 additions and 63 deletions

View File

@ -64,7 +64,7 @@ EXPORT_HEADERS= SMESH_Type.h \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \ CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \
-I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
-I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR} -I${GEOM_ROOT_DIR}/include/salome ${BOOST_CPPFLAGS}
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
-I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR} -I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
LDFLAGS += $(OCC_KERNEL_LIBS) -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeApp -lsuit LDFLAGS += $(OCC_KERNEL_LIBS) -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeApp -lsuit

View File

@ -2216,17 +2216,17 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
//======================================================================= //=======================================================================
void SMESHGUI_FilterDlg::insertFilterInViewer() void SMESHGUI_FilterDlg::insertFilterInViewer()
{ {
if (SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle()) { if (SVTK_Selector* aSelector = SMESH::GetSelector()) {
SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType(); SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
if (myFilter[ myTable->GetType() ]->_is_nil() || if (myFilter[ myTable->GetType() ]->_is_nil() ||
myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() || myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
!mySetInViewer->isChecked()) { !mySetInViewer->isChecked()) {
SMESH::RemoveFilter(getFilterId(anEntType), aStyle); SMESH::RemoveFilter(getFilterId(anEntType), aSelector);
} else { } else {
Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter(); Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter();
aFilter->SetPredicate(myFilter[ myTable->GetType() ]->GetPredicate()); aFilter->SetPredicate(myFilter[ myTable->GetType() ]->GetPredicate());
SMESH::SetFilter(aFilter, aStyle); SMESH::SetFilter(aFilter, aSelector);
} }
} }
} }

View File

@ -504,8 +504,8 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
myActor = SMESH::FindActorByEntry(aList.First()->getEntry()); myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
if (!myActor) if (!myActor)
myActor = SMESH::FindActorByObject(myMesh); myActor = SMESH::FindActorByObject(myMesh);
SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle(); SVTK_Selector* aSelector = SMESH::GetSelector();
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter(myFilterType); Handle(VTKViewer_Filter) aFilter = aSelector->GetFilter(myFilterType);
if (!aFilter.IsNull()) if (!aFilter.IsNull())
aFilter->SetActor(myActor); aFilter->SetActor(myActor);
} }
@ -605,9 +605,9 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted()
//======================================================================= //=======================================================================
bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
{ {
SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle(); SVTK_Selector* aSelector = SMESH::GetSelector();
Handle(SMESHGUI_Filter) aFilter = Handle(SMESHGUI_Filter) aFilter =
Handle(SMESHGUI_Filter)::DownCast(aStyle->GetFilter(myFilterType)); Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
return (!aFilter.IsNull() && aFilter->IsObjValid(theId)); return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
} }

View File

@ -308,8 +308,8 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const
QString entry = static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->entry(); QString entry = static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->entry();
SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() ); SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() );
if ( actor && actor->hasIO() ) { if ( actor && actor->hasIO() ) {
SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor(); if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView())
return QVariant( renderInter->isVisible( actor->getIO() ), 0 ); return QVariant( aViewWindow->isVisible( actor->getIO() ), 0 );
} }
} }
return QVariant( false, 0 ); return QVariant( false, 0 );

View File

@ -36,9 +36,7 @@
#include "SVTK_Selector.h" #include "SVTK_Selector.h"
#include "SVTK_ViewModel.h" #include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h" #include "SVTK_ViewWindow.h"
#include "SVTK_RenderWindow.h"
#include "SVTK_InteractorStyle.h" #include "SVTK_InteractorStyle.h"
#include "SVTK_RenderWindowInteractor.h"
#include "utilities.h" #include "utilities.h"
@ -448,85 +446,83 @@ namespace SMESH{
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ), double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ); SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 );
for ( int i=0, n=views.count(); i<n; i++ ) { for ( int i=0, n=views.count(); i<n; i++ ){
SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] ); // update VTK viewer properties
if (!aVtkView) continue; if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
// update VTK viewer properties // mesh element selection
SVTK_RenderWindowInteractor* anInteractor = aVtkView->getRWInteractor(); aVtkView->SetSelectionProp(aSelColor.red()/255.,
if (anInteractor) { aSelColor.green()/255.,
// mesh element selection aSelColor.blue()/255.,
anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255., SW );
aSelColor.blue()/255., SW ); // tolerances
aVtkView->SetSelectionTolerance(SP1, SP2);
// tolerances // pre-selection
anInteractor->SetSelectionTolerance(SP1, SP2); aVtkView->SetPreselectionProp(aPreColor.red()/255.,
aPreColor.green()/255.,
// pre-selection aPreColor.blue()/255.,
SVTK_InteractorStyle* aStyle = PW);
dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
if (aStyle) {
aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
aPreColor.blue()/255., PW);
}
}
// update actors // update actors
vtkRenderer* aRenderer = aVtkView->getRenderer(); vtkRenderer* aRenderer = aVtkView->getRenderer();
vtkActorCollection *aCollection = aRenderer->GetActors(); vtkActorCollection *aCollection = aRenderer->GetActors();
aCollection->InitTraversal(); aCollection->InitTraversal();
while(vtkActor *anAct = aCollection->GetNextActor()){ while(vtkActor *anAct = aCollection->GetNextActor()){
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){ if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255., anActor->SetHighlightColor(aHiColor.red()/255.,
aHiColor.green()/255.,
aHiColor.blue()/255.); aHiColor.blue()/255.);
anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255., anActor->SetPreHighlightColor(aPreColor.red()/255.,
aPreColor.green()/255.,
aPreColor.blue()/255.); aPreColor.blue()/255.);
} }
} }
}
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SVTK_InteractorStyle* GetInteractorStyle(SUIT_ViewWindow *theWindow){ SVTK_Selector*
if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow)){ GetSelector(SUIT_ViewWindow *theWindow)
if(SVTK_RenderWindowInteractor* anInteractor = aWnd->getRWInteractor()){ {
return dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() ); if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow))
} return aWnd->GetSelector();
}
return NULL; return NULL;
} }
void SetFilter(const Handle(VTKViewer_Filter)& theFilter, void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
SVTK_InteractorStyle* theStyle) SVTK_Selector* theSelector)
{ {
if (theStyle) if (theSelector)
theStyle->SetFilter(theFilter); theSelector->SetFilter(theFilter);
} }
Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_InteractorStyle* theStyle) Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_Selector* theSelector)
{ {
return theStyle->GetFilter(theId); return theSelector->GetFilter(theId);
} }
bool IsFilterPresent(int theId, SVTK_InteractorStyle* theStyle) bool IsFilterPresent(int theId, SVTK_Selector* theSelector)
{ {
return theStyle->IsFilterPresent(theId); return theSelector->IsFilterPresent(theId);
} }
void RemoveFilter(int theId, SVTK_InteractorStyle* theStyle) void RemoveFilter(int theId, SVTK_Selector* theSelector)
{ {
theStyle->RemoveFilter(theId); theSelector->RemoveFilter(theId);
} }
void RemoveFilters(SVTK_InteractorStyle* theStyle) void RemoveFilters(SVTK_Selector* theSelector)
{ {
for ( int id = SMESHGUI_NodeFilter; theStyle && id < SMESHGUI_LastFilter; id++ ) for ( int id = SMESHGUI_NodeFilter; theSelector && id < SMESHGUI_LastFilter; id++ )
theStyle->RemoveFilter( id ); theSelector->RemoveFilter( id );
} }
bool IsValid(SALOME_Actor* theActor, int theCellId, bool IsValid(SALOME_Actor* theActor, int theCellId,
SVTK_InteractorStyle* theStyle) SVTK_Selector* theSelector)
{ {
return theStyle->IsValid(theActor,theCellId); return theSelector->IsValid(theActor,theCellId);
} }

View File

@ -34,7 +34,6 @@ class SUIT_Study;
class SUIT_ViewWindow; class SUIT_ViewWindow;
class SUIT_ViewManager; class SUIT_ViewManager;
class SVTK_InteractorStyle;
class SVTK_ViewWindow; class SVTK_ViewWindow;
class SVTK_Selector; class SVTK_Selector;
@ -119,25 +118,25 @@ namespace SMESH{
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SVTK_InteractorStyle* SVTK_Selector*
GetInteractorStyle (SUIT_ViewWindow* = GetActiveWindow()); GetSelector(SUIT_ViewWindow* = GetActiveWindow());
void SetFilter (const Handle(VTKViewer_Filter)& theFilter, void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
SVTK_InteractorStyle* theStyle = GetInteractorStyle()); SVTK_Selector* theSelector = GetSelector());
Handle(VTKViewer_Filter) Handle(VTKViewer_Filter)
GetFilter (int theId, SVTK_InteractorStyle* theStyle = GetInteractorStyle()); GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
bool IsFilterPresent (int theId, bool IsFilterPresent (int theId,
SVTK_InteractorStyle* theStyle = GetInteractorStyle()); SVTK_Selector* theSelector = GetSelector());
void RemoveFilter (int theId, void RemoveFilter (int theId,
SVTK_InteractorStyle* theStyle = GetInteractorStyle()); SVTK_Selector* theSelector = GetSelector());
void RemoveFilters (SVTK_InteractorStyle* theStyle = GetInteractorStyle()); void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
bool IsValid (SALOME_Actor* theActor, int theCellId, bool IsValid (SALOME_Actor* theActor, int theCellId,
SVTK_InteractorStyle* theStyle = GetInteractorStyle()); SVTK_Selector* theSelector = GetSelector());
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int GetNameOfSelectedNodes(SVTK_Selector* theSelector, int GetNameOfSelectedNodes(SVTK_Selector* theSelector,