#include "LightApp_VTKSelector.h"
#include "LightApp_DataOwner.h"
-#include "SVTK_ViewModel.h"
+#include "SVTK_ViewModelBase.h"
#include "SVTK_Selector.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_Functor.h"
*/
LightApp_SVTKDataOwner
::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIds,
- Selection_Mode theMode,
- SALOME_Actor* theActor):
+ const TColStd_IndexedMapOfInteger& theIds,
+ Selection_Mode theMode,
+ SALOME_Actor* theActor):
LightApp_DataOwner( theIO ),
mySelectionMode(theMode),
myActor(theActor)
Constructor.
*/
LightApp_VTKSelector
-::LightApp_VTKSelector( SVTK_Viewer* viewer,
- SUIT_SelectionMgr* mgr ):
+::LightApp_VTKSelector( SVTK_ViewModelBase* viewer,
+ SUIT_SelectionMgr* mgr ):
SUIT_Selector( mgr, viewer ),
myViewer( viewer )
{
/*!
Gets viewer.
*/
-SVTK_Viewer*
+SVTK_ViewModelBase*
LightApp_VTKSelector
::viewer() const
{
}
/*!
- Gets type of vtk viewer.
+ Gets type of salome vtk viewer.
*/
QString
LightApp_VTKSelector
::type() const
{
- return SVTK_Viewer::Type();
+ return myViewer->getType();
}
/*!
TColStd_IndexedMapOfInteger anIds;
aSelector->GetIndex(anIO,anIds);
SALOME_Actor* anActor = aSelector->GetActor(anIO);
- if( !anActor )
- anActor = VTK::Find<SALOME_Actor>(aView->getRenderer()->GetActors(),VTK::TIsSameIObject<SALOME_Actor>(anIO));
-
+ if( !anActor ){
+ using namespace SVTK;
+ anActor = Find<SALOME_Actor>(aView->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(anIO));
+ }
aList.append(new LightApp_SVTKDataOwner(anIO,anIds,aMode,anActor));
}
}
#include "SALOME_InteractiveObject.hxx"
class SALOME_Actor;
-class SVTK_Viewer;
+class SVTK_ViewModelBase;
/*!
Provide salome vtk data owner list.
Q_OBJECT;
public:
- LightApp_VTKSelector( SVTK_Viewer*, SUIT_SelectionMgr* );
+ LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
virtual ~LightApp_VTKSelector();
- SVTK_Viewer* viewer() const;
+ SVTK_ViewModelBase* viewer() const;
virtual QString type() const;
virtual void setSelection( const SUIT_DataOwnerPtrList& );
private:
- SVTK_Viewer* myViewer;
+ SVTK_ViewModelBase* myViewer;
};
#endif
SVTK_ViewModel.h \
SVTK_View.h
-LIB_CLIENT_IDL = \
- SALOMEDS.idl \
- SALOMEDS_Attributes.idl \
- SALOME_Exception.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_GenericObj.idl
-
BIN = SVTK
CPPFLAGS+= \
#include "SVTK_MainWindow.h"
#include "SVTK_Prs.h"
-#include "VTKViewer_ViewModel.h"
-
-#include "ToolsGUI.h"
-
#include "SALOME_Actor.h"
#include "SALOME_InteractiveObject.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "SALOME_ModuleCatalog_impl.hxx"
-#include "SALOME_NamingService.hxx"
-
-#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_StudyManager.hxx"
-
// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from
// SALOMEDS::StudyManager - no linkage with SalomeApp.
-static _PTR(Study) getStudyDS()
-{
- SALOMEDSClient_Study* aStudy = NULL;
- _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
-
+// Temporarily commented to avoid awful dependecy on SALOMEDS
+// TODO: better mechanism of storing display/erse status in a study
+// should be provided...
+//static _PTR(Study) getStudyDS()
+//{
+// SALOMEDSClient_Study* aStudy = NULL;
+// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
// get id of SUIT_Study, if it's a SalomeApp_Study, it will return
// id of its underlying SALOMEDS::Study
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if ( !app ) return _PTR(Study)(aStudy);
- SUIT_Study* stud = app->activeStudy();
- if ( !stud ) return _PTR(Study)(aStudy);
- const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
+// SUIT_Application* app = SUIT_Session::session()->activeApplication();
+// if ( !app ) return _PTR(Study)(aStudy);
+// SUIT_Study* stud = app->activeStudy();
+// if ( !stud ) return _PTR(Study)(aStudy);
+// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
// get SALOMEDS_Study with this id from StudyMgr
- return aMgr->GetStudyByID( id );
-}
+// return aMgr->GetStudyByID( id );
+//}
//==========================================================
-SVTK_Viewer
-::SVTK_Viewer()
+SVTK_Viewer::SVTK_Viewer()
{
myTrihedronSize = 105;
}
//==========================================================
-SVTK_Viewer
-::~SVTK_Viewer()
+SVTK_Viewer::~SVTK_Viewer()
{
}
SVTK_Viewer
::contextMenuPopup( QPopupMenu* thePopup )
{
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+ thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+ thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
thePopup->insertSeparator();
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
if ( !aView->getView()->GetMainWindow()->getToolBar()->isVisible() ){
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+ thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
}
}
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
// get SALOMEDS Study
- _PTR(Study) aStudy(getStudyDS());
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ // _PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor()){
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
- }
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+ //}
// just display the object
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
// get SALOMEDS Study
- _PTR(Study) aStudy(getStudyDS());
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //_PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor())
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
- }
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ //}
// just display the object
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
SVTK_Viewer
::EraseAll( const bool forced )
{
- _PTR(Study) aStudy(getStudyDS());
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //_PTR(Study) aStudy(getStudyDS());
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
while(vtkActor* anActor = anActorCollection->GetNextActor()){
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// Set visibility flag
- Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
- ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
if(forced)
aRenderer->RemoveActor(anAct);
else{
#define SVTK_VIEWMODEL_H
#include "SVTK.h"
+#include "SUIT_ViewModel.h"
#include "SVTK_ViewModelBase.h"
-#include "VTKViewer_ViewModel.h"
-
#include "SALOME_Prs.h"
#include "SALOME_InteractiveObject.hxx"
+++ /dev/null
-#include "SalomeApp_VTKSelector.h"
-#include "SalomeApp_DataOwner.h"
-
-#include "SVTK_ViewModelBase.h"
-#include "SVTK_Selector.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Functor.h"
-
-#include "SALOME_Actor.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "VTKViewer_Algorithm.h"
-
-#include <vtkRenderer.h>
-
-#include "utilities.h"
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-/*!
- Constructor.
-*/
-SalomeApp_SVTKDataOwner
-::SalomeApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIds,
- Selection_Mode theMode,
- SALOME_Actor* theActor):
- SalomeApp_DataOwner( theIO ),
- mySelectionMode(theMode),
- myActor(theActor)
-{
- myIds = theIds; // workaround - there is no constructor copy for the container
-}
-
-/*!
- Destuctor.
-*/
-SalomeApp_SVTKDataOwner
-::~SalomeApp_SVTKDataOwner()
-{
-}
-
-/*!
- Gets actor pointer.
-*/
-SALOME_Actor*
-SalomeApp_SVTKDataOwner
-::GetActor() const
-{
- return myActor.GetPointer();
-}
-
-/*!
- Constructor.
-*/
-SalomeApp_VTKSelector
-::SalomeApp_VTKSelector( SVTK_ViewModelBase* viewer,
- SUIT_SelectionMgr* mgr ):
- SUIT_Selector( mgr, viewer ),
- myViewer( viewer )
-{
- if ( myViewer )
- connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
-}
-
-/*!
- Destructor.
-*/
-SalomeApp_VTKSelector
-::~SalomeApp_VTKSelector()
-{
-}
-
-/*!
- Gets viewer.
-*/
-SVTK_ViewModelBase*
-SalomeApp_VTKSelector
-::viewer() const
-{
- return myViewer;
-}
-
-/*!
- Gets type of salome vtk viewer.
-*/
-QString
-SalomeApp_VTKSelector
-::type() const
-{
- return myViewer->getType();
-}
-
-/*!
- On selection changed.
-*/
-void
-SalomeApp_VTKSelector
-::onSelectionChanged()
-{
- selectionChanged();
-}
-
-/*!
- Gets list of selected data owners.(output \a aList).
-*/
-void
-SalomeApp_VTKSelector
-::getSelection( SUIT_DataOwnerPtrList& aList ) const
-{
- using namespace SVTK;
- if(myViewer){
- if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
- if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
- if(SVTK_Selector* aSelector = aView->GetSelector()){
- Selection_Mode aMode = aSelector->SelectionMode();
- const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for(; anIter.More(); anIter.Next()){
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(anIO->hasEntry()){
- TColStd_IndexedMapOfInteger anIds;
- aSelector->GetIndex(anIO,anIds);
- SALOME_Actor* anActor = aSelector->GetActor(anIO);
- if( !anActor )
- anActor = Find<SALOME_Actor>(aView->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(anIO));
-
- aList.append(new SalomeApp_SVTKDataOwner(anIO,anIds,aMode,anActor));
- if(MYDEBUG) MESSAGE("VTKSelector::getSelection - "<<anIO->getEntry());
- }
- }
- }
- }
- }
- }
-}
-
-/*!
- Sets selection to selector from data owner list \a theList.
-*/
-void
-SalomeApp_VTKSelector
-::setSelection( const SUIT_DataOwnerPtrList& theList )
-{
- if(myViewer){
- if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
- if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
- if(SVTK_Selector* aSelector = aView->GetSelector()){
- SALOME_ListIO anAppendList;
- const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
- SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
- for(; anIter != theList.end(); ++anIter){
- const SUIT_DataOwner* aDataOwner = (*anIter).get();
- if(const SalomeApp_SVTKDataOwner* anOwner = dynamic_cast<const SalomeApp_SVTKDataOwner*>(aDataOwner)){
- aSelector->SetSelectionMode(anOwner->GetMode());
- Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
-
- if( anOwner->GetActor() )
- aSelector->AddIObject( anOwner->GetActor() );
- else
- aSelector->AddIObject(anIO);
-
- anAppendList.Append(anIO);
- aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
- if(MYDEBUG) MESSAGE("VTKSelector::setSelection - SVTKDataOwner - "<<anIO->getEntry());
- }else if(const SalomeApp_DataOwner* anOwner = dynamic_cast<const SalomeApp_DataOwner*>(aDataOwner)){
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(anOwner->entry().latin1(),"");
- aSelector->AddIObject(anIO);
- anAppendList.Append(anIO);
- if(MYDEBUG) MESSAGE("VTKSelector::setSelection - DataOwner - "<<anIO->getEntry());
- }
- }
- // To remove IOs, which is not selected.
- QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;
- SALOME_ListIteratorOfListIO anIt( aStoredList );
- for( ; anIt.More(); anIt.Next() )
- if( !anIt.Value().IsNull() )
- toRemove[ anIt.Value()->getEntry() ] = anIt.Value();
-
- anIt = SALOME_ListIteratorOfListIO(anAppendList);
- for( ; anIt.More(); anIt.Next() )
- toRemove.remove( anIt.Value()->getEntry() );
-
- QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
- REnd = toRemove.end();
- for( ; RIt!=REnd; RIt++ )
- aSelector->RemoveIObject( RIt.data() );
-
- aView->onSelectionChanged();
- }
- }
- }
- }
-}
+++ /dev/null
-#ifndef SALOMEAPP_VTKSELECTOR_H
-#define SALOMEAPP_VTKSELECTOR_H
-
-#include <vtkSmartPointer.h>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#include "SUIT_Selector.h"
-
-#include "SalomeApp.h"
-#include "SalomeApp_DataOwner.h"
-
-#include "SVTK_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-
-class SALOME_Actor;
-class SVTK_ViewModelBase;
-
-/*!
- Provide salome vtk data owner list.
-*/
-class SalomeApp_SVTKDataOwner : public SalomeApp_DataOwner
-{
- public:
- SalomeApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIds,
- Selection_Mode theMode = ActorSelection,
- SALOME_Actor* theActor = NULL);
- virtual ~SalomeApp_SVTKDataOwner();
-
- /*!Gets dataowners ids list.*/
- const TColStd_IndexedMapOfInteger& GetIds() const
- {
- return myIds;
- }
-
- /*!Gets selection mode.*/
- Selection_Mode GetMode() const
- {
- return mySelectionMode;
- }
-
- SALOME_Actor* GetActor() const;
-
- protected:
- TColStd_IndexedMapOfInteger myIds;
- Selection_Mode mySelectionMode;
- vtkSmartPointer<SALOME_Actor> myActor;
-};
-
-
-/*!
- Provide salome vtk selection of data owners.
-*/
-class SALOMEAPP_EXPORT SalomeApp_VTKSelector : public SUIT_Selector
-{
- Q_OBJECT;
-
-public:
- SalomeApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
- virtual ~SalomeApp_VTKSelector();
-
- SVTK_ViewModelBase* viewer() const;
-
- virtual QString type() const;
-
-private slots:
- void onSelectionChanged();
-
-protected:
- virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
- virtual void setSelection( const SUIT_DataOwnerPtrList& );
-
-private:
- SVTK_ViewModelBase* myViewer;
-};
-
-#endif
<parameter name="OCCViewer" value="${SUITRoot}/resources"/>
<parameter name="VTKViewer" value="${SUITRoot}/resources"/>
<parameter name="SVTK" value="${SUITRoot}/resources"/>
+ <parameter name="LightApp" value="${SUITRoot}/resources"/>
<parameter name="SalomeApp" value="${SUITRoot}/resources"/>
<parameter name="OB" value="${SUITRoot}/resources"/>
<parameter name="CAM" value="${SUITRoot}/resources"/>
<parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
<parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
<parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources"/>
<parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
<parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources"/>
<parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
<parameter name="COMPONENT" value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="HELLO" value="${HELLO1_ROOT_DIR}/share/salome/resources"/>
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="ToolsGUI" value="${SUITRoot}/resources"/>
<parameter name="name" value="Geometry"/>
<parameter name="icon" value="ModuleGeom.png"/>
</section>
+ <section name="LIGHT">
+ <parameter name="name" value="Light"/>
+ <parameter name="icon" value="LIGHT.png"/>
+ </section>
<section name="SMESH">
<parameter name="name" value="Mesh"/>
<parameter name="icon" value="ModuleMesh.png"/>
<parameter name="name" value="Med"/>
<parameter name="icon" value="ModuleMed.png"/>
</section>
+ <section name="HELLO">
+ <parameter name="name" value="Hello"/>
+ <parameter name="icon" value="HELLO.png"/>
+ </section>
<!-- values below this line are just an example, they are not used -->
<section name="application">
<parameter value="true" name="ShowLegend" />
<parameter value="0" name="VerScaleMode" />
</section>
+ <section name="SUPERVGraph" >
+ <parameter value="144, 208, 211" name="Background" />
+ <parameter value="63, 213, 255" name="Title" />
+ </section>
<section name="Geometry" >
<parameter value="10" name="SettingsGeomStep" />
<parameter value="0" name="display_mode" />