From 68e4d8f0009e8ca0084aa08ad0bd295c2b743532 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 23 Aug 2005 08:24:38 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'BR-D5-38-2003'. Cherrypick from master 2005-08-23 08:24:37 UTC sln 'New messages for operation mechanism added': configure.in.base src/SALOME_PY/SalomePy.cxx src/SUIT/resources/SUIT_msg_en.po src/SVTK/SVTK_Functor.h --- configure.in.base | 403 ++++++++++++++++++++++++++++++ src/SALOME_PY/SalomePy.cxx | 185 ++++++++++++++ src/SUIT/resources/SUIT_msg_en.po | 109 ++++++++ src/SVTK/SVTK_Functor.h | 68 +++++ 4 files changed, 765 insertions(+) create mode 100644 configure.in.base create mode 100755 src/SALOME_PY/SalomePy.cxx create mode 100755 src/SUIT/resources/SUIT_msg_en.po create mode 100644 src/SVTK/SVTK_Functor.h diff --git a/configure.in.base b/configure.in.base new file mode 100644 index 000000000..e6be9b20d --- /dev/null +++ b/configure.in.base @@ -0,0 +1,403 @@ +# +# PLEASE DO NOT MODIFY configure.in FILE +# +# ALL CHANGES WILL BE DISCARDED BY THE NEXT +# build_configure COMMAND +# +# CHANGES MUST BE MADE IN configure.in.base FILE +# +# +# Author : Marc Tajchman (CEA) +# Date : 28/06/2001 +# Modified by : Patrick GOLDBRONN (CEA) +# Modified by : Marc Tajchman (CEA) +# +# Created from configure.in.base +# + + +AC_INIT(src) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CANONICAL_HOST + +PACKAGE=salome +AC_SUBST(PACKAGE) + +VERSION=0.0.1 +AC_SUBST(VERSION) + +dnl +dnl Initialize source and build root directories +dnl + +ROOT_BUILDDIR=`pwd` +ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +cd $ROOT_SRCDIR +ROOT_SRCDIR=`pwd` +cd $ROOT_BUILDDIR + +AC_SUBST(ROOT_SRCDIR) +AC_SUBST(ROOT_BUILDDIR) + +echo +echo Source root directory : $ROOT_SRCDIR +echo Build root directory : $ROOT_BUILDDIR +echo +echo + +if test -z "$AR"; then + AC_CHECK_PROGS(AR,ar xar,:,$PATH) +fi +AC_SUBST(AR) + +dnl Export the AR macro so that it will be placed in the libtool file +dnl correctly. +export AR + +echo +echo --------------------------------------------- +echo testing make +echo --------------------------------------------- +echo + +AC_PROG_MAKE_SET +AC_PROG_INSTALL +dnl +dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! + +AC_ENABLE_DEBUG(yes) +AC_DISABLE_PRODUCTION + +echo --------------------------------------------- +echo testing libtool +echo --------------------------------------------- + +dnl first, we set static to no! +dnl if we want it, use --enable-static +AC_ENABLE_STATIC(no) + +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + +dnl Fix up the INSTALL macro if it s a relative path. We want the +dnl full-path to the binary instead. +case "$INSTALL" in + *install-sh*) + INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_CXX_WARNINGS +AC_CXX_TEMPLATE_OPTIONS +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl add library libm : +AC_CHECK_LIB(m,ceil) + +dnl +dnl Well we use sstream which is not in gcc pre-2.95.3 +dnl We must test if it exists. If not, add it in include ! +dnl + +AC_CXX_HAVE_SSTREAM + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing LEX \& YACC +echo --------------------------------------------- +echo + +lex_yacc_ok=no +AC_PROG_YACC +AC_PROG_LEX +lex_yacc_ok=yes + +echo +echo --------------------------------------------- +echo testing python +echo --------------------------------------------- +echo + +CHECK_PYTHON + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing java +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_JAVA + +echo +echo --------------------------------------------- +echo testing swig +echo --------------------------------------------- +echo + +CHECK_SWIG + +echo +echo --------------------------------------------- +echo testing threads +echo --------------------------------------------- +echo + +ENABLE_PTHREADS + +echo +echo --------------------------------------------- +echo testing omniORB +echo --------------------------------------------- +echo + +CHECK_OMNIORB + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing mico +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_MICO + +echo +echo --------------------------------------------- +echo default ORB : omniORB +echo --------------------------------------------- +echo + +DEFAULT_ORB=omniORB +CHECK_CORBA + +AC_SUBST_FILE(CORBA) +corba=make_$ORB +CORBA=adm_local/unix/$corba + +echo +echo --------------------------------------------- +echo testing openGL +echo --------------------------------------------- +echo + +CHECK_OPENGL + +echo +echo --------------------------------------------- +echo testing QT +echo --------------------------------------------- +echo + +CHECK_QT + +echo +echo --------------------------------------------- +echo testing msg2qm +echo --------------------------------------------- +echo + +CHECK_MSG2QM + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + +echo +echo --------------------------------------------- +echo Testing sip +echo --------------------------------------------- +echo + +CHECK_SIP + +echo +echo --------------------------------------------- +echo Testing pyqt +echo --------------------------------------------- +echo + +CHECK_PYQT + +echo +echo --------------------------------------------- +echo Testing qwt +echo --------------------------------------------- +echo + +CHECK_QWT + +echo +echo --------------------------------------------- +echo Testing html generators +echo --------------------------------------------- +echo + +CHECK_HTML_GENERATORS + +echo +echo --------------------------------------------- +echo Testing Kernel +echo --------------------------------------------- +echo + +CHECK_KERNEL + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok msg2qm_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok" + +for var in $variables +do + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var +done + +echo +echo "Default ORB : $DEFAULT_ORB" +echo + +dnl generals files which could be included in every makefile + +AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence +AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude +AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module + +dnl les dependences +AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend + +dnl We don t need to say when we re entering directories if we re using +dnl GNU make becuase make does it for us. +if test "X$GMAKE" = "Xyes"; then + AC_SUBST(SETX) SETX=":" +else + AC_SUBST(SETX) SETX="set -x" +fi + +# make other build directories +for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl +do +# if test ! -d $rep ; then +# eval mkdir $rep +# fi + $INSTALL -d $rep +done + +echo +echo --------------------------------------------- +echo copying resource files, shell scripts, and +echo xml files +echo --------------------------------------------- +echo + + +dnl copy resources directories + +#for i in `find $ROOT_SRCDIR -name 'resources' -print` +#do +# local_res=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +# local_res_dir=`echo $local_res | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +# mkdir -p $local_res_dir +# cd $local_res_dir +# ln -fs $i +# echo $local_res +# cd $ROOT_BUILDDIR +#done + +dnl copy shells and utilities contained in the bin directory +dnl excluding .in files (treated in AC-OUTPUT below) and CVS +dnl directory + +mkdir -p bin/salome +cd bin/salome + +for i in $ROOT_SRCDIR/bin/* +do + local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` + case "$local_bin" in + *.in | *~) ;; + ./bin/CVS | ./bin/salome) ;; + *) $INSTALL $i . ; echo $local_bin ;; + esac +done +cd $ROOT_BUILDDIR + +AC_SUBST_FILE(ENVSCRIPT) ENVSCRIPT=salome_adm/unix/envScript + +dnl copy xml files to the build tree (lib directory) +dnl pourquoi ???? + +#cd lib +#for i in `find $ROOT_SRCDIR -name "*.xml" -print` +#do +# ln -fs $i +# echo `echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +#done +#cd $ROOT_BUILDDIR + + +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +AC_OUTPUT_COMMANDS([ \ + chmod +x ./bin/* \ +]) + +## do not delete this line diff --git a/src/SALOME_PY/SalomePy.cxx b/src/SALOME_PY/SalomePy.cxx new file mode 100755 index 000000000..1013f34cc --- /dev/null +++ b/src/SALOME_PY/SalomePy.cxx @@ -0,0 +1,185 @@ +// SALOME SALOME_PY : binding of VTK graphics and Python +// +// 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 : SalomePy.cxx +// Author : Paul RASCLE, EDF +// Module : SALOME +// $Header$ + +#include +#include + +#include +#include +#include +#include + +#include "SALOME_Event.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" + +#include "SVTK_ViewManager.h" +#include "SVTK_ViewWindow.h" +#include "SVTK_RenderWindow.h" +#include "SVTK_RenderWindowInteractor.h" + +using namespace std; + +////////////////////////////////////////////////////////////////////////////// +// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based) +// All methods are implemented using Event mechanism: +// - getRenderer() +// - getRenderWindow() +// - getRenderWindowInteractor() +// These methods open new VTK viewer if there is no one opened. +// In case of error methods return None object in Python. +////////////////////////////////////////////////////////////////////////////// + +static PyObject* GetPyClass(const char* theClassName){ + static PyObject *aVTKModule = NULL; + if(!aVTKModule){ + if (VTK_MAJOR_VERSION > 3) + aVTKModule = PyImport_ImportModule("libvtkRenderingPython"); + else + aVTKModule = PyImport_ImportModule("libVTKGraphicsPython"); + if(PyErr_Occurred()){ + PyErr_Print(); + return NULL; + } + } + PyObject* aVTKDict = PyModule_GetDict(aVTKModule); + char* aClassName = const_cast(theClassName); + PyObject* aPyClass = PyDict_GetItemString(aVTKDict,aClassName); + //Py_DECREF(aVTKModule); + return aPyClass; +} + +static SVTK_ViewWindow* GetVTKViewWindow() { + SVTK_ViewWindow* aVW = NULL; + if ( SUIT_Session::session() ) { + // get application + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( anApp ) { + // get active study + SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); + if ( aStudy ) { + // find or create VTK view manager + SVTK_ViewManager* aVM = dynamic_cast( anApp->getViewManager( "VTKViewer", true ) ); + if ( aVM ) { + aVW = dynamic_cast( aVM->getActiveView() ); + // VSR : When new view window is created it can be not active yet at this moment, + // so the following is a some workaround + if ( !aVW && !aVM->getViews().isEmpty() ) + aVW = dynamic_cast( aVM->getViews()[ 0 ] ); + } + } + } + } + return aVW; +} + +/*! + Get VTK renderer (opens new VTK window if there is no one opened) +*/ +class TGetRendererEvent: public SALOME_Event { +public: + typedef PyObject* TResult; + TResult myResult; + TGetRendererEvent() : myResult( Py_None ) {} + virtual void Execute() { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + PyObject* aPyClass = GetPyClass("vtkRenderer"); + vtkRenderer* aVTKObject = aVTKViewWindow->getRenderer(); + myResult = PyVTKObject_New(aPyClass,aVTKObject); + } + } +}; +extern "C" PyObject *libSalomePy_getRenderer(PyObject *self, PyObject *args) +{ + return ProcessEvent( new TGetRendererEvent() ); +} + +/*! + Get VTK render window (opens new VTK window if there is no one opened) +*/ +class TGetRenderWindowEvent: public SALOME_Event { +public: + typedef PyObject* TResult; + TResult myResult; + TGetRenderWindowEvent() : myResult( Py_None ) {} + virtual void Execute() { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + PyObject* aPyClass = GetPyClass("vtkRenderWindow"); + vtkRenderWindow* aVTKObject = aVTKViewWindow->getRenderWindow()->getRenderWindow(); + myResult = PyVTKObject_New(aPyClass,aVTKObject); + } + } +}; +extern "C" PyObject *libSalomePy_getRenderWindow(PyObject *self, PyObject *args) +{ + return ProcessEvent( new TGetRenderWindowEvent() ); +} + +/*! + Get VTK render window interactor (opens new VTK window if there is no one opened) +*/ +class TGetRenderWindowInteractorEvent: public SALOME_Event { +public: + typedef PyObject* TResult; + TResult myResult; + TGetRenderWindowInteractorEvent() : myResult( Py_None ) {} + virtual void Execute() { + if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow() ) { + PyObject* aPyClass = GetPyClass("vtkRenderWindowInteractor"); + vtkRenderWindowInteractor* aVTKObject = aVTKViewWindow->getRWInteractor(); + myResult = PyVTKObject_New(aPyClass,aVTKObject); + } + } +}; +extern "C" PyObject *libSalomePy_getRenderWindowInteractor(PyObject *self, PyObject *args) +{ + return ProcessEvent( new TGetRenderWindowInteractorEvent() ); +} + +/*! + Library initialization +*/ +static PyMethodDef Module_Methods[] = +{ + { "getRenderer", libSalomePy_getRenderer, METH_NOARGS }, + { "getRenderWindow", libSalomePy_getRenderWindow, METH_NOARGS }, + { "getRenderWindowInteractor", libSalomePy_getRenderWindow, METH_NOARGS }, + { NULL, NULL } +}; + +extern "C" void initlibSalomePy() +{ + static char modulename[] = "libSalomePy"; + /*PyObject* aModule = */Py_InitModule(modulename, Module_Methods); + if(PyErr_Occurred()){ + PyErr_Print(); + return; + } +} diff --git a/src/SUIT/resources/SUIT_msg_en.po b/src/SUIT/resources/SUIT_msg_en.po new file mode 100755 index 000000000..95f43c747 --- /dev/null +++ b/src/SUIT/resources/SUIT_msg_en.po @@ -0,0 +1,109 @@ +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: example-Qt-message-extraction\n" +"POT-Creation-Date: 1999-02-23 15:38+0200\n" +"PO-Revision-Date: 1999-02-23 15:38+0200\n" +"Last-Translator: \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "MEN_DESK_WINDOW" +msgstr "&Window" + +msgid "MEN_DESK_WINDOW_CASCADE" +msgstr "&Cascade" + +msgid "PRP_DESK_WINDOW_CASCADE" +msgstr "Arranges the windows as overlapping tiles" + +msgid "MEN_DESK_WINDOW_TILE" +msgstr "&Tile" + +msgid "PRP_DESK_WINDOW_TILE" +msgstr "Arranges the windows as nonoverlapping tiles" + +msgid "MEN_DESK_WINDOW_VTILE" +msgstr "Tile &Vertically" + +msgid "PRP_DESK_WINDOW_VTILE" +msgstr "Arranges the windows as nonoverlapping vertical tiles" + +msgid "PRP_DESK_WINDOW_ACTIVATE" +msgstr "Activates this window" + +msgid "LAB_QUICK_PATH" +msgstr "Quick path:" + +msgid "BUT_ADD_PATH" +msgstr "Add path" + +msgid "INF_DESK_DOC_OPEN" +msgstr "Open File" + +msgid "INF_DESK_DOC_SAVE" +msgstr "Save File" + +msgid "ERR_ERROR" +msgstr "Error" + +msgid "WRN_WARNING" +msgstr "Warning" + +msgid "ERR_DIR_NOT_EXIST" +msgstr "The directory \"%1\" does not exist!" + +msgid "ERR_FILE_NOT_EXIST" +msgstr "The file \"%1\" does not exist!" + +msgid "ERR_PERMISSION_DENIED" +msgstr "Can't save file \"%1\".\nPermission denied." + +msgid "BUT_OK" +msgstr "&OK" + +msgid "BUT_YES" +msgstr "&Yes" + +msgid "BUT_NO" +msgstr "&No" + +msgid "INF_DIRECTORIES_FILTER" +msgstr "Directories" + +msgid "QUE_FILE_EXISTS" +msgstr "The file \"%1\" already exists.\nDo you want to overwrite it?" + +msgid "TLT_DUMP_VIEW" +msgstr "Dump View to File" + +msgid "TLT_IMAGE_FILES" +msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"" + +msgid "ERR_CANT_DUMP_VIEW" +msgstr "Can't dump view contents to the file." + +msgid "CONTINUE" +msgstr "Continue" + +msgid "CANCEL" +msgstr "Cancel" + +#====================================================================== + +msgid "SUIT_Study::OPERATION_LAUNCH" +msgstr "Operation launch" + +msgid "SUIT_Study::PREVIOUS_NOT_FINISHED" +msgstr "Previous operation is not finished and will be aborted" + +#====================================================================== + + + + + + + + \ No newline at end of file diff --git a/src/SVTK/SVTK_Functor.h b/src/SVTK/SVTK_Functor.h new file mode 100644 index 000000000..74cddb3c3 --- /dev/null +++ b/src/SVTK/SVTK_Functor.h @@ -0,0 +1,68 @@ +#ifndef SVTK_Functor_H +#define SVTK_Functor_H + +#include + +#include + +#include + +#include "SALOME_InteractiveObject.hxx" + +namespace VTK +{ + template + struct TIsSameEntry + { + std::string myEntry; + TIsSameEntry(const char* theEntry): myEntry(theEntry) {} + bool operator()(TActor* theActor) + { + if ( theActor->hasIO() ) + { + Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); + if ( anIO->hasEntry() ) + return myEntry == anIO->getEntry(); + } + return false; + } + }; + + + //---------------------------------------------------------------- + template + struct TIsSameIObject + { + Handle(SALOME_InteractiveObject) myIObject; + TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject): + myIObject(theIObject) + {} + bool operator()(TActor* theActor) + { + if(theActor->hasIO()) + { + Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); + return myIObject->isSame(anIO); + } + return false; + } + }; + + + //---------------------------------------------------------------- + template + struct THighlight + { + bool myIsHighlight; + THighlight(bool theIsHighlight): myIsHighlight( theIsHighlight ) {} + void operator()(TActor* theActor) + { + if(theActor->GetVisibility() && theActor->GetMapper()) + theActor->highlight( myIsHighlight ); + } + }; + +} + + +#endif -- 2.39.2