/*! SAN & VSR : Test QT_EVENT
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/
- void DoSomething();
+ void CreateTestView();
+ void ShowTestObject();
/*! SAN & VSR : Test QT_EVENT
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*/
# header files
EXPORT_HEADERS= \
- VisuGUI_NonIsometricDlg.h
+ VisuGUI_NonIsometricDlg.h \
+ VisuGUI_Swig.hxx \
+ VisuGUI_Swig.i
# .po files to transform in .qm
PO_FILES = \
VisuGUI_TimeAnimation.cxx \
VisuGUI_CutLinesDlg.cxx \
VisuGUI_FileDlg.cxx \
- VisuGUI_EditContainerDlg.cxx
+ VisuGUI_EditContainerDlg.cxx \
+ VisuGUI_Swig.cxx
LIB_MOC = \
VisuGUI.h \
-I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(MED2_LIBS) $(HDF5_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
- -lVisuObject -lVISUEngine -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
+ -lVisuObject -lVISUEngine -lVISUEvent -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@
#include "VisuGUI.h"
+#include "VISU_Event.h"
+
#include "VISU_Gen_i.hh"
#include "VISU_Result_i.hh"
#include "VISU_PrsObject_i.hh"
/* ======================================================================================== */
/* Import Table from file */
/* ======================================================================================== */
-
case 199:
{
if(checkLock(aStudy)) break;
case 111:
{
+ ShowTestObject();
+ break;
visuGUI->CopyAndImportFile();
break;
}
case 112:
{
+ ShowTestObject();
+ break;
visuGUI->ImportFile();
break;
}
//===========================================================================
bool VisuGUI::CanProcessEvent(SALOME_Event* se)
{
-// return ( se && se->getType() > VISU_FIRST_EVENT && se->getType() < VISU_LAST_EVENT );
- return true;
+ if ( se && se->getType() >= VISU_START_EVENT && se->getType() < VISU_Event::LastEvent ) {
+ VISU_Event* ve = dynamic_cast<VISU_Event*>( se );
+ if ( ve )
+ return true;
+ }
+ return false;
}
//===========================================================================
//===========================================================================
bool VisuGUI::ProcessEvent(SALOME_Event* se)
{
- return true;
+ if ( se && se->getType() >= VISU_START_EVENT && se->getType() < VISU_Event::LastEvent ) {
+ VISU_Event* ve = dynamic_cast<VISU_Event*>( se );
+ if ( ve ) {
+ switch ( se->getType() ) {
+ case VISU_Event::CreateTestViewEvent:
+ VisuGUI::CreateTestView();
+ break;
+ case VISU_Event::ShowTestObjectEvent:
+ VisuGUI::ShowTestObject();
+ break;
+ }
+ return true;
+ }
+ }
+ return false;
}
void VisuGUI::SelectionInfo() {
visuGUI = new VisuGUI( "" );
return visuGUI;
}
-
-//***************************************
-// san - obsolete code - TO BE REMOVED!
-// No extern "C" fucntions below will be necessary!
-//**************************************
-
- bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
- {
- //if(MYDEBUG) MESSAGE("VisuGUI::OnGUIEvent "<< theCommandID);
- return visuGUI->OnGUIEvent(theCommandID, parent);
- }
-
- bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- if(MYDEBUG) MESSAGE("VisuGUI::OnKeyPress ");
- return visuGUI->OnKeyPress (pe, parent, studyFrame);
- }
-
- bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- //if(MYDEBUG) MESSAGE("VisuGUI::OnMousePress ");
- return visuGUI->OnMousePress (pe, parent, studyFrame);
- }
-
- bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- //if(MYDEBUG) MESSAGE("VisuGUI::OnMouseMove ");
- return visuGUI->OnMouseMove (pe, parent, studyFrame);
- }
-
- bool SetSettings ( QAD_Desktop* parent )
- {
- return visuGUI->SetSettings( parent );
- }
-
- bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject )
- {
- return visuGUI->CustomPopup( parent, popup, theContext, theParent, theObject );
- }
-
- void definePopup ( QString & theContext, QString & theParent, QString & theObject )
- {
- visuGUI->DefinePopup( theContext, theParent, theObject );
- }
-
- bool activeStudyChanged ( QAD_Desktop* parent )
- {
- //VisuGUI::activeStudyChanged( parent );
- }
- void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
- {
- visuGUI->BuildPresentation(theIO);
- }
-
- void supportedViewType(int* buffer, int bufferSize)
- {
- if (!buffer || !bufferSize) return;
- buffer[0] = (int)VIEW_VTK;
- if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
- }
-
}
-//***************************************
-// san - temporary code - TO BE REMOVED!
-// No extern "C" fucntions will be necessary!
-//**************************************
//////////////////////////////////////////////////////////////////////////////////
this->myActiveDialogBox = (QDialog*)aDlg ;
return ;
}
+
+void VisuGUI::CreateTestView()
+{
+ QAD_Desktop* desktop = VisuGUI::GetDesktop();
+ QAD_Study* aStudy = desktop->getActiveStudy();
+ if ( !aStudy ) {
+ QString defViewer = QAD_CONFIG->getSetting( "Viewer::DefaultViewer" );
+ int dv = defViewer.toInt();
+ QAD_CONFIG->addSetting( "Viewer::DefaultViewer", QString::number( VIEW_VTK ) );
+ desktop->createStudy();
+ if ( !defViewer.isEmpty() ) {
+ QAD_CONFIG->addSetting( "Viewer::DefaultViewer", QString::number( dv ) );
+}
+ }
+ else {
+ aStudy->newWindow3d( "", VIEW_VTK );
+ }
+}
+
+#include <vtkSphereSource.h>
+#include <vtkPolyDataMapper.h>
+
+void VisuGUI::ShowTestObject()
+{
+ MESSAGE("1")
+ vtkSphereSource* aSource = vtkSphereSource::New();
+ MESSAGE("2")
+ aSource->SetRadius( 100. );
+ MESSAGE("3")
+
+ vtkProperty* prop = vtkProperty::New();
+ MESSAGE("4")
+
+ vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
+ MESSAGE("5")
+ aMapper->SetInput( aSource->GetOutput() );
+ MESSAGE("6")
+
+ vtkActor* sphere = vtkActor::New();
+ MESSAGE("7")
+ sphere->SetMapper( aMapper );
+ MESSAGE("8")
+ sphere->SetProperty( prop );
+ MESSAGE("9")
+
+ QAD_Desktop* desktop = VisuGUI::GetDesktop();
+ MESSAGE("10")
+ QAD_Study* aStudy = desktop->getActiveStudy();
+ MESSAGE("11")
+ if ( !aStudy ) {
+ CreateTestView();
+ MESSAGE("12")
+ }
+ MESSAGE("13")
+ VTKViewer_ViewFrame* vf = (VTKViewer_ViewFrame*)(desktop->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame());
+ MESSAGE("14")
+ sphere->SetVisibility( true );
+ MESSAGE("15")
+ vf->getRenderer()->AddActor(sphere);
+ MESSAGE("16")
+ vf->Repaint();
+ MESSAGE("17")
+}
static SALOMEDS::Study_var GetStudyDocument();
static SALOMEDS::StudyBuilder_var NewBuilder();
static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
+ static void CreateTestView();
+ static void ShowTestObject();
static VISU::Result_i* CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
--- /dev/null
+// VISU VISUGUI : GUI for VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Swig.cxx
+// Author : Vadim SANDLER
+// Module : VISU
+// $Header$
+
+using namespace std;
+#include "VisuGUI_Swig.hxx"
+#include "VISU_Event.h"
+#include <qapplication.h>
+
+VISU_Swig::VISU_Swig()
+{
+}
+
+VISU_Swig::~VISU_Swig()
+{
+}
+
+void VISU_Swig::CreateTestView()
+{
+ VISU_Event* ve = new VISU_Event( VISU_Event::CreateTestViewEvent, false );
+ ve->process();
+ qApp->processEvents();
+}
+
+void VISU_Swig::ShowTestObject()
+{
+ VISU_Event* ve = new VISU_Event( VISU_Event::ShowTestObjectEvent, false );
+ ve->process();
+ qApp->processEvents();
+}
--- /dev/null
+// VISU VISUGUI : GUI for VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Swig.hxx
+// Author : Vadim SANDLER
+// Module : VISU
+// $Header$
+
+#ifndef _VISUGUI_SWIG_HXX_
+#define _VISUGUI_SWIG_HXX_
+
+class VISU_Swig
+{
+public:
+ VISU_Swig();
+ ~VISU_Swig();
+
+ void CreateTestView();
+ void ShowTestObject();
+};
+
+#endif
--- /dev/null
+// VISU VISUGUI : GUI for VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Swig.i
+// Author : Vadim SANDLER
+// Module : VISU
+// $Header$
+
+%{
+#include "VisuGUI_Swig.hxx"
+%}
+
+class VISU_Swig
+{
+ public:
+ VISU_Swig();
+ ~VISU_Swig();
+
+ void CreateTestView();
+ void ShowTestObject();
+};
#include "SALOME_Event.hxx"
-// VISU event types: 10000...11000
+// VISU event types: 10000...10999
#define VISU_START_EVENT 10000
/* Customized VISU component event */
public:
enum {
CreateTestViewEvent = VISU_START_EVENT,
- ShowTestObjectEent,
- LastEvent = VISU_START_EVENT + 999 };
+ ShowTestObjectEvent,
+ LastEvent = VISU_START_EVENT + 1000 };
VISU_Event( int eventType, bool wait );
virtual ~VISU_Event();
LDFLAGS += $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
-lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer -lSalomeHDFPersist \
- -lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj -lEvent \
+ -lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj -lVISUEvent \
-L${KERNEL_ROOT_DIR}/lib/salome
LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d \
#include <qstring.h>
#include <qfileinfo.h>
-#include "SALOME_Event.hxx"
+#include "VISU_Event.h"
using namespace std;
/*! SAN & VSR : Test QT_EVENT
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/
- #define TEST_EVENT 1
- void VISU_Gen_i::DoSomething() {
- MESSAGE("VISU_Gen_i::DoSomething : myMutex = "<<myMutex);
+ void VISU_Gen_i::CreateTestView() {
if(myMutex){
- MESSAGE( "VISU_Gen_i::DoSomething started" );
- SALOME_Semaphore s;
- QThread::postEvent( qApp, new SALOME_Event( TEST_EVENT, &s ) );
- s += 1;
- MESSAGE( "VISU_Gen_i::DoSomething completed" );
+ VISU_Event* ve = new VISU_Event( VISU_Event::CreateTestViewEvent, true );
+ ve->process();
return;
}
- myVisuGen->DoSomething();
+ myVisuGen->CreateTestView();
+ }
+
+ void VISU_Gen_i::ShowTestObject() {
+ if(myMutex){
+ VISU_Event* ve = new VISU_Event( VISU_Event::ShowTestObjectEvent, true );
+ ve->process();
+ return;
+ }
+ myVisuGen->ShowTestObject();
}
/*! SAN & VSR : Test QT_EVENT
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/*! SAN & VSR : Test QT_EVENT
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/
- virtual void DoSomething();
+ virtual void CreateTestView();
+ virtual void ShowTestObject();
/*! SAN & VSR : Test QT_EVENT
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*/
CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(QT_INCLUDES) \
$(VTK_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES)
-LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine
+LDFLAGS += $(PYTHON_LIBS) $(VTK_LIBS) -lVisuConvertor -lVisuPipeLine -lVISUGUI
@CONCLUDE@
\ No newline at end of file
from batchmode_salome import *
import visu
+sg = SalomeGUI()
+
myVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,myStudy,10)
if myVisu is None:
raise RuntimeError, "myVisu is none, VISU component is not loaded or found"
#include "VISU_Gen_s.hh"
%}
+%include "VisuGUI_Swig.i"
class Convertor{
public: