# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
- caf CAM CASCatch DDS Event LightApp LogWindow ObjBrowser OpenGLUtils
+ caf CAM CASCatch DDS Event LightApp LogWindow ObjBrowser
QDS qtx SalomePrs SalomeStyle std SUITApp suit ViewerTools ViewerData
ImageComposer
)
# GL specific targets:
IF(SALOME_USE_GLVIEWER)
LIST(APPEND _${PROJECT_NAME}_exposed_targets
- GLViewer)
+ OpenGLUtils GLViewer)
ENDIF(SALOME_USE_GLVIEWER)
# VTK specific targets:
ENDIF()
ENDMACRO(SALOME_GUI_WITH_CORBA)
-#----------------------------------------------------------------------------
-# FULL_GUI is a macro useful for determining whether a GUI module
-# builded in full mode
-#----------------------------------------------------------------------------
-MACRO(FULL_GUI)
- SET(_options)
- LIST(APPEND _options SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_VTKVIEWER
- SALOME_USE_PLOT2DVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_QXGRAPHVIEWER
- SALOME_USE_SALOMEOBJECT SALOME_USE_PYCONSOLE)
- SALOME_GUI_MODE(${_options})
-ENDMACRO(FULL_GUI)
#----------------------------------------------------------------------------
# SALOME_GUI_MODE is a macro useful for determining whether a GUI module
# builded in particular mode
#----------------------------------------------------------------------------
#########################################################################
-# FULL_GUI()
+# SALOME_GUI_MODE()
#
-# USAGE: FULL_GUI(_options)
+# USAGE: SALOME_GUI_MODE(_options)
#
# ARGUMENTS:
# _options [input] List - The list of CMake options given to SALOME GUI
#
-MACRO(SALOME_GUI_MODE _options)
- MESSAGE(STATUS "Checking status of GUI options ${_options}")
- SET(_message)
- FOREACH(_option ${_options})
- IF(NOT ${_option})
- LIST(APPEND _message ${_option})
+# Notes:
+# The arguments list can include "OPTIONAL" keywords:
+# * All arguments preceded by "OPTIONAL" keyword are mandatory for current module.
+# If GUI module was compiled without this functionality, further installation
+# of the current module becomes impossible.
+# * All arguments following "OPTIONAL" keyword are optional for current module, which
+# uses this functionality, but can be installed without it.
+#
+MACRO(SALOME_GUI_MODE)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS " Checking status of GUI options")
+ MESSAGE(STATUS " ==================================== ")
+ MESSAGE(STATUS "")
+ SET(_message)
+ SET(_length 25)
+ SET(_is_optional OFF)
+ FOREACH(_option ${ARGN})
+ IF(${_option} STREQUAL "OPTIONAL")
+ SET(_is_optional ON)
+ MESSAGE(STATUS " Optional:")
+ ELSE()
+ SALOME_JUSTIFY_STRING(${_option} ${_length} _option_name)
+ MESSAGE(STATUS " * ${_option_name} -> ${${_option}}")
+ IF(NOT ${_option} AND NOT ${_is_optional})
+ LIST(APPEND _message ${_option})
+ ENDIF()
ENDIF()
ENDFOREACH()
+ MESSAGE(STATUS "")
+
IF(_message)
- SET(_message "We absolutely need a Salome GUI module in full mode.\nThe following options should be set to ON when building GUI module:\n${_message}\n")
- IF(_corba_message)
- MESSAGE(FATAL_ERROR "${_corba_message}\n${_message}")
- ELSE()
- MESSAGE(FATAL_ERROR "${_message}")
- ENDIF()
- ELSEIF(_corba_message)
- MESSAGE(FATAL_ERROR "${_corba_message}")
- ENDIF()
+ SET(_message "We absolutely need a Salome GUI module in special mode. The following options should be set to ON when building GUI module: \n${_message}\n")
+ MESSAGE(FATAL_ERROR "${_message}")
+ ENDIF()
ENDMACRO(SALOME_GUI_MODE)
##
SET(SUBDIRS_COMMON
CASCatch Qtx HelpBrowser Style DDS QDS ObjBrowser SUIT SUITApp STD CAF
- CAM LogWindow Prs Event OpenGLUtils ViewerData ViewerTools ImageComposer GUI_PY
+ CAM LogWindow Prs Event ViewerData ViewerTools ImageComposer GUI_PY
)
##
# GL viewer
##
IF(SALOME_USE_GLVIEWER)
- SET(SUBDIRS_GLVIEWER GLViewer)
+ SET(SUBDIRS_GLVIEWER OpenGLUtils GLViewer)
ENDIF(SALOME_USE_GLVIEWER)
##
${CAS_KERNEL}
${QT_LIBRARIES}
${HDF5_LIBRARIES}
- CASCatch qtx suit std SalomeStyle SalomePrs CAM LogWindow ObjBrowser
+ CASCatch qtx suit std SalomeStyle SalomePrs CAM LogWindow ObjBrowser Event
${KERNEL_SalomeHDFPersist} ${KERNEL_SALOMELocalTrace}
)
IF(SALOME_USE_SALOMEOBJECT)
${PTHREAD_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/CASCatch
${PROJECT_SOURCE_DIR}/src/Qtx
- ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
${PROJECT_SOURCE_DIR}/src/SUIT
${PROJECT_SOURCE_DIR}/src/ViewerData
${PROJECT_SOURCE_DIR}/src/ViewerTools
)
+IF(SALOME_USE_GLVIEWER)
+ INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
+ )
+ENDIF()
# additional preprocessor / compiler flags
ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS})
SET(_link_LIBRARIES
${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo}
${CAS_TKTopAlgo} ${CAS_TKG2d} ${CAS_TKOpenGl}
- CASCatch qtx suit OpenGLUtils ViewerTools ViewerData
+ CASCatch qtx suit ViewerTools ViewerData
)
+IF(SALOME_USE_GLVIEWER)
+ LIST(APPEND _link_LIBRARIES
+ OpenGLUtils
+ )
+ENDIF()
+
# --- headers ---
# header files / to be processed by moc
#include <QtxMultiAction.h>
#include <QtxRubberBand.h>
-#include <OpenGLUtils_FrameBuffer.h>
+#ifndef DISABLE_GLVIEWER
+ #include <OpenGLUtils_FrameBuffer.h>
+#endif
#include <QPainter>
#include <QTime>
view->Redraw(); // In order to reactivate GL context
//view->Update();
+#ifndef DISABLE_GLVIEWER
OpenGLUtils_FrameBuffer aFrameBuffer;
if( aFrameBuffer.init( aWidth, aHeight ) )
{
glReadPixels( p.x(), p.y(), aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE,
data);
+#endif
*/
Image_PixMap aPix;
# --- options ---
-INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS}
- ${QT_INCLUDES}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src/SUIT
- ${CMAKE_SOURCE_DIR}/src/CAM
- ${CMAKE_SOURCE_DIR}/src/STD
- ${CMAKE_SOURCE_DIR}/src/Qtx
- ${CMAKE_SOURCE_DIR}/src/Event
- ${CMAKE_SOURCE_DIR}/src/PyInterp
- ${CMAKE_SOURCE_DIR}/src/PyConsole
- ${CMAKE_SOURCE_DIR}/src/LogWindow
- )
-
-SET(_PARAVIEW_APP_COMPO_LIB
- pqApplicationComponents
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/SUIT
+ ${PROJECT_SOURCE_DIR}/src/STD
+ ${PROJECT_SOURCE_DIR}/src/Qtx
+ ${PROJECT_SOURCE_DIR}/src/Event
+ ${PROJECT_SOURCE_DIR}/src/PyInterp
+ ${CMAKE_SOURCE_DIR}/src/LogWindow
)
-ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
-ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${PYTHON_DEFINITIONS})
+ADD_DEFINITIONS(
+ ${KERNEL_DEFINITIONS}
+ ${PYTHON_DEFINITIONS}
+ )
SET(_link_LIBRARIES
- ${KERNEL_LDFLAGS} ${KERNEL_SALOMELocalTrace} ${KERNEL_OpUtil}
- ${GUI_LDFLAGS} suit Event PyInterp
- ${_PARAVIEW_APP_COMPO_LIB}
+ ${KERNEL_SALOMELocalTrace}
+ ${KERNEL_OpUtil}
+ suit
+ Event
+ pqApplicationComponents
vtkRenderingFreeTypeOpenGL
-)
+ )
# --- headers ---
virtual ~PVViewer_Behaviors() {}
-//public slots:
-// void onEmulateApply();
-
private:
static int BehaviorLoadingLevel;
};
#include "PVViewer_EngineWrapper.h"
#include <Utils_SALOME_Exception.hxx>
-//#include <SalomeApp_Application.h>
#include <SUIT_Session.h>
+#include <PyInterp_Utils.h>
+
+class PVViewer_EngineWrapper::Private
+{
+public:
+ PyObjWrapper pvserverEngine;
+};
PVViewer_EngineWrapper * PVViewer_EngineWrapper::instance = NULL;
return instance;
}
-//static SalomeApp_Application* getApplication()
-//{
-// if ( SUIT_Session::session() )
-// return dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
-// return 0;
-//}
-//
-//PVViewer_EngineWrapper::PVViewer_EngineWrapper()
-//// : pvserverEngine(NULL)
-//{
-// _component = getApplication()->lcc()->FindOrLoad_Component( "FactoryServer", "PARAVIS" );
-//}
-//
-//bool PVViewer_EngineWrapper::GetGUIConnected()
-//{
-// CORBA::Request_var req = _component->_request("GetGUIConnected");
-// req->set_return_type(CORBA::_tc_boolean);
-// req->invoke();
-// CORBA::Exception *exc =req->env()->exception();
-// if( exc )
-// throw SALOME_Exception("Unable to invoke PARAVIS engine!");
-// CORBA::Any & ret = req->return_value();
-// CORBA::Boolean bo;
-//
-// if (ret >>= bo)
-// return bool(bo);
-// else
-// throw SALOME_Exception("Unable to convert engine result!");
-//}
-//
-//void PVViewer_EngineWrapper::SetGUIConnected(bool isConnected)
-//{
-// CORBA::Request_var req = _component->_request("SetGUIConnected");
-// CORBA::Boolean arg = isConnected;
-// req->add_in_arg() <<= arg;
-// req->set_return_type(CORBA::_tc_void);
-// req->invoke();
-// CORBA::Exception *exc =req->env()->exception();
-// if( exc )
-// throw SALOME_Exception("Unable to invoke PARAVIS engine!");
-//}
-//
-//std::string PVViewer_EngineWrapper::FindOrStartPVServer(int port)
-//{
-// CORBA::Request_var req = _component->_request("FindOrStartPVServer");
-// CORBA::Long arg = port;
-// req->add_in_arg() <<= arg;
-// req->set_return_type(CORBA::_tc_string);
-// req->invoke();
-// CORBA::Exception *exc =req->env()->exception();
-// if( exc )
-// throw SALOME_Exception("Unable to invoke PARAVIS engine!");
-//
-// const char* ret;
-// if(req->return_value() >>= ret)
-// return std::string(ret);
-// else
-// throw SALOME_Exception("Unable to convert engine result!");
-//}
-
-PVViewer_EngineWrapper::PVViewer_EngineWrapper() :
- pvserverEngine(NULL)
+PVViewer_EngineWrapper::PVViewer_EngineWrapper()
{
+ myData = new Private;
PyLockWrapper lock;
const char* code = "import PVSERVER_utils as pa;__enginePVSERVER=pa.getEngine()";
int ret = PyRun_SimpleString(const_cast<char*>(code));
PyObject* main_module = PyImport_AddModule((char*)"__main__");
PyObject* global_dict = PyModule_GetDict(main_module);
PyObjWrapper tmp(PyDict_GetItemString(global_dict, "__enginePVSERVER"));
- pvserverEngine = tmp;
+ myData->pvserverEngine = tmp;
}
-
+PVViewer_EngineWrapper::~PVViewer_EngineWrapper()
+{
+ delete myData;
+}
bool PVViewer_EngineWrapper::GetGUIConnected()
{
PyLockWrapper lock;
- PyObjWrapper obj(PyObject_CallMethod(pvserverEngine, (char*)("GetGUIConnected"), NULL));
+ PyObjWrapper obj(PyObject_CallMethod(myData->pvserverEngine, (char*)("GetGUIConnected"), NULL));
if (!obj)
{
PyErr_Print();
{
PyLockWrapper lock;
- PyObjWrapper obj(PyObject_CallMethod(pvserverEngine, (char*)("SetGUIConnected"),
+ PyObjWrapper obj(PyObject_CallMethod(myData->pvserverEngine, (char*)("SetGUIConnected"),
(char *)"i", (int)isConnected ) );
if (!obj)
{
std::string PVViewer_EngineWrapper::FindOrStartPVServer(int port)
{
PyLockWrapper lock;
- PyObjWrapper obj(PyObject_CallMethod(pvserverEngine, (char*)("FindOrStartPVServer"),
+ PyObjWrapper obj(PyObject_CallMethod(myData->pvserverEngine, (char*)("FindOrStartPVServer"),
(char *)"i", port ) );
if (!obj)
{
void PVViewer_EngineWrapper::PutPythonTraceStringToEngine(const char * str)
{
PyLockWrapper lock;
- PyObjWrapper obj(PyObject_CallMethod(pvserverEngine, (char*)("PutPythonTraceStringToEngine"),
+ PyObjWrapper obj(PyObject_CallMethod(myData->pvserverEngine, (char*)("PutPythonTraceStringToEngine"),
(char *)"s", str) );
if (!obj)
{
#include "PVViewer.h"
-#include <PyInterp_Utils.h>
#include <string>
-//#include <SALOMEconfig.h>
-//#include <SALOME_LifeCycleCORBA.hxx>
-//#include <SALOMEDS_SObject.hxx>
-//#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
-//#include CORBA_SERVER_HEADER(SALOMEDS)
-
-
/*!
* Class facilitating the access to the PARAVIS engine without having to link
* to it. Documentation of the method is found in the PARAVIS module (in the idl directory).
- *
- * (Two implementations are provided: one with CORBA dynamic invokation from C++, one using
- * Python - see commented elements in the .cxx file)
*/
class PVVIEWER_EXPORT PVViewer_EngineWrapper
{
+ class Private;
public:
//! Returns the unique instance of the engine.
- static PVViewer_EngineWrapper * GetInstance();
+ static PVViewer_EngineWrapper* GetInstance();
bool GetGUIConnected();
void SetGUIConnected(bool isConnected);
std::string FindOrStartPVServer(int port);
- void PutPythonTraceStringToEngine(const char *);
+ void PutPythonTraceStringToEngine(const char*);
private:
PVViewer_EngineWrapper();
- virtual ~PVViewer_EngineWrapper() {}
-
- static PVViewer_EngineWrapper * instance;
- //Engines::EngineComponent_var _component;
+ virtual ~PVViewer_EngineWrapper();
- PyObjWrapper pvserverEngine;
+ static PVViewer_EngineWrapper* instance;
+ Private* myData;
};
#endif /* PVVIEWERENGINEWRAPPER_H_ */
vtkStandardNewMacro(PVViewer_LogWindowAdapter);
-
-
/*!
* Put the message in the log window.
*/
return this->GenericWarningCount;
}
-//LogWindow* PVViewer_LogWindowAdapter::getLogWindow()
-//{
-// LogWindow* wnd = 0;
-// LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
-// if ( anApp )
-// wnd = anApp->logWindow();
-// return wnd;
-//}
-
void PVViewer_LogWindowAdapter::DisplayText(const char* text)
{
++this->TextCount;
#include <SUIT_Session.h>
#include <SUIT_Study.h>
#include <SUIT_ResourceMgr.h>
-#include <PyInterp_Interp.h>
-#include <PyConsole_Interp.h>
-#include <PyConsole_Console.h>
#include <LogWindow.h>
#include <QApplication>
connect( desk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
-// connect(this, SIGNAL(viewCreated(SUIT_ViewWindow*)), this, SLOT(onPVViewCreated(SUIT_ViewWindow*)));
}
pqPVApplicationCore * PVViewer_ViewManager::GetPVApplication()
MESSAGE("PVViewer_Viewer: creating view model ...");
}
-
/*!
Create new instance of view window on desktop \a theDesktop.
\retval SUIT_ViewWindow* - created view window pointer.
PyInterp_Event.cxx
PyInterp_Interp.cxx
PyInterp_Request.cxx
- PyInterp_Utils.cxx
)
# sources / to compile
+++ /dev/null
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 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, or (at your option) any later version.
-//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Adrien BRUNETON
-//
-
-#include "PyInterp_Utils.h"
-
-#include <iostream>
-
-/*!
- \class PyLockWrapper
- \brief Python GIL wrapper.
-*/
-
-/*!
- \brief Constructor. Automatically acquires GIL.
-*/
-PyLockWrapper::PyLockWrapper()
-{
- _gil_state = PyGILState_Ensure();
- // Save current thread state for later comparison
- _state = PyGILState_GetThisThreadState();
-}
-
-/*!
- \brief Destructor. Automatically releases GIL.
-*/
-PyLockWrapper::~PyLockWrapper()
-{
- PyThreadState * _currState = PyGILState_GetThisThreadState();
- if (_currState != _state)
- {
- std::cout << "!!!!!!!!! PyLockWrapper inconsistency - now entering infinite loop for debugging\n";
- while(1);
- }
-
- PyGILState_Release(_gil_state);
-}
-
#include "PyInterp.h"
#include <Python.h>
+#ifdef _DEBUG_
+ #include <iostream>
+#endif
/**
+ * \class PyLockWrapper
+ * \brief Python GIL wrapper.
+ *
* Utility class wrapping the Python GIL acquisition. This makes use of the high level
* API (PyGILState_Ensure and PyGILState_Release), and is hence compatible with only
* one running Python interpreter (no call to Py_NewInterpreter()).
{
public:
- PyLockWrapper();
- ~PyLockWrapper();
+ /**
+ * \brief Constructor. Automatically acquires GIL.
+ */
+ PyLockWrapper()
+ {
+ _gil_state = PyGILState_Ensure();
+ // Save current thread state for later comparison
+ _state = PyGILState_GetThisThreadState();
+ }
+
+ /**
+ * \brief Destructor. Automatically releases GIL.
+ */
+ ~PyLockWrapper()
+ {
+ PyThreadState* _currState = PyGILState_GetThisThreadState();
+#ifdef _DEBUG_
+ if (_currState != _state)
+ {
+ std::cout << "!!!!!!!!! PyLockWrapper inconsistency - now entering infinite loop for debugging\n";
+ while(1);
+ }
+#endif
+ PyGILState_Release(_gil_state);
+ }
private:
PyGILState_STATE _gil_state;
- PyThreadState * _state;
+ PyThreadState* _state;
// "Rule of 3" - Forbid usage of copy operator and copy-constructor
PyLockWrapper(const PyLockWrapper & another);
/**
- * Utility class to properly handle the reference counting required on Python objects.
+ * \class PyObjWrapper
+ * \brief Utility class to properly handle the reference counting required on Python objects.
*/
class PYINTERP_EXPORT PyObjWrapper
{
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/Prs
${PROJECT_SOURCE_DIR}/src/VTKViewer
- ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
)
+IF(SALOME_USE_GLVIEWER)
+ INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
+ )
+ENDIF()
+
# additional preprocessor / compiler flags
ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
${VTK_LIBRARIES}
${CAS_KERNEL} ${CAS_VIEWER}
${KERNEL_OpUtil}
- qtx suit ViewerTools SalomeObject SalomePrs VTKViewer OpenGLUtils
+ qtx suit ViewerTools SalomeObject SalomePrs VTKViewer
)
+IF(SALOME_USE_GLVIEWER)
+ LIST(APPEND _link_LIBRARIES
+ OpenGLUtils
+ )
+ENDIF()
+
# --- headers ---
# header files / to be processed by moc
#include "VTKViewer_Algorithm.h"
#include "SVTK_Functor.h"
-#include <OpenGLUtils_FrameBuffer.h>
+#ifndef DISABLE_GLVIEWER
+ #include <OpenGLUtils_FrameBuffer.h>
+#endif
namespace SVTK
int aWidth = aSize[0];
int aHeight = aSize[1];
+#ifndef DISABLE_GLVIEWER
OpenGLUtils_FrameBuffer aFrameBuffer;
if( aFrameBuffer.init( aWidth, aHeight ) )
{
anImage = anImage.mirrored();
return anImage;
}
+#endif
// if frame buffers are unsupported, use old functionality
unsigned char *aData =
if ( a )
a->setEnabled( activeStudy() );
+#ifndef DISABLE_PYCONSOLE
// Load script menu
a = action( LoadScriptId );
if( a )
a->setEnabled( pythonConsole() );
+#endif
// Properties menu
a = action( PropertiesId );