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
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \
-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 \
-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

View File

@ -2216,17 +2216,17 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
//=======================================================================
void SMESHGUI_FilterDlg::insertFilterInViewer()
{
if (SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle()) {
if (SVTK_Selector* aSelector = SMESH::GetSelector()) {
SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
if (myFilter[ myTable->GetType() ]->_is_nil() ||
myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
!mySetInViewer->isChecked()) {
SMESH::RemoveFilter(getFilterId(anEntType), aStyle);
SMESH::RemoveFilter(getFilterId(anEntType), aSelector);
} else {
Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter();
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());
if (!myActor)
myActor = SMESH::FindActorByObject(myMesh);
SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter(myFilterType);
SVTK_Selector* aSelector = SMESH::GetSelector();
Handle(VTKViewer_Filter) aFilter = aSelector->GetFilter(myFilterType);
if (!aFilter.IsNull())
aFilter->SetActor(myActor);
}
@ -605,9 +605,9 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted()
//=======================================================================
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)::DownCast(aStyle->GetFilter(myFilterType));
Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
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();
SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() );
if ( actor && actor->hasIO() ) {
SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
return QVariant( renderInter->isVisible( actor->getIO() ), 0 );
if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView())
return QVariant( aViewWindow->isVisible( actor->getIO() ), 0 );
}
}
return QVariant( false, 0 );

View File

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