+++ /dev/null
-// 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 : SALOME_Session.idl
-// Author : Paul RASCLE, EDF
-// $Header$
-
-#include "SALOME_Component.idl"
-
-/*!
- This package contains interfaces used for management of the session in %SALOME application.
-*/
-module SALOME
-{
-/*! \brief State of the session
-
- This enumeration contains values defining the state of the session
-
-*/
- enum SessionState {asleep, /*! Session is inactive */
- running /*! Session is running */
- } ;
-
-/*! \brief %Session State and Statistics
-
-
- This struct contains a field list with general information about the session
-*/
-
- struct StatSession
- {
-/*! \brief State of the session
-
- It can be:
- * -# asleep : no running study
- * -# running : one or more running studies
-*/
- SessionState state ;
-/*! Number of running studies
-*/
- short runningStudies ;
-/*! It is True if GUI is active in the session
-*/
- boolean activeGUI ;
- } ;
-/*! \brief Interface of the session
-
- The %session Server launches and stops GUI (Graphical User Interface).
- The %session can be active without GUI (It can contain one or more running studies)
-*/
-
- interface Session
- {
-/*!
- This exception is raised when trying to stop the %session with active GUI
-*/
- exception GUIActive {} ;
-/*!
- This exception is raised when trying to stop the %session with a number of running studies.
-*/
- exception RunningStudies {} ;
-
-/*!
- Launches GUI in the session
-*/
- void GetInterface();
-
-/*!
- Returns the Visu component
-*/
- Engines::Component GetVisuComponent();
-
-/*!
- Stops the %Session (It must be idle)
-*/
- void StopSession() raises(GUIActive, RunningStudies) ;
-
-/*!
- Gets Session State
-*/
- StatSession GetStatSession() ;
-/*!
- Determines whether the server has already been loaded or not.
-*/
- void ping();
-/*!
- Get Active study ID
-*/
- long GetActiveStudyId();
- } ;
-
-} ;
+++ /dev/null
-<Ressources-list>
- <computer>
- <name>eri</name>
- <OS>Linux</OS>
- <OS-version>2.2.14-6.1.1smp</OS-version>
- <proc-list>
- <proc>
- <number>0</number>
- <model>Pentium III (Coppermine)</model>
- <CPU-MHz>860.946775</CPU-MHz>
- <cache>256</cache>
- </proc>
- <proc>
- <number>1</number>
- <model>Pentium III (Coppermine)</model>
- <CPU-MHz>860.946775</CPU-MHz>
- <cache>256</cache>
- </proc>
- </proc-list>
- <containertype-list>
- <containertype>C++</containertype>
- <containertype>python</containertype>
- <containertype>NP</containertype>
- </containertype-list>
- </computer>
- <computer>
- <name>omote</name>
- <OS>Linux</OS>
- <OS-version>2.4.3-12smp</OS-version>
- <proc-list>
- <proc>
- <number>0</number>
- <model>Pentium II (Deschutes)</model>
- <CPU-MHz>398.780</CPU-MHz>
- <cache>512</cache>
- </proc>
- </proc-list>
- <containertype-list>
- <containertype>C++</containertype>
- <containertype>python</containertype>
- </containertype-list>
- </computer>
-</Ressources-list>
+++ /dev/null
-! Description of available plugins
-! ********************************
-!
-a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin
-!
-! standard attribute drivers plugin
-!
-ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
-ad696001-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
-ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
+++ /dev/null
-dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-dnl
-dnl
-dnl
-
-AC_DEFUN([CHECK_MED2],[
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-AC_REQUIRE([CHECK_HDF5])dnl
-
-AC_CHECKING(for MED2)
-
-AC_ARG_WITH(med2,
- [ --with-med2=DIR root directory path to med2 installation ],
- [MED2HOME="$withval"
- AC_MSG_RESULT("select $withval as path to med2")
- ])
-
-AC_SUBST(MED2_INCLUDES)
-AC_SUBST(MED2_LIBS)
-AC_SUBST(MED2_MT_LIBS)
-
-MED2_INCLUDES=""
-MED2_LIBS=""
-MED2_MT_LIBS=""
-
-med2_ok=no
-
-LOCAL_INCLUDES="$HDF5_INCLUDES"
-LOCAL_LIBS="-lmed $HDF5_LIBS"
-
-if test -z $MED2HOME
-then
- AC_MSG_WARN(undefined MED2HOME variable which specify med2 installation directory)
-else
- LOCAL_INCLUDES="$LOCAL_INCLUDES -I$MED2HOME/include"
- LOCAL_LIBS="-L$MED2HOME/lib $LOCAL_LIBS"
-fi
-
-dnl check med2 header
-
-CPPFLAGS_old="$CPPFLAGS"
-dnl we must test system : linux = -DPCLINUX
-dnl we must test system : Alpha-OSF = -DOSF1
-case $host_os in
- linux*)
- CPPFLAGS="$CPPFLAGS -DPCLINUX $LOCAL_INCLUDES"
- ;;
- osf*)
- CPPFLAGS="$CPPFLAGS -DOSF1 $LOCAL_INCLUDES"
- ;;
-esac
-AC_CHECK_HEADER(med.h,med2_ok=yes ,med2_ok=no)
-CPPFLAGS="$CPPFLAGS_old"
-
-if test "x$med2_ok" = "xyes"
-then
-
-dnl check med2 library
-
- LIBS_old="$LIBS"
- LIBS="$LIBS $LOCAL_LIBS"
- AC_CHECK_LIB(med,MEDouvrir,med2_ok=yes,med2_ok=no)
- LIBS="$LIBS_old"
-
-fi
-
-if test "x$med2_ok" = "xyes"
-then
-case $host_os in
- linux*)
- MED2_INCLUDES="-DPCLINUX $LOCAL_INCLUDES"
- ;;
- osf*)
- MED2_INCLUDES="-DOSF1 $LOCAL_INCLUDES"
- ;;
-esac
- MED2_LIBS="$LOCAL_LIBS"
- MED2_MT_LIBS="$LOCAL_LIBS"
-fi
-
-AC_MSG_RESULT(for med2: $med2_ok)
-
-])dnl
+++ /dev/null
-Environnement
--------------
-repertoire de construction (build) :
- variables d'environement, a passer plutot dans les Makefile
-
- export BUILD_SALOME=${HOME}/devSalome/build
- export SALOME_LIB_DIR=${BUILD_SALOME}/lib
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BUILD_SALOME}/lib
-
-naming Service : cf. plus bas.
-
-IAPP_XML (exemple N. Rejneri adapté)
---------
-
-- options de compilation revues (Qt avec threads)
-- creation de librairie
-- initialiser tous les membres de classe pointeurs à NULL dans le constructeur
- (plantage à la 2° execution de mainWindow sur handler non nul)
-- utilisation de getenv pour trouver le path des ressources (xml, librairies, icones)
-- utilisation "extern C" pour l'appel de methode ds librairie dynamique
-
-Naming Service
---------------
-- creation librairie avec la classe d'implementation de SALOME_NamingService
-- environnement
-
-export OMNIORB_CONFIG=${HOME}/.omniORB.cfg
-
-1 line in file ${HOME}/.omniORB.cfg
-ORBInitRef NameService=corbaname::localhost
-
-(replace localhost by internet address to access Naming Service from other machines)
-
-# environnement Mico2.3.5
-
-export MICODIR=/opt/mico2.3.5
-export MICOVERSION=` sed -n '/MICO_VERSION/ { y/b/./; s#^[^"]*"\([^"]*\)".*$#\1#p; }' \
- "$MICODIR/include/mico/version.h" `
-export PATH=${PATH}:${MICODIR}/bin
-export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MICODIR}/lib
-export MANPATH=${MANPATH}:${MICODIR}/man
-export LIBPATH=${LIBPATH}:${MICODIR}/lib
-export SHLIB_PATH=${SHLIB_PATH}:${MICODIR}/lib
-export LIBRARY_PATH=${MICODIR}/lib
-export CPLUS_INCLUDE_PATH=${MICODIR}/include
-
--------------------------------------------------------------------------------
-TODO LIST
--------------------------------------------------------------------------------
-
-Utils
------
- - CPU&Memory measurements
- - Makefile : library, includes
- - Doxygen comments
-
-Session
--------
-
-Server :
- - test only one mainWindow (mutex)
-
-Loader :
- - get stats to know if Server is OK before get interface
-
-Session stats :
- - write the code
-
-Session Kill :
- - write the code
- - get stats to know if there is one or more active sessions before kill.
-
-Launch script for everything :
+++ /dev/null
-// KERNEL Utils : common utils for KERNEL
-// Copyright (C) 2003 CEA
-//
-// 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.salome-platform.org or email : webmaster.salome@opencascade.org
-
-
-#include "CASCatch_SignalsHandler.h"
-#include <signal.h>
-#include <OSD.hxx>
-using namespace std;
-
-CASCatch_SignalsHandler::CASCatch_SignalsHandler(bool theFloatingSignal)
-{
- OSD::SetSignal(theFloatingSignal);
- // To allow application kill when used in xterm, one must use default behavior
- // with SIGHUP signal
- Utils_SignalsHandler::SetSigHandler(SIGHUP,SIG_DFL);
-}
+++ /dev/null
-// KERNEL Utils : common utils for KERNEL
-// Copyright (C) 2003 CEA
-//
-// 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.salome-platform.org or email : webmaster.salome@opencascade.org
-
-#ifndef _CASCATCH_SIGNALSHANDLER_H_
-#define _CASCATCH_SIGNALSHANDLER_H_
-
-
-#include "Utils_SignalsHandler.h"
-#include <Standard_ErrorHandler.hxx>
-
-class CASCatch_SignalsHandler: private Utils_SignalsHandler{
- public:
- CASCatch_SignalsHandler(bool theFloatingSignal = true);
-};
-
-
-#endif
+++ /dev/null
-# SALOME Utils : general SALOME's definitions and tools
-#
-# 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 : Makefile.in
-# Author : Marc Tajchman (CEA)
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS= \
- SALOME_Event.hxx
-
-EXPORT_PYSCRIPTS =
-# Libraries targets
-
-LIB = libEvent.la
-LIB_SRC = SALOME_Event.cxx
-
-CPPFLAGS+=$(QT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS)
-
-@CONCLUDE@
-
-
+++ /dev/null
-// KERNEL SALOME_Event : Define event posting mechanism
-//
-// 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 : SALOME_Event.cxx
-// Author : Sergey ANIKIN
-// Module : KERNEL
-// $Header$
-
-#include "SALOME_Event.hxx"
-
-#include "utilities.h"
-
-#include <qsemaphore.h>
-#include <qapplication.h>
-#include <qthread.h>
-#include <pthread.h>
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-static pthread_t myThread;
-
-void SALOME_Event::GetSessionThread(){
- myThread = pthread_self();
-}
-
-bool SALOME_Event::IsSessionThread(){
- bool aResult = myThread == pthread_self();
- if(MYDEBUG) INFOS("IsSessionThread() - "<<aResult);
- return aResult;
-}
-
-
-//===========================================================
-/*!
- * SALOME_Event::SALOME_Event
- * Constructor
- */
-//===========================================================
-SALOME_Event::SALOME_Event(){
- if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this );
- // Prepare the semaphore
- mySemaphore = new QSemaphore( 2 );
- *mySemaphore += 2;
-}
-
-//===========================================================
-/*!
- * SALOME_Event::~SALOME_Event
- * Destructor
- */
-//===========================================================
-SALOME_Event::~SALOME_Event(){
- if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this );
- if ( mySemaphore->available() < mySemaphore->total() )
- *mySemaphore -= mySemaphore->total() - mySemaphore->available();
- delete mySemaphore;
-}
-
-//===========================================================
-/*!
- * SALOME_Event::process
- * Posts the event and optionally waits for its completion
- */
-//===========================================================
-void SALOME_Event::process()
-{
- QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
- if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<", *mySemaphore += 1 " );
- *mySemaphore += 1;
- if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<" - COMPLETED" );
-}
-
-//===========================================================
-/*!
- * SALOME_Event::processed
- * Signals that this event has been processed
- */
-//===========================================================
-void SALOME_Event::processed()
-{
- if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this );
- // process() takes control over mySemaphore after the next line is executed
- *mySemaphore -= 1;
-}
+++ /dev/null
-// KERNEL SALOME_Event : Define event posting mechanism
-//
-// 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 : SALOME_Event.hxx
-// Author : Sergey ANIKIN
-// Module : KERNEL
-// $Header$
-
-
-#ifndef SALOME_Event_HeaderFile
-#define SALOME_Event_HeaderFile
-
-#include <qevent.h>
-
-#define SALOME_EVENT QEvent::Type( QEvent::User + 10000 )
-
-class QSemaphore;
-
-//===========================================================
-/*!
- * Class: SALOME_Event
- * Description:
- * This class encapsulates data and functionality required for
- * posting component-specific events to perform arbitrary operations in main GUI thread.
- * SALOME_Event objects can be posted by any thread belonging to the GUI process.
- *
- * It is necessary to derive a custom event class from SALOME_Event and
- * re-implement virtual Execute() method. This method should actually perform
- * the desirable operation. To pass all the required data to Execute() and store a return value,
- * arbitrary data fields can be added to the custom event class. There is
- * no need to protect such fields with a mutex, for only one thread working with
- * a SALOME_Event object is active at any moment.
- *
- * Usage:
- * - create SALOME_Event.
- * Components can derive their own event class from SALOME_Event
- * in order to pass custom data to the event handler.
- * - call process() method to post the event. After process() execution
- * it is possible to examine fields of your custom event object.
- * - perform delete operator on the event to wake up the desktop (you can also set <autoRelease>
- * parameter to TRUE to automatically wake up desktop after process()
- *
- * processed() method is used by the desktop to signal that event processing
- * has been completed.
- *
- * Caveats:
- * There is no.
- */
-//===========================================================
-
-
-class SALOME_Event{
-public:
- SALOME_Event();
- virtual ~SALOME_Event();
-
- // To do real work
- virtual void Execute() = 0;
-
- static bool IsSessionThread();
- void process();
-
-protected:
- void processed();
- friend class QAD_Desktop;
-
- static void GetSessionThread();
- friend int main(int, char **);
-
-private:
- QSemaphore* mySemaphore;
-};
-
-
-// Template classes for member function
-//-------------------------------------
-template<class TObject, typename TRes>
-class TMemFunEvent: public SALOME_Event{
-public:
- typedef TRes TResult;
- TResult myResult;
- typedef TResult (TObject::* TAction)();
- TMemFunEvent(TObject* theObject, TAction theAction,
- TResult theResult = TResult()):
- myObject(theObject),
- myAction(theAction),
- myResult(theResult)
- {}
- virtual void Execute(){
- myResult = (myObject->*myAction)();
- }
-private:
- TObject* myObject;
- TAction myAction;
-};
-
-
-template<class TObject>
-class TVoidMemFunEvent: public SALOME_Event{
-public:
- typedef void (TObject::* TAction)();
- TVoidMemFunEvent(TObject* theObject, TAction theAction):
- myObject(theObject),
- myAction(theAction)
- {}
- virtual void Execute(){
- (myObject->*myAction)();
- }
-private:
- TObject* myObject;
- TAction myAction;
-};
-
-
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TStoreArg = TArg>
-class TMemFun1ArgEvent: public SALOME_Event{
-public:
- typedef TRes TResult;
- TResult myResult;
- typedef TResult (TObject::* TAction)(TArg);
- TMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg,
- TResult theResult = TResult()):
- myObject(theObject),
- myAction(theAction),
- myResult(theResult),
- myArg(theArg)
- {}
- virtual void Execute(){
- myResult = (myObject->*myAction)(myArg);
- }
-private:
- TObject* myObject;
- TAction myAction;
- TStoreArg myArg;
-};
-
-
-template<class TObject, typename TArg, typename TStoreArg = TArg>
-class TVoidMemFun1ArgEvent: public SALOME_Event{
-public:
- typedef void (TObject::* TAction)(TArg);
- TVoidMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg):
- myObject(theObject),
- myAction(theAction),
- myArg(theArg)
- {}
- virtual void Execute(){
- (myObject->*myAction)(myArg);
- }
-private:
- TObject* myObject;
- TAction myAction;
- TStoreArg myArg;
-};
-
-
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class TMemFun2ArgEvent: public SALOME_Event{
-public:
- typedef TRes TResult;
- TResult myResult;
- typedef TResult (TObject::* TAction)(TArg,TArg1);
- TMemFun2ArgEvent(TObject* theObject, TAction theAction,
- TArg theArg, TArg1 theArg1,
- TResult theResult = TResult()):
- myObject(theObject),
- myAction(theAction),
- myResult(theResult),
- myArg(theArg),
- myArg1(theArg1)
- {}
- virtual void Execute(){
- myResult = (myObject->*myAction)(myArg,myArg1);
- }
-private:
- TObject* myObject;
- TAction myAction;
- TStoreArg myArg;
- TStoreArg1 myArg1;
-};
-
-
-template<class TObject, typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class TVoidMemFun2ArgEvent: public SALOME_Event{
-public:
- typedef void (TObject::* TAction)(TArg,TArg1);
- TVoidMemFun2ArgEvent(TObject* theObject, TAction theAction, TArg theArg, TArg1 theArg1):
- myObject(theObject),
- myAction(theAction),
- myArg(theArg),
- myArg1(theArg1)
- {}
- virtual void Execute(){
- (myObject->*myAction)(myArg,myArg1);
- }
-private:
- TObject* myObject;
- TAction myAction;
- TStoreArg myArg;
- TStoreArg1 myArg1;
-};
-
-
-// Template function for processing events with result returing
-template<class TEvent> inline typename TEvent::TResult ProcessEvent(TEvent* theEvent){
- typename TEvent::TResult aResult;
- if(SALOME_Event::IsSessionThread()){
- theEvent->Execute();
- aResult = theEvent->myResult;
- }else{
- theEvent->process();
- aResult = theEvent->myResult;
- }
- delete theEvent;
- return aResult;
-}
-
-
-// Template function for processing events without result
-inline void ProcessVoidEvent(SALOME_Event* theEvent){
- if(SALOME_Event::IsSessionThread()){
- theEvent->Execute();
- }else{
- theEvent->process();
- }
- delete theEvent;
-}
-
-
-#endif
+++ /dev/null
-// SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
-//
-// 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 : TestLifeCycleCORBA.cxx
-// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-// Module : SALOME
-// $Header$
-
-#include <iostream>
-#include <unistd.h>
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Component)
-#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
-#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "utilities.h"
-#include "SALOMETraceCollector.hxx"
-#include <OpUtil.hxx>
-
-using namespace std;
-
-int main (int argc, char * argv[])
-{
-
- try
- {
- // Initializing omniORB
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
-
- // Obtain a reference to the root POA
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
-
- SALOME_NamingService _NS(orb) ;
-
- SALOME_LifeCycleCORBA _LCC(&_NS) ;
-
- // get a local container (with a name based on local hostname),
- // load an engine, and invoque methods on that engine
-
- string containerName = GetHostname();
-
- cout << containerName << endl;
- cout << "FindOrLoadComponent " + containerName + "/" + "SalomeTestComponent" << endl;
- MESSAGE("FindOrLoadComponent " + containerName + "/" + "SalomeTestComponent" );
-
- Engines::Component_var mycompo =
- _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
-
- ASSERT(!CORBA::is_nil(mycompo));
-
- Engines::TestComponent_var m1;
- m1 = Engines::TestComponent::_narrow(mycompo);
-
- ASSERT(!CORBA::is_nil(m1));
-
- SCRUTE(m1->instanceName());
- MESSAGE("Coucou " << m1->Coucou(1L));
-
- // get another container (with a fixed name),
- // load an engine, and invoque methods on that engine
-
- string containerName2 = "FactoryServerPy";
-
- Engines::Component_var mycompo2 =
- _LCC.FindOrLoad_Component(containerName2.c_str(),"SALOME_TestComponentPy");
-
- ASSERT(!CORBA::is_nil(mycompo2));
-
- Engines::TestComponent_var m2;
- m2 = Engines::TestComponent::_narrow(mycompo2);
-
- ASSERT(!CORBA::is_nil(m2));
-
- SCRUTE(m2->instanceName());
- cout << m2->instanceName() << endl;
- MESSAGE("Coucou " << m2->Coucou(1L));
-
- Engines::Component_var mycompo3 = _LCC.FindOrLoad_Component("totoPy","SALOME_TestComponentPy");
- ASSERT(!CORBA::is_nil(mycompo3));
- Engines::TestComponent_var m3 = Engines::TestComponent::_narrow(mycompo3);
- ASSERT(!CORBA::is_nil(m3));
- cout << m3->instanceName() << endl;
-
- string containerName4 = containerName + "/titiPy";
- Engines::Component_var mycompo4 = _LCC.FindOrLoad_Component(containerName4.c_str(),"SALOME_TestComponentPy");
- ASSERT(!CORBA::is_nil(mycompo4));
- Engines::TestComponent_var m4 = Engines::TestComponent::_narrow(mycompo4);
- ASSERT(!CORBA::is_nil(m4));
- cout << m4->instanceName() << endl;
-
- }
- catch(CORBA::COMM_FAILURE& ex)
- {
- INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught a CORBA::SystemException.");
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-
- return 0;
-}
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : InquireServersQThread.cxx
-// Author : Vasily RUSYAEV
-// Module : SALOME
-// $Header$
-
-#include "utilities.h"
-#include "InquireServersQThread.h"
-
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qabstractlayout.h>
-#include <qlayout.h>
-#include <qevent.h>
-#include <qfont.h>
-#include <qmessagebox.h>
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qstringlist.h>
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qdesktopwidget.h>
-#endif
-//VRV: porting on Qt 3.0.5
-
-#include <qsize.h>
-
-#include <SALOMEconfig.h>
-
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "SALOME_NamingService.hxx"
-//#include "utilities.h"
-#include "OpUtil.hxx"
-using namespace std;
-
-#include CORBA_CLIENT_HEADER(SALOME_Session)
-#include CORBA_CLIENT_HEADER(SALOME_Registry)
-#include CORBA_CLIENT_HEADER(SALOMEDS)
-#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-#include CORBA_CLIENT_HEADER(SALOME_Component)
-
-#define MARGIN_SIZE 5
-#define SPACING_SIZE 3
-
-static QString findFile( QString filename );
-static QString addSlash( const QString& path );
-
-InquireServersGUI::InquireServersGUI()
- : QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder | WType_TopLevel | WStyle_StaysOnTop | WX11BypassWM )
-{
- myGUI = false;
- myThread = new InquireServersQThread(this);
-
- // 1. Polish the appearance
- setMargin( MARGIN_SIZE );
- setSpacing( SPACING_SIZE );
- setFrameStyle( QFrame::Plain | QFrame::Box );
- setLineWidth( 2 );
- setMinimumSize( 200, 150 );
-
- // 2. Splash image
- QFrame* frm = new QFrame( this );
- frm->setFrameStyle( QFrame::Box | QFrame::Raised );
- QHBoxLayout* frmLayout = new QHBoxLayout( frm );
- frmLayout->setMargin( MARGIN_SIZE );
- QLabel* splash = 0;
- splash = new QLabel( frm, "splash" );
- frmLayout->addWidget( splash );
- // setting pixmap
- QString path = findFile( "Application-Splash.png" );
- splash->setPixmap( QPixmap( path ) );
-
- // 3. Progress bar
- myPrgBar = new QProgressBar( this, "QProgressBar" );
- myPrgBar->setFixedWidth( splash->pixmap()->isNull() ? 180 : splash->sizeHint().width() );
- //Sets the total number of steps .
- myPrgBar->setTotalSteps ( myThread->getInquiredServers() );
- myPrgBar->setProgress( 0 );
-
- // 4. Info label
- QWidget* aWgt1 = new QWidget( this );
- QHBoxLayout* aHBoxLayout1 = new QHBoxLayout( aWgt1 );
- myLabel = new QLabel( tr( "Loading:" ), aWgt1 );
- myLabel->setFixedWidth( splash->pixmap()->isNull() ? 180 : splash->sizeHint().width() );
- myLabel->setAlignment( AlignLeft );
- QFont theFont = myLabel->font();
- theFont.setBold(true);
- myLabel->setFont( theFont );
- aHBoxLayout1->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aHBoxLayout1->addWidget( myLabel );
- aHBoxLayout1->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
-
- // 5. <Cancel> button
- QWidget* aWgt = new QWidget( this );
- QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt );
- QPushButton* myCancelBtn = new QPushButton( tr( "Cancel" ), aWgt );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- aHBoxLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aHBoxLayout->addWidget( myCancelBtn );
- aHBoxLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
-
- //Center widget
-#if QT_VERSION >= 0x030005
- QDesktopWidget *d = QApplication::desktop();
-#else
- QWidget *d = QApplication::desktop();
-#endif
-//VRV: porting on Qt 3.0.5
-
- int w = d->width(); // returns desktop width
- int h = d->height(); // returns desktop height
- QSize mySize = sizeHint (); // returns widget size
- int Xc = ( w - mySize.width() ) / 2;
- int Yc = ( h - mySize.height() ) / 2;
- move( Xc, Yc );
-
- myThread->start();
-}
-
-InquireServersGUI::~InquireServersGUI()
-{
- delete myThread;
-}
-
-void InquireServersGUI::getArgs( int& _argc, char *** _argv)
-{
- _argc = qApp->argc();
- *_argv = qApp->argv();
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose : cancel loading of SALOME
-//=================================================================================
-void InquireServersGUI::ClickOnCancel()
-{
- //it's necessary to stop asking servers
- myThread->stop();
- myGUI = false;
- //Also we should send QCloseEvent in order to close this widget (and remove from screen)
- //QThread::postEvent ( this, new QCloseEvent() );
- qApp->exit(1);
-}
-
-void InquireServersGUI::closeEvent ( QCloseEvent * pe)
-{
- //default implementation calls e->accept(), which hides this widget.
- //See the QCloseEvent documentation for more details.
- pe->accept();
- QApplication::flushX ();
- QApplication::syncX ();
- qApp->exit();
-}
-
-void InquireServersGUI::customEvent( QCustomEvent* pe )
-{
- switch( pe->type() )
- {
- case InquireEvent::ProgressEvent:
- {
- int* value = ( int* )(( InquireEvent*)pe)->data();
- myPrgBar->setProgress( *value );
- break;
- }
- case InquireEvent::ProgressEventLabel:
- {
- QString* myString = ( QString* )(( InquireEvent*)pe)->data();
- myLabel->setText( *myString );
- break;
- }
- case InquireEvent::ProgressEventError:
- {
- QString* myErrDesc = ( QString* )(( InquireEvent*)pe)->data();
- QString appName = "SALOME Professional";
- QString error = "An internal error occurred.\n"+ *myErrDesc + "\n";
- QMessageBox myMsgBox(appName,error,QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton,
- QMessageBox::NoButton,0,"MY",TRUE,WStyle_DialogBorder|WStyle_StaysOnTop);
- myMsgBox.exec();
- ClickOnCancel();
- break;
- }
- default:
- {
- ;
- }
- }
-}
-
-int InquireServersGUI::getExitStatus()
-{
- return myThread->getExitStatus();
-}
-
-InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
- : receiver(r), myExitStatus(0)
-{
- char* cenv;
-
- IsChecking = true;
- myServersCount = 5;
- //how many times we should repeat attempts to get response from all needed for launching SALOME servers
- myRepeat = 30; // default value, user can change it by setting CSF_RepeatServerRequest env.variable
- cenv = getenv( "CSF_RepeatServerRequest" );
- if ( cenv ) {
- int val = atoi( cenv );
- if ( val > 0 )
- myRepeat = val;
- }
- //define delay time between two attempts
- myDelay = 1000000; // 1 second
- QString str = "Loading: ";
- myMessages[0] = "Checking naming service...";
- myMessages[1] = str + "SALOME_Registry_Server" + "...";
- myMessages[2] = str + "SALOMEDS_Server" + "...";
- myMessages[3] = str + "SALOME_ModuleCatalog_Server" + "...";
- myMessages[4] = str + "SALOME_Session_Server" + "...";
- myMessages[5] = "";
- myMessages[6] = "";
- myMessages[7] = "";
-
- r->getArgs( _argc, &_argv);
-
- // NRI : Temporary solution for SuperVisionContainer
- for ( int i=1; i<=(_argc-1); i++) {
- if (strcmp(_argv[i],"CPP")==0) {
- myMessages[5] = str + "SALOME_Container FactoryServer" + "...";
- myServersCount++;
- }
- if (strcmp(_argv[i],"PY")==0) {
- myMessages[6] = str + "SALOME_ContainerPy.py FactoryServerPy" + "...";
- myServersCount++;
- }
- if (strcmp(_argv[i],"SUPERV")==0) {
- myMessages[7] = str + "SALOME_Container SuperVisionContainer" + "...";
- myServersCount++;
- }
- if (strcmp(_argv[i],"GUI")==0) {
- r->withGUI(true);
- }
- }
-}
-
-void InquireServersQThread::run()
-{
-while (IsChecking)
- {
- for (int i=1; i<=8; i++)
- {
- if ( myMessages[i-1].isEmpty() ) {
- if (i==8) {
- IsChecking = false;
- //myExitStatus should be 0 because all servers exist and work
- myExitStatus = 0;
- //we should send QCloseEvent in order to close this widget (and remove from screen)
- QThread::postEvent ( receiver , new QCloseEvent() );
- } else
- continue;
- }
- QString *message = new QString(myMessages[i-1]);
- QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEventLabel, message ) );
- QThread::usleep(200000);
- QString *errMsg;
- bool result = AskServer(i,&errMsg);
- if (result)
- {
- QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEvent, new int( i ) ) );
- if (i==8)
- {
- IsChecking = false;
- //myExitStatus should be 0 because all servers exist and work
- myExitStatus = 0;
- //we should send QCloseEvent in order to close this widget (and remove from screen)
- QThread::postEvent ( receiver , new QCloseEvent() );
- }
- }
- else
- {
- QThread::postEvent( receiver, new InquireEvent( ( QEvent::Type )InquireEvent::ProgressEventError, errMsg ) );
- //myExitStatus should be 1 because we didn't receive response from server
- myExitStatus = 1;
- return;
- }
- }
- }
-}
-
-bool InquireServersQThread::AskServer(int iteration, QString ** errMessage)
-{
- ASSERT(iteration<=myServersCount);
- //will be set true if we get response from server
- bool IsPassed = false;
- QString errDescription;
- switch (iteration)
- {
- case 1:
- //First checking - existence of Naming Service
- for (int i = myRepeat; i ; i--)
- {
- try
- {
- CORBA::ORB_var orb = CORBA::ORB_init(_argc,_argv) ;
- CORBA::Object_var obj = orb->resolve_initial_references("NameService");
- CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow(obj);
- if (CORBA::is_nil(_root_context))
- continue;
- else
- IsPassed = true;
- break;
- }
- catch(CORBA::COMM_FAILURE&)
- {
- MESSAGE("CORBA::COMM_FAILURE: unable to contact the naming service");
- }
- catch(...)
- {
- MESSAGE("Unknown Exception: unable to contact the naming service");
- }
- QThread::usleep(myDelay);
- }
- if (!IsPassed)
- *errMessage = new QString("unable to contact the naming service");
- break;
- case 2:
- //checking - existence of SALOME_Registry_Server
- case 3:
- //checking - existence of SALOMEDS_Server
- case 4:
- //checking - existence of SALOME_ModuleCatalog_Server
- case 5:
- //checking - existence of SALOME_Session_Server
- case 6:
- //checking - existence of SALOME_Container FactoryServer
- case 7:
- //checking - existence of SALOME_ContainerPy.py FactoryServerPy
- case 8:
- //checking - existence of SALOME_Container SuperVisionContainer
-
-
- IsPassed = pingServer(iteration, errDescription);
- if (!IsPassed)
- *errMessage = new QString(errDescription);
- break;
- }
-return IsPassed;
-}
-
-bool InquireServersQThread::pingServer(int iteration, QString& errMessage)
-{
- ASSERT(iteration<=myServersCount);
- bool result = false;
- QString errorDescr;
- for (int i = myRepeat; i ; i--)
- {
- try
- {
- CORBA::ORB_var orb = CORBA::ORB_init(_argc,_argv) ;
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
- NS.init_orb( orb ) ;
- switch (iteration)
- {
- case 2:
- {
- CORBA::Object_var obj = NS.Resolve("/Registry");
- Registry::Components_var registry = Registry::Components::_narrow(obj) ;
- if (!CORBA::is_nil(registry))
- {
- MESSAGE("/Registry is found");
- registry->ping();
- result = true;
- MESSAGE("Registry was activated");
- return result;
- }
- }
- break;
- case 3:
- {
- CORBA::Object_var obj = NS.Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(obj) ;
- if (!CORBA::is_nil(studyManager))
-
-
-
-
-
- {
- MESSAGE("/myStudyManager is found");
- studyManager->ping();
- result = true;
- MESSAGE("StudyManager was activated");
- return result;
- }
- }
- break;
- case 4:
- {
- CORBA::Object_var obj = NS.Resolve("Kernel/ModulCatalog");
- SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
- if (!CORBA::is_nil(catalog))
- {
- MESSAGE("/Kernel/ModulCatalog is found");
- catalog->ping();
- result = true;
- MESSAGE("ModuleCatalog was activated");
- return result;
- }
- }
- break;
- case 5:
- {
- CORBA::Object_var obj = NS.Resolve("Kernel/Session");
- SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
- if (!CORBA::is_nil(session))
- {
- MESSAGE("/Kernel/Session is found");
- session->ping();
- result = true;
- MESSAGE("SALOME_Session was activated");
- return result;
- }
- }
- break;
- case 6:
- {
- string hostname = GetHostname();
- string containerName = "/Containers/";
- containerName += hostname;
- containerName += "/FactoryServer";
-
- CORBA::Object_var obj = NS.Resolve(containerName.c_str());
- Engines::Container_var FScontainer = Engines::Container::_narrow(obj) ;
- if (!CORBA::is_nil(FScontainer))
- {
- FScontainer->ping();
- result = true;
- MESSAGE("FactoryServer container was activated");
- return result;
- }
- }
- break;
- case 7:
- {
- string hostname = GetHostname();
- string containerName = "/Containers/";
- containerName += hostname;
- containerName += "/FactoryServerPy";
-
- CORBA::Object_var obj = NS.Resolve(containerName.c_str());
- Engines::Container_var FSPcontainer = Engines::Container::_narrow(obj) ;
- if (!CORBA::is_nil(FSPcontainer))
- {
- FSPcontainer->ping();
- result = true;
- MESSAGE("FactoryServerPy container was activated");
- return result;
- }
- }
- break;
- case 8:
- {
- string hostname = GetHostname();
- string containerName = "/Containers/";
- containerName += hostname;
- containerName += "/SuperVisionContainer";
-
- CORBA::Object_var obj = NS.Resolve(containerName.c_str());
- Engines::Container_var SVcontainer = Engines::Container::_narrow(obj) ;
- if (!CORBA::is_nil(SVcontainer))
- {
- SVcontainer->ping();
-
- result = true;
- MESSAGE("SuperVisionContainer container was activated");
- return result;
- }
- }
- break;
- }
- }
- catch (ServiceUnreachable&)
- {
- MESSAGE("Caught exception: Naming Service Unreachable");
- errorDescr = "Caught exception: Naming Service Unreachable";
- }
- catch (CORBA::COMM_FAILURE&)
- {
- MESSAGE("Caught CORBA::SystemException CommFailure.");
- errorDescr = "Caught CORBA::SystemException CommFailure";
- }
- catch (CORBA::SystemException&)
- {
- MESSAGE("Caught CORBA::SystemException.");
- errorDescr = "Caught CORBA::SystemException";
- }
- catch (CORBA::Exception&)
- {
- MESSAGE("Caught CORBA::Exception.");
- errorDescr = "Caught CORBA::Exception";
- }
- catch (...)
- {
- MESSAGE("Caught unknown exception.");
- errorDescr = "Caught unknown exception";
- }
- QThread::usleep(myDelay);
- }
- if (!result)
- {
- QString serverName;
- switch (iteration)
- {
- case 2:
- serverName = "SALOME_Registry_Server is not loaded. ";
- break;
- case 3:
- serverName = "SALOMEDS_Server is not loaded. ";
- break;
- case 4:
- serverName = "SALOME_ModuleCatalog_Server is not loaded. ";
- break;
- case 5:
- serverName = "SALOME_Session_Server is not loaded. ";
- break;
- case 6:
- serverName = "SALOME_Container FactoryServer is not loaded. ";
- break;
- case 7:
- serverName = "SALOME_ContainerPy.py FactoryServerPy is not loaded. ";
- break;
- case 8:
- serverName = "SALOME_Container SuperVisionContainer is not loaded. ";
- break;
- }
- errMessage = serverName + errorDescr;
- }
- return result;
-}
-
-static const char* SEPARATOR = ":";
-
-QString findFile( QString filename )
-{
- QString dir;
- char* cenv;
-
- // Try ${SALOME_SITE_DIR}/share/${SALOME_SITE_NAME}/resources directory
- cenv = getenv( "SALOME_SITE_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- cenv = getenv( "SALOME_SITE_NAME" );
- if ( cenv )
- dir = dir + cenv ;
- else
- dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
- cenv = getenv( "KERNEL_ROOT_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try CSF_ResourcesDefaults env.var directory ( or directory list )
- cenv = getenv( "CSF_ResourcesDefaults" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- QStringList dirList = QStringList::split( SEPARATOR, dir, false ); // skip empty entries
- for ( int i = 0; i < dirList.count(); i++ ) {
- QFileInfo fileInfo( addSlash( dirList[ i ] ) + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- }
- // Try ${HOME}/.salome/resources directory
- cenv = getenv( "HOME" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + ".salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- return filename;
-}
-QString addSlash( const QString& path )
-{
- if (!path.isNull()) {
-#ifdef WNT
- QChar slash ('\\');
-#else
- QChar slash ('/');
-#endif
- if ( path.at(path.length()-1) != slash )
- return path + slash;
- }
- return path;
-}
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : InquireServersQThread.h
-// Author : Vasily RUSYAEV
-// Module : SALOME
-// $Header$
-
-#include <qapplication.h>
-#include <qthread.h>
-#include <qvbox.h>
-#include <qprogressbar.h>
-#include <qlabel.h>
-
-/**********************************************************
-** Class: InquireEvent
-** Descr: Contains QCustomEvents for posting to InquireServersQThread
-** Level: Private
-***********************************************************/
-
-class InquireEvent : public QCustomEvent
-{
-public:
-
- enum myCustomEvents{ ProgressEvent = QEvent::User + 10, ProgressEventLabel, ProgressEventError };
-
- InquireEvent( QEvent::Type type , void* data = 0 )
- : QCustomEvent( type, data ) {}
- ~InquireEvent()
- {
- type() == (QEvent::Type)ProgressEvent ?
- delete ( int* )data() : delete ( QString* )data();
- }
-};
-
-class InquireServersGUI;
-
-class InquireServersQThread : public QThread
-{
-public:
- InquireServersQThread( InquireServersGUI* r );
-
- //the main loop of this thread
- virtual void run() ;
- //stop to ask servers
- void stop()
- {
- IsChecking = false;
- myExitStatus = 1;
- }
- //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
- int getExitStatus() { return myExitStatus;}
- //return count of inquired servers
- int getInquiredServers() { return myServersCount; }
-
-private:
-
-//functions:
-
- bool AskServer(int iteration, QString ** message);
- bool pingServer(int iteration, QString& errMessage);
-
-//variables:
-
- InquireServersGUI* receiver;
- int _argc ;
- char ** _argv;
- //this variable is true if we are checking servers
- bool IsChecking;
- //count of inquired servers
- int myServersCount;
- //how many times we should repeat attempt to get response from all needed for launching SALOME servers
- int myRepeat;
- //define delay time between two attempts in microseconds
- int myDelay;
- //this strings' array contains messages for each server (e.g. "Loading: SALOMEDS_Server")
- QString myMessages[8];
- //exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
- int myExitStatus;
-
-} ;
-
-class InquireServersGUI : public QVBox
-{
- Q_OBJECT
-
-public:
- InquireServersGUI() ;
- ~InquireServersGUI();
-
- //returns arguments of QApplication
- //they are needed for CORBA servers initialization
- void getArgs( int& _argc, char *** _argv);
- //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
- int getExitStatus();
- //launch IAPP
- bool withGUI() { return myGUI; }
- void withGUI(bool gui) { myGUI = gui; }
-
-protected:
- virtual void customEvent( QCustomEvent* );
- virtual void closeEvent ( QCloseEvent * );
-
-private:
- InquireServersQThread* myThread;
- QProgressBar* myPrgBar;
- //this string contains description of currently asked server
- QLabel* myLabel;
- bool myGUI;
-
-private slots:
-
- void ClickOnCancel();
-} ;
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Executables targets
-BIN = SALOME_Session_Loader
-
-BIN_MOC = InquireServersQThread.h
-BIN_SRC = InquireServersQThread.cxx
-
-BIN_CLIENT_IDL = SALOME_Session.idl \
- SALOMEDS.idl \
- SALOMEDS_Attributes.idl \
- SALOME_Component.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Registry.idl \
- SALOME_Exception.idl Logger.idl
-
-CPPFLAGS+=$(QT_MT_INCLUDES)
-CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
-LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
-
-
-@CONCLUDE@
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOME_Session_loader.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-/*! \file SALOME_Session_loader.cxx
- */
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Session)
-#include CORBA_CLIENT_HEADER(Logger)
-
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "SALOME_NamingService.hxx"
-#include "utilities.h"
-#include "SALOMETraceCollector.hxx"
-
-//! CORBA client for SALOME Session server : launch GUI
-/*!
- * SALOME_Session Loader launches a SALOME GUI on the SALOME session servant process
- */
-
-#include <qapplication.h>
-#include "InquireServersQThread.h"
-using namespace std;
-
-void MessageOutput( QtMsgType type, const char *msg )
-{
- switch ( type ) {
- case QtDebugMsg:
- MESSAGE( "Debug: " << msg );
- break;
- case QtWarningMsg:
- MESSAGE( "Warning: " << msg );
- break;
- case QtFatalMsg:
- MESSAGE( "Fatal: " << msg );
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
- SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- qInstallMsgHandler( MessageOutput );
-//VRV: T2.4 - Trace management improvement
- QApplication myQApp(argc, argv) ;
- InquireServersGUI myIS;
- myQApp.setMainWidget(&myIS);
- ASSERT(QObject::connect(&myQApp, SIGNAL(lastWindowClosed()), &myQApp, SLOT(quit()) ) );
- myIS.show();
- myQApp.exec();
-
- if (myIS.getExitStatus())
- exit(1);
-//VRV: T2.4 - Trace management improvement
- if (myIS.withGUI()) {
- try
- {
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
- NS.init_orb( orb ) ;
-
- CORBA::Object_var obj = NS.Resolve("/Kernel/Session");
-
- SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
- ASSERT(! CORBA::is_nil(session));
- MESSAGE("SALOME::Session::_narrow(obj)");
- INFOS("Corba initialisation, Distant server");
-
- // -------------------------------------------------------------
-
- session->GetInterface() ;
-
- // -------------------------------------------------------------
-
- orb->destroy() ;
- }
- catch (ServiceUnreachable&)
- {
- INFOS("Caught exception: Naming Service Unreachable");
- }
- catch (CORBA::COMM_FAILURE&)
- {
- INFOS("Caught CORBA::SystemException CommFailure.");
- }
- catch (CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch (CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch (...)
- {
- INFOS("Caught unknown exception.");
- }
- return 0 ;
- }
- INFOS("Normal Exit"); // without this trace, Splash remains on screen !
- delete myThreadTrace;
- return 0 ;
-}
-
-
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_Algorithm.hxx"
-#include "MED_Utilities.hxx"
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-namespace MED{
- //---------------------------------------------------------------
- TElemGroup
- GetElemsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo)
- {
- MSG(MYDEBUG,"GetElemsByEntity(...)");
- TElemGroup aGroup;
- MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
- for(; anIter != theEntityInfo.end(); anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- const MED::TGeom& aGeom = anIter->second;
- TElemMap& anElemMap = aGroup[anEntity];
-
- if(anEntity == eNOEUD){
- anElemMap[ePOINT1] = theWrapper.GetPNodeInfo(theMeshInfo);
- continue;
- }
-
- MED::TGeom::const_iterator anGeomIter = aGeom.begin();
- for(; anGeomIter != aGeom.end(); anGeomIter++){
- const EGeometrieElement& aGeo = anGeomIter->first;
- switch(aGeo){
- case ePOLYGONE: {
- anElemMap[ePOLYGONE] = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
- break;
- }
- case ePOLYEDRE: {
- anElemMap[ePOLYEDRE] = theWrapper.GetPPolyedreInfo(theMeshInfo,anEntity,aGeo);
- break;
- }
- default: {
- anElemMap[aGeo] = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
- }}
-
- }
- }
- ADDMSG(MYDEBUG,"\n");
- return aGroup;
- }
-
-
- //---------------------------------------------------------------
- TFamilyGroup
- GetFamilies(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo)
- {
- MSG(MYDEBUG,"GetFamilies(...)");
- TErr anErr;
- TFamilyGroup aGroup;
- TInt aNbFam = theWrapper.GetNbFamilies(*theMeshInfo);
- INITMSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam<<"\n");
- for(TInt iFam = 1; iFam <= aNbFam; iFam++){
- PFamilyInfo aFamilyInfo = theWrapper.GetPFamilyInfo(theMeshInfo,iFam,&anErr);
- if(anErr >= 0)
- aGroup.insert(aFamilyInfo);
- }
- ADDMSG(MYDEBUG,"\n");
- return aGroup;
- }
-
-
- TGroupInfo
- GetFamiliesByGroup(const TFamilyGroup& theGroupInfo)
- {
- MSG(MYDEBUG,"GetFamiliesByGroup(...)");
- TGroupInfo aGroup;
- TFamilyGroup::const_iterator anIter = theGroupInfo.begin();
- for(; anIter != theGroupInfo.end(); anIter++){
- const PFamilyInfo& aFamilyInfo = *anIter;
- TInt aNbGroup = aFamilyInfo->GetNbGroup();
- for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
- aGroup[aFamilyInfo->GetGroupName(iGroup)].insert(aFamilyInfo);
- }
- }
-
-#ifdef _DEBUG_
- if(MYDEBUG){
- TGroupInfo::const_iterator anIter = aGroup.begin();
- for(; anIter != aGroup.end(); anIter++){
- string aName = anIter->first;
- INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
- const TFamilyGroup& aFamilyGroup = anIter->second;
- TFamilyGroup::const_iterator anFamIter = aFamilyGroup.begin();
- for(; anFamIter != aFamilyGroup.end(); anFamIter++){
- const PFamilyInfo& aFamilyInfo = *anFamIter;
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyInfo->GetName()<<"'\n");
- }
- }
- ADDMSG(MYDEBUG,"\n");
- }
-#endif
-
- return aGroup;
- }
-
-
- //---------------------------------------------------------------
- TTimeStampGroup
- GetFieldsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo)
- {
- MSG(MYDEBUG,"GetFieldsByEntity(...)");
- TTimeStampGroup aGroup;
- TInt aNbFields = theWrapper.GetNbFields();
- INITMSG(MYDEBUG,"GetNbFields() = "<<aNbFields<<"\n");
- for(TInt iField = 1; iField <= aNbFields; iField++){
- PFieldInfo aFieldInfo = theWrapper.GetPFieldInfo(theMeshInfo,iField);
- INITMSG(MYDEBUG,"aFieldName = '"<<aFieldInfo->GetName()<<
- "'; aNbComp = "<<aFieldInfo->GetNbComp()<<"; ");
- MED::TGeom aGeom;
- EEntiteMaillage anEntity = EEntiteMaillage(-1);
- TInt aNbTimeStamps = theWrapper.GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom);
- ADDMSG(MYDEBUG,"anEntity = "<<anEntity<<"; GetNbTimeStamps = "<<aNbTimeStamps<<"\n");
- for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- PTimeStampInfo aTimeStamp =
- theWrapper.GetPTimeStampInfo(aFieldInfo,anEntity,aGeom,iTimeStamp);
- aGroup[aFieldInfo].insert(aTimeStamp);
- INITMSG(MYDEBUG,"aDt = "<<aTimeStamp->GetDt()
- <<", Unit = \'"<<aTimeStamp->GetUnitDt()
- <<"\', aNbGauss = "<<aTimeStamp->GetNbGauss()<<"\n");
- }
- }
- ADDMSG(MYDEBUG,"\n");
- return aGroup;
- }
-
-
- TFieldGroup
- GetFieldsByEntity(const TTimeStampGroup& theTimeStampGroup)
- {
- TFieldGroup aGroup;
- TTimeStampGroup::const_iterator anIter = theTimeStampGroup.begin();
- for(; anIter != theTimeStampGroup.end(); anIter++){
- //const PFieldInfo& aFieldInfo = anIter->first;
- const TTimeStampSet& aTimeStampSet = anIter->second;
- if(aTimeStampSet.empty()) continue;
- const PTimeStampInfo& aTimeStampInfo = *aTimeStampSet.begin();
- aGroup[aTimeStampInfo->GetEntity()].insert(*anIter);
- }
- return aGroup;
- }
-
-
- TFamilyByEntity
- GetFamiliesByEntity(TWrapper& theWrapper,
- const TElemGroup& theElemGroup,
- const TFamilyGroup& theFamilyGroup)
- {
- MSG(MYDEBUG,"GetFamiliesByEntity(...)");
- TFamilyByEntity aFamilyByEntity;
-
- typedef map<TInt,PFamilyInfo> TFamilyByIdMap;
- TFamilyByIdMap aFamilyByIdMap;
- TFamilyGroup::const_iterator anIter = theFamilyGroup.begin();
- for(; anIter != theFamilyGroup.end(); anIter++){
- const PFamilyInfo& aFamilyInfo = *anIter;
- aFamilyByIdMap.insert(TFamilyByIdMap::value_type(aFamilyInfo->GetId(),aFamilyInfo));
- }
-
- if(!aFamilyByIdMap.empty()){
- typedef set<TInt> TFamilyIdSet;
- typedef map<EEntiteMaillage,TFamilyIdSet> TFamilyIdByEntity;
- TFamilyIdByEntity aFamilyIdByEntity;
-
- if(!theElemGroup.empty()){
- TElemGroup::const_iterator anIter = theElemGroup.begin();
- for(; anIter != theElemGroup.end(); anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[anEntity];
- const TElemMap& anElemMap = anIter->second;
- TElemMap::const_iterator anElemIter = anElemMap.begin();
- for(; anElemIter != anElemMap.end(); anElemIter++){
- const PElemInfo& aElemInfo = anElemIter->second;
- if(TInt aNbElem = aElemInfo->GetNbElem()){
- for(TInt i = 0; i < aNbElem; i++){
- aFamilyIdSet.insert(aElemInfo->GetFamNum(i));
- }
- }
- }
- }
- }
-
- if(!aFamilyIdByEntity.empty()){
- TFamilyIdByEntity::const_iterator anIter = aFamilyIdByEntity.begin();
- for(; anIter != aFamilyIdByEntity.end(); anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- INITMSG(MYDEBUG,"anEntity = "<<anEntity<<":\n");
- const TFamilyIdSet& aFamilyIdSet = anIter->second;
- TFamilyIdSet::const_iterator anFamilyIdIter = aFamilyIdSet.begin();
- for(; anFamilyIdIter != aFamilyIdSet.end(); anFamilyIdIter++){
- const TInt& aFamilyId = *anFamilyIdIter;
- TFamilyByIdMap::const_iterator
- anFamilyByIdMapIter = aFamilyByIdMap.find(aFamilyId);
- if(anFamilyByIdMapIter != aFamilyByIdMap.end()){
- const PFamilyInfo& aFamilyInfo = anFamilyByIdMapIter->second;
- aFamilyByEntity[anEntity].insert(aFamilyInfo);
- INITMSG(MYDEBUG,
- "aFamilyName = '"<<aFamilyInfo->GetName()<<
- "' anId = "<<aFamilyInfo->GetId()<<"\n");
- }
- }
- }
- }
- }
- ADDMSG(MYDEBUG,"\n");
- return aFamilyByEntity;
- }
-
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Algorithm_HeaderFile
-#define MED_Algorithm_HeaderFile
-
-#include "MED_Structures.hxx"
-#include "MED_Wrapper.hxx"
-
-#include <set>
-
-namespace MED{
- //---------------------------------------------------------------
- typedef std::map<EGeometrieElement,PElemInfo> TElemMap;
- typedef std::map<EEntiteMaillage,TElemMap> TElemGroup;
-
- TElemGroup GetElemsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo);
-
-
- //---------------------------------------------------------------
- typedef std::set<PFamilyInfo> TFamilyGroup;
-
- TFamilyGroup GetFamilies(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo);
-
-
- //---------------------------------------------------------------
- typedef std::map<EEntiteMaillage,TFamilyGroup> TFamilyByEntity;
-
- TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper,
- const TElemGroup& theElemGroup,
- const TFamilyGroup& theFamilyGroup);
-
-
- //---------------------------------------------------------------
- typedef std::map<std::string,TFamilyGroup> TGroupInfo;
-
- TGroupInfo GetFamiliesByGroup(const TFamilyGroup& theGroupInfo);
-
-
- //---------------------------------------------------------------
- typedef std::set<PTimeStampInfo> TTimeStampSet;
- typedef std::map<PFieldInfo,TTimeStampSet> TTimeStampGroup;
-
- TTimeStampGroup GetFieldsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo);
-
-
- //---------------------------------------------------------------
- typedef std::map<EEntiteMaillage,TTimeStampGroup> TFieldGroup;
-
- TFieldGroup GetFieldsByEntity(const TTimeStampGroup& theTimeStampGroup);
-
-}
-
-#endif
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Common_HeaderFile
-#define MED_Common_HeaderFile
-
-#include <stdexcept>
-#include <valarray>
-#include <vector>
-#include <string>
-#include <set>
-#include <map>
-
-extern "C"{
-#include <hdf5.h>
-}
-
-#include <boost/shared_ptr.hpp>
-
-namespace MED{
-
- enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
-
-
- template<class T> class SharedPtr: public boost::shared_ptr<T>
- {
- public:
- SharedPtr() {}
-
- template<class Y>
- explicit SharedPtr(Y * p):
- boost::shared_ptr<T>(p)
- {}
-
- template<class Y>
- SharedPtr(SharedPtr<Y> const & r):
- boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag())
- {}
-
- template<class Y>
- SharedPtr& operator=(SharedPtr<Y> const & r)
- {
- boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag()).swap(*this);
- return *this;
- }
-
- template<class Y> SharedPtr& operator()(Y * p) // Y must be complete
- {
- return operator=<Y>(SharedPtr<Y>(p));
- }
-
- operator const T& () const
- {
- return *get();
- }
-
- operator T& ()
- {
- return *get();
- }
- };
-
-
- template<class TContainer>
- class ConstSliceArray
- {
- const TContainer& myConstContainer;
- std::slice mySlice;
- protected:
- size_t GetID(size_t theId) const
- {
- if(theId < mySlice.size()){
- size_t anId = mySlice.start() + theId*mySlice.stride();
- if(anId < myConstContainer.size())
- return anId;
- }
- throw std::out_of_range();
- return -1;
- }
-
- public:
- typedef typename TContainer::value_type TValue;
-
- ConstSliceArray(const TContainer& theContainer,
- const std::slice& theSlice):
- myConstContainer(theContainer),
- mySlice(theSlice)
- {
- }
-
- const TValue& operator[](size_t theId) const
- {
- return myConstContainer[GetID(theId)];
- }
-
- size_t size() const
- {
- return mySlice.size();
- }
- };
-
-
- template<class TContainer>
- class SliceArray: public ConstSliceArray<TContainer>
- {
- TContainer& myContainer;
-
- public:
- typedef ConstSliceArray<TContainer> TSupperClass;
- SliceArray(TContainer& theContainer,
- const std::slice& theSlice):
- TSupperClass(theContainer,theSlice),
- myContainer(theContainer)
- {
- }
-
- typename TSupperClass::TValue& operator[](size_t theId)
- {
- return myContainer[GetID(theId)];
- }
- };
-
-
- typedef enum {eFAUX, eVRAI} EBooleen ;
- typedef double TFloat;
- typedef int TInt;
-
- typedef hid_t TIdt;
- typedef herr_t TErr;
-
- typedef enum {eFLOAT64=6, eINT=26} ETypeChamp;
-
- typedef enum {eNON_STRUCTURE, eSTRUCTURE} EMaillage;
-
- typedef enum {eCART, eCYL, eSPHER} ERepere;
-
- typedef enum {eNOD, eDESC} EConnectivite ;
-
- typedef enum {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
- eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
- ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310,
- ePYRA13=313, ePENTA15=315, eHEXA20=320,
- ePOLYGONE=400, ePOLYEDRE=500, eNONE=0} EGeometrieElement;
-
- typedef enum {eMAILLE, eFACE, eARETE, eNOEUD} EEntiteMaillage;
-
- typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil;
-
- typedef std::vector<TFloat> TFloatVector;
- typedef std::vector<std::string> TStringVector;
- typedef std::vector<TInt> TIntVector;
- typedef std::set<std::string> TStringSet;
-
- typedef std::map<EGeometrieElement,TInt> TGeom;
- typedef std::map<EEntiteMaillage,TGeom> TEntityInfo;
-
- typedef std::set<EGeometrieElement> TGeomSet;
- typedef std::map<EEntiteMaillage,TGeomSet> TEntity2GeomSet;
-
- const TEntity2GeomSet& GetEntity2GeomSet();
-
- template<int>
-
- TInt GetNbConn(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- template<>
- TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- template<>
- TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- TInt GetNbNodes(EGeometrieElement typmai);
-
- struct TNameInfo;
- typedef SharedPtr<TNameInfo> PNameInfo;
-
- struct TMeshInfo;
- typedef SharedPtr<TMeshInfo> PMeshInfo;
-
- struct TFamilyInfo;
- typedef SharedPtr<TFamilyInfo> PFamilyInfo;
-
- struct TElemInfo;
- typedef SharedPtr<TElemInfo> PElemInfo;
-
- struct TNodeInfo;
- typedef SharedPtr<TNodeInfo> PNodeInfo;
-
- struct TPolygoneInfo;
- typedef SharedPtr<TPolygoneInfo> PPolygoneInfo;
-
- struct TPolyedreInfo;
- typedef SharedPtr<TPolyedreInfo> PPolyedreInfo;
-
- struct TCellInfo;
- typedef SharedPtr<TCellInfo> PCellInfo;
-
- struct TFieldInfo;
- typedef SharedPtr<TFieldInfo> PFieldInfo;
-
- struct TTimeStampInfo;
- typedef SharedPtr<TTimeStampInfo> PTimeStampInfo;
-
- struct TTimeStampVal;
- typedef SharedPtr<TTimeStampVal> PTimeStampVal;
-
- class TWrapper;
- typedef SharedPtr<TWrapper> PWrapper;
-};
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : VISU_Structure.cxx
-// Author : Eugeny NIKOLAEV
-// Module : VISU
-
-#include "MED_Structures.hxx"
-#include "MED_Utilities.hxx"
-using namespace MED;
-
-#if defined __GNUC__
- #if __GNUC__ == 2
- #define __GNUC_2__
- #endif
-#endif
-
-#if defined __GNUC_2__
-#define GETINDEX(anArray,ind) anArray[ind]
-#else
-#define GETINDEX(anArray,ind) anArray.at(ind)
-#endif
-
-namespace MED{
-
- TInt GetNbNodes(EGeometrieElement typmai)
- {
- return typmai%100;
- }
-
- template<>
- TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim)
- {
- TInt nsup = 0;
-
- if(typent == eMAILLE){
- TInt edim = typmai / 100;
- if(mdim == 2 || mdim == 3)
- if(edim == 1)
- nsup = 1;
-
- if(mdim == 3)
- if (edim == 2)
- nsup = 1;
- }
-
- return nsup + typmai%100;
- }
-
- template<>
- TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim)
- {
- return typmai%100;
- }
-
- std::string GetString(TInt theId, TInt theStep,
- const TString& theString)
- {
- const char* aPos = &GETINDEX(theString,theId*theStep);
- TInt aSize = std::min(TInt(strlen(aPos)),theStep);
- return std::string(aPos,aSize);
- }
-
- void SetString(TInt theId, TInt theStep,
- TString& theString,
- const std::string& theValue)
- {
- TInt aSize = std::min(TInt(theValue.size()+1),theStep);
- char* aPos = &GETINDEX(theString,theId*theStep);
- strncpy(aPos,theValue.c_str(),aSize);
- }
-
-}
-
-//---------------------------------------------------------------
-TInt TFamilyInfo::GetAttrId(TInt theId) const {
- return GETINDEX(myAttrId,theId);
-}
-
-TInt TFamilyInfo::GetAttrVal(TInt theId) const {
- return GETINDEX(myAttrVal,theId);
-}
-
-void TFamilyInfo::SetAttrId(TInt theId,TInt theVal) {
- GETINDEX(myAttrId,theId) = theVal;
-}
-
-void TFamilyInfo::SetAttrVal(TInt theId,TInt theVal) {
- GETINDEX(myAttrVal,theId) = theVal;
-}
-
-//---------------------------------------------------------------
-TInt TElemInfo::GetFamNum(TInt theId) const {
- return GETINDEX(myFamNum,theId);
-}
-
-TInt TElemInfo::GetElemNum(TInt theId) const {
- return GETINDEX(myElemNum,theId);
-}
-
-void TElemInfo::SetFamNum(TInt theId,TInt theVal) {
- GETINDEX(myFamNum,theId) = theVal;
-}
-
-//---------------------------------------------------------------
-TFloat TNodeInfo::GetNodeCoord(TInt theId,TInt theComp) const {
- return GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp);
-}
-
-void TNodeInfo::SetNodeCoord(TInt theId,TInt theComp,TFloat theVal) {
- GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp) = theVal;
-}
-
-//---------------------------------------------------------------
-TInt TCellInfo::GetConn(TInt theElemId, TInt theConnId) const {
- return GETINDEX(myConn,GetConnDim()*theElemId + theConnId);
-}
-
-void TCellInfo::SetConn(TInt theElemId, TInt theConnId, TInt theVal){
- GETINDEX(myConn,GetConnDim()*theElemId + theConnId) = theVal;
-}
-
-TConstConnSlice
-TCellInfo::GetConnSlice(TInt theElemId) const
-{
- return TConstConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1));
-}
-
-TConnSlice
-TCellInfo::GetConnSlice(TInt theElemId)
-{
- return TConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1));
-}
-
-//---------------------------------------------------------------
-TInt TPolygoneInfo::GetNbConn(TInt theElemId) const {
- TInt i1 = GETINDEX(myIndex,theElemId);
- TInt i2 = GETINDEX(myIndex,theElemId+1);
- TInt ret = i2 - i1;
- return ret;
-}
-
-//---------------------------------------------------------------
-TInt TPolyedreInfo::GetNbConn(TInt theElemId) const {
- TInt ind1 = GETINDEX(myIndex,theElemId);
- TInt ind2 = GETINDEX(myIndex,theElemId+1);
-
- TInt inf1 = GETINDEX(myFacesIndex,ind1-1);
- TInt inf2 = GETINDEX(myFacesIndex,ind2-1);
-
- TInt ret = inf2-inf1;
- return ret;
-}
-
-//---------------------------------------------------------------
-TFloat TTimeStampVal::GetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TInt theGauss) const {
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- TMeshValue::const_iterator anIter = myMeshValue.find(theGeom);
- if(anIter != myMeshValue.end()){
- TFloat aRet=GETINDEX(anIter->second,theId*aStep + theComp*aNbGauss + theGauss);
- return aRet;
- }
- return TFloat();
-}
-
-void TTimeStampVal::SetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TFloat theVal, TInt theGauss)
-{
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- GETINDEX(myMeshValue[theGeom],theId*aStep + theComp*aNbGauss + theGauss) = theVal;
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Structures_HeaderFile
-#define MED_Structures_HeaderFile
-
-#include "MED_Common.hxx"
-
-namespace MED{
-
- //---------------------------------------------------------------
- typedef std::vector<char> TString;
-
- std::string GetString(TInt theId, TInt theStep,
- const TString& theString);
-
- void SetString(TInt theId, TInt theStep,
- TString& theString,
- const std::string& theValue);
-
- //---------------------------------------------------------------
- struct TBase
- {
- virtual ~TBase() {}
- };
-
-
- //---------------------------------------------------------------
- struct TNameInfo: virtual TBase
- {
- TString myName;
- virtual std::string GetName() const = 0;
- virtual void SetName(const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- struct TMeshInfo: virtual TNameInfo
- {
- TInt myDim;
- TInt GetDim() const { return myDim;}
-
- EMaillage myType;
- EMaillage GetType() const { return myType;}
-
- TString myDesc;
- virtual std::string GetDesc() const = 0;
- virtual void SetDesc(const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- typedef std::vector<TInt> TFamAttr;
-
- struct TFamilyInfo: virtual TNameInfo
- {
- PMeshInfo myMeshInfo;
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
-
- TInt myId;
- TInt GetId() const { return myId;}
- void SetId(TInt theId) { myId = theId;}
-
- TInt myNbGroup;
- TInt GetNbGroup() const { return myNbGroup;}
-
- TString myGroupNames;
- virtual std::string GetGroupName(TInt theId) const = 0;
- virtual void SetGroupName(TInt theId, const std::string& theValue) = 0;
-
- TInt myNbAttr;
- TInt GetNbAttr() const { return myNbAttr;}
-
- TFamAttr myAttrId;
- TInt GetAttrId(TInt theId) const;
- void SetAttrId(TInt theId, TInt theVal);
-
- TFamAttr myAttrVal;
- TInt GetAttrVal(TInt theId) const;
- void SetAttrVal(TInt theId, TInt theVal);
-
- TString myAttrDesc;
- virtual std::string GetAttrDesc(TInt theId) const = 0;
- virtual void SetAttrDesc(TInt theId, const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- typedef std::vector<TInt> TElemNum;
-
- struct TElemInfo: virtual TBase
- {
- PMeshInfo myMeshInfo;
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
-
- TInt myNbElem;
- TInt GetNbElem() const { return myNbElem;}
-
- TElemNum myFamNum;
- TInt GetFamNum(TInt theId) const;
- void SetFamNum(TInt theId, TInt theVal);
-
- EBooleen myIsElemNum;
- EBooleen IsElemNum() const { return myIsElemNum;}
-
- TElemNum myElemNum;
- TInt GetElemNum(TInt theId) const;
- void SetElemNum(TInt theId, TInt theVal);
-
- EBooleen myIsElemNames;
- EBooleen IsElemNames() const { return myIsElemNames;}
-
- TString myElemNames;
- virtual std::string GetElemName(TInt theId) const = 0;
- virtual void SetElemName(TInt theId, const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- typedef std::vector<TFloat> TNodeCoord;
-
- struct TNodeInfo: virtual TElemInfo
- {
- TNodeCoord myCoord;
- TFloat GetNodeCoord(TInt theId, TInt theComp) const;
- void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal);
-
- ERepere mySystem;
- ERepere GetSystem() const { return mySystem;}
- void SetSystem(ERepere theSystem) { mySystem = theSystem;}
-
- TString myCoordNames;
- virtual std::string GetCoordName(TInt theId) const = 0;
- virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
-
- TString myCoordUnits;
- virtual std::string GetCoordUnit(TInt theId) const = 0;
- virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- typedef SliceArray<TElemNum> TConnSlice;
- typedef ConstSliceArray<TElemNum> TConstConnSlice;
-
- struct TCellInfo: virtual TElemInfo
- {
- EEntiteMaillage myTEntity;
- EEntiteMaillage GetEntity() const { return myTEntity;}
-
- EGeometrieElement myTGeom;
- EGeometrieElement GetGeom() const { return myTGeom;}
-
- EConnectivite myTConn;
- EConnectivite GetConn() const { return myTConn;}
-
- virtual TInt GetConnDim() const = 0;
-
- TElemNum myConn;
- TConstConnSlice GetConnSlice(TInt theElemId) const;
- TConnSlice GetConnSlice(TInt theElemId);
-
- TInt GetConn(TInt theElemId, TInt theConnId) const;
- void SetConn(TInt theElemId, TInt theConnId, TInt theVal);
- };
-
- //---------------------------------------------------------------
- struct TPolygoneInfo: virtual TElemInfo
- {
- EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
- EEntiteMaillage GetEntity() const { return myTEntity;}
-
- EGeometrieElement myTGeom; // ePOLYGONE
- EGeometrieElement GetGeom() const { return ePOLYGONE;}
-
- EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
- EConnectivite GetConn() const { return myTConn;}
-
- TInt myConnDim;
- TInt GetConnDim() const { return myConnDim;}
-
- TElemNum myConn; // Table de connectivities
- TElemNum GetConnectivite() const { return myConn;}
-
- TElemNum myIndex; // Table de indexes
- TElemNum GetIndex() {return myIndex;}
- TInt GetNbConn(TInt theElemId) const;
- };
-
- //---------------------------------------------------------------
- struct TPolyedreInfo: virtual TElemInfo
- {
- EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
- EEntiteMaillage GetEntity() const { return myTEntity;}
-
- EGeometrieElement myTGeom; // ePOLYEDRE
- EGeometrieElement GetGeom() const { return ePOLYEDRE;}
-
- EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
- EConnectivite GetConn() const { return myTConn;}
-
- TInt myNbConn;
- TInt GetNbConn() const { return myNbConn;}
-
- TElemNum myConn; // Table de connectivities
- TElemNum GetConnectivite() const { return myConn;}
-
- TInt myNbFacesIndex;
- TInt GetNbFacesIndex() const { return myNbFacesIndex;}
-
- TElemNum myFacesIndex; // Table de faces indexes
- TElemNum GetFacesIndex() {return myFacesIndex;}
-
- TElemNum myIndex; // Table de indexes
- TElemNum GetIndex() {return myIndex;}
- TInt GetNbConn(TInt theElemId) const;
- };
-
- //---------------------------------------------------------------
- struct TFieldInfo: virtual TNameInfo
- {
- PMeshInfo myMeshInfo;
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
-
- ETypeChamp myType;
- ETypeChamp GetType() const { return myType;}
-
- TInt myNbComp;
- TInt GetNbComp() const { return myNbComp;}
-
- EBooleen myIsLocal;
- EBooleen GetIsLocal() const { return myIsLocal;}
-
- TInt myNbRef;
- TInt GetNbRef() const { return myNbRef;}
-
- TString myCompNames;
- virtual std::string GetCompName(TInt theId) const = 0;
- virtual void SetCompName(TInt theId, const std::string& theValue) = 0;
-
- TString myUnitNames;
- virtual std::string GetUnitName(TInt theId) const = 0;
- virtual void SetUnitName(TInt theId, const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- struct TTimeStampInfo: virtual TBase
- {
- PFieldInfo myFieldInfo;
- const PFieldInfo& GetFieldInfo() const { return myFieldInfo;}
-
- EEntiteMaillage myEntity;
- EEntiteMaillage GetEntity() const { return myEntity;}
-
- TGeom myGeom;
- const TGeom& GetGeom() const { return myGeom;}
-
- TInt myNbGauss, myNumDt, myNumOrd;
- TInt GetNbGauss() const { return myNbGauss;}
- TInt GetNumDt() const { return myNumDt;}
- TInt GetNumOrd() const { return myNumOrd;}
-
- TFloat myDt;
- TFloat GetDt() const { return myDt;}
-
- TString myGaussName;
- virtual std::string GetGaussName() const = 0;
- virtual void SetGaussName(const std::string& theValue) = 0;
-
- TString myUnitDt;
- virtual std::string GetUnitDt() const = 0;
- virtual void SetUnitDt(const std::string& theValue) = 0;
- };
-
-
- //---------------------------------------------------------------
- typedef std::vector<TFloat> TValue;
- typedef std::map<EGeometrieElement,TValue> TMeshValue;
-
- struct TTimeStampVal: virtual TBase
- {
- PTimeStampInfo myTimeStampInfo;
- const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
-
- TMeshValue myMeshValue;
- TFloat GetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TInt theGauss = 0) const;
-
- void SetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TFloat theVal, TInt theGauss = 0);
- EModeProfil myPflMode;
- EModeProfil GetPflMode() const { return myPflMode;}
- void GetPflMode(EModeProfil theVal) { myPflMode = theVal;}
-
- TString myPflName;
- virtual std::string GetPflName() const = 0;
- virtual void SetPflName(const std::string& theValue) = 0;
- };
-
-}
-
-#endif
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_TStructures_HeaderFile
-#define MED_TStructures_HeaderFile
-
-#include "MED_Structures.hxx"
-
-namespace MED{
-
- const TInt DESC = 200;
- const TInt IDENT = 8;
- const TInt NOM = 32;
- const TInt LNOM = 80;
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTNameInfo: virtual TNameInfo
- {
- TTNameInfo(const std::string& theValue = "")
- {
- myName.resize(nNOM+1);
- SetName(theValue);
- }
-
- virtual std::string GetName() const {
- return GetString(0,nNOM,myName);
- }
-
- virtual void SetName(const std::string& theValue){
- SetString(0,nNOM,myName,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTMeshInfo:
- virtual TMeshInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
-
- TTMeshInfo(const PMeshInfo& theInfo):
- TNameInfoBase(theInfo->GetName())
- {
- myDim = theInfo->GetDim();
- myType = theInfo->GetType();
-
- myDesc.resize(nDESC+1);
- SetDesc(theInfo->GetDesc());
- }
-
- TTMeshInfo(TInt theDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = ""):
- TNameInfoBase(theValue)
- {
- myDim = theDim;
- myType = theType;
-
- myDesc.resize(nDESC+1);
- SetDesc(theDesc);
- }
-
- virtual std::string GetDesc() const {
- return GetString(0,nDESC,myDesc);
- }
-
- virtual void SetDesc(const std::string& theValue){
- SetString(0,nDESC,myDesc,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTFamilyInfo:
- virtual TFamilyInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
-
- TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
- TNameInfoBase(theInfo->GetName())
- {
- myMeshInfo = theMeshInfo;
-
- myId = theInfo->GetId();
-
- myNbGroup = theInfo->GetNbGroup();
- myGroupNames.resize(myNbGroup*nLNOM+1);
- if(myNbGroup){
- for(TInt anId = 0; anId < myNbGroup; anId++){
- SetGroupName(anId,theInfo->GetGroupName(anId));
- }
- }
-
- myNbAttr = theInfo->GetNbAttr();
- myAttrId.resize(myNbAttr);
- myAttrVal.resize(myNbAttr);
- myAttrDesc.resize(myNbAttr*nDESC+1);
- if(myNbAttr){
- for(TInt anId = 0; anId < myNbAttr; anId++){
- SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
- myAttrVal[anId] = theInfo->GetAttrVal(anId);
- myAttrId[anId] = theInfo->GetAttrId(anId);
- }
- }
- }
-
- TTFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
- TInt theNbAttr = 0,
- TInt theId = 0,
- const std::string& theValue = ""):
- TNameInfoBase(theValue)
- {
- myMeshInfo = theMeshInfo;
-
- myId = theId;
-
- myNbGroup = theNbGroup;
- myGroupNames.resize(theNbGroup*nLNOM+1);
-
- myNbAttr = theNbAttr;
- myAttrId.resize(theNbAttr);
- myAttrVal.resize(theNbAttr);
- myAttrDesc.resize(theNbAttr*nDESC+1);
- }
-
- TTFamilyInfo(const PMeshInfo& theMeshInfo,
- const std::string& theValue,
- TInt theId,
- const TStringSet& theGroupNames,
- const TStringVector& theAttrDescs = TStringVector(),
- const TIntVector& theAttrIds = TIntVector(),
- const TIntVector& theAttrVals = TIntVector()):
- TNameInfoBase(theValue)
- {
- myMeshInfo = theMeshInfo;
-
- myId = theId;
-
- myNbGroup = theGroupNames.size();
- myGroupNames.resize(myNbGroup*nLNOM+1);
- if(myNbGroup){
- TStringSet::const_iterator anIter = theGroupNames.begin();
- for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
- const std::string& aVal = *anIter;
- SetGroupName(anId,aVal);
- }
- }
-
- myNbAttr = theAttrDescs.size();
- myAttrId.resize(myNbAttr);
- myAttrVal.resize(myNbAttr);
- myAttrDesc.resize(myNbAttr*nDESC+1);
- if(myNbAttr){
- for(TInt anId = 0, anEnd = theAttrDescs.size(); anId < anEnd; anId++){
- SetAttrDesc(anId,theAttrDescs[anId]);
- myAttrVal[anId] = theAttrVals[anId];
- myAttrId[anId] = theAttrIds[anId];
- }
- }
- }
-
- virtual std::string GetGroupName(TInt theId) const {
- return GetString(theId,nLNOM,myGroupNames);
- }
-
- virtual void SetGroupName(TInt theId, const std::string& theValue){
- SetString(theId,nLNOM,myGroupNames,theValue);
- }
-
- virtual std::string GetAttrDesc(TInt theId) const {
- return GetString(theId,nDESC,myAttrDesc);
- }
-
- virtual void SetAttrDesc(TInt theId, const std::string& theValue){
- SetString(theId,nDESC,myAttrDesc,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTElemInfo: virtual TElemInfo
- {
- TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
- {
- myMeshInfo = theMeshInfo;
-
- myNbElem = theInfo->GetNbElem();
- myFamNum.resize(myNbElem);
-
- myIsElemNum = theInfo->IsElemNum();
- myElemNum.resize(myIsElemNum == eFAUX? 0: myNbElem);
-
- myIsElemNames = theInfo->IsElemNames();
- myElemNames.resize(myNbElem*nPNOM+1);
-
- if(myNbElem){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myFamNum[anId] = theInfo->GetFamNum(anId);
- }
- if(myIsElemNum == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myElemNum[anId] = theInfo->GetElemNum(anId);
- }
- }
- if(myIsElemNames == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
- SetElemName(anId,theInfo->GetElemName(anId));
- }
- }
- }
- }
-
- TTElemInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- myMeshInfo = theMeshInfo;
-
- myNbElem = theNbElem;
- myFamNum.resize(theNbElem);
-
- myIsElemNum = theIsElemNum;
- myElemNum.resize(theIsElemNum == eFAUX? 0: theNbElem);
-
- myIsElemNames = theIsElemNames;
- myElemNames.resize(theNbElem*nPNOM+1);
- }
-
- TTElemInfo(const PMeshInfo& theMeshInfo,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- myMeshInfo = theMeshInfo;
-
- myNbElem = theFamilyNums.size();
- myFamNum.resize(myNbElem);
-
- myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
- myElemNum.resize(theElemNums.size());
-
- myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
- myElemNames.resize(theElemNames.size()*nPNOM+1);
-
- if(myNbElem){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myFamNum[anId] = theFamilyNums[anId];
- }
- if(myIsElemNum == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myElemNum[anId] = theElemNums[anId];
- }
- }
- if(myIsElemNames == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
- const std::string& aVal = theElemNames[anId];
- SetElemName(anId,aVal);
- }
- }
- }
- }
-
- virtual std::string GetElemName(TInt theId) const {
- return GetString(theId,nPNOM,myElemNames);
- }
-
- virtual void SetElemName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myElemNames,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTNodeInfo:
- virtual TNodeInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
-
- TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
- TElemInfoBase(theMeshInfo,theInfo)
- {
- mySystem = theInfo->GetSystem();
-
- TInt aDim = theMeshInfo->GetDim();
- TInt aNbElem = theInfo->GetNbElem();
- myCoord.resize(aNbElem*aDim);
-
- for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
- for(TInt anDimId = 0; anDimId < aDim; anDimId++){
- SetNodeCoord(anElemId,anDimId,theInfo->GetNodeCoord(anElemId,anDimId));
- }
- }
-
- myCoordNames.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordName(anId,theInfo->GetCoordName(anId));
- }
-
- myCoordUnits.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
- }
- }
-
- TTNodeInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- ERepere theSystem = eCART,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
- TElemInfoBase(theMeshInfo,
- theNbElem,
- theIsElemNum,
- theIsElemNames)
- {
- mySystem = theSystem;
- myCoord.resize(theNbElem*theMeshInfo->myDim);
- myCoordNames.resize(theMeshInfo->myDim*nPNOM+1);
- myCoordUnits.resize(theMeshInfo->myDim*nPNOM+1);
- }
-
-
- TTNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
- const TFloatVector& theNodeCoords,
- const TStringVector& theCoordNames,
- const TStringVector& theCoordUnits,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
- TElemInfoBase(theMeshInfo,
- theFamilyNums,
- theElemNums,
- theElemNames)
- {
- mySystem = theSystem;
- myCoord.resize(theNodeCoords.size());
-
- for(TInt anId = 0, anEnd = myCoord.size(); anId < anEnd; anId++){
- myCoord[anId] = theNodeCoords[anId];
- }
-
- TInt aDim = theMeshInfo->GetDim();
- myCoordNames.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordName(anId,theCoordNames[anId]);
- }
-
- myCoordUnits.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordUnit(anId,theCoordUnits[anId]);
- }
- }
-
- virtual std::string GetCoordName(TInt theId) const {
- return GetString(theId,nPNOM,myCoordNames);
- }
-
- virtual void SetCoordName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCoordNames,theValue);
- }
-
- virtual std::string GetCoordUnit(TInt theId) const {
- return GetString(theId,nPNOM,myCoordUnits);
- }
-
- virtual void SetCoordUnit(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCoordUnits,theValue);
- }
- };
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTPolygoneInfo:
- virtual TPolygoneInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
-
- TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
- TElemInfoBase(theMeshInfo,theInfo)
- {
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
- myConnDim = theInfo->GetConnDim();
- myConn = theInfo->GetConnectivite();
- myIndex = theInfo->GetIndex();
- }
-
- TTPolygoneInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
- TElemInfoBase(theMeshInfo,
- theNbElem,
- theIsElemNum,
- theIsElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConnDim = theNbConn;
- myConn.resize(myConnDim);
- myIndex.resize(theNbElem+1);
- }
-
- TTPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
- TElemInfoBase(theMeshInfo,
- theFamilyNums,
- theElemNums,
- theElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConnDim = theConnectivities.size();
- myConn = theConnectivities;
- myIndex = theIndexes;
- }
- };
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTPolyedreInfo:
- virtual TPolyedreInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
-
- TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
- TElemInfoBase(theMeshInfo,theInfo)
- {
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
- myNbConn = theInfo->GetNbConn();
- myNbFacesIndex = theInfo->GetNbFacesIndex();
- myConn = theInfo->GetConnectivite();
- myFacesIndex = theInfo->GetFacesIndex();
- myIndex = theInfo->GetIndex();
- }
-
- TTPolyedreInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- TInt theNbFacesIndex,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
- TElemInfoBase(theMeshInfo,
- theNbElem,
- theIsElemNum,
- theIsElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myNbConn = theNbConn;
- myNbFacesIndex = theNbFacesIndex;
- myConn.resize(myNbConn);
- myFacesIndex.resize(myNbFacesIndex);
- myIndex.resize(theNbElem+1);
- }
-
- TTPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFacesIndexes,
- const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
- TElemInfoBase(theMeshInfo,
- theFamilyNums,
- theElemNums,
- theElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myNbConn = theConnectivities.size();
- myNbFacesIndex = theFacesIndexes.size();
- myConn = theConnectivities;
- myFacesIndex = theFacesIndexes;
- myIndex = theIndexes;
- }
- };
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTCellInfo:
- virtual TCellInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
-
- TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
- TElemInfoBase(theMeshInfo,theInfo)
- {
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
-
- TInt aConnDim = GetNbNodes(myTGeom);
- myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
- for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
- for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
- SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId));
- }
- }
- }
-
- TTCellInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
- TElemInfoBase(theMeshInfo,
- theNbElem,
- theIsElemNum,
- theIsElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConn.resize(theNbElem*GetNbConn<nV>(theTGeom,myTEntity,theMeshInfo->myDim));
- }
-
- TTCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
- TElemInfoBase(theMeshInfo,
- theFamilyNums,
- theElemNums,
- theElemNames)
- {
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
-
- TInt aConnDim = GetNbNodes(myTGeom);
- myNbElem = theConnectivities.size() / aConnDim;
- myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
- for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
- for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
- SetConn(anElemId,anConnId,theConnectivities[anElemId*aConnDim+anConnId]);
- }
- }
-
- }
-
- virtual TInt GetConnDim() const {
- return GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim);
- }
-
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTFieldInfo:
- virtual TFieldInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- {
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
-
- TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
- TNameInfoBase(theInfo->GetName())
- {
- myMeshInfo = theMeshInfo;
-
- myNbComp = theInfo->GetNbComp();
- myCompNames.resize(myNbComp*nPNOM+1);
- for(TInt anId = 0; anId < myNbComp; anId++){
- SetCompName(anId,theInfo->GetCompName(anId));
- }
-
- myUnitNames.resize(myNbComp*nPNOM+1);
- for(TInt anId = 0; anId < myNbComp; anId++){
- SetUnitName(anId,theInfo->GetUnitName(anId));
- }
-
- myType = theInfo->GetType();
-
- myIsLocal = theInfo->GetIsLocal();
- myNbRef = theInfo->GetNbRef();
- }
-
- TTFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theNbComp = 0,
- ETypeChamp theType = eFLOAT64,
- const std::string& theValue = "",
- EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1):
- TNameInfoBase(theValue)
- {
- myMeshInfo = theMeshInfo;
-
- myNbComp = theNbComp;
- myCompNames.resize(theNbComp*nPNOM+1);
- myUnitNames.resize(theNbComp*nPNOM+1);
-
- myType = theType;
-
- myIsLocal = theIsLocal;
- myNbRef = theNbRef;
- }
-
- virtual std::string GetCompName(TInt theId) const {
- return GetString(theId,nPNOM,myCompNames);
- }
-
- virtual void SetCompName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCompNames,theValue);
- }
-
- virtual std::string GetUnitName(TInt theId) const {
- return GetString(theId,nPNOM,myUnitNames);
- }
-
- virtual void SetUnitName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myUnitNames,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTTimeStampInfo: virtual TTimeStampInfo
- {
- TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
- {
- myFieldInfo = theFieldInfo;
-
- myEntity = theInfo->GetEntity();
- myGeom = theInfo->GetGeom();
-
- myNbGauss = theInfo->GetNbGauss();
- myNumDt = theInfo->GetNumDt();
- myNumOrd = theInfo->GetNumOrd();
- myDt = theInfo->GetDt();
-
- myUnitDt.resize(nPNOM+1);
- SetUnitDt(theInfo->GetUnitDt());
-
- myGaussName.resize(nNOM+1);
- SetGaussName(theInfo->GetGaussName());
- }
-
- TTTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
- TInt theNumDt = 0,
- TInt theNumOrd = 0,
- TFloat theDt = 0,
- const std::string& theUnitDt = "",
- const std::string& theGaussName = "")
- {
- myFieldInfo = theFieldInfo;
-
- myEntity = theEntity;
- myGeom = theGeom;
-
- myNbGauss = theNbGauss;
- myNumDt = theNumDt;
- myNumOrd = theNumDt;
- myDt = theDt;
-
- myUnitDt.resize(nPNOM+1);
- SetUnitDt(theUnitDt);
-
- myGaussName.resize(nNOM+1);
- SetGaussName(theGaussName);
- }
-
- virtual std::string GetGaussName() const {
- return GetString(0,nNOM,myGaussName);
- }
-
- virtual void SetGaussName(const std::string& theValue){
- SetString(0,nNOM,myGaussName,theValue);
- }
-
- virtual std::string GetUnitDt() const {
- return GetString(0,nPNOM,myUnitDt);
- }
-
- virtual void SetUnitDt(const std::string& theValue){
- SetString(0,nPNOM,myUnitDt,theValue);
- }
- };
-
-
- //---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- struct TTTimeStampVal: virtual TTimeStampVal
- {
- TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo, const PTimeStampVal& theInfo)
- {
- myTimeStampInfo = theTimeStampInfo;
-
- myPflMode = theInfo->GetPflMode();
-
- myPflName.resize(nNOM+1);
- SetPflName(theInfo->GetPflName());
-
- TInt aNbComp = theTimeStampInfo->GetFieldInfo()->GetNbComp();
- const TGeom& aTGeom = theTimeStampInfo->GetGeom();
- TInt aNbGauss = theTimeStampInfo->GetNbGauss();
- TGeom::const_iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- TInt aNbElem = anIter->second;
- TInt aSize = aNbElem*aNbComp*aNbGauss;
- TValue& aValue = myMeshValue[aGeom];
- aValue.resize(aSize);
- for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
- for(TInt aCompId = 0; aCompId < aNbComp; aCompId++){
- for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
- SetVal(aGeom,anElemId,aCompId,theInfo->GetVal(aGeom,anElemId,aCompId,aGaussId),aGaussId);
- }
- }
- }
- }
- }
-
- TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT)
- {
- myTimeStampInfo = theTimeStampInfo;
-
- myPflMode = thePflMode;
-
- myPflName.resize(nNOM+1);
- SetPflName(thePflName);
-
- TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = theTimeStampInfo->myNbGauss;
- const TGeom& aTGeom = theTimeStampInfo->myGeom;
- TGeom::const_iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- TInt aNb = anIter->second*aNbComp*aNbGauss;
- myMeshValue[aGeom].resize(aNb);
- }
- }
-
- virtual std::string GetPflName() const {
- return GetString(0,nNOM,myPflName);
- }
-
- virtual void SetPflName(const std::string& theValue){
- SetString(0,nNOM,myPflName,theValue);
- }
- };
-
-}
-
-#endif
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_TWrapper_HeaderFile
-#define MED_TWrapper_HeaderFile
-
-#include "MED_TStructures.hxx"
-#include "MED_Wrapper.hxx"
-
-namespace MED{
-
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- class TTWrapper: public TWrapper{
- public:
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PMeshInfo
- CrMeshInfo(TInt theDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = "")
- {
- return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theDim,
- theValue,
- theType,
- theDesc));
- }
-
- virtual
- PMeshInfo
- CrMeshInfo(const PMeshInfo& theInfo)
- {
- return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>(theInfo));
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
- TInt theNbAttr = 0,
- TInt theId = 0,
- const std::string& theValue = "")
- {
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbGroup,
- theNbAttr,
- theId,
- theValue));
- }
-
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const std::string& theValue,
- TInt theId,
- const MED::TStringSet& theGroupNames,
- const MED::TStringVector& theAttrDescs = MED::TStringVector(),
- const MED::TIntVector& theAttrIds = MED::TIntVector(),
- const MED::TIntVector& theAttrVals = MED::TIntVector())
- {
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theValue,
- theId,
- theGroupNames,
- theAttrDescs,
- theAttrIds,
- theAttrVals));
- }
-
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const PFamilyInfo& theInfo)
- {
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- ERepere theSystem = eCART,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbElem,
- theSystem,
- theIsElemNum,
- theIsElemNames));
- }
-
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
- const TFloatVector& theNodeCoords,
- const TStringVector& theCoordNames,
- const TStringVector& theCoordUnits,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theSystem,
- theNodeCoords,
- theCoordNames,
- theCoordUnits,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- const PNodeInfo& theInfo)
- {
- return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbElem,
- theNbConn,
- theTEntity,
- theTGeom,
- theTConn,
- theIsElemNum,
- theIsElemNames));
- }
-
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
- theConnectivities,
- theIndexes,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- const PPolygoneInfo& theInfo)
- {
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- TInt theNbFaces,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbElem,
- theNbConn,
- theNbFaces,
- theTEntity,
- theTGeom,
- theTConn,
- theIsElemNum,
- theIsElemNames));
- }
-
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFacesIndexes,
- const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
- theConnectivities,
- theFacesIndexes,
- theIndexes,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- const PPolyedreInfo& theInfo)
- {
- return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbElem,
- theTEntity,
- theTGeom,
- theTConn,
- theIsElemNum,
- theIsElemNames));
- }
-
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
- theConnectivities,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- const PCellInfo& theInfo)
- {
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theNbComp = 0,
- ETypeChamp theType = eFLOAT64,
- const std::string& theValue = "",
- EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1)
- {
- return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theNbComp,
- theType,
- theValue,
- theIsLocal,
- theNbRef));
- }
-
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- const PFieldInfo& theInfo)
- {
- return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theMeshInfo,
- theInfo));
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
- TInt theNumDt = 0,
- TInt theNumOrd = 0,
- TFloat theDt = 0,
- const std::string& theUnitDt = "",
- const std::string& theGaussName = "")
- {
- return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theFieldInfo,
- theEntity,
- theGeom,
- theNbGauss,
- theNumDt,
- theNumOrd,
- theDt,
- theUnitDt,
- theGaussName));
- }
-
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- const PTimeStampInfo& theInfo)
- {
- return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theFieldInfo,
- theInfo));
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PTimeStampVal
- CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT)
- {
- return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theTimeStampInfo,
- thePflName,
- thePflMode));
- }
-
- virtual
- PTimeStampVal
- CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const PTimeStampVal& theInfo)
- {
- return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
- (theTimeStampInfo,
- theInfo));
- }
-
- };
-
-}
-
-
-#endif
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_Utilities.hxx"
-#include "MED_Common.hxx"
-
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-int MED::PrefixPrinter::myCounter = 0;
-
-MED::PrefixPrinter::PrefixPrinter(bool theIsActive):
- myIsActive(theIsActive)
-{
- if(myIsActive)
- myCounter++;
- MSG(MYDEBUG,"MED::PrefixPrinter::PrefixPrinter(...)- "<<myCounter);
-}
-
-MED::PrefixPrinter::~PrefixPrinter()
-{
- if(myIsActive)
- myCounter--;
-}
-
-string MED::PrefixPrinter::GetPrefix()
-{
- if(myCounter)
- return string(myCounter*2,' ');
- return "";
-}
-
-
-static MED::TEntity2GeomSet Entity2GeomSet;
-
-bool InitEntity2GeomSet()
-{
- using namespace MED;
-
- TGeomSet& aGeomARETESet = Entity2GeomSet[eARETE];
- aGeomARETESet.insert(eSEG2);
- aGeomARETESet.insert(eSEG3);
-
- TGeomSet& aGeomFACESet = Entity2GeomSet[eFACE];
- aGeomFACESet.insert(eTRIA3);
- aGeomFACESet.insert(eQUAD4);
- aGeomFACESet.insert(eTRIA6);
- aGeomFACESet.insert(eQUAD8);
- aGeomFACESet.insert(ePOLYGONE);
-
- TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
- aGeomMAILLESet.insert(ePOINT1);
- aGeomMAILLESet.insert(aGeomARETESet.begin(),aGeomARETESet.end());
- aGeomMAILLESet.insert(aGeomFACESet.begin(),aGeomFACESet.end());
- aGeomMAILLESet.insert(eTETRA4);
- aGeomMAILLESet.insert(ePYRA5);
- aGeomMAILLESet.insert(ePENTA6);
- aGeomMAILLESet.insert(eHEXA8);
- aGeomMAILLESet.insert(eTETRA10);
- aGeomMAILLESet.insert(ePYRA13);
- aGeomMAILLESet.insert(ePENTA15);
- aGeomMAILLESet.insert(eHEXA20);
- aGeomMAILLESet.insert(ePOLYEDRE);
-
- return true;
-}
-
-static bool anIsInited = InitEntity2GeomSet();
-
-const MED::TEntity2GeomSet& MED::GetEntity2GeomSet()
-{
- return Entity2GeomSet;
-}
-
-
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Utilities_HeaderFile
-#define MED_Utilities_HeaderFile
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <stdexcept>
-
-
-namespace MED{
- using namespace std;
- class PrefixPrinter{
- static int myCounter;
- bool myIsActive;
- public:
- PrefixPrinter(bool theIsActive = true);
- ~PrefixPrinter();
-
- static string GetPrefix();
- };
-};
-
-//#define _DEBUG_
-#ifdef _DEBUG_
- #define MSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg<<" ("<<__FILE__<<" ["<<__LINE__<<"])\n"
- #define BEGMSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg
- #define INITMSG(deb,msg) MED::PrefixPrinter aPrefixPrinter(deb); BEGMSG(deb,msg)
- #define ADDMSG(deb,msg) if(deb) std::cout<<msg
-#else
- #define MSG(deb,msg)
- #define BEGMSG(deb,msg)
- #define INITMSG(deb,msg)
- #define ADDMSG(deb,msg)
-#endif
-
-
-#ifndef EXCEPTION
-
-#define EXCEPTION(TYPE, MSG) {\
- std::ostringstream aStream;\
- aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
- throw TYPE(aStream.str());\
-}
-
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : VISU_DatConvertor.cxx
-// Author : Alexey PETROV
-// Module : VISU
-
-#include "MED_Wrapper.hxx"
-#include "MED_Utilities.hxx"
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
-#endif
-
-namespace MED{
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PMeshInfo TWrapper::GetPMeshInfo(TInt theId,
- TErr* theErr)
- {
- PMeshInfo anInfo = CrMeshInfo();
- GetMeshInfo(theId,*anInfo,theErr);
- return anInfo;
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PFamilyInfo TWrapper::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr)
- {
- TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
- TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
- PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
- GetFamilyInfo(theId,*anInfo,theErr);
-
-#ifdef _DEBUG_
- string aName = anInfo->GetName();
- INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
- "'; andId = "<<anInfo->GetId()<<
- "; aNbAttr = "<<aNbAttr<<
- "; aNbGroup = "<<aNbGroup<<"\n");
- for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
- aName = anInfo->GetGroupName(iGroup);
- INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
- }
-#endif
-
- return anInfo;
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PNodeInfo TWrapper::GetPNodeInfo(const PMeshInfo& theMeshInfo,
- TErr* theErr)
- {
- TInt aNbElems = GetNbNodes(*theMeshInfo);
- PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
- GetNodeInfo(*anInfo,theErr);
-
-#ifdef _DEBUG_
- TInt aDim = theMeshInfo->myDim;
- TInt aNbElem = anInfo->GetNbElem();
- INITMSG(MYDEBUG,"GetPNodeInfo - aCoords: "<<aNbElem<<": ");
- TNodeCoord& aCoord = anInfo->myCoord;
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
- ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
- }
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG,endl);
-
- BEGMSG(MYDEBUG,"GetPNodeInfo - GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
- }
- ADDMSG(MYDEBUG,endl);
-
- if(anInfo->IsElemNum()){
- BEGMSG(MYDEBUG,"GetPNodeInfo - GetElemNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
- }
- ADDMSG(MYDEBUG,endl);
- }
-
- ADDMSG(MYDEBUG,endl);
-#endif
-
- return anInfo;
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PPolygoneInfo TWrapper::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn)
- {
- TInt aNbElem = GetNbPolygones(*theMeshInfo,theEntity,theGeom,theConn);
- TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
- PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
- GetPolygoneInfo(*anInfo);
-
-#ifdef _DEBUG_
- TElemNum aConn = anInfo->GetConnectivite();
- TElemNum aIndex = anInfo->GetIndex();
- TInt aNbIndex = aIndex.size();
- TInt aIndex0 = aIndex[0];
- INITMSG(MYDEBUG,"theGeom = "<<theGeom<<"; aNbElem = "<<aNbIndex-1<<": ");
- for(TInt iElem = 1; iElem < aNbIndex; iElem++){
- for (TInt i = aIndex0; i < aIndex[iElem];i++)
- ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
- ADDMSG(MYDEBUG," ");
- aIndex0 = aIndex[iElem];
- }
- ADDMSG(MYDEBUG,endl);
- BEGMSG(MYDEBUG,"Indexes: ");
- for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
- ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
- }
- ADDMSG(MYDEBUG,endl);
-#endif
-
- return anInfo;
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PPolyedreInfo TWrapper::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn)
- {
- TInt aNbElem = GetNbPolyedres(*theMeshInfo,theEntity,theGeom,theConn);
- TInt aNbConn = 0;
- TInt aNbFaces = 0;
- GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
- PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
- GetPolyedreInfo(*anInfo);
-
-#ifdef _DEBUG_
- TElemNum aConn = anInfo->GetConnectivite();
- TElemNum aFacesIndex = anInfo->GetFacesIndex();
- TElemNum aIndex = anInfo->GetIndex();
-
- TInt aNbIndex = aIndex.size();
-
- for (int aNp = 0; aNp < aNbIndex-1;aNp++){
- if (anInfo->IsElemNames())
- ADDMSG(MYDEBUG,anInfo->GetElemName(aNp)<<endl);
- else
- ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
-
- for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
- ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
- for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
- ADDMSG(MYDEBUG," "<<aConn[aNc]);
- }
- ADDMSG(MYDEBUG," ]"<<endl;);
- }
- }
-#endif
-
- return anInfo;
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PCellInfo TWrapper::GetPCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn,
- TErr* theErr)
- {
- TInt aNbElem = GetNbCells(*theMeshInfo,theEntity,theGeom,theConn);
- PCellInfo anInfo = CrCellInfo(theMeshInfo,aNbElem,theEntity,theGeom,theConn);
- GetCellInfo(*anInfo,theErr);
-
-#ifdef _DEBUG_
- TInt aConnDim = anInfo->GetConnDim();
- INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
- BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- for(TInt iConn = 0; iConn < aConnDim; iConn++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetConn(iElem,iConn)<<",");
- }
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG,endl);
-
- BEGMSG(MYDEBUG,"GetPCellInfo - GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
- }
- ADDMSG(MYDEBUG,endl);
-
- if(anInfo->IsElemNum()){
- BEGMSG(MYDEBUG,"GetPCellInfo - GetElemNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
- }
- ADDMSG(MYDEBUG,endl);
- }
- ADDMSG(MYDEBUG,endl);
-#endif
-
- return anInfo;
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PFieldInfo TWrapper::GetPFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr)
- {
- TInt aNbComp = GetNbComp(theId);
- PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
- GetFieldInfo(theId,*anInfo,theErr);
-
-#ifdef _DEBUG_
- INITMSG(MYDEBUG,
- "GetPFieldInfo - aNbComp = "<<aNbComp<<
- "; aType = "<<anInfo->GetType()<<"\n");
-#endif
-
- return anInfo;
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PTimeStampInfo TWrapper::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const MED::TGeom& theGeom,
- TInt theId,
- TErr* theErr)
- {
- PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
- GetTimeStampInfo(theId,*anInfo,theErr);
-
-#ifdef _DEBUG_
- INITMSG(MYDEBUG,
- "GetPTimeStampInfo - aNbGauss = "<<anInfo->GetNbGauss()<<
- "; aNumDt = "<<anInfo->GetNumDt()<<"\n");
-#endif
-
- return anInfo;
- }
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PTimeStampVal TWrapper::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- TErr* theErr)
- {
- PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
- GetTimeStampVal(*anInfo,theErr);
-
-#ifdef _DEBUG_
- TInt aNbGauss = theTimeStampInfo->GetNbGauss();
- PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
- TInt aNbComp = aFieldInfo->GetNbComp();
- INITMSG(MYDEBUG,"GetPTimeStampVal\n");
- TMeshValue& aMeshValue = anInfo->myMeshValue;
- TMeshValue::const_iterator aMeshValueIter = aMeshValue.begin();
- for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
- const EGeometrieElement& aGeom = aMeshValueIter->first;
- const TValue& aValue = aMeshValueIter->second;
- TInt iElemEnd = aValue.size() / aNbComp / aNbGauss;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<iElemEnd<<": ");
- for(TInt iElem = 0, anId = 0; iElem < iElemEnd; iElem++){
- ADDMSG(MYVALUEDEBUG,"{");
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- ADDMSG(MYVALUEDEBUG,aValue[anId++]<<" ");
- }
- ADDMSG(MYVALUEDEBUG,"| ");
- }
- ADDMSG(MYVALUEDEBUG,"} ");
- }
- ADDMSG(MYDEBUG,"\n");
- }
-#endif
-
- return anInfo;
- }
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Wrapper_HeaderFile
-#define MED_Wrapper_HeaderFile
-
-#include "MED_Structures.hxx"
-
-namespace MED{
-
- struct TWrapper{
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- PMeshInfo
- CrMeshInfo(TInt theDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = "") = 0;
-
- virtual
- PMeshInfo
- CrMeshInfo(const PMeshInfo& theInfo) = 0;
-
- virtual
- TInt
- GetNbMeshes(TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetMeshInfo(TInt theMeshId, TMeshInfo&,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetMeshInfo(const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- PMeshInfo
- GetPMeshInfo(TInt theId,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbFamilies(const TMeshInfo& theMeshInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- TInt
- GetNbFamAttr(TInt theFamId,
- const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- TInt
- GetNbFamGroup(TInt theFamId,
- const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetFamilyInfo(TInt theFamId,
- TFamilyInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetFamilyInfo(const TFamilyInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
- TInt theNbAttr = 0,
- TInt theId = 0,
- const std::string& theValue = "") = 0;
-
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const std::string& theValue,
- TInt theId,
- const TStringSet& theGroupNames,
- const TStringVector& theAttrDescs = TStringVector(),
- const TIntVector& theAttrIds = TIntVector(),
- const TIntVector& theAttrVals = TIntVector()) = 0;
-
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const PFamilyInfo& theInfo) = 0;
-
- PFamilyInfo
- GetPFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL)
- {}
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbNodes(const TMeshInfo& theMeshInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetNodeInfo(TNodeInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetNodeInfo(const TNodeInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- ERepere theSystem = eCART,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI) = 0;
-
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
- const TFloatVector& theNodeCoords,
- const TStringVector& theCoordNames,
- const TStringVector& theCoordUnits,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()) = 0;
-
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- const PNodeInfo& theInfo) = 0;
-
- PNodeInfo
- GetPNodeInfo(const PMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetPolygoneInfo(TPolygoneInfo& theInfo,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- SetPolygoneInfo(const TPolygoneInfo& theInfo,
- TErr* theErr = NULL)
- {}
-
- virtual
- TInt
- GetNbPolygones(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL)
- { return 0;}
-
- virtual
- TInt
- GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL)
- { return 0;}
-
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolygoneInfo();
- }
-
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolygoneInfo();
- }
-
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- const PPolygoneInfo& theInfo)
- {
- return PPolygoneInfo();
- }
-
- PPolygoneInfo
- GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn = eNOD);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr = NULL)
- {}
-
- virtual
- void
- SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr = NULL)
- {}
-
- virtual
- TInt
- GetNbPolyedres(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL)
- { return 0;}
-
- virtual
- void
- GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
- EConnectivite theConn,
- TInt& nf,
- TInt& nc,
- TErr* theErr = NULL)
- {}
-
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- TInt theNbConn,
- TInt theNbFaces,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolyedreInfo();
- }
-
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolyedreInfo();
- }
-
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- const PPolyedreInfo& theInfo)
- {
- return PPolyedreInfo();
- }
-
- PPolyedreInfo
- GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn = eNOD);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TEntityInfo
- GetEntityInfo(const TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL) = 0;
-
- virtual
- TInt
- GetNbCells(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetCellInfo(TCellInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetCellInfo(const TCellInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI) = 0;
-
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()) = 0;
-
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- const PCellInfo& theInfo) = 0;
-
- PCellInfo
- GetPCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn = eNOD,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbFields(TErr* theErr = NULL) = 0;
-
- virtual
- TInt
- GetNbComp(TInt theFieldId,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetFieldInfo(TInt theFieldId,
- TFieldInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetFieldInfo(const TFieldInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
-
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theNbComp = 0,
- ETypeChamp theType = eFLOAT64,
- const std::string& theValue = "",
- EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1) = 0;
-
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- const PFieldInfo& theInfo) = 0;
-
- PFieldInfo
- GetPFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbTimeStamps(const TFieldInfo& theInfo,
- const TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- GetTimeStampInfo(TInt theTimeStampId,
- TTimeStampInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
- TInt theNumDt = 0,
- TInt theNumOrd = 0,
- TFloat theDt = 0,
- const std::string& theUnitDt = "",
- const std::string& theGaussName = "") = 0;
-
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- const PTimeStampInfo& theInfo) = 0;
-
- PTimeStampInfo
- GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const MED::TGeom& theGeom,
- TInt theId,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetTimeStampVal(TTimeStampVal& theVal,
- TErr* theErr = NULL) = 0;
-
- virtual
- void
- SetTimeStamp(const TTimeStampVal& theTimeStampVal,
- TErr* theErr = NULL) = 0;
-
- virtual
- PTimeStampVal
- CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT) = 0;
-
- virtual
- PTimeStampVal
- CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const PTimeStampVal& theInfo) = 0;
-
- PTimeStampVal
- GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- TErr* theErr = NULL);
-
- };
-
-}
-
-#endif
+++ /dev/null
-#
-#
-# 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 :
-# Author :
-# Module :
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- MED_Common.hxx \
- MED_Wrapper.hxx \
- MED_TWrapper.hxx \
- MED_Structures.hxx \
- MED_TStructures.hxx \
- MED_Algorithm.hxx \
- MED_Utilities.hxx
-
-# Libraries targets
-
-LIB = libMEDWrapperBase.la
-LIB_SRC = \
- MED_Structures.cxx MED_Wrapper.cxx \
- MED_Algorithm.cxx MED_Utilities.cxx
-
-# Executables targets
-BIN =
-BIN_SRC =
-
-CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES)
-
-LDFLAGS+=
-
-@CONCLUDE@
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_Factory.hxx"
-#include "MED_Utilities.hxx"
-#include "MED_V2_2_Wrapper.hxx"
-#include "MED_V2_1_Wrapper.hxx"
-
-#include <stdio.h>
-
-extern "C"{
-#include <med.h>
-}
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-namespace MED{
-
- EVersion GetVersionId(const std::string& theFileName)
- {
- EVersion aVersion = eVUnknown;
- char* aFileName = const_cast<char*>(theFileName.c_str());
- med_idt aFid = MEDouvrir(aFileName,MED_LECTURE);
- MSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aFid = "<<aFid<<endl);
- if(aFid >= 0){
- med_int aMajor, aMinor, aRelease;
- med_err aRet = MEDversionLire(aFid,&aMajor,&aMinor,&aRelease);
- INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aRet = "<<aRet<<endl);
- if(aRet >= 0){
- if(aMajor >= 2 && aMinor >= 2)
- aVersion = eV2_2;
- else
- aVersion = eV2_1;
- }
- }
- INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aVersion = "<<aVersion<<endl);
- return aVersion;
- }
-
- PWrapper CrWrapper(const std::string& theFileName)
- {
- PWrapper aWrapper;
- EVersion aVersion = GetVersionId(theFileName);
- switch(aVersion){
- case eV2_2:
- aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
- break;
- case eV2_1:
- default:
- aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
- }
- return aWrapper;
- }
-
- PWrapper CrWrapper(const std::string& theFileName, EVersion theId)
- {
- EVersion aVersion = GetVersionId(theFileName);
-
- if(aVersion != theId)
- remove(theFileName.c_str());
-
- PWrapper aWrapper;
- switch(theId){
- case eV2_2:
- aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
- break;
- case eV2_1:
- aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
- break;
- }
- return aWrapper;
- }
-
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_Factory_HeaderFile
-#define MED_Factory_HeaderFile
-
-#include "MED_Wrapper.hxx"
-
-namespace MED{
-
- EVersion GetVersionId(const std::string& theFileName);
-
- PWrapper CrWrapper(const std::string& theFileName);
-
- PWrapper CrWrapper(const std::string& theFileName, EVersion theId);
-
-}
-
-#endif
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_Utilities.hxx"
-#include "MED_Algorithm.hxx"
-#include "MED_Factory.hxx"
-
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
-static int MYVALUEDEBUG = 0;
-
-static int MYWRITEDEBUG = 1;
-
-using namespace MED;
-
-
-void CheckMed(const std::string& theFileName)
-{
- MSG(MYDEBUG,"CheckMed - theFileName = '"<<theFileName<<"'");
- {
- PWrapper aMed = CrWrapper(theFileName);
- TInt aNbMeshes = aMed->GetNbMeshes();
- INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<endl);
- for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
-
- PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
- INITMSG(MYDEBUG,"aMeshInfo->GetName() = "<<aMeshInfo->GetName()<<endl);
-
- //continue;
-
- TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
- TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
-
- TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
-
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
-
- TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
-
- TTimeStampGroup aTimeStampGroup = GetFieldsByEntity(aMed,aMeshInfo,aEntityInfo);
-
- TFieldGroup aFieldGroup = GetFieldsByEntity(aTimeStampGroup);
-
- TFieldGroup::const_iterator aFieldGroupIter = aFieldGroup.begin();
- for(; aFieldGroupIter != aFieldGroup.end(); aFieldGroupIter++){
- const TTimeStampGroup& aTTimeStampGroup = aFieldGroupIter->second;
- TTimeStampGroup::const_iterator aTTimeStampGroupIter = aTTimeStampGroup.begin();
- for(; aTTimeStampGroupIter != aTTimeStampGroup.end(); aTTimeStampGroupIter++){
- PFieldInfo aFieldInfo = aTTimeStampGroupIter->first;
- const TTimeStampSet& aTimeStampSet = aTTimeStampGroupIter->second;
- TTimeStampSet::const_iterator aTTimeStampSetIter = aTimeStampSet.begin();
- for(; aTTimeStampSetIter != aTimeStampSet.end(); aTTimeStampSetIter++){
- PTimeStampInfo aTimeStampInfo = *aTTimeStampSetIter;
- TErr anErr;
- PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,&anErr);
- }
- }
- }
-
- }
- }
- MSG(MYDEBUG,"OK");
-}
-
-
-void CopyMed(const PWrapper& theMed,
- const PWrapper& theMed2,
- int theIncr)
-{
- TInt aNbMeshes = theMed->GetNbMeshes();
- MSG(MYDEBUG,"aNbMeshes = "<<aNbMeshes);
- std::string aName;
- for(TInt iMesh = 0; iMesh < aNbMeshes; iMesh++){
- PMeshInfo aMeshInfo = theMed->GetPMeshInfo(iMesh+1);
- TInt aDim = aMeshInfo->myDim;
- aName = aMeshInfo->GetName();
- INITMSG(MYDEBUG,"GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim<<"\n");
- PMeshInfo aMeshInfo2 = theMed2->CrMeshInfo(aMeshInfo);
- if(MYWRITEDEBUG){
- aName = aMeshInfo2->GetName();
-
- aName[0] += theIncr;
- aMeshInfo2->SetName(aName);
- theMed2->SetMeshInfo(aMeshInfo2);
- BEGMSG(MYDEBUG,"aNbMeshes2 = "<<theMed2->GetNbMeshes()<<"\n");
- }
-
- TEntityInfo aEntityInfo = theMed->GetEntityInfo(aMeshInfo);
-
- //continue;
-
- TInt aNbFields = theMed->GetNbFields();
- MSG(MYDEBUG,"GetNbFields() = "<<aNbFields);
- for(TInt iField = 0; iField < aNbFields; iField++){
- PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,iField+1);
- TInt aNbComp = aFieldInfo->GetNbComp();
- INITMSG(MYDEBUG,"aName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<";\n");
- PFieldInfo aFieldInfo2 = theMed->CrFieldInfo(aMeshInfo2,aFieldInfo);
-
- if(MYWRITEDEBUG){
- aName = aFieldInfo->GetName();
- aName[0] += theIncr;
- aFieldInfo2->SetName(aName);
- theMed2->SetFieldInfo(aFieldInfo2);
- }
-
- EEntiteMaillage anEntity;
- TGeom aTGeom;
- TInt aNbTimeStamps =
- theMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,anEntity,aTGeom);
- {
- INITMSG(MYDEBUG,"GetNbTimeStamps = "<<aNbTimeStamps<<endl);
- for(TInt iTimeStamp = 0; iTimeStamp < aNbTimeStamps; iTimeStamp++){
- PTimeStampInfo aTimeStampInfo =
- theMed->GetPTimeStampInfo(aFieldInfo,anEntity,aTGeom,iTimeStamp+1);
- TInt aNumDt = aTimeStampInfo->GetNumDt();
- TInt aNbGauss = aTimeStampInfo->GetNbGauss();
- INITMSG(MYDEBUG,"aNbGauss = "<<aNbGauss<<"; aNumDt = "<<aNumDt<<"\n");
-
- PTimeStampInfo aTimeStampInfo2 =
- theMed->CrTimeStampInfo(aFieldInfo2,aTimeStampInfo);
-
- PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
-
- PTimeStampVal aTimeStampVal2 = theMed->CrTimeStampVal(aTimeStampInfo2,aTimeStampVal);
-
- if(MYWRITEDEBUG) theMed2->SetTimeStamp(aTimeStampVal2);
-
- TMeshValue& aMeshValue = aTimeStampVal->myMeshValue;
- TMeshValue::iterator aMeshValueIter = aMeshValue.begin();
- for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
- EGeometrieElement aGeom = aMeshValueIter->first;
- TValue aValue = aMeshValueIter->second;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ");
- for(TInt i = 0, iEnd = aValue.size()/aNbComp; i < iEnd; i++){
- for(TInt j = 0, ij = i*aNbComp; j < aNbComp; j++, ij++){
- ADDMSG(MYVALUEDEBUG,aValue[ij]<<",");
- }
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG,"\n");
- }
- }
- }
- }
-
- TInt aNbFam = theMed->GetNbFamilies(aMeshInfo);
- MSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam);
- for(TInt iFam = 0; iFam < aNbFam; iFam++){
- PFamilyInfo aFamilyInfo = theMed->GetPFamilyInfo(aMeshInfo,iFam+1);
- TInt aNbGroup = aFamilyInfo->GetNbGroup();
- TInt aNbAttr = aFamilyInfo->GetNbAttr();
- TInt anId = aFamilyInfo->GetId();
- if(anId == 0)
- continue;
-
- aName = aFamilyInfo->GetName();
- INITMSG(MYDEBUG,"aName = '"<<aName<<"'; anId = "<<anId<<
- "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
- PFamilyInfo aFamilyInfo2 = theMed->CrFamilyInfo(aMeshInfo2,aFamilyInfo);
- for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
- aName = aFamilyInfo->GetGroupName(iGroup);
- INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
- aName[0] += theIncr;
- aFamilyInfo2->SetGroupName(iGroup,aName);
- }
-
- if(MYWRITEDEBUG){
- aName = aFamilyInfo->GetName();
- aName[0] += theIncr;
- aFamilyInfo2->SetName(aName);
- theMed2->SetFamilyInfo(aFamilyInfo2);
- INITMSG(MYDEBUG,"GetNbFamilies = "<<theMed2->GetNbFamilies(aMeshInfo2)<<endl);
- }
- }
-
- MSG(MYDEBUG,"GetEntityInfo - aNbEntities = "<<aEntityInfo.size());
- TEntityInfo::iterator anEntityInfoIter = aEntityInfo.begin();
- for(; anEntityInfoIter != aEntityInfo.end(); anEntityInfoIter++){
- const EEntiteMaillage& anEntity = anEntityInfoIter->first;
- INITMSG(MYDEBUG,"anEntity = "<<anEntity<<"\n");
- if(anEntity == eNOEUD){
- PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
- PNodeInfo aNodeInfo2 = theMed->CrNodeInfo(aMeshInfo2,aNodeInfo);
- if(MYWRITEDEBUG) theMed2->SetNodeInfo(aNodeInfo2);
- continue;
- }
- TGeom& aTGeom = anEntityInfoIter->second;
- TGeom::iterator anTGeomIter = aTGeom.begin();
- for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const EGeometrieElement& aGeom = anTGeomIter->first;
- const TInt& aNbElem = anTGeomIter->second;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
- switch(aGeom){
- case ePOLYGONE:
- {
- PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
- TElemNum aConn = aPolygoneInfo->GetConnectivite();
- TElemNum aIndex = aPolygoneInfo->GetIndex();
- TInt aNbIndex = aIndex.size();
- TInt aIndex0 = aIndex[0];
- for(TInt iElem = 1; iElem < aNbIndex; iElem++){
- for (TInt i = aIndex0; i < aIndex[iElem];i++)
- ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
- ADDMSG(MYDEBUG," ");
- aIndex0 = aIndex[iElem];
- }
- ADDMSG(MYDEBUG,endl);
- INITMSG(MYDEBUG,"Indexes :");
- for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
- ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
- }
- ADDMSG(MYDEBUG,endl);
- PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
- if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
- break;
- }
- case ePOLYEDRE:
- {
- PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
- TElemNum aConn = aPolyedreInfo->GetConnectivite();
- TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
- TElemNum aIndex = aPolyedreInfo->GetIndex();
-
- TInt aNbIndex = aIndex.size();
-
- for (int aNp = 0; aNp < aNbIndex-1;aNp++){
- if (aPolyedreInfo->IsElemNames())
- ADDMSG(MYDEBUG,aPolyedreInfo->GetElemName(aNp)<<endl);
- else
- ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
-
- for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
- ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
- for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
- ADDMSG(MYDEBUG," "<<aConn[aNc]);
- }
- ADDMSG(MYDEBUG," ]"<<endl;);
- }
- }
-
- PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
- if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
- break;
- }
- default:
- PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
- PCellInfo aCellInfo2 = theMed2->CrCellInfo(aMeshInfo2,aCellInfo);
- if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
- }
- }
- }
-
- }
- MSG(MYDEBUG,"OK");
-}
-
-
-void CopyMed(const std::string& theFileName,
- const std::string& theFileName2,
- MED::EVersion theVersion,
- int theNbCopy)
-{
- MSG(MYDEBUG,"CopyMed - theFileName = '"<<theFileName<<"'; theFileName2 = '"<<theFileName2<<"', theVersion = "<<theVersion);
-
- PWrapper aMed = CrWrapper(theFileName);
-
- PWrapper aMed2 = CrWrapper(theFileName2,theVersion);
-
- for(int i = 0; i < theNbCopy; i++)
- CopyMed(aMed,aMed2,i);
-}
-
-
-void ReadMed(const char* theFileName,
- const char* theFileName2,
- MED::EVersion theVersion = eV2_2,
- int theNbCopy = 1)
-{
- MSG(MYDEBUG,"theFileName = '"<<theFileName<<"'; "<<
- "theFileName2 = '"<<theFileName2<<"'; "<<
- "theVersion = "<<theVersion<<"; "<<
- "theNbCopy = "<<theNbCopy);
-
- CopyMed(theFileName,theFileName2,theVersion,theNbCopy);
-}
-
-
-int main(int argc, char** argv){
- try{
- if(argc == 2)
- CheckMed(argv[1]);
- if(argc == 3)
- ReadMed(argv[1],argv[2]);
- if(argc == 4)
- ReadMed(argv[1],argv[2],MED::EVersion(atoi(argv[3])));
- if(argc == 5)
- ReadMed(argv[1],argv[2],MED::EVersion(atoi(argv[3])),atoi(argv[4]));
- return 0;
- }catch(std::exception& exc){
- MSG(MYDEBUG,"Follow exception was accured :\n"<<exc.what());
- }catch(...){
- MSG(MYDEBUG,"Unknown exception was accured");
- }
- return 1;
-}
+++ /dev/null
-#
-#
-# 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 :
-# Author :
-# Module :
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Libraries targets
-
-LIB = libMEDWrapper.la
-LIB_SRC = \
- MED_Factory.cxx
-
-EXPORT_HEADERS = \
- MED_Factory.hxx
-
-# Executables targets
-BIN = MED_Test
-BIN_SRC =
-
-CPPFLAGS+= $(BOOST_CPPFLAGS) $(MED2_INCLUDES)
-
-LDFLAGS+= -lMEDWrapper_V2_2 -lMEDWrapper_V2_1
-
-LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapperBase
-
-@CONCLUDE@
+++ /dev/null
-#
-#
-# 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 :
-# Author :
-# Module :
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-SUBDIRS = Base V2_1 V2_2 Factory
-
-@MODULE@
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction : _MED1cstring
- * - Description : convertit une chaine de caracteres FORTRAN
- * en une nouvelle chaine de caracteres C
- * dont la longueur est passee en parametre.
- * Les caracteres completes sont des blancs
- * - Parametres :
- * - chaine (IN) : la chaine FORTRAN
- * - longueur_reelle (IN) : la longueur de la chaine FORTRAN
- * - longueur_fixee (IN) : longueur de la chaine C a construire
- * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
- */
-
-namespace med_2_1{
-
-char *
-_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee)
-{
- char *nouvelle;
- int i;
-
- if (longueur_reelle > longueur_fixee)
- return NULL;
-
- if ((nouvelle = (char *) malloc(sizeof(char)*(longueur_fixee+1))) == NULL)
- return NULL;
-
- for (i=0;i<longueur_reelle;i++)
- *(nouvelle+i) = *(chaine+i);
-
- for (i=longueur_reelle;i<longueur_fixee;i++)
- *(nouvelle+i) = ' ';
-
- *(nouvelle+longueur_fixee) = '\0';
-
- return nouvelle;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction _MED2cstring
- * - Description : convertit une chaine de caracteres FORTRAN en
- * nouvelle chaine de caracteres C
- * - Parametres :
- * - chaine (IN) : la chaine FORTRAN
- * - longueur (IN) : longueur de la chaine
- * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
- */
-
-namespace med_2_1{
-
-char *
-_MED2cstring(char *chaine, int longueur)
-{
- char *nouvelle;
- char *temoin;
- int long_reelle = longueur;
- int i;
-
- if ( longueur < 0 ) return NULL;
-
- temoin = chaine+longueur-1;
- while (*temoin == ' ' && (temoin != chaine) )
- {
- temoin --;
- long_reelle--;
- }
- if ( *temoin == ' ') long_reelle = 0;
-
- if ((nouvelle = (char *) malloc(sizeof(char)*(long_reelle+1))) == NULL)
- return NULL;
-
- for (i=0;i<long_reelle+1;i++)
- *(nouvelle+i) = *(chaine+i);
- *(nouvelle+long_reelle) = '\0';
-
- return nouvelle;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-_MEDGeometrieElement(med_geometrie_element typ_geo[],med_entite_maillage typ_ent)
-{
- int i;
- med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-
- switch(typ_ent)
- {
- case MED_MAILLE :
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- typ_geo[i] = typ_mai[i];
- break;
-
- case MED_FACE :
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- typ_geo[i] = typ_fac[i];
- break;
-
- case MED_ARETE :
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- typ_geo[i] = typ_are[i];
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_V2_1_Wrapper.hxx"
-#include "MED_Utilities.hxx"
-
-#include "med.hxx"
-using namespace med_2_1;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-
-namespace MED{
- namespace V2_1{
-
- //---------------------------------------------------------------
- class TFile{
- TFile();
- TFile(const TFile&);
-
- public:
- TFile(const std::string& theFileName):
- myFid(-1),
- myCount(0),
- myFileName(theFileName)
- {}
-
- ~TFile(){
- Close();
- }
-
- void Open(EModeAcces theMode, TErr* theErr = NULL){
- if(myCount++ == 0){
- char* aFileName = const_cast<char*>(myFileName.c_str());
- myFid = MEDouvrir(aFileName,med_mode_acces(theMode));
- }
- if(theErr){
- *theErr = TErr(myFid);
- INITMSG(MYDEBUG && myFid < 0,"TFile::Open - MED_MODE_ACCES = "<<theMode<<"; myFid = "<<myFid<<endl);
- }else if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - MEDouvrir('"<<myFileName<<"',"<<theMode<<")");
- }
-
- const TIdt& Id() const {
- if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - GetFid() < 0");
- return myFid;
- }
-
- void Close(){
- if(--myCount == 0)
- MEDfermer(myFid);
- }
-
- protected:
- std::string myFileName;
- TInt myCount;
- TIdt myFid;
- };
-
-
- //---------------------------------------------------------------
- class TFileWrapper{
- PFile myFile;
-
- public:
- TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL):
- myFile(theFile)
- {
- myFile->Open(theMode,theErr);
- }
-
- ~TFileWrapper(){
- myFile->Close();
- }
- };
-
-
- //---------------------------------------------------------------
- TVWrapper::TVWrapper(const std::string& theFileName):
- myFile(new TFile(theFileName))
- {}
-
-
- TInt TVWrapper::GetNbMeshes(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnMaa(myFile->Id());
- }
-
-
- void TVWrapper::GetMeshInfo(TInt theMeshId,
- MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet = MEDmaaInfo(myFile->Id(),
- theMeshId,
- &theInfo.myName[0],
- &theInfo.myDim);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetMeshInfo - MEDmaaInfo(...)");
- }
-
-
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
-
- TErr aRet = MEDmaaCr(myFile->Id(),
- &anInfo.myName[0],
- anInfo.myDim);
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetMeshInfo - MEDmaaCr(...)");
- }
-
-
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetMeshInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbFamilies(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- 0,
- MED_FAMILLE);
- }
-
-
- TInt TVWrapper::GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- theFamId,
- MED_ATTR);
- }
-
-
- TInt TVWrapper::GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- theFamId,
- MED_GROUPE);
- }
-
-
- void TVWrapper::GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TErr aRet = MEDfamInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- theFamId,
- &theInfo.myName[0],
- &theInfo.myId,
- &theInfo.myAttrId[0],
- &theInfo.myAttrVal[0],
- &theInfo.myAttrDesc[0],
- &theInfo.myNbAttr,
- &theInfo.myGroupNames[0],
- &theInfo.myNbGroup);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFamilyInfo - MEDfamInfo - "<<
- "&aMeshInfo.myName[0] = '"<<&aMeshInfo.myName[0]<<"'; "<<
- "theFamId = "<<theFamId<<"; "<<
- "&theInfo.myName[0] = '"<<&theInfo.myName[0]<<"'; "<<
- "theInfo.myId = "<<theInfo.myId);
- }
-
-
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TErr aRet = MEDfamCr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myName[0],
- anInfo.myId,
- &anInfo.myAttrId[0],
- &anInfo.myAttrVal[0],
- &anInfo.myAttrDesc[0],
- anInfo.myNbAttr,
- &anInfo.myGroupNames[0],
- anInfo.myNbGroup);
-
- INITMSG(MYDEBUG && aRet,"TVWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFamilyInfo - MEDfamCr(...)");
- }
-
-
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFamilyInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetFamilyInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr)
- {
- MSG(MYDEBUG,"TVWrapper::GetNbNodes");
- INITMSG(MYDEBUG,"GetNbNodes ... ");
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TInt aRet = MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_COOR,
- MED_NOEUD,
- med_geometrie_element(0),
- med_connectivite(0));
-
- ADDMSG(MYDEBUG," nbnodes="<<aRet<<" ... OK"<<endl);
- return aRet;
- }
-
-
- void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- MSG(MYDEBUG,"TVWrapper::GetNodeInfo");
- INITMSG(MYDEBUG,"GetNodeInfo ... ");
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0 || theInfo.myNbElem<=0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_repere& aRepere = static_cast<med_repere>(theInfo.mySystem);
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &theInfo.myCoord[0],
- MED_FULL_INTERLACE,
- &aRepere,
- &theInfo.myCoordNames[0],
- &theInfo.myCoordUnits[0],
- &theInfo.myElemNames[0],
- &anIsElemNames,
- &theInfo.myElemNum[0],
- &anIsElemNum,
- &theInfo.myFamNum[0],
- theInfo.myNbElem);
-
- ADDMSG(MYDEBUG," myDim="<<aMeshInfo.myDim<<" myNbElem="<<theInfo.myNbElem<<" ... ");
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
- ADDMSG(MYDEBUG,"OK"<<endl);
- }
-
-
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_repere& aRepere = static_cast<med_repere>(theInfo.mySystem);
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &anInfo.myCoord[0],
- MED_FULL_INTERLACE,
- aRepere,
- &anInfo.myCoordNames[0],
- &anInfo.myCoordUnits[0],
- &anInfo.myElemNames[0],
- anIsElemNames,
- &anInfo.myElemNum[0],
- anIsElemNum,
- &anInfo.myFamNum[0],
- anInfo.myNbElem,
- MED_REMP);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetNodeInfo - MEDnoeudsEcr(...)");
- }
-
-
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetNodeInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetNodeInfo(theInfo,eREMP,theErr);
- }
-
-
- TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TEntityInfo anInfo;
-
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return anInfo;
-
- TInt aNbElem = GetNbNodes(theMeshInfo);
- if(aNbElem > 0){
- anInfo[eNOEUD][ePOINT1] = aNbElem;
- const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
- TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
- TEntity2GeomSet::const_iterator anIterEnd = anEntity2GeomSet.end();
- for(; anIter != anIterEnd; anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- const TGeomSet& aGeomSet = anIter->second;
- TGeomSet::const_iterator anIter2 = aGeomSet.begin();
- TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
- for(; anIter2 != anIterEnd2; anIter2++){
- const EGeometrieElement& aGeom = *anIter2;
- aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
- if(aNbElem > 0)
- anInfo[anEntity][aGeom] = aNbElem;
- }
- }
- }
- return anInfo;
- }
-
-
- TInt TVWrapper::GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- med_entite_maillage anEntity = med_entite_maillage(theTEntity);
- med_geometrie_element aGeom = med_geometrie_element(theTGeom);
- med_connectivite aConn = med_connectivite(theTConn);
-
- return MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_CONN,
- anEntity,
- aGeom,
- aConn);
- }
-
-
- void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TInt aNbElem = theInfo.myElemNum.size();
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theInfo.myTGeom);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDelementsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &theInfo.myConn[0],
- MED_FULL_INTERLACE,
- &theInfo.myElemNames[0],
- &anIsElemNames,
- &theInfo.myElemNum[0],
- &anIsElemNum,
- &theInfo.myFamNum[0],
- aNbElem,
- anEntity,
- aGeom,
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
- }
-
-
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TCellInfo& anInfo = const_cast<MED::TCellInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theInfo.myTGeom);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDelementsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &anInfo.myConn[0],
- MED_FULL_INTERLACE,
- &anInfo.myElemNames[0],
- anIsElemNames,
- &anInfo.myElemNum[0],
- anIsElemNum,
- &anInfo.myFamNum[0],
- anInfo.myNbElem,
- anEntity,
- aGeom,
- aConn,
- MED_REMP);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
- }
-
-
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetCellInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetCellInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbFields(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnChamp(myFile->Id(),0);
- }
-
-
- TInt TVWrapper::GetNbComp(TInt theFieldId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnChamp(myFile->Id(),theFieldId);
- }
-
-
- void TVWrapper::GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- med_type_champ& aType = static_cast<med_type_champ>(theInfo.myType);
-
- TErr aRet = MEDchampInfo(myFile->Id(),
- theFieldId,
- &theInfo.myName[0],
- &aType,
- &theInfo.myCompNames[0],
- &theInfo.myUnitNames[0],
- theInfo.myNbComp);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFieldInfo - MEDchampInfo(...)");
- }
-
-
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
-
- med_type_champ& aType = static_cast<med_type_champ>(theInfo.myType);
-
- TErr aRet = MEDchampCr(myFile->Id(),
- &anInfo.myName[0],
- aType,
- &anInfo.myCompNames[0],
- &anInfo.myUnitNames[0],
- anInfo.myNbComp);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFieldInfo - MEDchampCr(...)");
- }
-
-
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- try{
-
- TErr aRet;
- SetFieldInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetFieldInfo(theInfo,eREMP,theErr);
-
- }catch(const std::exception& theExc){
- EXCEPTION(runtime_error,"SetFieldInfo(...)"<<endl<<
- theExc.what());
- }catch(...){
- throw;
- }
- }
-
-
- TInt TVWrapper::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr){
- if(theEntityInfo.empty())
- *theErr = -1;
- if(*theErr < 0)
- return -1;
- }else if(theEntityInfo.empty())
- EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
-
- theGeom.clear();
- TInt aNbTimeStamps = 0;
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
- TEntityInfo::const_iterator anIter = theEntityInfo.begin();
- for(; anIter != theEntityInfo.end(); anIter++){
- const med_entite_maillage& anEntity = static_cast<const med_entite_maillage>(anIter->first);
- const TGeom& aTGeom = anIter->second;
- TGeom::const_iterator anGeomIter = aTGeom.begin();
- for(; anGeomIter != aTGeom.end(); anGeomIter++){
- const med_geometrie_element& aGeom = static_cast<const med_geometrie_element>(anGeomIter->first);
- aNbTimeStamps = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
- if(aNbTimeStamps){
- theEntity = EEntiteMaillage(anEntity);
- theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
- }
- }
- if(aNbTimeStamps)
- break;
- }
- return aNbTimeStamps;
- }
-
-
- void TVWrapper::GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- TGeom& aTGeom = theInfo.myGeom;
-
- if(theErr){
- if(aTGeom.empty())
- *theErr = -1;
- if(*theErr < 0)
- return;
- }else if(aTGeom.empty())
- EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
-
- MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myEntity);
-
- TGeom::iterator anIter = aTGeom.begin();
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
-
- TErr aRet = MEDpasdetempsInfo(myFile->Id(),
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- theTimeStampId,
- &aMeshInfo.myName[0],
- &theInfo.myNbGauss,
- &theInfo.myNumDt,
- &theInfo.myUnitDt[0],
- &theInfo.myDt,
- &theInfo.myNumOrd);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
-
- static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
- theInfo.myNbGauss = 1;
- }
-
-
- void TVWrapper::GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TIdt anId = myFile->Id();
-
- MED::TTimeStampInfo& aTimeStampInfo = *theVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(aTimeStampInfo.myEntity);
- TGeom& aTGeom = aTimeStampInfo.myGeom;
- TGeom::iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
- TInt aNbVal = MEDnVal(anId,
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aNbVal <= 0){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
- }
-
- TValue& aValue = theVal.myMeshValue[EGeometrieElement(aGeom)];
- TInt iEnd = aNbVal*aFieldInfo.myNbComp;
-
- if(iEnd != aValue.size()){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,
- "GetTimeStampInfo - iEnd("<<iEnd<<
- ") != aValue.size()("<<aValue.size()<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom);
- }
-
- TErr aRet;
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &theVal.myPflName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }
- default: {
- std::vector<TInt> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &theVal.myPflName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(med_int i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }}
- if(aRet < 0){
- if(theErr){
- *theErr = aRet;
- return;
- }
- EXCEPTION(runtime_error,"GetValTimeStamp - MEDchampLire(...)");
- }
- }
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet;
- TIdt anId = myFile->Id();
-
- MED::TTimeStampVal& aVal = const_cast<MED::TTimeStampVal&>(theVal);
- MED::TTimeStampInfo& aTimeStampInfo = *aVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- MED::TMeshValue& aMeshValue = aVal.myMeshValue;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(aTimeStampInfo.myEntity);
- TMeshValue::iterator anIter = aMeshValue.begin();
- for(; anIter != aMeshValue.end(); anIter++){
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
- TValue& aValue = aVal.myMeshValue[EGeometrieElement(aGeom)];
- med_int iEnd = aValue.size();
- med_int aNbVal = iEnd / aFieldInfo.myNbComp;
-
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat>& anArray = aValue;
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- aTimeStampInfo.myNbGauss,
- MED_ALL,
- &aVal.myPflName[0],
- MED_ECRI,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }
- default: {
- vector<TInt> anArray(iEnd);
- for(TInt i = 0; i< iEnd; i++) anArray[i] = TInt(aValue[i]);
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- aTimeStampInfo.myNbGauss,
- MED_ALL,
- &aVal.myPflName[0],
- MED_ECRI,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }}
-
- if(aRet < 0){
- if(theErr){
- *theErr = aRet;
- break;
- }
- EXCEPTION(runtime_error,"SetTimeStamp - MEDchampEcr(...)");
- }
-
- }
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TErr aRet;
- SetTimeStamp(theVal,eECRI,&aRet);
-
- if(aRet < 0)
- SetTimeStamp(theVal,eREMP,theErr);
- }
-
- }
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_V2_1_Wrapper_HeaderFile
-#define MED_V2_1_Wrapper_HeaderFile
-
-#include "MED_TWrapper.hxx"
-
-namespace MED{
- namespace V2_1{
-
- const TInt PNOM = 8;
-
- typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVMeshInfo;
-
- typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFamilyInfo;
-
- typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVNodeInfo;
-
- typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVCellInfo;
-
- typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFieldInfo;
-
- typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampInfo;
-
- typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampVal;
-
- //---------------------------------------------------------------
- class TFile;
- typedef boost::shared_ptr<TFile> PFile;
-
- typedef enum {eLECT, eECRI, eREMP} EModeAcces;
-
- //---------------------------------------------------------------
- class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_1>
- {
- TVWrapper();
- TVWrapper(const TVWrapper&);
- TVWrapper& operator=(const TVWrapper&);
-
- public:
- TVWrapper(const std::string& theFileName);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TInt GetNbMeshes(TErr* theErr = NULL);
-
- virtual void GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
- TErr* theErr = NULL);
-
- virtual void SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TInt GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
- virtual TInt GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
- virtual TInt GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TInt GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
-
- virtual void GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TEntityInfo GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL);
-
- virtual TInt GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL);
-
- virtual void GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TInt GetNbFields(TErr* theErr = NULL);
-
- virtual TInt GetNbComp(TInt theFieldId,
- TErr* theErr = NULL);
-
- virtual void GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual TInt GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr = NULL);
-
- virtual void GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr = NULL);
-
- virtual void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- TErr* theErr = NULL);
-
- void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- protected:
- PFile myFile;
- };
- }
-}
-
-#endif
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrFermer
- * - Description : fermeture de l'acces a l'attribut dont l'ID est passe en
- * parametre
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Aclose(id)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrNumEcrire
- * - Description : ecriture d'un attribut entier
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - type (IN) : le type du champ {MED_REEL64,MED_INT}
- * - nom (IN) : le nom de l'attribut
- * - val (IN) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,
- med_mode_acces mode)
-{
- med_idt aid,attr;
- med_err ret;
- int type_hdf;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT :
-#if defined(IRIX64) || defined(OSF1)
- type_hdf = H5T_NATIVE_LONG;
-#elif defined(PCLINUX)
- /* This explicit convertion avoid a core dump between in HDF&ASTER when reading on SGI
- a file written under a PCLINUX system (in founction H5Tconvert),
- we don't know yet if it is an HDF bug or an ASTER one */
- /* The problem seems to be in convertion process between INT32LE->INT32BE ? */
- type_hdf = H5T_STD_I32BE;
- if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL)) < 0)
- return -1;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- default :
- return -1;
- }
-
- if ((aid = H5Screate(H5S_SCALAR)) < 0)
- return -1;
-
- if ( ((attr = H5Aopen_name(pere,nom)) > 0) && (mode != MED_REMP) )
- return -1;
- else
- if ( attr < 0)
- if ((attr = H5Acreate(pere,nom,type_hdf,aid,H5P_DEFAULT)) < 0) return -1;
-
- if ((ret = H5Awrite(attr,type_hdf,val)) < 0)
- return -1;
-
-
- if ((ret = H5Sclose(aid)) < 0)
- return -1;
- if ((ret = H5Aclose(attr)) < 0)
- return -1;
-
-#if defined(PCLINUX)
- /* This explicit convertion cancel the previous on which avoid a mysterious bug between HDF&ASTER when reading
- a file written under a PCLINUX system, we don't know yet if it is an HDF bug or an ASTER one */
- if (type == MED_INT)
- if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL)) < 0)
- return -1;
-#endif
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrNumLire
- * - Description : lecture d'un attribut entier
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - type (IN) : le type du champ {MED_REEL64,MED_INT}
- * - nom (IN) : le nom de l'attribut
- * - val (OUT) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val)
-{
- med_idt attid;
- med_err ret;
- int type_hdf;
-
- if ((attid = H5Aopen_name(pere,nom)) < 0)
- return -1;
-
- switch(type)
- {
- case MED_REEL64 :
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT :
-#if defined(IRIX64) || defined(OSF1)
- type_hdf = H5T_NATIVE_LONG;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Aread(attid,type_hdf,val)) < 0)
- return -1;
-
- if ((ret = H5Aclose(attid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrOuvrir
- * - Description : acces a l'attribut dont le nom est passe en parametre
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - Resultat : ID de l'attribut en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDattrOuvrir(med_idt pid,char * nom)
-{
- med_idt aid;
-
- if ((aid = H5Aopen_name(pid,nom)) < 0)
- return -1;
-
- return aid;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrStringEcrire
- * - Description : ecriture d'un attribut chaine de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - longueur (IN) : strlen(val)
- * - val (IN) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val, med_mode_acces mode)
-{
- med_idt aid,attr, datatype;
- med_err ret;
-
- if ((aid = H5Screate(H5S_SCALAR)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,longueur+1)) < 0)
- return -1;
-
- if ( ((attr = H5Aopen_name(pere,nom)) > 0)
- && (mode != MED_REMP) )
- return -1;
- else
- if ( attr < 0)
- if ((attr = H5Acreate(pere,nom,datatype,aid,H5P_DEFAULT)) < 0) return -1;
-
- if ((ret = H5Awrite(attr, datatype, val)) < 0)
- return -1;
-
- if ((ret = H5Sclose(aid)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Aclose(attr)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrStringLire
- * - Description : lecture d'un attribut chaine de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - longueur (IN) : strlen(val)
- * - val (OUT) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val)
-{
- med_idt attid,datatype;
- med_err ret;
-
- if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if ((ret = H5Tset_size(datatype,longueur+1)) < 0)
- return -1;
- if ((attid = H5Aopen_name(pere,nom)) < 0)
- return -1;
- if ((ret = H5Aread(attid,datatype,val)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Aclose(attid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#if defined(IRIX64)
-#define MED_INTEGER MED_INT64
-#else
-#define MED_INTEGER MED_INT32
-#endif
-
-namespace med_2_1{
-
-med_err
-MEDbodyFittedEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode )
-{
- /* ecriture des coordonnees */
- med_idt maaid, noeid, dataset;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
- int d;
- char *ds;
-
- /* On inhibe le gestionnaire d'erreur HDF */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- if ((maaid = _MEDdatagroupOuvrir(fid, chemin)) < 0) {
- return(-1);
- };
-
- /* Si le Data Group "NOE" n'existe pas on le cree */
- if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
- if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
- return(-1);
- };
- };
-
- /* Creation du Data Set "BOF" */
- dimd[0] = nnoeuds*mdim;
- if (_MEDdatasetNumEcrire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "BOF" pour y placer des attributs */
- if ((dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds) */
- if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nnoeuds, mode) < 0) {
- return(-1);
- };
-
- /* L'attribut "REP" */
- type_rep_int = (med_int)repere;
- if (_MEDattrEntierEcrire(dataset, MED_NOM_REP, &type_rep_int, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringEcrire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringEcrire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
- return(-1);
- };
-
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
-
- dimd[0] = 1;
- for (d=0; d<mdim; d++) {
- switch (d) {
- case 0 : {
- ds = MED_NOM_IN1;
- break;
- };
- case 1 : {
- ds = MED_NOM_IN2;
- break;
- };
- case 2 : {
- ds = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Creation du Data Set "IN1", "IN2", "IN3" contenant la taille du bodyfitted sur cette dimension */
- if (_MEDdatasetNumEcrire(noeid, ds, MED_INTEGER, mode_coo, MED_DIM1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)&nbr[d], mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre ce Data Set pour y placer des attributs */
- if ((dataset = _MEDdatasetOuvrir(noeid, ds)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds dans l'une des dimensions) */
- if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nbr[d], mode) < 0) {
- return(-1);
- };
-
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
- };
-
- /* Ecriture des numeros de familles */
- if (MEDfamEcr(fid, maa, fam, nnoeuds, mode, MED_NOEUD, MED_POINT1) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatagroupFermer(noeid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDbodyFittedLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds )
-{
- med_idt maaid, noeid, dataset;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas => erreur */
- noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- if (noeid < 0) return(-1);
-
- /* Lecture du Data Set "BOF" */
- if (_MEDdatasetNumLire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "BOF" pour y lire des attributs */
- dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF);
- if (dataset < 0) return(-1);
-
- /* L'attribut "REP" */
- if (_MEDattrEntierLire(dataset, MED_NOM_REP, &type_rep_int) < 0) {
- return(-1);
- } else {
- *repere = (med_repere)type_rep_int;
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringLire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringLire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
- return(-1);
- };
-
- /* lecture des numeros de familles */
- if (MEDfamLire(fid, maa, fam, nnoeuds, MED_NOEUD, MED_POINT1) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(dataset) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(noeid) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(maaid) < 0) {
- return(-1);
- };
- return(0);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
- char *unit,med_int ncomp)
-{
- med_err ret = 0;
- med_idt root,gid;
- char chemin[MED_TAILLE_CHA+1];
- med_size dimd[1];
- med_int _type = (med_int) type;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group "/CHA/" n'existe pas, on le cree
- */
- strncpy(chemin,MED_CHA,MED_TAILLE_CHA-1);
- chemin[MED_TAILLE_CHA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group cha n'existe pas, on le cree
- * Sinon => erreur
- */
- if ((gid = _MEDdatagroupOuvrir(root,champ)) >= 0)
- return -1;
- if ((gid = _MEDdatagroupCreer(root,champ)) < 0)
- return -1;
-
- /*
- * Les infos sur les composants du champ
- */
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_NCO,&ncomp,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_TYP,&_type,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrStringEcrire(gid,MED_NOM_NOM,MED_TAILLE_PNOM*ncomp,comp,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrStringEcrire(gid,MED_NOM_UNI,MED_TAILLE_PNOM*ncomp,unit,MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return ret;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-/*
- * - Nom de la fonction : MEDchampEcr
- * - Description : ecriture d'un Champ Résultat
- * - Parametres :
- * - fid (IN) : ID du fichier HDF courant
- * - maa (IN) : le nom du maillage sur lequel s'applique le champ
- * - cha (IN) : le nom du champ
- * - val (IN) : valeurs du champ à stocker
- * - interlace(IN) : entrelacement utilisé en mémoire {MED_FULL_INTERLACE,MED_NO_INTERLACE}
- * - nbelem (IN) : nombre d'éléments (prend en compte le nbre
- * de points de Gauss (c'est demandé à l'utilisateur ds la doc) mais pas le nbre de composantes)
- * - ngauss (IN) : nbre de point de gauss utilisé (MED_NOPG si aucun)
- * - numco (IN) : n° de la composante à stocker (MED_ALL si toutes)
- * - profil (IN) : nom du profil utilisé (MED_NOPFL si inutilisé)
- * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
- * - type_ent (IN) : entité concerné par le champ {MED_NOEUD,MED_ARETE,MED_FACE,MED_MAILLE}
- * - type_geo (IN) : type géométrique de l'entité concerné {MED_POINT,MED_SEG2 ......}
- * - numdt (IN) : n° du pas de temps (MED_NOPDT si aucun)
- * - dt_unit (IN) : chaine de taille MED_NOMP indiquant l'unité du champ
- * - dt (IN) : valeur du pas de temps
- * - numo (IN) : n° d'ordre utilisé MED_NONOR si inutile
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
- med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo)
-{
- med_err ret;
- med_idt chid,datagroup1,datagroup2;
- med_int ncomp, chtype, i, locnumdt,pfluse;
- char pflname [MED_TAILLE_NOM+1];
- char maillage[MED_TAILLE_NOM+1];
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1[MED_TAILLE_NOM_ENTITE+1];
- med_size dimd[1],psize;
- med_int *pfltabtmp=0;
- med_ssize *pfltab=0;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation du datagroup de niveau 1 <type_ent>[.<type_geo>]
- */
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- datagroup1 = 0;
- if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0)
- if ((datagroup1 = _MEDdatagroupCreer(chid,nomdatagroup1)) < 0)
- return -1;
-
- /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
- if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
-
-
- /*Cree ou ouvre (en mode MED_REMP) le datagroup nomdatagroup2 */
- datagroup2 = 0;
- if (((datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) > 0)
- && (mode != MED_REMP))
- return -1;
- else
- if (datagroup2 < 0)
- if ((datagroup2 = _MEDdatagroupCreer(datagroup1,nomdatagroup2)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NDT */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NDT,&numdt,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PDT */
- if ((ret = _MEDattrFloatEcrire(datagroup2,MED_NOM_PDT,&dt,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NOR */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NOR,&numo,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NBR */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NBR,&nbelem,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_MAA */
- /* rem : Aucune verification de l'existence du maillage */
- strncpy(maillage,maa,MED_TAILLE_NOM);
- maillage[MED_TAILLE_NOM]='\0';
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maillage,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PFL */
- pfluse = 0;
- if ( strlen(profil) == 0) /* idem MED_NOPFL*/
- strncpy(pflname,MED_NOPFLi,MED_TAILLE_NOM+1);
- else {
- strncpy(pflname,profil,MED_TAILLE_NOM);
- pflname[MED_TAILLE_NOM]='\0';
- pfluse = 1;
- }
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pflname,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_UNI */
- if ( strlen(dt_unit) == 0) {
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM," ",mode)) < 0)
- return -1;
- } else
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit,mode)) < 0)
- return -1;
-
-
- /* Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NGAU */
- /* Ecriture du nombre de pts de gauss propre au <type_ent>[.<type_geo>] */
- /* On n'utilise pas ngauss=MED_NOPG mais ngauss=1 si aucun pt de gauss */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NGA,&ngauss,mode)) < 0)
- return -1;
-
- /*Lecture de l'attribut MED_NOM_NCO */
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
- return -1;
-
- /*Determination de la taille dimd[0] du dataset à stocker*/
- dimd[0] = nbelem*ncomp;
-
- /* Gestion des profils*/
- if ( pfluse ) {
-
- if ( ( i = MEDnValProfil(fid,pflname) ) < 0 )
- return -1;
- else
- psize = i;
-
- pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- if ((ret = MEDprofilLire(fid,pfltabtmp,pflname)) < 0)
- return -1;
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
-
- }
- else
- psize = MED_NOPF;
-
-
- /*
- * Ecriture du champ
- */
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
- return -1;
- switch(chtype)
- {
- case MED_REEL64 :
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_REEL64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
- break;
-
- case MED_INT32 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT32,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#endif
- break;
-
- case MED_INT64 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#else
- return -1;
-#endif
- break;
-
- default :
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ( pfluse ) { free(pfltab); free(pfltabtmp);}
-
- if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(chid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDchampInfo(med_idt fid,int indice,char *champ,
- med_type_champ *type,char *comp,char *unit,
- med_int ncomp)
-{
- med_err ret=0;
- med_idt gid;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
- int num;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du champ
- */
- num = indice - 1;
- strcpy(chemin,MED_CHA);
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,champ)) < 0)
- return -1;
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcat(chemin,champ);
- if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
-
- /*
- * La liste des attributs
- */
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_TYP,(med_int*) type)) < 0)
- return -1;
- if ((ret = _MEDattrStringLire(gid,MED_NOM_NOM,ncomp*MED_TAILLE_PNOM,
- comp)) < 0)
- return -1;
- if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,ncomp*MED_TAILLE_PNOM,
- unit)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
- /*La taille de val allouée par l'utilisateur doit prendre en compte le nbre de points de gauss et le nbre de composantes*/
-
-namespace med_2_1{
-
-med_err
-MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
- char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
- med_int numdt, med_int numo)
- /* VERIFIER LA POSSIBILITE DE RELIRE L'UNITE DE PAS DE TEMPS (DS CHAMPINFO) */
-{
- med_err ret;
- med_idt chid, datagroup1, datagroup2;
- med_int ncomp, chtype, ngauss, i, locnumdt, pfluse;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1[MED_TAILLE_NOM_ENTITE+1], pfltmp[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
- med_size psize;
- med_int *pfltabtmp=0;
- med_ssize *pfltab=0;
- char maatmp[MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group de niveau 1 <type_ent>[.<type_geo>] n'existe pas => erreur
- */
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- datagroup1 = 0;
- if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0 )
- return -1;
-
- /*
- * Si le Data Group de niveau 2 <numdtt>.<numoo> n'existe pas => erreur
- */
- if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
-
- datagroup2 = 0;
- if ( (datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) < 0)
- return -1;
-
- /* Lecture du nbre de composantes du champ */
-
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
- return -1;
-
- /* Gestion des profils*/
-
- /*
- * Lire le profil demandé
- */
-
- if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pfltmp)) < 0)
- return -1;
-
- if ( pfluse = (strcmp(pfltmp,MED_NOPFLi) && strcmp(pfltmp,"")) ) /* le test "" pour des raisons de compatibilité */
- {
- strcpy(profil,pfltmp);
- if ( (i = MEDnValProfil(fid,profil)) < 0 )
- return -1;
- else
- psize = i;
-
- pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- if ((ret = MEDprofilLire(fid,pfltabtmp,profil)) < 0)
- return -1;
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
-
- }
- else {
- psize = MED_NOPF;
- strcpy(profil,MED_NOPFL);
- }
-
- /*
- * Lire le nom de maillage associé au champ
- */
- if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maatmp)) < 0)
- return -1;
-
- if (strcmp(maa,maatmp))
- return -1;
-
- /* Lit le nbre de points de Gauss */
- /* (attribut MED_NOM_NGAU) propre au <type_ent>[.<type_geo>] pour simplifier la relecture */
- if ( (ret = _MEDattrEntierLire(datagroup2,MED_NOM_NGA,&ngauss)) < 0 )
- return -1;
-
- /*
- * Lecture du champ
- */
-
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
- return -1;
-
- switch(chtype)
- {
- case MED_REEL64 :
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_REEL64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
- break;
-
- case MED_INT32 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT32,
- interlace,ncomp,numco,
- psize, pfltab,ngauss,val))< 0)
- return -1;
-#endif
- break;
-
- case MED_INT64 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
-#else
- return -1;
-#endif
- break;
-
- default :
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ( pfluse ) { free(pfltab); free(pfltabtmp);}
-
- if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(chid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
- med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_connectivite type_conn)
-{
- med_idt maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- int dim, nnoe, ndes;
- int nsup = 0;
- int taille;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- /*EF Gerer le mode */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * On cree s'il n'existe pas le Data Group du type geometrique
- */
- /*EF Gerer le mode */
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
-
- /*
- * On regarde si le Data Set existe et on le cree sinon
- */
- if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
- return -1;
- if (mdim == 2 || mdim == 3)
- if (type_ent == MED_MAILLE && dim == 1)
- nsup = 1;
- if (mdim == 3)
- if (type_ent == MED_MAILLE && dim == 2)
- nsup = 1;
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- taille = nsup + nnoe;
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- taille = nsup + ndes;
- break;
-
- default :
- return -1;
- }
- dimd[0] = nbre*taille;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT64,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) connectivite,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT32,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) connectivite,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds ou d'elements)
- */
- if ((dataset = _MEDdatasetOuvrir(geoid,nom_dataset)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&nbre,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- med_int * pfltabtmp, med_size psizetmp,
- med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn)
-{
- med_idt maaid,entid,geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- med_ssize * pfltab;
- med_size psize;
- int dim,nnoe,ndes;
- int nsup = 0;
- int taille;
- int i,j;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * si le Data Group du type geometrique n'existe pas => erreur
- */
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
-
- /*
- * Si le Data Set de la connectivite n'existe pas => erreur
- * Si oui => on le lit
- */
- if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
- return -1;
- if (mdim == 2 || mdim == 3)
- if (type_ent == MED_MAILLE && dim == 1)
- nsup = 1;
- if (mdim == 3)
- if (type_ent == MED_MAILLE && dim == 2)
- nsup = 1;
-
-
- psize = psizetmp;
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- taille = nsup + nnoe;
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- taille = nsup + ndes;
- if ( psizetmp != MED_NOPF ) {
- psize = psizetmp;
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- for (i=0;i<psizetmp;i++)
- pfltab[i] = (med_ssize) (pfltabtmp[i]);
- };
-
- break;
-
- default :
- return -1;
- }
-
-
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT64,
- mode_switch,(med_size)taille,MED_ALL,
- psize,pfltab,MED_NOPG,
- (unsigned char*) connectivite)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT32,
- mode_switch,(med_size) taille,MED_ALL,
- psize,pfltab,MED_NOPG,
- (unsigned char*) connectivite)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
-
- if ( (psize != MED_NOPF) && (type_conn == MED_DESC) ) free(pfltab);
-
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int n,
- med_mode_acces mode, med_repere type_rep, char *nom, char *unit)
-{
- med_idt maaid, noeid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group "NOE" n'existe pas
- * on le cree
- */
- /* EF : A faire : gerer le mode MED_REMP*/
- if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
- if ((noeid = _MEDdatagroupCreer(maaid,MED_NOM_NOE)) < 0)
- return -1;
-
- /*
- * Creation du Data Set "COO"
- */
- dimd[0] = n*mdim;
- if ((ret = _MEDdatasetNumEcrire(noeid,MED_NOM_COO,MED_REEL64,mode_coo,mdim,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) coo,mode)) < 0)
- return -1;
-
- /*
- * On re-ouvre le Data Set "COO" pour y placer des attributs
- */
- if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
- return -1;
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * L'attribut "REP"
- */
- type_rep_int = (med_int) type_rep;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_REP,&type_rep_int,mode)) < 0)
- return -1;
-
- /*
- * Attribut "NOM"
- */
- if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,nom,mode)) < 0)
- return -1;
-
- /*
- * Attribut "UNI"
- */
- if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,unit,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(noeid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int numco,
- med_int * pfltabtmp, med_size psize, med_repere *type_rep, char *nom, char *unit)
-{
- med_idt maaid, noeid, dataset;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- int i,j;
- med_float *new_coo;
- med_int type_rep_int;
- med_ssize * pfltab;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- * Sinon on recupere sa dimension au passage
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group "NOE" n'existe pas => erreur
- */
- if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
- return -1;
-
- /*
- * Convertion de med_int en med_ssize
- */
- if ( psize != MED_NOPF ) {
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
- }
-
- /*
- * Lecture du Data Set "COO"
- */
- if ((ret = _MEDdatasetNumLire(noeid,MED_NOM_COO,MED_REEL64,
- mode_coo,mdim,numco,
- psize,pfltab,MED_NOPG,
- (unsigned char*) coo)) < 0)
- return -1;
-
-
-
- /*
- * On re-ouvre le Data Set "COO" pour y lire des attributs
- */
- if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
- return -1;
-
- /*
- * L'attribut "REP"
- */
- if ((ret = _MEDattrEntierLire(dataset,MED_NOM_REP,&type_rep_int)) < 0)
- return -1;
- else
- *type_rep = (med_repere) type_rep_int;
-
- /*
- * Attribut "NOM"
- */
- if ((ret = _MEDattrStringLire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,
- nom)) < 0)
- return -1;
-
- /*
- * Attribut "UNI"
- */
- if ((ret = _MEDattrStringLire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,
- unit)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ( psize != MED_NOPF ) free(pfltab);
-
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(noeid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction _MEDcstringFree
- * - Description : libere la chaine de caracteres creee par
- * les routines _MEDXcstring
- * - Parametres :
- * - chaine (IN/OUT) : la chaine de caracteres a detruire
- * - Resultat : 0 si succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDcstringFree(char *chaine)
-{
-
- free(chaine);
- return 0;
-
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupCreer
- * - Description : creation et ouverture d'un Datagroup HDF
- * - Parametres :
- * - pid (IN) : l'ID de l'objet pere
- * - nom (IN) : le nom de l'objet fils
- * - Resultat : l'ID du fils en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatagroupCreer(med_idt pid, char *nom)
-{
- med_idt id;
-
- if ((id = H5Gcreate(pid,nom,0)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupFermer
- * - Description : fermeture d'un datagroup HDF
- * - Parametres :
- * - id (IN) : l'ID du datagroup
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatagroupFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Gclose(id)) < 0)
- return -1;
- else
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupOuvrir
- * - Description : ouverture d'un datagroup HDF
- * - Parametres :
- * - pid (IN) : l'ID de l'objet pere
- * - nom (IN) : le nom de l'objet fils
- * - Resultat : l'ID du fils en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatagroupOuvrir(med_idt pid, char *nom)
-{
- med_idt id;
-
- if ((id = H5Gopen(pid,nom)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetFermer
- * - Description : fermeture d'un objet HDF dataset
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF dataset
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Dclose(id)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetNumEcrire
- * - Description : ecriture d'un dataset tableau numerique
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom du dataset
- * - type (IN) : type numerique MED { MED_REEL64 , MED_INT32 , MED_INT64 }
- * - interlace (IN) : Choix du type d'entrelacement utilisé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
- * - nbdim (IN) : Dimension des éléments
- * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer
- * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
- * (référence les élements, cette taille ne prend pas en compte le nombre de pts de gauss ni la dimension )
- * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
- * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
- * - ngauss (IN) : Nombre de points de GAUSS par élément
- * - size (IN) : Taille du tableau de valeurs
- * (référence tous les élements, cette taille prend en compte le nombre de pts de gauss et la dimension )
- * - val (IN) : valeurs du tableau
- * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetNumEcrire(med_idt pere,char *nom, med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- med_size *size, unsigned char *val, med_mode_acces mode)
-{
- med_idt dataset, dataspace = 0, memspace = 0;
- med_ssize start_mem[1],start_data[1],*pflmem,*pfldsk;
- med_size stride[1],count[1],pcount[1],pflsize[1];
- med_err ret;
- int i,j,index,type_hdf;
- int dim, firstdim, dimutil, lastdim ;
- med_mode_profil pflmod;
-
- /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
- if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
- return -1;
-
- /* block pflmod to MED_COMPACT (until med2.2) */
- pflmod = MED_COMPACT;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT32 :
-#if defined(PCLINUX)
- type_hdf = H5T_STD_I32BE;
- if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,(hsize_t)*size,(void *)val,NULL,NULL)) < 0)
- return -1;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- case MED_INT64 :
- type_hdf = H5T_NATIVE_LONG;
- break;
-
- default :
- return -1;
- }
-
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- {
- /* Whatever the size of the profil is we create a dataset with the size of the value array */
- /* Then if we used the MED_REMP mode we can append a new dimension to a previous one in the dataset */
- /* When we'll use the compression mode, the space used by unused values would be easily compressed */
-
- if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
- return -1;
- if ((dataset = H5Dcreate(pere,nom,type_hdf,dataspace,
- H5P_DEFAULT)) < 0)
- return -1;
- }
- else
- if (mode != MED_REMP)
- {
- H5Dclose(dataset);
- return -1;
- }
- else
- if ((dataspace = H5Dget_space(dataset)) <0)
- return -1;
-
-
- switch(interlace)
- { /* switch Interlace */
- case MED_FULL_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- count [0] = (*size)/(nbdim);
-
-
- if ( psize == MED_NOPF ) {
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- stride[0] = nbdim;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- start_mem[0] = dim;
- if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
- count, NULL)) <0)
- return -1;
-
- start_data[0] = dim*count[0];
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
- }
-
- } else { /* psize != MED_NOPF */
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil;
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
- pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /* switch pflmod pout FULL_INTERLACE*/
- case MED_GLOBALE :
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
- free(pfldsk);
- }
-
-
- break;
-
- case MED_NO_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
-
- count[0] = (*size)/nbdim;
-
- if ( psize == MED_NOPF ) {
-
- if ( fixdim != MED_ALL)
- start_data[0] = (fixdim-1)*count[0];
- else {
- count[0] = *size;
- start_data[0] = 0;
- };
-
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
-
- } else {
-
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
- pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /*switch plfmod pour NO_INTERLACE */
- case MED_GLOBALE :
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET,pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
-
- break;
-
- default :
- return -1;
-
- }
-
- free(pfldsk);
-
- };
-
- break;
-
- default :
- return -1;
- }
-
-
- if (memspace)
- if ((ret = H5Sclose(memspace)) < 0)
- return -1;
-
- if ((ret = H5Sclose(dataspace)) < 0)
- return -1;
-
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
-#if defined(PCLINUX)
- if (type == MED_INT32)
- if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,(hsize_t)*size,(void *)val,NULL,NULL)) < 0)
- return -1;
-#endif
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetNumLire
- * - Description : lecture d'un dataset tableau numerique
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom du dataset
- * - type (IN) : type numerique MED
- * - interlace (IN) : Choix du type d'entrelacement demandé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
- * - nbdim (IN) : Dimension des éléments
- * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer à partir de 1..oo
- * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
- * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
- * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
- * - ngauss (IN) : Nombre de points de GAUSS par élément
- * - val (OUT) : valeurs du tableau
- * - Resultat : 0 en cas de succes, -1 sinon
- * Equivalent à l'ancienne routine si .....,MED_NO_INTERLACE,1,MED_ALL,MED_NOPF,0,1 (peu importe),....
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- unsigned char *val)
-{
- med_idt dataset, dataspace = 0, memspace = 0;
- med_ssize start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
- med_size stride[1],count[1],pcount[1],size[1],pflsize[1];
- med_err ret;
- int i,j,index,type_hdf;
- hid_t datatype;
- size_t typesize;
- int dim, firstdim, dimutil, lastdim;
- med_mode_profil pflmod;
-
- /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
- if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
- return -1;
-
- /* block pflmod to MED_COMPACT (until med2.2) */
- pflmod = MED_COMPACT;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT32 :
- type_hdf = H5T_NATIVE_INT;
- break;
-
- case MED_INT64 :
- type_hdf = H5T_NATIVE_LONG;
- break;
-
- default :
- return -1;
- }
-
- /* Ouverture du Dataset à lire */
- if ((dataset = H5Dopen(pere,nom)) < 0)
- return -1;
-
- /* Interrogation de la taille du dataset */
- if ( (datatype = H5Dget_type(dataset )) < 0) return -1;
- if ( (typesize = H5Tget_size(datatype)) < 0) return -1;
- size[0] = H5Dget_storage_size(dataset) / typesize;
- if ( H5Tclose(datatype) < 0) return -1;
-
- /* Create dataspace */
- if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
- return -1;
-
- switch(interlace)
- {
- case MED_FULL_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- count [0] = (*size)/(nbdim);
-
-
- /*rem: Pas de vérification de l'assertion (*size)=n*nbdim */
- if ( psize == MED_NOPF ) {
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- stride[0] = nbdim;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- start_mem[0] = dim;
- if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
- count, NULL)) <0)
- return -1;
-
- start_data[0] = dim*count[0];
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
- }
-
- } else {
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil;
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
- pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /* switch pflmod pour FULL_INTERLACE*/
- case MED_GLOBALE :
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
- free(pfldsk);
- }
-
- break;
-
- case MED_NO_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
-
- count[0] = (*size)/nbdim;
-
- if ( psize == MED_NOPF ) {
-
- if ( fixdim != MED_ALL)
- start_data[0] = (fixdim-1)*count[0];
- else {
- count[0] = *size;
- start_data[0] = 0;
- };
-
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
-
- } else {
-
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
- pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /*switch plfmod pour NO_INTERLACE */
- case MED_GLOBALE :
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- default :
- return -1;
-
- }
-
- free(pfldsk);
-
- };
-
- break;
-
- default :
- return -1;
- }
-
-
-
- if (memspace)
- if ((ret = H5Sclose(memspace)) < 0)
- return -1;
-
- if ((ret = H5Sclose(dataspace)) < 0)
- return -1;
-
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetOuvrir
- * - Description : ouverture d'un objet HDF dataset
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere
- * - nom (IN) : le nom du dataset
- * - Resultat : ID du dataset en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatasetOuvrir(med_idt pid,char *nom)
-{
- med_idt id;
-
- if ((id = H5Dopen(pid,nom)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetStringEcrire
- * - Description : ecriture d'un dataset tableau de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - dimd (IN) : profil du tableau
- * - val (IN) : valeurs du tableau
- * - mode (IN) : mode d'ecriture MED
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
- char *val, med_mode_acces mode)
-{
- med_idt dataset;
- med_idt datatype = 0;
- med_idt dataspace = 0;
- med_err ret;
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- {
- if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- if ((dataset = H5Dcreate(pere,nom,datatype,dataspace,
- H5P_DEFAULT)) < 0)
- return -1;
- }
- else
- if (mode != MED_REMP)
- {
- H5Dclose(dataset);
- return -1;
- }
- else
- {
- if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- }
- if ((ret = H5Dwrite(dataset,datatype,H5S_ALL,H5S_ALL,
- H5P_DEFAULT, val)) < 0)
- return -1;
- if (dataspace)
- if((ret = H5Sclose(dataspace)) < 0)
- return -1;
- if (datatype)
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetStringLire
- * - Description : lecture d'un dataset tableau de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - val (IN) : valeurs du tableau
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetStringLire(med_idt pere,char *nom,char *val)
-{
- med_idt dataset,datatype;
- med_err ret;
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- return -1;
- if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if ((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- if ((ret = H5Dread(dataset,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT,val)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-med_int
-MEDdimLire(med_idt fid, char *maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int dim;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le groupe existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut dimension
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,&dim)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return dim;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen inom,med_int *num,med_booleen inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn,
- med_mode_acces mode)
-{
- med_err ret;
-
- /* Ecriture de la connectivite */
- if ((ret = MEDconnEcr(fid,maa,mdim,connectivite,mode_switch,nele,mode,typ_ent,typ_geo,
- typ_conn)) < 0)
- return -1;
-
- /* Ecriture des noms */
- if (inom == MED_VRAI)
- if ((ret = MEDnomEcr(fid,maa,nom,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- /* Ecriture des numeros */
- if (inum == MED_VRAI)
- if ((ret = MEDnumEcr(fid,maa,num,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- /* Ecriture des numeros de familles */
- if ((ret = MEDfamEcr(fid,maa,fam,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn)
-{
- med_err ret;
-
- /* Lecure de la connectivite */
- if ((ret = MEDconnLire(fid,maa,mdim,connectivite,mode_switch,0,MED_NOPF,
- typ_ent,typ_geo,typ_conn)) < 0)
- return -1;
-
- /* Lecture des noms */
- if ((ret = MEDnomLire(fid,maa,nom,nele,typ_ent,typ_geo)) < 0)
- *inom = MED_FAUX;
- else
- *inom = MED_VRAI;
-
- /* Lecture des numeros */
- if ((ret = MEDnumLire(fid,maa,num,nele,typ_ent,typ_geo)) < 0)
- *inum = MED_FAUX;
- else
- *inum = MED_VRAI;
-
- /* Lecture des numeros de familles */
- if ((ret = MEDfamLire(fid,maa,fam,nele,typ_ent,typ_geo)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDequivCr(med_idt fid,char *maa, char *eq, char *desc)
-{
- med_idt root,eqid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_EQS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group "EQS" n'existe pas, on le cree
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strncpy(tmp,MED_EQS,MED_TAILLE_EQS-1);
- tmp[MED_TAILLE_EQS-1] = '\0';
- strcat(chemin,tmp);
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si une equivalence du meme nom existe => erreur
- * Sinon on la cree
- */
- if ((eqid = _MEDdatagroupOuvrir(root,eq)) >= 0)
- return -1;
- if ((eqid = _MEDdatagroupCreer(root,eq)) < 0)
- return -1;
-
- /*
- * L'attribut "DES"
- */
- if ((ret = _MEDattrStringEcrire(eqid,MED_NOM_DES,MED_TAILLE_DESC,desc,MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0 ;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
- med_size dimd[1];
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Ecriture de l'equivalence
- */
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- datagroup = 0;
- if (((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) > 0) &&
- (mode != MED_REMP))
- return -1;
- else
- if (datagroup > 0)
- _MEDdatagroupFermer(datagroup);
-
- /* EF : verifier que çà marche si le data groupe existe déjà */
- if ((datagroup = _MEDdatagroupCreer(eqid,nomdatagroup)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- dimd[0] = 2*n;
-
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) corr,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) corr,mode)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
-{
- med_idt eqid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- int num;
- int idx;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom de l'equivalence
- */
- num = ind - 1;
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- if ((idx = _MEDobjetIdentifier(fid,chemin,num,eq)) < 0)
- return -1;
-
- /*
- * Si le Data Group eq n'existe pas => erreur
- */
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * L'attribut "DES"
- */
- if ((ret = _MEDattrStringLire(eqid,MED_NOM_DES,MED_TAILLE_DESC,des)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_entite_maillage typ_ent,med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Lecture de l'equivalence
- */
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
- return -1;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) corr)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) corr)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-
-/***********************************************************************
- * FONCTION MEDfam2groA
- *
- * - DESCRIPTION : 1ere etape dans la conversion des familles de groupes
- * MED en goupes de noeuds et d'elements.
- * Calcul des tailles des tableaux a allouer pour stocker les
- * groupes que l'on veut creer.
- * Les parametres renvoyes sont :
- * 1 - le nombre de groupes de noeuds a creer (ngn)
- * 2 - le nombre de groupes d'elements (nge)
- * 3 - le nombre total de noeuds composant l'ensemble des groupes
- * de noeuds (nindn)
- * 4 - le nombre total d'elements composant l'ensemble des groupes
- * d'elements (ninde)
- * Ces parametres doivent permettre de creer les tables suivantes :
- * 1 - une table de taille (nindn) contenant pour chaque groupe
- * de noeuds la liste des noeuds le composant. Cette table
- * sera indexee par une table de taille (ngn) qui contiendra
- * pour chaque noeud un numero d'indice. Une table de taille
- * (ngn) qui contiendra la liste des noms des differents
- * groupes de noeuds.
- * 2 - idem pour les elements
- * Le remplissage de ces tables est realise par la fonction
- * MEDfam2groB().
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nfam .E . med_int . nombre de familles
- * numfam .E . med_int*. table des numeros de familles
- * numfamnoe .E . med_int*. table des numeros de familles
- * . . . des noeuds
- * nnoeuds .E . med_int . nombre de noeuds
- * numfamele .E . med_int*. table des numeros de familles
- * . . . des elements
- * nelememts .E . . nombre total d'elements
- * grofam .E . char* . liste des groupes de familles
- * indfamgro .E . int* . liste des indices des groupes
- * . . . de familles dans grofam
- * ngn . S. med_int*. nombre de groupes de noeuds a
- * . . creer
- * nge . S. med_int*. nombre de groupes d'elements a
- * . . creer
- * nindn . S. med_int*. taille de la table
- * . . des groupes de noeuds a creer
- * ninde . S. med_int*. taille de la table
- * . . des groupes d'elements
- *
- * - RESULTAT : 0 si succes et -1 sinon
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDfam2groA (med_int nfam,med_int *numfam,med_int *numfamnoe,
- med_int nnoeuds,med_int *numfamele,med_int nelements,
- char *grofam,int *indfamgro,
- med_int *ngn,med_int *nge,med_int *nindn,med_int *ninde)
-{
- int i,j,k;
- char groupe[MED_TAILLE_LNOM];
- char *nomgronoe,*nomgroele,*tmp;
- med_int numc;
- int nnoe = 0,nele = 0;
- int flag = 0;
-
- *ngn = 0;
- *nge = 0;
- *nindn = 0;
- *ninde = 0;
-
- tmp = NULL;
- nomgronoe = NULL;
- nomgroele = NULL;
-
- /* Pour chaque famille, on regarde s'il y a de nouveaux groupes
- de noeuds ou d'elements a creer. Pour chaque nouveau groupe,
- on compte le nombre de noeuds ou d'elements qui devront lui etre
- rataches */
- for (i=1;i<=nfam;i++)
- if ((*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM > 0)
- {
- /* on releve le numero de la famille courante */
- numc = *(numfam+i-1);
- nnoe = 0;
- nele = 0;
- /* si c'est une famille de noeuds, on compte le nombre de
- noeuds qui y sont rattaches */
- if (numc > 0)
- for (j=0;j<nnoeuds;j++)
- if (*(numfamnoe+j) == numc)
- nnoe++;
- /* si c'est une famille d'elements, on compte le nombre d'elements
- qui y sont rattaches */
- if (numc < 0)
- for (j=0;j<nelements;j++)
- if (*(numfamele+j) == numc)
- nele++;
- /* on parcourt la liste des groupes de la famille et pour chaque
- groupe :
- 1 - on met a jour les compteurs nindn et ninde ;
- 2 - on verifie s'il s'agit d'un groupe deja repertorie.
- Si c'est le cas on ne fait rien, sinon on met a jour les
- compteurs ngn ou nge */
- for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM;j++)
- {
- strncpy(groupe,grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM);
- if (numc > 0)
- {
- *nindn = *nindn+nnoe;
- if (*ngn == 0)
- {
- *ngn = 1;
- if ((nomgronoe=(char*)malloc(sizeof(char)*MED_TAILLE_LNOM))
- == NULL)
- return -1;
- strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
- }
- else
- {
- flag = 0;
- for (k=0;k<(*ngn);k++)
- if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- flag = 1;
- if (flag == 0)
- {
- *ngn = *ngn + 1;
- if ((tmp=(char*)malloc(sizeof(char)*
- MED_TAILLE_LNOM**ngn)) == NULL)
- return -1;
- strncpy(tmp,nomgronoe,MED_TAILLE_LNOM*(*ngn-1));
- strncpy(tmp+MED_TAILLE_LNOM*(*ngn-1),groupe,
- MED_TAILLE_LNOM);
- free(nomgronoe);
- nomgronoe = tmp;
- }
- }
- }
- if (numc < 0)
- {
- *ninde = *ninde+nele;
- if (*nge == 0)
- {
- *nge = 1;
- if ((nomgroele=(char *)malloc(sizeof(char)*
- MED_TAILLE_LNOM)) == NULL)
- return -1;
- strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
- }
- else
- {
- flag = 0;
- for (k=0;k<(*nge);k++)
- if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- flag = 1;
- if (flag == 0)
- {
- *nge = *nge + 1;
- if ((tmp = (char*) malloc(sizeof(char)*MED_TAILLE_LNOM*
- *nge)) == NULL)
- return -1;
- strncpy(tmp,nomgroele,MED_TAILLE_LNOM*(*nge-1));
- strncpy(tmp+MED_TAILLE_LNOM*(*nge-1), groupe,
- MED_TAILLE_LNOM);
- free(nomgroele);
- nomgroele = tmp;
- }
- }
- }
- }
- }
-
- /* nettoyage memoire */
- free(nomgronoe);
- free(nomgroele);
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDfam2groB
- *
- * - DESCRIPTION : 2e etape dans la conversion des familles MED en
- * groupes de noeuds et d'elements. Les tables allouees a partir
- * des parametres calcules par MEDfam2groA() sont passees en argument
- * a MEDfam2groB et remplies par cette derniere fonction.
- * Il s'agit de :
- * 1 - la table des noms de groupes de noeuds, chaque nom ayant
- * une taille de MED_TAILLE_LNOM
- * 2 - la table des noms des groupes d'elements
- * 3 - la table des groupes de noeuds -i.e. pour chaque groupe
- * la liste des numeros des noeuds qui le composent
- * 4 - la table d'indexation de la table des groupes de noeuds
- * 5 - la table des groupes d'elements
- * 6 - la table d'indexation de la table des groupes d'elements
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nfam .E . med_int . nombre de familles
- * numfam .E . med_int*. table des numeros de familles
- * numfamnoe .E . med_int*. table des numeros de familles
- * . . . des noeuds
- * nnoeuds .E . med_int . nombre de noeuds
- * numfamele .E . med_int*. table des numeros de familles
- * . . . des elements
- * nelememts .E . med_int . nombre total d'elements
- * grofam .E . char* . liste des groupes de familles
- * indfamgro .E . int* . liste des indices des groupes
- * . . . de familles dans indfamgro
- * numnoeuds .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . des groupes de noeuds a creer
- * ninde .E . med_int . nombre d'indices dans la table
- * . . des groupes d'elements
- * nomgronoe . S. char* . noms des groupes de noeuds
- * nomgroele . S. char* . noms des groupes d'elements
- * indgronoe . S. int* . indices des groupes de noeuds
- * indgroele . S. int* . indices des groupes d'elements
- * tabgronoe . S. med_int*. table des groupes de noeuds
- * tabgroele . S. med_int*. table des groupes d'elements
- *
- * - RESULTAT : 0
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDfam2groB(med_int nfam,med_int *numfam,med_int *numfamnoe,
- med_int nnoeuds,med_int *numfamele,med_int nelements,
- char *grofam,int *indfamgro,med_int *numnoeuds,
- med_int *numele,med_int ngn,med_int nge,med_int nindn,
- med_int ninde,char *nomgronoe,char *nomgroele,
- int *indgronoe,int *indgroele,
- med_int *tabgronoe,med_int *tabgroele)
-{
- int i,j,k;
- char groupe[MED_TAILLE_LNOM];
- med_int numc;
- int nnoe = 0, nele = 0;
- int flag = 0;
- int nn = 0, ne = 0;
- int pos, cpt;
-
- /* initialisations */
- for (i=0;i<=ngn;i++)
- *(indgronoe+i) = 0;
- for (i=0;i<=nge;i++)
- *(indgroele+i) = 0;
-
- /* 1ere passe : on passe en revue toutes les familles :
- 1 - on etablit dans (nomgronoe) et dans (nomgroele) les listes
- des noms de groupes de noeuds et d'elements
- 2 - on place dans les tables d'index (indgronoe) et (indgroele)
- le nombre de noeuds ou d'elements que chaque groupe se verra
- attribuer */
- for (i=1;i<=nfam;i++)
- {
- numc = *(numfam+i-1);
- nnoe = 0;
- nele = 0;
- if (numc > 0)
- for (j=0;j<nnoeuds;j++)
- if (*(numfamnoe+j) == numc)
- nnoe++;
- if (numc < 0)
- for (j=0;j<nelements;j++)
- if (*(numfamele+j) == numc)
- nele++;
- for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM; j++)
- {
- strncpy(groupe, grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM);
- if (numc > 0)
- {
- if (nn == 0)
- {
- strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
- nn = 1;
- pos = 1;
- }
- else
- {
- flag = 0;
- for (k=0; k<nn;k++)
- if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- {
- flag = 1;
- pos = k+1;
- }
- if (flag == 0)
- {
- strncpy(nomgronoe+nn*MED_TAILLE_LNOM,groupe,
- MED_TAILLE_LNOM);
- pos = nn + 1;
- nn = nn + 1;
- }
- }
- *(indgronoe+pos) = *(indgronoe+pos) + nnoe;
- }
- if (numc < 0)
- {
- if (ne == 0)
- {
- strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
- ne = 1;
- pos = 1;
- }
- else
- {
- flag = 0;
- for (k=0; k<ne;k++)
- if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- {
- flag = 1;
- pos = k + 1;
- }
- if (flag == 0)
- {
- strncpy(nomgroele+ne*MED_TAILLE_LNOM,groupe,
- MED_TAILLE_LNOM);
- pos = ne + 1;
- ne = ne + 1;
- }
- }
- *(indgroele+pos) = *(indgroele+pos) + nele;
- }
- }
- }
- *(nomgronoe+ngn*MED_TAILLE_LNOM) = '\0';
- *(nomgroele+nge*MED_TAILLE_LNOM) = '\0';
-
- /* 2e passe : on construit les listes des index ainsi que les
- les tables des groupes */
- for (i=1;i<=ngn;i++)
- {
- cpt = 0;
- *(indgronoe+i) = *(indgronoe+i-1) + *(indgronoe+i);
- strncpy(groupe,nomgronoe+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- for (j=1;j<=nfam;j++)
- {
- numc = *(numfam+j-1);
- if (numc > 0)
- {
- flag = 0;
- for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
- k++)
- if (! strncmp(groupe,
- grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM))
- flag = 1;
- if (flag == 1)
- for (k=0;k<nnoeuds;k++)
- if (*(numfamnoe+k) == numc)
- {
- *(tabgronoe+*(indgronoe+i-1)+cpt) = *(numnoeuds+k);
- cpt++;
- }
- }
- }
- }
-
- for (i=1;i<=nge;i++)
- {
- cpt = 0;
- *(indgroele+i) = *(indgroele+i-1) + *(indgroele+i);
- strncpy(groupe,nomgroele+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- for (j=1;j<=nfam;j++)
- {
- numc = *(numfam+j-1);
- if (numc < 0)
- {
- flag = 0;
- for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
- k++)
- if (! strncmp(groupe,
- grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM))
- flag = 1;
- if (flag == 1)
- for (k=0;k<nelements;k++)
- if (*(numfamele+k) == numc)
- {
- *(tabgroele+*(indgroele+i-1)+cpt) = *(numele+k);
- cpt++;
- }
- }
- }
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int n_attr,char *groupe, med_int n_groupe)
-{
- med_idt root, datagroup, famid;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_FAS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group FAS n'existe pas, on le cree
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strncpy(tmp,MED_FAS,MED_TAILLE_FAS-1);
- tmp[MED_TAILLE_FAS-1] = '\0';
- strcat(chemin,tmp);
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group de meme nom que famille existe => erreur
- * Sinon on le cree
- */
- if ((famid = _MEDdatagroupOuvrir(root,famille)) >= 0)
- return -1;
- if ((famid = _MEDdatagroupCreer(root,famille)) < 0)
- return -1;
-
- /*
- * L'attribut NUM
- */
- if ((ret = _MEDattrEntierEcrire(famid,MED_NOM_NUM,&numero,MED_REMP)) < 0)
- return -1;
-
- /*
- * Le Data Group "GRO"
- */
- if (n_groupe > 0)
- {
- /*
- * On cree le Data Group
- */
- if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_GRO)) < 0)
- return -1;
-
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_groupe,MED_REMP)) < 0)
- return -1;
-
- /*
- * Data Set des noms des groupes "NOM"
- */
- dimd[0] = n_groupe*MED_TAILLE_LNOM+1;
- if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_NOM,dimd,groupe,
- MED_REMP))<0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- /*
- * Le Data Group "ATT"
- */
-
- if (n_attr > 0)
- {
- if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_ATT)) < 0)
- return -1;
-
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_attr,MED_REMP)) < 0)
- return -1;
-
- /*
- * Le Data Set "IDE"
- */
- dimd[0] = n_attr;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char *)attr_ident,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char *)attr_ident,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "VAL"
- */
- dimd[0] = n_attr;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)attr_val,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)attr_val,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "DES"
- */
- dimd[0] = n_attr*MED_TAILLE_DESC+1;
- if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_DES,dimd,attr_desc,
- MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent, med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "FAM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n;
-#if defined(IRIX64) || defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)fam,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)fam,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_FAM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent) {
- /* Ecrire des numeros de familles pour les grilles cartesiennes ou polaires :
- - pour les noeuds
- - pour les aretes
- - pour les faces
- - pour les mailles */
-
- med_geometrie_element type_geo;
-
- switch(type_ent) {
- case MED_NOEUD : {
- type_geo = MED_POINT1;
- break;
- };
- case MED_ARETE : {
- type_geo = MED_SEG2;
- break;
- };
- case MED_FACE : {
- type_geo = MED_QUAD4;
- break;
- };
- case MED_MAILLE : {
- type_geo = MED_HEXA8;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- return(MEDfamEcr(fid, maa, fam, n, mode, type_ent, type_geo));
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent) {
- /* lecture des numeros de familles pour les grilles cartesiennes ou polaires :
- - pour les noeuds
- - pour les aretes
- - pour les faces
- - pour les mailles */
-
- med_geometrie_element type_geo;
-
- switch(type_ent) {
- case MED_NOEUD : {
- type_geo = MED_POINT1;
- break;
- };
- case MED_ARETE : {
- type_geo = MED_SEG2;
- break;
- };
- case MED_FACE : {
- type_geo = MED_QUAD4;
- break;
- };
- case MED_MAILLE : {
- type_geo = MED_HEXA8;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- return(MEDfamLire(fid, maa, fam, n, type_ent, type_geo));
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
- med_int *numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int *n_attr, char *groupe ,med_int *n_groupe)
-{
- med_idt famid,datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
- int num;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom de la famille
- */
- num = indice - 1;
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_FAS);
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,famille)) < 0)
- return -1;
-
- /*
- * Si le Data Group de la famille n'existe pas => erreur
- */
- strcat(chemin,famille);
- if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * L'attribut NUM
- */
- if ((ret = _MEDattrEntierLire(famid,MED_NOM_NUM,numero)) < 0)
- return -1;
-
- /*
- * Le Data Group "GRO"
- */
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) >= 0)
- {
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_groupe)) < 0)
- return -1;
-
- /*
- * Data Set des noms des groupes "NOM"
- */
- if ((ret = _MEDdatasetStringLire(datagroup,MED_NOM_NOM,groupe)) < 0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- else
- *n_groupe = 0;
-
- /*
- * Le Data Group "ATT"
- */
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) >= 0)
- {
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_attr)) < 0)
- return -1;
-
- /*
- * Le Data Set "IDE"
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) attr_ident)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) attr_ident)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "VAL"
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) attr_val)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) attr_val)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "DES"
- */
- ret = _MEDdatasetStringLire(datagroup,MED_NOM_DES,attr_desc);
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- else
- *n_attr = 0;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root,maaid, entid, geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * si le Data Group du type geometrique => erreur
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "FAM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *)fam)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *)fam)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdio.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaCr(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles)
-{
- med_err ret;
- med_int i;
- med_int natt,ngro;
- med_int numf;
- char nomfam[MED_TAILLE_NOM+1];
-
- /* La famille de numero 0 n'a aucun attribut, ni aucun groupe
- Les familles de numero > 0 sont des familles de noeuds
- Les familles de numero < 0 sont des familles d'elements */
- for (i=0;i<nfamilles;i++)
- {
- numf = *(numfam+i);
- if (numf == 0)
- strcpy(nomfam,"FAMILLE_0");
- if (numf > 0)
- {
- strcpy(nomfam,"FAMILLE_NOEUD_");
- sprintf(nomfam,"%s%d",nomfam,numf);
- nomfam[MED_TAILLE_NOM] = '\0';
- }
- if (numf < 0)
- {
- strcpy(nomfam,"FAMILLE_ELEMENT_");
- sprintf(nomfam,"%s%d",nomfam,-numf);
- nomfam[MED_TAILLE_NOM] = '\0';
- }
- natt = *(indatt+i+1) - *(indatt+i);
- ngro = (*(indgro+i+1) - *(indgro+i))/MED_TAILLE_LNOM;
- if ((ret = MEDfamCr(fid,maa,nomfam,numf,
- attide+*(indatt+i),
- attval+*(indatt+i),
- attdes+*(indatt+i)*MED_TAILLE_DESC,natt,
- gro+*(indgro+i),ngro)) < 0)
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
- med_int *ngroc)
-{
- med_int ret;
- med_int i;
-
- /* Lecture du nombre de familles */
- if ((*nfam = MEDnFam(fid,maa,0,(med_dim_famille)0)) < 0)
- return -1;
-
- /* Lecture des nombres cumules de groupes et d'attributs dans toutes
- les familles du maillage */
- *nattc = 0;
- *ngroc = 0;
- for (i=0;i<*nfam;i++)
- {
- if ((ret = MEDnFam(fid,maa,i+1,MED_ATTR)) < 0)
- return -1;
- *nattc += ret;
- if ((ret = MEDnFam(fid,maa,i+1,MED_GROUPE)) < 0)
- return -1;
- *ngroc += ret;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaLire(med_idt fid,char *maa,med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles)
-{
- med_err ret;
- med_int natt,ngro;
- med_int i;
- char nom[MED_TAILLE_NOM+1];
-
- *indatt = 0;
- *indgro = 0;
- for (i=0;i<nfamilles;i++)
- {
- if ((ret = MEDfamInfo(fid,maa,i+1,nom,numfam+i,attide+*(indatt+i),
- attval+*(indatt+i),
- attdes+*(indatt+i)*MED_TAILLE_DESC,
- &natt,gro+*(indgro+i),&ngro)) < 0)
- return -1;
- *(indatt+i+1) = *(indatt+i)+natt;
- *(indgro+i+1) = *(indgro+i)+ngro*MED_TAILLE_LNOM;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfermer(med_idt fid)
-{
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ferme le fichier MED
- */
- if (_MEDfichierFermer(fid) < 0)
- return -1;
- else
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode)
-{
- med_idt attr;
- med_idt root;
- med_err ret;
- char nom[] = MED_NOM_DESCRIPTEUR;
- char chemin[MED_TAILLE_MAA+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- * s'il n'existe pas on le cree
- */
- strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si oui on le met a jour en fonction
- * du mode d'ouverture, sinon on le cree
- */
-
- if ((ret = _MEDattrStringEcrire(root,nom,MED_TAILLE_DESC,des,mode)) < 0)
- return -1;
-
- /*
- * Fermetures
- */
-
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfichEntete(med_idt fid, med_fich_info quoi, char str[])
-{
- med_idt atid, root;
- med_err ret;
- char locale[MED_TAILLE_DESC+1];
- char chemin[MED_TAILLE_MAA+1];
-
- switch (quoi)
- {
- case MED_HDF_VERSION :
- strcpy(str,HDF_VERSION_ACTUELLE);
- break;
-
- case MED_VERSION :
- strcpy(str,MED_VERSION_ACTUELLE);
- break;
-
- case MED_FICH_DES :
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- */
- strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si non => erreur
- * Si oui => on le copie dans str
- */
- if ((ret = _MEDattrStringLire(root,MED_NOM_DESCRIPTEUR,
- MED_TAILLE_DESC,locale)) < 0)
- return -1;
- strcpy(str,locale);
-
- if ((ret == _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierCreer
- * - Description : creation d'un fichier HDF
- * - Parametres :
- * - nom (IN) : le nom du fichier
- * - Resultat : ID du fichier en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDfichierCreer(char *nom)
-{
- med_idt fid,gid;
- med_err ret;
- med_int majeur = MED_NUM_MAJEUR;
- med_int mineur = MED_NUM_MINEUR;
- med_int release = MED_NUM_RELEASE;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- if ((fid = H5Fcreate(nom,H5F_ACC_TRUNC,
- H5P_DEFAULT,H5P_DEFAULT)) < 0)
- return -1;
-
- if ((gid = _MEDdatagroupCreer(fid,MED_NOM_INFOS)) < 0)
- return -1;
-
- /* Numero de versions de MED */
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MAJEUR,&majeur,MED_REMP)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MINEUR,&mineur,MED_REMP)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_RELEASE,&release,MED_REMP)) < 0)
- return -1;
-
- /* On ferme tout */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return fid;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierFermer
- * - Description : fermeture d'un fichier HDF
- * - Parametres :
- * - fid (IN) : ID du fichier
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDfichierFermer(med_idt fid)
-{
- med_err ret;
-
- if ((ret = H5Fclose(fid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierOuvrir
- * - Description : ouverture d'un fichier HDF en fonction du mode passe
- * en parametre
- * - Parametres :
- * - nom (IN) : le nom du fichier
- * - mode (IN) : mode d'ouverture
- * - Resultat : ID du fichier en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDfichierOuvrir(char *nom,med_mode_acces mode)
-{
- med_idt fid;
- int hdf_mode;
-
- switch(mode)
- {
- case MED_ECRI :
- hdf_mode = H5F_ACC_RDWR;
- break;
-
- case MED_LECT :
- hdf_mode = H5F_ACC_RDONLY;
- break;
-
- default :
- return -1;
- }
-
- if ((fid = H5Fopen(nom,hdf_mode,H5P_DEFAULT)) < 0)
- return -1;
-
- return fid;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDformatConforme(const char * nomfich)
-{
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
-
- if ( H5Fis_hdf5(nomfich) > 0 )
- return 0;
- else
- return -1;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-
-/*
- * Chaine C -> chaine FORTRAN completee par des blancs
- */
-
-namespace med_2_1{
-
-med_err
-_MEDfstring(char *chaine, med_int longueur_fixee)
-{
- int longueur_reelle, i;
-
- if (longueur_fixee == 0 ) return 0;
-
- longueur_reelle = strlen(chaine);
- if (longueur_fixee < longueur_reelle)
- return -1;
-
- /* on supprime le caractere de fin de chaine C '\0'
- et complete par des blancs */
- for (i=longueur_reelle;i<longueur_fixee;i++)
- *(chaine+i) = ' ';
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ)
-{
- med_idt maaid, root;
- char chemin[MED_TAILLE_MAA+1];
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si la racine n'existe pas on la cree */
- strncpy(chemin, MED_MAA, strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid, chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid, chemin)) < 0)
- return(-1);
-
- /* si le maillage existe deja => erreur */
- if (_MEDdatagroupOuvrir(root, maillage) > 0) {
- return(-1);
- };
-
- /* Creation du Data Group */
- maaid = _MEDdatagroupCreer(root, maillage);
- if (maaid < 0) return(-1);
-
- /* Creation de l'attribut dimension */
- if (_MEDattrEntierEcrire(maaid, MED_NOM_DIM, &dim, MED_REMP) < 0) {
- return(-1);
- };
-
- /* Creation de l'attribut grille */
- if (_MEDattrEntierEcrire(maaid, MED_NOM_GRD, &typ, MED_REMP) < 0) {
- return(-1);
- };
-
- /* Nettoyages divers */
- if ( _MEDdatagroupFermer(maaid) < 0) return(-1);
- if (_MEDdatagroupFermer(root) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode )
-{
- /* ecriture des indices */
-
- med_idt maaid, noeid, ds;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_size dimd[1];
- char *dataset;
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur HDF */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas on le cree */
- if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
- if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
- return(-1);
- };
- };
-
- switch (dim) {
- case 0 : {
- dataset = MED_NOM_IN1;
- break;
- };
- case 1 : {
- dataset = MED_NOM_IN2;
- break;
- };
- case 2 : {
- dataset = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Creation du Data Set "IN1" ou "IN2" ou "IN3" */
- dimd[0] = nb;
- if (_MEDdatasetNumEcrire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "IN1" ou "IN2" ou "IN3" pour y placer des attributs */
- if ((ds = _MEDdatasetOuvrir(noeid, dataset)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds) */
- if (_MEDattrEntierEcrire(ds, MED_NOM_NBR, &nb, mode) < 0) {
- return(-1);
- };
-
- /* L'attribut "REP" */
- type_rep_int = (med_int)repere;
- if (_MEDattrEntierEcrire(ds, MED_NOM_REP, &type_rep_int, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringEcrire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringEcrire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(ds) < 0) return(-1);
- if (_MEDdatagroupFermer(noeid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ)
-{
- int numero;
- med_idt maaid;
- char maillage[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* On recupere le nom du groupe de rang "indice" */
- numero = indice-1;
- if (_MEDobjetIdentifier(fid, MED_MAA, numero, maillage) < 0) {
- return(-1);
- };
-
- /* On va chercher l'attribut dimension */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maillage);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- if (_MEDattrEntierLire(maaid, MED_NOM_GRD, typ) < 0) {
- *isAGrid = 0;
- } else {
- *isAGrid = 1;
- };
-
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo )
-{
- med_idt maaid, noeid, ds;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char *dataset;
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas => erreur */
- noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- if (noeid < 0) return(-1);
-
- switch (dim) {
- case 0 : {
- dataset = MED_NOM_IN1;
- break;
- };
- case 1 : {
- dataset = MED_NOM_IN2;
- break;
- };
- case 2 : {
- dataset = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Lecture du Data Set "IN1" ou "IN2" ou "IN3" */
- if (_MEDdatasetNumLire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set precedant pour y lire des attributs */
- ds = _MEDdatasetOuvrir(noeid, dataset);
- if (ds < 0) return(-1);
-
- /* L'attribut "REP" */
- if (_MEDattrEntierLire(ds, MED_NOM_REP, &type_rep_int) < 0) {
- return(-1);
- } else {
- *repere = (med_repere)type_rep_int;
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringLire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringLire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(ds) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(noeid) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(maaid) < 0) {
- return(-1);
- };
- return(0);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDgro2famA
- *
- * - DESCRIPTION : 1ere etape dans la conversion des groupes de noeuds
- * et d'elements en familles MED.
- * Calcul des tailles des tableaux que l'on devra allouer pour
- * stocker les familles qui seront construites par MEDgro2famB().
- * Les parametres renvoyes sont :
- * 1 - le nombre de familles MED a creer (nfamg)
- * 2 - le nombre de noms groupes associes a l'ensemble des familles
- * MED (nindf)
- * Ces parametres doivent permettre a l'appelant de creer les tables
- * suivantes :
- * 1 - une table des noms des groupes propres a chaque famille,
- * de taille : nindf*MED_TAILLE_LNOM+1
- * 2 - une table d'index donnant pour chaque famille son numero d'indice
- * dans la table des noms, de taille : nfamg+1
- * 3 - une table destinee a contenir la liste des numeros de familles
- * a creer, de taille : nfamg
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nnoe .E . med_int . nombre de noeuds
- * nele .E . med_int . nombre d'elements
- * numnoe .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . . des groupes de noeuds
- * ninde .E . med_int . nombre d'indices dans la table
- * . . . de groupes d'elements
- * indgronoe .E . int* . table index de la table des groupes
- * . . . de noeuds
- * indgroele .E . int* . table index de la table des groupes
- * . . . d'elements
- * tabgronoe .E . med_int*. table des groupes de noeuds
- * tabgroele .E . med_int*. table des groupes d'elements
- * nfamg . S. med_int*. nombre de familles MED a creer
- * nidnf . S. med_int*. nombre de noms groupes associes a
- * . . . l'ensemble des familles MED
- *
- * - RESULTAT : 0 si succes, -1 sinon
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDgro2famA (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
- med_int ngn,med_int nge,med_int nindn,
- med_int ninde,int *indgronoe,int *indgroele,med_int *tabgronoe,
- med_int *tabgroele,med_int *nfamg,med_int *nindf)
-{
- int i,j,k;
- int *famnoe,*famele,*tmp;
- int *p;
- int flag, num,exist;
- int nfamn, nfame;
- int fam01 = 0;
- int fam02 = 0;
-
- /* initialisations */
- famnoe = NULL;
- famele = NULL;
-
- *nfamg = 0;
- *nindf = 0;
- nfamn = 0;
- nfame = 0;
-
- if ((ngn > 0) || (nge > 0))
- {
- /* pour chaque noeud :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille de noeuds.
- Si oui => on incremente le compteur local nfamn (nombre de familles
- de noeuds)
- on incremente le parametre nindf du nombre de groupes
- que devra compter cette famille de noeuds
- Si non => on ne fait rien */
- for (i=0;i<nnoe;i++)
- {
- if ((tmp = (int*) malloc(sizeof(int)*ngn)) == NULL)
- return -1;
- num = *(numnoe+i);
- for (j=0;j<ngn;j++)
- {
- flag = 0;
- /* on regarde si le noeud appartient au groupe */
- for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
- if (num == *(tabgronoe+*(indgronoe+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on note la creation de la famille 0 */
- if (fam01 == 0)
- {
- flag = 1;
- for (j=0;j<ngn;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- fam01 = 1;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famnoe == NULL)
- {
- exist = 0;
- if ((famnoe = (int *) malloc (sizeof(int)*ngn)) == NULL)
- return -1;
- for (j=0;j<ngn;j++)
- {
- *(famnoe+j) = *(tmp+j);
- if (*(famnoe+j) == 1)
- *nindf = *nindf + 1;
- }
- nfamn = 1;
- }
- else
- {
- for (j=0;j<nfamn;j++)
- {
- p = famnoe + ngn*j;
- for (k=0;k<ngn;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- break;
- }
- if (exist == 0)
- {
- nfamn = nfamn + 1;
- p = famnoe;
- if ((famnoe = (int*) malloc(sizeof(int)*ngn*nfamn)) == NULL)
- return -1;
- for (j=0;j<nfamn-1;j++)
- for (k=0;k<ngn;k++)
- *(famnoe+j*ngn+k) = *(p+j*ngn+k);
- free(p);
- p = famnoe+(nfamn-1)*ngn;
- for (j=0;j<ngn;j++)
- {
- *(p+j) = *(tmp+j);
- if (*(p+j) == 1)
- *nindf = *nindf + 1;
- }
- }
- }
- free(tmp);
- }
-
- /* pour chaque element : idem que pour les noeuds */
- for (i=0;i<nele;i++)
- {
- if ((tmp = (int*) malloc(sizeof(int)*nge)) == NULL)
- return -1;
- num = *(numele+i);
- for (j=0;j<nge;j++)
- {
- flag = 0;
- /* on regarde si l'element appartient au groupe */
- for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
- if (num == *(tabgroele+*(indgroele+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on note la creation de la famille 0 */
- if (fam02 == 0)
- {
- flag = 1;
- for (j=0;j<nge;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- fam02 = 1;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famele == NULL)
- {
- exist = 0;
- if ((famele = (int *) malloc (sizeof(int)*nge)) == NULL)
- return -1;
- for (j=0;j<nge;j++)
- {
- *(famele+j) = *(tmp+j);
- if (*(famele+j) == 1)
- *nindf = *nindf + 1;
- }
- nfame = 1;
- }
- else
- {
- for (j=0;j<nfame;j++)
- {
- p = famele + nge*j;
- for (k=0;k<nge;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- break;
- }
- if (exist == 0)
- {
- nfame = nfame + 1;
- p = famele;
- if ((famele = (int*) malloc(sizeof(int)*nge*nfame)) == NULL)
- return -1;
- for (j=0;j<nfame-1;j++)
- for (k=0;k<nge;k++)
- *(famele+j*nge+k) = *(p+j*nge+k);
- free(p);
- p = famele+(nfame-1)*nge;
- for (j=0;j<nge;j++)
- {
- *(p+j) = *(tmp+j);
- if (*(p+j) == 1)
- *nindf = *nindf + 1;
- }
- }
- }
- free(tmp);
- }
-
- /* la famille 0 existe pour les noeuds et les elements, on
- ne la compte qu'une fois */
- if (fam01 && fam02)
- nfamn = nfamn - 1;
-
- /* le nombre de familles a creer est egal au nombre de familles
- de noeuds + nombre de familles d'elements */
- *nfamg = nfamn + nfame;
-
-
- /* Nettoyage memoire */
- free(famnoe);
- free(famele);
- }
- else
- {
- /* on a aucun groupes de noeuds ou d'elements */
- *nfamg = 1; /* on a au moins la famille 0 */
- *nindf = 0;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDgro2famB
- *
- * - DESCRIPTION : 2eme etape dans la conversion des groupes de noeuds
- * et d'elements en familles MED
- * Mise a jour des tables suivantes passees en parametres :
- * 1 - les nouveaux numeros des familles a creer
- * 2 - les nouveaux numeros des familles des elements
- * 3 - les nouveaux numeros des familles des noeuds
- * 4 - les noms des groupes composant ces familles
- * 5 - les index de la table des groupes
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nnoe .E . med_int . nombre de noeuds
- * nele .E . med_int . nombre d'elements
- * numnoe .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . . des groupes de noeuds
- * ninde .E . med_int . nombre d'indices dans la table
- * . . . de groupes d'elements
- * nomgronoe .E . char* . noms des groupes de noeuds
- * nomgroele .E . char* . noms des groupes d'elements
- * indgronoe .E . int* . table index de la table des groupes
- * . . . de noeuds
- * indgroele .E . int* . table index de la table des groupes
- * . . . d'elements
- * tabgronoe .E . int* . table des groupes de noeuds
- * tabgroele .E . int* . table des groupes d'elements
- * nfamg .E . med_int . nombre de familles MED a creer
- * nidnf .E . med_int . nombre de noms groupes associes a
- * . . . l'ensemble des familles MED
- * newnumfam . S. med_int*. nouveaux numeros de familles
- * newnumfamele . S. med_int*. nouveaux numeros de familles des
- * . . . elements
- * newnumfamnoe . S. med_int*. nouveaux numeros de familles des
- * . . . noeuds
- * newindfamgro . S. int* . table des index de la table des
- * . . . noms de groupes associes aux familles
- * newfamgro . . char* . table des noms des groupes des
- * . . . familles
- *
- * - RESULTAT : 0
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDgro2famB (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
- med_int ngn,med_int nge,med_int nindn,
- med_int ninde, char *nomgronoe,char *nomgroele,
- int *indgronoe,int *indgroele,med_int *tabgronoe,
- med_int *tabgroele,med_int nfamg,med_int nindf,
- med_int *newnumfam,med_int *newnumfamele,
- med_int *newnumfamnoe,int *newindfamgro,
- char *newfamgro)
-{
- int i,j,k;
-
- med_int *famnoe, *famele, *tmp;
- med_int *p;
- med_int num;
- int flag,exist;
- int nfamn, nfame;
- int estfam0 = 1;
- int newnumnoe, newnumele;
- int tmp1;
- int existfam0 = 0;
- int ind = 0;
-
- famnoe = NULL;
- famele = NULL;
-
- nfamn = 0;
- nfame = 0;
- newnumnoe = 0;
- newnumele = 0;
-
- *newindfamgro = 0;
-
- if (nfamg > 1)
- {
- /* pour chaque noeud :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille de noeuds.
- Si oui => - on cree le numero de famille que l'on reporte
- dans newnumfam
- - on reporte ce numero dans newnumnoe
- - on met a jour la table des noms des groupes des familles
- ainsi que sa table d'index
- Si non => on ne fait rien
- ATTENTION : pour la famille 0, on ne met a jour que les numeros */
- for (i=0;i<nnoe;i++)
- {
- if ((tmp = (med_int*) malloc(sizeof(med_int)*ngn)) == NULL)
- return -1;
- num = *(numnoe+i);
- for (j=0;j<ngn;j++)
- {
- flag = 0;
- /* on regarde si le noeud appartient au groupe */
- for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
- if (num == *(tabgronoe+*(indgronoe+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on regarde si le numero de famille est 0 */
- estfam0 = 0;
- flag = 1;
- for (j=0;j<ngn;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- {
- estfam0 = 1;
- *(newnumfamnoe+i) = 0;
- }
- if (flag == 1 && existfam0 == 0)
- existfam0 = 1;
- /* faut-il creer une nouvelle famille ? */
- if (famnoe == NULL)
- {
- exist = 0;
- if ((famnoe = (med_int *) malloc (sizeof(med_int)*ngn)) == NULL)
- return -1;
- /* on met a jour la table d'indices */
- nfamn = 1;
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
- for (j=0;j<ngn;j++)
- {
- tmp1 = *(tmp+j);
- *(famnoe+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn),
- nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn) +
- MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumnoe = 1;
- *newnumfamnoe = newnumnoe;
- *newnumfam = newnumnoe;
- }
- else
- *newnumfam = 0;
- }
- else
- {
- for (j=0;j<nfamn;j++)
- {
- p = famnoe + ngn*j;
- for (k=0;k<ngn;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- {
- if (estfam0 == 0)
- *(newnumfamnoe+i) = *(newnumfam+j);
- break;
- }
- }
- if (exist == 0)
- {
- nfamn = nfamn + 1;
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
- p = famnoe;
- if ((famnoe = (med_int*) malloc(sizeof(med_int)*ngn*nfamn))
- == NULL)
- return -1;
- for (j=0;j<nfamn-1;j++)
- for (k=0;k<ngn;k++)
- *(famnoe+j*ngn+k) = *(p+j*ngn+k);
- free(p);
- p = famnoe+(nfamn-1)*ngn;
- for (j=0;j<ngn;j++)
- {
- tmp1 = *(tmp+j);
- *(p+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn),
- nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn) = *(newindfamgro + nfamn)
- + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumnoe = newnumnoe + 1;
- *(newnumfamnoe+i) = newnumnoe;
- *(newnumfam+nfamn-1) = newnumnoe;
- }
- else
- *(newnumfam+nfamn-1) = 0;
- }
- }
- free(tmp);
- }
-
- /* pour chaque element :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille d'elements.
- Si oui => - on cree le numero de famille que l'on reporte
- dans newnumfam
- - on reporte ce numero dans newnumele
- - on met a jour la table des noms des groupes des familles
- ainsi que sa table d'index
- Si non => on ne fait rien
- ATTENTION : pour la famille 0, on ne met a jour que les numeros */
- for (i=0;i<nele;i++)
- {
- if ((tmp = (med_int*) malloc(sizeof(med_int)*nge)) == NULL)
- return -1;
- num = *(numele+i);
- for (j=0;j<nge;j++)
- {
- flag = 0;
- /* on regarde si l'element appartient au groupe */
- for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
- if (num == *(tabgroele+*(indgroele+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on regarde si le numero de famille est 0 */
- estfam0 = 0;
- flag = 1;
- for (j=0;j<nge;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- {
- estfam0 = 1;
- *(newnumfamele+i) = 0;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famele == NULL)
- {
- if (!(estfam0&&existfam0))
- {
- exist = 0;
- if ((famele = (med_int *) malloc (sizeof(med_int)*nge))
- == NULL)
- return -1;
- nfame = 1;
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
- for (j=0;j<nge;j++)
- {
- tmp1 = *(tmp+j);
- *(famele+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn+nfame),
- nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame)
- + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumele = -1;
- *(newnumfamele+i) = newnumele;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- }
- else
- {
- newnumele = 0;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- existfam0 = 1;
- }
- }
- }
- else
- {
- for (j=0;j<nfame;j++)
- {
- p = famele + nge*j;
- for (k=0;k<nge;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- {
- if (estfam0 == 0)
- *(newnumfamele+i) = *(newnumfam+nfamn+j);
- break;
- }
- }
- if (exist == 0 && !(estfam0 && existfam0))
- /* on cree une nouvelle famille */
- {
- nfame = nfame + 1;
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
- p = famele;
- if ((famele = (med_int*) malloc(sizeof(med_int)*nge*nfame))
- == NULL)
- return -1;
- for (j=0;j<nfame-1;j++)
- for (k=0;k<nge;k++)
- *(famele+j*nge+k) = *(p+j*nge+k);
- free(p);
- p = famele+(nfame-1)*nge;
- for (j=0;j<nge;j++)
- {
- tmp1 = *(tmp+j);
- *(p+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy((newfamgro+*(newindfamgro+nfamn+nfame)),
- nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn+nfame) =
- *(newindfamgro+nfamn+nfame) + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumele = newnumele - 1;
- *(newnumfamele+i) = newnumele;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- }
- else
- if (existfam0 == 0)
- {
- *(newnumfam+nfamn+nfame-1) = 0;
- existfam0 =1;
- }
- }
- }
- free(tmp);
- }
-
- *(newfamgro+MED_TAILLE_LNOM*nindf) = '\0';
-
- free(famnoe);
- free(famele);
- }
- else
- {
- *newnumfam = 0;
- for (i=0;i<nele;i++)
- *(newnumfamele+i) = 0;
- for (i=0;i<nnoe;i++)
- *(newnumfamnoe+i) = 0;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDindiceInfo
- * - Description : en argument de H5Giterate, donne le nom
- * de l'objet HDF (data set ou data group)
- * contenu dans l'objet HDF passe en argument
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF
- * - nom (OUT) : le nom recupere
- * - donnees (OUT) : tampon
- * - Resultat : 1 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDindiceInfo(med_idt id, const char *nom, void *donnees)
-{
- if (donnees != NULL)
- strcpy((char*)donnees,nom);
- else
- return -1;
-
- return 1;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDindiceNum
- * - Description : en argument de H5Giterate, donne le nombre
- * d'objets HDF (data set ou data group)
- * contenu dans l'objet HDF passe en argument
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF
- * - nom (OUT) : le nom du sous-objet
- * - donnees (OUT) : tampon
- * - Resultat : le nombre d'objets en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDindiceNum(med_idt id,const char *nom, void *donnees)
-{
- int *compteur;
-
- compteur = (int *) donnees;
- (*compteur)++;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-#include <string.h>
-
-namespace med_2_1{
-
-med_int
-MEDlFichDes(med_idt fid)
-{
- med_idt attr, root;
- med_err ret=0;
- char des[MED_TAILLE_DESC+1];
- med_int longueur=0;
- char nom[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_MAA+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- */
- strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si non => erreur
- * Si oui => on retourne sa longueur
- */
- strcpy(nom,MED_NOM_DESCRIPTEUR);
-
- if ((attr = _MEDattrOuvrir(root,nom)) < 0) {
- _MEDdatagroupFermer(root);
- longueur=0;
- return 0;
- }
-
- if ((ret = _MEDattrFermer(attr)) < 0) {
- _MEDdatagroupFermer(root);
- return -1;
- }
-
- if ((ret = _MEDattrStringLire(root,nom,MED_TAILLE_DESC,des)) < 0) {
- _MEDdatagroupFermer(root);
- return -1;
- }
-
- longueur = strlen(des);
-
- /*
- * fermetures
- */
- if ((ret == _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return longueur;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDmaaCr(med_idt fid, char *maillage, med_int dim)
-{
- med_idt maaid, root;
- char chemin[MED_TAILLE_MAA+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si la racine n'existe pas on la cree
- */
- strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * si le maillage existe deja => erreur
- */
- if ((maaid = _MEDdatagroupOuvrir(root,maillage)) > 0)
- return -1;
-
- /*
- * Creation du Data Group
- */
- if ((maaid = _MEDdatagroupCreer(root,maillage)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut dimension
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_DIM,&dim,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim)
-{
- int numero;
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du groupe de rang "indice"
- */
- numero = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,MED_MAA,numero,maillage)) < 0)
- return -1;
-
- /*
- * On va chercher l'attribut dimension
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,dim)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDmodeErreurVerrouiller
- * - Description : inhibe le mode erreur HDF5
- * - Parametres : aucun
- * - Resultat : aucun
- */
-
-namespace med_2_1{
-
-void
-_MEDmodeErreurVerrouiller()
-{
- H5Eset_auto(NULL,NULL);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-#include <stdlib.h>
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnChamp(med_idt fid, int indice)
-{
- int n1;
- med_int n2;
- med_idt datagroup;
- med_err ret;
- char nomdatagroup[MED_TAILLE_NOM+1];
- int num;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
-
- if (indice < 0)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group cha n'existe pas et indice == 0 => 0
- * sinon erreur => erreur
- */
- strcpy(chemin,MED_CHA);
-
- /*
- * Si indice == 0 => nombre de champs
- */
- if (indice == 0)
- {
- n1 = 0;
- _MEDnObjets(fid,chemin,&n1);
- n2 = n1;
- }
-
- /*
- * Si indice > 0 => nbre de composants
- */
- if (indice > 0)
- {
- /*
- * On recupere le nom du champ
- */
- num = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup)) < 0)
- return -1;
- strcat(chemin,nomdatagroup);
- /*
- * On recupere le nombre de composants
- */
- if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NCO,&n2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- return n2;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
- med_int n;
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
- return 0;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_connectivite type_conn)
-{
- med_idt root, maaid, entid,geoid, dataset=0;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- med_int res = 0;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => res = 0
- */
- entid = _MEDdatagroupOuvrir(maaid,nom_ent);
-
- /*
- * Pour les mailles, les faces et le aretes
- * si le Data Group du type geometrique n'existe pas => res = 0
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- geoid = _MEDdatagroupOuvrir(entid,nom_geo);
- }
- else
- geoid = -1;
-
- /*
- * Ouverture du Data Set renvoye par _MEDnomDataset()
- * S'il n'existe pas => erreur
- * Sinon lecture de l'attribut NBR
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- if ((ret = _MEDnomDataset(nom_dataset,quoi,type_conn)) < 0)
- return -1;
- dataset = _MEDdatasetOuvrir(root,nom_dataset);
- if (dataset > 0)
- if ((ret = _MEDattrEntierLire(dataset,MED_NOM_NBR,&res)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if (dataset > 0)
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if (entid > 0)
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return res;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
- med_connectivite typ_con)
-{
- med_int total = 0;
- int i;
- med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-
- switch (typ_ent)
- {
- case MED_MAILLE :
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_MAILLE,typ_mai[i],typ_con);
- break;
-
- case MED_FACE :
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_FACE,typ_fac[i],typ_con);
- break;
-
- case MED_ARETE :
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_ARETE,typ_are[i],typ_con);
- break;
-
- case MED_NOEUD :
- total = MEDnEntMaa(fid,maa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
- break;
-
- default :
- total = -1;
- }
-
- return total;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnEquiv(med_idt fid, char *maa)
-{
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+MED_TAILLE_EQS+1];
- int n;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- n = 0;
- _MEDnObjets(fid,chemin,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi)
-{
- med_idt datagroup,famid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
- med_int n;
- int n_tmp;
- int num;
- char famille[MED_TAILLE_NOM+1];
-
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_FAS);
- if (indice == 0)
- {
- n_tmp = 0;
- _MEDnObjets(fid,chemin,&n_tmp);
- n = (med_int ) n_tmp;
- }
- else
- {
- /*
- * On recupere le nom de la famille
- */
- num = indice - 1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,
- famille)) < 0)
- return -1;
-
- /*
- * Si le Data Group de la famille n'existe pas => erreur
- */
- strcat(chemin,famille);
- if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- switch (quoi)
- {
- case MED_GROUPE :
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) < 0)
- n = 0;
- else
- {
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- break;
-
- case MED_ATTR :
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) < 0)
- n = 0;
- else
- {
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- break;
-
- default :
- return -1;
- }
-
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
-
- }
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnGrid(med_idt fid, char *maa, med_grid n)
-{
- med_idt maaid, entid, geoid, dataset;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char *nom_dataset;
- med_int res = (-1);
-
- /* On inhibe le gestionnaire d'erreur HDF 5 */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- switch (n) {
- case MED_FAM_NOEUD : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_NOEUD) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(maaid, nom_ent);
- break;
- };
- case MED_FAM_ARETE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_ARETE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_SEG2) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_FAM_FACE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_FACE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_QUAD4) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_FAM_MAILLE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_MAILLE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_HEXA8) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_GRID_NOEUD : {
- nom_dataset = MED_NOM_BOF;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D1 : {
- nom_dataset = MED_NOM_IN1;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D2 : {
- nom_dataset = MED_NOM_IN2;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D3 : {
- nom_dataset = MED_NOM_IN3;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- default : {
- return(-1);
- };
- };
-
- if (entid < 0) return(-1);
- dataset = _MEDdatasetOuvrir(entid, nom_dataset);
- if (dataset < 0) return(-1);
- if (_MEDattrEntierLire(dataset, MED_NOM_NBR, &res) < 0) return(-1);
-
- /* On ferme tout */
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
- if (_MEDdatagroupFermer(entid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
-
- return(res);
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_int
-MEDnMaa(med_idt fid)
-{
- int n;
-
- _MEDmodeErreurVerrouiller();
-
- n = 0;
- _MEDnObjets(fid,MED_MAA,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnObjets
- * - Description : indique le nombre d'objets HDF contenu dans le
- * datagroup passe en argument
- * - Parametres :
- * - fid (IN) : l'ID du fichier HDF
- * - chemin (IN) : chemin d'acces au datagroup
- * - n (OUT) : le nombre recherche
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnObjets(med_idt fid,char *chemin,int *n)
-{
- int idx;
-
- if ((idx = H5Giterate(fid,chemin,NULL,_MEDindiceNum,(void *)n)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-/*
- * Nombre de Couple (PDT,NOR) pour le champ <cha>
- */
-
-namespace med_2_1{
-
-med_int
-MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
- med_geometrie_element type_geo)
-
-{
- med_err ret;
- int n1;
- char nomdatagroup1[MED_TAILLE_NOM+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
- char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Creation du chemin d'accès aux différents (PDT,NOR) pour les différents <type_ent>[.<type_geo>]
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- strcat(chemin,"/");
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
-
- n1 =0;
- _MEDnObjets(fid,chemin,&n1);
-
- return (med_int) n1;
-
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnProfil(med_idt fid)
-{
- int n;
- med_err ret;
-
- _MEDmodeErreurVerrouiller();
-
- n = 0;
- _MEDnObjets(fid,MED_PROFILS,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-#include <stdlib.h>
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnVal(med_idt fid, char *champ, med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_int numdt, med_int numo)
-{
- med_int n;
- med_idt datagroup;
- med_err ret;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
- char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+(2*MED_MAX_PARA)+1+100];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On cree le chemin d'accès
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,champ);
- strcat(chemin,"/");
-
- /* On cree le nom du datagroup de niveau 1 */
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
- strcat(chemin,"/");
-
- /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) numdt,MED_MAX_PARA,(long ) numo);
- strcat(chemin,nomdatagroup2);
-
- /*
- * Acces au champ
- */
- if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return 0;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
-
- /*
- * fermetures
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnValProfil(med_idt fid, char *nom)
-{
- med_int n = 0;
- med_idt pid;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * ouverture du groupe /PROFILS/"nom"
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,nom);
- if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(pid,MED_NOM_N,&n)) < 0)
- return ret;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Isoles"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNI,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Fermetures des objets
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnoisLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNI"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNI,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Max par maille"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNM,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnomaLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNM"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNM,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Sommets"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNS,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Fermetures
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnosoLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNS"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNS,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
- med_mode_switch mode_coo,
- med_repere repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
- med_int nnoeuds,med_mode_acces mode)
-{
- med_err ret;
-
- /* ecriture des coordonnees */
- if ((ret = MEDcoordEcr(fid,maa,mdim,coord,mode_coo,
- nnoeuds,mode,repere,nomcoo,
- unicoo)) < 0)
- return -1;
-
- /* ecriture des noms (facultatifs) */
- if (inom == MED_VRAI)
- if ((ret = MEDnomEcr(fid,maa,nom,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- /* ecriture des numeros (facultatifs) */
- if (inum == MED_VRAI)
- if ((ret = MEDnumEcr(fid,maa,num,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- /* ecriture des numeros de familles */
- if ((ret = MEDfamEcr(fid,maa,fam,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
- med_mode_switch mode_coo,
- med_repere *repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
- med_int nnoeuds)
-{
- med_err ret;
-
- /* lecture des coordonnees */
- if ((ret = MEDcoordLire(fid,maa,mdim,coord,mode_coo,MED_ALL,0,MED_NOPF,repere,nomcoo,
- unicoo)) < 0)
- return -1;
-
- /* lecture des noms (facultatifs) */
- if ((ret = MEDnomLire(fid,maa,nom,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- *inom = MED_FAUX;
- else
- *inom = MED_VRAI;
-
- /* lecture des numeros (facultatifs) */
- if ((ret = MEDnumLire(fid,maa,num,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- *inum = MED_FAUX;
- else
- *inum = MED_VRAI;
-
- /* lecture des numeros de familles */
- if ((ret = MEDfamLire(fid,maa,fam,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomDataset
- * - Description : fournit un nom de dataset
- * - Parametres :
- * - nom_dataset (OUT) : le nom du data set
- * - quoi (IN) : le type de table MED
- * - type_conn (IN) : le type de connectivite
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomDataset(char *nom_dataset,med_table quoi,med_connectivite type_conn)
-{
- switch(quoi)
- {
- case MED_COOR :
- strcpy(nom_dataset,MED_NOM_COO);
- break;
-
- case MED_CONN :
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_NOM :
- strcpy(nom_dataset,MED_NOM_NOM);
- break;
-
- case MED_NUM :
- strcpy(nom_dataset,MED_NOM_NUM);
- break;
-
- case MED_FAM :
- strcpy(nom_dataset,MED_NOM_FAM);
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "NOM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n*MED_TAILLE_PNOM+1;
- if ((ret = _MEDdatasetStringEcrire(root,MED_NOM_NOM,dimd,nom,mode)) < 0)
- return -1;
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NOM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomEntite
- * - Description : fournit le nom associe a un type d'entite MED
- * - Parametres :
- * - nom_ent (OUT) : le nom de l'entite
- * - type_ent (IN) : le type de l'entite
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomEntite(char *nom_ent,med_entite_maillage type_ent)
-{
- switch(type_ent)
- {
- case MED_NOEUD :
- strcpy(nom_ent,MED_NOM_NOE);
- break;
-
- case MED_MAILLE :
- strcpy(nom_ent,MED_NOM_MAI);
- break;
-
- case MED_FACE :
- strcpy(nom_ent,MED_NOM_FAC);
- break;
-
- case MED_ARETE :
- strcpy(nom_ent,MED_NOM_ARE);
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomGeometrie
- * - Description : fournit le nom de l'element geometrique associe
- * au type geometrique MED
- * - Parametres :
- * - nom_geo (OUT) : le nom de l'element
- * - type_geo (IN) : le type de l'element
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo)
-{
- switch (type_geo)
- {
- case MED_POINT1 :
- strcpy(nom_geo,MED_NOM_PO1);
- break;
-
- case MED_SEG2 :
- strcpy(nom_geo,MED_NOM_SE2);
- break;
-
- case MED_SEG3 :
- strcpy(nom_geo,MED_NOM_SE3);
- break;
-
- case MED_TRIA3 :
- strcpy(nom_geo,MED_NOM_TR3);
- break;
-
- case MED_TRIA6 :
- strcpy(nom_geo,MED_NOM_TR6);
- break;
-
- case MED_QUAD4 :
- strcpy(nom_geo,MED_NOM_QU4);
- break;
-
- case MED_QUAD8 :
- strcpy(nom_geo,MED_NOM_QU8);
- break;
-
- case MED_TETRA4 :
- strcpy(nom_geo,MED_NOM_TE4);
- break;
-
- case MED_TETRA10 :
- strcpy(nom_geo,MED_NOM_T10);
- break;
-
- case MED_HEXA8 :
- strcpy(nom_geo,MED_NOM_HE8);
- break;
-
- case MED_HEXA20 :
- strcpy(nom_geo,MED_NOM_H20);
- break;
-
- case MED_PENTA6 :
- strcpy(nom_geo,MED_NOM_PE6);
- break;
-
- case MED_PENTA15 :
- strcpy(nom_geo,MED_NOM_P15);
- break;
-
- case MED_PYRA5 :
- strcpy(nom_geo,MED_NOM_PY5);
- break;
-
- case MED_PYRA13 :
- strcpy(nom_geo,MED_NOM_P13);
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes,
- * on ouvre le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "NOM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- if ((ret = _MEDdatasetStringLire(root,MED_NOM_NOM,nom)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((root = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "NUM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) num,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) num,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NUM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root,maaid,entid,geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes,
- * si le Data Group du type geometrique => erreur
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "NUM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) num)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) num)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDobjetIdentifier
- * - Description : retrouve le nom de l'objet de rang "indice"
- * se trouvant dans le datagroup "chemin"
- * - Parametres :
- * - fid (IN) : l'ID du fichier ou se trouve le datagroup
- * - chemin (IN) : chemin d'acces au datagroup
- * - indice (IN) : indice de l'objet du datagroup dont on veut
- * le nom
- * - nom (OUT) : le nom
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom)
-{
- int idx;
-
- if ((idx = H5Giterate(fid,chemin,&indice,_MEDindiceInfo,
- nom)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#ifdef PPRO_NT
-#define F_OK 0
-#else
-#include <unistd.h>
-#endif
-
-namespace med_2_1{
-
-med_idt
-MEDouvrir(char *nom, med_mode_acces mode_acces)
-{
- med_idt fid;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le fichier MED sous HDF
- */
- switch(mode_acces)
- {
- case MED_LECT :
- if (access(nom,F_OK))
- return -1;
- else
- if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
- return -1;
- break;
-
- case MED_ECRI :
- if (access(nom,F_OK))
- {
- if ((fid = _MEDfichierCreer(nom)) < 0)
- return -1;
- }
- else
- if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
- return -1;
- break;
-
- case MED_REMP :
- if ((fid = _MEDfichierCreer(nom)) < 0)
- return -1;
- break;
-
- default :
- return -1;
- }
-
- return fid;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDparametresGeometrie
- * - Description : fournit les parametres geometriques des differents
- * entites et elements MED
- * - Parametres :
- * - typ_ent (IN) : type d'entite de l'element
- * - type_geo (IN) : le type geometrique de l'element
- * - dim (OUT) : dimension de l'element
- * - nnoe (OUT) : nombre de noeuds composant l'element (connectivite
- * nodale)
- * - ndes (OUT) : nombre de composants dans l'elements (connectivite
- * descendante)
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDparametresGeometrie(med_entite_maillage type_ent,
- med_geometrie_element type_geo, int *dim,
- int *nnoe,int *ndes)
-{
- *nnoe = type_geo % 100;
- *dim = type_geo / 100;
-
- switch(type_ent)
- {
- case MED_MAILLE :
- switch (type_geo)
- {
- case MED_POINT1 :
- *ndes = 0;
- break;
-
- case MED_SEG2 :
- *ndes = 2;
- break;
-
- case MED_SEG3 :
- *ndes = 3;
- break;
-
- case MED_TRIA3 :
- *ndes = 3;
- break;
-
- case MED_TRIA6 :
- *ndes = 3;
- break;
-
- case MED_QUAD4 :
- *ndes = 4;
- break;
-
- case MED_QUAD8 :
- *ndes = 4;
- break;
-
- case MED_TETRA4 :
- *ndes = 4;
- break;
-
- case MED_TETRA10 :
- *ndes = 4;
- break;
-
- case MED_HEXA8 :
- *ndes = 6;
- break;
-
- case MED_HEXA20 :
- *ndes = 6;
- break;
-
- case MED_PENTA6 :
- *ndes = 5;
- break;
-
- case MED_PENTA15 :
- *ndes = 5;
- break;
-
- case MED_PYRA5 :
- *ndes = 5;
- break;
-
- case MED_PYRA13 :
- *ndes = 5;
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_FACE :
- switch(type_geo)
- {
- case MED_TRIA3 :
- *ndes = 3;
- break;
-
- case MED_TRIA6 :
- *ndes = 3;
- break;
-
- case MED_QUAD4 :
- *ndes = 4;
- break;
-
- case MED_QUAD8 :
- *ndes = 4;
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_ARETE :
- switch(type_geo)
- {
- case MED_SEG2 :
- *ndes = 2;
- break;
-
- case MED_SEG3 :
- *ndes = 3;
- break;
-
- default :
- return -1;
- }
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/* Le nom de cette fonction n'est pas très bien choisie */
-
-namespace med_2_1{
-
-med_err
-MEDpasdetempsInfo(med_idt fid,char *champ
- ,med_entite_maillage type_ent, med_geometrie_element type_geo,
- int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
- med_int * numo)
-{
-
- med_err ret=0;
- med_int gauss_size;
- med_idt gid;
- char chemin[(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+2*MED_MAX_PARA+1];
- int num;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du datagroup <numdtt>.<numoo>
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,champ);
- strcat(chemin,"/");
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
- strcat(chemin,"/");
-
- num = indice - 1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup2)) < 0)
- return -1;
- strcat(chemin,nomdatagroup2);
- if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * La liste des attributs
- */
- if ((ret = _MEDattrStringLire(gid,MED_NOM_MAI,MED_TAILLE_NOM,maa)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_NDT,(med_int*) numdt)) < 0)
- return -1;
-
- if ((ret = _MEDattrFloatLire(gid,MED_NOM_PDT,(med_float*) dt)) < 0)
- return -1;
-
- if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_NOR,(med_int*) numo)) < 0)
- return -1;
-
- if ( (ret = _MEDattrEntierLire(gid,MED_NOM_NGA,ngauss)) < 0 )
- return -1;
-
-
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom)
-{
- med_idt root, pid, did;
- med_size dimd[1];
- med_err ret;
- char chemin[MED_TAILLE_PROFILS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le groupe "PROFILS" n'existe pas, on le cree
- */
- strncpy(chemin,MED_PROFILS,MED_TAILLE_PROFILS-1);
- chemin[MED_TAILLE_PROFILS-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le groupe "nom" n'existe pas, on le cree
- * Sinon => erreur
- */
- if ((pid = _MEDdatagroupOuvrir(root,nom)) >= 0)
- return -1;
- if ((pid = _MEDdatagroupCreer(root,nom)) < 0)
- return -1;
-
- /*
- * On stocke "n" sous forme d'attribut
- */
- if ((ret = _MEDattrEntierEcrire(pid,MED_NOM_N,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * On stocke le profil dans un dataset
- */
- dimd[0] = n;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) pflval,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) pflval,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n)
-{
- int numero;
- med_idt proid;
- med_err ret;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du groupe de rang "indice"
- */
- numero = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,MED_PROFILS,numero,profil)) < 0)
- return -1;
-
- /*
- * On va chercher l'attribut taille du profil
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,profil);
- if ((proid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(proid,MED_NOM_N,n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(proid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilLire(med_idt fid,med_int *pflval, char *nom)
-{
- med_err ret = 0;
- med_idt pid,did;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * ouverture du groupe /PROFILS/"nom"
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,nom);
- if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Lecture du profil
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) pflval)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) pflval)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
-
- return ret;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <time.h>
-
-#ifdef PPRO_NT
-// Windows Header Files:
-#include <windows.h>
-#include <Lmcons.h>
-#include <sys/timeb.h>
-#else
-#include <sys/time.h>
-#endif
-
-namespace med_2_1{
-
-med_err
-MEDunvCr(med_idt fid, char *maa)
-{
- med_idt maaid;
- char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nomu [MED_TAILLE_LNOM+1];
- time_t temps;
-#ifdef PPRO_NT
- struct timeb tp;
- char lpBuffer [UNLEN+1];
- long nSize = UNLEN+1;
-#else
- struct timeval tp;
-#endif
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation/Ecriture de l'attribut nom universel
- */
-
-#ifdef PPRO_NT
- if ( GetUserName(lpBuffer,&nSize) == 0 ) return -1;
- if ( nSize > MED_TAILLE_NOM ) nSize = MED_TAILLE_NOM;
- strncpy(nomu,lpBuffer,nSize);
- strcat(nomu," ");
- temps=time(&temps);
- strcat(nomu,ctime(&temps));
- ftime(&tp);
- nSize = strlen(nomu)-1;
- if ( sprintf(&nomu[nSize]," %hu",tp.millitm) < 0 ) return -1;
-#else
- if (cuserid(nomu) == (void*) NULL) return -1;
- strcat(nomu," ");
- temps=time(&temps);
- strcat(nomu,ctime(&temps));
- if ( gettimeofday(&tp,NULL) < 0 ) return -1;
- if ( sprintf(&nomu[strlen(nomu)-1]," %li",tp.tv_usec) < 0 ) return -1;
-#endif
- if ((ret = _MEDattrStringEcrire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,nomu,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <time.h>
-
-namespace med_2_1{
-
-med_err
-MEDunvLire(med_idt fid, char *maa,char *nomu)
-{
- med_idt maaid;
- char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation/Ecriture de l'attribut nom universel
- */
- if ((ret = _MEDattrStringLire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,
- nomu )) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDversionConforme(const char *nom) {
- med_int majeur, mineur;
- med_idt fid, gid;
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le fichier MED en mode MED_LECT
- */
- if ((fid = _MEDfichierOuvrir((char *)nom,MED_LECT)) < 0)
- return -1;
-
- /*
- * Lecture du numero de version
- */
- if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,&majeur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,&mineur)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- if ((ret = _MEDfichierFermer(fid)) < 0)
- return -1;
-
- if ((majeur == MED_NUM_MAJEUR) && (mineur == MED_NUM_MINEUR))
- return 0;
- else
- return -1;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-void
-MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release) {
- *majeur = MED_NUM_MAJEUR;
- *mineur = MED_NUM_MINEUR;
- *release = MED_NUM_RELEASE;
-}
-
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release)
-{
- med_err ret = 0;
- med_idt gid;
-
- /* On ouvre le group ou se trouvent les infos */
- if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0) {
- *majeur = 2;
- *mineur = -1;
- *release = -1;
- ret = 0;
- }
- else {
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,majeur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,mineur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_RELEASE,release)) < 0)
- return -1;
-
- /* On ferme tout */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
- }
-
- return ret;
-}
-
-}
+++ /dev/null
-#
-#
-# 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 :
-# Author :
-# Module :
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-LIB_SRC_TOOLS_HDFI= \
-MEDattrFermer.cxx \
-MEDattrNumEcrire.cxx \
-MEDattrNumLire.cxx \
-MEDattrOuvrir.cxx \
-MEDattrStringEcrire.cxx \
-MEDattrStringLire.cxx \
-MEDdatagroupCreer.cxx \
-MEDdatagroupFermer.cxx \
-MEDdatagroupOuvrir.cxx \
-MEDdatasetFermer.cxx \
-MEDdatasetNumEcrire.cxx \
-MEDdatasetNumLire.cxx \
-MEDdatasetOuvrir.cxx \
-MEDdatasetStringEcrire.cxx \
-MEDdatasetStringLire.cxx \
-MEDfichierCreer.cxx \
-MEDfichierFermer.cxx \
-MEDfichierOuvrir.cxx \
-MEDindiceInfo.cxx \
-MEDindiceNum.cxx \
-MEDmodeErreurVerrouiller.cxx \
-MEDnObjets.cxx \
-MEDobjetIdentifer.cxx
-
-LIB_SRC_TOOLS_MISC= \
-MED1cstring.cxx MEDnomDataset.cxx \
-MED2cstring.cxx MEDnomEntite.cxx \
-MEDGeometrieElement.cxx MEDnomGeometrie.cxx \
-MEDcstringFree.cxx MEDparametresGeometrie.cxx \
-MEDfstring.cxx
-
-LIB_SRC_API_CI= \
-MEDchampCr.cxx \
-MEDchampEcr.cxx \
-MEDchampInfo.cxx \
-MEDchampLire.cxx \
-MEDconnEcr.cxx \
-MEDconnLire.cxx \
-MEDcoordEcr.cxx \
-MEDcoordLire.cxx \
-MEDdimLire.cxx \
-MEDelementsEcr.cxx \
-MEDelementsLire.cxx \
-MEDequivCr.cxx \
-MEDequivEcr.cxx \
-MEDequivInfo.cxx \
-MEDequivLire.cxx \
-MEDfam2groA.cxx \
-MEDfam2groB.cxx \
-MEDfamCr.cxx \
-MEDfamEcr.cxx \
-MEDfamInfo.cxx \
-MEDfamLire.cxx \
-MEDfamMaaCr.cxx \
-MEDfamMaaInfo.cxx \
-MEDfamMaaLire.cxx \
-MEDfermer.cxx \
-MEDfichDesEcr.cxx \
-MEDfichEntete.cxx \
-MEDgro2famA.cxx \
-MEDgro2famB.cxx \
-MEDlFichDes.cxx \
-MEDmaaCr.cxx \
-MEDmaaInfo.cxx \
-MEDnChamp.cxx \
-MEDnCorres.cxx \
-MEDnEntMaa.cxx \
-MEDnEntites.cxx \
-MEDnEquiv.cxx \
-MEDnFam.cxx \
-MEDnMaa.cxx \
-MEDnPasdetemps.cxx \
-MEDnProfil.cxx \
-MEDnVal.cxx \
-MEDnValProfil.cxx \
-MEDnbnoisEcr.cxx \
-MEDnbnoisLire.cxx \
-MEDnbnomaEcr.cxx \
-MEDnbnomaLire.cxx \
-MEDnbnosoEcr.cxx \
-MEDnbnosoLire.cxx \
-MEDnoeudsEcr.cxx \
-MEDnoeudsLire.cxx \
-MEDnomEcr.cxx \
-MEDnomLire.cxx \
-MEDnumEcr.cxx \
-MEDnumLire.cxx \
-MEDouvrir.cxx \
-MEDpasdetempsInfo.cxx \
-MEDprofilEcr.cxx \
-MEDprofilLire.cxx \
-MEDprofilInfo.cxx \
-MEDunvCr.cxx \
-MEDunvLire.cxx \
-MEDformatConforme.cxx \
-MEDversionConforme.cxx \
-MEDversionDonner.cxx \
-MEDversionLire.cxx \
-MEDbodyFittedEcr.cxx \
-MEDbodyFittedLire.cxx \
-MEDfamGridEcr.cxx \
-MEDfamGridLire.cxx \
-MEDgridCr.cxx \
-MEDgridEcr.cxx \
-MEDgridInfo.cxx \
-MEDgridLire.cxx \
-MEDnGrid.cxx
-
-# Libraries targets
-
-LIB = libMEDWrapper_V2_1.la
-LIB_SRC = \
- $(LIB_SRC_TOOLS_HDFI) \
- $(LIB_SRC_TOOLS_MISC) \
- $(LIB_SRC_API_CI) \
- MED_V2_1_Wrapper.cxx
-
-EXPORT_HEADERS = \
- MED_V2_1_Wrapper.hxx \
- med.hxx \
- med_proto.hxx
-
-# Executables targets
-BIN = mdump_V2_1 test1_V2_1
-BIN_SRC =
-
-CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -DPCLINUX
-
-LDFLAGS+= $(HDF5_LIBS) -lMEDWrapperBase
-
-LDFLAGSFORBIN=$(LDFLAGS)
-
-@CONCLUDE@
+++ /dev/null
-/******************************************************************************
- * - Nom du fichier : mdump.c
- *
- * - Description : utilitaire de dump pour fichier MED V2.1
- *
- *****************************************************************************/
-#define NBR_MAILLE_EQU 7
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "med.hxx"
-using namespace med_2_1;
-
-/*******************************************************************
- * DUMP D'UN FICHIER MED STRUCTURE EN GRILLE : *
- * NOEUDS, ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS *
- *******************************************************************/
-
-int grid_cartesian_or_polar(med_idt fid, int numero, med_mode_switch mode_coo) {
- med_int mdim, nnoe, nfam, i, j;
- char nommaa[MED_TAILLE_NOM+1];
- char nom_universel[MED_TAILLE_LNOM+1];
- med_float *coo;
- med_int *fam;
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- med_repere rep;
- char str[MED_TAILLE_PNOM+1];
-
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension de la grille */
- if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nom de la grille\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nom de la grille : <<%s>>\n", nommaa);
- fprintf(stdout, "- Dimension de la grille : %d\n", mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
- fprintf(stdout, "- Nom universel de la grille : %s \n", nom_universel);
- } else {
- fprintf(stdout, "- Pas de nom universel \n");
- };
-
- /* nombre de familles */
- nfam = MEDnFam(fid, nommaa, 0, (med_dim_famille)0);
- if (nfam < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de familles\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de familles : %d \n", nfam);
-
- fprintf(stdout, "\n- Lecture des indices : \n");
- for (i=0; i<mdim; i++) {
- fprintf(stdout, "-- Lecture de l'indice : %d\n", i);
- nnoe = MEDnGrid(fid, nommaa, (med_grid)i);
- fprintf(stdout, "-- nombre d'indice : %d\n", nnoe);
- coo = (med_float*)malloc(sizeof(med_float)*nnoe);
-
- if (MEDgridLire(fid, nommaa, mdim, coo, i, mode_coo, &rep, nomcoo, unicoo) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des indices \n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
-
- fprintf(stdout, "- Nom des coordonnees : \n");
- for (j=0; j<mdim; j++) {
- strncpy(str, nomcoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Unites des coordonnees : \n");
- for (j=0; j<mdim; j++) {
- strncpy(str, unicoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n-- Coordonnees des indices : \n");
- for (j=0; j<nnoe; j++) {
- fprintf(stdout, " %f ", *(coo+j));
- };
-
- fprintf(stdout, "\n\n");
- free(coo);
- };
-
- nfam = MEDnGrid(fid, nommaa, (med_grid)-2);
- fprintf(stdout, "- Nombre de noeud pour les familles : %d\n", nfam);
- if (nfam > 0) {
- fam = (med_int*)malloc(sizeof(med_int)*nfam);
- if (MEDfamGridLire(fid, nommaa, fam, nfam,MED_NOEUD) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des familles\n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "\n- Numeros des familles des noeuds :\n");
- for (i=0; i<nfam; i++) {
- fprintf(stdout, " %d ", *(fam+i));
- };
- fprintf(stdout, "\n");
- free(fam);
- };
-
- return(0);
-}
-
-int grid_body_fitted(med_idt fid, int numero, med_mode_switch mode_coo) {
- med_int mdim, nnoe, nfam, i;
- char nommaa[MED_TAILLE_NOM+1];
- char nom_universel[MED_TAILLE_LNOM+1];
- char str[MED_TAILLE_PNOM+1];
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- med_float *coo;
- med_int *fam;
- med_repere rep;
-
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension du maillage */
- if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nom du maillage body fitted\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nom du maillage body fitted : <<%s>>\n", nommaa);
- fprintf(stdout, "- Dimension du maillage body fitted : %d\n", mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
- fprintf(stdout, "- Nom universel du maillage body fitted : %s \n", nom_universel);
- } else {
- fprintf(stdout, "- Pas de nom universel \n");
- };
-
- /* Combien de noeuds ? */
- /* nnoe = MEDnGrid(fid, nommaa, -1);*/
- nnoe = MEDnGrid(fid, nommaa, MED_GRID_NOEUD);
- if (nnoe < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
-
- /* Combien de noeuds dans la dimension 1 ? */
- i = MEDnGrid(fid, nommaa, (med_grid)0);
- if (i < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 1 \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds dans la dimension 1 : %d \n", i);
-
- /* Combien de noeuds dans la dimension 2 ? */
- i = MEDnGrid(fid, nommaa, (med_grid)1);
- if (i < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 2 \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds dans la dimension 2 : %d \n", i);
-
- /* nombre de familles */
- nfam = MEDnFam(fid, nommaa, 0,(med_dim_famille)0);
- if (nfam < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de familles : %d \n", nfam);
-
- coo = (med_float*)malloc(sizeof(med_float)*nnoe*mdim);
- fam = (med_int*)malloc(sizeof(med_int)*nnoe);
-
- if (MEDbodyFittedLire(fid, nommaa, mdim, coo, mode_coo, &rep, nomcoo, unicoo, fam, nnoe) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des noeuds \n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
-
- fprintf(stdout, "- Nom des coordonnees : \n");
- for (i=0; i<mdim; i++) {
- strncpy(str, nomcoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Unites des coordonnees : \n");
- for (i=0; i<mdim; i++) {
- strncpy(str, unicoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Coordonnees des noeuds : \n");
- for (i=0; i<nnoe*mdim; i++) {
- fprintf(stdout, " %f ", *(coo+i));
- };
-
- fprintf(stdout, "\n- Numeros des familles des noeuds : \n");
- for (i=0; i<nnoe; i++) {
- fprintf(stdout, " %d ", *(fam+i));
- };
- fprintf(stdout, "\n");
-
- if (nnoe) {
- free(coo);
- free(fam);
- };
- return(0);
-}
-
-int grid(med_idt fid, int numero, med_grid_type theType, med_mode_switch mode_coo) {
- switch (theType) {
- case MED_CARTESIAN : {
- fprintf(stdout, "- Type de la grille : MED_CARTESIAN\n");
- return(grid_cartesian_or_polar(fid, numero, mode_coo));
- };
- case MED_POLAR : {
- fprintf(stdout, "- Type de la grille : MED_POLAR\n");
- return(grid_cartesian_or_polar(fid, numero, mode_coo));
- };
- case MED_BODY_FITTED : {
- fprintf(stdout, "- Type de la grille : MED_BODY_FITTED\n");
- return(grid_body_fitted(fid, numero, mode_coo));
- };
- default : {
- fprintf(stderr, ">> ERREUR : type de maillage inconnu\n");
- return(EXIT_FAILURE);
- };
- };
-}
-
-/******************************************************************************
- * DUMP D'UN FICHIER MED : NOEUDS,
- * ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS
- *****************************************************************************/
-
-int main (int argc, char **argv)
-{
- med_err ret = 0;
- med_idt fid;
- int i,j,k,l,kp;
- int numero;
- char message[200];
- /* nombre d'objets MED */
- char nom_universel[MED_TAILLE_LNOM+1];
- med_int long_fichier_en_tete;
- char *fichier_en_tete;
- char version_hdf[10];
- char version_med[10];
- med_int nmaa,mdim,nnoe;
- med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
- med_int nare[MED_NBR_GEOMETRIE_ARETE];
- /* nom du maillage */
- char nommaa[MED_TAILLE_NOM+1];
- /* noeuds */
- med_float *coo;
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- char *nomnoe;
- med_int *numnoe;
- med_int *nufano;
- med_repere rep;
- med_booleen inonoe,inunoe;
- med_mode_switch mode_coo;
- char str[MED_TAILLE_PNOM+1];
- /* elements */
- med_int nsup;
- med_int edim;
- med_int taille;
- med_int *connectivite;
- char *nomele;
- med_int *numele;
- med_int *nufael;
- med_booleen inoele, inuele;
- med_connectivite typ_con;
- med_geometrie_element typgeo;
- med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
- med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
- char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
- "MED_SEG2",
- "MED_SEG3",
- "MED_TRIA3",
- "MED_TRIA6",
- "MED_QUAD4",
- "MED_QUAD8",
- "MED_TETRA4",
- "MED_TETRA10",
- "MED_HEXA8",
- "MED_HEXA20",
- "MED_PENTA6",
- "MED_PENTA15",
- "MED_PYRA5",
- "MED_PYRA13"};
- med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
- med_int nfaces[MED_NBR_GEOMETRIE_FACE];
- char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
- "MED_QUAD4","MED_QUAD8"};
- med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
- med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
- med_int naretes[MED_NBR_GEOMETRIE_ARETE];
- char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
- /* familles */
- med_int nfam;
- med_int natt,ngro;
- char *attdes,*gro;
- med_int *attval,*attide;
- char nomfam[MED_TAILLE_NOM+1];
- med_int numfam;
- char str1[MED_TAILLE_DESC+1];
- char str2[MED_TAILLE_LNOM+1];
- /* equivalences */
- med_int nequ,ncor;
- med_int *cor;
- char equ[MED_TAILLE_NOM+1];
- char des[MED_TAILLE_DESC+1];
- /* champs de resultats */
- char *comp;
- char *unit;
- char nomcha[MED_TAILLE_NOM+1];
- char maillage_champ[MED_TAILLE_NOM+1];
- med_int ncomp;
- med_float *valr;
- med_int *vale;
- med_type_champ typcha;
- med_int ncha;
- med_int nval;
- int reponse;
- int lecture_en_tete_seulement = 0;
- med_int npdt;
- med_int ngauss,numdt,numo;
- med_float dt;
- char dtunit[MED_TAILLE_PNOM+1];
- char pflnom[MED_TAILLE_NOM+1];
- med_int pflsize;
- med_int *pflval;
- med_int isGrid;
- med_grid_type theType;
-
- /****************************************************************************
- * TEST DU NOMBRE D'ARGUMENTS *
- * argument 1 = nom du fichier MED *
- ****************************************************************************/
- if (argc != 2 && argc != 5)
- {
- fprintf(stderr,">> ERREUR : nombre de parametres incorrects \n");
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- fid = MEDouvrir(argv[1],MED_LECT);
- if (fid < 0)
- {
- fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",argv[1]);
- exit(EXIT_FAILURE);
- }
-
-
- /****************************************************************************
- * QUESTIONS PRELIMINAIRES *
- * 1. Mode d'affichage des coordonnees (entrelace ou non) ? *
- * 2. Connectivite des elements (nodale ou descendante) *
- ****************************************************************************/
- fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",argv[1]);
-
- /* en-tete du fichier (presence optionnelle) */
- long_fichier_en_tete = MEDlFichDes(fid);
- if (long_fichier_en_tete > 0)
- {
- fichier_en_tete = (char *) malloc(sizeof(char)*(long_fichier_en_tete+1));
- ret = MEDfichEntete(fid,MED_FICH_DES,fichier_en_tete);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture de l'en-tete du fichier \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
- free(fichier_en_tete);
- }
- /* versions hdf et med */
- ret = MEDfichEntete(fid,MED_HDF_VERSION,version_hdf);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du numero de version de HDF \n");
- exit(EXIT_FAILURE);
- }
- ret = MEDfichEntete(fid,MED_VERSION,version_med);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du numero de version de MED \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Version de HDF utilisee : %s \n",version_hdf);
- fprintf(stdout,"- Version de MED utilisee : %s \n",version_med);
-
- if (argc == 2)
- {
- fprintf(stdout,"(*****************)\n");
- fprintf(stdout,"(* PARAMETRAGE : *)\n");
- fprintf(stdout,"(*****************)\n");
- fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
- fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
- fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
- reponse = 0;
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&reponse);
- }
- while (reponse != 1 && reponse != 2);
- if (reponse == 1)
- mode_coo = MED_FULL_INTERLACE;
- else
- mode_coo = MED_NO_INTERLACE;
-
- fprintf(stdout,"- Connectivité des éléments ? \n");
- fprintf(stdout," 1. Nodale : taper 1 \n");
- fprintf(stdout," 2. Descendante : taper 2 \n");
- reponse = 0;
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&reponse);
- }
- while (reponse != 1 && reponse != 2);
- if (reponse == 1)
- typ_con = MED_NOD;
- else
- typ_con = MED_DESC;
- }
- else
- {
- if (! strcmp(argv[3],"NODALE"))
- typ_con = MED_NOD;
- if (! strcmp(argv[3],"DESCENDANTE"))
- typ_con = MED_DESC;
-
- if (!strcmp(argv[4],"NO_INTERLACE"))
- mode_coo = MED_NO_INTERLACE;
- if (!strcmp(argv[4],"FULL_INTERLACE"))
- mode_coo = MED_FULL_INTERLACE;
- if (! strcmp(argv[4],"LECTURE_EN_TETE_SEULEMENT"))
- lecture_en_tete_seulement = 1;
-
- }
-
- /****************************************************************************
- * QUEL MAILLAGE LIRE *
- ****************************************************************************/
- nmaa = MEDnMaa(fid);
- if (nmaa < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de maillages \n");
- exit(EXIT_FAILURE);
- }
-
- /* Quel maillage lire ? */
- if (argc == 2)
- {
- fprintf(stdout,"- Il y a %d maillages dans ce fichier \n",nmaa);
- fprintf(stdout," Lequel voulez-vous lire (1|2|3|...|n) ?\n");
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&numero);
- }
- while (numero > nmaa || numero <= 0);
- }
- else
- {
- numero = atoi(argv[2]);
- if (numero > nmaa || numero <= 0)
- {
- fprintf(stderr,">> ERREUR : il y a %d maillages dans ce fichier \n",
- nmaa);
- exit(EXIT_FAILURE);
- }
- }
-
-/*****************************************************************************
- * QUELLE SORTE DE MAILLAGE : GRILLE OU PAS *
- *****************************************************************************/
-
- fprintf(stdout,"\n(**************************************************)\n");
- fprintf(stdout,"(* MAILLAGE STRUCTURE (GRILLE) OU NON STRUCTURE : *)\n");
- fprintf(stdout,"(**************************************************)\n");
-
- /* lecture de la sorte de maillage : structure ou pas */
- ret = MEDgridInfo(fid, numero, &isGrid, &theType);
- if (ret < 0) {
- fprintf(stderr, ">> ERREUR : lecture de la sorte de maillage (structure ou pas)\n");
- exit(EXIT_FAILURE);
- };
- fprintf(stdout, "- Sorte de maillage : %s\n", isGrid? "structure (grille)": "non structure");
- if (isGrid) {
- ret = grid(fid, numero, theType, mode_coo);
- if (ret == 0) {
- ret = MEDfermer(fid);
- if (ret == 0) {
- fprintf(stdout, "\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n", argv[1]);
- } else {
- fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n", argv[1]);
- };
- };
- if (ret == 0) {
- return(0);
- } else {
- exit(EXIT_FAILURE);
- };
- };
-
- /****************************************************************************
- * NOMBRES D'OBJETS MED *
- ****************************************************************************/
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension du maillage */
- ret = MEDmaaInfo(fid,numero,nommaa,&mdim);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
- fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- ret = MEDunvLire(fid,nommaa,nom_universel);
- if (ret > 0)
- fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
- else
- fprintf(stdout,"- Pas de nom universel \n");
-
-
- /* Combien de noeuds ? */
- nnoe = MEDnEntMaa(fid,nommaa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
- if (nnoe < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de noeuds (via MEDnEntMaa) \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de noeuds : %d \n",nnoe);
-
- /* Combien de mailles, faces ou aretes ? */
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- nmailles[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,typmai[i],
- typ_con);
- if (nmailles[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de mailles \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre de mailles de type %s : %d \n",nommai[i],nmailles[i]);
- }
-
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- {
- nfaces[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,typfac[i],
- typ_con);
- if (nfaces[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de faces \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre de faces de type %s : %d \n",nomfac[i],nfaces[i]);
- }
-
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- {
- naretes[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_ARETE,typare[i],
- typ_con);
- if (naretes[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre d'aretes \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre d'aretes de type %s : %d \n",nomare[i],naretes[i]);
- }
-
- /* nombre de familles */
- nfam = MEDnFam(fid,nommaa,0,(med_dim_famille)0);
- if (nfam < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de familles \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de familles : %d \n",nfam);
-
- /* combien d'equivalences dans le fichier */
- nequ = MEDnEquiv(fid,nommaa);
- if (nequ < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre d'equivalences \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre d'equivalences : %d \n",nequ);
-
- /* combien de champs dans le fichier */
- ncha = MEDnChamp(fid,0);
- if (ncha < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de champs \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de champs : %d \n",ncha);
-
- /* Doit-on s'arreter ? */
- if (lecture_en_tete_seulement)
- {
- ret = MEDfermer(fid);
- if (ret == 0)
- {
- fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
- return 0;
- }
- else
- {
- fprintf(stderr,">> ERREUR : fermeture du fichier %s \n",argv[1]);
- exit(EXIT_FAILURE);
- }
- }
-
- /****************************************************************************
- * LECTURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout,"\n(************************)\n");
- fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout,"(************************)\n");
-
- /* Allocations memoires */
- /* table des coordonnees
- profil : (dimension * nombre de noeuds ) */
- coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
- /* table des numeros, des numeros de familles des noeuds
- profil : (nombre de noeuds) */
- numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
- nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
- /* table des noms des noeuds
- profil : (nnoe*MED_TAILLE_PNOM+1) */
- nomnoe = (char*) malloc(MED_TAILLE_PNOM*nnoe+1);
-
- /* lecture des noeuds :
- - coordonnees
- - noms (optionnel dans un fichier MED)
- - numeros (optionnel dans un fichier MED)
- - numeros des familles */
- ret = MEDnoeudsLire(fid,nommaa,mdim,coo,mode_coo,&rep,
- nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
- nufano,nnoe);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des noeuds \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"- Type de repere des coordonnees : %d \n",rep);
- fprintf(stdout,"- Nom des coordonnees : \n");
- for (i=0;i<mdim;i++)
- {
- strncpy(str,nomcoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- fprintf(stdout,"\n- Unites des coordonnees : \n");
- for (i=0;i<mdim;i++)
- {
- strncpy(str,unicoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- fprintf(stdout,"\n- Coordonnees des noeuds : \n");
- for (i=0;i<nnoe*mdim;i++)
- fprintf(stdout," %f ",*(coo+i));
- if (inonoe)
- {
- fprintf(stdout,"\n- Noms des noeuds : \n");
- for (i=0;i<nnoe;i++)
- {
- strncpy(str,nomnoe+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inunoe)
- {
- fprintf(stdout,"\n- Numeros des noeuds : \n");
- for (i=0;i<nnoe;i++)
- fprintf(stdout," %d ",*(numnoe+i));
- }
- fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
- for (i=0;i<nnoe;i++)
- fprintf(stdout," %d ",*(nufano+i));
- fprintf(stdout,"\n");
- }
-
- /* liberation memoire */
- free(coo);
- free(nomnoe);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * LECTURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout,"\n(**************************)\n");
- fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout,"(**************************)");
- /* Lecture des connectivites, noms, numeros des mailles */
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- if (nmailles[i] > 0 && ret == 0)
- {
- /* dimension de la maille */
- edim = typmai[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typmai[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desmai[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*nmailles[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- nmailles[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- nmailles[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- nmailles[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- nmailles[i],MED_MAILLE,typmai[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des mailles \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n\n- Mailles de type %s : ", nommai[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<nmailles[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<nmailles[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<nmailles[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<nmailles[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- {
- if (nfaces[i] > 0 && ret == 0)
- {
- /* dimension de la face */
- edim = typfac[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typfac[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desfac[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*nfaces[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- nfaces[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- nfaces[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- nfaces[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- nfaces[i],MED_FACE,typfac[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des faces \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<nfaces[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<nfaces[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<nfaces[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<nfaces[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- {
- if (naretes[i] > 0 && ret == 0)
- {
- /* dimension de l'arete */
- edim = typare[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typare[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desare[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*naretes[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- naretes[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- naretes[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- naretes[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- naretes[i],MED_ARETE,typare[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des aretes \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n- Aretes de type %d : ", nomare[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<naretes[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<naretes[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<naretes[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<naretes[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- /****************************************************************************
- * LECTURE DES FAMILLES *
- ****************************************************************************/
- printf("\n(*************************)\n");
- printf("(* FAMILLES DU MAILLAGE : *)\n");
- printf("(*************************)\n");
- if (ret == 0)
- for (i=0;i<nfam;i++)
- {
-
- /* nombre de groupes */
- ngro = MEDnFam(fid,nommaa,i+1,MED_GROUPE);
- if (ngro < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre de groupes d'une famille \n");
- }
-
- /* nombre d'attributs */
- if (ret == 0)
- {
- natt = MEDnFam(fid,nommaa,i+1,MED_ATTR);
- if (natt < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
- }
- }
-
- if (ret == 0)
- fprintf(stdout,"- Famille %d a %d attributs et %d groupes \n",i+1,natt,ngro);
-
- /* nom,numero,attributs,groupes */
- if (ret == 0)
- {
- attide = (med_int*) malloc(sizeof(med_int)*natt);
- attval = (med_int*) malloc(sizeof(med_int)*natt);
- attdes = (char *) malloc(MED_TAILLE_DESC*natt+1);
- gro = (char*) malloc(MED_TAILLE_LNOM*ngro+1);
- ret = MEDfamInfo(fid,nommaa,i+1,nomfam,&numfam,attide,attval,
- attdes,&natt,gro,&ngro);
- fprintf(stdout," - Famille de nom %s et de numero %d : \n",nomfam,numfam);
- fprintf(stdout," - Attributs : \n");
- for (j=0;j<natt;j++)
- {
- strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
- str1[MED_TAILLE_DESC] = '\0';
- fprintf(stdout," ide = %d - val = %d - des = %s\n",*(attide+j),
- *(attval+j),str1);
- }
- free(attide);
- free(attval);
- free(attdes);
- fprintf(stdout," - Groupes :\n");
- for (j=0;j<ngro;j++)
- {
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM] = '\0';
- fprintf(stdout," gro = %s\n",str2);
- }
- free(gro);
- }
- }
-
- /****************************************************************************
- * LECTURE DES EQUIVALENCES *
- ****************************************************************************/
- fprintf(stdout,"\n(******************************)\n");
- fprintf(stdout,"(* EQUIVALENCES DU MAILLAGE : *)\n");
- fprintf(stdout,"(******************************)\n");
-
- /* lecture de toutes les equivalences associes a nommaa */
- if (ret == 0)
- for (i = 0;i<nequ;i++)
- {
- fprintf(stdout,"- Equivalence numero : %d ",i+1);
-
- /* lecture des infos sur l'equivalence */
- ret = MEDequivInfo(fid,nommaa,i+1,equ,des);
- if (ret == 0)
- {
- fprintf(stdout,"\n - Nom de l'equivalence: %s \n",equ);
- fprintf(stdout,"\n - Description de l'equivalence : %s \n",des);
- }
- else
- strcpy(message,">> ERREUR : lecture informations sur equivalence\n");
-
- /* lecture des correspondances sur les differents types d'entites */
- if (ret == 0)
- {
- /* les noeuds */
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_NOEUD,(med_geometrie_element)0)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture nombre de correspondances\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les noeuds \n",ncor);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_NOEUD,(med_geometrie_element)0);
- if (ret == 0)
- for (j=0;j<ncor;j++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",j+1,*(cor+2*j),
- *(cor+2*j+1));
- else
- strcpy(message,">> ERREUR : lecture des correspondances\n");
- free(cor);
- }
-
- /* sur les mailles : on ne prend pas en compte les mailles 3D */
- if (ret ==0)
- for (j=0;j<NBR_MAILLE_EQU;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_MAILLE,typmai[j])) < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture informations sur nombre de correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les mailles %s \n",ncor,
- nommai[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_MAILLE,
- typmai[j]);
- if (ret == 0)
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- else
- strcpy(message,">> ERREUR : correspondances\n");
- free(cor);
- }
- }
-
- /* sur les faces */
- if (ret == 0)
- for (j=0;j<MED_NBR_GEOMETRIE_FACE;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_FACE,typfac[j])) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : informations sur correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les faces %s\n",ncor,
- nomfac[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_FACE,
- typfac[j]);
- if (ret < 0)
- strcpy(message,"ERREUR : lecture des equivalences \n");
- else
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- free(cor);
- }
- }
-
- /* sur les aretes */
- for (j=0;j<MED_NBR_GEOMETRIE_ARETE;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_ARETE,typare[j])) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les aretes %s \n",
- ncor,nomare[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_ARETE,
- typare[j]);
- if (ret < 0)
- strcpy(message,">> ERREUR : equivalences \n");
- else
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- free(cor);
- }
- }
- }
- }
-
- /****************************************************************************
- * LECTURE DES CHAMPS *
- ****************************************************************************/
- fprintf(stdout,"\n(************************)\n");
- fprintf(stdout,"(* CHAMPS DU MAILLAGE : *)\n");
- fprintf(stdout,"(************************)\n");
-
- if (ret == 0)
- for (i=0;i<ncha;i++)
- {
- fprintf(stdout,"- Champ numero : %d \n",i+1);
-
- /* combien de composantes */
- if ((ncomp = MEDnChamp(fid,i+1)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de composants d'un champ\n");
- }
-
- /* allocation memoire de comp et unit*/
- if (ret == 0)
- {
- comp = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
- unit = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
- }
-
- /* infos sur les champs */
- if (ret == 0)
- ret = MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- if (ret < 0)
- strcpy(message,">> ERREUR : information sur les champs \n");
-
- if (ret == 0) {
- fprintf(stdout," - Nom du champ : %s de type %d\n",nomcha,typcha);
- fprintf(stdout," - Nom des composantes : %s\n",comp);
- fprintf(stdout," - Unites des composantes : %s \n",unit);
- free(comp);
- free(unit);
- }
-
-
- if (ret == 0) /* Valeurs sur les noeuds */
- {
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_NOEUD,(med_geometrie_element)0);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les noeuds \n",npdt);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
-
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (k=0;k<nval*ncomp;k++)
- fprintf(stdout," %f ",*(valr+k));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (k=0;k<nval*ncomp;k++)
- fprintf(stdout," %d ",*(vale+k));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les mailles */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_MAILLE;k++)
- {
- typgeo = typmai[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_MAILLE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les mailles de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_MAILLE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_MAILLE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_MAILLE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les faces */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_FACE;k++)
- {
- typgeo = typfac[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_FACE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les faces de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_FACE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_FACE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_FACE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_FACE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les aretes */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_ARETE;k++)
- {
- typgeo = typare[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_ARETE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les aretes de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_ARETE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_ARETE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_ARETE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_ARETE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
- }
-
- if (ret < 0)
- fprintf(stderr,"%s\n",message);
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- ret = MEDfermer(fid);
-
- if (ret == 0)
- fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
- else
- fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",argv[1]);
-
- return 0;
-}
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2003 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#ifndef MED_H
-#define MED_H
-
-extern "C"{
-#include <hdf5.h>
-}
-
-namespace med_2_1{
-
-#define MED_NULL (void *) NULL
-#define MED_MAX_PARA 20
-
-#define MED_TAILLE_DESC 200
-#define MED_TAILLE_IDENT 8
-#define MED_TAILLE_NOM 32
-#define MED_TAILLE_LNOM 80
-#define MED_TAILLE_PNOM 8
-
-/* Integration des developpements OCC */
-typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type;
-
-typedef enum {MED_GRID_D1=0, MED_GRID_D2=1, MED_GRID_D3=2,
- MED_GRID_NOEUD=3,
- MED_FAM_NOEUD=4, MED_FAM_ARETE=5, MED_FAM_FACE=6, MED_FAM_MAILLE=7 } med_grid;
-
-/* Fin de l'integration*/
-
-typedef enum {MED_FULL_INTERLACE,
- MED_NO_INTERLACE} med_mode_switch;
-
-typedef enum {MED_GLOBALE,
- MED_COMPACT } med_mode_profil;
-
-typedef enum {MED_LECT,MED_ECRI,MED_REMP} med_mode_acces;
-
-typedef enum {MED_MAILLE, MED_FACE, MED_ARETE, MED_NOEUD} med_entite_maillage;
-
-typedef enum {MED_COOR, MED_CONN, MED_NOM, MED_NUM, MED_FAM} med_table;
-
-typedef enum {MED_REEL64=6, MED_INT32=24,MED_INT64=26, MED_INT} med_type_champ;
-
-#define MED_NBR_GEOMETRIE_MAILLE 15
-#define MED_NBR_GEOMETRIE_FACE 4
-#define MED_NBR_GEOMETRIE_ARETE 2
-typedef enum {MED_POINT1=1, MED_SEG2=102, MED_SEG3=103, MED_TRIA3=203,
- MED_QUAD4=204, MED_TRIA6=206,MED_QUAD8=208, MED_TETRA4=304,
- MED_PYRA5=305, MED_PENTA6=306, MED_HEXA8=308, MED_TETRA10=310,
- MED_PYRA13=313, MED_PENTA15=315, MED_HEXA20=320}
-med_geometrie_element;
-
-typedef enum {MED_NOD, MED_DESC} med_connectivite ;
-
-typedef enum {MED_CART, MED_CYL, MED_SPHER} med_repere;
-
-typedef enum {MED_FAUX, MED_VRAI} med_booleen ;
-
-typedef enum {MED_GROUPE, MED_ATTR, MED_FAMILLE} med_dim_famille;
-
-typedef enum {MED_COMP, MED_DTYPE} med_dim_champ;
-
-typedef enum {MED_HDF_VERSION, MED_VERSION, MED_FICH_DES} med_fich_info;
-
-#define MED_NOPG 1 /* -> pas de point de Gauss */
-#define MED_NOPFL "" /* -> pas de profils utilisateur */
-#define MED_NOPFLi " " /* Variable Interne */
-#define MED_NOPF 0 /* -> pas de profils pour _MEDdataseNnumEcrire */
-#define MED_NOPDT -1 /* rem: pas de pas de temps negatifs */
-#define MED_NONOR -1 /* rem: pas de n°ordre negatif */
-#define MED_DIM1 1 /* PAS */
-#define MED_ALL 0
-
-#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000)
-/* interface C/FORTRAN */
-/* this true only with g77 and gcc : we must change it to use directly NOMF_... and INT32 or INT64 -
- it will be more simple to understand and to use ! */
-#define NOMF_POST_UNDERSCORE
-
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-#if defined(HP9000)
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-#if defined(IRIX64) || defined(OSF1)
-#define NOMF_POST_UNDERSCORE
-
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef long med_int;
-typedef double med_float;
-#endif
-
-
-#if defined(PPRO_NT)
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-
-#if defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) _##x##_
-#endif
-#if defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) _##x
-#endif
-#if !defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) x##_
-#endif
-#if !defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) x
-#endif
-
-}
-
-#include "med_proto.hxx"
-
-#endif /* MED_H */
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#ifndef MED_HDFI_H
-#define MED_HDFI_H
-#include "med.hxx"
-
-/* FONCTIONS INTERFACE MED/HDF */
-namespace med_2_1{
-
-/* Gestion des fichiers HDF */
-extern
-med_idt _MEDfichierCreer(char *nom);
-
-extern
-med_idt _MEDfichierOuvrir(char *nom,med_mode_acces mode);
-
-extern
-med_err _MEDfichierFermer(med_idt fid);
-
-
-/* Gestion des datagroups HDF */
-extern
-med_idt _MEDdatagroupCreer(med_idt pid, char *nom);
-
-extern
-med_idt _MEDdatagroupOuvrir(med_idt pid, char *nom);
-
-extern
-med_err _MEDdatagroupFermer(med_idt id);
-
-
-/* Gestion des datasets HDF */
-
-extern
-med_idt _MEDdatasetOuvrir(med_idt pid,char *nom);
-
-extern
-med_err _MEDdatasetFermer(med_idt id);
-
-extern
-med_err _MEDdatasetNumEcrire (med_idt pere,char *nom, med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * profil, med_int ngauss,
- med_size *size, unsigned char *val, med_mode_acces mode);
-
-
-extern
-med_err _MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- unsigned char *val);
-
-extern
-med_err _MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
- char *val, med_mode_acces mode);
-
-extern
-med_err _MEDdatasetStringLire(med_idt pere,char *nom,char *val);
-
-/* Gestion des attributs HDF */
-extern
-med_idt _MEDattrOuvrir(med_idt pid,char * nom);
-
-extern
-med_err _MEDattrFermer(med_idt id);
-
-extern
-med_err _MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,med_mode_acces mode);
-
-#define _MEDattrEntierEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_INT ,x,(unsigned char *) y,z)
-#define _MEDattrFloatEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_REEL64,x,(unsigned char *) y,z)
-
-extern
-med_err _MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val);
-
-#define _MEDattrEntierLire(x,y,z) _MEDattrNumLire(x,MED_INT ,y,(unsigned char*)z)
-#define _MEDattrFloatLire(x,y,z) _MEDattrNumLire(x,MED_REEL64,y,(unsigned char*)z)
-
-extern
-med_err _MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val,med_mode_acces mode);
-
-extern
-med_err _MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val);
-
-
-/* Divers */
-extern
-med_err _MEDindiceInfo(med_idt id, const char *nom, void *donnees);
-
-extern
-med_err _MEDindiceNum(med_idt id,const char *nom, void *donnees);
-
-extern
-med_err _MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom);
-
-extern
-med_err _MEDnObjets(med_idt fid,char *chemin,int *n);
-
-extern
-void _MEDmodeErreurVerrouiller();
-
-}
-
-#endif /* MED_HDFI_H */
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#ifndef MED_MISC_H
-#define MED_MISC_H
-#include "med.hxx"
-
-
-/* CHAINES DE CARACTERES FORTRAN => C */
-namespace med_2_1{
-
-extern
-char *_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee);
-
-extern
-char *_MED2cstring(char *chaine, int longueur);
-
-extern
-med_err _MEDcstringFree(char *chaine);
-
-extern
-med_err _MEDfstring(char *chaine, med_int longueur_fixee);
-
-/* Noms associes aux objets MED */
-extern
-med_err _MEDnomEntite(char *nom_ent,med_entite_maillage type_ent);
-
-extern
-med_err _MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo);
-
-extern
-med_err _MEDparametresGeometrie(med_entite_maillage type_ent,
- med_geometrie_element type_geo, int *dim, int *nnoe,
- int *ndes);
-extern
-med_err _MEDnomDataset(char *nom_dataset,med_table quoi,
- med_connectivite type_conn);
-
-/* Geometrie des objets MED */
-extern
-med_err _MEDGeometrieElement(med_geometrie_element typ_geo[],
- med_entite_maillage typ_ent);
-
-}
-
-#endif /* MED_MISC_H */
-
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2003 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#ifndef MED_OUTILS_H
-#define MED_OUTILS_H
-#include "med.hxx"
-
-#define MED_NOM_MAJEUR "MAJ"
-#define MED_NOM_MINEUR "MIN"
-#define MED_NOM_RELEASE "REL"
-
-#define MED_NUM_MAJEUR 2
-#define MED_NUM_MINEUR 1
-#define MED_NUM_RELEASE 6
-
-#define MED_NOM_INFOS "INFOS_GENERALES"
-
-#define MED_NOM_DESCRIPTEUR "descripteur de fichier"
-#define MED_VERSION_ACTUELLE "2.1.6"
-#define HDF_VERSION_ACTUELLE "5-1.4.4"
-
-/* Noms des data sets ou attributs correspondant a des entites MED */
-#define MED_TAILLE_NOM_ENTITE 3
-#define MED_NOM_NUM "NUM"
-#define MED_NOM_NBR "NBR"
-#define MED_NOM_NOM "NOM"
-#define MED_NOM_UNV "UNV"
-#define MED_NOM_NNS "NNS"
-#define MED_NOM_NNM "NNM"
-#define MED_NOM_NNI "NNI"
-#define MED_NOM_GRO "GRO"
-#define MED_NOM_ATT "ATT"
-#define MED_NOM_NCO "NCO"
-#define MED_NOM_DIM "DIM"
-#define MED_NOM_FAM "FAM"
-#define MED_NOM_IDE "IDE"
-#define MED_NOM_VAL "VAL"
-#define MED_NOM_DES "DES"
-#define MED_NOM_COR "COR"
-#define MED_NOM_DIM "DIM"
-#define MED_NOM_NOE "NOE"
-#define MED_NOM_COO "COO"
-#define MED_NOM_REP "REP"
-#define MED_NOM_UNI "UNI"
-#define MED_NOM_NOD "NOD"
-#define MED_NOM_TYP "TYP"
-#define MED_NOM_CO "CO"
-#define MED_NOM_NCW "NCW"
-#define MED_NOM_TYW "TYW"
-#define MED_NOM_MAI "MAI"
-#define MED_NOM_FAC "FAC"
-#define MED_NOM_ARE "ARE"
-#define MED_NOM_PO1 "PO1"
-#define MED_NOM_SE2 "SE2"
-#define MED_NOM_SE3 "SE3"
-#define MED_NOM_TR3 "TR3"
-#define MED_NOM_TR6 "TR6"
-#define MED_NOM_QU4 "QU4"
-#define MED_NOM_QU8 "QU8"
-#define MED_NOM_TE4 "TE4"
-#define MED_NOM_T10 "T10"
-#define MED_NOM_HE8 "HE8"
-#define MED_NOM_H20 "H20"
-#define MED_NOM_PE6 "PE6"
-#define MED_NOM_P15 "P15"
-#define MED_NOM_PY5 "PY5"
-#define MED_NOM_P13 "P13"
-
-#define MED_NOM_GEO "GEO"
-#define MED_NOM_GAU "GAU"
-#define MED_NOM_NGA "NGA"
-#define MED_NOM_N "N"
-#define MED_NOM_PFL "PFL"
-#define MED_NOM_NDT "NDT"
-#define MED_NOM_PDT "PDT"
-#define MED_NOM_NOR "NOR"
-
-/* Integration des developpements OCC */
-#define MED_NOM_GRD "GRD"
-#define MED_NOM_BOF "BOF"
-#define MED_NOM_IN1 "IN1"
-#define MED_NOM_IN2 "IN2"
-#define MED_NOM_IN3 "IN3"
-
-/* Nom du DATA GROUP CONTENANT TOUS LES MAILLAGES DU FICHIER HDF */
-#define MED_MAA "/ENS_MAA/"
-#define MED_TAILLE_MAA 9
-
-/* Nom du data group ou ranger les champs solution */
-#define MED_CHA "/CHA/"
-#define MED_TAILLE_CHA 5
-
-/* Nom du data group ou ranger les familles */
-#define MED_FAS "/FAS/"
-#define MED_TAILLE_FAS 5
-
-/* Nom du data group ou ranger les equivalences */
-#define MED_EQS "/EQS/"
-#define MED_TAILLE_EQS 5
-
-/* Nom du data groupe contenant les profils */
-#define MED_PROFILS "/PROFILS/"
-#define MED_TAILLE_PROFILS 9
-
-/*Pour eviter le bug solaris*/
-#include <malloc.h>
-
-/* Interface des routines du composant tools */
-#include "med_misc.hxx"
-#include "med_hdfi.hxx"
-#include "med_utils.hxx"
-#endif /* MED_OUTILS_H */
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-#ifndef MED_PROTO_H
-#define MED_PROTO_H
-
-/* Interface de l'API MED */
-namespace med_2_1{
-/* Fichier */
-extern med_idt
-MEDouvrir(char *nom, med_mode_acces mode_acces);
-extern med_err
-MEDfermer(med_idt fid);
-extern med_int
-MEDlFichDes(med_idt fid);
-extern med_err
-MEDfichEntete(med_idt fid, med_fich_info quoi, char str[]);
-extern med_err
-MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode);
-extern med_err
-MEDunvCr(med_idt fid, char *maa);
-extern med_err
-MEDunvLire(med_idt fid, char *maa,char *nomu);
-extern med_err
-MEDformatConforme(const char * nomfich);
-extern med_err
-MEDversionConforme(const char *nom);
-extern void
-MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release);
-extern med_err
-MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release);
-
-
-
-/* Maillage */
-extern med_err
-MEDmaaCr(med_idt fid, char *maillage, med_int dim);
-extern med_int
-MEDdimLire(med_idt fid, char *maillage);
-extern med_err
-MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim);
-extern med_int
-MEDnMaa(med_idt fid);
-extern med_err
-MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnosoLire(med_idt fid,char *nom_maillage);
-extern med_err
-MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnoisLire(med_idt fid,char *nom_maillage);
-extern med_err
-MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnomaLire(med_idt fid,char *nom_maillage);
-
-/* EntMaillage */
-extern med_err
-MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
- med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_connectivite type_conn);
-
-extern med_err
-MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- med_int * pfltab, med_size psize,
- med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn);
-extern med_err
-MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int n,
- med_mode_acces mode, med_repere type_rep, char *nom, char *unit);
-extern med_err
-MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int numco,
- med_int * pfltab, med_size psize, med_repere *type_rep, char *nom, char *unit);
-
-extern med_int
-MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_connectivite type_conn);
-
-
-/* Resultat */
-extern med_err MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
- char *unit,med_int ncomp);
-
-extern med_err
-MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
- med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo);
-
-extern med_err
-MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
- char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
- med_int numdt, med_int numo);
-
-extern med_err
-MEDchampInfo(med_idt fid,int indice,char *champ,
- med_type_champ *type,char *comp,char *unit,
- med_int ncomp);
-
-extern med_int
-MEDnChamp(med_idt fid, int indice);
-
-extern med_int
-MEDnVal(med_idt fid, char *champ, med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_int numdt, med_int numo);
-
-
-/* Famille */
-extern med_err
-MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent, med_geometrie_element type_geo);
-extern med_err
-MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
- med_int *attr_ident, med_int *attr_val,char *attr_desc,med_int n_attr,
- char *groupe , med_int n_groupe);
-extern med_int
-MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi);
-
-extern med_err
-MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
- med_int *numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int *n_attr,char *groupe ,med_int *n_groupe);
-
-/* Equivalence */
-extern med_err
-MEDequivCr(med_idt fid,char *maa, char *eq, char *desc);
-extern med_err
-MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_entite_maillage typ_ent,med_geometrie_element typ_geo);
-extern med_err
-MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo);
-extern med_err
-MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des);
-extern med_int
-MEDnEquiv(med_idt fid, char *maa);
-extern med_int
-MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo);
-
-
-/* Routines de niveau intermediaire */
-extern med_int
-MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
- med_connectivite typ_con);
-
-extern med_err
-MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
- med_mode_switch mode_coo,
- med_repere *repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
- med_int nnoeuds);
-
-extern med_err
-MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
- med_mode_switch mode_coo,
- med_repere repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
- med_int nnoeuds,med_mode_acces mode);
-extern med_err
-MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen inom,med_int *num,med_booleen inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn,med_mode_acces mode);
-extern med_err
-MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn);
-
-/* Routines de haut niveau */
-
-/*(? On enlève le reste ?)*/
-
-extern med_err
-MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
- med_int *ngroc);
-
-extern med_err
-MEDfamMaaLire(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles);
-
-extern med_err
-MEDfamMaaCr(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles);
-
-/* Routines concernant les profils */
-
-extern med_err
-MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n);
-
-extern med_int
-MEDnProfil(med_idt fid);
-
-extern med_err
-MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom);
-
-extern med_int
-MEDnValProfil(med_idt fid, char *nom);
-
-extern med_err
-MEDprofilLire(med_idt fid, med_int *pflval, char *nom);
-
-/* Routines concernant les pas de temps/ numéros d'ordre */
-
-extern med_int
-MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
- med_geometrie_element type_geo);
-
-extern med_err
-MEDpasdetempsInfo(med_idt fid,char *champ
- ,med_entite_maillage type_ent, med_geometrie_element type_geo,
- int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
- med_int * numo);
-
-/* Grilles */
-
-med_int MEDnGrid(med_idt fid, char *maa, med_grid n);
-med_err MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ);
-med_err MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ);
-med_err MEDgridEcr(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode );
-med_err MEDgridLire(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo );
-med_err MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent);
-med_err MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent);
-med_err MEDbodyFittedEcr(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode );
-med_err MEDbodyFittedLire(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds );
-}
-
-#endif /* MED_PROTO_H */
-
-
-
-
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-# ifndef __UTILITES_H__
-# define __UTILITES_H__
-
-
-/* pour indiquer le statut des arguments des fonctions. */
-
-#ifdef _IN
-#error _IN already defined
-#endif
-#define _IN
-
-#ifdef _OUT
-#error _OUT already defined
-#endif
-#define _OUT
-
-#ifdef _INOUT
-#error _INOUT already defined
-#endif
-#define _INOUT
-
-#ifdef _UNUSED
-#error _UNUSED already defined
-#endif
-#define _UNUSED
-
-
-
-
-
-
-
-/* --- Pour afficher le nom du fichier source courant et le numero de la ligne courante --- */
-/* --- sur la stderr. --- */
-
-# define ICI {\
- fflush(stdout);\
- fprintf(stderr, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
- fflush(stderr) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour afficher la date et l'heure de la compilation du fichier source courant, --- */
-/* --- sur la stdout. --- */
-
-# ifdef INFOS_COMPILATION
-# error INFOS_COMPILATION already defined
-# endif
-# define INFOS_COMPILATION {\
- fflush(stderr);\
- fprintf(stdout, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
- fprintf(stdout,"Compilation le %s" , __DATE__);\
- fprintf(stdout," a %s" , __TIME__ );\
- fprintf(stdout,"\n\n\n" );\
- fflush(stdout) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour attendre "secondes" secondes et afficher un message sur la stderr indiquant --- */
-/* --- cette attente volontaire. --- */
-
-# ifdef ATTENTE
-# error ATTENTE already defined
-# endif
-# define ATTENTE(secondes) {\
- ICI ;\
- fprintf( stderr, "ATTENTE de %d secondes" , secondes);\
- fflush(stderr) ;\
- sleep(secondes) ;\
- fprintf( stderr, "\n" );\
- fflush(stderr) ;\
- }
-
-
-
-
-
-
-
-/* ---------- Les macros suivantes ne doivent pas deja exister ! ---------- */
-
-# ifdef EXECUTION
-# error EXECUTION already defined
-# endif
-# ifdef INTERRUPTION
-# error INTERRUPTION already defined
-# endif
-# ifdef ISCRUTE
-# error ISCRUTE already defined
-# endif
-# ifdef RSCRUTE
-# error RSCRUTE already defined
-# endif
-# ifdef SSCRUTE
-# error SSCRUTE already defined
-# endif
-# ifdef CSCRUTE
-# error CSCRUTE already defined
-# endif
-# ifdef XSCRUTE
-# error XSCRUTE already defined
-# endif
-# ifdef MESSAGE
-# error MESSAGE already defined
-# endif
-
-
-
-
-
-# ifdef _DEBOG_
-
-
-/* --- Pour tracer sur la stderr l'execution d"une instruction. --- */
-
-# define EXECUTION(instruction) {\
- ICI ;\
- fprintf( stderr,"INSTRUCTION %s" , #instruction ) ;\
- fflush(stderr);\
- instruction ;\
- fflush(stdout);\
- fprintf( stderr," FRANCHIE\n" ) ;\
- fflush(stderr);\
- }
-
-
-
-
-
-
-
-/* --- Pour afficher un message d'interruption volontaire et retourner le code retour --- */
-/* --- "code" --- */
-
-# define INTERRUPTION(code) {\
- ICI ;\
- fprintf( stderr," INTERRUPTION code = %d",code) ;\
- fprintf(stderr,"\n") ;\
- exit(code) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour conditionner la poursuite du traitement par la validite de la condition --- */
-/* --- "condiiton". --- */
-
-# ifndef ASSERT
-# define ASSERT(condition) if( !(condition) ){\
- ICI ;\
- fprintf(stderr,"condition %s VIOLEE\n",#condition);\
- INTERRUPTION(17);\
- }
-# endif /* # ifndef ASSERT */
-
-
-
-
-
-
-
-/* --- Pour afficher sur la stderr la valeur d'une variable precedee de son nom. --- */
-
-# define ISCRUTE(entier) {\
- ICI ;\
- fprintf(stderr,"%s = %d\n",#entier,entier) ;\
- fflush(stderr) ;\
- }
-# define RSCRUTE(reel) {\
- ICI ;\
- fprintf(stderr,"%s = %f\n",#reel,reel) ;\
- fflush(stderr) ;\
- }
-# define XSCRUTE(pointeur) {\
- ICI ;\
- fprintf(stderr,"%s = %x\n",#pointeur,pointeur) ;\
- fflush(stderr) ;\
- }
-# define CSCRUTE(car) {\
- ICI ;\
- fprintf(stderr,"%s = %c\n",#car,car) ;\
- fflush(stderr) ;\
- }
-# define SSCRUTE(chaine) {\
- ICI ;\
- fprintf(stderr,"%s = \"%s\"\n",#chaine,chaine) ;\
- fflush(stderr) ;\
- }
-# define MESSAGE(chaine) {\
- ICI ;\
- fprintf(stderr,"%s\n",chaine) ;\
- fflush(stderr) ;\
- }
-# define FIN(nom) {\
- ICI ;\
- fprintf( stderr , "} FIN %s\n\n\n" , nom ) ;\
- fflush(stderr) ;\
- }
-# define DEBUT(nom) {\
- fprintf( stderr , "\n\n\n") ;\
- ICI ;\
- fprintf( stderr , "{ DEBUT %s\n" , nom ) ;\
- fflush(stderr) ;\
- }
-
-
-# else /* # ifdef _DEBOG_ */
-
-
-
-# define EXECUTION(instruction) instruction
-# define INTERRUPTION(code)
-
-# ifndef ASSERT
-# define ASSERT(condition)
-# endif
-
-# define ISCRUTE(entier)
-# define RSCRUTE(reel)
-# define CSCRUTE(car)
-# define SSCRUTE(chaine)
-# define MESSAGE(chaine)
-# define DEBUT(nom)
-# define FIN(nom)
-
-
-# endif /* # ifdef _DEBOG_ */
-
-
-# endif /* # ifndef __UTILITES_H__ */
+++ /dev/null
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* 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
-*
-*************************************************************************/
-
-/******************************************************************************
- * - Nom du fichier : test1.c
- *
- * - Description : tests des routines d'ouverture/fermeture des
- * fichiers MED
- *
- *****************************************************************************/
-
-#include "med.hxx"
-using namespace med_2_1;
-
-/******************************************************************************
- * OUVERTURE/FERMETURE DE FICHIERS :
- *
- * Description :
- * - ouverture du fichier en mode ecriture avec remplacement
- * - ecriture d'une description du fichier (optionnel)
- * - fermeture du fichier
- * - ouverture du fichier en mode de lecture
- * - fermeture du fichier
- *****************************************************************************/
-
-int main (int argc, char **argv)
-{
- med_err ret = 0;
- med_idt fid;
- char des[MED_TAILLE_DESC+1]="Ceci est un courte description du mon fichier test1.med";
-
- fid = MEDouvrir("test1.med",MED_REMP);
- if (fid < 0)
- ret = -1;
- printf("%d\n",ret);
-
- if (ret == 0)
- ret = MEDfichDesEcr(fid,des, MED_REMP);
- printf("%d\n",ret);
-
- ret = MEDfermer(fid);
- printf("%d\n",ret);
-
- fid = MEDouvrir("test1.med",MED_LECT);
- if (fid < 0)
- ret = -1;
- printf("%d\n",ret);
-
- ret = MEDfermer(fid);
- printf("%d\n",ret);
-
- return 0;
-}
-
-
-
-
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_V2_2_Wrapper.hxx"
-#include "MED_Utilities.hxx"
-
-extern "C"{
-#include <med.h>
-}
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-
-namespace MED{
- namespace V2_2{
-
- //---------------------------------------------------------------
- class TFile{
- TFile();
- TFile(const TFile&);
-
- public:
- TFile(const std::string& theFileName):
- myFid(0),
- myCount(0),
- myFileName(theFileName)
- {}
-
- ~TFile(){
- Close();
- }
-
- void Open(EModeAcces theMode, TErr* theErr = NULL){
- if(myCount++ == 0){
- char* aFileName = const_cast<char*>(myFileName.c_str());
- myFid = MEDouvrir(aFileName,med_mode_acces(theMode));
- }
- if(theErr)
- *theErr = TErr(myFid > 0);
- else if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - MEDouvrir('"<<myFileName<<"',"<<theMode<<")");
- }
-
- const TIdt& Id() const {
- if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - GetFid() < 0");
- return myFid;
- }
-
- void Close(){
- if(--myCount == 0)
- MEDfermer(myFid);
- }
-
- protected:
- std::string myFileName;
- TInt myCount;
- TIdt myFid;
- };
-
-
- //---------------------------------------------------------------
- class TFileWrapper{
- PFile myFile;
-
- public:
- TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL):
- myFile(theFile)
- {
- myFile->Open(theMode,theErr);
- }
-
- ~TFileWrapper(){
- myFile->Close();
- }
- };
-
-
- //---------------------------------------------------------------
- TVWrapper::TVWrapper(const std::string& theFileName):
- myFile(new TFile(theFileName))
- {
- }
-
-
- TInt TVWrapper::GetNbMeshes(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- return MEDnMaa(myFile->Id());
- }
-
-
- void TVWrapper::GetMeshInfo(TInt theMeshId,
- MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- med_maillage& aType = static_cast<med_maillage>(theInfo.myType);
-
- TErr aRet = MEDmaaInfo(myFile->Id(),
- theMeshId,
- &theInfo.myName[0],
- &theInfo.myDim,
- &aType,
- &theInfo.myDesc[0]);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetMeshInfo - MEDmaaInfo(...)");
- }
-
-
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
-
- med_maillage& aType = static_cast<med_maillage>(theInfo.myType);
-
- TErr aRet = MEDmaaCr(myFile->Id(),
- &anInfo.myName[0],
- anInfo.myDim,
- aType,
- &anInfo.myDesc[0]);
- if(aRet == 0){
- aRet = MEDunvCr(myFile->Id(),
- &anInfo.myName[0]);
- }
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetMeshInfo - MEDmaaCr(...)");
- }
-
-
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetMeshInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eCREATION,theErr);
- }
-
-
- TInt TVWrapper::GetNbFamilies(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0]);
- }
-
-
- TInt TVWrapper::GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnAttribut(myFile->Id(),
- &anInfo.myName[0],
- theFamId);
- }
-
-
- TInt TVWrapper::GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnGroupe(myFile->Id(),
- &anInfo.myName[0],
- theFamId);
- }
-
-
- void TVWrapper::GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TErr aRet = MEDfamInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- theFamId,
- &theInfo.myName[0],
- &theInfo.myId,
- &theInfo.myAttrId[0],
- &theInfo.myAttrVal[0],
- &theInfo.myAttrDesc[0],
- &theInfo.myNbAttr,
- &theInfo.myGroupNames[0],
- &theInfo.myNbGroup);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFamilyInfo - MEDfamInfo(...) - "<<
- " aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<
- "'; theFamId = "<<theFamId<<
- "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
- "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
-
- INITMSG(MYDEBUG,"GetFamilyInfo - MEDfamInfo(...) - "<<
- " aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<
- "'; theFamId = "<<theFamId<<
- "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
- "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
- }
-
-
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TErr aRet = MEDfamCr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myName[0],
- anInfo.myId,
- &anInfo.myAttrId[0],
- &anInfo.myAttrVal[0],
- &anInfo.myAttrDesc[0],
- anInfo.myNbAttr,
- &anInfo.myGroupNames[0],
- anInfo.myNbGroup);
-
- INITMSG(MYDEBUG,"TVWrapper::GetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFamilyInfo - MEDfamCr(...)");
- }
-
-
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFamilyInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetFamilyInfo(theInfo,eLECTURE_AJOUT,theErr);
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TVWrapper::GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = MEDnomLire(myFile->Id(),
- &aMeshInfo.myName[0],
- &theInfo.myElemNames[0],
- nb,
- anEntity,
- aGeom);
-
- theInfo.myIsElemNames = (theInfo.myElemNames).empty()? EBooleen(0) : EBooleen(1) ;
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetNames - MEDnomLire(...)");
- }
-
- void TVWrapper::GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = MEDnumLire(myFile->Id(),
- &aMeshInfo.myName[0],
- &theInfo.myElemNum[0],
- nb,
- anEntity,
- aGeom);
-
- theInfo.myIsElemNum = (theInfo.myElemNum).empty()? EBooleen(0) : EBooleen(1) ;
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetNumeration - MEDnumLire(...)");
- }
-
- void TVWrapper::GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = MEDfamLire(myFile->Id(),
- &aMeshInfo.myName[0],
- &theInfo.myFamNum[0],
- nb,
- anEntity,
- aGeom);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFamilies - MEDfamLire(...)");
- }
-
- void TVWrapper::SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- SetNames(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
- }
-
- void TVWrapper::SetNames(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = 0;
- if (anIsElemNames){
- aRet = MEDnomEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNames[0],
- anInfo.myElemNames.size(),
- anEntity,
- aGeom);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetNames - MEDnomEcr(...)");
- }
- }
-
- void TVWrapper::SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- SetNumeration(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
- }
-
- void TVWrapper::SetNumeration(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = 0;
- if (anIsElemNum){
- aRet = MEDnumEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNum[0],
- anInfo.myElemNum.size(),
- anEntity,
- aGeom);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetNumeration - MEDnumEcr(...)");
- }
- }
-
- void TVWrapper::SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- SetFamilies(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
- }
-
- void TVWrapper::SetFamilies(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-
- TErr aRet = MEDfamEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myFamNum[0],
- anInfo.myFamNum.size(),
- anEntity,
- aGeom);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFamilies - MEDfamEcr(...)");
- }
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- return MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_COOR,
- MED_NOEUD,
- med_geometrie_element(0),
- med_connectivite(0));
- }
-
-
- void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_repere& aRepere = static_cast<med_repere>(theInfo.mySystem);
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &theInfo.myCoord[0],
- MED_FULL_INTERLACE,
- &aRepere,
- &theInfo.myCoordNames[0],
- &theInfo.myCoordUnits[0],
- &theInfo.myElemNames[0],
- &anIsElemNames,
- &theInfo.myElemNum[0],
- &anIsElemNum,
- &theInfo.myFamNum[0],
- theInfo.myNbElem);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
- }
-
-
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_repere& aRepere = static_cast<med_repere>(theInfo.mySystem);
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &anInfo.myCoord[0],
- MED_FULL_INTERLACE,
- aRepere,
- &anInfo.myCoordNames[0],
- &anInfo.myCoordUnits[0],
- &anInfo.myElemNames[0],
- anIsElemNames,
- &anInfo.myElemNum[0],
- anIsElemNum,
- &anInfo.myFamNum[0],
- anInfo.myNbElem);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetNodeInfo - MEDnoeudsEcr(...)");
- }
-
-
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetNodeInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetNodeInfo(theInfo,eLECTURE_AJOUT,theErr);
- }
-
- void TVWrapper::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TInt aNbElem = theInfo.myElemNum.size();
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = 0;
-
- aRet = MEDpolygoneConnLire(myFile->Id(),
- &aMeshInfo.myName[0],
- &theInfo.myIndex[0],
- aNbElem+1,
- &theInfo.myConn[0],
- anEntity,
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
-
-
- GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- TErr* theErr)
- {
- SetPolygoneInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDpolygoneConnEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myIndex[0],
- anInfo.myNbElem+1,
- &anInfo.myConn[0],
- anEntity,
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolygoneInfo - MEDpolygoneConnEcr(...)");
-
- SetNames(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- SetNumeration(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- SetFamilies(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- TInt TVWrapper::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
- }
-
- TInt TVWrapper::GetNbPolygoneConn(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return 0;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
- med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
-
- med_int taille = 0;
-
- TErr aRet = MEDpolygoneInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- anEntity,
- aConn,
- &taille);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
-
- return TInt(taille);
- }
-
- void TVWrapper::GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TInt aNbElem = theInfo.myElemNum.size();
-
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = 0;
-
- aRet = MEDpolyedreConnLire(myFile->Id(),
- &aMeshInfo.myName[0],
- &theInfo.myIndex[0],
- aNbElem+1,
- &theInfo.myFacesIndex[0],
- theInfo.myNbFacesIndex,
- &theInfo.myConn[0],
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreConnLire(...)");
-
- GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- void TVWrapper::SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr)
- {
- SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- void TVWrapper::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDpolyedreConnEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myIndex[0],
- anInfo.myNbElem+1,
- &anInfo.myFacesIndex[0],
- anInfo.myNbFacesIndex,
- &anInfo.myConn[0],
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolyedreInfo - MEDpolyedreConnEcr(...)");
-
- if (anIsElemNames){
- aRet = MEDnomEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNames[0],
- anInfo.myElemNames.size(),
- anEntity,
- MED_POLYEDRE);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnomEcr(...)");
- }
-
- if (anIsElemNum){
- aRet = MEDnumEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNum[0],
- anInfo.myElemNum.size(),
- anEntity,
- MED_POLYEDRE);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnumEcr(...)");
- }
-
-
- aRet = MEDfamEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myFamNum[0],
- anInfo.myFamNum.size(),
- anEntity,
- MED_POLYEDRE);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolyedreInfo - MEDfamEcr(...)");
- }
-
- TInt TVWrapper::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
- }
-
- void TVWrapper::GetNbPolyedreConnF(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TInt& nf,
- TInt& nc,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr) EXCEPTION(runtime_error,"GetPolyedreInfo - (...)");
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
-
- TErr aRet = MEDpolyedreInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- aConn,
- &nf,
- &nc);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreInfo(...)");
-
- }
-
- TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TEntityInfo anInfo;
-
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return anInfo;
-
- TInt aNbElem = GetNbNodes(theMeshInfo);
- if(aNbElem > 0){
- anInfo[eNOEUD][ePOINT1] = aNbElem;
- const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
- TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
- TEntity2GeomSet::const_iterator anIterEnd = anEntity2GeomSet.end();
- for(; anIter != anIterEnd; anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- const TGeomSet& aGeomSet = anIter->second;
- TGeomSet::const_iterator anIter2 = aGeomSet.begin();
- TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
- for(; anIter2 != anIterEnd2; anIter2++){
- const EGeometrieElement& aGeom = *anIter2;
- aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
- if(aNbElem > 0)
- anInfo[anEntity][aGeom] = aNbElem;
- }
- }
- }
- return anInfo;
- }
-
-
- TInt TVWrapper::GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- med_entite_maillage anEntity = med_entite_maillage(theTEntity);
- med_geometrie_element aGeom = med_geometrie_element(theTGeom);
- med_connectivite aConn = med_connectivite(theTConn);
-
- return MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_CONN,
- anEntity,
- aGeom,
- aConn);
- }
-
-
- void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TInt aNbElem = theInfo.myElemNum.size();
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theInfo.myTGeom);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDelementsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &theInfo.myConn[0],
- MED_FULL_INTERLACE,
- &theInfo.myElemNames[0],
- &anIsElemNames,
- &theInfo.myElemNum[0],
- &anIsElemNum,
- &theInfo.myFamNum[0],
- aNbElem,
- anEntity,
- aGeom,
- aConn);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
- }
-
-
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TCellInfo& anInfo = const_cast<MED::TCellInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theInfo.myTGeom);
- med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
-
- TErr aRet = MEDelementsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &anInfo.myConn[0],
- MED_FULL_INTERLACE,
- &anInfo.myElemNames[0],
- anIsElemNames,
- &anInfo.myElemNum[0],
- anIsElemNum,
- &anInfo.myFamNum[0],
- anInfo.myNbElem,
- anEntity,
- aGeom,
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetCellInfo - MEDelementsLire(...)");
- }
-
-
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- SetCellInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
-
- TInt TVWrapper::GetNbFields(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- return MEDnChamp(myFile->Id(),0);
- }
-
-
- TInt TVWrapper::GetNbComp(TInt theFieldId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return -1;
-
- return MEDnChamp(myFile->Id(),theFieldId);
- }
-
-
- void TVWrapper::GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- med_type_champ& aType = static_cast<med_type_champ>(theInfo.myType);
-
- TErr aRet = MEDchampInfo(myFile->Id(),
- theFieldId,
- &theInfo.myName[0],
- &aType,
- &theInfo.myCompNames[0],
- &theInfo.myUnitNames[0],
- theInfo.myNbComp);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFieldInfo - MEDchampInfo(...)");
- }
-
-
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
-
- med_type_champ& aType = static_cast<med_type_champ>(theInfo.myType);
-
- TErr aRet = MEDchampCr(myFile->Id(),
- &anInfo.myName[0],
- aType,
- &anInfo.myCompNames[0],
- &anInfo.myUnitNames[0],
- anInfo.myNbComp);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFieldInfo - MEDchampEcr(...)");
- }
-
-
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFieldInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetFieldInfo(theInfo,eLECTURE_AJOUT,theErr);
- }
-
-
- TInt TVWrapper::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr)
- {
- theEntity = EEntiteMaillage(-1);
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr){
- if(theEntityInfo.empty())
- *theErr = -1;
- if(*theErr < 0)
- return -1;
- }else if(theEntityInfo.empty())
- EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
-
- theGeom.clear();
- TInt aNbTimeStamps = 0;
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
- TEntityInfo::const_iterator anIter = theEntityInfo.begin();
- for(; anIter != theEntityInfo.end(); anIter++){
- const med_entite_maillage& anEntity = static_cast<const med_entite_maillage>(anIter->first);
- const TGeom& aTGeom = anIter->second;
- TGeom::const_iterator anGeomIter = aTGeom.begin();
- for(; anGeomIter != aTGeom.end(); anGeomIter++){
- const med_geometrie_element& aGeom = static_cast<const med_geometrie_element>(anGeomIter->first);
- TInt aTmp = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
- aNbTimeStamps = max(aTmp,aNbTimeStamps);
- if (aNbTimeStamps<1)
- continue;
- BEGMSG(MYDEBUG,"GetNbTimeStamps aNbTimeStamps="<<aTmp<<"; aGeom="<<aGeom<<"; anEntity="<<anEntity<<"\n");
- if(aTmp){
- theEntity = EEntiteMaillage(anEntity);
- ADDMSG(MYDEBUG,"theEntity="<<theEntity<<"\n");
- theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
- }
- }
- if(!theGeom.empty())
- break;
- }
- return aNbTimeStamps;
- }
-
-
- void TVWrapper::GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- TGeom& aTGeom = theInfo.myGeom;
-
- if(theErr){
- if(aTGeom.empty())
- *theErr = -1;
- if(*theErr < 0)
- return;
- }else if(aTGeom.empty())
- EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
-
- MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myEntity);
-
- TGeom::iterator anIter = aTGeom.begin();
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
-
- med_booleen& anIsLocal = static_cast<med_booleen>(aFieldInfo.myIsLocal);
-
- TErr aRet = MEDpasdetempsInfo(myFile->Id(),
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- theTimeStampId,
- &theInfo.myNbGauss,
- &theInfo.myNumDt,
- &theInfo.myNumOrd,
- &theInfo.myUnitDt[0],
- &theInfo.myDt,
- &aMeshInfo.myName[0],
- &anIsLocal,
- &aFieldInfo.myNbRef);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
-
- static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
- theInfo.myNbGauss = 1;
- }
-
-
- void TVWrapper::GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && !*theErr)
- return;
-
- TIdt anId = myFile->Id();
-
- MED::TTimeStampInfo& aTimeStampInfo = *theVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(aTimeStampInfo.myEntity);
- med_mode_profil& aPflMode = static_cast<med_mode_profil>(theVal.myPflMode);
- TGeom& aTGeom = aTimeStampInfo.myGeom;
- TGeom::iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
- TInt aNbVal = MEDnVal(anId,
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd,
- &aMeshInfo.myName[0],
- aPflMode);
- if(aNbVal <= 0){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
- }
-
- TValue& aValue = theVal.myMeshValue[EGeometrieElement(aGeom)];
- TInt iEnd = aNbVal*aFieldInfo.myNbComp;
-
- if(iEnd != aValue.size()){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,
- "GetTimeStampInfo - iEnd("<<iEnd<<
- ") != aValue.size()("<<aValue.size()<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom);
- }
-
- TErr aRet;
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &aTimeStampInfo.myGaussName[0],
- &theVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }
- default: {
- std::vector<TInt> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &aTimeStampInfo.myGaussName[0],
- &theVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(med_int i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }}
- if(aRet < 0){
- if(theErr){
- *theErr = MED_FAUX;
- return;
- }
- EXCEPTION(runtime_error,"GetValTimeStamp - MEDchampLire(...)");
- }
- }
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && !*theErr)
- return;
-
- TErr aRet;
- TIdt anId = myFile->Id();
-
- MED::TTimeStampVal& aVal = const_cast<MED::TTimeStampVal&>(theVal);
- MED::TTimeStampInfo& aTimeStampInfo = *aVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- MED::TMeshValue& aMeshValue = aVal.myMeshValue;
-
- med_entite_maillage& anEntity = static_cast<med_entite_maillage>(aTimeStampInfo.myEntity);
- med_mode_profil& aPflMode = static_cast<med_mode_profil>(theVal.myPflMode);
- TMeshValue::iterator anIter = aMeshValue.begin();
- for(; anIter != aMeshValue.end(); anIter++){
- med_geometrie_element& aGeom = static_cast<med_geometrie_element>(anIter->first);
- TValue& aValue = aVal.myMeshValue[EGeometrieElement(aGeom)];
- med_int iEnd = aValue.size();
- med_int aNbVal = iEnd / aFieldInfo.myNbComp;
-
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat>& anArray = aValue;
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- &aTimeStampInfo.myGaussName[0],
- MED_ALL,
- &aVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }
- default: {
- vector<TInt> anArray(iEnd);
- for(TInt i = 0; i< iEnd; i++) anArray[i] = TInt(aValue[i]);
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- &aTimeStampInfo.myGaussName[0],
- MED_ALL,
- &aVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }}
-
- if(aRet < 0){
- if(theErr){
- *theErr = MED_FAUX;
- break;
- }
- EXCEPTION(runtime_error,"SetTimeStamp - MEDchampEcr(...)");
- }
-
- }
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TErr aRet;
- SetTimeStamp(theVal,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetTimeStamp(theVal,eLECTURE_AJOUT,theErr);
- }
-
- }
-}
+++ /dev/null
-//
-//
-// 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 :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_V2_2_Wrapper_HeaderFile
-#define MED_V2_2_Wrapper_HeaderFile
-
-#include "MED_Structures.hxx"
-#include "MED_TWrapper.hxx"
-
-namespace MED{
- namespace V2_2{
-
- const TInt PNOM = 16;
-
- typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVMeshInfo;
-
- typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFamilyInfo;
-
- typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVNodeInfo;
-
- typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVCellInfo;
-
- typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFieldInfo;
-
- typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampInfo;
-
- typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampVal;
-
- //---------------------------------------------------------------
- class TFile;
- typedef boost::shared_ptr<TFile> PFile;
-
- typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces;
-
- //---------------------------------------------------------------
- class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_2>{
- TVWrapper();
- TVWrapper(const TVWrapper&);
- TVWrapper& operator=(const TVWrapper&);
-
- public:
- TVWrapper(const std::string& theFileName);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbMeshes(TErr* theErr = NULL);
-
- virtual
- void
- GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
- TErr* theErr = NULL);
-
- virtual
- void
- SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- void
- SetNames(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
- void
- SetNumeration(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
- void
- SetFamilies(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetPolygoneInfo(TPolygoneInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetPolygoneInfo(const TPolygoneInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbPolygones(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- void
- GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbPolyedres(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL);
-
- virtual
- void
- GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
- EConnectivite,
- TInt& nf,
- TInt& nc,
- TErr* theErr = NULL);
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TEntityInfo
- GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL);
-
- virtual
- void
- GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbFields(TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbComp(TInt theFieldId,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- virtual
- TInt
- GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr = NULL);
-
- virtual
- void
- SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- TErr* theErr = NULL);
-
- void
- SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- protected:
- PFile myFile;
- };
- }
-}
-
-#endif
+++ /dev/null
-#
-#
-# 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 :
-# Author :
-# Module :
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Libraries targets
-
-LIB = libMEDWrapper_V2_2.la
-LIB_SRC = \
- MED_V2_2_Wrapper.cxx
-
-EXPORT_HEADERS = \
- MED_V2_2_Wrapper.hxx
-
-# Executables targets
-BIN =
-BIN_SRC =
-
-CPPFLAGS+= $(BOOST_CPPFLAGS) $(MED2_INCLUDES)
-
-LDFLAGS+= $(MED2_LIBS) $(HDF5_LIBS) -lMEDWrapperBase
-
-@CONCLUDE@
+++ /dev/null
-#==============================================================================
-# File : MPILifeCycleCORBA.py
-# Created : ven may 30 08:42:01 CEST 2003
-# Author : Bernard SECHER, CEA
-# Project : SALOME
-# Copyright : CEA 2003
-# $Header$
-#==============================================================================
-
-from LifeCycleCORBA import *
-from Utils_Identity import getShortHostName
-
-class MPILifeCycleCORBA(LifeCycleCORBA):
- #-------------------------------------------------------------------------
-
- def __init__(self, orb):
- MESSAGE( "MPILifeCycleCORBA::__init__" )
- LifeCycleCORBA.__init__(self, orb)
-
- #-------------------------------------------------------------------------
-
- def FindOrStartMPIContainer(self, theComputer , theMPIContainerRoot, nbproc ):
- theMPIContainer = theMPIContainerRoot + "_" + str(nbproc)
- MESSAGE( "FindOrStartMPIContainer" + theComputer + theMPIContainer )
- aMPIContainer = self.FindContainer( theComputer + "/" + theMPIContainer )
- if aMPIContainer is None :
- if (theMPIContainerRoot == "MPIFactoryServer") | (theMPIContainerRoot == "MPIFactoryServerPy") :
- if theComputer == getShortHostName() :
- rshstr = ""
- else :
- rshstr = "rsh -n " + theComputer + " "
- path = self.ComputerPath( theComputer )
-## if path != "" :
-## rshstr = rshstr + path + "/../bin/salome/"
-## else :
-## rshstr = rshstr + os.getenv( "KERNEL_ROOT_DIR" ) + "/bin/"
-# rshstr = rshstr + os.getenv( "PWD" ) + "/"
- if theMPIContainerRoot == "MPIFactoryServer" :
- rshstr = rshstr + "mpirun -np " + str(nbproc) + " " + path + "SALOME_MPIContainer "
- else :
- rshstr = rshstr + path + "SALOME_MPIContainerPy.py '"
- rshstr = rshstr + theMPIContainer + " -"
- omniORBcfg = os.getenv( "OMNIORB_CONFIG" )
-# omniORBcfg = os.getenv( "HOME" ) + "/.omniORB.cfg"
- file = os.open( omniORBcfg , os.O_RDONLY )
- ORBInitRef = os.read(file,132)
- if ORBInitRef[len(ORBInitRef)-1] == '\n' :
- ORBInitRef,bsn = ORBInitRef.split('\n')
- os.close( file )
- rshstr = rshstr + ORBInitRef
- if theMPIContainerRoot == "MPIFactoryServerPy" :
- rshstr = rshstr + "'"
- rshstr = rshstr + " > /tmp/" + theMPIContainer + "_"
- rshstr = rshstr + theComputer
- rshstr = rshstr + ".log 2>&1 &"
- os.system( rshstr )
- MESSAGE( "FindOrStartMPIContainer" + rshstr + " done" )
- else :
- if theMPIContainer.find('Py') == -1 :
- aMPIContainer = self.FindContainer( theComputer + "/" + "MPIFactoryServer_" + str(nbproc) )
- else :
- aMPIContainer = self.FindContainer( theComputer + "/" + "MPIFactoryServerPy_" + str(nbproc) )
- aMPIContainer = aMPIContainer.start_impl( theMPIContainer )
-
- count = 21
- while aMPIContainer is None :
- time.sleep(1)
- count = count - 1
- MESSAGE( str(count) + ". Waiting for " + theComputer + "/" + theMPIContainer )
- aMPIContainer = self.FindContainer( theComputer + "/" + theMPIContainer )
- if count == 0 :
- return aMPIContainer
-
- return aMPIContainer
- #os.system("rsh -n dm2s0017 /export/home/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
-
- #-------------------------------------------------------------------------
-
- def FindOrLoadMPIComponent(self, MPIcontainerName, MPIcomponentName, nbproc):
-
- theComputer,theMPIContainerRoot = self.ContainerName( MPIcontainerName )
- theMPIContainer = theMPIContainerRoot + "_" + str(nbproc)
- name = [CosNaming.NameComponent(theComputer,"dir"),
- CosNaming.NameComponent(theMPIContainer,"dir"),
- CosNaming.NameComponent(MPIcomponentName,"object")]
- try:
- obj = self._containerRootContext.resolve(name)
- except CosNaming.NamingContext.NotFound, ex:
- MESSAGE( "component " + MPIcomponentName + " not found, trying to load" )
- MPIcontainer = self.FindContainer(theComputer + "/" + theMPIContainer)
- if MPIcontainer is None:
- MESSAGE( "MPIcontainer " + theComputer + "/" + theMPIContainer + " not found in Naming Service, trying to start" )
- if (theMPIContainerRoot != "MPIFactoryServer") & (theMPIContainerRoot != "MPIFactoryServerPy") :
- if theMPIContainer.find('Py') == -1 :
- theMPIFactorycontainerRoot = "MPIFactoryServer"
- theMPIFactorycontainer = theMPIFactorycontainerRoot + "_" + str(nbproc)
- else :
- theMPIFactorycontainerRoot = "MPIFactoryServerPy"
- theMPIFactorycontainer = theMPIFactorycontainerRoot + "_" + str(nbproc)
- MPIFactorycontainer = self.FindContainer(theComputer + "/" + theMPIFactorycontainer)
- if MPIFactorycontainer is None:
- MESSAGE( "MPIcontainer " + theComputer + "/" + theMPIFactorycontainer + " not found in Naming Service, trying to start" )
- MPIFactorycontainer = self.FindOrStartMPIContainer(theComputer,theMPIFactorycontainerRoot,nbproc)
- else:
- MPIFactorycontainer = self.FindOrStartMPIContainer(theComputer,theMPIContainerRoot,nbproc)
- if MPIFactorycontainer != None :
- MPIcontainer = self.FindOrStartMPIContainer(theComputer,theMPIContainerRoot,nbproc)
-
- if MPIcontainer != None:
- compoinfo = self._catalog.GetComponent(MPIcomponentName)
- if compoinfo is None:
- MESSAGE( "MPIcomponent " + MPIcomponentName + " not found in Module Catalog" )
- else:
- try:
- machineName = theComputer
- path = compoinfo.GetPathPrefix(machineName) + "/"
- except SALOME_ModuleCatalog.NotFound, ex:
- MESSAGE( "machine " + machineName + " not found in Module Catalog" )
- MESSAGE( "trying localhost" )
- try:
- path = compoinfo.GetPathPrefix("localhost") + "/"
- except SALOME_ModuleCatalog.NotFound, ex:
- path = ""
- implementation = path + "lib" + MPIcomponentName + "Engine.so"
- MESSAGE( "Trying to load " + implementation )
- try:
- MPIcomponent = MPIcontainer.load_impl(MPIcomponentName, implementation)
- MESSAGE( "component " + MPIcomponent._get_instanceName() + " launched !" )
- return MPIcomponent
- except:
- MESSAGE( "component " + MPIcomponentName + " NOT launched !" )
-
- else:
- try:
- MPIcomponent = obj._narrow(Engines.Component)
- if MPIcomponent is None:
- MESSAGE( MPIcomponentName + " is not a component !" )
- else:
- MESSAGE( "MPIcomponent " + MPIcomponent._get_instanceName() + " found !" )
- return MPIcomponent
- except:
- MESSAGE( MPIcomponentName + " failure" )
- return None
+++ /dev/null
-import salome
-from MPILifeCycleCORBA import *
-
-# create an LifeCycleCORBA instance
-lcc = MPILifeCycleCORBA(salome.orb)
+++ /dev/null
-#==============================================================================
-# File : Makefile.in
-# Created : lun jui 2 20:32:24 CEST 2001
-# Author : Paul RASCLE, EDF - Marc Tajchman, CEA
-# Project : SALOME
-# Copyright : EDF 2001
-# $Header$
-#==============================================================================
-
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = SALOME_MPILifeCycleCORBA.hxx
-
-EXPORT_PYSCRIPTS = MPIsalome.py MPILifeCycleCORBA.py
-
-# Libraries targets
-
-LIB = libSalomeMPILifeCycleCORBA.la
-LIB_SRC = SALOME_MPILifeCycleCORBA.cxx
-LIB_CLIENT_IDL = SALOME_MPIObject.idl SALOME_MPIContainer.idl \
- SALOME_Component.idl SALOME_ModuleCatalog.idl
-
-# Executables targets
-BIN = TestMPILifeCycleCORBA
-BIN_SRC =
-BIN_CLIENT_IDL = Logger.idl SALOME_MPIObject.idl SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl
-
-LDFLAGS += -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace
-
-@CONCLUDE@
-
+++ /dev/null
-//=============================================================================
-// File : SALOME_MPILifeCycleCORBA.cxx
-// Created : mar jui 03 14:55:50 CEST 2003
-// Author : Bernard SECHER CEA
-// Project : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#include <iostream>
-#include <fstream>
-#include <strstream>
-#include <iomanip>
-#include <stdio.h>
-#include <string.h>
-
-#include "OpUtil.hxx"
-#include "utilities.h"
-
-#include <ServiceUnreachable.hxx>
-
-#include "SALOME_MPILifeCycleCORBA.hxx"
-#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-#include "SALOME_NamingService.hxx"
-using namespace std;
-
-SALOME_MPILifeCycleCORBA::SALOME_MPILifeCycleCORBA() :
- SALOME_LifeCycleCORBA()
-{
- _MPIFactoryServer = NULL;
-}
-
-SALOME_MPILifeCycleCORBA::SALOME_MPILifeCycleCORBA(SALOME_NamingService *ns) :
- SALOME_LifeCycleCORBA(ns)
-{
- _MPIFactoryServer = NULL;
-}
-
-SALOME_MPILifeCycleCORBA::~SALOME_MPILifeCycleCORBA()
-{
-}
-
-Engines::MPIContainer_var SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer(
- const std::string theComputer ,
- const std::string theMPIContainerRoot,
- const int nbproc)
-{
- char nbp[1024];
-
- sprintf(nbp,"_%d",nbproc);
- std::string theMPIContainer = theMPIContainerRoot + nbp;
- std::string aComputerContainer = theComputer + "/" + theMPIContainer;
-
- SCRUTE( aComputerContainer ) ;
- SCRUTE( theComputer ) ;
- SCRUTE( theMPIContainer ) ;
-
- // On recherche si le containe rest deja lance
- Engines::MPIContainer_var aMPIContainer = Engines::MPIContainer::_narrow(FindContainer(aComputerContainer.c_str()));
-
- //On a trouve le container: on renvoie une poigne dessus
- if ( !CORBA::is_nil( aMPIContainer ) ) {
- MESSAGE("MPIContainer " << aComputerContainer << " found!!!");
- return aMPIContainer ;
- }
- // On a pas trouve le container
- else {
- MESSAGE("MPIContainer " << aComputerContainer << " not found!!!");
- // On recherche un container generique
- bool pyCont = false ;
- int len = theMPIContainer.length() ;
- if ( !strcmp( &theMPIContainerRoot.c_str()[len-2] , "Py" ) ) {
- pyCont = true ;
- }
- std::string MPIFactoryServer = theComputer ;
- if ( pyCont ) {
- MPIFactoryServer += "/MPIFactoryServerPy" ;
- }
- else {
- MPIFactoryServer += "/MPIFactoryServer" ;
- }
- MPIFactoryServer += nbp;
- Engines::MPIContainer_var aMPIFactoryServer = Engines::MPIContainer::_narrow(FindContainer( MPIFactoryServer.c_str()));
-
- // On n'a pas trouve le container generique: on lance le container demande
- if ( CORBA::is_nil( aMPIFactoryServer ) ) {
-// rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
- std::string rsh( "" ) ;
- if ( theComputer!= GetHostname() ) {
- rsh += "rsh -n " ;
- rsh += theComputer ;
- rsh += " " ;
- }
- std::string path = ComputerPath( theComputer.c_str() ) ;
- SCRUTE( path ) ;
- // rsh += "runSession " ;
- if ( pyCont ) {
- MESSAGE("MPI python container not implemented");
- return Engines::MPIContainer::_nil();
-// rsh += "SALOME_MPIContainerPy.py " ;
-// rsh += "MPIFactoryServerPy -" ;
- }
- else {
- sprintf(nbp,"mpirun -np %d %sSALOME_MPIContainer ",nbproc,path.c_str());
- rsh += nbp;
- rsh += theMPIContainer +" -" ;
- }
- std::string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
- ifstream omniORBfile( omniORBcfg.c_str() ) ;
- char ORBInitRef[12] ;
- char nameservice[132] ;
- omniORBfile >> ORBInitRef ;
- rsh += ORBInitRef ;
- rsh += " " ;
- omniORBfile >> nameservice ;
- omniORBfile.close() ;
- char * bsn = strchr( nameservice , '\n' ) ;
- if ( bsn ) {
- bsn[ 0 ] = '\0' ;
- }
- rsh += nameservice ;
- if ( pyCont ) {
- rsh += " > /tmp/MPIFactoryServerPy_" ;
- }
- else {
- rsh += " > /tmp/MPIFactoryServer_" ;
- }
- sprintf(nbp,"%d_",nbproc);
- rsh += nbp;
- rsh += theComputer ;
- rsh += ".log 2>&1 &" ;
- SCRUTE( rsh );
- int status = system( rsh.c_str() ) ;
- if (status == -1) {
- INFOS("SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer rsh failed (system command status -1)") ;
- }
- else if (status == 217) {
- INFOS("SALOME_MPILifeCycleCORBA::FindOrStartContainer rsh failed (system command status 217)") ;
- }
- else {
- int count = 21 ;
- while ( CORBA::is_nil( aMPIFactoryServer ) && count ) {
- sleep( 1 ) ;
- count-- ;
- if ( count != 10 )
- MESSAGE( count << ". Waiting for FactoryServer on " << theComputer)
- aMPIFactoryServer = Engines::MPIContainer::_narrow(FindContainer( MPIFactoryServer.c_str()));
- }
- if ( CORBA::is_nil( aMPIFactoryServer ) ) {
- INFOS("SALOME_MPILifeCycleCORBA::FindOrStartMPIContainer rsh failed") ;
- }
- else if ( strcmp( theComputer.c_str() , GetHostname().c_str() ) ) {
- _MPIFactoryServer = aMPIFactoryServer ;
- }
- }
- }
- // On a trouve le container generique distant: on se sert de lui
- // pour lancer un nouveau container MPI
- // a revoir...
- if ( !CORBA::is_nil( aMPIFactoryServer ) ) {
- if ( strcmp( theMPIContainer.c_str() , "MPIFactoryServer" ) ||
- strcmp( theMPIContainer.c_str() , "MPIFactoryServerPy" ) ) {
- MESSAGE("MPI Container not found ! trying to start " << aComputerContainer);
- Engines::MPIContainer_var myMPIContainer = aMPIFactoryServer->start_MPIimpl( theMPIContainer.c_str(), nbproc ) ;
- if ( !CORBA::is_nil( myMPIContainer ) ) {
- MESSAGE("MPIContainer " << aComputerContainer << " started");
- return myMPIContainer ;
- }
- else {
- MESSAGE("MPIContainer " << aComputerContainer << " NOT started");
- }
- }
- else {
- MESSAGE("MPIContainer " << aComputerContainer << " started");
- return aMPIFactoryServer ;
- }
- }
- }
- return Engines::MPIContainer::_nil();
-}
-
-// Engines::Component_var SALOME_MPILifeCycleCORBA::FindOrLoad_MPIComponent
-// (const char *MPIcontainerName,
-// const char *MPIcomponentName,
-// const char *implementation,
-// const int nbproc)
-// {
-// BEGIN_OF("FindOrLoad_MPIComponent(1)");
-// ASSERT(_NS != NULL);
-// string theComputer ;
-// string theMPIContainer ;
-// string theComputerContainer = ContainerName( MPIcontainerName ,
-// &theComputer ,
-// &theMPIContainer ) ;
-// Engines::MPIContainer_var cont = FindOrStartMPIContainer( theComputerContainer ,
-// theComputer ,
-// theMPIContainer,
-// nbproc) ;
-// // ASSERT(!CORBA::is_nil(cont));
-
-// string path( theComputerContainer );
-// path = path + "/";
-// path = path + MPIcomponentName;
-// SCRUTE(path);
-// try
-// {
-// CORBA::Object_var obj = _NS->Resolve(path.c_str());
-// if (CORBA::is_nil(obj))
-// {
-// MESSAGE("MPIComponent not found ! trying to load " << path);
-// Engines::Component_var compo
-// = cont->load_impl(MPIcomponentName, implementation);
-// // ASSERT(!CORBA::is_nil(compo));
-// MESSAGE("MPIComponent launched !" << path);
-// return compo;
-// }
-// else
-// {
-// MESSAGE("MPIComponent found !" << path);
-// Engines::Component_var compo = Engines::Component::_narrow(obj);
-// // ASSERT(!CORBA::is_nil(compo));
-// try
-// {
-// compo->ping();
-// }
-// catch (CORBA::COMM_FAILURE&)
-// {
-// INFOS("Caught CORBA::SystemException CommFailure. Engine "
-// << path << "does not respond" );
-// }
-// return compo;
-// }
-// }
-// catch (ServiceUnreachable&)
-// {
-// INFOS("Caught exception: Naming Service Unreachable");
-// }
-// catch (...)
-// {
-// INFOS("Caught unknown exception.");
-// }
-// return Engines::Component::_nil();
-// }
-
-Engines::Component_var SALOME_MPILifeCycleCORBA::FindOrLoad_MPIComponent
- (const char *MPIcontainerName,
- const char *MPIcomponentName,
- const int nbproc)
-{
-
- char nbp[1024];
-
- sprintf(nbp,"_%d",nbproc);
-// BEGIN_OF("FindOrLoad_Component(2)");
- ASSERT(_NS != NULL);
- string theComputer ;
- string theMPIContainerRoot ;
- string theMPIContainer;
- string theComputerContainer = ContainerName( MPIcontainerName ,
- &theComputer ,
- &theMPIContainerRoot ) ;
- theMPIContainer = theMPIContainerRoot + nbp;
- Engines::MPIContainer_var cont = FindOrStartMPIContainer( theComputer ,
- theMPIContainerRoot,
- nbproc ) ;
-
- if ( CORBA::is_nil( cont ) ) {
- MESSAGE("MPIContainer not found ! " << theComputerContainer );
- return Engines::Component::_nil();
- }
-
-// char * machine = cont->machineName() ;
- const char * machine = theComputer.c_str() ;
-
- string path( theComputerContainer );
- path += nbp;
- path += "/";
- path += MPIcomponentName;
- SCRUTE(path);
-
- try {
- CORBA::Object_var obj = _NS->Resolve(path.c_str());
- if ( CORBA::is_nil( obj ) ) {
- MESSAGE("MPIComponent not found ! trying to load " << path);
- CORBA::Object_var obj2 = _NS->Resolve("/Kernel/ModulCatalog");
- SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj2);
-
- SALOME_ModuleCatalog::Acomponent_ptr compoInfo =
- Catalog->GetComponent(MPIcomponentName);
- if (CORBA::is_nil (compoInfo))
- {
- INFOS("Catalog Error : Component not found in the catalog")
- return Engines::Component::_nil();
-// exit (-1);
- }
-
- string path;
- try
- {
- path = compoInfo->GetPathPrefix( machine ) ;
- path += "/" ;
- }
- catch (SALOME_ModuleCatalog::NotFound&)
- {
- MESSAGE("GetPathPrefix(" << machine << ") not found!"
- << "trying localhost");
- try {
- path = compoInfo->GetPathPrefix("localhost") ;
- path += "/" ;
- }
- catch (SALOME_ModuleCatalog::NotFound&) {
- MESSAGE("GetPathPrefix(localhost) not found!") ;
- path = "" ;
- }
- }
-
- SCRUTE(path);
- string implementation(path);
- implementation += "lib";
- implementation += MPIcomponentName;
- implementation += "Engine.so";
-
- Engines::Component_var compo
- = cont->load_impl(MPIcomponentName, implementation.c_str());
-
-// ASSERT(!CORBA::is_nil(compo));
-// MESSAGE("Component launched !" << path);
- return compo;
- }
- else
- {
- MESSAGE("MPIComponent found !" << path);
- Engines::Component_var compo = Engines::Component::_narrow(obj);
- // ASSERT(!CORBA::is_nil(compo));
- try
- {
- string instanceName = compo->instanceName();
- }
- catch (CORBA::COMM_FAILURE&)
- {
- INFOS("Caught CORBA::SystemException CommFailure. Engine "
- << path << "does not respond" );
- }
- return compo;
- }
- }
- catch (ServiceUnreachable&)
- {
- INFOS("Caught exception: Naming Service Unreachable");
- }
- catch (...)
- {
- INFOS("Caught unknown exception.");
- }
- return Engines::Component::_nil();
-}
+++ /dev/null
-//=============================================================================
-// File : SALOME_MPILifeCycleCORBA.hxx
-// Created : mar jui 03 14:55:45 CEST 2003
-// Author : Bernard SECHER, CEA
-// Project : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#ifndef _SALOME_MPILIFECYCLECORBA_HXX_
-#define _SALOME_MPILIFECYCLECORBA_HXX_
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string>
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
-#include "SALOME_LifeCycleCORBA.hxx"
-
-class SALOME_MPILifeCycleCORBA : public SALOME_LifeCycleCORBA
-{
-public:
- SALOME_MPILifeCycleCORBA();
- SALOME_MPILifeCycleCORBA(SALOME_NamingService *ns);
- virtual ~SALOME_MPILifeCycleCORBA();
-
-// Engines::Component_var FindOrLoad_MPIComponent(const char *MPIcontainerName,
-// const char *MPIcomponentName,
-// const char *implementationPath,
-// const int nbproc);
- Engines::Component_var FindOrLoad_MPIComponent(const char *MPIcontainerName,
- const char *MPIcomponentName,
- const int nbproc);
-protected:
- Engines::MPIContainer_var _MPIFactoryServer ;
-
-private:
- Engines::MPIContainer_var FindOrStartMPIContainer(const std::string theComputer ,
- const std::string theMPIContainerRoot,
- const int nbproc) ;
-
-} ;
-
-#endif
+++ /dev/null
-// using namespace std;
-//=============================================================================
-// File : TestMPILifeCycleCORBA.cxx
-// Created : mer jui 4 13:11:27 CEST 2003
-// Author : Bernard SECHER, 2003
-// Project : SALOME
-// Copyright : CEA 2003
-// $Header$
-//=============================================================================
-
-#include "utilities.h"
-#include <iostream>
-#include <unistd.h>
-#include <string>
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
-#include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent)
-
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-#include "SALOME_NamingService.hxx"
-#include "SALOME_MPILifeCycleCORBA.hxx"
-#include "OpUtil.hxx"
-using namespace std;
-
-int main (int argc, char * argv[])
-{
-
- try{
- // Initializing omniORB
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
-
- // Obtain a reference to the root POA
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
-
- // Use Name Service to find container
- SALOME_NamingService NS(orb);
-
- SALOME_MPILifeCycleCORBA LCC(&NS);
-
- Engines::Component_var comp = LCC.FindOrLoad_MPIComponent("MPIFactoryServer","TestMPIComponent",2);
-
- Engines::TestMPIComponent_var m1 = Engines::TestMPIComponent::_narrow(comp);
- if(CORBA::is_nil(m1)){
- INFOS("echec recuperation poignee composant");
- }
- else{
-
- INFOS("Lancement de coucou");
- m1->Coucou(1L);
- }
-
- orb->destroy();
- }
- catch(CORBA::COMM_FAILURE& ex) {
- INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
- }
- catch(CORBA::SystemException&) {
- INFOS("Caught a CORBA::SystemException.");
- }
- catch(CORBA::Exception&) {
- INFOS("Caught CORBA::Exception.");
- }
- catch(...) {
- INFOS("Caught unknown exception.");
- }
-
- return 0;
-}
+++ /dev/null
- THE Q PUBLIC LICENSE
- version 1.0
-
- Copyright (C) 1999-2000 Trolltech AS, Norway.
- Everyone is permitted to copy and
- distribute this license document.
-
-The intent of this license is to establish freedom to share and change the
-software regulated by this license under the open source model.
-
-This license applies to any software containing a notice placed by the
-copyright holder saying that it may be distributed under the terms of
-the Q Public License version 1.0. Such software is herein referred to as
-the Software. This license covers modification and distribution of the
-Software, use of third-party application programs based on the Software,
-and development of free software which uses the Software.
-
- Granted Rights
-
-1. You are granted the non-exclusive rights set forth in this license
- provided you agree to and comply with any and all conditions in this
- license. Whole or partial distribution of the Software, or software
- items that link with the Software, in any form signifies acceptance of
- this license.
-
-2. You may copy and distribute the Software in unmodified form provided
- that the entire package, including - but not restricted to - copyright,
- trademark notices and disclaimers, as released by the initial developer
- of the Software, is distributed.
-
-3. You may make modifications to the Software and distribute your
- modifications, in a form that is separate from the Software, such as
- patches. The following restrictions apply to modifications:
-
- a. Modifications must not alter or remove any copyright notices in
- the Software.
-
- b. When modifications to the Software are released under this
- license, a non-exclusive royalty-free right is granted to the
- initial developer of the Software to distribute your modification
- in future versions of the Software provided such versions remain
- available under these terms in addition to any other license(s) of
- the initial developer.
-
-4. You may distribute machine-executable forms of the Software or
- machine-executable forms of modified versions of the Software, provided
- that you meet these restrictions:
-
- a. You must include this license document in the distribution.
-
- b. You must ensure that all recipients of the machine-executable forms
- are also able to receive the complete machine-readable source code
- to the distributed Software, including all modifications, without
- any charge beyond the costs of data transfer, and place prominent
- notices in the distribution explaining this.
-
- c. You must ensure that all modifications included in the
- machine-executable forms are available under the terms of this
- license.
-
-5. You may use the original or modified versions of the Software to
- compile, link and run application programs legally developed by you
- or by others.
-
-6. You may develop application programs, reusable components and other
- software items that link with the original or modified versions of the
- Software. These items, when distributed, are subject to the following
- requirements:
-
- a. You must ensure that all recipients of machine-executable forms of
- these items are also able to receive and use the complete
- machine-readable source code to the items without any charge
- beyond the costs of data transfer.
-
- b. You must explicitly license all recipients of your items to use
- and re-distribute original and modified versions of the items in
- both machine-executable and source code forms. The recipients must
- be able to do so without any charges whatsoever, and they must be
- able to re-distribute to anyone they choose.
-
-
- c. If the items are not available to the general public, and the
- initial developer of the Software requests a copy of the items,
- then you must supply one.
-
- Limitations of Liability
-
-In no event shall the initial developers or copyright holders be liable
-for any damages whatsoever, including - but not restricted to - lost
-revenue or profits or other direct, indirect, special, incidental or
-consequential damages, even if they have been advised of the possibility
-of such damages, except to the extent invariable law, if any, provides
-otherwise.
-
- No Warranty
-
-The Software and this license document are provided AS IS with NO WARRANTY
-OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE.
- Choice of Law
-
-This license is governed by the Laws of Norway. Disputes shall be settled
-by Oslo City Court.
+++ /dev/null
-# SALOME MSG2QM : duplication of Qt tool
-#
-# 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 : Makefile.in
-# Module : SALOME
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-@COMMENCE@
-
-# Executables targets
-BIN = msg2qm
-BIN_SRC =
-
-CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS)
-
-LDFLAGSFORBIN=$(LDFLAGS)
-
-@CONCLUDE@
+++ /dev/null
-This package includes the msg2qm tool for resources compiling.
-It is a part of Qt 3.0.5 toolkit.
-The files in this package are distributed under conditions of the Q Public License.
\ No newline at end of file
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : MSG2QM
-// File : msg2qm.cxx
-// Description : This is a duplication of Qt tool for resources compiling
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** This is a utility program for converting findtr msgfiles to
-** qtranslator message files
-**
-**
-** Copyright (C) 1998 by Trolltech AS. All rights reserved.
-**
-*****************************************************************************/
-
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qtextcodec.h>
-#include <qtranslator.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-
-static QString* defaultScope = 0;
-
-bool hasHandle( const QString& line, const QString& handle)
-{
- return line.left(handle.length()) == handle;
-}
-
-
-QString extractContents( const QString& line )
-{
- QString contents;
- if ( line.contains('\"') < 2)
- return contents;
- int pos = 0;
- while ( pos < int(line.length()) && line[pos] != '\"' )
- pos++;
- pos++;
- while ( pos < int(line.length()) && line[pos] != '\"' ) {
- // 0xa5: the yen sign is the Japanese backslash
- if ( line[pos] == '\\' || line[pos] == QChar(0xa5) ) {
- pos++;
- switch (char(line[pos]) ) {
- case 'n':
- contents += '\n';
- break;
- case 't':
- contents += '\t';
- break;
- case 'r':
- contents += '\r';
- break;
- case 'a':
- contents += '\a';
- break;
- case 'f':
- contents += '\f';
- break;
- case 'v':
- contents += '\v';
- break;
- case 'b':
- contents += '\b';
- break;
- default:
- contents += char(line[pos]);
- break;
- }
- }
- else
- contents += line[pos];
- pos++;
- }
- return contents;
-}
-
-
-void addTranslation( QTranslator* translator, const QString& msgid, const QString& msgstr)
-{
- if (!msgid.isNull() && !msgstr.isNull() ) {
- QString scope = "";
- QString id = msgid;
- int coloncolon = msgid.find("::");
- if (coloncolon != -1) {
- scope = msgid.left( coloncolon );
- id = msgid.right( msgid.length() - scope.length() - 2 );
- }
- else if (defaultScope)
- scope = *defaultScope;
-
- if (translator->contains( scope.ascii(), id.ascii() ) ) {
- qWarning("Error: \"%s\" already in use", msgid.ascii() );
- }
- else {
- translator->insert( scope.latin1(), id.latin1(), msgstr );
- }
- }
-}
-
-
-
-void translate( const QString& filename, const QString& qmfile )
-{
- QFile f(filename);
- if ( !f.open( IO_ReadOnly) )
- return;
- QTranslator* translator = new QTranslator(0);
- QTextCodec *codec = 0;
- for (int pass = 0; pass < 2; pass++) {
- f.at(0);
- QTextStream t( &f );
- QString line;
- QString msgid;
- QString msgstr;
- if ( codec != 0 ) {
- t.setCodec( codec );
- }
- while ( !t.atEnd() || !line.isEmpty() ) {
- if (line.isEmpty()) {
- t.skipWhiteSpace();
- line = t.readLine();
- }
- if ( hasHandle( line, "msgid") ) {
- msgstr = QString::null;
- msgid = extractContents( line );
- if (!t.atEnd()) {
- t.skipWhiteSpace();
- line = t.readLine();
- }
- else
- line = QString::null;
- while ( hasHandle( line, "\"") ) {
- msgid += extractContents( line );
- if (!t.atEnd()) {
- t.skipWhiteSpace();
- line = t.readLine();
- }
- else
- line = QString::null;
- }
- }
- else if ( hasHandle( line, "msgstr") ) {
- msgstr = extractContents( line );
- if (!t.atEnd()) {
- t.skipWhiteSpace();
- line = t.readLine();
- }
- else
- line = QString::null;
- while ( hasHandle( line, "\"") ) {
- msgstr += extractContents( line );
- if (!t.atEnd()) {
- t.skipWhiteSpace();
- line = t.readLine();
- }
- else
- line = QString::null;
- }
- if ( pass == 1 )
- addTranslation( translator, msgid, msgstr);
-
- if ( pass == 0 && msgid.isEmpty() ) {
- // Check for the encoding.
- int cpos = msgstr.find( "charset=" );
- if ( cpos >= 0 ) {
- cpos = cpos + 8; //skip "charset="
- int i = cpos;
- int len = msgstr.length();
- while ( i < len && !msgstr[i].isSpace() )
- i++;
- QString charset = msgstr.mid( cpos, i-cpos );
- codec = QTextCodec::codecForName( charset.ascii() );
- if ( codec ) {
- debug( "PO file character set: %s. Codec: %s",
- charset.ascii(), codec->name() );
- } else {
- debug( "No codec for %s", charset.ascii() );
- }
- }
- break;
- }
- }
- else
- line = QString::null;
- }
- }
- f.close();
- translator->save( qmfile );
-}
-
-
-// workaround for BCC problem, qtranslator.h includes qwindowdefs.h via qobject.h, see NEEDS_QMAIN
-#if defined(main)
-#undef main
-#endif
-
-int main( int argc, char* argv[] )
-{
-
- int infile = 1;
- if (argc > 1) {
- if ( QString("-scope") == argv[1] ) {
- defaultScope = new QString(argv[2]);
- infile += 2;
- }
- }
-
- if ( argc <= infile ) {
- printf("usage: %s [-scope default] infile [outfile]\n", argv[0]);
- exit(1);
- }
-
- translate(argv[infile], argc > infile+1 ? argv[infile+1] : "tr.qm");
- return 0;
-}
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : Handle_SALOME_AISObject.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_AISObject_HeaderFile
-#define _Handle_SALOME_AISObject_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_AIS_InteractiveObject_HeaderFile
-#include <Handle_AIS_InteractiveObject.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(AIS_InteractiveObject);
-class SALOME_AISObject;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISObject);
-
-class Handle(SALOME_AISObject) : public Handle(AIS_InteractiveObject) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_AISObject)():Handle(AIS_InteractiveObject)() {}
- Handle(SALOME_AISObject)(const Handle(SALOME_AISObject)& aHandle) : Handle(AIS_InteractiveObject)(aHandle)
- {
- }
-
- Handle(SALOME_AISObject)(const SALOME_AISObject* anItem) : Handle(AIS_InteractiveObject)((AIS_InteractiveObject *)anItem)
- {
- }
-
- Handle(SALOME_AISObject)& operator=(const Handle(SALOME_AISObject)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_AISObject)& operator=(const SALOME_AISObject* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_AISObject* operator->()
- {
- return (SALOME_AISObject *)ControlAccess();
- }
-
- SALOME_AISObject* operator->() const
- {
- return (SALOME_AISObject *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_AISObject)();
-
- Standard_EXPORT static const Handle(SALOME_AISObject) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : Handle_SALOME_AISShape.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_AISShape_HeaderFile
-#define _Handle_SALOME_AISShape_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_AIS_Shape_HeaderFile
-#include <Handle_AIS_Shape.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(AIS_Shape);
-class SALOME_AISShape;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISShape);
-
-class Handle(SALOME_AISShape) : public Handle(AIS_Shape) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_AISShape)():Handle(AIS_Shape)() {}
- Handle(SALOME_AISShape)(const Handle(SALOME_AISShape)& aHandle) : Handle(AIS_Shape)(aHandle)
- {
- }
-
- Handle(SALOME_AISShape)(const SALOME_AISShape* anItem) : Handle(AIS_Shape)((AIS_Shape *)anItem)
- {
- }
-
- Handle(SALOME_AISShape)& operator=(const Handle(SALOME_AISShape)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_AISShape)& operator=(const SALOME_AISShape* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_AISShape* operator->()
- {
- return (SALOME_AISShape *)ControlAccess();
- }
-
- SALOME_AISShape* operator->() const
- {
- return (SALOME_AISShape *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_AISShape)();
-
- Standard_EXPORT static const Handle(SALOME_AISShape) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : Handle_SALOME_InteractiveObject.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#define _Handle_SALOME_InteractiveObject_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_MMgt_TShared_HeaderFile
-#include <Handle_MMgt_TShared.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(MMgt_TShared);
-class SALOME_InteractiveObject;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_InteractiveObject);
-
-class Handle(SALOME_InteractiveObject) : public Handle(MMgt_TShared) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOME_InteractiveObject)():Handle(MMgt_TShared)() {}
- Handle(SALOME_InteractiveObject)(const Handle(SALOME_InteractiveObject)& aHandle) : Handle(MMgt_TShared)(aHandle)
- {
- }
-
- Handle(SALOME_InteractiveObject)(const SALOME_InteractiveObject* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
- {
- }
-
- Handle(SALOME_InteractiveObject)& operator=(const Handle(SALOME_InteractiveObject)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_InteractiveObject)& operator=(const SALOME_InteractiveObject* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_InteractiveObject* operator->()
- {
- return (SALOME_InteractiveObject *)ControlAccess();
- }
-
- SALOME_InteractiveObject* operator->() const
- {
- return (SALOME_InteractiveObject *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_InteractiveObject)();
-
- Standard_EXPORT static const Handle(SALOME_InteractiveObject) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = SALOME_InteractiveObject.hxx \
- Handle_SALOME_InteractiveObject.hxx \
- SALOME_Actor.h \
- SALOME_AISShape.hxx \
- Handle_SALOME_AISShape.hxx \
- SALOME_AISObject.hxx \
- Handle_SALOME_AISObject.hxx \
-
-# Libraries targets
-
-LIB = libSalomeObject.la
-LIB_SRC = SALOME_InteractiveObject.cxx \
- SALOME_Actor.cxx \
- SALOME_AISShape.cxx\
- SALOME_AISObject.cxx\
-
-LIB_CLIENT_IDL =
-
-# Executables targets
-BIN =
-BIN_SRC =
-
-CPPFLAGS+=$(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
-LDFLAGS+= $(PYTHON_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(CAS_LDPATH) -lTKV3d -lSalomeVTKFilter
-
-
-@CONCLUDE@
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISObject.hxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOME_AISObject.ixx"
-using namespace std;
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISObject.hxx
-// Module : SALOME
-
-#ifndef _SALOME_AISObject_HeaderFile
-#define _SALOME_AISObject_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_AISObject_HeaderFile
-#include <Handle_SALOME_AISObject.hxx>
-#endif
-
-#ifndef _AIS_InteractiveObject_HeaderFile
-#include <AIS_InteractiveObject.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-class SALOME_InteractiveObject;
-
-
-class SALOME_AISObject : public AIS_InteractiveObject {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT virtual Handle_SALOME_InteractiveObject getIO() = 0;
-Standard_EXPORT virtual Standard_Boolean hasIO() = 0;
-Standard_EXPORT virtual Standard_CString getName() = 0;
-Standard_EXPORT virtual void setName(const Standard_CString aName) = 0;
-Standard_EXPORT ~SALOME_AISObject();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_AISObject_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISObject.ixx
-// Module : SALOME
-
-#include "SALOME_AISObject.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_AISObject::~SALOME_AISObject() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_AISObject_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_InteractiveObject);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_InteractiveObject);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(SelectMgr_SelectableObject);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SelectMgr_SelectableObject);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(PrsMgr_PresentableObject);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(PrsMgr_PresentableObject);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient);
- if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISObject",
- sizeof(SALOME_AISObject),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_AISObject) Handle(SALOME_AISObject)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_AISObject) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
- _anOtherObject = Handle(SALOME_AISObject)((Handle(SALOME_AISObject)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_AISObject::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_AISObject) ;
-}
-Standard_Boolean SALOME_AISObject::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_AISObject) == AType || AIS_InteractiveObject::IsKind(AType));
-}
-Handle_SALOME_AISObject::~Handle_SALOME_AISObject() {}
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISObject.jxx
-// Module : SALOME
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _SALOME_AISObject_HeaderFile
-#include "SALOME_AISObject.hxx"
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISShape.hxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOME_AISShape.ixx"
-using namespace std;
-
-SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape): AIS_Shape(shape) {
-}
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISShape.hxx
-// Module : SALOME
-
-#ifndef _SALOME_AISShape_HeaderFile
-#define _SALOME_AISShape_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_AISShape_HeaderFile
-#include <Handle_SALOME_AISShape.hxx>
-#endif
-
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _AIS_Shape_HeaderFile
-#include <AIS_Shape.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class SALOME_InteractiveObject;
-class TopoDS_Shape;
-class TColStd_IndexedMapOfInteger;
-
-
-class SALOME_AISShape : public AIS_Shape {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_AISShape(const TopoDS_Shape& shape);
-Standard_EXPORT virtual Handle_SALOME_InteractiveObject getIO() = 0;
-Standard_EXPORT virtual Standard_Boolean hasIO() = 0;
-Standard_EXPORT virtual Standard_CString getName() = 0;
-Standard_EXPORT virtual void setName(Standard_CString aName) = 0;
-Standard_EXPORT virtual void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0;
-Standard_EXPORT ~SALOME_AISShape();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_AISShape_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISShape.ixx
-// Module : SALOME
-
-#include "SALOME_AISShape.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_AISShape::~SALOME_AISShape() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_AISShape_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_Shape);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_Shape);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_InteractiveObject);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_InteractiveObject);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(SelectMgr_SelectableObject);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SelectMgr_SelectableObject);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(PrsMgr_PresentableObject);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(PrsMgr_PresentableObject);
- static Handle_Standard_Type aType5 = STANDARD_TYPE(MMgt_TShared);
- if ( aType5.IsNull()) aType5 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType6 = STANDARD_TYPE(Standard_Transient);
- if ( aType6.IsNull()) aType6 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISShape",
- sizeof(SALOME_AISShape),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_AISShape) Handle(SALOME_AISShape)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_AISShape) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
- _anOtherObject = Handle(SALOME_AISShape)((Handle(SALOME_AISShape)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_AISShape::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_AISShape) ;
-}
-Standard_Boolean SALOME_AISShape::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_AISShape) == AType || AIS_Shape::IsKind(AType));
-}
-Handle_SALOME_AISShape::~Handle_SALOME_AISShape() {}
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_AISShape.jxx
-// Module : SALOME
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _SALOME_AISShape_HeaderFile
-#include "SALOME_AISShape.hxx"
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_Actor.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class SALOME_Actor SALOME_Actor.h
- \brief Abstract class of SALOME Objects in VTK.
-*/
-
-#include "SALOME_Actor.h"
-#include "SALOME_Transform.h"
-#include "SALOME_GeometryFilter.h"
-#include "SALOME_TransformFilter.h"
-#include "SALOME_PassThroughFilter.h"
-
-// SALOME Includes
-#include "utilities.h"
-
-// VTK Includes
-#include <vtkCell.h>
-#include <vtkRenderer.h>
-#include <vtkPolyData.h>
-#include <vtkObjectFactory.h>
-#include <vtkDataSetMapper.h>
-#include <vtkPolyDataMapper.h>
-
-using namespace std;
-
-int SALOME_POINT_SIZE = 3;
-
-
-vtkStandardNewMacro(SALOME_Actor);
-
-
-SALOME_Actor::SALOME_Actor(){
- myIsHighlighted = myIsPreselected = false;
-
- myRepresentation = VTK_WIREFRAME;
- myDisplayMode = myRepresentation - 1;
-
- myProperty = vtkProperty::New();
- PreviewProperty = NULL;
-
- myIsInfinite = false;
-
- myIsResolveCoincidentTopology = true;
-
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
- myStoreMapping = false;
- myGeomFilter = SALOME_GeometryFilter::New();
-
- myTransformFilter = SALOME_TransformFilter::New();
-
- for(int i = 0; i < 6; i++)
- myPassFilter.push_back(SALOME_PassThroughFilter::New());
-}
-
-
-SALOME_Actor::~SALOME_Actor(){
- SetPreviewProperty(NULL);
-
- myGeomFilter->UnRegisterAllOutputs();
- myGeomFilter->Delete();
-
- myTransformFilter->UnRegisterAllOutputs();
- myTransformFilter->Delete();
-
- for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
- if(myPassFilter[i]){
- myPassFilter[i]->UnRegisterAllOutputs();
- myPassFilter[i]->Delete();
- }
- }
-
- myProperty->Delete();
-}
-
-
-void SALOME_Actor::AddToRender(vtkRenderer* theRenderer){
- theRenderer->AddActor(this);
-}
-
-void SALOME_Actor::RemoveFromRender(vtkRenderer* theRenderer){
- theRenderer->RemoveActor(this);
-}
-
-
-void SALOME_Actor::SetTransform(SALOME_Transform* theTransform){
- myTransformFilter->SetTransform(theTransform);
-}
-
-
-void SALOME_Actor::SetMapper(vtkMapper* theMapper){
- InitPipeLine(theMapper);
-}
-
-void SALOME_Actor::InitPipeLine(vtkMapper* theMapper){
- if(theMapper){
- int anId = 0;
- myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
- myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
-
- anId++; // 1
- myGeomFilter->SetStoreMapping( myStoreMapping );
- myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
-
- anId++; // 2
- myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
- myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
-
- anId++; // 3
- myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
-
- anId++; // 4
- myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
- myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
-
- anId++; // 5
- if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
- aMapper->SetInput(myPassFilter[anId]->GetOutput());
- }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
- aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
- }
- }
- vtkLODActor::SetMapper(theMapper);
-}
-
-
-void SALOME_Actor::Render(vtkRenderer *ren, vtkMapper* m){
- if(myIsResolveCoincidentTopology){
- int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
- float aFactor, aUnit;
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
-
- vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
- vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
- vtkLODActor::Render(ren,m);
-
- vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
- vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
- }else{
- vtkLODActor::Render(ren,m);
- }
-}
-
-
-void SALOME_Actor::SetResolveCoincidentTopology(bool theIsResolve) {
- myIsResolveCoincidentTopology = theIsResolve;
-}
-
-void SALOME_Actor::SetPolygonOffsetParameters(float factor, float units){
- myPolygonOffsetFactor = factor;
- myPolygonOffsetUnits = units;
-}
-
-void SALOME_Actor::GetPolygonOffsetParameters(float& factor, float& units){
- factor = myPolygonOffsetFactor;
- units = myPolygonOffsetUnits;
-}
-
-
-vtkDataSet* SALOME_Actor::GetInput(){
- return myPassFilter.front()->GetOutput();
-}
-
-
-unsigned long int SALOME_Actor::GetMTime(){
- unsigned long mTime = this->Superclass::GetMTime();
- unsigned long time = myTransformFilter->GetMTime();
- mTime = ( time > mTime ? time : mTime );
- if(vtkDataSet *aDataSet = myPassFilter[0]->GetInput()){
- time = aDataSet->GetMTime();
- mTime = ( time > mTime ? time : mTime );
- }
- return mTime;
-}
-
-
-void SALOME_Actor::SetRepresentation(int theMode) {
- switch(myRepresentation){
- case VTK_POINTS :
- case VTK_SURFACE :
- myProperty->DeepCopy(GetProperty());
- }
- switch(theMode){
- case VTK_POINTS :
- case VTK_SURFACE :
- GetProperty()->DeepCopy(myProperty);
- break;
- default:
- GetProperty()->SetAmbient(1.0);
- GetProperty()->SetDiffuse(0.0);
- GetProperty()->SetSpecular(0.0);
- }
- switch(theMode){
- case 3 :
- myGeomFilter->SetInside(true);
- GetProperty()->SetRepresentation(1);
- break;
- case VTK_POINTS :
- GetProperty()->SetPointSize(SALOME_POINT_SIZE);
- default :
- GetProperty()->SetRepresentation(theMode);
- myGeomFilter->SetInside(false);
- }
- myRepresentation = theMode;
-}
-
-int SALOME_Actor::GetRepresentation(){
- return myRepresentation;
-}
-
-
-vtkCell* SALOME_Actor::GetElemCell(int theObjID){
- return GetInput()->GetCell(theObjID);
-}
-
-
-float* SALOME_Actor::GetNodeCoord(int theObjID){
- return GetInput()->GetPoint(theObjID);
-}
-
-
-//=================================================================================
-// function : GetObjDimension
-// purpose : Return object dimension.
-// Virtual method shoulb be redifined by derived classes
-//=================================================================================
-int SALOME_Actor::GetObjDimension( const int theObjId )
-{
- if ( vtkCell* aCell = GetElemCell(theObjId) )
- return aCell->GetCellDimension();
- return 0;
-}
-
-
-bool SALOME_Actor::IsInfinitive(){
- return myIsInfinite;
-}
-
-
-void SALOME_Actor::SetOpacity(float theOpacity){
- myOpacity = theOpacity;
- GetProperty()->SetOpacity(theOpacity);
-}
-
-float SALOME_Actor::GetOpacity(){
- return myOpacity;
-}
-
-
-void SALOME_Actor::SetColor(float r,float g,float b){
- GetProperty()->SetColor(r,g,b);
-}
-
-void SALOME_Actor::GetColor(float& r,float& g,float& b){
- float aColor[3];
- GetProperty()->GetColor(aColor);
- r = aColor[0];
- g = aColor[1];
- b = aColor[2];
-}
-
-
-int SALOME_Actor::getDisplayMode(){
- return myDisplayMode;
-}
-
-void SALOME_Actor::setDisplayMode(int theMode){
- SetRepresentation(theMode+1);
- myDisplayMode = GetRepresentation() - 1;
-}
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_Actor.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOME_ACTOR_H
-#define SALOME_ACTOR_H
-
-#include <vector>
-
-#include <vtkLODActor.h>
-#include <vtkProperty.h>
-
-class vtkCell;
-class vtkDataSet;
-class vtkPolyData;
-class vtkCamera;
-
-#include "SALOME_InteractiveObject.hxx"
-
-class SALOME_Transform;
-class SALOME_GeometryFilter;
-class SALOME_TransformFilter;
-class SALOME_PassThroughFilter;
-
-extern int SALOME_POINT_SIZE;
-
-class SALOME_Actor : public vtkLODActor{
- public:
- static SALOME_Actor* New();
-
- vtkTypeMacro(SALOME_Actor,vtkLODActor);
-
- virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
- virtual const Handle(SALOME_InteractiveObject)& getIO() { return myIO; }
- virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
-
- virtual const char* getName() { return myName.c_str(); }
- virtual void setName(const char* theName){
- if(hasIO()) myIO->setName(theName);
- myName = theName;
- }
-
- // To generate highlight automaticaly
- virtual bool hasHighlight() { return false; }
- virtual void highlight(bool theHighlight) { myIsHighlighted = theHighlight; }
- virtual bool isHighlighted() { return myIsHighlighted; }
-
- virtual void SetOpacity(float theOpacity);
- virtual float GetOpacity();
-
- virtual void SetColor(float r,float g,float b);
- virtual void GetColor(float& r,float& g,float& b);
- void SetColor(const float theRGB[3]){
- SetColor(theRGB[0],theRGB[1],theRGB[2]);
- }
-
- vtkSetObjectMacro(PreviewProperty,vtkProperty);
-
- virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
-
-
- // Used to obtain all dependent actors
- virtual void GetChildActors(vtkActorCollection*) {};
-
- virtual void AddToRender(vtkRenderer* theRenderer);
- virtual void RemoveFromRender(vtkRenderer* theRenderer);
-
-
- // For selection mapping purpose
- virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
- virtual float* GetNodeCoord(int theObjID);
-
- virtual int GetElemObjId(int theVtkID) { return theVtkID;}
- virtual vtkCell* GetElemCell(int theObjID);
-
- virtual int GetObjDimension( const int theObjId );
-
- virtual void SetMapper(vtkMapper* theMapper);
- virtual vtkDataSet* GetInput();
-
-
- virtual void SetTransform(SALOME_Transform* theTransform);
- virtual unsigned long int GetMTime();
-
- virtual void SetRepresentation(int theMode);
- virtual int GetRepresentation();
-
- virtual int getDisplayMode();
- virtual void setDisplayMode(int theMode);
-
- // Infinitive means actor without size (point for example),
- // which is not taken into account in calculation of boundaries of the scene
- void SetInfinitive(bool theIsInfinite) { myIsInfinite = theIsInfinite; }
- virtual bool IsInfinitive();
-
- void SetResolveCoincidentTopology(bool theIsResolve);
- void SetPolygonOffsetParameters(float factor, float units);
- void GetPolygonOffsetParameters(float& factor, float& units);
-
- virtual void Render(vtkRenderer *, vtkMapper *);
-
- virtual float GetShrinkFactor() { return 1.0;}
-
- virtual bool IsShrunkable() { return false;}
- virtual bool IsShrunk() { return false;}
-
- virtual void SetShrink() {}
- virtual void UnShrink() {}
-
- virtual bool IsSetCamera() const { return false; }
- virtual bool IsResizable() const { return false; }
- virtual void SetSize( const float ) {}
- virtual void SetCamera( vtkCamera* ) {}
-
- protected:
- bool myIsResolveCoincidentTopology;
- float myPolygonOffsetFactor;
- float myPolygonOffsetUnits;
-
- Handle(SALOME_InteractiveObject) myIO;
- std::string myName;
-
- vtkProperty *PreviewProperty;
- bool myIsPreselected;
-
- float myOpacity;
- bool myIsHighlighted;
- int myDisplayMode;
- bool myIsInfinite;
-
- bool myStoreMapping;
- SALOME_GeometryFilter *myGeomFilter;
- SALOME_TransformFilter *myTransformFilter;
- std::vector<SALOME_PassThroughFilter*> myPassFilter;
-
- int myRepresentation;
- vtkProperty *myProperty;
-
- void InitPipeLine(vtkMapper* theMapper);
-
- SALOME_Actor();
- ~SALOME_Actor();
-};
-
-
-#endif // SALOME_ACTOR_H
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_InteractiveObject.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class SALOME_InteractiveObject SALOME_InteractiveObject.hxx
- \brief ...
-*/
-
-#include "SALOME_InteractiveObject.ixx"
-using namespace std;
-
-SALOME_InteractiveObject::SALOME_InteractiveObject()
-{
- myEntry = "";
- myName = "";
- myComponentDataType = "";
- myReference = "";
-}
-
-SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry,
- const char* aComponentDataType,
- const char* aName):
- myEntry(anEntry),
- myName(aName),
- myComponentDataType(aComponentDataType),
- myReference("")
-{}
-
-void SALOME_InteractiveObject::setEntry(const char* anEntry){
- myEntry = anEntry;
-}
-
-const char* SALOME_InteractiveObject::getEntry(){
- return myEntry.c_str();
-}
-
-void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
- myComponentDataType = aComponentDataType;
-}
-
-const char* SALOME_InteractiveObject::getComponentDataType(){
- return myComponentDataType.c_str();
-}
-
-void SALOME_InteractiveObject::setName(const char* aName){
- myName = aName;
-}
-
-const char* SALOME_InteractiveObject::getName(){
- return myName.c_str();
-}
-
-Standard_Boolean SALOME_InteractiveObject::hasEntry(){
- return myEntry != "";
-}
-
-Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
- if ( anIO->hasEntry() && this->hasEntry() ) {
- if ( myEntry == anIO->getEntry() )
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
- if ( myComponentDataType == ComponentDataType )
- return Standard_True;
- else
- return Standard_False;
-}
-
-Standard_Boolean SALOME_InteractiveObject::hasReference()
-{
- return myReference != "";
-}
-
-const char* SALOME_InteractiveObject::getReference()
-{
- return myReference.c_str();
-}
-
-void SALOME_InteractiveObject::setReference(const char* aReference)
-{
- myReference = aReference;
-}
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_InteractiveObject.hxx
-// Module : SALOME
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#define _SALOME_InteractiveObject_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-
-#include <string>
-
-class SALOME_InteractiveObject : public MMgt_TShared {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_InteractiveObject();
-Standard_EXPORT SALOME_InteractiveObject(const char* anEntry,
- const char* aComponentDataType,
- const char* aName = "");
-Standard_EXPORT void setEntry(const char* anEntry) ;
-Standard_EXPORT const char* getEntry() ;
-Standard_EXPORT void setName(const char* aName) ;
-Standard_EXPORT const char* getName() ;
-Standard_EXPORT Standard_Boolean hasEntry() ;
-Standard_EXPORT virtual Standard_Boolean isSame(const Handle(SALOME_InteractiveObject)& anIO) ;
-
-Standard_EXPORT Standard_Boolean hasReference() ;
-Standard_EXPORT const char* getReference() ;
-Standard_EXPORT void setReference(const char* aReference) ;
-
-Standard_EXPORT void setComponentDataType(const char* ComponentDataType) ;
-Standard_EXPORT const char* getComponentDataType() ;
-Standard_EXPORT Standard_Boolean isComponentType(const char* ComponentDataType) ;
- //Standard_EXPORT Standard_Boolean isComponentType(std::string ComponentDataType) ;
-Standard_EXPORT virtual ~SALOME_InteractiveObject();
-
-// Must be defined for using by NCollection for ceratin of data map
-friend Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
- const Handle(SALOME_InteractiveObject)& anIO2)
-{ return anIO1->isSame( anIO2 ); }
-
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_InteractiveObject_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
- std::string myReference;
- std::string myEntry;
- std::string myName;
- std::string myComponentDataType;
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_InteractiveObject.ixx
-// Module : SALOME
-
-#include "SALOME_InteractiveObject.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_InteractiveObject::~SALOME_InteractiveObject() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_InteractiveObject_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_InteractiveObject",
- sizeof(SALOME_InteractiveObject),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_InteractiveObject) Handle(SALOME_InteractiveObject)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_InteractiveObject) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_InteractiveObject))) {
- _anOtherObject = Handle(SALOME_InteractiveObject)((Handle(SALOME_InteractiveObject)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_InteractiveObject::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_InteractiveObject) ;
-}
-Standard_Boolean SALOME_InteractiveObject::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_InteractiveObject) == AType || MMgt_TShared::IsKind(AType));
-}
-Handle_SALOME_InteractiveObject::~Handle_SALOME_InteractiveObject() {}
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// 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 : SALOME_InteractiveObject.jxx
-// Module : SALOME
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
+++ /dev/null
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- OCCViewer_AISSelector.h \
- OCCViewer_Viewer3d.h \
- OCCViewer_ViewFrame.h \
- OCCViewer_ViewPort.h \
- OCCViewer_ViewPort3d.h \
- OCCViewer_VService.h \
- OCCViewer_Prs.h
-
-# Libraries targets
-
-LIB = libOCCViewer.la
-LIB_SRC = OCCViewer.cxx \
- OCCViewer_Viewer3d.cxx \
- OCCViewer_ViewFrame.cxx \
- OCCViewer_ViewPort.cxx \
- OCCViewer_ViewPort3d.cxx \
- OCCViewer_AISSelector.cxx \
- OCCViewer_VService.cxx \
- OCCViewer_Prs.cxx
-
-LIB_MOC = \
- OCCViewer.h \
- OCCViewer_AISSelector.h \
- OCCViewer_Viewer3d.h \
- OCCViewer_ViewFrame.h \
- OCCViewer_ViewPort.h \
- OCCViewer_ViewPort3d.h
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Component.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) -lSalomePrs -lSalomeGUI -lToolsGUI
-
-
-@CONCLUDE@
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "OCCViewer.h"
-#include "OCCViewer_ViewFrame.h"
-using namespace std;
-
-QAD_ViewFrame* OCCViewer::createView(QAD_RightFrame* parent)
-{
- return new OCCViewer_ViewFrame( parent, "occView" );
-}
-
-extern "C"
-{
- QAD_ViewFrame* createView(QAD_RightFrame* parent)
- {
- return OCCViewer::createView(parent);
- }
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_HeaderFile
-#define OCCViewer_HeaderFile
-
-#include "QAD_RightFrame.h"
-#include "QAD_ViewFrame.h"
-
-class OCCViewer : public QObject
-{
- Q_OBJECT
-
-public :
-
- Standard_EXPORT static QAD_ViewFrame* createView ( QAD_RightFrame* parent);
-
-};
-
-#endif
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_AISSelector.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class OCCViewer_AISSelector OCCViewer_AISSelector.h
- \brief Selector for AIS interactive context.
-
- Used only by Viewer Open CASCADE.
-*/
-
-#include "OCCViewer_AISSelector.h"
-using namespace std;
-
-/*!
- Constructor
-*/
-OCCViewer_AISSelector::OCCViewer_AISSelector( const Handle (AIS_InteractiveContext)& aisContext) :
- myAISContext ( aisContext ),
- myEnableSelection( true ),
- myEnableMultipleSelection( true )
-{
- initialize();
-}
-
-/*!
- Destructor
-*/
-OCCViewer_AISSelector::~OCCViewer_AISSelector()
-{
- cleanup();
-}
-
-/*!
- Initialization ( internal )
-*/
-void OCCViewer_AISSelector::initialize()
-{
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
-
- myHilightColor = Quantity_NOC_CYAN1;
- mySelectColor = Quantity_NOC_WHITE;
-
- myAISContext->SetHilightColor( myHilightColor );
- myAISContext->SelectionColor( mySelectColor );
- myAISContext->SetSubIntensityColor( Quantity_NOC_CYAN1 );
-}
-
-/*!
- Cleanup ( internal )
-*/
-void OCCViewer_AISSelector::cleanup()
-{
-}
-
-/*!
- Sets the color to hilight the detected objects
-*/
-void OCCViewer_AISSelector::setHilightColor ( Quantity_NameOfColor color )
-{
- myHilightColor = color;
-}
-
-/*!
- Sets the color to display the selected objects
-*/
-void OCCViewer_AISSelector::setSelectColor ( Quantity_NameOfColor color )
-{
- mySelectColor = color;
-}
-
-/*!
- Sets the interactive context for this selector
-*/
-void OCCViewer_AISSelector::setContext ( const Handle (AIS_InteractiveContext)& aisContext )
-{
- QAD_ASSERT_DEBUG_ONLY ( !aisContext.IsNull() );
- myAISContext = aisContext;
-}
-
-/*!
- Checks the status of pick and emits 'selSelectionDone' or
- 'selSelectionCancel'.
- Returns 'true' if no error, 'false' otherwise.
-*/
-void OCCViewer_AISSelector::checkSelection ( int numSelBefore )
-{
- int numSelAfter = numSelected();
- if ( numSelAfter < 1 && numSelBefore > 0 )
- emit selSelectionCancel( false );
- else if ( numSelAfter > 0 )
- emit selSelectionDone( numSelAfter > 1 );
-}
-
-
-/*!
- Detects the interactive objects at position (x,y).
- Returns 'true' if no error, 'false' otherwise.
-*/
-void OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view )
-{
- if ( !myEnableSelection )
- return;
-
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- myAISContext->MoveTo (x, y, view);
-}
-
-/*!
- Selects the detected interactive objects.
- Calls checkSelection() for checking the status.
-*/
-void OCCViewer_AISSelector::select ()
-{
- if ( !myEnableSelection )
- return;
-
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- int numBefore = numSelected();
-
- myAISContext->Select();
-
- /* send notifications */
- checkSelection ( numBefore );
-}
-
-/*!
- Selects the objects covered by the rectangle.
- Multiple selection must be enabled to get use of this function.
- Calls checkSelection() for checking the status.
-*/
-void OCCViewer_AISSelector::select ( int left, int top, int right, int bottom,
- const Handle (V3d_View)& view )
-{
- if ( !myEnableSelection || !myEnableMultipleSelection )
- return; /* selection with rectangle is considered as multiple selection */
-
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- int numBefore = numSelected();
-
- myAISContext->Select(left, top, right, bottom, view);
-
- /* send notifications */
- checkSelection ( numBefore );
-}
-
-/*!
- Adds new selected objects to the objects previously selected.
- Multiple selection must be enabled to get use of this function.
- Calls checkSelection() for checking the status.
-*/
-void OCCViewer_AISSelector::shiftSelect ()
-{
- if ( !myEnableSelection )
- return;
-
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- int numBefore = numSelected();
-
- if ( numBefore && !myEnableMultipleSelection)
- myAISContext->Select();
- else
- myAISContext->ShiftSelect();
-
- /* send notifications */
- checkSelection ( numBefore );
-}
-
-/*!
- Adds new selected objects covered by the rectangle to the objects
- previously selected.
- Multiple selection must be enabled to get use of this function.
- Calls checkSelection() for checking the status.
-*/
-void OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom,
- const Handle (V3d_View)& view )
-
-{
- if ( !myEnableSelection || !myEnableMultipleSelection )
- return; /* selection with rectangle is considered as multiple selection */
-
- QAD_ASSERT_DEBUG_ONLY ( !myAISContext.IsNull() );
- int numBefore = numSelected();
-
- myAISContext->ShiftSelect(left,top,right,bottom, view);
-
- /* send notifications */
- checkSelection ( numBefore );
-}
-
-/*!
- Enables/disables selection
-*/
-void OCCViewer_AISSelector::enableSelection( bool bEnable )
-{
- myEnableSelection = bEnable;
-}
-
-/*!
- Enables/disables multiple selection i.e
- selection of several objects at the same time.
- If enabled, non-multiple selection is enabled as well.
-*/
-void OCCViewer_AISSelector::enableMultipleSelection( bool bEnable )
-{
- myEnableMultipleSelection = bEnable;
- if ( bEnable ) myEnableSelection = bEnable;
-}
-
-/*!
- Returns the number of selected objects.
-*/
-int OCCViewer_AISSelector::numSelected() const
-{
- if ( myAISContext.IsNull() )
- return 0;
-
- if ( myAISContext->HasOpenedContext() )
- return myAISContext->NbSelected();
- return myAISContext->NbCurrents();
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_AISSelector.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_AISSELECTOR_H
-#define OCCViewer_AISSELECTOR_H
-
-#include "QAD.h"
-
-// QT Include
-#include <qobject.h>
-
-// Open CASCADE Includes
-#include <Quantity_NameOfColor.hxx>
-#include <AIS_InteractiveContext.hxx>
-
-class QAD_EXPORT OCCViewer_AISSelector : public QObject
-{
- Q_OBJECT
-
- void initialize();
- void cleanup();
-
-public:
- OCCViewer_AISSelector( const Handle (AIS_InteractiveContext)& );
- ~OCCViewer_AISSelector();
-
-public:
- void moveTo ( int, int, const Handle (V3d_View)& );
- void select ( int, int, int, int, const Handle (V3d_View)& );
- void shiftSelect ( int, int, int, int, const Handle (V3d_View)& );
- void select ();
- void shiftSelect ();
-
- void setContext ( const Handle (AIS_InteractiveContext)& );
- void setHilightColor ( Quantity_NameOfColor color );
- void setSelectColor ( Quantity_NameOfColor color );
-
- void enableSelection( bool );
- void enableMultipleSelection( bool );
-
-signals:
- void selSelectionDone( bool bAdded );
- void selSelectionCancel( bool bAdded );
-
-protected:
- void checkSelection ( int numBefore );
- int numSelected() const;
-
-private:
- Handle (AIS_InteractiveContext) myAISContext; // graphic context
- Quantity_NameOfColor myHilightColor; // color for hilight object
- Quantity_NameOfColor mySelectColor; // color for selected object
-
- bool myEnableSelection;
- bool myEnableMultipleSelection;
-
-};
-
-#endif
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : OCCViewer_Prs.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#include "OCCViewer_Prs.h"
-using namespace std;
-
-//==========================================================
-/*!
- * OCCViewer_Prs::OCCViewer_Prs
- * Default constructor
- */
-//==========================================================
-OCCViewer_Prs::OCCViewer_Prs()
-{
- myToActivate = true;
-}
-
-//==========================================================
-/*!
- * OCCViewer_Prs::OCCViewer_Prs
- * Standard constructor
- */
-//==========================================================
-OCCViewer_Prs::OCCViewer_Prs( const Handle(AIS_InteractiveObject)& obj )
-{
- AddObject( obj );
-}
-
-//==========================================================
-/*!
- * OCCViewer_Prs::~OCCViewer_Prs
- * Destructor
- */
-//==========================================================
-OCCViewer_Prs::~OCCViewer_Prs()
-{
- myObjects.Clear();
-}
-
-//==========================================================
-/*!
- * OCCViewer_Prs::GetObjects
- * Get interactive objects list
- */
-//==========================================================
-void OCCViewer_Prs::GetObjects( AIS_ListOfInteractive& list ) const
-{
- list = myObjects;
-}
-
-//==========================================================
-/*!
- * OCCViewer_Prs::AddObject
- * Add interactive object
- */
-//==========================================================
-void OCCViewer_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj )
-{
- myObjects.Append( obj );
-}
-
-//==========================================================
-/*!
- * OCCViewer_Prs::IsNull
- * Return 0 if list of the interactive objects is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
-bool OCCViewer_Prs::IsNull() const
-{
- return myObjects.IsEmpty();
-}
-
-//=================================================================
-/*!
- * GEOM_Displayer::SetToActivate
- * This method is used for activisation/deactivisation of
- * objects in the moment of displaying
-*/
-//=================================================================
-void OCCViewer_Prs::SetToActivate( const bool toActivate )
-{
- myToActivate = toActivate;
-}
-bool OCCViewer_Prs::ToActivate() const
-{
- return myToActivate;
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : OCCViewer_Prs.h
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef OCCVIEWER_PRS_H
-#define OCCVIEWER_PRS_H
-
-#include "SALOME_Prs.h"
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_ListOfInteractive.hxx>
-
-class OCCViewer_Prs : public SALOME_OCCPrs
-{
-public:
- OCCViewer_Prs();
- // Default constructor
- OCCViewer_Prs( const Handle(AIS_InteractiveObject)& obj );
- // Standard constructor
- ~OCCViewer_Prs();
- // Destructor
-
- void GetObjects( AIS_ListOfInteractive& list ) const;
- // Get interactive objects list
- void AddObject( const Handle(AIS_InteractiveObject)& obj );
- // Add interactive object
-
- bool IsNull() const;
- // Reimplemented from SALOME_Prs
-
- /* This method is used for activisation/deactivisation of
- objects in the moment of displaying */
- void SetToActivate( const bool );
- bool ToActivate() const;
-
-private:
- AIS_ListOfInteractive myObjects; // list of interactive objects
- bool myToActivate;
-};
-
-#endif
-
-
-
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_VService.cxx
-// Author : GG, FMN, Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "OCCViewer_VService.h"
-
-// Open CASCADE Includes
-#include <V3d_Viewer.hxx>
-#include <V3d_View.hxx>
-#include <Viewer_Viewer.hxx>
-
-#include <V2d_Viewer.hxx>
-#include <V2d_View.hxx>
-#include <Viewer_Viewer.hxx>
-
-#ifdef WNT
-#include <WNT_Window.hxx>
-#include <Graphic3d_WNTGraphicDevice.hxx>
-#include <WNT_GraphicDevice.hxx>
-#include <WNT_GraphicDevice.hxx>
-#include <WNT_WDriver.hxx>
-#else
-#include <Xw_Window.hxx>
-#include <Graphic3d_GraphicDevice.hxx>
-#include <Xw_Driver.hxx>
-#include <Xdps_Driver.hxx>
-#include <Xw_TypeOfMapping.hxx>
-#endif
-using namespace std;
-
-// For 2d
-#define LOPTIM
-#ifdef WNT
-#ifndef LOPTIM
-static Handle(WNT_GraphicDevice) XServiceDefault2dDevice;
-static Handle(WNT_GraphicDevice) XServiceImageDevice;
-#else
-static Handle(WNT_GraphicDevice)& _XServiceDefault2dDevice() {
-static Handle(WNT_GraphicDevice) XServiceDefault2dDevice;
-return XServiceDefault2dDevice;
-}
-#define XServiceDefault2dDevice _XServiceDefault2dDevice()
-
-static Handle(WNT_GraphicDevice)& _XServiceImageDevice() {
-static Handle(WNT_GraphicDevice) XServiceImageDevice;
-return XServiceImageDevice;
-}
-#define XServiceImageDevice _XServiceImageDevice()
-#endif // LOPTIM
-#else
-#ifndef LOPTIM
-static Handle(Xw_GraphicDevice) XServiceDefault2dDevice;
-static Handle(Xw_GraphicDevice) XServiceImageDevice;
-#else
-static Handle(Xw_GraphicDevice)& _XServiceDefault2dDevice() {
-static Handle(Xw_GraphicDevice) XServiceDefault2dDevice;
-return XServiceDefault2dDevice;
-}
-#define XServiceDefault2dDevice _XServiceImageDevice()
-
-static Handle(Xw_GraphicDevice)& _XServiceImageDevice() {
-static Handle(Xw_GraphicDevice) XServiceImageDevice;
-return XServiceImageDevice;
-}
-#define XServiceImageDevice _XServiceImageDevice()
-#endif // LOPTIM
-#endif // WNT
-
-
-// ==================================== 3D ================================================================
-/*----------------------------------------------------------------------*/
-
-void OCCViewer_VService::SetWindow (const Handle(V3d_View)& aView,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality aQuality)
-{
-#ifdef WNT
- Handle(WNT_Window) w = new WNT_Window(Handle(Graphic3d_WNTGraphicDevice)::DownCast(aView->Viewer()->Device()),hiwin,lowin);
-#else
- Handle(Xw_Window) w = new Xw_Window(Handle(Graphic3d_GraphicDevice)::DownCast(aView->Viewer()->Device()),hiwin,lowin,aQuality);
-#endif
- aView->SetWindow(w);
-// aView->SetShadingModel(V3d_GOURAUD);
-}
-
-/*----------------------------------------------------------------------*/
-
-void OCCViewer_VService::SetMagnify (const Handle(V3d_View)& aView,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Handle(V3d_View)& aPreviousView,
- const Standard_Integer x1,
- const Standard_Integer y1,
- const Standard_Integer x2,
- const Standard_Integer y2,
- const Xw_WindowQuality aQuality)
-{
-#ifdef WNT
- Handle(WNT_Window) w = new WNT_Window(Handle(Graphic3d_WNTGraphicDevice)::DownCast(aView->Viewer()->Device()),hiwin,lowin);
-#else
- Handle(Xw_Window) w = new Xw_Window(Handle(Graphic3d_GraphicDevice)::DownCast(aView->Viewer()->Device()),hiwin,lowin,aQuality);
-#endif // WNT
-
- aView->SetMagnify(w,aPreviousView,x1,y1,x2,y2);
-// aView->SetShadingModel(V3d_GOURAUD);
-// aView->SetSurfaceDetail(V3d_TEX_NONE);
-// aView->SetVisualization(V3d_WIREFRAME);
-// aView->SetVisualization(V3d_ZBUFFER);
-}
-/*----------------------------------------------------------------------*/
-
-Handle(V3d_Viewer) OCCViewer_VService::Viewer( const Standard_CString aDisplay,
- const Standard_ExtString aName,
- const Standard_CString aDomain,
- const Standard_Real ViewSize,
- const V3d_TypeOfOrientation ViewProj,
- const Standard_Boolean ComputedMode,
- const Standard_Boolean aDefaultComputedMode )
-{
-#ifndef WNT
-static Handle(Graphic3d_GraphicDevice) defaultdevice;
-
- if(defaultdevice.IsNull()) defaultdevice = new Graphic3d_GraphicDevice(aDisplay);
- return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
- Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
- ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
-#else
- static Handle(Graphic3d_WNTGraphicDevice) defaultdevice;
-
- if(defaultdevice.IsNull()) defaultdevice = new Graphic3d_WNTGraphicDevice();
- return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
- Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
- ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
-#endif // WNT
-}
-
-/*----------------------------------------------------------------------*/
-// ==================================== 2D ================================================================
-Handle(V2d_View) OCCViewer_VService::XView( const Handle(V2d_Viewer)& aViewer,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality aQuality,
- const Standard_Boolean Update,
- const Quantity_NameOfColor BackColor)
-{
-#ifdef WNT
- Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device());
- Handle(WNT_Window) W = new WNT_Window(GD,hiwin,lowin,BackColor);
- Handle(WNT_WDriver) D = new WNT_WDriver(W);
-#else
- Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device());
- Handle(Xw_Window) W = new Xw_Window(GD,hiwin,lowin,aQuality,BackColor);
- Handle(Xw_Driver) D = new Xw_Driver(W);
-#endif
-
- Handle(V2d_View) V = new V2d_View(D,aViewer);
- if(Update) V->Update();
- return V;
-}
-
-Handle(V2d_View) OCCViewer_VService::XdpsView( const Handle(V2d_Viewer)& aViewer,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality aQuality,
- const Standard_Boolean Update,
- const Quantity_NameOfColor BackColor)
-{
-#ifdef WNT
- Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device());
- Handle(WNT_Window) W = new WNT_Window(GD,hiwin,lowin,BackColor);
-//POP
- W->SetBackground(BackColor);
-//POP
- Handle(WNT_WDriver) D = new WNT_WDriver(W);
-#else
- Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device());
- Handle(Xw_Window) W = new Xw_Window(GD,hiwin,lowin,aQuality,BackColor);
- Handle(Xdps_Driver) D = new Xdps_Driver(W);
-#endif
- Handle(V2d_View) V = new V2d_View(D,aViewer);
- if(Update) V->Update();
- return V;
-}
-
-Handle(V2d_Viewer) OCCViewer_VService::Viewer( const Standard_CString aDisplay,
- const Standard_ExtString aName,
- const Standard_CString aDomain)
-{
-#ifdef WNT
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new WNT_GraphicDevice();
-#else
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new Xw_GraphicDevice(aDisplay,Xw_TOM_READONLY);
-#endif
- return new V2d_Viewer(XServiceDefault2dDevice,aName,aDomain);
-}
-
-Handle(V2d_Viewer) OCCViewer_VService::Viewer( const Standard_CString aDisplay,
- const Handle(Graphic2d_View)& aView,
- const Standard_ExtString aName,
- const Standard_CString aDomain)
-{
-#ifdef WNT
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new WNT_GraphicDevice();
-#else
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new Xw_GraphicDevice(aDisplay,Xw_TOM_READONLY);
-#endif
- return new V2d_Viewer(XServiceDefault2dDevice,aView,aName,aDomain);
-}
-
-Handle(Aspect_WindowDriver) OCCViewer_VService::WindowDriver( const Standard_CString aDisplay,
- const Standard_Integer ahiwin,
- const Standard_Integer alowin,
- const Quantity_NameOfColor aColor)
-{
-#ifdef WNT
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new WNT_GraphicDevice();
- Handle(WNT_Window) W = new WNT_Window(XServiceDefault2dDevice,ahiwin,alowin,aColor);
- return new WNT_WDriver(W);
-#else
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new Xw_GraphicDevice(aDisplay,Xw_TOM_READONLY);
- Handle(Xw_Window) W = new Xw_Window(XServiceDefault2dDevice,ahiwin,alowin,Xw_WQ_DRAWINGQUALITY,aColor);
- return new Xw_Driver(W);
-#endif
-}
-
-Handle(Aspect_WindowDriver) OCCViewer_VService::XdpsDriver( const Standard_CString aDisplay,
- const Standard_Integer ahiwin,
- const Standard_Integer alowin,
- const Quantity_NameOfColor aColor)
-{
-#ifdef WNT
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new WNT_GraphicDevice();
- Handle(WNT_Window) W = new WNT_Window(XServiceDefault2dDevice,ahiwin,alowin,aColor);
- return new WNT_WDriver(W);
-#else
- if(XServiceDefault2dDevice.IsNull()) XServiceDefault2dDevice = new Xw_GraphicDevice(aDisplay,Xw_TOM_READONLY);
- Handle(Xw_Window) W = new Xw_Window(XServiceDefault2dDevice,ahiwin,alowin,Xw_WQ_DRAWINGQUALITY,aColor);
- return new Xdps_Driver(W);
-#endif
-}
-
-Handle(Aspect_WindowDriver) OCCViewer_VService::ImageDriver( const Standard_CString aDisplay,
- const Standard_Integer ahiwin,
- const Standard_Integer alowin,
- const Quantity_NameOfColor aColor)
-{
-#ifdef WNT
- if(XServiceImageDevice.IsNull()) XServiceImageDevice = new WNT_GraphicDevice();
- Handle(WNT_Window) W = new WNT_Window(XServiceImageDevice,ahiwin,alowin,aColor);
- return new WNT_WDriver(W);
-#else
- if(XServiceImageDevice.IsNull()) XServiceImageDevice = new Xw_GraphicDevice(aDisplay,Xw_TOM_READONLY);
- Handle(Xw_Window) W = new Xw_Window(XServiceImageDevice,ahiwin,alowin,Xw_WQ_PICTUREQUALITY,aColor);
- return new Xw_Driver(W);
-#endif
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_VService.h
-// Module : SALOME
-
-#ifndef _OCCViewer_VService_HeaderFile
-#define _OCCViewer_VService_HeaderFile
-
-#ifndef _Handle_V3d_View_HeaderFile
-#include <Handle_V3d_View.hxx>
-#endif
-#ifndef _Handle_V2d_View_HeaderFile
-#include <Handle_V2d_View.hxx>
-#endif
-#ifndef _Handle_V2d_Viewer_HeaderFile
-#include <Handle_V2d_Viewer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Xw_WindowQuality_HeaderFile
-#include <Xw_WindowQuality.hxx>
-#endif
-#ifndef _Handle_V3d_Viewer_HeaderFile
-#include <Handle_V3d_Viewer.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _Standard_ExtString_HeaderFile
-#include <Standard_ExtString.hxx>
-#endif
-#ifndef _Quantity_Length_HeaderFile
-#include <Quantity_Length.hxx>
-#endif
-#ifndef _Quantity_NameOfColor_HeaderFile
-#include <Quantity_NameOfColor.hxx>
-#endif
-#ifndef _V3d_TypeOfOrientation_HeaderFile
-#include <V3d_TypeOfOrientation.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_Graphic2d_View_HeaderFile
-#include <Handle_Graphic2d_View.hxx>
-#endif
-#ifndef _Handle_Aspect_WindowDriver_HeaderFile
-#include <Handle_Aspect_WindowDriver.hxx>
-#endif
-
-class V3d_View;
-class V3d_Viewer;
-
-class V2d_View;
-class V2d_Viewer;
-class Graphic2d_View;
-class Aspect_WindowDriver;
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class OCCViewer_VService {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-
-// Methods PUBLIC
-//
-Standard_EXPORT static void SetWindow(const Handle(V3d_View)& aView,const Standard_Integer hiwin,const Standard_Integer lowin,const Xw_WindowQuality aQuality = Xw_WQ_3DQUALITY) ;
-Standard_EXPORT static void SetMagnify(const Handle(V3d_View)& aView,const Standard_Integer hiwin,const Standard_Integer lowin,const Handle(V3d_View)& aPreviousView,const Standard_Integer x1,const Standard_Integer y1,const Standard_Integer x2,const Standard_Integer y2,const Xw_WindowQuality aQuality = Xw_WQ_3DQUALITY) ;
-Standard_EXPORT static Handle_V3d_Viewer Viewer(const Standard_CString aDisplay,const Standard_ExtString aName,const Standard_CString aDomain = "",const Quantity_Length ViewSize = 1000.0,const V3d_TypeOfOrientation ViewProj = V3d_XposYnegZpos,const Standard_Boolean ComputedMode = Standard_True,const Standard_Boolean DefaultComputedMode = Standard_True) ;
-
-Standard_EXPORT static Handle_V2d_View XView(const Handle(V2d_Viewer)& aViewer,const Standard_Integer hiwin,const Standard_Integer lowin,const Xw_WindowQuality aQuality = Xw_WQ_DRAWINGQUALITY,const Standard_Boolean Update = Standard_True,const Quantity_NameOfColor BackColor = Quantity_NOC_MATRAGRAY) ;
-Standard_EXPORT static Handle_V2d_View XdpsView(const Handle(V2d_Viewer)& aViewer,const Standard_Integer hiwin,const Standard_Integer lowin,const Xw_WindowQuality aQuality = Xw_WQ_DRAWINGQUALITY,const Standard_Boolean Update = Standard_True,const Quantity_NameOfColor BackColor = Quantity_NOC_MATRAGRAY) ;
-Standard_EXPORT static Handle_V2d_Viewer Viewer(const Standard_CString aDisplay,const Standard_ExtString aName,const Standard_CString aDomain = "") ;
-Standard_EXPORT static Handle_V2d_Viewer Viewer(const Standard_CString aDisplay,const Handle(Graphic2d_View)& aView,const Standard_ExtString aName,const Standard_CString aDomain = "") ;
-Standard_EXPORT static Handle_Aspect_WindowDriver WindowDriver(const Standard_CString aDisplay,const Standard_Integer ahiwin,const Standard_Integer alowin,const Quantity_NameOfColor aColor = Quantity_NOC_GRAY69) ;
-Standard_EXPORT static Handle_Aspect_WindowDriver XdpsDriver(const Standard_CString aDisplay,const Standard_Integer ahiwin,const Standard_Integer alowin,const Quantity_NameOfColor aColor = Quantity_NOC_GRAY69) ;
-Standard_EXPORT static Handle_Aspect_WindowDriver ImageDriver(const Standard_CString aDisplay,const Standard_Integer ahiwin,const Standard_Integer alowin,const Quantity_NameOfColor aColor = Quantity_NOC_GRAY69) ;
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "OCCViewer_ViewFrame.h"
-#include "OCCViewer_Viewer3d.h"
-#include "OCCViewer_ViewPort.h"
-#include "OCCViewer_ViewPort3d.h"
-#include "OCCViewer_Prs.h"
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_ViewFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "utilities.h"
-
-#include "QAD_Config.h"
-#include "QAD_Settings.h"
-#include "SALOME_Selection.h"
-#include "SALOME_AISShape.hxx"
-#include "SALOMEGUI.h"
-#include "SALOMEDS_Tool.hxx"
-#include "ToolsGUI.h"
-
-// QT Include
-#include <qapplication.h>
-
-// Open CASCADE Include
-#include <V3d_View.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <Visual3d_View.hxx>
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-using namespace std;
-
-//=======================================================================
-// name : getMapOfEntry
-// Purpose : Convert list of interactive objects in map <entry <--> interactive object>
-//=======================================================================
-static void getMapOfEntry( const AIS_ListOfInteractive& theList,
- QMap< QString, Handle(AIS_InteractiveObject) >& theMap )
-{
- AIS_ListIteratorOfListOfInteractive anIter( theList );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(SALOME_InteractiveObject) anIO =
- Handle(SALOME_InteractiveObject)::DownCast( anIter.Value() );
- if ( !anIO.IsNull() )
- theMap[ anIO->getEntry() ] = anIter.Value();
- }
-}
-
-
-/*
- Class : OCCViewer_ViewFrame
- Description : View frame for Open CASCADE view
-*/
-
-
-//=======================================================================
-// name : OCCViewer_ViewFrame
-// Purpose : Constructor
-//=======================================================================
-OCCViewer_ViewFrame::OCCViewer_ViewFrame( QWidget* parent, const QString& title )
- : QAD_ViewFrame ( parent, "" )
-{
- initialize();
-}
-
-//=======================================================================
-// name : OCCViewer_ViewFrame
-// Purpose : Constructor
-//=======================================================================
-OCCViewer_ViewFrame::OCCViewer_ViewFrame( QWidget* parent )
- : QAD_ViewFrame (parent, "")
-{
- initialize();
-}
-
-//=======================================================================
-// name : ~OCCViewer_ViewFrame
-// Purpose : Destructor
-//=======================================================================
-OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
-{
- cleanup();
-}
-
-//=======================================================================
-// name : initialize
-// Purpose : Initialize view frame (called from constructors )
-//=======================================================================
-void OCCViewer_ViewFrame::initialize()
-{
- myViewPort = NULL;
- myViewer = new OCCViewer_Viewer3d( this );
-
- /* enable/disable selection */
- myViewer->enableSelection( true );
- myViewer->enableMultipleSelection( true );
-}
-
-//=======================================================================
-// name : cleanup
-// Purpose : Cleanup viewframe
-//=======================================================================
-void OCCViewer_ViewFrame::cleanup()
-{
-}
-
-//=======================================================================
-// name : setViewPort
-// Purpose : Sets the viewport for this frame
-//=======================================================================
-void OCCViewer_ViewFrame::setViewPort( OCCViewer_ViewPort* view )
-{
- myViewPort = view;
- initViewPort();
- setCentralWidget ( myViewPort );
-}
-
-//=======================================================================
-// name : initViewPort
-// Purpose : Inits the viewport for this frame
-//=======================================================================
-void OCCViewer_ViewFrame::initViewPort()
-{
- /* Active Key Event */
-
- setFocus();
-
- /* Initial attributes */
-
- myViewPort->setCursor( cursor() );
- myViewPort->setBackgroundColor( backgroundColor() );
-
- QAD_ASSERT( QObject::connect(myViewPort, SIGNAL( vpKeyPress ( QKeyEvent* ) ),
- this, SIGNAL(vfKeyPress(QKeyEvent*))) );
-
- /* Listen to my viewport */
-
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpTransformationStarted( OCCViewer_ViewPort::OperationType ) ),
- this, SIGNAL( vfTransformationStarted( OCCViewer_ViewPort::OperationType ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpTransformationFinished ( OCCViewer_ViewPort::OperationType ) ),
- this, SIGNAL( vfTransformationFinished( OCCViewer_ViewPort::OperationType ) ) ) );
-
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpDrawExternal( QPainter* ) ),
- this, SIGNAL( vfDrawExternal( QPainter* ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpMousePress( QMouseEvent* ) ),
- this, SIGNAL( vfMousePress( QMouseEvent* ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpMouseRelease( QMouseEvent* ) ),
- this, SIGNAL( vfMouseRelease( QMouseEvent* ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpMouseMove( QMouseEvent* ) ),
- this, SIGNAL( vfMouseMove( QMouseEvent* ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpMouseDoubleClick( QMouseEvent* ) ),
- this, SIGNAL( vfMouseDoubleClick( QMouseEvent* ) ) ) );
-
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpKeyPress( QKeyEvent* ) ),
- this, SIGNAL( vfKeyPress( QKeyEvent* ) ) ) );
- QAD_ASSERT( connect( myViewPort, SIGNAL( vpKeyRelease( QKeyEvent* ) ),
- this, SIGNAL( vfKeyRelease( QKeyEvent* ) ) ) );
-}
-
-//=======================================================================
-// name : getViewWidget
-// Purpose : Returns widget containing 3D-Viewer
-//=======================================================================
-QWidget* OCCViewer_ViewFrame::getViewWidget()
-{
- return (QWidget*)getViewPort();
-}
-
-//=======================================================================
-// name : getViewPort
-// Purpose : Returns the viewport of this frame
-//=======================================================================
-OCCViewer_ViewPort* OCCViewer_ViewFrame::getViewPort() const
-{
- return myViewPort;
-}
-
-//=======================================================================
-// name : Sets the cursor for the viewframe's viewport
-// Purpose : setCursor
-//=======================================================================
-void OCCViewer_ViewFrame::setCursor( const QCursor& cursor)
-{
- if ( myViewPort )
- myViewPort->QWidget::setCursor( cursor );
-}
-
-
-//=======================================================================
-// name : cursor
-// Purpose : Returns the current cursor
-//=======================================================================
-QCursor OCCViewer_ViewFrame::cursor() const
-{
- if ( myViewPort )
- return myViewPort->cursor();
- return QMainWindow::cursor();
-}
-
-//=======================================================================
-// name : setBackgroundColor
-// Purpose : Set background of the viewport
-//=======================================================================
-void OCCViewer_ViewFrame::setBackgroundColor( const QColor& color)
-{
- if ( myViewPort )
- myViewPort->setBackgroundColor( color );
-}
-
-//=======================================================================
-// name : backgroundColor
-// Purpose : Returns background of the viewport
-//=======================================================================
-QColor OCCViewer_ViewFrame::backgroundColor() const
-{
- if ( myViewPort )
- return myViewPort->backgroundColor();
- return QMainWindow::backgroundColor();
-}
-
-//=======================================================================
-// name : setViewer
-// Purpose : Sets the parent viewer for the window
-//=======================================================================
-void OCCViewer_ViewFrame::setViewer( OCCViewer_Viewer3d* viewer )
-{
- myViewer = viewer;
-}
-
-//=======================================================================
-// name : getViewer
-// Purpose : Returns the parent viewer for the window
-//=======================================================================
-OCCViewer_Viewer3d* OCCViewer_ViewFrame::getViewer() const
-{
- return myViewer;
-}
-
-//=======================================================================
-// name : setVisible
-// Purpose : Show/hide view
-//=======================================================================
-void OCCViewer_ViewFrame::setVisible( const bool visible )
-{
- if ( visible == QWidget::isVisible() )
- return;
-
- if ( visible )
- show();
- else
- hide();
-}
-
-//=======================================================================
-// name : closeEvent
-// Purpose : Called when viewframe is about to close
-//=======================================================================
-void OCCViewer_ViewFrame::closeEvent( QCloseEvent* e )
-{
- emit vfViewClosing( e ); /* notify our viewer */
-}
-
-//=======================================================================
-// name : resizeEvent
-// Purpose : Called when viewframe is resized
-//=======================================================================
-void OCCViewer_ViewFrame::resizeEvent( QResizeEvent* e )
-{
- emit vfResize( e );
-}
-
-//=======================================================================
-// name : keyPressEvent
-// Purpose : Called when key is pressed
-//=======================================================================
-void OCCViewer_ViewFrame::keyPressEvent( QKeyEvent *k )
-{
- emit vfKeyPress(k);
-}
-
-//=======================================================================
-// name : onViewFitAll
-// Purpose : Fits all objects in the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewFitAll()
-{
- myViewPort->fitAll();
-}
-
-//=======================================================================
-// name : onViewFitArea
-// Purpose : Fits all obejcts within a rectangular area of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewFitArea()
-{
- myViewPort->activateWindowFit();
- QAD_Application::getDesktop()->putInfo( tr( "PRP_VW3D_SKETCHAREA" ) );
-}
-
-//=======================================================================
-// name : onViewPan
-// Purpose : Moves the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewPan()
-{
- myViewPort->activatePanning();
-}
-
-//=======================================================================
-// name : onViewZoom
-// Purpose : Zooms the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewZoom()
-{
- myViewPort->activateZoom();
-}
-
-//=======================================================================
-// name : onViewGlobalPan
-// Purpose : Sets a new center of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewGlobalPan()
-{
- myViewPort->activateGlobalPanning();
- QAD_Application::getDesktop()->putInfo( tr("PRP_VW3D_POINTCENTER") );
-}
-
-//=======================================================================
-// name : onViewRotate
-// Purpose : Rotates the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewRotate()
-{
- myViewPort->activateRotation();
-}
-
-//=======================================================================
-// name : onViewReset
-// Purpose : Reset the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewReset()
-{
- myViewPort->reset();
-}
-
-//=======================================================================
-// name : onViewFront
-// Purpose : Provides front projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewFront()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj (V3d_Xpos);
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewBack
-// Purpose : Provides back projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewBack()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj (V3d_Xneg);
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewRight
-// Purpose : Provides right projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewRight()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() )
- view3d->SetProj( V3d_Ypos );
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewLeft
-// Purpose : Provides left projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewLeft()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() )
- view3d->SetProj( V3d_Yneg );
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewBottom
-// Purpose : Provides bottom projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewBottom()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj(V3d_Zneg);
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewTop
-// Purpose : Provides top projection of the active view
-//=======================================================================
-void OCCViewer_ViewFrame::onViewTop()
-{
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
- if ( !view3d.IsNull() ) view3d->SetProj( V3d_Zpos );
- onViewFitAll();
-}
-
-//=======================================================================
-// name : onViewTrihedron
-// Purpose : Display/hide Trihedron
-//=======================================================================
-void OCCViewer_ViewFrame::onViewTrihedron()
-{
- if (!myViewer->getAISContext()->IsDisplayed( myViewer->getTrihedron() ))
- myViewer->getAISContext()->Display( myViewer->getTrihedron() );
- else
- myViewer->getAISContext()->Erase( myViewer->getTrihedron() );
- onAdjustTrihedron();
-}
-
-//=======================================================================
-// name : rename
-// Purpose : Rename entry object
-//=======================================================================
-void OCCViewer_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
- const QString newName )
-{
- myViewer->rename(IObject, newName);
-}
-
-//=======================================================================
-// name : unHighlightAll
-// Purpose : Unhighlight all objects
-//=======================================================================
-void OCCViewer_ViewFrame::unHighlightAll()
-{
- myViewer->unHighlightAll();
-}
-
-//=======================================================================
-// name : highlight
-// Purpose : Highlight object
-//=======================================================================
-void OCCViewer_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
- const bool highlight,
- const bool update )
-{
- myViewer->highlight( IObject, highlight, update );
-}
-
-//=======================================================================
-// name : isInViewer
-// Purpose : Magic function
-//=======================================================================
-bool OCCViewer_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return myViewer->isInViewer( IObject );
-}
-
-//=======================================================================
-// name : isVisible
-// Purpose : Verify whether object is visible
-//=======================================================================
-bool OCCViewer_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return myViewer->isVisible( IObject );
-}
-
-//=======================================================================
-// name : setPopupServer
-// Purpose : Set popup server
-//=======================================================================
-void OCCViewer_ViewFrame::setPopupServer( QAD_Application* App )
-{
- myViewer->setPopupServer( App );
-}
-
-//=======================================================================
-// name : redisplayAll
-// Purpose : Redisplay all objects of active component in accordance with
-// their display flags
-//=======================================================================
-void OCCViewer_ViewFrame::redisplayAll( QAD_Study* theQADStudy, const bool theToUpdate )
-{
- SALOMEDS::Study_var aStudy = theQADStudy->getStudyDocument();
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- SALOMEGUI* aGUI = aDesktop->getActiveGUI();
- const QString& aCompName = aDesktop->getComponentDataType();
- SALOMEDS::SObject_var aComponent =
- SALOMEDS::SObject::_narrow( aStudy->FindComponent ( aCompName.latin1() ) );
-
- if ( aComponent->_is_nil() )
- return;
-
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
- bool isTrhDisplayed = anIC->IsDisplayed( myViewer->getTrihedron() );
-
- anIC->DisplayAll( true, false );
- anIC->EraseAll( false, false );
-
- if ( isTrhDisplayed )
- anIC->Display( myViewer->getTrihedron(), false );
-
- std::list<SALOMEDS::SObject_var> aList;
- SALOMEDS_Tool::GetAllChildren( aStudy, aComponent, aList );
-
- std::list<SALOMEDS::SObject_var>::iterator anIter = aList.begin();
- for ( ; anIter != aList.end(); ++anIter )
- {
- SALOMEDS::SObject_var anObj = (*anIter);
- if ( ToolsGUI::GetVisibility( aStudy, anObj, this ) )
- {
- Handle(SALOME_InteractiveObject) anIObj = new SALOME_InteractiveObject();
- anIObj->setEntry( anObj->GetID() );
- aGUI->BuildPresentation( anIObj, this );
- }
- }
-
- if ( theToUpdate )
- Repaint();
-}
-
-//=======================================================================
-// name : undo
-// Purpose : Redisplay all objects of active component in accordance with
-// their display flags. Called when undo operation is complited
-//=======================================================================
-void OCCViewer_ViewFrame::undo( QAD_Study* theQADStudy, const char* )
-{
- redisplayAll( theQADStudy );
-}
-
-//=======================================================================
-// name : redo
-// Purpose : Redisplay all objects of active component in accordance with
-// their display flags. Called when undo operation is complited
-//=======================================================================
-void OCCViewer_ViewFrame::redo( QAD_Study* theQADStudy, const char* )
-{
- redisplayAll( theQADStudy );
-}
-
-//=======================================================================
-// name : FindIObject
-// Purpose : Find in context SALOME_InteractiveObject by entry
-//=======================================================================
-Handle(SALOME_InteractiveObject) OCCViewer_ViewFrame::FindIObject( const char* Entry )
-{
- Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
-
- AIS_ListOfInteractive List;
- ic->DisplayedObjects( List );
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector( List1 );
- List.Append( List1 );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), Entry ) == 0 )
- {
- MESSAGE ( "IO found")
- return anObj;
- }
- }
- MESSAGE ( "IO not found")
- return Handle(SALOME_InteractiveObject)();
-}
-
-//=======================================================================
-// name : Display
-// Purpose : Display object
-//=======================================================================
-void OCCViewer_ViewFrame::Display( const Handle(SALOME_InteractiveObject)& theIObject,
- bool toUpdate )
-{
- if ( theIObject.IsNull() )
- return;
-
- QAD_Study* aQADStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection( aQADStudy->getSelection() );
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
-
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
-
- AIS_ListOfInteractive aList;
- anIC->ObjectsInCollector( aList );
- AIS_ListIteratorOfListOfInteractive anIter( aList );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( theIObject ) )
- {
- anIC->Display( anIter.Value(), false );
- aSel->AddIObject( anObj, false );
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- break;
- }
- }
-
- if ( toUpdate )
- Repaint();
-}
-
-//=======================================================================
-// name : DisplayOnly
-// Purpose : Display object and erase all other ones
-//=======================================================================
-void OCCViewer_ViewFrame::DisplayOnly( const Handle(SALOME_InteractiveObject)& theIO )
-{
- EraseAll();
- Display( theIO );
-}
-
-//=======================================================================
-// name : Erase
-// Purpose : Erase object
-//=======================================================================
-void OCCViewer_ViewFrame::Erase( const Handle(SALOME_InteractiveObject)& theIObject,
- bool toUpdate )
-{
- QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection( aStudy->getSelection() );
-
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
-
- AIS_ListOfInteractive aList;
- anIC->DisplayedObjects( aList );
-
- AIS_ListIteratorOfListOfInteractive ite( aList );
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() )
- {
- if ( anObj->isSame( theIObject ) )
- {
- anIC->Erase( ite.Value(), false );
- aSel->RemoveIObject( anObj, false );
- ToolsGUI::SetVisibility( aStudy->getStudyDocument(), anObj->getEntry(), false, this );
- break;
- }
- }
- }
-
- if ( toUpdate )
- Repaint();
-}
-
-//=======================================================================
-// name : DisplayAll
-// Purpose : Display all objects of active component
-//=======================================================================
-void OCCViewer_ViewFrame::DisplayAll()
-{
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- SALOMEGUI* aGUI = aDesktop->getActiveGUI();
- const QString& aCompName = aDesktop->getComponentDataType();
- SALOMEDS::SObject_var aComponent =
- SALOMEDS::SObject::_narrow( aStudy->FindComponent ( aCompName.latin1() ) );
-
- if ( aComponent->_is_nil() )
- return;
-
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
-
- AIS_ListOfInteractive aDispList;
- AIS_ListOfInteractive aCollList;
- anIC->DisplayedObjects( aDispList );
- anIC->ObjectsInCollector( aCollList );
-
- QMap< QString, Handle(AIS_InteractiveObject) > aDispMap;
- QMap< QString, Handle(AIS_InteractiveObject) > aCollMap;
- getMapOfEntry( aDispList, aDispMap );
- getMapOfEntry( aCollList, aCollMap );
-
- std::list<SALOMEDS::SObject_var> aList;
- SALOMEDS_Tool::GetAllChildren( aStudy, aComponent, aList );
-
- std::list<SALOMEDS::SObject_var>::iterator anIter = aList.begin();
- for ( ; anIter != aList.end(); ++anIter )
- {
- SALOMEDS::SObject_var anObj = (*anIter);
- if ( anObj->_is_nil() )
- continue;
-
- const char* aEntry = anObj->GetID();
- if ( aCollMap.contains( aEntry ) )
- {
- anIC->DisplayFromCollector( aCollMap[ aEntry ], false );
- ToolsGUI::SetVisibility( aStudy, aEntry, true, this );
- }
- else if ( !aDispMap.contains( aEntry ) )
- {
- Handle(SALOME_InteractiveObject) anIObj = new SALOME_InteractiveObject();
- anIObj->setEntry( anObj->GetID() );
- aGUI->BuildPresentation( anIObj, this );
- }
- }
-
- Repaint();
-}
-
-//=======================================================================
-// name : EraseAll
-// Purpose : Erase all objects
-//=======================================================================
-void OCCViewer_ViewFrame::EraseAll()
-{
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-
- Standard_Boolean isTrihedronDisplayed =
- myViewer->getAISContext()->IsDisplayed( myViewer->getTrihedron() );
-
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
-
- AIS_ListOfInteractive aList;
- anIC->DisplayedObjects( aList );
- AIS_ListIteratorOfListOfInteractive anIter( aList );
- for ( ; anIter.More(); anIter.Next() )
- {
- if ( anIC->IsDisplayed( myViewer->getTrihedron() ) &&
- anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) )
- continue;
-
- Handle(AIS_InteractiveObject) anIO = anIter.Value();
- anIC->Erase( anIO, false, true );
-
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() )
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), false, this );
- }
-
- if ( isTrihedronDisplayed )
- myViewer->getAISContext()->Display( myViewer->getTrihedron() );
- else
- Repaint();
-}
-
-//=======================================================================
-// name : Repaint
-// Purpose : Uodate view
-//=======================================================================
-void OCCViewer_ViewFrame::Repaint()
-{
- onAdjustTrihedron();
- myViewer->getViewer3d()->Update();
-}
-
-//=======================================================================
-// name : getTrihedronSize
-// Purpose : Get new and current trihedron size corresponding to the
-// current model size
-//=======================================================================
-bool OCCViewer_ViewFrame::getTrihedronSize( double& theNewSize, double& theSize )
-{
- theNewSize = 100;
- theSize = 100;
-
- Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)myViewPort)->getView();
-
- if ( view3d.IsNull() )
- return false;
-
- double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
- double aMaxSide;
-
- view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
-
- if ( Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() ||
- Xmax == RealLast() || Ymax == RealLast() || Zmax == RealLast() )
- return false;
-
- aMaxSide = Xmax - Xmin;
- if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin;
- if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin;
-
- static float aSizeInPercents = 105;
- QString aSetting = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
- if (!aSetting.isEmpty())
- aSizeInPercents = aSetting.toFloat();
-
- static float EPS = 5.0E-3;
- theSize = myViewer->getTrihedron()->Size();
- theNewSize = aMaxSide*aSizeInPercents / 100.0;
-
- return fabs( theNewSize - theSize ) > theSize * EPS ||
- fabs( theNewSize - theSize) > theNewSize * EPS;
-}
-
-//=======================================================================
-// name : AdjustTrihedrons
-// Purpose : Adjust trihedron size in accordance with size of model
-//=======================================================================
-void OCCViewer_ViewFrame::AdjustTrihedrons( const bool forced )
-{
- Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
-
- if ( !myViewer->isTrihedronDisplayed() )
- return;
- else
- {
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- if ( List.First() == List.Last() && List.First() == myViewer->getTrihedron() )
- {
- myViewer->setTrihedronSize( 100 );
- return;
- }
- }
-
- double aNewSize = 100, aSize = 100;
- if ( getTrihedronSize( aNewSize, aSize ) || forced )
- myViewer->setTrihedronSize( aNewSize );
-}
-
-//=======================================================================
-// name : onAdjustTrihedron
-// Purpose : Slot. Called when trihedrons must be resized
-//=======================================================================
-void OCCViewer_ViewFrame::onAdjustTrihedron()
-{
- AdjustTrihedrons( false );
-}
-
-//=======================================================================
-// name : Display
-// Purpose : Display presentation
-//=======================================================================
-void OCCViewer_ViewFrame::Display( const SALOME_OCCPrs* prs )
-{
- // try do downcast object
- const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( prs );
- if ( !anOCCPrs || anOCCPrs->IsNull() )
- return;
-
- // get context
- Handle (AIS_InteractiveContext) ic = myViewer->getAISContext();
- // get all displayed objects
- AIS_ListOfInteractive List;
- ic->DisplayedObjects( List );
- // get objects in the collector
- AIS_ListOfInteractive ListCollector;
- ic->ObjectsInCollector( ListCollector );
-
- // get objects to be displayed
- AIS_ListOfInteractive anAISObjects;
- anOCCPrs->GetObjects( anAISObjects );
-
- AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
- for ( ; aIter.More(); aIter.Next() )
- {
- Handle(AIS_InteractiveObject) anAIS = aIter.Value();
- if ( !anAIS.IsNull() )
- {
- // try to find presentation in the viewer
- bool bDisplayed = false;
- AIS_ListIteratorOfListOfInteractive ite( List );
- for ( ; ite.More(); ite.Next() )
- {
- // compare presentations by handles
- // if the object is already displayed - nothing to do more
- if ( ite.Value() == anAIS )
- {
- // Deactivate object if necessary
- if ( !anOCCPrs->ToActivate() )
- ic->Deactivate( anAIS );
- bDisplayed = true;
- break;
- }
- }
-
- if ( bDisplayed )
- continue;
-
- // then try to find presentation in the collector
- bDisplayed = false;
- ite.Initialize( ListCollector );
- for ( ; ite.More(); ite.Next() )
- {
- // compare presentations by handles
- // if the object is in collector - display it
- if ( ite.Value() == anAIS )
- {
- ic->DisplayFromCollector( anAIS, false );
-
- // Deactivate object if necessary
- if ( !anOCCPrs->ToActivate() )
- ic->Deactivate( anAIS );
- bDisplayed = true;
-
- // Set visibility flag
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- if ( !anObj.IsNull() && anObj->hasEntry() )
- {
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- }
-
- break;
- }
- }
- if ( bDisplayed )
- continue;
-
- // if object is not displayed and not found in the collector - display it
- if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
- {
- Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );
- double aNewSize = 100, aSize = 100;
- getTrihedronSize( aNewSize, aSize );
- aTrh->SetSize( aTrh == myViewer->getTrihedron() ? aNewSize : 0.5 * aNewSize );
- }
-
- ic->Display( anAIS, false );
-
- // Set visibility flag
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- if ( !anObj.IsNull() && anObj->hasEntry() )
- {
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- }
-
- // Deactivate object if necessary
- if ( !anOCCPrs->ToActivate() )
- ic->Deactivate( anAIS );
- }
- }
-}
-
-//=======================================================================
-// name : Erase
-// Purpose : Erase presentation
-//=======================================================================
-void OCCViewer_ViewFrame::Erase( const SALOME_OCCPrs* prs, const bool forced )
-{
- // try do downcast object
- const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( prs );
- if ( !anOCCPrs || anOCCPrs->IsNull() )
- return;
-
- // get context
- Handle(AIS_InteractiveContext) ic = myViewer->getAISContext();
-
- // get objects to be erased
- AIS_ListOfInteractive anAISObjects;
- anOCCPrs->GetObjects( anAISObjects );
-
- AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
- for ( ; aIter.More(); aIter.Next() ) {
- Handle(AIS_InteractiveObject) anAIS = aIter.Value();
- if ( !anAIS.IsNull() ) {
- // erase the object from context : move it to collector
- ic->Erase( anAIS, false, forced ? false : true );
-
- // Set visibility flag if necessary
- if ( !forced )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- if ( !anObj.IsNull() && anObj->hasEntry() )
- {
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- }
- }
- }
- }
-}
-
-//=======================================================================
-// name : CreatePrs
-// Purpose : Create presentation corresponding to the entry
-//=======================================================================
-SALOME_Prs* OCCViewer_ViewFrame::CreatePrs( const char* entry )
-{
- OCCViewer_Prs* prs = new OCCViewer_Prs();
- if ( entry )
- {
- // get context
- Handle(AIS_InteractiveContext) ic = myViewer->getAISContext();
-
- // get displayed objects
- AIS_ListOfInteractive List;
- ic->DisplayedObjects( List );
- // get objects in the collector
- AIS_ListOfInteractive ListCollector;
- ic->ObjectsInCollector( ListCollector );
- List.Append( ListCollector );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), entry ) == 0 )
- prs->AddObject( ite.Value() );
- }
- }
- return prs;
-}
-
-//=======================================================================
-// name : LocalSelection
-// Purpose : Activates selection of sub shapes
-//=======================================================================
-void OCCViewer_ViewFrame::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
-{
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
-
- const OCCViewer_Prs* anOCCPrs = dynamic_cast<const OCCViewer_Prs*>( thePrs );
- if ( anIC.IsNull() )
- return;
-
- // Open local context if there is no one
- bool allObjects = thePrs == 0 || thePrs->IsNull();
- if ( !anIC->HasOpenedContext() ) {
- anIC->ClearCurrents( false );
- anIC->OpenLocalContext( allObjects, true, true );
- }
-
- AIS_ListOfInteractive anObjs;
- // Get objects to be activated
- if ( allObjects )
- anIC->DisplayedObjects( anObjs );
- else
- anOCCPrs->GetObjects( anObjs );
-
- // Activate selection of objects from prs
- AIS_ListIteratorOfListOfInteractive aIter( anObjs );
- for ( ; aIter.More(); aIter.Next() ) {
- Handle(AIS_InteractiveObject) anAIS = aIter.Value();
- if ( !anAIS.IsNull() )
- {
- if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
- {
- anIC->Load( anAIS, -1, false );
- anIC->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
- }
- else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
- {
- anIC->Load( anAIS, -1, false );
- anIC->Activate( anAIS, theMode );
- }
- }
- }
-}
-
-//=======================================================================
-// name : GlobalSelection
-// Purpose : Deactivates selection of sub shapes
-//=======================================================================
-void OCCViewer_ViewFrame::GlobalSelection( const bool update ) const
-{
- Handle(AIS_InteractiveContext) anIC = myViewer->getAISContext();
- if ( !anIC.IsNull() )
- anIC->CloseAllContexts( false );
- if ( update )
- anIC->CurrentViewer()->Redraw();
-}
-
-//=======================================================================
-// name : BeforeDisplay
-// Purpose : Axiluary method called before displaying of objects
-//=======================================================================
-void OCCViewer_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
-{
- d->BeforeDisplay( this, SALOME_OCCViewType() );
-}
-
-//=======================================================================
-// name : AfterDisplay
-// Purpose : Axiluary method called after displaying of objects
-//=======================================================================
-void OCCViewer_ViewFrame::AfterDisplay( SALOME_Displayer* d )
-{
- d->AfterDisplay( this, SALOME_OCCViewType() );
-}
-
-#define INCREMENT_FOR_OP 10
-
-//=======================================================================
-// name : onPanLeft
-// Purpose : Performs incremental panning to the left
-//=======================================================================
-void OCCViewer_ViewFrame::onPanLeft()
-{
- myViewPort->incrementalPan( -INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onPanRight
-// Purpose : Performs incremental panning to the right
-//=======================================================================
-void OCCViewer_ViewFrame::onPanRight()
-{
- myViewPort->incrementalPan( INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onPanUp
-// Purpose : Performs incremental panning to the top
-//=======================================================================
-void OCCViewer_ViewFrame::onPanUp()
-{
- myViewPort->incrementalPan( 0, INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onPanDown
-// Purpose : Performs incremental panning to the bottom
-//=======================================================================
-void OCCViewer_ViewFrame::onPanDown()
-{
- myViewPort->incrementalPan( 0, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onZoomIn
-// Purpose : Performs incremental zooming in
-//=======================================================================
-void OCCViewer_ViewFrame::onZoomIn()
-{
- myViewPort->incrementalZoom( INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onZoomOut
-// Purpose : Performs incremental zooming out
-//=======================================================================
-void OCCViewer_ViewFrame::onZoomOut()
-{
- myViewPort->incrementalZoom( -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onRotateLeft
-// Purpose : Performs incremental rotating to the left
-//=======================================================================
-void OCCViewer_ViewFrame::onRotateLeft()
-{
- myViewPort->incrementalRotate( -INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onRotateRight
-// Purpose : Performs incremental rotating to the right
-//=======================================================================
-void OCCViewer_ViewFrame::onRotateRight()
-{
- myViewPort->incrementalRotate( INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onRotateUp
-// Purpose : Performs incremental rotating to the top
-//=======================================================================
-void OCCViewer_ViewFrame::onRotateUp()
-{
- myViewPort->incrementalRotate( 0, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onRotateDown
-// Purpose : Performs incremental rotating to the bottom
-//=======================================================================
-void OCCViewer_ViewFrame::onRotateDown()
-{
- myViewPort->incrementalRotate( 0, INCREMENT_FOR_OP );
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_ViewFrame_H
-#define OCCViewer_ViewFrame_H
-
-#include "OCCViewer_ViewPort.h"
-#include "QAD_ViewFrame.h"
-#include "SALOME_Selection.h"
-
-class OCCViewer_Viewer3d;
-
-/*
- Class : OCCViewer_ViewFrame
- Description : View frame for Open CASCADE view
-*/
-
-class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
-{
- Q_OBJECT
-
-public:
-
- OCCViewer_ViewFrame( QWidget* parent, const QString& title );
- OCCViewer_ViewFrame( QWidget* parent = 0 );
- virtual ~OCCViewer_ViewFrame();
-
- /*
- Reimplemented from QAD_ViewFrame
- */
-
- virtual ViewType getTypeView() const { return VIEW_OCC; }
- virtual QWidget* getViewWidget();
- virtual void setBackgroundColor( const QColor& );
- virtual QColor backgroundColor() const;
- virtual void SetSelectionMode( Selection_Mode mode ) {};
-
- /* popup management */
-
- virtual void setPopupServer( QAD_Application* );
-
- /* interactive object management */
-
- virtual void highlight( const Handle(SALOME_InteractiveObject)&,
- const bool highlight,
- const bool update = true );
- virtual void unHighlightAll();
- virtual void rename( const Handle(SALOME_InteractiveObject)&,
- QString );
- virtual bool isInViewer( const Handle(SALOME_InteractiveObject)& );
- virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
-
- /* undo/redo management */
-
- void undo( QAD_Study* aStudy, const char* StudyFrameEntry );
- void redo( QAD_Study* aStudy, const char* StudyFrameEntry );
-
- /* selection */
-
- virtual Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );
-
- /* display */
- virtual void Display( const Handle(SALOME_InteractiveObject)&,
- bool update = true);
- virtual void DisplayOnly( const Handle(SALOME_InteractiveObject)& );
- virtual void Erase( const Handle(SALOME_InteractiveObject)&,
- bool update = true);
- virtual void DisplayAll();
- virtual void EraseAll();
- virtual void Repaint();
-
- void AdjustTrihedrons( const bool forced = false );
-
- /* Reimplemented from SALOME_View */
-
- virtual void Display( const SALOME_OCCPrs* );
- virtual void Erase( const SALOME_OCCPrs*, const bool = false );
- virtual SALOME_Prs* CreatePrs( const char* entry = 0 );
- virtual void BeforeDisplay( SALOME_Displayer* d );
- virtual void AfterDisplay ( SALOME_Displayer* d );
- virtual void LocalSelection( const SALOME_OCCPrs*, const int );
- virtual void GlobalSelection( const bool = false ) const;
-
- /* Own public methods */
-
- void setViewPort( OCCViewer_ViewPort* );
- OCCViewer_ViewPort* getViewPort() const;
-
- void setViewer( OCCViewer_Viewer3d* );
- OCCViewer_Viewer3d* getViewer() const;
-
- void setVisible( const bool isVisible = true );
-
- void setCursor( const QCursor& );
- QCursor cursor() const;
-
-signals:
-
- void vfTransformationStarted ( OCCViewer_ViewPort::OperationType );
- void vfTransformationFinished( OCCViewer_ViewPort::OperationType );
- void vfDrawExternal( QPainter* painter );
- void vfMousePress( QMouseEvent* );
- void vfMouseRelease( QMouseEvent* );
- void vfMouseMove( QMouseEvent* );
- void vfMouseDoubleClick( QMouseEvent* );
- void vfKeyPress( QKeyEvent* );
- void vfKeyRelease( QKeyEvent* );
- void vfResize( QResizeEvent* );
- void vfPrint( QPaintEvent* );
- void vfViewClosing( QCloseEvent* );
- void vfMoved ( QMoveEvent* );
-
-public slots:
-
- void onViewPan();
- void onViewZoom();
- void onViewFitAll();
- void onViewFitArea();
- void onViewGlobalPan();
- void onViewRotate();
- void onViewReset();
- void onViewFront();
- void onViewBack();
- void onViewRight();
- void onViewLeft();
- void onViewBottom();
- void onViewTop();
- void onViewTrihedron();
- void onAdjustTrihedron();
-
- void onPanLeft();
- void onPanRight();
- void onPanUp();
- void onPanDown();
- void onZoomIn();
- void onZoomOut();
- void onRotateLeft();
- void onRotateRight();
- void onRotateUp();
- void onRotateDown();
-
-protected:
-
- void initViewPort();
- void initialize();
- void cleanup();
- void closeEvent( QCloseEvent* );
- void resizeEvent( QResizeEvent* );
- void keyPressEvent( QKeyEvent * );
-private:
-
- bool getTrihedronSize( double& theNewSize, double& theSize );
- void redisplayAll( QAD_Study*, const bool = true );
-
-private:
-
- OCCViewer_Viewer3d* myViewer; // my owner
- OCCViewer_ViewPort* myViewPort; // child viewport
-};
-
-#endif
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewPort.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include <stdlib.h>
-
-#if !defined WNT
-#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
-#endif
-
-#include "OCCViewer_ViewPort.h"
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-
-#if !defined WNT
-#include <GL/glx.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xmu/StdCmap.h>
-#undef QT_CLEAN_NAMESPACE
-#include <Xw_Window.hxx>
-#include <Graphic3d_GraphicDevice.hxx>
-
-#include <qpixmap.h>
-#include <qintdict.h>
-
-#include "utilities.h"
-
-using namespace std;
-
-/* XPM */
-const char* imageZoomCursor[] = {
-"32 32 3 1",
-". c None",
-"a c #000000",
-"# c #ffffff",
-"................................",
-"................................",
-".#######........................",
-"..aaaaaaa.......................",
-"................................",
-".............#####..............",
-"...........##.aaaa##............",
-"..........#.aa.....a#...........",
-".........#.a.........#..........",
-".........#a..........#a.........",
-"........#.a...........#.........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-".........#...........#.a........",
-".........#a..........#a.........",
-".........##.........#.a.........",
-"........#####.....##.a..........",
-".......###aaa#####.aa...........",
-"......###aa...aaaaa.......#.....",
-".....###aa................#a....",
-"....###aa.................#a....",
-"...###aa...............#######..",
-"....#aa.................aa#aaaa.",
-".....a....................#a....",
-"..........................#a....",
-"...........................a....",
-"................................",
-"................................",
-"................................",
-"................................"};
-
-const char* imageRotateCursor[] = {
-"32 32 3 1",
-". c None",
-"a c #000000",
-"# c #ffffff",
-"................................",
-"................................",
-"................................",
-"................................",
-"........#.......................",
-".......#.a......................",
-"......#######...................",
-".......#aaaaa#####..............",
-"........#..##.a#aa##........##..",
-".........a#.aa..#..a#.....##.aa.",
-".........#.a.....#...#..##.aa...",
-".........#a.......#..###.aa.....",
-"........#.a.......#a..#aa.......",
-"........#a.........#..#a........",
-"........#a.........#a.#a........",
-"........#a.........#a.#a........",
-"........#a.........#a.#a........",
-".........#.........#a#.a........",
-"........##a........#a#a.........",
-"......##.a#.......#.#.a.........",
-"....##.aa..##.....##.a..........",
-"..##.aa.....a#####.aa...........",
-"...aa.........aaa#a.............",
-"................#.a.............",
-"...............#.a..............",
-"..............#.a...............",
-"...............a................",
-"................................",
-"................................",
-"................................",
-"................................",
-"................................"};
-
-struct CMapEntry {
- CMapEntry();
- ~CMapEntry();
- Colormap cmap;
- bool alloc;
- XStandardColormap scmap;
-};
-
-CMapEntry::CMapEntry()
-{
- cmap = 0;
- alloc = false;
- scmap.colormap = 0;
-}
-
-CMapEntry::~CMapEntry()
-{
- if ( alloc )
- XFreeColormap( QPaintDevice::x11AppDisplay(), cmap );
-}
-
-static QIntDict<CMapEntry> *cmap_dict = 0;
-static bool mesa_gl = false;
-
-static void cleanup_cmaps()
-{
- if ( !cmap_dict )
- return;
- cmap_dict->setAutoDelete(true);
- delete cmap_dict;
- cmap_dict = 0;
-}
-
-static Colormap choose_cmap(Display *dpy, XVisualInfo *vi)
-{
- if ( !cmap_dict )
- {
- cmap_dict = new QIntDict<CMapEntry>;
- const char *v = glXQueryServerString( dpy, vi->screen, GLX_VERSION );
- mesa_gl = strstr(v,"Mesa") != 0;
- qAddPostRoutine( cleanup_cmaps );
- }
-
- CMapEntry *x = cmap_dict->find( (long)vi->visualid );
- if ( x ) // found colormap for visual
- return x->cmap;
-
- x = new CMapEntry();
-
- XStandardColormap *c;
- int n, i;
-
-#ifdef DEBUG
- MESSAGE( "Choosing cmap for vID = " << vi->visualid );
-#endif
-
- if ( vi->visualid == XVisualIDFromVisual( (Visual*)QPaintDevice::x11AppVisual() ) )
- {
-#ifdef DEBUG
- MESSAGE( "Using x11AppColormap" );
-#endif
- return QPaintDevice::x11AppColormap();
- }
-
- if ( mesa_gl )
- {
- Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
- if ( hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8 )
- {
- if ( XGetRGBColormaps(dpy, RootWindow(dpy,vi->screen), &c, &n, hp_cmaps) )
- {
- i = 0;
- while ( i < n && x->cmap == 0 )
- {
- if ( c[i].visualid == vi->visual->visualid )
- {
- x->cmap = c[i].colormap;
- x->scmap = c[i];
- // Using HP_RGB scmap
- }
- i++;
- }
- XFree( (char *)c );
- }
- }
- }
-
-#if !defined(_OS_SOLARIS_)
- if ( !x->cmap )
- {
- if ( XmuLookupStandardColormap(dpy,vi->screen,vi->visualid,vi->depth,
- XA_RGB_DEFAULT_MAP,false,true) )
- {
- if ( XGetRGBColormaps(dpy,RootWindow(dpy,vi->screen),&c,&n,
- XA_RGB_DEFAULT_MAP) )
- {
- i = 0;
- while ( i < n && x->cmap == 0 )
- {
- if ( c[i].visualid == vi->visualid )
- {
- x->cmap = c[i].colormap;
- x->scmap = c[i];
- // Using RGB_DEFAULT scmap
- }
- i++;
- }
- XFree( (char *)c );
- }
- }
- }
-#endif
- if ( !x->cmap )
- {
- // no shared cmap found
- x->cmap = XCreateColormap( dpy, RootWindow(dpy,vi->screen), vi->visual,
- AllocNone );
- x->alloc = true;
- // Allocating cmap
- }
-
- cmap_dict->insert( (long)vi->visualid, x ); // associate cmap with visualid
- return x->cmap;
-}
-#endif
-
-/* statics */
-int OCCViewer_ViewPort::nCounter = 0;
-QCursor* OCCViewer_ViewPort::defCursor = NULL;
-QCursor* OCCViewer_ViewPort::handCursor = NULL;
-QCursor* OCCViewer_ViewPort::panCursor = NULL;
-QCursor* OCCViewer_ViewPort::zoomCursor = NULL;
-QCursor* OCCViewer_ViewPort::rotCursor = NULL;
-QCursor* OCCViewer_ViewPort::glPanCursor = NULL;
-
-/*!
- Creates the necessary viewport cursors [ static ]
-*/
-void OCCViewer_ViewPort::createCursors ()
-{
- defCursor = new QCursor ( ArrowCursor );
- handCursor = new QCursor ( PointingHandCursor );
- panCursor = new QCursor ( SizeAllCursor );
- zoomCursor = new QCursor (QPixmap(imageZoomCursor));
- rotCursor = new QCursor (QPixmap(imageRotateCursor));
- glPanCursor = new QCursor (CrossCursor);
-// QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
-// zoomCursor = new QCursor ( rmgr->loadPixmap( "QAD", tr("ICON_CURSOR_ZOOM") ));
-// rotCursor = new QCursor ( rmgr->loadPixmap( "QAD", tr("ICON_CURSOR_ROTATE") ));
-}
-
-/*!
- Destroys the viewport cursors [ static ]
-*/
-void OCCViewer_ViewPort::destroyCursors ()
-{
- if ( defCursor ) delete defCursor;
- defCursor = 0;
- if ( handCursor ) delete handCursor;
- handCursor = 0;
- if ( panCursor ) delete panCursor;
- panCursor = 0;
- if ( zoomCursor ) delete zoomCursor;
- zoomCursor = 0;
- if ( rotCursor ) delete rotCursor;
- rotCursor = 0;
- if ( glPanCursor ) delete glPanCursor;
- glPanCursor = 0;
-}
-
-/*!
- Sets new default cursor [ static ]
-*/
-void OCCViewer_ViewPort::setDefaultCursor(const QCursor& newCursor)
-{
- if ( !defCursor ) defCursor = new QCursor;
- *defCursor = newCursor;
-}
-
-/*!
- Sets new cursor for drawing rectangle in the viewport [ static ]
-*/
-void OCCViewer_ViewPort::setHandCursor(const QCursor& newCursor)
-{
- if ( !handCursor ) handCursor = new QCursor;
- *handCursor = newCursor;
-}
-
-/*!
- Sets new cursor for panning [ static ]
-*/
-void OCCViewer_ViewPort::setPanCursor(const QCursor& newCursor)
-{
- if ( !panCursor ) panCursor = new QCursor;
- *panCursor = newCursor;
-}
-
-/*!
- Sets new cursor for zooming [ static ]
-*/
-void OCCViewer_ViewPort::setZoomCursor(const QCursor& newCursor)
-{
- if ( !zoomCursor ) zoomCursor = new QCursor;
- *zoomCursor = newCursor;
-}
-
-/*!
- Sets new cursor for rotating [ static ]
-*/
-void OCCViewer_ViewPort::setRotCursor(const QCursor& newCursor)
-{
- if ( !rotCursor ) rotCursor = new QCursor;
- *rotCursor = newCursor;
-}
-
-/*!
- Sets new cursor for global panning [ static ]
-*/
-void OCCViewer_ViewPort::setGlPanCursor(const QCursor& newCursor)
-{
- if ( !glPanCursor ) glPanCursor = new QCursor;
- *glPanCursor = newCursor;
-}
-
-/*!
- Constructor
-*/
-OCCViewer_ViewPort::OCCViewer_ViewPort(QWidget* parent) :
- QWidget( parent, 0, WRepaintNoErase | WResizeNoErase)
-{
- initialize();
-}
-
-/*!
- Destructor
-*/
-OCCViewer_ViewPort::~OCCViewer_ViewPort()
-{
- cleanup();
-}
-
-/*!
- Initializes viewport
-*/
-void OCCViewer_ViewPort::initialize()
-{
- /* initialize cursors */
- if ( nCounter++ == 0 ) createCursors();
-
-#if !defined WNT
-
- XVisualInfo* pVisualInfo;
- if ( x11Display() )
- {
- /* Initialization with the default VisualID
- */
- //NRI Visual *v = DefaultVisual(x11Display(), DefaultScreen(x11Display()));
- //NRI int visualID = XVisualIDFromVisual(v);
-
- /* Here we use the settings from
- Optimizer_ViewInfo::TxglCreateWindow()
- */
- int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1,
- GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER,
- None };
-
- pVisualInfo = ::glXChooseVisual (x11Display(), DefaultScreen(x11Display()), visualAttr);
-
- if ( isVisible() ) hide();
-
- XSetWindowAttributes a;
-
- a.colormap = choose_cmap( x11Display(), pVisualInfo ); /* find best colormap */
- a.background_pixel = backgroundColor().pixel();
- a.border_pixel = black.pixel();
- Window p = RootWindow( x11Display(), DefaultScreen(x11Display()) );
- if ( parentWidget() ) p = parentWidget()->winId();
-
- Window w = XCreateWindow( x11Display(), p, x(), y(), width(), height(),
- 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
- CWBackPixel | CWBorderPixel | CWColormap, &a );
- Window *cmw;
- Window *cmwret;
- int count;
- if ( XGetWMColormapWindows( x11Display(), topLevelWidget()->winId(), &cmwret, &count ) )
- {
- cmw = new Window[count+1];
- memcpy( (char *)cmw, (char *)cmwret, sizeof(Window)*count );
- XFree( (char *)cmwret );
- int i;
-
- for (i = 0; i < count; i++)
- {
- if ( cmw[i] == winId() ) /* replace old window */
- {
- cmw[i] = w;
- break;
- }
- }
-
- if ( i >= count ) /* append new window */
- cmw[count++] = w;
- }
- else
- {
- count = 1;
- cmw = new Window[count];
- cmw[0] = w;
- }
-
- /* Creating new window (with good VisualID) for this widget
- */
- create(w);
- XSetWMColormapWindows( x11Display(), topLevelWidget()->winId(), cmw, count );
- delete [] cmw;
-
- if ( isVisible() ) show();
-
- if ( pVisualInfo ) {
- XFree( (char *)pVisualInfo );
- }
-
- XFlush(x11Display());
- // XSync(x11Display(), false);
- // XSynchronize(x11Display(), true);
- }
-#endif // !defined WNT
-
- myOriginalViewport = NULL;
- myCursorIsHand = false;
- myCursor = *defCursor;
- myHasWindow = false;
- myDrawRect = false;
- myStartX = myStartY = myCurrX = myCurrY =0;
- myPaintersRedrawing = false;
- myEnableDrawMode = true;
-
- setTransformRequested ( NOTHING );
- setTransformInProcess ( false );
-
- setMouseTracking( true );
- setBackgroundMode(NoBackground);
-
- setFocus();
-}
-
-/*!
- Cleans up the viewport
-*/
-void OCCViewer_ViewPort::cleanup()
-{
- if ( --nCounter == 0 )
- destroyCursors();
-}
-
-/*!
- Sets the original view for the viewport
-*/
-void OCCViewer_ViewPort::setOriginalView( OCCViewer_ViewPort* viewport,
- const QRect& magnify )
-{
- myOriginalViewport = viewport;
- myMagnifyRect = magnify;
-}
-
-/*!
- Returns the original view or null
-*/
-OCCViewer_ViewPort* OCCViewer_ViewPort::getOriginalView() const
-{
- return myOriginalViewport;
-}
-
-/*!
- Returns the 'magnify' rect ( used for 'magnify' operation )
-*/
-const QRect& OCCViewer_ViewPort::getMagnifyRect() const
-{
- return myMagnifyRect;
-}
-
-/*!
- Returns the sketched rect ( used for multiple selection )
-*/
-const QRect& OCCViewer_ViewPort::getSelectionRect() const
-{
- return myRect;
-}
-
-/*!
- Returns 'true' if the viewport has a native window
-*/
-bool OCCViewer_ViewPort::hasWindow() const
-{
- return myHasWindow;
-}
-
-/*!
- Must be called if native window was changed
-*/
-void OCCViewer_ViewPort::windowChanged()
-{
- myHasWindow = false;
-}
-
-/*!
- Sets the default cursor active
-*/
-void OCCViewer_ViewPort::setDefaultCursorOn()
-{
- setCursor ( *OCCViewer_ViewPort::defCursor );
-}
-
-/*!
- Sets the 'hand' cursor active
-*/
-void OCCViewer_ViewPort::setHandCursorOn()
-{
- setCursor ( *OCCViewer_ViewPort::handCursor );
-}
-
-/*!
- Sets the panning cursor active
-*/
-void OCCViewer_ViewPort::setPanCursorOn()
-{
- setCursor( *OCCViewer_ViewPort::panCursor );
-}
-
-/*!
- Sets the zooming cursor active
-*/
-void OCCViewer_ViewPort::setZoomCursorOn()
-{
- setCursor( *OCCViewer_ViewPort::zoomCursor );
-}
-
-/*!
- Sets the rotating cursor active
-*/
-void OCCViewer_ViewPort::setRotCursorOn()
-{
- setCursor( *OCCViewer_ViewPort::rotCursor );
-}
-
-/*!
- Sets the global panning cursor active
-*/
-void OCCViewer_ViewPort::setGlPanCursorOn()
-{
- setCursor( *OCCViewer_ViewPort::glPanCursor );
-}
-
-/*!
- Returns the default background color
-*/
-QColor OCCViewer_ViewPort::backgroundColor() const
-{
- return Qt::white;
-}
-
-/*!
- Activates 'zoom' transformation
-*/
-void OCCViewer_ViewPort::activateZoom()
-{
- if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
-
- if ( myOperation != ZOOMVIEW ) {
- setTransformRequested ( ZOOMVIEW );
- setCursor( *zoomCursor );
- }
-}
-
-/*!
- Activates 'panning' transformation
-*/
-void OCCViewer_ViewPort::activatePanning()
-{
- if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
-
- if ( myOperation != PANVIEW ) {
- setTransformRequested ( PANVIEW );
- setCursor( *panCursor );
- }
-}
-
-/*!
- Activates 'rotation' transformation
-*/
-void OCCViewer_ViewPort::activateRotation()
-{
- if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
-
- if ( myOperation != ROTATE ) {
- setTransformRequested ( ROTATE );
- setCursor( *rotCursor );
- }
-}
-
-/*!
- Activates 'fit' transformation
-*/
-void OCCViewer_ViewPort::activateWindowFit()
-{
- if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
-
- if ( myOperation != WINDOWFIT ) {
- setTransformRequested ( WINDOWFIT );
- setCursor ( *handCursor );
- myCursorIsHand = true;
- }
-// setTransformInProcess( true );
-// emit vpTransformationStarted ( WINDOWFIT );
-}
-
-/*!
- Activates 'global panning' transformation
-*/
-void OCCViewer_ViewPort::activateGlobalPanning()
-{
- if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
-
- if ( myOperation != PANGLOBAL )
- {
- fitAll(); /* fits view before selecting a new scene center */
- setTransformRequested ( PANGLOBAL );
- setCursor( *glPanCursor );
- }
-// setTransformInProcess( true );
-// emit vpTransformationStarted ( PANGLOBAL );
-}
-
-/*!
- Sets the viewport to its initial state
- ( no transformations in process etc. )
-*/
-void OCCViewer_ViewPort::resetState()
-{
- myDrawRect = false;
-
- /* make rectangle empty (left > right) */
- myRect.setLeft(2);
- myRect.setRight(0);
-
- if ( transformRequested() || myCursorIsHand )
- setCursor( myCursor );
- myCursorIsHand = false;
-
- if ( transformRequested() )
- emit vpTransformationFinished (myOperation);
-
- setTransformInProcess( false );
- setTransformRequested ( NOTHING );
- QAD_Application::getDesktop()->putInfo( tr("INF_READY") );
-}
-
-/*!
- Enable/disable user's ability to sketch a rect in the viewport
-*/
-void OCCViewer_ViewPort::enableDrawMode(bool bEnable )
-{
- myEnableDrawMode = bEnable;
-}
-
-/*!
- Returns 'true' if user can sketch a rect in the viewport
-*/
-bool OCCViewer_ViewPort::enableDrawMode() const
-{
- return myEnableDrawMode;
-}
-
-/*!
- Sets the active operation 'op'
-*/
-void OCCViewer_ViewPort::setTransformRequested ( OperationType op )
-{
- myOperation = op;
- setMouseTracking ( myOperation == NOTHING );
-}
-
-/*!
- Mouse event handler
-*/
-void OCCViewer_ViewPort::mousePressEvent (QMouseEvent* event)
-{
- myStartX = event->x();
- myStartY = event->y();
- switch ( myOperation )
- {
- case WINDOWFIT:
- if ( event->button() == Qt::LeftButton )
- emit vpTransformationStarted ( WINDOWFIT );
- break;
-// return;
- case PANGLOBAL:
- if ( event->button() == Qt::LeftButton )
- emit vpTransformationStarted ( PANGLOBAL );
- break;
-// return;
-
- case ZOOMVIEW:
- if ( event->button() == Qt::LeftButton )
- emit vpTransformationStarted ( ZOOMVIEW );
- break;
-
- case PANVIEW:
- if ( event->button() == Qt::LeftButton )
- emit vpTransformationStarted ( PANVIEW );
- break;
-
- case ROTATE:
- if ( event->button() == Qt::LeftButton )
- {
- startRotation(myStartX, myStartY);
- emit vpTransformationStarted ( ROTATE );
- }
- break;
-
- default:
-
- /* Try to activate a transformation
- */
- if ( (event->state() == Qt::ControlButton) &&
- (event->button() == Qt::LeftButton) )
- {
- /* MB1 + CTRL = Zooming */
- activateZoom();
- }
- else if ( (event->state() == Qt::ControlButton) &&
- (event->button() == Qt::MidButton) )
- {
- /* MB2 + CTRL = Panning */
- activatePanning();
- }
- else if ( (event->state() == Qt::ControlButton) &&
- (event->button() == Qt::RightButton) )
- {
- /* MB3 + CTRL = Rotation */
- activateRotation();
- startRotation(myStartX, myStartY);
- }
-
- /* notify that we start a transformation */
- if ( transformRequested() )
- emit vpTransformationStarted ( myOperation );
- }
-
- if ( transformRequested() )
- setTransformInProcess( true );
-
- /* NOTE: this signal must be emitted at the end
- because we must to detect a transformation first
- */
- emit vpMousePress (event);
-}
-
-/*!
- Mouse event handler
-*/
-void OCCViewer_ViewPort::mouseMoveEvent (QMouseEvent* event)
-{
- myCurrX = event->x();
- myCurrY = event->y();
- switch (myOperation)
- {
- case ROTATE:
- rotate(myCurrX, myCurrY);
- break;
-
- case ZOOMVIEW:
- zoom(myStartX, myStartY, myCurrX, myCurrY);
- myStartX = myCurrX;
- myStartY = myCurrY;
- break;
-
- case PANVIEW:
- pan(myCurrX - myStartX, myStartY - myCurrY);
- myStartX = myCurrX;
- myStartY = myCurrY;
- break;
-
-/* case WINDOWFIT:
- myDrawRect = true;
- repaint();
- break;
-*/
- case PANGLOBAL:
- break;
-
- default:
- if ( event->state() == Qt::LeftButton ||
- event->state() == ( Qt::LeftButton | Qt::ShiftButton) )
- {
- myDrawRect = myEnableDrawMode;
- if ( myDrawRect )
- {
- repaint( visibleRect(), false);
- if ( !myCursorIsHand )
- { /* we are going to sketch a rectangle */
- myCursorIsHand = true;
- myCursor = cursor();
- setCursor ( *handCursor );
- }
- }
- }
- }
- emit vpMouseMove( event );
-}
-
-/*!
- Mouse event handler
-*/
-void OCCViewer_ViewPort::mouseReleaseEvent (QMouseEvent* event)
-{
- if ( !transformRequested() && (event->button() == Qt::RightButton) )
- {
- QPopupMenu* popup = createPopup();
- if ( popup ) {
- QAD_Tools::checkPopup( popup );
- if ( popup->count()>0 ) {
- popup->exec( QCursor::pos() );
- }
- destroyPopup();
- }
- return;
- }
-
- switch ( myOperation )
- {
- case NOTHING:
- break;
- case ROTATE:
- endRotation();
- resetState();
- break;
-
- case PANVIEW:
- case ZOOMVIEW:
- resetState();
- break;
-
- case PANGLOBAL:
- if ( event->button() == Qt::LeftButton )
- {
- setCenter( event->x(), event->y() );
- resetState();
- }
- break;
-
- case WINDOWFIT:
- if ( event->state() == Qt::LeftButton )
- {
- myCurrX = event->x();
- myCurrY = event->y();
- QRect rect = QAD_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
- if ( !rect.isEmpty() ) fitWindow(rect);
- resetState();
- }
- break;
- }
-
- // NOTE: viewer 3D detects a rectangle of selection using this event
- // so we must emit it BEFORE resetting the selection rectangle
- emit vpMouseRelease (event);
-
- if ( event->button() == Qt::LeftButton && myDrawRect )
- {
- myDrawRect = false;
- repaint(visibleRect(), false);
- resetState();
- }
-}
-
-/*!
- Mouse event handler
-*/
-void OCCViewer_ViewPort::mouseDoubleClickEvent(QMouseEvent *event)
-{
- emit vpMouseDoubleClick (event);
-}
-
-/*!
- Key event handler
-*/
-void OCCViewer_ViewPort::keyPressEvent(QKeyEvent *event)
-{
- emit vpKeyPress (event);
-}
-
-/*!
- Key event handler
-*/
-void OCCViewer_ViewPort::keyReleaseEvent(QKeyEvent *event)
-{
- emit vpKeyRelease (event);
-}
-
-/*!
- Called when the viewport gets the focus
-*/
-void OCCViewer_ViewPort::focusInEvent(QFocusEvent *event)
-{
- emit vpFocusIn (event);
-}
-
-/*!
- Called when the viewport loses the focus
-*/
-void OCCViewer_ViewPort::focusOutEvent(QFocusEvent *event)
-{
- emit vpFocusOut (event);
-}
-
-/*!
- Resizes the viewport
-*/
-void OCCViewer_ViewPort::resizeEvent (QResizeEvent* event)
-{
- windowResize();
-}
-
-/*!
- Updates the viewport
-*/
-void OCCViewer_ViewPort::update(int x, int y, int w, int h)
-{
- if ( !myHasWindow )
- myHasWindow = setWindow();
- if ( myHasWindow)
- repaint(x, y, w, h, true);
-}
-
-/*!
- Repaints the viewport
-*/
-void OCCViewer_ViewPort::paintEvent (QPaintEvent *ev)
-{
- emit vpPaint (ev);
- if ( myDrawRect )
- {
- QPainter thePainter(this);
- thePainter.setRasterOp(Qt::XorROP);
- thePainter.setPen(Qt::white);
- QRect aRect = QAD_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
- if ( !myRect.isEmpty() )
- thePainter.drawRect( myRect );
- thePainter.drawRect(aRect);
- myRect = aRect;
- }
-
- if ( myPaintersRedrawing )
- {
- QPainter thePainter(this);
- emit vpDrawExternal (&thePainter);
- myPaintersRedrawing = false;
- }
-}
-
-/*!
- Forces to redraw the viewport by an external painter
-*/
-void OCCViewer_ViewPort::redrawPainters()
-{
- myPaintersRedrawing = true;
- repaint();
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewPort.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_ViewPort_H
-#define OCCViewer_ViewPort_H
-
-#include "QAD.h"
-#include "QAD_Popup.h"
-
-// QT Includes
-#include <qrect.h>
-#include <qcolor.h>
-#include <qwidget.h>
-#include <qcursor.h>
-#include <qpainter.h>
-
-class QAD_EXPORT OCCViewer_ViewPort: public QWidget,
- public QAD_PopupClientServer
-{
- Q_OBJECT
-
- /* Objects counter */
- static int nCounter;
-
- /* Cursors */
- static QCursor* defCursor;
- static QCursor* handCursor;
- static QCursor* panCursor;
- static QCursor* zoomCursor;
- static QCursor* rotCursor;
- static QCursor* glPanCursor;
-
- void initialize();
- void cleanup();
-
-public:
- enum OperationType {
- NOTHING,
- PANVIEW,
- ZOOMVIEW,
- ROTATE,
- PANGLOBAL,
- WINDOWFIT
- };
-
-protected:
- static void createCursors();
- static void destroyCursors();
-
- static const QCursor* getDefaultCursor() { return defCursor; }
- static void setDefaultCursor(const QCursor& newCursor);
- static const QCursor* getHandCursor() { return handCursor; }
- static void setHandCursor(const QCursor& newCursor);
- static const QCursor* getPanCursor() { return panCursor; }
- static void setPanCursor(const QCursor& newCursor);
- static const QCursor* getZoomCursor() { return zoomCursor; }
- static void setZoomCursor(const QCursor& newCursor);
- static const QCursor* getRotCursor() { return rotCursor; }
- static void setRotCursor(const QCursor& newCursor);
- static const QCursor* getGlPanCursor() { return rotCursor; }
- static void setGlPanCursor(const QCursor& newCursor);
-
- /* Transformation selected but not started yet */
- bool transformRequested() const { return ( myOperation != NOTHING ); }
- void setTransformRequested ( OperationType op );
-
- /* Transformation is selected and already started */
- bool transformInProcess() const { return myEventStarted; }
- void setTransformInProcess( bool bOn ) { myEventStarted = bOn; }
-
-public:
- OCCViewer_ViewPort( QWidget* parent );
- ~OCCViewer_ViewPort();
-
- /* Draw mode management */
- void enableDrawMode( bool bEnable );
- bool enableDrawMode() const;
-
- /* Cursors management */
- void setDefaultCursorOn();
- void setHandCursorOn();
- void setPanCursorOn();
- void setZoomCursorOn();
- void setRotCursorOn();
- void setGlPanCursorOn();
-
- void resetState();
- bool hasWindow() const;
- void windowChanged();
- void redrawPainters();
- void update(int x, int y, int w, int h);
-
- void setOriginalView( OCCViewer_ViewPort* view, const QRect& magnify );
- OCCViewer_ViewPort* getOriginalView() const;
- const QRect& getMagnifyRect() const;
- const QRect& getSelectionRect() const;
-
- /* View transformations */
- virtual void activateZoom();
- virtual void activatePanning();
- virtual void activateRotation();
- virtual void activateWindowFit();
- virtual void activateGlobalPanning();
-
- virtual void fitAll( bool withZ = true ) = 0;
- virtual void reset() = 0;
-
- virtual void incrementalPan ( const int incrX, const int incrY ) = 0;
- virtual void incrementalZoom ( const int incr ) = 0;
- virtual void incrementalRotate( const int incrX, const int incrY ) = 0;
-
- /* background color */
- virtual QColor backgroundColor() const;
- virtual void setBackgroundColor( const QColor& color) = 0;
-
-protected:
- virtual void paintEvent(QPaintEvent *);
- virtual void resizeEvent(QResizeEvent *);
-
- virtual void mouseMoveEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseDoubleClickEvent(QMouseEvent *);
-
- virtual void keyPressEvent(QKeyEvent *);
- virtual void keyReleaseEvent(QKeyEvent *);
-
- virtual void focusInEvent(QFocusEvent *event);
- virtual void focusOutEvent(QFocusEvent *event);
-
-signals:
- void vpTransformationStarted (OCCViewer_ViewPort::OperationType type);
- void vpTransformationFinished (OCCViewer_ViewPort::OperationType type);
-
- void vpMousePress (QMouseEvent*);
- void vpMouseRelease (QMouseEvent*);
- void vpMouseMove (QMouseEvent*);
- void vpMouseDoubleClick (QMouseEvent*);
-
- void vpKeyPress (QKeyEvent*);
- void vpKeyRelease (QKeyEvent*);
-
- void vpFocusOut (QFocusEvent*);
- void vpFocusIn (QFocusEvent*);
-
- void vpPaint (QPaintEvent*);
- void vpDrawExternal (QPainter* painter);
-
-protected slots:
- virtual void onChangeBackgroundColor() = 0;
-
-protected:
- virtual bool setWindow() = 0;
- virtual void windowResize() = 0;
- virtual void pan(int dx, int dy) = 0;
- virtual void setCenter(int x, int y) = 0;
- virtual void fitWindow( const QRect& rect) = 0;
- virtual void zoom(int x0, int y0, int x, int y) = 0;
- virtual void startRotation(int x0, int y0) = 0;
- virtual void rotate(int x, int y) = 0;
- virtual void endRotation() = 0;
-
-protected:
- OCCViewer_ViewPort* myOriginalViewport;
- OperationType myOperation;
- QCursor myCursor;
-
- QRect myMagnifyRect;
- QRect myRect;
- bool myDrawRect; /* set when a rect is used for selection or magnify */
-
- /* Mouse coordinates */
- int myStartX;
- int myStartY;
- int myCurrX;
- int myCurrY;
-
- bool myHasWindow;
- bool myCursorIsHand;
- bool myEnableDrawMode;
- bool myEventStarted; /* set when transformation is in process */
- bool myPaintersRedrawing; /* set to draw with external painters */
-};
-
-#endif
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewPort3d.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "OCCViewer_ViewPort3d.h"
-
-#include "QAD.h"
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "SALOME_Selection.h"
-
-// QT Include
-#include <qcolordialog.h>
-
-// Open CASCADE Includes
-#include <V3d_PerspectiveView.hxx>
-#include <V3d_OrthographicView.hxx>
-
-#if !defined WNT
-#include <Xw.hxx>
-#endif
-
-using namespace std;
-
-/*!
- Constructor
-*/
-OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_Viewer)& viewer,
- V3d_TypeOfView viewType, OCCViewer_ViewPort* prevView ,
- const QRect* magnify ) :
- OCCViewer_ViewPort( parent )
-{
- if ( viewType == V3d_ORTHOGRAPHIC )
- myActiveView = new V3d_OrthographicView( viewer );
- else
- myActiveView = new V3d_PerspectiveView( viewer );
-
- myCurScale = 1.0;
- myDegenerated = true;
-
- myActiveView->SetDegenerateModeOn();
-
- if ( prevView ) setOriginalView( prevView, *magnify );
-}
-
-/*!
- Destructor
-*/
-OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d()
-{
- myActiveView->Remove();
-}
-
-/*!
- Creates the popup
-*/
-void OCCViewer_ViewPort3d::onCreatePopup()
-{
- if ( myPopup ) {
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
-
- QString theContext;
- QString theParent("Viewer");
- QString theObject;
-
- Desktop->definePopup( theContext, theParent, theObject );
- Desktop->createPopup( myPopup, theContext, theParent, theObject);
- Desktop->customPopup( myPopup, theContext, theParent, theObject );
-
-// if (Sel->IObjectCount() == 0 && myPopup->count()<1) {
- if ( myPopup->count() > 0 )
- myIDs.append ( myPopup->insertSeparator() );
- int id;
- myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
- QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
-// }
- }
-}
-
-/*!
- Sets new CASCADE view on viewport.
- Returns the previous view or null if the view hasn't been set.
-*/
-Handle (V3d_View) OCCViewer_ViewPort3d::setView( const Handle (V3d_View)& view )
-{
- Handle (V3d_View) oldView = myActiveView;
- myActiveView = view;
- if ( hasWindow() ) setWindow();
- return oldView;
-}
-
-/*!
- Returns CasCade 3D view
-*/
-Handle(V3d_View) OCCViewer_ViewPort3d::getView() const
-{
- return myActiveView;
-}
-
-/*!
- Returns CasCade 3D viewer
-*/
-Handle (V3d_Viewer) OCCViewer_ViewPort3d::getViewer() const
-{
- Handle (V3d_Viewer) viewer;
- if ( !myActiveView.IsNull() )
- viewer = myActiveView->Viewer();
- return viewer;
-}
-
-/*!
- Passed the handle of native window of the component to CASCADE view
- (sets window handle for V3d_View class instance).
-*/
-bool OCCViewer_ViewPort3d::setWindow()
-{
- if ( !myActiveView.IsNull() )
- {
- int windowHandle = (int) winId();
- if ( windowHandle == 0 )
- return false;
-
- short hi, lo;
- lo = (short) windowHandle;
- hi = (short) (windowHandle >> 16);
-
- OCCViewer_ViewPort* preView = getOriginalView();
- if ( preView )
- {
- /* Create new window ( 'magnify' operation )
- */
- Handle (V3d_View) view;
- QRect rect = getMagnifyRect();
- if ( preView->inherits("OCCViewer_ViewPort3d") )
- {
- view = ((OCCViewer_ViewPort3d*)preView)->getView();
- }
- if ( !view.IsNull() && !rect.isEmpty() )
- {
- OCCViewer_VService::SetMagnify(myActiveView, (int)hi, (int) lo, view,
- rect.x(), rect.y(),
- rect.x() + rect.width(), rect.y() + rect.height(),
- Xw_WQ_SAMEQUALITY);
- return true;
- }
- }
-
- /* CasCade will use our widget as the drawing window */
- OCCViewer_VService::SetWindow( myActiveView, (int) hi, (int) lo, Xw_WQ_SAMEQUALITY);
- return true;
- }
- return false;
-}
-
-/*!
- Forces the CASCADE view to resize window
-*/
-void OCCViewer_ViewPort3d::windowResize()
-{
- QApplication::syncX();
- if ( !myActiveView.IsNull() )
- myActiveView->MustBeResized();
-}
-
-/*!
- Called at 'window fit' transformation
-*/
-void OCCViewer_ViewPort3d::fitWindow(const QRect& rect)
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->WindowFit( rect.x(), rect.y(), rect.x() + rect.width(),
- rect.y() + rect.height());
- }
-}
-
-/*!
- Called at 'zoom' transformation
-*/
-void OCCViewer_ViewPort3d::zoom(int x0, int y0, int x, int y)
-{
- if ( !myActiveView.IsNull() )
- myActiveView->Zoom(x0, y0, x, y);
-}
-
-/*!
- Centers the viewport
-*/
-void OCCViewer_ViewPort3d::setCenter(int x, int y)
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->Place(x, y, myCurScale);
- }
-}
-
-/*!
- Called at 'pan' transformation
-*/
-void OCCViewer_ViewPort3d::pan(int dx, int dy)
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->Pan(dx, dy, 1.0);
- }
-}
-
-/*!
- Inits 'rotation' transformation
-*/
-void OCCViewer_ViewPort3d::startRotation(int x0, int y0)
-{
- if ( !myActiveView.IsNull() )
- {
- myDegenerated = myActiveView->DegenerateModeIsOn();
- myActiveView->SetDegenerateModeOn();
- myActiveView->StartRotation(x0, y0);
- }
-}
-
-/*!
- Rotates the viewport
-*/
-void OCCViewer_ViewPort3d::rotate(int x, int y)
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->Rotation(x, y);
- }
-}
-
-/*!
- Resets the viewport after 'rotation'
-*/
-void OCCViewer_ViewPort3d::endRotation()
-{
- if ( !myActiveView.IsNull() )
- {
- if ( !myDegenerated )
- myActiveView->SetDegenerateModeOff();
- }
-}
-
-/*!
- Called to update the background color
-*/
-QColor OCCViewer_ViewPort3d::backgroundColor() const
-{
- if ( !myActiveView.IsNull() )
- {
- Standard_Real aRed, aGreen, aBlue;
- myActiveView->BackgroundColor(Quantity_TOC_RGB, aRed, aGreen, aBlue);
- int red = (int) (aRed * 255);
- int green = (int) (aGreen * 255);
- int blue = (int) (aBlue * 255);
- return QColor(red, green, blue);
- }
- return OCCViewer_ViewPort::backgroundColor();
-}
-
-/*!
- Sets the background color
-*/
-void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color)
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255.,
- color.green()/255., color.blue()/255.);
-
- /* VSR : PAL5420 ---------------------------------------------------
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorRed", color.red() );
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorGreen", color.green() );
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorBlue", color.blue() );
- VSR : PAL5420 --------------------------------------------------- */
- myActiveView->Update();
- }
-}
-
-/*!
- Sets the background color with color selection dialog
-*/
-void OCCViewer_ViewPort3d::onChangeBackgroundColor()
-{
- if ( !myActiveView.IsNull() )
- {
- QColor selColor = QColorDialog::getColor ( backgroundColor(), this );
- if ( selColor.isValid() )
- {
- setBackgroundColor( selColor );
- }
- }
-}
-
-/*!
- Repaints the viewport
-*/
-void OCCViewer_ViewPort3d::paintEvent (QPaintEvent* e )
-{
- if ( myActiveView.IsNull() )
- {
- QPainter thePainter (this);
- thePainter.drawText(50, 50, QObject::tr("ERR_VP_NOVIEW"), 7);
- }
- else
- {
- QApplication::syncX();
- if ( !myHasWindow )
- {
- myHasWindow = setWindow();
- if ( myHasWindow ) fitAll();
- }
- if ( myHasWindow )
- {
- QRect visibleRect = e->rect();
- if ( (!myDrawRect) && (!myPaintersRedrawing) )
- {
- myActiveView->Redraw ( visibleRect.x(), visibleRect.y(), visibleRect.width(),
- visibleRect.height());
- }
- }
- }
- OCCViewer_ViewPort::paintEvent( e );
-}
-
-/*!
- Called at 'global panning' transformation
-*/
-void OCCViewer_ViewPort3d::activateGlobalPanning()
-{
- if ( !myActiveView.IsNull() )
- {
- myCurScale = myActiveView->Scale();
- myActiveView->FitAll(0.01, false);
- }
- OCCViewer_ViewPort::activateGlobalPanning();
-}
-
-/*!
- Fits all objects in view
-*/
-void OCCViewer_ViewPort3d::fitAll( bool withZ )
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->FitAll(0.01, true);
- if ( withZ ) myActiveView->ZFitAll(0.0);
- }
-}
-
-/*!
- Resets the view
-*/
-void OCCViewer_ViewPort3d::reset()
-{
- if ( !myActiveView.IsNull() )
- {
- myActiveView->Reset();
- }
-}
-
-/*!
- Incremental panning
-*/
-void OCCViewer_ViewPort3d::incrementalPan( const int incrX, const int incrY )
-{
- this->pan( incrX, incrY );
-}
-
-/*!
- Incremental zooming
-*/
-void OCCViewer_ViewPort3d::incrementalZoom( const int incr )
-{
- int cx = width() / 2;
- int cy = height() / 2;
- this->zoom( cx, cy, cx + incr, cy + incr );
-}
-
-/*!
- Incremental rotating
-*/
-void OCCViewer_ViewPort3d::incrementalRotate( const int incrX, const int incrY )
-{
- int cx = width() / 2;
- int cy = height() / 2;
- this->startRotation( cx, cy );
- this->rotate( cx + incrX, cy + incrY );
- this->endRotation();
-}
-
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_ViewPort3d.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCViewer_ViewPort3d_H
-#define OCCViewer_ViewPort3d_H
-
-#include "OCCViewer_ViewPort.h"
-#include "OCCViewer_VService.h"
-
-#include "QAD.h"
-
-// Open CASCADE Includes
-#include <Standard.hxx>
-#include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
-
-// QT Includes
-#include <qwidget.h>
-#include <qrect.h>
-#include <qcolor.h>
-#include <qpainter.h>
-#include <qapplication.h>
-
-class QAD_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
-{
- Q_OBJECT
-
- public:
- OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_Viewer)& viewer,
- V3d_TypeOfView viewType = V3d_ORTHOGRAPHIC,
- OCCViewer_ViewPort* prevView = 0,
- const QRect* magnify = 0 );
- ~OCCViewer_ViewPort3d();
-
- /* view 3D management */
- Handle (V3d_View) setView( const Handle( V3d_View )& );
- Handle (V3d_View) getView() const;
- Handle (V3d_Viewer) getViewer() const;
- V3d_TypeOfView setViewType( V3d_TypeOfView type );
-
- /* popup management */
- void onCreatePopup();
-
- /* view transformations */
- void activateGlobalPanning();
- void fitAll( bool withZ = true );
- void reset();
-
- void incrementalPan ( const int incrX, const int incrY );
- void incrementalZoom ( const int incr );
- void incrementalRotate( const int incrX, const int incrY );
-
- /* background */
- void setBackgroundColor( const QColor& color);
- QColor backgroundColor() const;
-
- protected slots:
- void onChangeBackgroundColor();
-
- protected:
- void paintEvent(QPaintEvent *ev);
-
- private:
- bool setWindow();
- void windowResize();
- void pan(int dx, int dy);
- void setCenter(int x, int y);
- void fitWindow( const QRect& rect);
- void zoom(int x0, int y0, int x, int y);
- void startRotation(int x0, int y0);
- void rotate(int x, int y);
- void endRotation();
-
- private:
- Handle (V3d_View) myActiveView;
- bool myDegenerated;
- double myCurScale;
-};
-
-#endif
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_Viewer3d.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class OCCViewer_Viewer3d OCCViewer_Viewer3d.h
- \brief Open CASCADE Viewer 3D with viewport 3D and selection.
-*/
-
-#include "OCCViewer_Viewer3d.h"
-#include "OCCViewer_ViewFrame.h"
-#include "OCCViewer_AISSelector.h"
-#include "QAD.h"
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_Settings.h"
-#include "QAD_LeftFrame.h"
-#include "OCCViewer_ViewPort3d.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "SALOME_AISShape.hxx"
-#include "SALOME_AISObject.hxx"
-
-#include "utilities.h"
-
-// Open CASCADE Includes
-#include <Geom_Axis2Placement.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopExp.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <NCollection_DefineBaseCollection.hxx>
-#include <NCollection_DefineDataMap.hxx>
-
-using namespace std;
-
-DEFINE_BASECOLLECTION( OCCViewer_CollectionOfIndexedMapOfShapes, TopTools_IndexedMapOfShape )
-DEFINE_DATAMAP( OCCViewer_MapOfIOIndexedMapOfShape, OCCViewer_CollectionOfIndexedMapOfShapes, Handle_SALOME_InteractiveObject, TopTools_IndexedMapOfShape)
-
-DEFINE_BASECOLLECTION( OCCViewer_CollectionOfMapOfInteger, TColStd_MapOfInteger )
-DEFINE_DATAMAP( OCCViewer_MapOfIOMapOfInteger, OCCViewer_CollectionOfMapOfInteger, Handle_SALOME_InteractiveObject, TColStd_MapOfInteger )
-
-/*!
- Constructor
-*/
-OCCViewer_Viewer3d::OCCViewer_Viewer3d(OCCViewer_ViewFrame* vf) :
- myAISContext( NULL ),
- myAISSelector( NULL )
-{
- if ( myV3dViewer.IsNull() )
- createViewer3d(); /* create viewer */
-
- QString BackgroundColorRed = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorRed");
- QString BackgroundColorGreen = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorGreen");
- QString BackgroundColorBlue = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorBlue");
-
- if( !BackgroundColorRed.isEmpty() && !BackgroundColorGreen.isEmpty() && !BackgroundColorBlue.isEmpty() )
- myBackColor = QColor(BackgroundColorRed.toInt(),
- BackgroundColorGreen.toInt(),
- BackgroundColorBlue.toInt());
- else
- myBackColor = QColor(35, 136, 145);
-
- myViewFrame = vf;
- myViewFrame->setViewPort ( new OCCViewer_ViewPort3d( myViewFrame, myV3dViewer ) );
- myViewFrame->setViewer(this);
-
- /* properties settings */
- // if ( !myIcon.isNull() )
- // myStudyFrame->setIcon( myIcon );
-
- myViewFrame->setCursor( myCursor );
- myViewFrame->setBackgroundColor( myBackColor );
-
- if ( myAISContext.IsNull() ) {
- /* create interactive manager */
- myAISContext = new AIS_InteractiveContext ( myV3dViewer, myV3dCollector );
-
- myAISContext->IsoOnPlane(true) ;
-
- /* create trihedron */
- Handle(Geom_Axis2Placement) anAxis=new Geom_Axis2Placement(gp::XOY());
- myTrihedron=new AIS_Trihedron(anAxis);
- myTrihedron->SetInfiniteState( Standard_True );
-
- Quantity_Color Col(193/255., 205/255., 193/255., Quantity_TOC_RGB);
- myTrihedron->SetColor( Col );
- myTrihedron->SetArrowColor( Col.Name() );
-
- float dim = 100;
- QString Size = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
- if (!Size. isEmpty() ) dim = Size.toFloat(); //get size from preferences
-
- myTrihedron->SetSize(dim);
-
- myAISContext->Display(myTrihedron);
- myAISContext->Deactivate(myTrihedron);
-
- /* create selector */
- myAISSelector = new OCCViewer_AISSelector ( myAISContext );
- QAD_ASSERT ( connect (myAISSelector, SIGNAL(selSelectionDone(bool)),
- this, SLOT(onSelectionDone(bool))) );
- QAD_ASSERT ( connect (myAISSelector, SIGNAL(selSelectionCancel(bool)),
- this, SLOT(onSelectionCancel(bool))) );
- myEnableSelection = true;
- }
-
- QAD_ASSERT ( connect(myViewFrame,
- SIGNAL(vfKeyPress(QKeyEvent*)),
- this, SLOT(onKeyPress(QKeyEvent*))) );
-
- /* mouse events of the view */
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfMousePress(QMouseEvent*)),
- this, SLOT(onMousePress(QMouseEvent*))) );
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfMouseRelease(QMouseEvent*)),
- this, SLOT(onMouseRelease (QMouseEvent*))) );
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfMouseMove(QMouseEvent*)),
- this, SLOT(onMouseMove (QMouseEvent*))) );
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfMouseDoubleClick(QMouseEvent*)),
- this, SLOT(onMouseDoubleClick (QMouseEvent*))) );
-
- /* transformation events */
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfTransformationStarted(OCCViewer_ViewPort::OperationType)),
- this, SLOT(onTransformationStarted (OCCViewer_ViewPort::OperationType))) );
- QAD_ASSERT ( QObject::connect(myViewFrame,
- SIGNAL(vfTransformationFinished(OCCViewer_ViewPort::OperationType)),
- this, SLOT(onTransformationFinished (OCCViewer_ViewPort::OperationType))) );
-
- /* set popup manager for the viewport */
- myViewFrame->getViewPort()->setPopupServer ( this );
-
-}
-
-
-/*!
- Destructor
-*/
-OCCViewer_Viewer3d::~OCCViewer_Viewer3d()
-{
- delete myAISSelector;
-}
-
-
-/* trihedron */
-Handle(AIS_Trihedron) OCCViewer_Viewer3d::getTrihedron() const
-{
- return myTrihedron;
-}
-
-void OCCViewer_Viewer3d::setTrihedronSize( float size )
-{
- AIS_ListOfInteractive aList;
- myAISContext->DisplayedObjects( aList );
- myAISContext->ObjectsInCollector( aList );
-
- AIS_ListIteratorOfListOfInteractive anIter( aList );
- for ( ; anIter.More(); anIter.Next() )
- {
- Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anIter.Value() );
- if ( !aTrh.IsNull() )
- aTrh->SetSize( aTrh == myTrihedron ? size : 0.5 *size );
- }
-
- myAISContext->UpdateCurrentViewer();
-}
-
-bool OCCViewer_Viewer3d::isTrihedronDisplayed()
-
-{
- return myAISContext->IsDisplayed(myTrihedron);
-}
-
-void OCCViewer_Viewer3d::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- while (ite.More())
- {
- if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
- {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
-
- if ( aSh->hasIO() )
- {
- Handle(SALOME_InteractiveObject) IO = aSh->getIO();
- if ( IO->isSame( IObject ) )
- {
- char* aCopyName = CORBA::string_dup(newName.latin1());
- aSh->setName( aCopyName );
- delete( aCopyName );
- break;
- }
- }
- }
- else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
- {
- Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );
-
- // Add code here, if someone create a MODULE_AISObject.
- }
- ite.Next();
- }
-}
-
-void OCCViewer_Viewer3d::SetColor(const Handle(SALOME_InteractiveObject)& IObject,
- QColor thecolor)
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- {
- Quantity_Color CSFColor = Quantity_Color ( thecolor.red() / 255.,
- thecolor.green() / 255.,
- thecolor.blue() / 255.,
- Quantity_TOC_RGB );
- ite.Value()->SetColor( CSFColor );
- break;
- }
- }
-
- myV3dViewer->Update();
-}
-
-void OCCViewer_Viewer3d::SwitchRepresentation( const Handle(SALOME_InteractiveObject)& IObject,
- int mode )
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- myAISContext->SetDisplayMode( ite.Value(), (Standard_Integer)mode ,true );
- }
-
- myV3dViewer->Update();
-}
-
-void OCCViewer_Viewer3d::SetTransparency( const Handle(SALOME_InteractiveObject)& IObject,
- float transp )
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects( List );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- {
- myAISContext->SetTransparency( ite.Value(), transp, false );
- myAISContext->Redisplay( ite.Value(), Standard_False, Standard_True );
- }
- }
-
- myV3dViewer->Update();
-}
-
-/*!
- Highlights 'obj' in viewer, returns 'true' when selected successfully
-*/
-bool OCCViewer_Viewer3d::highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight, bool update )
-{
- bool isInLocal = myAISContext->HasOpenedContext();
- QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
-
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- {
- if ( !isInLocal )
- {
- if ( highlight && !myAISContext->IsSelected( ite.Value() ) )
- myAISContext->AddOrRemoveCurrentObject( ite.Value(), false );
- else if ( !highlight && myAISContext->IsSelected( ite.Value() ) )
- myAISContext->AddOrRemoveCurrentObject( ite.Value(), false );
- }
- // highlight subshapes only when local selection is active
- else
- {
- if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
- {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
- TColStd_IndexedMapOfInteger MapIndex;
- Sel->GetIndex( IObject, MapIndex );
- aSh->highlightSubShapes( MapIndex, highlight );
- }
- }
- break;
- }
- }
-
- if ( update )
- myV3dViewer->Redraw();
-
- return false;
-}
-
-/*!
- Unhighlight all selected objects
-*/
-bool OCCViewer_Viewer3d::unHighlightAll()
-{
- if ( myAISContext->HasOpenedContext() )
- myAISContext->ClearSelected();
- else
- myAISContext->ClearCurrents();
- return false;
-}
-
-/*!
- Returns true if the IObject has a Graphical Object in this viewer. Returns FALSE otherwise.
-*/
-bool OCCViewer_Viewer3d::isInViewer( const Handle(SALOME_InteractiveObject)& IObject, bool onlyInViewer)
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects(List);
-
- if ( onlyInViewer ) {
- AIS_ListOfInteractive List1;
- myAISContext->ObjectsInCollector(List1);
- List.Append(List1);
- }
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- return true;
- }
- return false;
-}
-
-bool OCCViewer_Viewer3d::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
-{
- AIS_ListOfInteractive List;
- myAISContext->DisplayedObjects( List );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- for ( ; ite.More(); ite.Next() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( IObject ) )
- return myAISContext->IsDisplayed( ite.Value() );
- }
-
- return false;
-}
-
-/*!
- Returns the interactive context
-*/
-Handle (AIS_InteractiveContext) OCCViewer_Viewer3d::getAISContext() const
-{
- return myAISContext;
-}
-
-OCCViewer_AISSelector* OCCViewer_Viewer3d::getAISSelector() const
-{
- return myAISSelector;
-}
-
-/*!
- Returns 'true' if selection is enabled in this viewer,
- 'false' otherwise.
-*/
-bool OCCViewer_Viewer3d::enabledSelection() const
-{
- return myEnableSelection;
-}
-
-/*!
- Enables/disables selection in the viewer
-*/
-void OCCViewer_Viewer3d::enableSelection( bool enable )
-{
- myEnableSelection = enable;
- myAISSelector->enableSelection( enable );
-
- /* send notification */
- emit vw3dSelectionEnabled( enable );
-}
-
-/*!
- Enables/disables ordinary and multiple selection
- ( by 'Shift' key or with a rectangle ) in this viewer.
-*/
-void OCCViewer_Viewer3d::enableMultipleSelection( bool enable )
-{
- /* Enable/disable rectangle skectching which
- is used for multiple selection */
- myAISSelector->enableMultipleSelection( enable );
-
- myViewFrame->getViewPort()->enableDrawMode( enable );
-
- /* Enable non-multiple selection as well */
- if ( !myEnableSelection && enable )
- enableSelection( enable );
-}
-
-/*!
- Key handler
-*/
-void OCCViewer_Viewer3d::onKeyPress( QKeyEvent* pe )
-{
- if (!QAD_Application::getDesktop()->getActiveComponent().isEmpty()) {
- QAD_Application::getDesktop()->onKeyPress( pe );
- }
-}
-
-/*!
- Mouse handler
-*/
-void OCCViewer_Viewer3d::onMousePress( QMouseEvent* pe )
-{
- if ( pe->button() == Qt::LeftButton ) {
- if ( !QAD_Application::getDesktop()->onMousePress( pe ) ) {
-
- QAD_ASSERT_DEBUG_ONLY ( myAISSelector );
- if ( pe->state() & Qt::ShiftButton )
- myAISSelector->shiftSelect(); /* append selection */
- else
- myAISSelector->select(); /* new selection */
- }
- }
-}
-
-/*!
- Mouse handler
-*/
-void OCCViewer_Viewer3d::onMouseMove( QMouseEvent* pe )
-{
- /* activate hilighting only if no MB pressed */
- if ( ! ( pe->state() & ( Qt::LeftButton | Qt::MidButton | Qt::RightButton ) ) ) {
- QAD_Application::getDesktop()->onMouseMove( pe );
- OCCViewer_ViewPort* vp = myViewFrame->getViewPort();
- myAISSelector->moveTo ( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() );
- }
-}
-
-/*!
- Mouse handler
-*/
-void OCCViewer_Viewer3d::onMouseRelease( QMouseEvent* pe )
-{
- /* Selection with a rectangle ( multiple ) */
- OCCViewer_ViewPort* vp = myViewFrame->getViewPort();
- QAD_ASSERT_DEBUG_ONLY ( vp );
- QRect selRect = vp->getSelectionRect ();
- if ( selRect.isValid() ) {
- QAD_ASSERT_DEBUG_ONLY ( myAISSelector );
- QAD_ASSERT_DEBUG_ONLY ( vp->inherits("OCCViewer_ViewPort3d") );
- if ( pe->state() & Qt::ShiftButton )
- myAISSelector->shiftSelect ( selRect.left(), selRect.top(),
- selRect.right(), selRect.bottom(),
- ((OCCViewer_ViewPort3d*)vp)->getView() );
- else
- myAISSelector->select ( selRect.left(), selRect.top(),
- selRect.right(), selRect.bottom(),
- ((OCCViewer_ViewPort3d*)vp)->getView() );
- }
-}
-
-/*!
- Mouse handler
-*/
-void OCCViewer_Viewer3d::onMouseDoubleClick( QMouseEvent* pe )
-{
-}
-
-/*!
- Called when a transformation in viewport is started
-*/
-void OCCViewer_Viewer3d::onTransformationStarted( OCCViewer_ViewPort::OperationType type )
-{
- QAD_ASSERT_DEBUG_ONLY ( myAISSelector );
- if ( myEnableSelection )
- myAISSelector->enableSelection ( false ); // lock until the end of transform
-
- if ( type == OCCViewer_ViewPort::PANGLOBAL ||
- type == OCCViewer_ViewPort::WINDOWFIT )
- {
- /* Start watching 'global panning' and 'window fit'.
- These operations require additional user's actions
- in viewport and we have to reset the operations if
- instead of these actions a user does something else.
- */
- qApp->installEventFilter( this );
- }
-}
-
-/*!
- Called when a transformation in viewport is finished
-*/
-void OCCViewer_Viewer3d::onTransformationFinished( OCCViewer_ViewPort::OperationType type )
-{
- QAD_ASSERT_DEBUG_ONLY ( myAISSelector );
- if ( myEnableSelection )
- myAISSelector->enableSelection ( true ); // unlock
-
- if ( type == OCCViewer_ViewPort::PANGLOBAL ||
- type == OCCViewer_ViewPort::WINDOWFIT )
- {
- /* stop watching 'global panning' and 'window fit'*/
- qApp->removeEventFilter( this );
- }
-}
-
-/*!
- Called when an object is selected
-*/
-void OCCViewer_Viewer3d::onSelectionDone( bool bAdded )
-{
- emit vw3dSelectionDone( bAdded );
-
-// QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
-// QAD_StudyFrame* myActiveSFrame = myActiveStudy->getActiveStudyFrame();
- // SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-// MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
-
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
-
- if ( ActiveComp.isEmpty() )
- {
- unHighlightAll();
- return;
- }
-
- if ( myAISContext->IndexOfCurrentLocal() <= 0 )
- globalSelectionDone( bAdded );
- else
- localSelectionDone( bAdded );
-
- myV3dViewer->Update();
-}
-
-/*!
- Called when an object is selected and there is no opened local context
-*/
-void OCCViewer_Viewer3d::globalSelectionDone( const bool bAdded )
-{
- SALOME_Selection* Sel = SALOME_Selection::Selection(
- QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
-
- MESSAGE ( "OCCViewer_Viewer3d - NB SELECTED INTERACTIVE OBJECT : " << Sel->IObjectCount() )
-
- SALOME_ListIO DeltaPos;
- DeltaPos.Clear();
- SALOME_ListIO DeltaNeg;
- DeltaNeg.Clear();
-
- if ( !bAdded )
- {
- for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
-
- if ( !anObj.IsNull() )
- {
- bool itemAllreadySelected = false;
- int nbSel = Sel->IObjectCount();
- if ( nbSel == 0 )
- DeltaPos.Append( anObj );
- else
- {
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for( ; It.More(); It.Next() )
- {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
- if ( anObj->isSame( IO1 ) )
- {
- itemAllreadySelected = true;
- break;
- }
- }
- if ( !itemAllreadySelected )
- DeltaPos.Append( anObj );
- }
- }
- else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
- {
- //Handle(SALOME_AISObject) aSh =
- // Handle(SALOME_AISObject)::DownCast( myAISContext->Current() );
- // Add code here, if someone create a MODULE_AISObject.
- }
- }
-
- if ( DeltaPos.Extent() > 0 )
- Sel->ClearIObjects();
-
- }
- else
- { /* shift select */
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ;It.More(); It.Next() )
- {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
-
- bool itemAllreadySelected = false;
- for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->isSame( IO1 ) )
- {
- itemAllreadySelected = true;
- break;
- }
- else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
- {
- //Handle(SALOME_AISObject) aSh =
- // Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
- // Add code here, if someone create a MODULE_AISObject.
- }
- }
-
- if ( !itemAllreadySelected )
- DeltaNeg.Append( IO1 );
- }
-
- myAISContext->InitCurrent();
- for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
-
- if ( !anObj.IsNull() )
- {
- bool itemAllreadySelected = false;
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ;It.More(); It.Next() )
- {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
-
- if ( anObj->isSame( IO1 ) )
- {
- itemAllreadySelected = true;
- break;
- }
- }
-
- if ( !itemAllreadySelected )
- DeltaPos.Append( anObj );
- }
- else if ( myAISContext->Current()->IsKind(STANDARD_TYPE(SALOME_AISObject)))
- {
- //Handle(SALOME_AISObject) aSh =
- // Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
- // Add code here, if someone create a MODULE_AISObject.
- }
- }
- }
-
- // MESSAGE ( "VIEWER onSelectionDone DeltaNeg.count() == " << DeltaNeg.count() )
- SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
- for( ;ItNeg.More();ItNeg.Next() )
- {
- Sel->RemoveIObject( ItNeg.Value(), false );
- }
-
- // MESSAGE ( "VIEWER onSelectionDone DeltaPos.count() == " << DeltaPos.Extent() )
- SALOME_ListIteratorOfListIO ItPos( DeltaPos );
- for ( ;ItPos.More();ItPos.Next() )
- {
- Sel->AddIObject( ItPos.Value(), false );
- }
-}
-
-/*!
- Called when an object is selected and there is opened local context
-*/
-void OCCViewer_Viewer3d::localSelectionDone( const bool /*bAdded*/ )
-{
- SALOME_Selection* aSelection = SALOME_Selection::Selection(
- QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
-
- aSelection->BlockSignals( true );
-
- OCCViewer_MapOfIOIndexedMapOfShape aMapsOfShapes; // SALOME_InteractiveObject <--> TopTools_IndexedMapOfShape
- OCCViewer_MapOfIOMapOfInteger aMapsOfIndexes; // SALOME_InteractiveObject <--> TColStd_MapOfInteger
-
-
- // Iterate through selected objects and add them to selection
- for( myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected() )
- {
- // Retrive selected shape and subshape
- Handle(SelectMgr_EntityOwner) anOwner = myAISContext->SelectedOwner();
- if ( anOwner.IsNull() )
- continue;
-
- Handle(AIS_InteractiveObject) anIO =
- Handle(AIS_InteractiveObject)::DownCast( myAISContext->SelectedInteractive() );
- if ( anIO.IsNull() )
- continue;
-
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
- if ( anObj.IsNull() )
- continue;
-
- if ( anIO->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
- {
- Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( anIO );
- TopoDS_Shape aShape = anAISShape->Shape();
- TopoDS_Shape aSubShape = anOwner->Shape();
- if ( aShape.IsNull() || aSubShape.IsNull() )
- continue;
-
- // Get index of selected shape
- if ( aMapsOfShapes.IsBound( anObj ) )
- {
- const TopTools_IndexedMapOfShape& aShapes = aMapsOfShapes( anObj );
- int anIndex = aShapes.FindIndex( aSubShape );
-
- aMapsOfIndexes( anObj ).Add( anIndex );
- }
- else
- {
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- int anIndex = aShapes.FindIndex( aSubShape );
-
- TColStd_MapOfInteger anIndexes;
- anIndexes.Add( anIndex );
-
- aMapsOfShapes.Bind( anObj, aShapes );
- aMapsOfIndexes.Bind( anObj, anIndexes );
- }
- }
- else
- {
- aMapsOfShapes.Bind( anObj, TopTools_IndexedMapOfShape() );
- aMapsOfIndexes.Bind( anObj, TColStd_MapOfInteger() );
- }
- }
-
- // Clear selection
- aSelection->ClearIObjects();
-
- // Add object in selection
- OCCViewer_MapOfIOMapOfInteger::Iterator anIter( aMapsOfIndexes );
- for ( ; anIter.More(); anIter.Next() )
- {
- if ( anIter.Value().IsEmpty() )
- aSelection->AddIObject( anIter.Key(), false );
- else
- {
- aSelection->AddIObject( anIter.Key(), false );
- aSelection->AddOrRemoveIndex( anIter.Key(), anIter.Value(), false, false );
- }
- }
-
- aSelection->BlockSignals( false );
- aSelection->SelectionChanged();
-}
-
-/*!
- Called when an object is unselected
-*/
-void OCCViewer_Viewer3d::onSelectionCancel( bool bAdded )
-{
- emit vw3dSelectionCancel();
-
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- SALOME_ListIO DeltaPos;
- DeltaPos.Clear();
- SALOME_ListIO DeltaNeg;
- DeltaNeg.Clear();
-
- if ( !bAdded )
- { /* select */
- Sel->ClearIObjects();
- }
- else
- { /* shiftselect */
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() )
- {
- Handle( SALOME_InteractiveObject) IO1 = It.Value();
-
- bool itemAllreadySelected = false;
- myAISContext->InitCurrent();
- for ( myAISContext->InitCurrent(); myAISContext->MoreCurrent(); myAISContext->NextCurrent() )
- {
- Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( myAISContext->Current()->GetOwner() );
-
- if ( !anObj.IsNull() && anObj->isSame( IO1 ) )
- {
- itemAllreadySelected = true;
- break;
- }
- else if ( myAISContext->Current()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
- {
- Handle(SALOME_AISObject) aSh =
- Handle(SALOME_AISObject)::DownCast(myAISContext->Current());
- // Add code here, if someone create a MODULE_AISObject.
- }
- }
-
- // only if isknown
- if ( !itemAllreadySelected )
- DeltaNeg.Append( IO1 );
- }
- }
-
- // MESSAGE ( "VIEWER onSelectionCancel DeltaNeg.count() == " << DeltaNeg.Extent() )
- SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
- for ( ; ItNeg.More(); ItNeg.Next() )
- Sel->RemoveIObject( ItNeg.Value(), false);
-
- myV3dViewer->Update();
-}
-
-/*!
- Installed while 'fit area' and 'global panning'
- operations are active
-*/
-bool OCCViewer_Viewer3d::eventFilter( QObject * po, QEvent * pe)
-{
- if ( ( pe->type() == QEvent::MouseButtonPress &&
- po != myViewFrame->getViewPort() ) ||
- pe->type() == QEvent::KeyPress ) {
- /* user press any key or a MB outside the viewport */
- myViewFrame->getViewPort()->resetState();
- }
- return QObject::eventFilter( po, pe );
-}
-
-/*!
- Creates CasCade viewer 3D
-*/
-void OCCViewer_Viewer3d::createViewer3d()
-{
- myV3dViewer = OCCViewer_VService::Viewer ( "", (short*) "Viewer3d", "", 1000.,
- V3d_XposYnegZpos, true, true);
- myV3dViewer->Init();
-
- myV3dCollector = OCCViewer_VService::Viewer ( "", (short*) "Collector3d", "", 1000.,
- V3d_XposYnegZpos, true, true);
- myV3dCollector->Init();
-}
-
-/*!
- Returns CasCade viewer 3D
-*/
-Handle(V3d_Viewer) OCCViewer_Viewer3d::getViewer3d() const
-{
- return myV3dViewer;
-}
-
-/*!
- Sets a new cursor on all its studyframes
-*/
-void OCCViewer_Viewer3d::setCursor( const QCursor& cursor)
-{
- myCursor = cursor;
-}
-
-/*!
- Returns the current cursor
-*/
-inline const QCursor& OCCViewer_Viewer3d::cursor() const
-{
- return myCursor;
-}
-
-/*!
- Sets default background color on all its studyframes
-*/
-void OCCViewer_Viewer3d::setBackgroundColor( const QColor& aColor )
-{
- myBackColor = aColor;
-}
-
-/*!
- Returns the current background
-*/
-inline const QColor& OCCViewer_Viewer3d::backgroundColor() const
-{
- return myBackColor;
-}
-
-/*!
- Sets a new icon to all its studyframes
-*/
-void OCCViewer_Viewer3d::setIcon( const QPixmap& icon )
-{
- myIcon = icon;
-}
-
-/*!
- Returns current icon
-*/
-inline const QPixmap& OCCViewer_Viewer3d::icon() const
-{
- return myIcon;
-}
-
-/*!
- Builds popup menu
-*/
-void OCCViewer_Viewer3d::onCreatePopup()
-{
-}
-
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// 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 : OCCViewer_Viewer3d.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef OCCVIEWER_VIEWER3D_H
-#define OCCVIEWER_VIEWER3D_H
-
-#include "OCCViewer_ViewPort.h"
-#include "QAD.h"
-#include "QAD_Popup.h"
-#include "QAD_ViewFrame.h"
-#include "SALOME_InteractiveObject.hxx"
-
-// Open CASCADE Includes
-#include <AIS_InteractiveContext.hxx>
-#include <AIS_Trihedron.hxx>
-
-class OCCViewer_ViewFrame;
-class OCCViewer_AISSelector;
-
-class QAD_EXPORT OCCViewer_Viewer3d : public QObject, public QAD_PopupClientServer
-{
- Q_OBJECT
-
-public:
- OCCViewer_Viewer3d(OCCViewer_ViewFrame* vf);
- ~OCCViewer_Viewer3d();
-
-signals:
- void vwKeyPress( QKeyEvent* );
- void vwKeyRelease( QKeyEvent* );
- void vwDrawExternal( QPainter* );
-
-public slots:
- void onKeyPress(QKeyEvent*);
-
- void onMouseMove(QMouseEvent*);
- void onMousePress(QMouseEvent*);
- void onMouseRelease(QMouseEvent*);
- void onMouseDoubleClick(QMouseEvent*);
-
- void onSelectionDone( bool bAdded );
- void onSelectionCancel( bool bAdded );
-
- void onTransformationStarted( OCCViewer_ViewPort::OperationType );
- void onTransformationFinished( OCCViewer_ViewPort::OperationType );
-
-signals:
- void vw3dSelectionDone (bool added);
- void vw3dSelectionCancel();
- void vw3dSelectionEnabled( bool );
-
-public:
- void createViewer3d();
- Handle(V3d_Viewer) getViewer3d() const;
-
- void setTrihedronSize(float size);
- bool isTrihedronDisplayed();
-
- /* popup management */
- void onCreatePopup();
-
- void setCursor( const QCursor& cursor);
- const QCursor& cursor() const;
- void setIcon( const QPixmap& icon);
- const QPixmap& icon() const;
- void setBackgroundColor( const QColor& aColor);
- const QColor& backgroundColor() const;
-
- /* Selection management */
- bool highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool update=true);
- bool unHighlightAll();
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject,
- bool onlyInViewer = false );
- bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
- void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
-
- bool enabledSelection() const;
- void enableSelection( bool );
- void enableMultipleSelection( bool );
-
- void SetColor(const Handle(SALOME_InteractiveObject)& IObject,
- QColor thecolor);
- void SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
- int mode);
- void SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,
- float transp);
-
- /* interactive context */
- Handle (AIS_InteractiveContext) getAISContext() const;
- OCCViewer_AISSelector* getAISSelector() const;
-
- /* trihedron */
- Handle(AIS_Trihedron) getTrihedron() const;
-
-protected:
- bool eventFilter( QObject *, QEvent * );
-
-protected:
- OCCViewer_ViewFrame* myViewFrame;
-
-private:
-
- void globalSelectionDone( const bool );
- void localSelectionDone ( const bool );
-
- Handle (AIS_InteractiveContext) myAISContext;
- OCCViewer_AISSelector* myAISSelector;
- bool myEnableSelection;
- Handle(AIS_Trihedron) myTrihedron;
- Handle(V3d_Viewer) myV3dViewer;
- Handle(V3d_Viewer) myV3dCollector;
-
- /* attributes for all the views */
- QPixmap myIcon; /* icon */
- QCursor myCursor; /* current cursor */
- QColor myBackColor; /* background */
-
-};
-
-#endif
-
+++ /dev/null
-*********************************************************************
-* File : BUGS_DESCRIPTION
-* Project : PAL/SALOME
-* Module : PatchQt
-* Author : Vadim SANDLER
-* Created : 03/11/2004
-*********************************************************************
-
-This file contains description of bugs found in Qt 3.0.5 classes and patches with bug-fixes and improvements done for Qt classes
-in frames of PAL/SALOME project.
-
-Main principles of the patches creation:
-* the original classes are renamed by adding "P" suffix to the class name;
-* private Qt classes are copied to patched files in order to avoid compilation/linking problems;
-* classes definitions are moved from *.cpp implementation to *.h header in order to avoid additional moc preprocessing for *.cpp files.
-
-*********************************************************************
-
-Bug: keyboard accelerators for actions (menu, toolbar, etc) are not disabled when action itself is disabled (grayed).
-
-Gravity: medium
-
-Patched file(s):
-* qactionP.cxx:
-1) void QActionPrivate::update()
-- enable/disable key accelerator according to the action state
-
-*********************************************************************
-
-Bug: Wrong MDI behaviour
-To reproduce in SALOME:
-1. Create new study
-- Window Study1#1 appears and becomes active
-2. Create one more study
-- Window Study2#1 appears and becomes active (Study1#1 becames inactive)
-3. Minimize Study2#1 window
-- Window Study2#1 is minimized, Study1#1 becames active
-4. Minimize Study1#1 window
-- Window Study1#1 is minimized but stays still active (highlighted title)
-5. Menu command "File/Close"
-- Study2 document is closed, but should Study1 !!!
-
-Gravity: high
-
-Bug: Crash on close study window
-To reproduce in SALOME:
-1. Launch application.
-2. Create new study with any Viewer.
-3. Create second new study.
-4. Close second study.
--> crash
-
-Gravity: high
-
-Bug: crash when leaving a study
-To reproduce in SALOME:
-1. Create new study
-2. Load VISU component
-3. Menu Window / New Window / Plot2d Viewer
-4. Miximize Study 1#2 window (with Plot2d viewer)
-5. Menu File / Close
-6. Press "Close w/o saving" button in "Close Active Study" dialog box.
--> crash
-
-Gravity: high
-
-Patched files(s):
-* qworkspaceP.h:
-- methods
-void QWorkspace::activateNextWindow()
-void QWorkspace::activatePreviousWindow()
-void QWorkspace::activateWindow( QWidget* w, bool change_focus = TRUE )
-are made public
-
-* qworkspaceP.cxx:
-- methods
-void QWorkspace::childEvent( QChildEvent * e)
-void QWorkspace::activateWindow( QWidget* w, bool change_focus )
-void QWorkspace::minimizeWindow( QWidget* w)
-bool QWorkspace::eventFilter( QObject *o, QEvent * e)
-void QWorkspace::activatePreviousWindow()
-are modified to activate correct child window on maximizing/minimizing/closing etc operations and to avoid crashes.
-
-*********************************************************************
-
-Improvement: Add controls to allow collapse/expand parts of view frame.
-The patch adds buttons with small arrows for splitter which allow to collapse/restore splitter in both (left/right or top/botton) directions.
-
-Gravity: medium
-
-Bug: Splitter is not shown in python console
-To reproduce in SALOME:
-1. Create new study
-2. Open new window (VTK or OCC) -> python console and message console is hidden
-3. Restore normal size of low frames (python and message consoles) by clicking corresponding splitter button.
--> horizontal scrolbars for this windows are not shown, i.e. python and message frames are clipped.
-
-Gravity: medium
-
-Bug: Splitter does not restore its original position after collapsing/expanding operations.
-To reproduce try to collapse/expand repeatedly any splitter (e.g. that one between Python and Message consoles).
-
-Gravity: medium
-
-Improvement: Implement a functionality (for VISU module) to control the Viewers behavior from python console - concerning QSplitter it means a possibility
-to show/hide different parts of view frame (Object Browser, Python Console, 3d/2d viewer, Python console, Message window).
-
-Gravity: high
-
-Patched file(s):
-* qsplitterP.h
-1) to process correctly resizing events:
-- methods
-QSizePolicy QSplitter::sizePolicy() const
-QSizePolicy QSplitterHandle::sizePolicy() const;
-are added
-
-2) to allow collapse/expand functionality:
-- methods
-bool QSplitter::isCompressEnabled() const;
-void QSplitter::setCompressEnabled(bool on);
-void QSplitter::compress(QWidget*);
-void QSplitter::unCompress(QWidget*);
-QSplitterHandle* QSplitter::getHandleAfter(QWidget* w);
-QSplitterHandle* QSplitter::getHandleBefore(QWidget* w);
-bool QSplitter::isCompressed( const QWidget* ) const;
-QWidget* QSplitter::widgetBefore( int id ) const;
-QWidget* QSplitter::widgetAfter( int id ) const;
-QSize QSplitter::minSize( const QWidget *w ) const;
-QSize QSplitter::maxSize( const QWidget *w ) const;
-int QSplitter::hit( QPoint p );
-void QSplitter::updateSplitterHandles() const;
-and
-void QSplitterHandle::updateButtonState();
-void QSplitterHandle::compressAfter();
-void QSplitterHandle::unCompressAfter();
-void QSplitterHandle::compressBefore();
-void QSplitterHandle::unCompressBefore();
-void QSplitterHandle::onBeforeCompress();
-void QSplitterHandle::onAfterCompress();
-void QSplitterHandle::onBeforeUnCompress();
-void QSplitterHandle::onAfterUnCompress();
-are added
-
-- fields:
-QWidgetList QSplitter::compressed_widgets;
-bool QSplitter::compress_flag;
-and
-int QSplitterHandle::oldpos;
-QPushButton* QSplitterHandle::left;
-QPushButton* QSplitterHandle::right;
-QPushButton* QSplitterHandle::unleft;
-QPushButton* QSplitterHandle::unright;
-are added
-
-- method
-void QSplitter::setG( QWidget *w, int p, int s );
-is modified
-
-* qsplitterP.cxx:
-1) to draw button arrows:
-static const char* splitter_left_xpm[];
-static const char* splitter_right_xpm[];
-static const char* splitter_up_xpm[];
-static const char* splitter_down_xpm[];
-are added
-
-2) to process correctly resizing events:
-- methods
-QSizePolicy QSplitter::sizePolicy() const
-QSizePolicy QSplitterHandle::sizePolicy() const;
-are added
-
-3) to allow collapse/expand functionality:
-- methods
-bool QSplitter::isCompressEnabled() const;
-void QSplitter::setCompressEnabled(bool on);
-void QSplitter::compress(QWidget*);
-void QSplitter::unCompress(QWidget*);
-QSplitterHandle* QSplitter::getHandleAfter(QWidget* w);
-QSplitterHandle* QSplitter::getHandleBefore(QWidget* w);
-bool QSplitter::isCompressed( const QWidget* ) const;
-QWidget* QSplitter::widgetBefore( int id ) const;
-QWidget* QSplitter::widgetAfter( int id ) const;
-QSize QSplitter::minSize( const QWidget *w ) const;
-QSize QSplitter::maxSize( const QWidget *w ) const;
-int QSplitter::hit( QPoint p );
-void QSplitter::updateSplitterHandles() const;
-and
-void QSplitterHandle::updateButtonState();
-void QSplitterHandle::compressAfter();
-void QSplitterHandle::unCompressAfter();
-void QSplitterHandle::compressBefore();
-void QSplitterHandle::unCompressBefore();
-void QSplitterHandle::onBeforeCompress();
-void QSplitterHandle::onAfterCompress();
-void QSplitterHandle::onBeforeUnCompress();
-void QSplitterHandle::onAfterUnCompress();
-are added
-
-- methods
-QSplitterHandle::QSplitterHandle()
-void QSplitter::setG( QWidget *w, int p, int s );
-QSize QSplitterHandle::sizeHint() const
-void QSplitterHandle::setOrientation( Qt::Orientation o )
-void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
-void QSplitterHandle::paintEvent( QPaintEvent * )
-void QSplitter::init()
-void QSplitter::setOrientation( Orientation o )
-QSplitterLayoutStruct *QSplitter::addWidget( QWidget *w, bool first )
-void QSplitter::setRubberband( int p )
-void QSplitter::drawSplitter( QPainter *p, QCOORD x, QCOORD y, QCOORD w, QCOORD h )
-void QSplitter::moveSplitter( QCOORD p, int id )
-void QSplitter::moveBefore( int pos, int id, bool upLeft )
-void QSplitter::moveAfter( int pos, int id, bool upLeft )
-void QSplitter::getRange( int id, int *min, int *max )
-void QSplitter::doResize()
-void QSplitter::recalc( bool update )
-void QSplitter::styleChange( QStyle& old )
-are modified:
-
-*********************************************************************
-
-Bug: File names filter of the "Open" and "Save" dialog boxes is broken
-To reproduce in SALOME:
-1) start PAL/SALOME
-2) open new study with the help of OCC Viewer and load Geometry module
-3) Menu File / Import / BRep
-4) Browse to any directory may be changed by yourself
-5) Press "Create New Folder" button of the "Import" dialog box
-6) Browse to created directory "New Folder 1"
-7) Press "Create New Folder" button of the "Import" dialog box
-8) Browse to created directory "New Folder 1"
-9) Delete first created "New Folder 1" directory externally (e.g. from any terminal window)
-10) Press "One directory up" button of the "Import" dialog box
-11) Error message box appears: "Could not read directory .../New Folder 1/New Folder 1" - press OK button to close message box.
--> Result: "BREP Files (*.brep)" filter is set as "File type" in the "Import" dialog box, but non-BREP files are also visible and available for the selection
-in the browser window of the "Import" dialog box
--> The same situation takes place for the "Export" dialog box.
-
-Gravity: low
-
-Patch:
-* qfiledialogP.cxx:
-1) methods
-void QFileDialogP::urlFinished( QNetworkOperation *op )
-is modified to fix bug
-
-*********************************************************************
-
+++ /dev/null
- THE Q PUBLIC LICENSE
- version 1.0
-
- Copyright (C) 1999-2000 Trolltech AS, Norway.
- Everyone is permitted to copy and
- distribute this license document.
-
-The intent of this license is to establish freedom to share and change the
-software regulated by this license under the open source model.
-
-This license applies to any software containing a notice placed by the
-copyright holder saying that it may be distributed under the terms of
-the Q Public License version 1.0. Such software is herein referred to as
-the Software. This license covers modification and distribution of the
-Software, use of third-party application programs based on the Software,
-and development of free software which uses the Software.
-
- Granted Rights
-
-1. You are granted the non-exclusive rights set forth in this license
- provided you agree to and comply with any and all conditions in this
- license. Whole or partial distribution of the Software, or software
- items that link with the Software, in any form signifies acceptance of
- this license.
-
-2. You may copy and distribute the Software in unmodified form provided
- that the entire package, including - but not restricted to - copyright,
- trademark notices and disclaimers, as released by the initial developer
- of the Software, is distributed.
-
-3. You may make modifications to the Software and distribute your
- modifications, in a form that is separate from the Software, such as
- patches. The following restrictions apply to modifications:
-
- a. Modifications must not alter or remove any copyright notices in
- the Software.
-
- b. When modifications to the Software are released under this
- license, a non-exclusive royalty-free right is granted to the
- initial developer of the Software to distribute your modification
- in future versions of the Software provided such versions remain
- available under these terms in addition to any other license(s) of
- the initial developer.
-
-4. You may distribute machine-executable forms of the Software or
- machine-executable forms of modified versions of the Software, provided
- that you meet these restrictions:
-
- a. You must include this license document in the distribution.
-
- b. You must ensure that all recipients of the machine-executable forms
- are also able to receive the complete machine-readable source code
- to the distributed Software, including all modifications, without
- any charge beyond the costs of data transfer, and place prominent
- notices in the distribution explaining this.
-
- c. You must ensure that all modifications included in the
- machine-executable forms are available under the terms of this
- license.
-
-5. You may use the original or modified versions of the Software to
- compile, link and run application programs legally developed by you
- or by others.
-
-6. You may develop application programs, reusable components and other
- software items that link with the original or modified versions of the
- Software. These items, when distributed, are subject to the following
- requirements:
-
- a. You must ensure that all recipients of machine-executable forms of
- these items are also able to receive and use the complete
- machine-readable source code to the items without any charge
- beyond the costs of data transfer.
-
- b. You must explicitly license all recipients of your items to use
- and re-distribute original and modified versions of the items in
- both machine-executable and source code forms. The recipients must
- be able to do so without any charges whatsoever, and they must be
- able to re-distribute to anyone they choose.
-
-
- c. If the items are not available to the general public, and the
- initial developer of the Software requests a copy of the items,
- then you must supply one.
-
- Limitations of Liability
-
-In no event shall the initial developers or copyright holders be liable
-for any damages whatsoever, including - but not restricted to - lost
-revenue or profits or other direct, indirect, special, incidental or
-consequential damages, even if they have been advised of the possibility
-of such damages, except to the extent invariable law, if any, provides
-otherwise.
-
- No Warranty
-
-The Software and this license document are provided AS IS with NO WARRANTY
-OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE.
- Choice of Law
-
-This license is governed by the Laws of Norway. Disputes shall be settled
-by Oslo City Court.
+++ /dev/null
-# SALOME PatchQt : patch for Qt
-#
-# 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 : Makefile.in
-# Module : SALOME
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- qsplitterP.h \
- qworkspaceP.h \
- qactionP.h \
- qfiledialogP.h
-
-# Libraries targets
-
-LIB = libqsplitterP.la
-LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx
-qsplitterP_moc.cxx: $(inc_builddir)/qsplitterP.h
- $(MOC) $(inc_builddir)/qsplitterP.h -o qsplitterP_moc.cxx
-
-qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h
- $(MOC) $(inc_builddir)/qworkspaceP.h -o qworkspaceP_moc.cxx
-
-qactionP_moc.cxx: $(inc_builddir)/qactionP.h
- $(MOC) $(inc_builddir)/qactionP.h -o qactionP_moc.cxx
-
-qfiledialogP_moc.cxx: $(inc_builddir)/qfiledialogP.h
- $(MOC) $(inc_builddir)/qfiledialogP.h -o qfiledialogP_moc.cxx
-
-CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++
-CXXFLAGS+=
-LDFLAGS+=$(QT_MT_LIBS)
-
-@CONCLUDE@
+++ /dev/null
-This package includes the patch for Qt toolkit.
-The files in this package are distributed under conditions of the Q Public License.
\ No newline at end of file
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qactionP.cxx
-// Description : the patch for Qt's QAction class (qaction.cpp)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Implementation of QAction class
-**
-** Created : 000000
-**
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the widgets module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#include "qactionP.h"
-
-#ifndef QT_NO_ACTION
-
-#include <qtoolbar.h>
-#include <qptrlist.h>
-#include <qpopupmenu.h>
-#include <qaccel.h>
-#include <qtoolbutton.h>
-#include <qcombobox.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qstatusbar.h>
-#include <qobjectlist.h>
-
-
-/*!
- \class QActionP qaction.h
- \ingroup basic
- \ingroup application
- \mainclass
- \brief The QActionP class provides an abstract user interface
- action that can appear both in menus and tool bars.
-
- In GUI applications many commands can be invoked via a menu option, a
- toolbar button and a keyboard accelerator. Since the same action must
- be performed regardless of how the action was invoked, and since the
- menu and toolbar should be kept in sync, it is useful to represent a
- command as an \e action. An action can be added to a menu and a
- toolbar and will automatically keep them in sync. For example, if the
- user presses a Bold toolbar button the Bold menu item will
- automatically be checked.
-
- A QActionP may contain an icon, a menu text, an accelerator, a status
- text, a whats this text and a tool tip. Most of these can be set in
- the constructor. They can also be set independently with setIconSet(),
- setText(), setMenuText(), setToolTip(), setStatusTip(), setWhatsThis()
- and setAccel(), respectively.
-
- An action may be a toggle action e.g. a Bold toolbar button, or a
- command action, e.g. 'Open File' to invoke an open file dialog.
- Toggle actions emit the toggled() signal when their state changes.
- Both command and toggle actions emit the activated() signal when they
- are invoked. Use setToggleAction() to set an action's toggled status.
- To see if an action is a toggle action use isToggleAction(). A toggle
- action may be "on", isOn() returns TRUE, or "off", isOn() returns
- FALSE.
-
- Actions are added to widgets (menus or toolbars) using addTo(), and
- removed using removeFrom().
-
- Once a QActionP has been created it should be added to the relevant
- menu and toolbar and then connected to the slot which will perform
- the action. For example:
-
- \quotefile action/application.cpp
- \skipto Save File
- \printuntil connect
-
- We create a "File Save" action with a menu text of "&Save" and
- \e{Ctrl+S} as the keyboard accelerator. We connect the
- fileSaveAction's activated() signal to our own save() slot. Note that at
- this point there is no menu or toolbar action, we'll add them next:
-
- \skipto new QToolBar
- \printline
- \skipto fileSaveAction->addTo
- \printline
- \skipto new QPopupMenu
- \printuntil insertItem
- \skipto fileSaveAction->addTo
- \printline
-
- We create a toolbar and add our fileSaveAction to it. Similarly we
- create a menu, add a top-level menu item, and add our
- fileSaveAction.
-
- (See the \link simple-application-action.html Simple Application
- Walkthrough featuring QActionP \endlink for a detailed example.)
-
- We recommend that actions are created as children of the window that
- they are used in. In most cases actions will be children of the
- application's main window.
-
- To prevent recursion, don't create an action as a child of a widget
- that the action is later added to.
-*/
-
-
-class QActionPPrivate
-{
-public:
- QActionPPrivate();
- ~QActionPPrivate();
- QIconSet *iconset;
- QString text;
- QString menutext;
- QString tooltip;
- QString statustip;
- QString whatsthis;
- QKeySequence key;
-#ifndef QT_NO_ACCEL
- QAccel* accel;
- int accelid;
-#endif
- uint enabled : 1;
- uint toggleaction :1;
- uint on : 1;
-#ifndef QT_NO_TOOLTIP
- QToolTipGroup* tipGroup;
-#endif
-
- struct MenuItem {
- MenuItem():popup(0),id(0){}
- QPopupMenu* popup;
- int id;
- };
- // ComboItem is only necessary for actions that are
- // in dropdown/exclusive actiongroups. The actiongroup
- // will clean this up
- struct ComboItem {
- ComboItem():combo(0), id(0) {}
- QComboBox *combo;
- int id;
- };
- QPtrList<MenuItem> menuitems;
- QPtrList<QToolButton> toolbuttons;
- QPtrList<ComboItem> comboitems;
-
- enum Update { Everything, Icons, State }; // Everything means everything but icons and state
- void update( Update upd = Everything );
-
- QString menuText() const;
- QString toolTip() const;
- QString statusTip() const;
-};
-
-QActionPPrivate::QActionPPrivate()
-{
- iconset = 0;
-#ifndef QT_NO_ACCEL
- accel = 0;
- accelid = 0;
-#endif
- key = 0;
- enabled = 1;
- toggleaction = 0;
- on = 0;
- menuitems.setAutoDelete( TRUE );
- comboitems.setAutoDelete( TRUE );
-#ifndef QT_NO_TOOLTIP
- tipGroup = new QToolTipGroup( 0 );
-#endif
-}
-
-QActionPPrivate::~QActionPPrivate()
-{
- QPtrListIterator<QToolButton> ittb( toolbuttons );
- QToolButton *tb;
-
- while ( ( tb = ittb.current() ) ) {
- ++ittb;
- delete tb;
- }
-
- QPtrListIterator<QActionPPrivate::MenuItem> itmi( menuitems);
- QActionPPrivate::MenuItem* mi;
- while ( ( mi = itmi.current() ) ) {
- ++itmi;
- QPopupMenu* menu = mi->popup;
- if ( menu->findItem( mi->id ) )
- menu->removeItem( mi->id );
- }
-
-#ifndef QT_NO_ACCEL
- delete accel;
-#endif
- delete iconset;
-#ifndef QT_NO_TOOLTIP
- delete tipGroup;
-#endif
-}
-
-void QActionPPrivate::update( Update upd )
-{
- for ( QPtrListIterator<MenuItem> it( menuitems); it.current(); ++it ) {
- MenuItem* mi = it.current();
- QString t = menuText();
-#ifndef QT_NO_ACCEL
- if ( key )
- t += '\t' + QAccel::keyToString( key );
-#endif
- switch ( upd ) {
- case State:
- mi->popup->setItemEnabled( mi->id, enabled );
- if ( toggleaction )
- mi->popup->setItemChecked( mi->id, on );
- break;
- case Icons:
- if ( iconset )
- mi->popup->changeItem( mi->id, *iconset, t );
- break;
- default:
- mi->popup->changeItem( mi->id, t );
- if ( !whatsthis.isEmpty() )
- mi->popup->setWhatsThis( mi->id, whatsthis );
- if ( toggleaction ) {
- mi->popup->setCheckable( TRUE );
- mi->popup->setItemChecked( mi->id, on );
- }
- }
- }
- for ( QPtrListIterator<QToolButton> it2( toolbuttons); it2.current(); ++it2 ) {
- QToolButton* btn = it2.current();
- switch ( upd ) {
- case State:
- btn->setEnabled( enabled );
- if ( toggleaction )
- btn->setOn( on );
- break;
- case Icons:
- if ( iconset )
- btn->setIconSet( *iconset );
- break;
- default:
- btn->setToggleButton( toggleaction );
- if ( !text.isEmpty() )
- btn->setTextLabel( text, FALSE );
-#ifndef QT_NO_TOOLTIP
- QToolTip::remove( btn );
- QToolTip::add( btn, toolTip(), tipGroup, statusTip() );
-#endif
-#ifndef QT_NO_WHATSTHIS
- QWhatsThis::remove( btn );
- if ( !whatsthis.isEmpty() )
- QWhatsThis::add( btn, whatsthis );
-#endif
- }
- }
- // Only used by actiongroup
- for ( QPtrListIterator<ComboItem> it3( comboitems ); it3.current(); ++it3 ) {
- ComboItem *ci = it3.current();
- if ( !ci->combo )
- return;
- if ( iconset )
- ci->combo->changeItem( iconset->pixmap(), text, ci->id );
- else
- ci->combo->changeItem( text, ci->id );
- }
- // VSR : enable/disable accel according to action state
-#ifndef QT_NO_ACCEL
- if ( upd == State && accel )
- accel->setItemEnabled( key, enabled );
-#endif
-}
-
-QString QActionPPrivate::menuText() const
-{
- if ( menutext.isNull() )
- return text;
- return menutext;
-}
-
-QString QActionPPrivate::toolTip() const
-{
- if ( tooltip.isNull() ) {
-#ifndef QT_NO_ACCEL
- if ( accel )
- return text + " (" + QAccel::keyToString( accel->key( accelid )) + ")";
-#endif
- return text;
- }
- return tooltip;
-}
-
-QString QActionPPrivate::statusTip() const
-{
- if ( statustip.isNull() )
- return toolTip();
- return statustip;
-}
-
-
-
-/*!
- Constructs an action with parent \a parent and name \a name.
-
- If \a toggle is TRUE the action will be a toggle action, otherwise it
- will be a command action.
-
- If \a parent is a QActionPGroup, the new action inserts itself into \a parent.
-
- For accelerators and status tips to work, \a parent must either be a
- widget, or an action group whose parent is a widget.
-*/
-QActionP::QActionP( QObject* parent, const char* name, bool toggle )
- : QObject( parent, name )
-{
- d = new QActionPPrivate;
- d->toggleaction = toggle;
- init();
-}
-
-
-/*!
- This constructor creates an action with the following properties:
- the description \a text, the icon or iconset \a icon, the menu text
- \a menuText and keyboard accelerator \a accel. It is a child of \a parent
- and named \a name. If \a toggle is TRUE the action will be a toggle
- action, otherwise it will be a command action.
-
- If \a parent is a QActionPGroup, the action automatically becomes a
- member of it.
-
- For accelerators and status tips to work, \a parent must either be a
- widget, or an action group whose parent is a widget.
-
- The \a text and \a accel will be used for tool tips and status tips
- unless you provide specific text for these using setToolTip() and
- setStatusTip().
-*/
-QActionP::QActionP( const QString& text, const QIconSet& icon, const QString& menuText, QKeySequence accel, QObject* parent, const char* name, bool toggle )
- : QObject( parent, name )
-{
- d = new QActionPPrivate;
- d->toggleaction = toggle;
- if ( !icon.isNull() )
- setIconSet( icon );
-
- d->text = text;
- d->menutext = menuText;
- setAccel( accel );
- init();
-}
-
-/*! This constructor results in an iconless action with the description
- \a text, the menu text \a menuText and the keyboard accelerator \a accel.
- Its parent is \a parent and its name \a
- name. If \a toggle is TRUE the action will be a toggle
- action, otherwise it will be a command action.
-
- The action automatically becomes a member of \a parent if \a parent
- is a QActionPGroup.
-
- For accelerators and status tips to work, \a parent must either be a
- widget, or an action group whose parent is a widget.
-
- The \a text and \a accel will be used for tool tips and status tips
- unless you provide specific text for these using setToolTip() and
- setStatusTip().
-*/
-QActionP::QActionP( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent, const char* name, bool toggle )
- : QObject( parent, name )
-{
- d = new QActionPPrivate;
- d->toggleaction = toggle;
- d->text = text;
- d->menutext = menuText;
- setAccel( accel );
- init();
-}
-
-/*!
- \internal
-*/
-void QActionP::init()
-{
- if ( parent() && parent()->inherits("QActionPGroup") ) {
- ((QActionPGroup*) parent())->add( this ); // insert into action group
- }
-}
-
-/*! Destroys the object and frees allocated resources. */
-
-QActionP::~QActionP()
-{
- delete d;
-}
-
-/*! \property QActionP::iconSet
- \brief the action's icon
-
- The icon is used as the tool button icon and in the menu to the left
- of the menu text. There is no default icon.
-
- (See the action/toggleaction/toggleaction.cpp example.)
-
-*/
-void QActionP::setIconSet( const QIconSet& icon )
-{
- if ( icon.isNull() )
- return;
-
- register QIconSet *i = d->iconset;
- d->iconset = new QIconSet( icon );
- delete i;
- d->update( QActionPPrivate::Icons );
-}
-
-QIconSet QActionP::iconSet() const
-{
- if ( d->iconset )
- return *d->iconset;
- return QIconSet();
-}
-
-/*! \property QActionP::text
- \brief the action's descriptive text
-
- If \l QMainWindow::usesTextLabel is TRUE, the text appears as a
- label in the relevant tool button. It also serves as the default text
- in menus and tool tips if these have not been specifically defined. There
- is no default text.
-
- \sa setMenuText() setToolTip() setStatusTip()
-*/
-void QActionP::setText( const QString& text )
-{
- d->text = text;
- d->update();
-}
-
-QString QActionP::text() const
-{
- return d->text;
-}
-
-
-/*! \property QActionP::menuText
- \brief the action's menu text
-
- If the action is added to a menu the menu option will consist of
- the icon (if there is one), the menu text and the accelerator (if
- there is one). If the menu text is not explicitly set in the
- constructor or by using setMenuText() the action's description
- text will be used as the menu text. There is no default menu text.
-
- \sa text
-*/
-void QActionP::setMenuText( const QString& text ) { d->menutext = text;
- d->update(); }
-
-QString QActionP::menuText() const { return d->menuText(); }
-
-/*!
- \property QActionP::toolTip \brief the action's tool tip
-
- This text is used for the tool tip. If no status tip has been set
- the tool tip will be used for the status tip.
-
- If no tool tip is specified the action's text is used, and if that
- hasn't been specified the description text is used as the tool tip
- text.
-
- There is no default tool tip text.
-
- \sa setStatusTip() setAccel()
-*/
-void QActionP::setToolTip( const QString& tip )
-{
- d->tooltip = tip;
- d->update();
-}
-
-QString QActionP::toolTip() const
-{
- return d->toolTip();
-}
-
-/*! \property QActionP::statusTip
- \brief the action's status tip
-
- The statusTip is displayed on all status bars that this action's
- toplevel parent widget provides.
-
- If no status tip is defined, the action uses the tool tip text.
-
- There is no default tooltip text.
-
- \sa setStatusTip() setToolTip()
-*/
-//#### Please reimp for QActionPGroup!
-//#### For consistency reasons even action groups should show
-//#### status tips (as they already do with tool tips)
-//#### Please change QActionPGroup class doc appropriately after
-//#### reimplementation.
-void QActionP::setStatusTip( const QString& tip )
-{
- d->statustip = tip;
- d->update();
-}
-
-QString QActionP::statusTip() const
-{
- return d->statusTip();
-}
-
-/*!\property QActionP::whatsThis
- \brief the action's "What's This?" help text
-
- The whats this text is used to provide a brief description of the
- action. The text may contain rich text (i.e. HTML tags -- see
- QStyleSheet for the list of supported tags). There is no default
- "What's This" text.
-
- \sa QWhatsThis
-*/
-void QActionP::setWhatsThis( const QString& whatsThis )
-{
- if ( d->whatsthis == whatsThis )
- return;
- d->whatsthis = whatsThis;
-#ifndef QT_NO_ACCEL
- if ( !d->whatsthis.isEmpty() && d->accel )
- d->accel->setWhatsThis( d->accelid, d->whatsthis );
-#endif
- d->update();
-}
-
-QString QActionP::whatsThis() const
-{
- return d->whatsthis;
-}
-
-
-/*! \property QActionP::accel
- \brief the action's accelerator key
-
- The keycodes can be found in \l Qt::Key and \l
- Qt::Modifier. There is no default accelerator key.
-
-
-*/
-//#### Please reimp for QActionPGroup!
-//#### For consistency reasons even QActionPGroups should respond to
-//#### their accelerators and e.g. open the relevant submenu.
-//#### Please change appropriate QActionPGroup class doc after
-//#### reimplementation.
-void QActionP::setAccel( const QKeySequence& key )
-{
- d->key = key;
-#ifndef QT_NO_ACCEL
- delete d->accel;
- d->accel = 0;
-#endif
-
- if ( !(int)key ) {
- d->update();
- return;
- }
-
-#ifndef QT_NO_ACCEL
- QObject* p = parent();
- while ( p && !p->isWidgetType() ) {
- p = p->parent();
- }
- if ( p ) {
- d->accel = new QAccel( (QWidget*)p, this, "qt_action_accel" );
- d->accelid = d->accel->insertItem( d->key );
- d->accel->connectItem( d->accelid, this, SLOT( internalActivation() ) );
- if ( !d->whatsthis.isEmpty() )
- d->accel->setWhatsThis( d->accelid, d->whatsthis );
- }
-#if defined(QT_CHECK_STATE)
- else
- qWarning( "QActionP::setAccel() (%s) requires widget in parent chain.", name( "unnamed" ) );
-#endif
-#endif
- d->update();
-}
-
-
-QKeySequence QActionP::accel() const
-{
- return d->key;
-}
-
-
-/*!
- \property QActionP::toggleAction
- \brief whether the action is a toggle action
-
- A toggle action is one which has an on/off state. For example a Bold
- toolbar button is either on or off. An action which is not a toggle
- action is a command action; a command action is simply executed.
- This property's default is FALSE.
-
- In some situations, the state of one toggle action should depend on
- the state of others. For example, "Left Align", "Center" and "Right
- Align" toggle actions are mutually exclusive. To achieve exclusive
- toggling, add the relevant toggle actions to a QActionPGroup with the
- \l QActionPGroup::exclusive property set to TRUE.
-
-*/
-void QActionP::setToggleAction( bool enable )
-{
- if ( enable == (bool)d->toggleaction )
- return;
-
- if ( !enable )
- d->on = FALSE;
-
- d->toggleaction = enable;
- d->update();
-}
-
-bool QActionP::isToggleAction() const
-{
- return d->toggleaction;
-}
-
-/*!
- Toggles the state of a toggle action.
-
- \sa on, toggled(), isToggleAction()
-*/
-void QActionP::toggle()
-{
- if ( !isToggleAction() ) {
-#if defined(QT_CHECK_STATE)
- qWarning( "QActionP::toggle() (%s) Only toggle actions "
- "may be switched", name( "unnamed" ) );
-#endif
- return;
- }
- setOn( !isOn() );
-}
-
-/*!
- \property QActionP::on
- \brief whether a toggle action is on
-
- This property is always on (TRUE) for command actions and
- \l{QActionPGroup}s; setOn() has no effect on them. For action's where
- isToggleAction() is TRUE, this property's default value is off
- (FALSE).
-
- \sa toggleAction
-*/
-void QActionP::setOn( bool enable )
-{
- if ( !isToggleAction() ) {
-#if defined(QT_CHECK_STATE)
- qWarning( "QActionP::setOn() (%s) Only toggle actions "
- "may be switched", name( "unnamed" ) );
-#endif
- return;
- }
- if ( enable == (bool)d->on )
- return;
- d->on = enable;
- d->update( QActionPPrivate::State );
- emit toggled( enable );
-}
-
-bool QActionP::isOn() const
-{
- return d->on;
-}
-
-/*! \property QActionP::enabled
- \brief whether the action is enabled
-
- Disabled actions can't be chosen by the user. They don't
- disappear from the menu/tool bar but are displayed in a way which
- indicates that they are unavailable, e.g. they might be displayed
- greyed out.
-
- What's this? help on disabled actions is still available
- provided the \l QActionP::whatsThis property is set.
-
-*/
-void QActionP::setEnabled( bool enable )
-{
- d->enabled = enable;
-#ifndef QT_NO_ACCEL
- if ( d->accel )
- d->accel->setEnabled( enable );
-#endif
- d->update( QActionPPrivate::State );
-}
-
-bool QActionP::isEnabled() const
-{
- return d->enabled;
-}
-
-/*! \internal
-*/
-void QActionP::internalActivation()
-{
- if ( isToggleAction() )
- setOn( !isOn() );
- emit activated();
-}
-
-/*! \internal
-*/
-void QActionP::toolButtonToggled( bool on )
-{
- if ( !isToggleAction() )
- return;
- setOn( on );
-}
-
-/*! Adds this action to widget \a w.
-
- Currently actions may be added to QToolBar and QPopupMenu widgets.
-
- An action added to a tool bar is automatically displayed
- as a tool button; an action added to a pop up menu appears
- as a menu option.
-
- addTo() returns TRUE if the action was added successfully and FALSE
- otherwise. (If \a w is not a QToolBar or QPopupMenu the action will
- not be added and FALSE will be returned.)
-
- \sa removeFrom()
-*/
-bool QActionP::addTo( QWidget* w )
-{
-#ifndef QT_NO_TOOLBAR
- if ( w->inherits( "QToolBar" ) ) {
- if ( !qstrcmp( name(), "qt_separator_action" ) ) {
- ((QToolBar*)w)->addSeparator();
- } else {
- QCString bname = name() + QCString( "_action_button" );
- QToolButton* btn = new QToolButton( (QToolBar*) w, bname );
- addedTo( btn, w );
- btn->setToggleButton( d->toggleaction );
- d->toolbuttons.append( btn );
- if ( d->iconset )
- btn->setIconSet( *d->iconset );
- d->update( QActionPPrivate::State );
- d->update( QActionPPrivate::Everything );
- connect( btn, SIGNAL( clicked() ), this, SIGNAL( activated() ) );
- connect( btn, SIGNAL( toggled(bool) ), this, SLOT( toolButtonToggled(bool) ) );
- connect( btn, SIGNAL( destroyed() ), this, SLOT( objectDestroyed() ) );
-#ifndef QT_NO_TOOLTIP
- connect( d->tipGroup, SIGNAL(showTip(const QString&)), this, SLOT(showStatusText(const QString&)) );
- connect( d->tipGroup, SIGNAL(removeTip()), this, SLOT(clearStatusText()) );
-#endif
- }
- } else
-#endif
- if ( w->inherits( "QPopupMenu" ) ) {
- if ( !qstrcmp( name(), "qt_separator_action" ) ) {
- ((QPopupMenu*)w)->insertSeparator();
- } else {
- QActionPPrivate::MenuItem* mi = new QActionPPrivate::MenuItem;
- mi->popup = (QPopupMenu*) w;
- QIconSet* diconset = d->iconset;
- if ( diconset )
- mi->id = mi->popup->insertItem( *diconset, QString::fromLatin1("") );
- else
- mi->id = mi->popup->insertItem( QString::fromLatin1("") );
- addedTo( mi->popup->indexOf( mi->id ), mi->popup );
- mi->popup->connectItem( mi->id, this, SLOT(internalActivation()) );
- d->menuitems.append( mi );
- d->update( QActionPPrivate::State );
- d->update( QActionPPrivate::Everything );
- w->topLevelWidget()->className();
- connect( mi->popup, SIGNAL(highlighted( int )), this, SLOT(menuStatusText( int )) );
- connect( mi->popup, SIGNAL(aboutToHide()), this, SLOT(clearStatusText()) );
- connect( mi->popup, SIGNAL( destroyed() ), this, SLOT( objectDestroyed() ) );
- }
- // Makes only sense when called by QActionPGroup::addTo
- } else if ( w->inherits( "QComboBox" ) ) {
- if ( qstrcmp( name(), "qt_separator_action" ) ) {
- QActionPPrivate::ComboItem *ci = new QActionPPrivate::ComboItem;
- ci->combo = (QComboBox*)w;
- connect( ci->combo, SIGNAL( destroyed() ), this, SLOT( objectDestroyed() ) );
- ci->id = ci->combo->count();
- if ( d->iconset )
- ci->combo->insertItem( d->iconset->pixmap(), text() );
- else
- ci->combo->insertItem( text() );
- d->comboitems.append( ci );
- }
- } else {
- qWarning( "QActionP::addTo(), unknown object" );
- return FALSE;
- }
- return TRUE;
-}
-
-/*! This function is called from the addTo() function when it created
- a widget (\a actionWidget) for the action in the \a container.
-*/
-
-void QActionP::addedTo( QWidget *actionWidget, QWidget *container )
-{
- Q_UNUSED( actionWidget );
- Q_UNUSED( container );
-}
-
-/*! \overload
-
- This function is called from the addTo() function when it created
- a menu item at the index \a index in the popup menu \a menu.
-*/
-
-void QActionP::addedTo( int index, QPopupMenu *menu )
-{
- Q_UNUSED( index );
- Q_UNUSED( menu );
-}
-
-/*! Sets the status message to \a text */
-void QActionP::showStatusText( const QString& text )
-{
-#ifndef QT_NO_STATUSBAR
- // find out whether we are clearing the status bar by the popup that actually set the text
- static QPopupMenu *lastmenu = 0;
- QObject *s = (QObject*)sender();
- if ( s ) {
- QPopupMenu *menu = (QPopupMenu*)s->qt_cast( "QPopupMenu" );
- if ( menu && !!text )
- lastmenu = menu;
- else if ( menu && text.isEmpty() ) {
- if ( lastmenu && menu != lastmenu )
- return;
- lastmenu = 0;
- }
- }
-
- QObject* par = parent();
- QObject* lpar = 0;
- QStatusBar *bar = 0;
- while ( par && !bar ) {
- lpar = par;
- bar = (QStatusBar*)par->child( 0, "QStatusBar", FALSE );
- par = par->parent();
- }
- if ( !bar && lpar ) {
- QObjectList *l = lpar->queryList( "QStatusBar" );
- if ( !l )
- return;
- // #### hopefully the last one is the one of the mainwindow...
- bar = (QStatusBar*)l->last();
- delete l;
- }
- if ( bar ) {
- if ( text.isEmpty() )
- bar->clear();
- else
- bar->message( text );
- }
-#endif
-}
-
-/*! Sets the status message to the menu item's status text, or
- to the tooltip, if there is no status text.
-*/
-void QActionP::menuStatusText( int id )
-{
- QString text;
- QPtrListIterator<QActionPPrivate::MenuItem> it( d->menuitems);
- QActionPPrivate::MenuItem* mi;
- while ( ( mi = it.current() ) ) {
- ++it;
- if ( mi->id == id ) {
- text = statusTip();
- break;
- }
- }
-
- if ( !text.isEmpty() )
- showStatusText( text );
-}
-
-/*! Clears the status text.
-*/
-void QActionP::clearStatusText()
-{
- showStatusText( QString::null );
-}
-
-/*!
- Removes the action from widget \a w.
-
- Returns TRUE if the action was removed successfully; otherwise
- returns FALSE.
-
- \sa addTo()
-*/
-bool QActionP::removeFrom( QWidget* w )
-{
-#ifndef QT_NO_TOOLBAR
- if ( w->inherits( "QToolBar" ) ) {
- QPtrListIterator<QToolButton> it( d->toolbuttons);
- QToolButton* btn;
- while ( ( btn = it.current() ) ) {
- ++it;
- if ( btn->parentWidget() == w ) {
- d->toolbuttons.removeRef( btn );
- disconnect( btn, SIGNAL( destroyed() ), this, SLOT( objectDestroyed() ) );
- delete btn;
- // no need to disconnect from statusbar
- }
- }
- } else
-#endif
- if ( w->inherits( "QPopupMenu" ) ) {
- QPtrListIterator<QActionPPrivate::MenuItem> it( d->menuitems);
- QActionPPrivate::MenuItem* mi;
- while ( ( mi = it.current() ) ) {
- ++it;
- if ( mi->popup == w ) {
- disconnect( mi->popup, SIGNAL(highlighted( int )), this, SLOT(menuStatusText(int)) );
- disconnect( mi->popup, SIGNAL(aboutToHide()), this, SLOT(clearStatusText()) );
- disconnect( mi->popup, SIGNAL( destroyed() ), this, SLOT( objectDestroyed() ) );
- mi->popup->removeItem( mi->id );
- d->menuitems.removeRef( mi );
- }
- }
- } else if ( w->inherits( "QComboBox" ) ) {
- QPtrListIterator<QActionPPrivate::ComboItem> it( d->comboitems );
- QActionPPrivate::ComboItem *ci;
- while ( ( ci = it.current() ) ) {
- ++it;
- if ( ci->combo == w ) {
- disconnect( ci->combo, SIGNAL(destroyed()), this, SLOT(objectDestroyed()) );
- d->comboitems.removeRef( ci );
- }
- }
- } else {
- qWarning( "QActionP::removeFrom(), unknown object" );
- return FALSE;
- }
- return TRUE;
-}
-
-/*!
- \internal
-*/
-void QActionP::objectDestroyed()
-{
- const QObject* obj = sender();
- QPtrListIterator<QActionPPrivate::MenuItem> it( d->menuitems );
- QActionPPrivate::MenuItem* mi;
- while ( ( mi = it.current() ) ) {
- ++it;
- if ( mi->popup == obj )
- d->menuitems.removeRef( mi );
- }
- QActionPPrivate::ComboItem *ci;
- QPtrListIterator<QActionPPrivate::ComboItem> it2( d->comboitems );
- while ( ( ci = it2.current() ) ) {
- ++it2;
- if ( ci->combo == obj )
- d->comboitems.removeRef( ci );
- }
- d->toolbuttons.removeRef( (QToolButton*) obj );
-}
-
-/*! \fn void QActionP::activated()
-
- This signal is emitted when an action is activated by the user, i.e.
- when the user clicks a menu option or a toolbar button or presses an
- action's accelerator key combination.
-
- Connect to this signal for command actions. Connect to the toggled()
- signal for toggle actions.
-*/
-
-/*! \fn void QActionP::toggled(bool)
-
- This signal is emitted when a toggle action changes state;
- command actions and QActionPGroups don't emit toggled().
-
- The argument denotes the new state; i.e. TRUE
- if the toggle action was switched on and FALSE if
- it was switched off.
-
- To trigger a user command depending on whether a toggle action has
- been switched on or off connect it to a slot that takes a bool to
- indicate the state, e.g.
-
- \quotefile action/toggleaction/toggleaction.cpp
- \skipto QMainWindow * window
- \printline QMainWindow * window
- \skipto labelonoffaction
- \printline labelonoffaction
- \skipto connect
- \printuntil setUsesTextLabel
-
- \sa activated() setToggleAction() setOn()
-*/
-
-
-
-class QActionPGroupPrivate
-{
-public:
- uint exclusive: 1;
- uint dropdown: 1;
- QPtrList<QActionP> actions;
- QActionP* selected;
- QActionP* separatorAction;
-
- struct MenuItem {
- MenuItem():popup(0),id(0){}
- QPopupMenu* popup;
- int id;
- };
-
- QPtrList<QComboBox> comboboxes;
- QPtrList<QToolButton> menubuttons;
- QPtrList<MenuItem> menuitems;
- QPtrList<QPopupMenu> popupmenus;
-
- void update( const QActionPGroup * );
-};
-
-void QActionPGroupPrivate::update( const QActionPGroup* that )
-{
- for ( QPtrListIterator<QActionP> it( actions ); it.current(); ++it ) {
- it.current()->setEnabled( that->isEnabled() );
- }
- for ( QPtrListIterator<QComboBox> cb( comboboxes ); cb.current(); ++cb ) {
- cb.current()->setEnabled( that->isEnabled() );
-
-#ifndef QT_NO_TOOLTIP
- QToolTip::remove( cb.current() );
- if ( !!that->toolTip() )
- QToolTip::add( cb.current(), that->toolTip() );
-#endif
-#ifndef QT_NO_WHATSTHIS
- QWhatsThis::remove( cb.current() );
- if ( !!that->whatsThis() )
- QWhatsThis::add( cb.current(), that->whatsThis() );
-#endif
- }
- for ( QPtrListIterator<QToolButton> mb( menubuttons ); mb.current(); ++mb ) {
- mb.current()->setEnabled( that->isEnabled() );
-
- if ( !that->text().isNull() )
- mb.current()->setTextLabel( that->text() );
- if ( !that->iconSet().isNull() )
- mb.current()->setIconSet( that->iconSet() );
-
-#ifndef QT_NO_TOOLTIP
- QToolTip::remove( mb.current() );
- if ( !!that->toolTip() )
- QToolTip::add( mb.current(), that->toolTip() );
-#endif
-#ifndef QT_NO_WHATSTHIS
- QWhatsThis::remove( mb.current() );
- if ( !!that->whatsThis() )
- QWhatsThis::add( mb.current(), that->whatsThis() );
-#endif
- }
- for ( QPtrListIterator<QActionPGroupPrivate::MenuItem> pu( menuitems ); pu.current(); ++pu ) {
- QWidget* parent = pu.current()->popup->parentWidget();
- if ( parent->inherits( "QPopupMenu" ) ) {
- QPopupMenu* ppopup = (QPopupMenu*)parent;
- ppopup->setItemEnabled( pu.current()->id, that->isEnabled() );
- } else {
- pu.current()->popup->setEnabled( that->isEnabled() );
- }
- }
- for ( QPtrListIterator<QPopupMenu> pm( popupmenus ); pm.current(); ++pm ) {
- QPopupMenu *popup = pm.current();
- QPopupMenu *parent = popup->parentWidget()->inherits( "QPopupMenu" ) ? (QPopupMenu*)popup->parentWidget() : 0;
- if ( !parent )
- continue;
-
- int index;
- parent->findPopup( popup, &index );
- int id = parent->idAt( index );
- parent->changeItem( id, that->iconSet(), that->menuText() );
- parent->setItemEnabled( id, that->isEnabled() );
- parent->setAccel( that->accel(), id );
- }
-}
-
-/*!
- \class QActionPGroup qaction.h
- \ingroup basic
- \ingroup application
-
- \brief The QActionPGroup class groups actions together.
-
- In some situations it is useful to group actions together. For
- example, if you have a left justify action, a right justify action
- and a center action, only one of these actions should be active at
- any one time, and one simple way of achieving this is to group the
- actions together in an action group and call setExclusive(TRUE).
-
- An action group can also be added to a menu or a toolbar as a single
- unit, with all the actions within the action group appearing as
- separate menu options and toolbar buttons.
-
- Here's an example from examples/textedit:
- \quotefile textedit/textedit.cpp
- \skipto QActionPGroup
- \printuntil connect
-
- We create a new action group and call setExclusive() to ensure that
- only one of the actions in the group is ever active at any one time.
- We then connect the group's selected() signal to our textAlign() slot.
-
- \printuntil actionAlignLeft->setToggleAction
-
- We create a left align action, add it to the toolbar and the menu
- and make it a toggle action. We create center and right align
- actions in exactly the same way.
-
- \omit
- A QActionPGroup emits an activated() signal when one of its actions
- is activated.
- \endomit
- The actions in an action group emit their activated()
- (and for toggle actions, toggled()) signals as usual.
-
- The setExclusive() function is used to ensure that only one action
- is active at any one time: it should be used with actions which have
- their \c toggleAction set to TRUE.
-
- Action group actions appear as individual menu options and toolbar
- buttons. For exclusive action groups use setUsesDropDown() to
- display the actions in a subwidget of any widget the action group is
- added to. For example, the actions would appear in a combobox in a
- toolbar or as a submenu in a menu.
-
- Actions can be added to an action group using add(), but normally
- they are added by creating the action with the action group as
- parent. Actions can have separators dividing them using
- addSeparator(). Action groups are added to widgets with addTo().
-
-*/
-
-/*! Constructs an action group with parent \a parent and name \a name.
-
- If \a exclusive is TRUE only one toggle action in the group will
- ever be active.
-
-*/
-QActionPGroup::QActionPGroup( QObject* parent, const char* name, bool exclusive )
- : QActionP( parent, name )
-{
- d = new QActionPGroupPrivate;
- d->exclusive = exclusive;
- d->dropdown = FALSE;
- d->selected = 0;
- d->separatorAction = 0;
-
- connect( this, SIGNAL(selected(QActionP*)), SLOT(internalToggle(QActionP*)) );
-}
-
-/*! Destroys the object and frees allocated resources. */
-
-QActionPGroup::~QActionPGroup()
-{
- QPtrListIterator<QActionPGroupPrivate::MenuItem> mit( d->menuitems );
- while ( mit.current() ) {
- QActionPGroupPrivate::MenuItem *mi = mit.current();
- ++mit;
- if ( mi->popup )
- mi->popup->disconnect( SIGNAL(destroyed()), this, SLOT(objectDestroyed()) );
- }
-
- QPtrListIterator<QComboBox> cbit( d->comboboxes );
- while ( cbit.current() ) {
- QComboBox *cb = cbit.current();
- ++cbit;
- cb->disconnect( SIGNAL(destroyed()), this, SLOT(objectDestroyed()) );
- }
- QPtrListIterator<QToolButton> mbit( d->menubuttons );
- while ( mbit.current() ) {
- QToolButton *mb = mbit.current();
- ++mbit;
- mb->disconnect( SIGNAL(destroyed()), this, SLOT(objectDestroyed()) );
- }
- QPtrListIterator<QPopupMenu> pmit( d->popupmenus );
- while ( pmit.current() ) {
- QPopupMenu *pm = pmit.current();
- ++pmit;
- pm->disconnect( SIGNAL(destroyed()), this, SLOT(objectDestroyed()) );
- }
-
- delete d->separatorAction;
- d->menubuttons.setAutoDelete( TRUE );
- d->comboboxes.setAutoDelete( TRUE );
- d->menuitems.setAutoDelete( TRUE );
- d->popupmenus.setAutoDelete( TRUE );
- delete d;
-}
-
-/*! \property QActionPGroup::exclusive
- \brief whether the action group does exclusive toggling
-
- If exclusive is TRUE only one toggle action in the action group can
- ever be active at any one time. If the user chooses another toggle
- action in the group the one they chose becomes active and the one
- that was active becomes inactive. By default this property is FALSE.
-
- \sa QActionP::toggleAction
-*/
-void QActionPGroup::setExclusive( bool enable )
-{
- d->exclusive = enable;
-}
-
-bool QActionPGroup::isExclusive() const
-{
- return d->exclusive;
-}
-
-/*! \property QActionPGroup::usesDropDown
- \brief whether the group's actions are displayed in a
- subwidget of the widgets the action group is added to
-
- Exclusive action groups added to a toolbar display their actions in
- a combobox with the action's \l QActionP::text and \l
- QActionP::iconSet properties shown. Non-exclusive groups are
- represented by a tool button showing their \l QActionP::iconSet and
- -- depending on \l QMainWindow::usesTextLabel() -- text() property.
-
- In a popup menu the member actions are displayed in a
- submenu.
-
- Changing usesDropDown only effects \e subsequent calls to addTo().
-
- This property's default is FALSE.
-
-*/
-void QActionPGroup::setUsesDropDown( bool enable )
-{
- d->dropdown = enable;
-}
-
-bool QActionPGroup::usesDropDown() const
-{
- return d->dropdown;
-}
-
-/*! Adds action \a action to this group.
-
- Normally an action is added to a group by creating it with the group
- as parent, so this function is not usually used.
-
- \sa addTo()
-*/
-void QActionPGroup::add( QActionP* action )
-{
- if ( d->actions.containsRef( action ) )
- return;
-
- d->actions.append( action );
-
- if ( action->whatsThis().isNull() )
- action->setWhatsThis( whatsThis() );
- if ( action->toolTip().isNull() )
- action->setToolTip( toolTip() );
- action->setEnabled( isEnabled() );
-
- connect( action, SIGNAL( destroyed() ), this, SLOT( childDestroyed() ) );
- connect( action, SIGNAL( activated() ), this, SIGNAL( activated() ) );
- connect( action, SIGNAL( toggled( bool ) ), this, SLOT( childToggled( bool ) ) );
-
- for ( QPtrListIterator<QComboBox> cb( d->comboboxes ); cb.current(); ++cb ) {
- cb.current()->insertItem( action->iconSet().pixmap(), action->text() );
- }
- for ( QPtrListIterator<QToolButton> mb( d->menubuttons ); mb.current(); ++mb ) {
- QPopupMenu* popup = mb.current()->popup();
- if ( !popup )
- continue;
- action->addTo( popup );
- }
- for ( QPtrListIterator<QActionPGroupPrivate::MenuItem> mi( d->menuitems ); mi.current(); ++mi ) {
- QPopupMenu* popup = mi.current()->popup;
- if ( !popup )
- continue;
- action->addTo( popup );
- }
-}
-
-/*! Adds a separator to the group. */
-void QActionPGroup::addSeparator()
-{
- if ( !d->separatorAction )
- d->separatorAction = new QActionP( 0, "qt_separator_action" );
- d->actions.append( d->separatorAction );
-}
-
-
-/*! \fn void QActionPGroup::insert( QActionP* a )
-
- \obsolete
-
- Use add() instead, or better still create the action with the action
- group as its parent.
- */
-
-/*!
- Adds this action group to the widget \a w.
-
- If usesDropDown() is TRUE and exclusive is TRUE (see setExclusive())
- the actions are presented in a combobox if \a w is a toolbar and as
- a submenu if \a w is a menu. Otherwise (the default) the actions
- within the group are added to the widget individually. For example
- if the widget is a menu, the actions will appear as individual menu
- options, and if the widget is a toolbar, the actions will appear as
- toolbar buttons.
-
- It is recommended that actions in action groups, especially where
- usesDropDown() is TRUE, have their menuText() or text() property set.
-
- All actions should be added to the action group \e before the action
- group is added to the widget. If actions are added to the action
- group \e after the action group has been added to the widget these
- later actions will \e not appear.
-
- \sa setExclusive() setUsesDropDown() removeFrom()
-*/
-bool QActionPGroup::addTo( QWidget* w )
-{
-#ifndef QT_NO_TOOLBAR
- if ( w->inherits( "QToolBar" ) ) {
- if ( d->dropdown ) {
- if ( !d->exclusive ) {
- QPtrListIterator<QActionP> it( d->actions);
- if ( !it.current() )
- return TRUE;
-
- QActionP *defAction = it.current();
-
- QToolButton* btn = new QToolButton( (QToolBar*) w, "qt_actiongroup_btn" );
- addedTo( btn, w );
- connect( btn, SIGNAL(destroyed()), SLOT(objectDestroyed()) );
- d->menubuttons.append( btn );
-
- if ( !iconSet().isNull() )
- btn->setIconSet( iconSet() );
- else if ( !defAction->iconSet().isNull() )
- btn->setIconSet( defAction->iconSet() );
- if ( !!text() )
- btn->setTextLabel( text() );
- else if ( !!defAction->text() )
- btn->setTextLabel( defAction->text() );
-#ifndef QT_NO_TOOLTIP
- if ( !!toolTip() )
- QToolTip::add( btn, toolTip() );
- else if ( !!defAction->toolTip() )
- QToolTip::add( btn, defAction->toolTip() );
-#endif
-#ifndef QT_NO_WHATSTHIS
- if ( !!whatsThis() )
- QWhatsThis::add( btn, whatsThis() );
- else if ( !!defAction->whatsThis() )
- QWhatsThis::add( btn, defAction->whatsThis() );
-#endif
-
- connect( btn, SIGNAL( clicked() ), defAction, SIGNAL( activated() ) );
- connect( btn, SIGNAL( toggled(bool) ), defAction, SLOT( toolButtonToggled(bool) ) );
- connect( btn, SIGNAL( destroyed() ), defAction, SLOT( objectDestroyed() ) );
-
- QPopupMenu *menu = new QPopupMenu( btn, "qt_actiongroup_menu" );
- btn->setPopupDelay( 0 );
- btn->setPopup( menu );
-
- while( it.current() ) {
- it.current()->addTo( menu );
- ++it;
- }
- return TRUE;
- } else {
- QComboBox *box = new QComboBox( FALSE, w, "qt_actiongroup_combo" );
- addedTo( box, w );
- connect( box, SIGNAL(destroyed()), SLOT(objectDestroyed()) );
- d->comboboxes.append( box );
-#ifndef QT_NO_TOOLTIP
- if ( !!toolTip() )
- QToolTip::add( box, toolTip() );
-#endif
-#ifndef QT_NO_WHATSTHIS
- if ( !!whatsThis() )
- QWhatsThis::add( box, whatsThis() );
-#endif
-
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- it.current()->addTo( box );
- }
- connect( box, SIGNAL(activated(int)), this, SLOT( internalComboBoxActivated(int)) );
- return TRUE;
- }
- }
- } else
-#endif
- if ( w->inherits( "QPopupMenu" ) ) {
- QPopupMenu *popup;
- if ( d->dropdown ) {
- QPopupMenu *menu = (QPopupMenu*)w;
- popup = new QPopupMenu( w, "qt_actiongroup_menu" );
- d->popupmenus.append( popup );
- connect( popup, SIGNAL(destroyed()), SLOT(objectDestroyed()) );
-
- int id;
- if ( !iconSet().isNull() ) {
- if ( menuText().isEmpty() )
- id = menu->insertItem( iconSet(), text(), popup );
- else
- id = menu->insertItem( iconSet(), menuText(), popup );
- } else {
- if ( menuText().isEmpty() )
- id = menu->insertItem( text(), popup );
- else
- id = menu->insertItem( menuText(), popup );
- }
-
- addedTo( menu->indexOf( id ), menu );
-
- QActionPGroupPrivate::MenuItem *item = new QActionPGroupPrivate::MenuItem;
- item->id = id;
- item->popup = popup;
- d->menuitems.append( item );
- } else {
- popup = (QPopupMenu*)w;
- }
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- // #### do an addedTo( index, popup, action), need to find out index
- it.current()->addTo( popup );
- }
- return TRUE;
- }
-
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- // #### do an addedTo( index, popup, action), need to find out index
- it.current()->addTo( w );
- }
-
- return TRUE;
-}
-
-/*! \reimp
-*/
-bool QActionPGroup::removeFrom( QWidget* w )
-{
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- it.current()->removeFrom( w );
- }
-
-#ifndef QT_NO_TOOLBAR
- if ( w->inherits( "QToolBar" ) ) {
- QPtrListIterator<QComboBox> cb( d->comboboxes );
- while( cb.current() ) {
- QComboBox *box = cb.current();
- ++cb;
- if ( box->parentWidget() == w )
- delete box;
- }
- QPtrListIterator<QToolButton> mb( d->menubuttons );
- while( mb.current() ) {
- QToolButton *btn = mb.current();
- ++mb;
- if ( btn->parentWidget() == w )
- delete btn;
- }
- } else
-#endif
- if ( w->inherits( "QPopupMenu" ) ) {
- QPtrListIterator<QActionPGroupPrivate::MenuItem> pu( d->menuitems );
- while ( pu.current() ) {
- QActionPGroupPrivate::MenuItem *mi = pu.current();
- ++pu;
- if ( d->dropdown && mi->popup )
- ( (QPopupMenu*)w )->removeItem( mi->id );
- delete mi->popup;
- }
- }
-
- return TRUE;
-}
-
-/*! \internal
-*/
-void QActionPGroup::childToggled( bool b )
-{
- if ( !isExclusive() )
- return;
- QActionP* s = (QActionP*) sender();
- if ( b ) {
- if ( s != d->selected ) {
- d->selected = s;
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- if ( it.current()->isToggleAction() && it.current() != s )
- it.current()->setOn( FALSE );
- }
- emit activated();
- emit selected( s );
- }
- } else {
- if ( s == d->selected ) {
- // at least one has to be selected
- s->setOn( TRUE );
- }
- }
-}
-
-/*! \internal
-*/
-void QActionPGroup::childDestroyed()
-{
- d->actions.removeRef( (QActionP*) sender() );
- if ( d->selected == sender() )
- d->selected = 0;
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setEnabled( bool enable )
-{
- if ( enable == isEnabled() )
- return;
-
- QActionP::setEnabled( enable );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setIconSet( const QIconSet& icon )
-{
- QActionP::setIconSet( icon );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setText( const QString& txt )
-{
- if ( txt == text() )
- return;
-
- QActionP::setText( txt );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setMenuText( const QString& text )
-{
- if ( text == menuText() )
- return;
-
- QActionP::setMenuText( text );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setToolTip( const QString& text )
-{
- if ( text == toolTip() )
- return;
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- if ( it.current()->toolTip().isNull() )
- it.current()->setToolTip( text );
- }
- QActionP::setToolTip( text );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::setWhatsThis( const QString& text )
-{
- if ( text == whatsThis() )
- return;
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- if ( it.current()->whatsThis().isNull() )
- it.current()->setWhatsThis( text );
- }
- QActionP::setWhatsThis( text );
- d->update( this );
-}
-
-/*! \reimp
-*/
-void QActionPGroup::childEvent( QChildEvent *e )
-{
- if ( !e->child()->inherits( "QActionP" ) )
- return;
-
- QActionP *action = (QActionP*)e->child();
-
- if ( !e->removed() )
- return;
-
- for ( QPtrListIterator<QComboBox> cb( d->comboboxes ); cb.current(); ++cb ) {
- for ( int i = 0; i < cb.current()->count(); i++ ) {
- if ( cb.current()->text( i ) == action->text() ) {
- cb.current()->removeItem( i );
- break;
- }
- }
- }
- for ( QPtrListIterator<QToolButton> mb( d->menubuttons ); mb.current(); ++mb ) {
- QPopupMenu* popup = mb.current()->popup();
- if ( !popup )
- continue;
- action->removeFrom( popup );
- }
- for ( QPtrListIterator<QActionPGroupPrivate::MenuItem> mi( d->menuitems ); mi.current(); ++mi ) {
- QPopupMenu* popup = mi.current()->popup;
- if ( !popup )
- continue;
- action->removeFrom( popup );
- }
-}
-
-/*!
- \fn void QActionPGroup::selected( QActionP* )
-
- This signal is emitted from exclusive groups when toggle actions
- change state.
-
- The argument is the action whose state changed to "on".
-
- \quotefile action/actiongroup/editor.cpp
- \skipto QActionPGroup
- \printline QActionPGroup
- \skipto QObject::connect
- \printuntil SLOT
-
- In this example we connect the selected() signal to our own
- setFontColor() slot, passing the QActionP so that we know which
- action was chosen by the user.
-
- (See the \link actiongroup.html QActionPGroup Walkthrough. \endlink)
-
- \sa setExclusive(), isOn()
-*/
-
-/*! \internal
-*/
-void QActionPGroup::internalComboBoxActivated( int index )
-{
- QActionP *a = d->actions.at( index );
- if ( a ) {
- if ( a != d->selected ) {
- d->selected = a;
- for ( QPtrListIterator<QActionP> it( d->actions); it.current(); ++it ) {
- if ( it.current()->isToggleAction() && it.current() != a )
- it.current()->setOn( FALSE );
- }
- if ( a->isToggleAction() )
- a->setOn( TRUE );
-
- emit activated();
- emit selected( d->selected );
- emit ((QActionPGroup*)a)->activated();
- }
- }
-}
-
-/*! \internal
-*/
-void QActionPGroup::internalToggle( QActionP *a )
-{
- for ( QPtrListIterator<QComboBox> it( d->comboboxes); it.current(); ++it ) {
- int index = d->actions.find( a );
- if ( index != -1 )
- it.current()->setCurrentItem( index );
- }
-}
-
-/*! \internal
-*/
-void QActionPGroup::objectDestroyed()
-{
- const QObject* obj = sender();
- d->menubuttons.removeRef( (QToolButton*)obj );
- for ( QPtrListIterator<QActionPGroupPrivate::MenuItem> mi( d->menuitems ); mi.current(); ++mi ) {
- if ( mi.current()->popup == obj ) {
- d->menuitems.removeRef( mi.current() );
- break;
- }
- }
- d->popupmenus.removeRef( (QPopupMenu*)obj );
- d->comboboxes.removeRef( (QComboBox*)obj );
-}
-
-/*! This function is called from the addTo() function when it created
- a widget (\a actionWidget) for the child action \a a in the \a
- container.
-*/
-
-void QActionPGroup::addedTo( QWidget *actionWidget, QWidget *container, QActionP *a )
-{
- Q_UNUSED( actionWidget );
- Q_UNUSED( container );
- Q_UNUSED( a );
-}
-
-/*! \overload
-
- This function is called from the addTo() function when it created a
- menu item for the child action at the index \a index in the popup
- menu \a menu.
-*/
-
-void QActionPGroup::addedTo( int index, QPopupMenu *menu, QActionP *a )
-{
- Q_UNUSED( index );
- Q_UNUSED( menu );
- Q_UNUSED( a );
-}
-
-/*! \reimp
- \overload
- This function is called from the addTo() function when it created
- a widget (\a actionWidget) in the \a container.
-*/
-
-void QActionPGroup::addedTo( QWidget *actionWidget, QWidget *container )
-{
- Q_UNUSED( actionWidget );
- Q_UNUSED( container );
-}
-
-/*! \reimp
- \overload
- This function is called from the addTo() function when it created a
- menu item at the index \a index in the popup menu \a menu.
-
-*/
-
-void QActionPGroup::addedTo( int index, QPopupMenu *menu )
-{
- Q_UNUSED( index );
- Q_UNUSED( menu );
-}
-
-#endif
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qactionP.h
-// Description : the patch for Qt's QAction class (qaction.h)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Definition of QAction class
-**
-** Created : 000000
-**
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the widgets module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#ifndef QACTIONP_H
-#define QACTIONP_H
-
-#ifndef QT_H
-#include <qobject.h>
-#include <qiconset.h>
-#include <qstring.h>
-#include <qkeysequence.h>
-#endif // QT_H
-
-#ifndef QT_NO_ACTION
-
-class QActionPPrivate;
-class QActionPGroupPrivate;
-class QStatusBar;
-class QPopupMenu;
-
-class Q_EXPORT QActionP : public QObject
-{
- Q_OBJECT
- Q_PROPERTY( bool toggleAction READ isToggleAction WRITE setToggleAction)
- Q_PROPERTY( bool on READ isOn WRITE setOn )
- Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
- Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
- Q_PROPERTY( QString text READ text WRITE setText )
- Q_PROPERTY( QString menuText READ menuText WRITE setMenuText )
- Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
- Q_PROPERTY( QString statusTip READ statusTip WRITE setStatusTip )
- Q_PROPERTY( QString whatsThis READ whatsThis WRITE setWhatsThis )
- Q_PROPERTY( QKeySequence accel READ accel WRITE setAccel )
-
-public:
- QActionP( QObject* parent, const char* name = 0, bool toggle = FALSE );
- QActionP( const QString& text, const QIconSet& icon, const QString& menuText, QKeySequence accel,
- QObject* parent, const char* name = 0, bool toggle = FALSE );
- QActionP( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent,
- const char* name = 0, bool toggle = FALSE );
- ~QActionP();
-
- virtual void setIconSet( const QIconSet& );
- QIconSet iconSet() const;
- virtual void setText( const QString& );
- QString text() const;
- virtual void setMenuText( const QString& );
- QString menuText() const;
- virtual void setToolTip( const QString& );
- QString toolTip() const;
- virtual void setStatusTip( const QString& );
- QString statusTip() const;
- virtual void setWhatsThis( const QString& );
- QString whatsThis() const;
- virtual void setAccel( const QKeySequence& key );
- QKeySequence accel() const;
- virtual void setToggleAction( bool );
- bool isToggleAction() const;
- bool isOn() const;
- bool isEnabled() const;
- virtual bool addTo( QWidget* );
- virtual bool removeFrom( QWidget* );
-
-protected:
- virtual void addedTo( QWidget *actionWidget, QWidget *container );
- virtual void addedTo( int index, QPopupMenu *menu );
-
-public slots:
- void toggle();
- virtual void setOn( bool );
- virtual void setEnabled( bool );
-
-signals:
- void activated();
- void toggled( bool );
-
-private slots:
- void internalActivation();
- void toolButtonToggled( bool );
- void objectDestroyed();
- void menuStatusText( int id );
- void showStatusText( const QString& );
- void clearStatusText();
-
-private:
- void init();
-
- QActionPPrivate* d;
-
-};
-
-class Q_EXPORT QActionPGroup : public QActionP
-{
- Q_OBJECT
- Q_PROPERTY( bool exclusive READ isExclusive WRITE setExclusive )
- Q_PROPERTY( bool usesDropDown READ usesDropDown WRITE setUsesDropDown )
-
-public:
- QActionPGroup( QObject* parent, const char* name = 0, bool exclusive = TRUE );
- ~QActionPGroup();
- void setExclusive( bool );
- bool isExclusive() const;
- void add( QActionP* a);
- void addSeparator();
- bool addTo( QWidget* );
- bool removeFrom( QWidget* );
- void setEnabled( bool );
-
- void setUsesDropDown( bool enable );
- bool usesDropDown() const;
-
- void setIconSet( const QIconSet& );
- void setText( const QString& );
- void setMenuText( const QString& );
- void setToolTip( const QString& );
- void setWhatsThis( const QString& );
-
-protected:
- void childEvent( QChildEvent* );
- virtual void addedTo( QWidget *actionWidget, QWidget *container, QActionP *a );
- virtual void addedTo( int index, QPopupMenu *menu, QActionP *a );
- virtual void addedTo( QWidget *actionWidget, QWidget *container );
- virtual void addedTo( int index, QPopupMenu *menu );
-
-signals:
- void selected( QActionP* );
-
-private slots:
- void childToggled( bool );
- void childDestroyed();
- void internalComboBoxActivated( int );
- void internalToggle( QActionP* );
- void objectDestroyed();
-
-private:
- QActionPGroupPrivate* d;
-
-#ifndef QT_NO_COMPAT
-public:
- void insert( QActionP* a ) { add( a ); }
-#endif
-
-};
-
-#endif
-
-#endif
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qfiledialogP.cxx
-// Description : the patch for Qt's QFileDialog class (qfiledialog.cpp)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Implementation of QFileDialog class
-**
-** Created : 950429
-**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the dialogs module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#include "qplatformdefs.h"
-
-// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED.
-#if defined(connect)
-#undef connect
-#endif
-
-#include "qfiledialogP.h"
-
-#ifndef QT_NO_FILEDIALOG
-
-#include "qlineedit.h"
-#include "qcombobox.h"
-#include "qlistview.h"
-#include "qlistbox.h"
-#include "qlabel.h"
-#include "qpushbutton.h"
-#include "qtoolbutton.h"
-#include "qmessagebox.h"
-#include "qapplication.h"
-#include "private/qapplication_p.h"
-#include "qlayout.h"
-#include "qbitmap.h"
-#include "qpopupmenu.h"
-#include "qwidgetstack.h"
-#include "qbuttongroup.h"
-#include "qptrvector.h"
-#include "qregexp.h"
-#include "qstrlist.h"
-#include "qtimer.h"
-#include "qvbox.h"
-#include "qhbox.h"
-#include "qtooltip.h"
-#include "qheader.h"
-#include "qdragobject.h"
-#include "qmime.h"
-#include "qprogressbar.h"
-#include "qfile.h"
-#include "qcstring.h"
-#include "qobjectlist.h"
-#include "qcheckbox.h"
-#include "qsplitter.h"
-#include "qmap.h"
-#include "qnetworkprotocol.h"
-#include "qsemimodal.h"
-#include "qpainter.h"
-#include "qcleanuphandler.h"
-#include "qstyle.h"
-#include "qcursor.h"
-
-#ifndef Q_OS_TEMP
-#include <time.h>
-#endif
-#include <ctype.h>
-#include <stdlib.h>
-
-#ifdef Q_WS_MAC
-#include "qt_mac.h"
-#undef check
-#endif
-
-#ifdef Q_WS_WIN
-#include "qt_windows.h"
-#endif
-
-/* XPM */
-static const char * const start_xpm[]={
- "16 15 8 1",
- "a c #cec6bd",
- "# c #000000",
- "e c #ffff00",
- "b c #999999",
- "f c #cccccc",
- "d c #dcdcdc",
- "c c #ffffff",
- ". c None",
- ".....######aaaaa",
- "...bb#cccc##aaaa",
- "..bcc#cccc#d#aaa",
- ".bcef#cccc#dd#aa",
- ".bcfe#cccc#####a",
- ".bcef#ccccccccc#",
- "bbbbbbbbbbbbccc#",
- "bccccccccccbbcc#",
- "bcefefefefee#bc#",
- ".bcefefefefef#c#",
- ".bcfefefefefe#c#",
- "..bcfefefefeeb##",
- "..bbbbbbbbbbbbb#",
- "...#############",
- "................"};
-
-/* XPM */
-static const char * const end_xpm[]={
- "16 15 9 1",
- "d c #a0a0a0",
- "c c #c3c3c3",
- "# c #cec6bd",
- ". c #000000",
- "f c #ffff00",
- "e c #999999",
- "g c #cccccc",
- "b c #ffffff",
- "a c None",
- "......####aaaaaa",
- ".bbbb..###aaaaaa",
- ".bbbb.c.##aaaaaa",
- ".bbbb....ddeeeea",
- ".bbbbbbb.bbbbbe.",
- ".bbbbbbb.bcfgfe.",
- "eeeeeeeeeeeeefe.",
- "ebbbbbbbbbbeege.",
- "ebfgfgfgfgff.ee.",
- "aebfgfgfgfgfg.e.",
- "aebgfgfgfgfgf.e.",
- "aaebgfgfgfgffe..",
- "aaeeeeeeeeeeeee.",
- "aaa.............",
- "aaaaaaaaaaaaaaaa"};
-
-/* XPM */
-static const char* const open_xpm[]={
- "16 16 6 1",
- ". c None",
- "b c #ffff00",
- "d c #000000",
- "* c #999999",
- "c c #cccccc",
- "a c #ffffff",
- "................",
- "................",
- "...*****........",
- "..*aaaaa*.......",
- ".*abcbcba******.",
- ".*acbcbcaaaaaa*d",
- ".*abcbcbcbcbcb*d",
- "*************b*d",
- "*aaaaaaaaaa**c*d",
- "*abcbcbcbcbbd**d",
- ".*abcbcbcbcbcd*d",
- ".*acbcbcbcbcbd*d",
- "..*acbcbcbcbb*dd",
- "..*************d",
- "...ddddddddddddd",
- "................"};
-
-/* XPM */
-static const char * const link_dir_xpm[]={
- "16 16 10 1",
- "h c #808080",
- "g c #a0a0a0",
- "d c #000000",
- "b c #ffff00",
- "f c #303030",
- "# c #999999",
- "a c #cccccc",
- "e c #585858",
- "c c #ffffff",
- ". c None",
- "................",
- "................",
- "..#####.........",
- ".#ababa#........",
- "#abababa######..",
- "#cccccccccccc#d.",
- "#cbababababab#d.",
- "#cabababababa#d.",
- "#cbababdddddddd.",
- "#cababadccccccd.",
- "#cbababdcececcd.",
- "#cababadcefdfcd.",
- "#cbababdccgdhcd.",
- "#######dccchccd.",
- ".dddddddddddddd.",
- "................"};
-
-/* XPM */
-static const char * const link_file_xpm[]={
- "16 16 10 1",
- "h c #808080",
- "g c #a0a0a0",
- "d c #c3c3c3",
- ". c #7f7f7f",
- "c c #000000",
- "b c #bfbfbf",
- "f c #303030",
- "e c #585858",
- "a c #ffffff",
- "# c None",
- "################",
- "..........######",
- ".aaaaaaaab.#####",
- ".aaaaaaaaba.####",
- ".aaaaaaaacccc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaadc###",
- ".aaaaaaaaaadc###",
- ".aaaacccccccc###",
- ".aaaacaaaaaac###",
- ".aaaacaeaeaac###",
- ".aaaacaefcfac###",
- ".aaaacaagchac###",
- ".ddddcaaahaac###",
- "ccccccccccccc###"};
-
-/* XPM */
-static const char* const file_xpm[]={
- "16 16 5 1",
- ". c #7f7f7f",
- "# c None",
- "c c #000000",
- "b c #bfbfbf",
- "a c #ffffff",
- "################",
- "..........######",
- ".aaaaaaaab.#####",
- ".aaaaaaaaba.####",
- ".aaaaaaaacccc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".aaaaaaaaaabc###",
- ".bbbbbbbbbbbc###",
- "ccccccccccccc###"};
-
-/* XPM */
-static const char * const closed_xpm[]={
- "16 16 6 1",
- ". c None",
- "b c #ffff00",
- "d c #000000",
- "* c #999999",
- "a c #cccccc",
- "c c #ffffff",
- "................",
- "................",
- "..*****.........",
- ".*ababa*........",
- "*abababa******..",
- "*cccccccccccc*d.",
- "*cbababababab*d.",
- "*cabababababa*d.",
- "*cbababababab*d.",
- "*cabababababa*d.",
- "*cbababababab*d.",
- "*cabababababa*d.",
- "*cbababababab*d.",
- "**************d.",
- ".dddddddddddddd.",
- "................"};
-
-
-/* XPM */
-static const char* const cdtoparent_xpm[]={
- "15 13 3 1",
- ". c None",
- "* c #000000",
- "a c #ffff99",
- "..*****........",
- ".*aaaaa*.......",
- "***************",
- "*aaaaaaaaaaaaa*",
- "*aaaa*aaaaaaaa*",
- "*aaa***aaaaaaa*",
- "*aa*****aaaaaa*",
- "*aaaa*aaaaaaaa*",
- "*aaaa*aaaaaaaa*",
- "*aaaa******aaa*",
- "*aaaaaaaaaaaaa*",
- "*aaaaaaaaaaaaa*",
- "***************"};
-
-
-/* XPM */
-static const char* const newfolder_xpm[] = {
- "15 14 4 1",
- " c None",
- ". c #000000",
- "+ c #FFFF00",
- "@ c #FFFFFF",
- " . ",
- " ",
- " . ",
- " . . ",
- " .... . . . ",
- " .+@+@. . . ",
- ".......... . .",
- ".@+@+@+@+@.. ",
- ".+@+@+@+@+. . ",
- ".@+@+@+@+@. . ",
- ".+@+@+@+@+. ",
- ".@+@+@+@+@. ",
- ".+@+@+@+@+. ",
- "........... "};
-
-/* XPM */
-static const char* const detailedview_xpm[]={
- "14 11 3 1",
- ". c None",
- "* c #000000",
- "a c #000099",
- ".****.***.***.",
- "..............",
- "aaaaaaaaaaaaaa",
- "..............",
- ".****.***.***.",
- "..............",
- ".****.***.***.",
- "..............",
- ".****.***.***.",
- "..............",
- ".****.***.***."};
-
-/* XPM */
-static const char* const previewinfoview_xpm[]={
- "13 13 4 1",
- ". c #00007f",
- "a c black",
- "# c #cec6bd",
- "b c #000000",
- "..#####aaaaaa",
- ".#.#bb#a#####",
- "...####a#bbb#",
- "#######a#####",
- "#######a#bb##",
- "..#####a#####",
- ".#.#bb#a#bbb#",
- "...####a#####",
- "#######a#bb##",
- "#######a#####",
- "..#####a#bbb#",
- ".#.#bb#a#####",
- "...####aaaaaa"};
-
-/* XPM */
-static const char* const previewcontentsview_xpm[]={
- "14 13 5 1",
- ". c #00007f",
- "a c black",
- "c c #7f007f",
- "# c #cec6bd",
- "b c #000000",
- "..#####aaaaaaa",
- ".#.#bb#a#####a",
- "...####a#ccc#a",
- "#######a#ccc#a",
- "#######a#####a",
- "..#####a#bbb#a",
- ".#.#bb#a#####a",
- "...####a#bbb#a",
- "#######a#####a",
- "#######a#bbb#a",
- "..#####a#####a",
- ".#.#bb#a#####a",
- "...####aaaaaaa"};
-
-/* XPM */
-static const char* const mclistview_xpm[]={
- "15 11 4 1",
- "* c None",
- "b c #000000",
- ". c #000099",
- "a c #ffffff",
- "...*****...****",
- ".a.*bbb*.a.*bbb",
- "...*****...****",
- "***************",
- "...*****...****",
- ".a.*bbb*.a.*bbb",
- "...*****...****",
- "***************",
- "...*****...****",
- ".a.*bbb*.a.*bbb",
- "...*****...****"};
-
-/* XPM */
-static const char * const back_xpm [] = {
- "13 11 3 1",
- "a c #00ffff",
- "# c #000000",
- ". c None",
- ".....#.......",
- "....##.......",
- "...#a#.......",
- "..#aa########",
- ".#aaaaaaaaaa#",
- "#aaaaaaaaaaa#",
- ".#aaaaaaaaaa#",
- "..#aa########",
- "...#a#.......",
- "....##.......",
- ".....#......."};
-
-static QPixmap * openFolderIcon = 0;
-static QPixmap * closedFolderIcon = 0;
-static QPixmap * detailViewIcon = 0;
-static QPixmap * multiColumnListViewIcon = 0;
-static QPixmap * cdToParentIcon = 0;
-static QPixmap * newFolderIcon = 0;
-static QPixmap * fifteenTransparentPixels = 0;
-static QPixmap * symLinkDirIcon = 0;
-static QPixmap * symLinkFileIcon = 0;
-static QPixmap * fileIcon = 0;
-static QPixmap * startCopyIcon = 0;
-static QPixmap * endCopyIcon = 0;
-static QPixmap * previewContentsViewIcon = 0;
-static QPixmap * previewInfoViewIcon = 0;
-static QPixmap *goBackIcon = 0;
-static QFileIconProviderP * fileIconProvider = 0;
-static QSize *lastSize = 0;
-static QString * workingDirectory = 0;
-
-static bool bShowHiddenFiles = FALSE;
-static int sortFilesBy = (int)QDir::Name;
-static bool sortAscending = TRUE;
-static bool detailViewMode = FALSE;
-
-static QCleanupHandler<QPixmap> qfd_cleanup_pixmap;
-static QCleanupHandler<QSize> qfd_cleanup_size;
-static QCleanupHandler<QString> qfd_cleanup_string;
-
-static bool isDirectoryMode( int m )
-{
- return m == QFileDialogP::Directory || m == QFileDialogP::DirectoryOnly;
-}
-
-#if defined(Q_WS_WIN)
-
-class QWindowsIconProvider : public QFileIconProviderP
-{
-public:
- QWindowsIconProvider( QObject *parent=0, const char *name=0 );
- ~QWindowsIconProvider();
-
- const QPixmap * pixmap( const QFileInfo &fi );
-
-private:
- QPixmap defaultFolder;
- QPixmap defaultFile;
- QPixmap defaultExe;
- QPixmap pix;
- int pixw, pixh;
- QMap< QString, QPixmap > cache;
-};
-#endif
-
-static void makeVariables() {
- if ( !openFolderIcon ) {
- workingDirectory = new QString( QDir::currentDirPath() );
- qfd_cleanup_string.add( &workingDirectory );
-
- openFolderIcon = new QPixmap( (const char **)open_xpm);
- qfd_cleanup_pixmap.add( &openFolderIcon );
- symLinkDirIcon = new QPixmap( (const char **)link_dir_xpm);
- qfd_cleanup_pixmap.add( &symLinkDirIcon );
- symLinkFileIcon = new QPixmap( (const char **)link_file_xpm);
- qfd_cleanup_pixmap.add( &symLinkFileIcon );
- fileIcon = new QPixmap( (const char **)file_xpm);
- qfd_cleanup_pixmap.add( &fileIcon );
- closedFolderIcon = new QPixmap( (const char **)closed_xpm);
- qfd_cleanup_pixmap.add( &closedFolderIcon );
- detailViewIcon = new QPixmap( (const char **)detailedview_xpm);
- qfd_cleanup_pixmap.add( &detailViewIcon );
- multiColumnListViewIcon = new QPixmap( (const char **)mclistview_xpm);
- qfd_cleanup_pixmap.add( &multiColumnListViewIcon );
- cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm);
- qfd_cleanup_pixmap.add( &cdToParentIcon );
- newFolderIcon = new QPixmap( (const char **)newfolder_xpm);
- qfd_cleanup_pixmap.add( &newFolderIcon );
- previewInfoViewIcon
- = new QPixmap( (const char **)previewinfoview_xpm );
- qfd_cleanup_pixmap.add( &previewInfoViewIcon );
- previewContentsViewIcon
- = new QPixmap( (const char **)previewcontentsview_xpm );
- qfd_cleanup_pixmap.add( &previewContentsViewIcon );
- startCopyIcon = new QPixmap( (const char **)start_xpm );
- qfd_cleanup_pixmap.add( &startCopyIcon );
- endCopyIcon = new QPixmap( (const char **)end_xpm );
- qfd_cleanup_pixmap.add( &endCopyIcon );
- goBackIcon = new QPixmap( (const char **)back_xpm );
- qfd_cleanup_pixmap.add( &goBackIcon );
- fifteenTransparentPixels = new QPixmap( closedFolderIcon->width(), 1 );
- qfd_cleanup_pixmap.add( &fifteenTransparentPixels );
- QBitmap m( fifteenTransparentPixels->width(), 1 );
- m.fill( Qt::color0 );
- fifteenTransparentPixels->setMask( m );
- bShowHiddenFiles = FALSE;
- sortFilesBy = (int)QDir::Name;
- detailViewMode = FALSE;
-#if defined(Q_WS_WIN)
- if ( !fileIconProvider )
- fileIconProvider = new QWindowsIconProvider( qApp );
-#endif
- }
-}
-
-QFDProgressAnimation::QFDProgressAnimation( QWidget *parent )
- : QWidget( parent, "qt_progressanimation" )
-{
- setFixedSize( 300, 50 );
- step = -1;
- next();
- timer = new QTimer( this );
- connect( timer, SIGNAL( timeout() ),
- this, SLOT( next() ) );
-}
-
-void QFDProgressAnimation::start()
-{
- timer->start( 150, FALSE );
-}
-
-void QFDProgressAnimation::next()
-{
- ++step;
- if ( step > 10 )
- step = 0;
- repaint();
-}
-
-void QFDProgressAnimation::paintEvent( QPaintEvent * )
-{
- erase();
-
- QPainter p;
- p.begin( this );
- if ( step == 0 ) {
- p.drawPixmap( 5, ( height() - startCopyIcon->height() ) / 2,
- *startCopyIcon );
- p.drawPixmap( width() - 5 - openFolderIcon->width(),
- ( height() - openFolderIcon->height() ) / 2 , *openFolderIcon );
- } else if ( step == 10 ) {
- p.drawPixmap( 5, ( height() - openFolderIcon->height() ) / 2,
- *openFolderIcon );
- p.drawPixmap( width() - 5 - endCopyIcon->width(),
- ( height() - endCopyIcon->height() ) / 2 , *endCopyIcon );
- } else {
- p.drawPixmap( 5, ( height() - openFolderIcon->height() ) / 2,
- *openFolderIcon );
- p.drawPixmap( width() - 5 - openFolderIcon->width(),
- ( height() - openFolderIcon->height() ) / 2 , *openFolderIcon );
- int x = 10 + openFolderIcon->width();
- int w = width() - 2 * x;
- int s = w / 9;
- p.drawPixmap( x + s * step, ( height() - fileIcon->height() ) / 2 - fileIcon->height(),
- *fileIcon );
- }
-}
-
-QFDProgressDialog::QFDProgressDialog( QWidget *parent, const QString &fn, int steps )
- : QDialog( parent, "", TRUE )
-{
-#ifndef QT_NO_WIDGET_TOPEXTRA
- setCaption( QFileDialogP::tr( "Copy or Move a File" ) );
-#endif
- QVBoxLayout *layout = new QVBoxLayout( this );
- layout->setSpacing( 5 );
- layout->setMargin( 5 );
-
- animation = new QFDProgressAnimation( this );
- layout->addWidget( animation );
-
- layout->addWidget( new QLabel( QFileDialogP::tr( "Read: %1" ).arg( fn ),
- this, "qt_read_lbl" ) );
- readBar = new QProgressBar( steps, this, "qt_readbar" );
- readBar->reset();
- readBar->setProgress( 0 );
- layout->addWidget( readBar );
- writeLabel = new QLabel( QFileDialogP::tr( "Write: %1" ).arg( QString::null ),
- this, "qt_write_lbl" );
- layout->addWidget( writeLabel );
- writeBar = new QProgressBar( steps, this, "qt_writebar" );
- writeBar->reset();
- writeBar->setProgress( 0 );
- layout->addWidget( writeBar );
-
- QPushButton *b = new QPushButton( QFileDialogP::tr( "Cancel" ), this,
- "qt_cancel_btn" );
- b->setFixedSize( b->sizeHint() );
- layout->addWidget( b );
- connect( b, SIGNAL( clicked() ),
- this, SIGNAL( cancelled() ) );
-
- animation->start();
-}
-
-void QFDProgressDialog::setReadProgress( int p )
-{
- readBar->setProgress( p );
-}
-
-void QFDProgressDialog::setWriteProgress( int p )
-{
- writeBar->setProgress( p );
-}
-
-void QFDProgressDialog::setWriteLabel( const QString &s )
-{
- writeLabel->setText( QFileDialogP::tr( "Write: %1" ).arg( s ) );
-}
-
-/************************************************************************
- *
- * Private QFileDialogP members
- *
- ************************************************************************/
-
-class QFileDialogPrivate {
-public:
- ~QFileDialogPrivate();
-
- QStringList history;
-
- bool geometryDirty;
- QComboBox * paths;
- QComboBox * types;
- QLabel * pathL;
- QLabel * fileL;
- QLabel * typeL;
-
- QVBoxLayout * topLevelLayout;
- QHBoxLayout *buttonLayout, *leftLayout, *rightLayout;
- QPtrList<QHBoxLayout> extraWidgetsLayouts;
- QPtrList<QLabel> extraLabels;
- QPtrList<QWidget> extraWidgets;
- QPtrList<QWidget> extraButtons;
- QPtrList<QButton> toolButtons;
-
- QWidgetStack * stack;
-
- QToolButton * cdToParent, *newFolder, * detailView, * mcView,
- *previewInfo, *previewContents, *goBack;
- QButtonGroup * modeButtons;
-
- QString currentFileName;
- QListViewItem *last;
-
- struct File: public QListViewItem {
- File( QFileDialogPrivate * dlgp,
- const QUrlInfo * fi, QListViewItem * parent )
- : QListViewItem( parent, dlgp->last ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
- { setup(); dlgp->last = this; }
- File( QFileDialogPrivate * dlgp,
- const QUrlInfo * fi, QListView * parent )
- : QListViewItem( parent, dlgp->last ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
- { setup(); dlgp->last = this; }
- File( QFileDialogPrivate * dlgp,
- const QUrlInfo * fi, QListView * parent, QListViewItem * after )
- : QListViewItem( parent, after ), info( *fi ), d(dlgp), i( 0 ), hasMimePixmap( FALSE )
- { setup(); if ( !nextSibling() ) dlgp->last = this; }
- ~File();
-
- QString text( int column ) const;
- const QPixmap * pixmap( int ) const;
-
- QUrlInfo info;
- QFileDialogPrivate * d;
- QListBoxItem *i;
- bool hasMimePixmap;
- };
-
- class MCItem: public QListBoxItem {
- public:
- MCItem( QListBox *, QListViewItem * item );
- MCItem( QListBox *, QListViewItem * item, QListBoxItem *after );
- QString text() const;
- const QPixmap *pixmap() const;
- int height( const QListBox * ) const;
- int width( const QListBox * ) const;
- void paint( QPainter * );
- QListViewItem * i;
- };
-
- class UrlInfoList : public QPtrList<QUrlInfo> {
- public:
- UrlInfoList() { setAutoDelete( TRUE ); }
- int compareItems( QPtrCollection::Item n1, QPtrCollection::Item n2 ) {
- if ( !n1 || !n2 )
- return 0;
-
- QUrlInfo *i1 = ( QUrlInfo *)n1;
- QUrlInfo *i2 = ( QUrlInfo *)n2;
-
- if ( i1->isDir() && !i2->isDir() )
- return -1;
- if ( !i1->isDir() && i2->isDir() )
- return 1;
-
- if ( i1->name() == ".." )
- return -1;
- if ( i2->name() == ".." )
- return 1;
-
-#if defined(Q_OS_WIN32)
- if ( sortFilesBy == QDir::Name ) {
- QString name1 = i1->name().lower();
- QString name2 = i2->name().lower();
- return name1.compare( name2 );
- }
-#endif
- if ( QUrlInfo::equal( *i1, *i2, sortFilesBy ) )
- return 0;
- else if ( QUrlInfo::greaterThan( *i1, *i2, sortFilesBy ) )
- return 1;
- else if ( QUrlInfo::lessThan( *i1, *i2, sortFilesBy ) )
- return -1;
- // can't happen...
- return 0;
- }
- QUrlInfo *operator[]( int i ) {
- return at( i );
- }
- };
-
- UrlInfoList sortedList;
- QPtrList<File> pendingItems;
-
- QFileListBox * moreFiles;
-
- QFileDialogP::Mode mode;
-
- QString rw;
- QString ro;
- QString wo;
- QString inaccessible;
-
- QString symLinkToFile;
- QString file;
- QString symLinkToDir;
- QString dir;
- QString symLinkToSpecial;
- QString special;
- QWidgetStack *preview;
- bool infoPreview, contentsPreview;
- QSplitter *splitter;
- QUrlOperator url, oldUrl;
- QWidget *infoPreviewWidget, *contentsPreviewWidget;
- QFilePreviewP *infoPreviewer, *contentsPreviewer;
- bool hadDotDot;
-
- bool ignoreNextKeyPress;
- // ignores the next refresh operation in case the user forced a selection
- bool ignoreNextRefresh;
- QFDProgressDialog *progressDia;
- bool checkForFilter;
- bool ignoreReturn;
- bool ignoreStop;
-
- QTimer *mimeTypeTimer;
- const QNetworkOperation *currListChildren;
-
- // this is similar to QUrl::encode but does encode "*" and
- // doesn't encode whitespaces
- static QString encodeFileName( const QString& fName ) {
-
- QString newStr;
- QCString cName = fName.utf8();
- const QCString sChars(
-#ifdef Q_WS_WIN
- "#%"
-#else
- "<>#@\"&%$:,;?={}|^~[]\'`\\*"
-#endif
- );
-
- int len = cName.length();
- if ( !len )
- return QString::null;
- for ( int i = 0; i < len ;++i ) {
- uchar inCh = (uchar)cName[ i ];
- if ( inCh >= 128 || sChars.contains(inCh) )
- {
- newStr += QChar( '%' );
- ushort c = inCh / 16;
- c += c > 9 ? 'A' - 10 : '0';
- newStr += c;
- c = inCh % 16;
- c += c > 9 ? 'A' - 10 : '0';
- newStr += c;
- } else {
- newStr += inCh;
- }
- }
- return newStr;
- }
-
-};
-
-QFileDialogPrivate::~QFileDialogPrivate()
-{
- delete modeButtons;
-}
-
-
-
-/************************************************************************
- *
- * Internal class QRenameEdit
- *
- ************************************************************************/
-
-void QRenameEdit::keyPressEvent( QKeyEvent *e )
-{
- if ( e->key() == Key_Escape )
- emit escapePressed();
- else
- QLineEdit::keyPressEvent( e );
- e->accept();
-}
-
-void QRenameEdit::focusOutEvent( QFocusEvent * )
-{
- emit escapePressed();
-}
-
-/************************************************************************
- *
- * Internal class QFileListBox
- *
- ************************************************************************/
-
-QFileListBox::QFileListBox( QWidget *parent, QFileDialogP *dlg )
- : QListBox( parent, "filelistbox" ), filedialog( dlg ),
- renaming( FALSE ), renameItem( 0 ), mousePressed( FALSE ),
- firstMousePressEvent( TRUE )
-{
- changeDirTimer = new QTimer( this );
- QVBox *box = new QVBox( viewport(), "qt_vbox" );
- box->setFrameStyle( QFrame::Box | QFrame::Plain );
- lined = new QRenameEdit( box );
- lined->setFixedHeight( lined->sizeHint().height() );
- box->hide();
- box->setBackgroundMode( PaletteBase );
- renameTimer = new QTimer( this );
- connect( lined, SIGNAL( returnPressed() ),
- this, SLOT (rename() ) );
- connect( lined, SIGNAL( escapePressed() ),
- this, SLOT( cancelRename() ) );
- connect( renameTimer, SIGNAL( timeout() ),
- this, SLOT( doubleClickTimeout() ) );
- connect( changeDirTimer, SIGNAL( timeout() ),
- this, SLOT( changeDirDuringDrag() ) );
- connect( this, SIGNAL( contentsMoving( int, int ) ),
- this, SLOT( contentsMoved( int, int ) ) );
- viewport()->setAcceptDrops( TRUE );
- dragItem = 0;
-}
-
-void QFileListBox::show()
-{
- setBackgroundMode( PaletteBase );
- viewport()->setBackgroundMode( PaletteBase );
- QListBox::show();
-}
-
-void QFileListBox::keyPressEvent( QKeyEvent *e )
-{
- if ( ( e->key() == Key_Enter ||
- e->key() == Key_Return ) &&
- renaming )
- return;
-
- QString keyPressed = ((QKeyEvent *)e)->text().lower();
- QChar keyChar = keyPressed[0];
- if ( keyChar.isLetterOrNumber() ) {
- QListBoxItem * i = 0;
- if ( currentItem() )
- i = item( currentItem() );
- else
- i = firstItem();
- if ( i->next() )
- i = i->next();
- else
- i = firstItem();
- while ( i != item( currentItem() ) ) {
- QString it = text( index( i ) );
- if ( it[0].lower() == keyChar ) {
- clearSelection();
- setCurrentItem( i );
- } else {
- if ( i->next() )
- i = i->next();
- else
- i = firstItem();
- }
- }
- }
- cancelRename();
- QListBox::keyPressEvent( e );
-}
-
-void QFileListBox::viewportMousePressEvent( QMouseEvent *e )
-{
- pressPos = e->pos();
- mousePressed = FALSE;
-
- bool didRename = renaming;
-
- cancelRename();
- if ( !hasFocus() && !viewport()->hasFocus() )
- setFocus();
-
- if ( e->button() != LeftButton ) {
- QListBox::viewportMousePressEvent( e );
- firstMousePressEvent = FALSE;
- return;
- }
-
- int i = currentItem();
- bool wasSelected = FALSE;
- if ( i != -1 )
- wasSelected = item( i )->isSelected();
- QListBox::viewportMousePressEvent( e );
-
- QFileDialogPrivate::MCItem *i1 = (QFileDialogPrivate::MCItem*)item( currentItem() );
- if ( i1 )
- mousePressed = !( (QFileDialogPrivate::File*)i1->i )->info.isDir();
-
- if ( itemAt( e->pos() ) != item( i ) ) {
- firstMousePressEvent = FALSE;
- return;
- }
-
- if ( !firstMousePressEvent && !didRename && i == currentItem() && currentItem() != -1 &&
- wasSelected && filedialog->mode() != QFileDialogP::ExistingFiles &&
- QUrlInfo( filedialog->d->url, "." ).isWritable() && item( currentItem() )->text() != ".." ) {
- renameTimer->start( QApplication::doubleClickInterval(), TRUE );
- renameItem = item( i );
- }
-
- firstMousePressEvent = FALSE;
-}
-
-void QFileListBox::viewportMouseReleaseEvent( QMouseEvent *e )
-{
- dragItem = 0;
- QListBox::viewportMouseReleaseEvent( e );
- mousePressed = FALSE;
-}
-
-void QFileListBox::viewportMouseDoubleClickEvent( QMouseEvent *e )
-{
- renameTimer->stop();
- QListBox::viewportMouseDoubleClickEvent( e );
-}
-
-void QFileListBox::viewportMouseMoveEvent( QMouseEvent *e )
-{
- if ( !dragItem )
- dragItem = itemAt( e->pos() );
- renameTimer->stop();
-#ifndef QT_NO_DRAGANDDROP
- if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() && mousePressed ) {
- QListBoxItem *item = dragItem;
- dragItem = 0;
- if ( item ) {
- if ( !itemRect( item ).contains( e->pos() ) )
- return;
- QUriDrag* drag = new QUriDrag( viewport() );
- drag->setUnicodeUris( filedialog->selectedFiles() );
-
- if ( lined->parentWidget()->isVisible() )
- cancelRename();
-
- connect( drag, SIGNAL( destroyed() ),
- this, SLOT( dragObjDestroyed() ) );
- drag->drag();
-
- mousePressed = FALSE;
- }
- } else
-#endif
- {
- QListBox::viewportMouseMoveEvent( e );
- }
-
-}
-
-void QFileListBox::dragObjDestroyed()
-{
-#ifndef QT_NO_DRAGANDDROP
- //#######
- //filedialog->rereadDir();
-#endif
-}
-
-#ifndef QT_NO_DRAGANDDROP
-void QFileListBox::viewportDragEnterEvent( QDragEnterEvent *e )
-{
- startDragUrl = filedialog->d->url;
- startDragDir = filedialog->dirPath();
- currDropItem = 0;
-
- if ( !QUriDrag::canDecode( e ) ) {
- e->ignore();
- return;
- }
-
- QStringList l;
- QUriDrag::decodeLocalFiles( e, l );
- urls = (int)l.count();
-
- if ( acceptDrop( e->pos(), e->source() ) ) {
- e->accept();
- setCurrentDropItem( e->pos() );
- } else {
- e->ignore();
- setCurrentDropItem( QPoint( -1, -1 ) );
- }
-
- oldDragPos = e->pos();
-}
-
-void QFileListBox::viewportDragMoveEvent( QDragMoveEvent *e )
-{
- if ( acceptDrop( e->pos(), e->source() ) ) {
- switch ( e->action() ) {
- case QDropEvent::Copy:
- e->acceptAction();
- break;
- case QDropEvent::Move:
- e->acceptAction();
- break;
- case QDropEvent::Link:
- break;
- default:
- break;
- }
- if ( oldDragPos != e->pos() )
- setCurrentDropItem( e->pos() );
- } else {
- changeDirTimer->stop();
- e->ignore();
- setCurrentDropItem( QPoint( -1, -1 ) );
- }
-
- oldDragPos = e->pos();
-}
-
-void QFileListBox::viewportDragLeaveEvent( QDragLeaveEvent * )
-{
- changeDirTimer->stop();
- setCurrentDropItem( QPoint( -1, -1 ) );
-//########
-// if ( startDragDir != filedialog->d->url )
-// filedialog->setUrl( startDragUrl );
-}
-
-void QFileListBox::viewportDropEvent( QDropEvent *e )
-{
- changeDirTimer->stop();
-
- if ( !QUriDrag::canDecode( e ) ) {
- e->ignore();
- return;
- }
-
- QStrList l;
- QUriDrag::decode( e, l );
-
- bool move = e->action() == QDropEvent::Move;
-// bool supportAction = move || e->action() == QDropEvent::Copy;
-
- QUrlOperator dest;
- if ( currDropItem )
- dest = QUrlOperator( filedialog->d->url, QFileDialogPrivate::encodeFileName( currDropItem->text() ) );
- else
- dest = filedialog->d->url;
- QStringList lst;
- for ( uint i = 0; i < l.count(); ++i ) {
- lst << l.at( i );
- }
-
- filedialog->d->url.copy( lst, dest, move );
-
- // ##### what is supportAction for?
- e->acceptAction();
- currDropItem = 0;
-}
-
-bool QFileListBox::acceptDrop( const QPoint &pnt, QWidget *source )
-{
- QListBoxItem *item = itemAt( pnt );
- if ( !item || item && !itemRect( item ).contains( pnt ) ) {
- if ( source == viewport() && startDragDir == filedialog->dirPath() )
- return FALSE;
- return TRUE;
- }
-
- QUrlInfo fi( filedialog->d->url, item->text() );
-
- if ( fi.isDir() && itemRect( item ).contains( pnt ) )
- return TRUE;
- return FALSE;
-}
-
-void QFileListBox::setCurrentDropItem( const QPoint &pnt )
-{
- changeDirTimer->stop();
-
- QListBoxItem *item = 0;
- if ( pnt != QPoint( -1, -1 ) )
- item = itemAt( pnt );
- if ( item && !QUrlInfo( filedialog->d->url, item->text() ).isDir() )
- item = 0;
- if ( item && !itemRect( item ).contains( pnt ) )
- item = 0;
-
- currDropItem = item;
- if ( currDropItem )
- setCurrentItem( currDropItem );
- changeDirTimer->start( 750 );
-}
-#endif // QT_NO_DRAGANDDROP
-
-void QFileListBox::changeDirDuringDrag()
-{
-#ifndef QT_NO_DRAGANDDROP
- if ( !currDropItem )
- return;
- changeDirTimer->stop();
- QUrl u( filedialog->d->url, QFileDialogPrivate::encodeFileName(currDropItem->text()) );
- filedialog->setDir( u );
- currDropItem = 0;
-#endif
-}
-
-void QFileListBox::doubleClickTimeout()
-{
- startRename();
- renameTimer->stop();
-}
-
-void QFileListBox::startRename( bool check )
-{
- if ( check && ( !renameItem || renameItem != item( currentItem() ) ) )
- return;
-
- int i = currentItem();
- setSelected( i, TRUE );
- QRect r = itemRect( item( i ) );
- int bdr = item( i )->pixmap() ?
- item( i )->pixmap()->width() : 16;
- int x = r.x() + bdr;
- int y = r.y();
- int w = item( i )->width( this ) - bdr;
- int h = QMAX( lined->height() + 2, r.height() );
- y = y + r.height() / 2 - h / 2;
-
- lined->parentWidget()->setGeometry( x, y, w + 6, h );
- lined->setFocus();
- lined->setText( item( i )->text() );
- lined->selectAll();
- lined->setFrame( FALSE );
- lined->parentWidget()->show();
- viewport()->setFocusProxy( lined );
- renaming = TRUE;
-}
-
-void QFileListBox::clear()
-{
- cancelRename();
- QListBox::clear();
-}
-
-void QFileListBox::rename()
-{
- if ( !lined->text().isEmpty() ) {
- QString file = currentText();
-
- if ( lined->text() != file )
- filedialog->d->url.rename( file, lined->text() );
- }
- cancelRename();
-}
-
-void QFileListBox::cancelRename()
-{
- renameItem = 0;
- lined->parentWidget()->hide();
- viewport()->setFocusProxy( this );
- renaming = FALSE;
- updateItem( currentItem() );
- if ( lined->hasFocus() )
- viewport()->setFocus();
-}
-
-void QFileListBox::contentsMoved( int, int )
-{
- changeDirTimer->stop();
-#ifndef QT_NO_DRAGANDDROP
- setCurrentDropItem( QPoint( -1, -1 ) );
-#endif
-}
-
-/************************************************************************
- *
- * Internal class QFileListView
- *
- ************************************************************************/
-
-QFileDialogQFileListView::QFileDialogQFileListView( QWidget *parent, QFileDialogP *dlg )
- : QListView( parent, "qt_filedlg_listview" ), renaming( FALSE ), renameItem( 0 ),
- filedialog( dlg ), mousePressed( FALSE ),
- firstMousePressEvent( TRUE )
-{
- changeDirTimer = new QTimer( this );
- QVBox *box = new QVBox( viewport(), "qt_vbox" );
- box->setFrameStyle( QFrame::Box | QFrame::Plain );
- lined = new QRenameEdit( box );
- lined->setFixedHeight( lined->sizeHint().height() );
- box->hide();
- box->setBackgroundMode( PaletteBase );
- renameTimer = new QTimer( this );
- connect( lined, SIGNAL( returnPressed() ),
- this, SLOT (rename() ) );
- connect( lined, SIGNAL( escapePressed() ),
- this, SLOT( cancelRename() ) );
- header()->setMovingEnabled( FALSE );
- connect( renameTimer, SIGNAL( timeout() ),
- this, SLOT( doubleClickTimeout() ) );
- connect( changeDirTimer, SIGNAL( timeout() ),
- this, SLOT( changeDirDuringDrag() ) );
- disconnect( header(), SIGNAL( sectionClicked( int ) ),
- this, SLOT( changeSortColumn( int ) ) );
- connect( header(), SIGNAL( sectionClicked( int ) ),
- this, SLOT( changeSortColumn2( int ) ) );
- connect( this, SIGNAL( contentsMoving( int, int ) ),
- this, SLOT( contentsMoved( int, int ) ) );
-
- viewport()->setAcceptDrops( TRUE );
- sortcolumn = 0;
- ascending = TRUE;
- dragItem = 0;
-}
-
-void QFileDialogQFileListView::setSorting( int column, bool increasing )
-{
- if ( column == -1 ) {
- QListView::setSorting( column, increasing );
- return;
- }
-
- sortAscending = ascending = increasing;
- sortcolumn = column;
- switch ( column ) {
- case 0:
- sortFilesBy = QDir::Name;
- break;
- case 1:
- sortFilesBy = QDir::Size;
- break;
- case 3:
- sortFilesBy = QDir::Time;
- break;
- default:
- sortFilesBy = QDir::Name; // #### ???
- break;
- }
-
- filedialog->resortDir();
-}
-
-void QFileDialogQFileListView::changeSortColumn2( int column )
-{
- int lcol = header()->mapToLogical( column );
- setSorting( lcol, sortcolumn == lcol ? !ascending : TRUE );
-}
-
-void QFileDialogQFileListView::keyPressEvent( QKeyEvent *e )
-{
- if ( ( e->key() == Key_Enter ||
- e->key() == Key_Return ) &&
- renaming )
- return;
-
- QString keyPressed = e->text().lower();
- QChar keyChar = keyPressed[0];
- if ( keyChar.isLetterOrNumber() ) {
- QListViewItem * i = 0;
- if ( currentItem() )
- i = currentItem();
- else
- i = firstChild();
- if ( i->nextSibling() )
- i = i->nextSibling();
- else
- i = firstChild();
- while ( i != currentItem() ) {
- QString it = i->text(0);
- if ( it[0].lower() == keyChar ) {
- clearSelection();
- ensureItemVisible( i );
- setCurrentItem( i );
- } else {
- if ( i->nextSibling() )
- i = i->nextSibling();
- else
- i = firstChild();
- }
- }
- return;
- }
-
- cancelRename();
- QListView::keyPressEvent( e );
-}
-
-void QFileDialogQFileListView::viewportMousePressEvent( QMouseEvent *e )
-{
- pressPos = e->pos();
- mousePressed = FALSE;
-
- bool didRename = renaming;
- cancelRename();
- if ( !hasFocus() && !viewport()->hasFocus() )
- setFocus();
-
- if ( e->button() != LeftButton ) {
- QListView::viewportMousePressEvent( e );
- firstMousePressEvent = FALSE;
- return;
- }
-
- QListViewItem *i = currentItem();
- QListView::viewportMousePressEvent( e );
-
- QFileDialogPrivate::File *i1 = (QFileDialogPrivate::File*)currentItem();
- if ( i1 )
- mousePressed = !i1->info.isDir();
-
- if ( itemAt( e->pos() ) != i ||
- e->x() + contentsX() > columnWidth( 0 ) ) {
- firstMousePressEvent = FALSE;
- return;
- }
-
- if ( !firstMousePressEvent && !didRename && i == currentItem() && currentItem() &&
- filedialog->mode() != QFileDialogP::ExistingFiles &&
- QUrlInfo( filedialog->d->url, "." ).isWritable() && currentItem()->text( 0 ) != ".." ) {
- renameTimer->start( QApplication::doubleClickInterval(), TRUE );
- renameItem = currentItem();
- }
-
- firstMousePressEvent = FALSE;
-}
-
-void QFileDialogQFileListView::viewportMouseDoubleClickEvent( QMouseEvent *e )
-{
- renameTimer->stop();
- QListView::viewportMouseDoubleClickEvent( e );
-}
-
-void QFileDialogQFileListView::viewportMouseReleaseEvent( QMouseEvent *e )
-{
- QListView::viewportMouseReleaseEvent( e );
- mousePressed = FALSE;
- dragItem = 0;
-}
-
-void QFileDialogQFileListView::viewportMouseMoveEvent( QMouseEvent *e )
-{
- renameTimer->stop();
- if ( !dragItem )
- dragItem = itemAt( e->pos() );
-#ifndef QT_NO_DRAGANDDROP
- if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() && mousePressed ) {
- QListViewItem *item = dragItem;
- dragItem = 0;
- if ( item ) {
- QUriDrag* drag = new QUriDrag( viewport() );
- drag->setUnicodeUris( filedialog->selectedFiles() );
-
- if ( lined->isVisible() )
- cancelRename();
-
- connect( drag, SIGNAL( destroyed() ),
- this, SLOT( dragObjDestroyed() ) );
- drag->drag();
-
- mousePressed = FALSE;
- }
- }
-#endif
-}
-
-void QFileDialogQFileListView::dragObjDestroyed()
-{
-#ifndef QT_NO_DRAGANDDROP
- //######
- //filedialog->rereadDir();
-#endif
-}
-
-#ifndef QT_NO_DRAGANDDROP
-void QFileDialogQFileListView::viewportDragEnterEvent( QDragEnterEvent *e )
-{
- startDragUrl = filedialog->d->url;
- startDragDir = filedialog->dirPath();
- currDropItem = 0;
-
- if ( !QUriDrag::canDecode( e ) ) {
- e->ignore();
- return;
- }
-
- QStringList l;
- QUriDrag::decodeLocalFiles( e, l );
- urls = (int)l.count();
-
- if ( acceptDrop( e->pos(), e->source() ) ) {
- e->accept();
- setCurrentDropItem( e->pos() );
- } else {
- e->ignore();
- setCurrentDropItem( QPoint( -1, -1 ) );
- }
-
- oldDragPos = e->pos();
-}
-
-void QFileDialogQFileListView::viewportDragMoveEvent( QDragMoveEvent *e )
-{
- if ( acceptDrop( e->pos(), e->source() ) ) {
- if ( oldDragPos != e->pos() )
- setCurrentDropItem( e->pos() );
- switch ( e->action() ) {
- case QDropEvent::Copy:
- e->acceptAction();
- break;
- case QDropEvent::Move:
- e->acceptAction();
- break;
- case QDropEvent::Link:
- break;
- default:
- break;
- }
- } else {
- changeDirTimer->stop();
- e->ignore();
- setCurrentDropItem( QPoint( -1, -1 ) );
- }
-
- oldDragPos = e->pos();
-}
-
-void QFileDialogQFileListView::viewportDragLeaveEvent( QDragLeaveEvent * )
-{
- changeDirTimer->stop();
- setCurrentDropItem( QPoint( -1, -1 ) );
-//########
-// if ( startDragDir != filedialog->d->url )
-// filedialog->setUrl( startDragUrl );
-}
-
-void QFileDialogQFileListView::viewportDropEvent( QDropEvent *e )
-{
- changeDirTimer->stop();
-
- if ( !QUriDrag::canDecode( e ) ) {
- e->ignore();
- return;
- }
-
- QStringList l;
- QUriDrag::decodeToUnicodeUris( e, l );
-
- bool move = e->action() == QDropEvent::Move;
-// bool supportAction = move || e->action() == QDropEvent::Copy;
-
- QUrlOperator dest;
- if ( currDropItem )
- dest = QUrlOperator( filedialog->d->url, QFileDialogPrivate::encodeFileName( currDropItem->text( 0 ) ) );
- else
- dest = filedialog->d->url;
- filedialog->d->url.copy( l, dest, move );
-
- // ##### what is supportAction for?
- e->acceptAction();
- currDropItem = 0;
-}
-
-bool QFileDialogQFileListView::acceptDrop( const QPoint &pnt, QWidget *source )
-{
- QListViewItem *item = itemAt( pnt );
- if ( !item || item && !itemRect( item ).contains( pnt ) ) {
- if ( source == viewport() && startDragDir == filedialog->dirPath() )
- return FALSE;
- return TRUE;
- }
-
- QUrlInfo fi( filedialog->d->url, item->text( 0 ) );
-
- if ( fi.isDir() && itemRect( item ).contains( pnt ) )
- return TRUE;
- return FALSE;
-}
-
-void QFileDialogQFileListView::setCurrentDropItem( const QPoint &pnt )
-{
- changeDirTimer->stop();
-
- QListViewItem *item = itemAt( pnt );
- if ( pnt == QPoint( -1, -1 ) )
- item = 0;
- if ( item && !QUrlInfo( filedialog->d->url, item->text( 0 ) ).isDir() )
- item = 0;
-
- if ( item && !itemRect( item ).contains( pnt ) )
- item = 0;
-
- currDropItem = item;
-
- if ( currDropItem )
- setCurrentItem( currDropItem );
-
- changeDirTimer->start( 750 );
-}
-#endif // QT_NO_DRAGANDDROP
-
-void QFileDialogQFileListView::changeDirDuringDrag()
-{
-#ifndef QT_NO_DRAGANDDROP
- if ( !currDropItem )
- return;
- changeDirTimer->stop();
- QUrl u( filedialog->d->url, QFileDialogPrivate::encodeFileName(currDropItem->text( 0 ) ) );
- filedialog->setDir( u );
- currDropItem = 0;
-#endif // QT_NO_DRAGANDDROP
-}
-
-
-void QFileDialogQFileListView::doubleClickTimeout()
-{
- startRename();
- renameTimer->stop();
-}
-
-void QFileDialogQFileListView::startRename( bool check )
-{
- if ( check && ( !renameItem || renameItem != currentItem() ) )
- return;
-
- QListViewItem *i = currentItem();
- setSelected( i, TRUE );
-
- QRect r = itemRect( i );
- int bdr = i->pixmap( 0 ) ?
- i->pixmap( 0 )->width() : 16;
- int x = r.x() + bdr;
- int y = r.y();
- int w = columnWidth( 0 ) - bdr;
- int h = QMAX( lined->height() + 2, r.height() );
- y = y + r.height() / 2 - h / 2;
-
- lined->parentWidget()->setGeometry( x, y, w + 6, h );
- lined->setFocus();
- lined->setText( i->text( 0 ) );
- lined->selectAll();
- lined->setFrame( FALSE );
- lined->parentWidget()->show();
- viewport()->setFocusProxy( lined );
- renaming = TRUE;
-}
-
-void QFileDialogQFileListView::clear()
-{
- cancelRename();
- QListView::clear();
-}
-
-void QFileDialogQFileListView::rename()
-{
- if ( !lined->text().isEmpty() ) {
- QString file = currentItem()->text( 0 );
-
- if ( lined->text() != file )
- filedialog->d->url.rename( file, lined->text() );
- }
- cancelRename();
-}
-
-void QFileDialogQFileListView::cancelRename()
-{
- renameItem = 0;
- lined->parentWidget()->hide();
- viewport()->setFocusProxy( this );
- renaming = FALSE;
- if ( currentItem() )
- currentItem()->repaint();
- if ( lined->hasFocus() )
- viewport()->setFocus();
-}
-
-void QFileDialogQFileListView::contentsMoved( int, int )
-{
- changeDirTimer->stop();
-#ifndef QT_NO_DRAGANDDROP
- setCurrentDropItem( QPoint( -1, -1 ) );
-#endif
-}
-
-
-QFileDialogPrivate::File::~File()
-{
- if ( d->pendingItems.findRef( this ) )
- d->pendingItems.removeRef( this );
-}
-
-QString QFileDialogPrivate::File::text( int column ) const
-{
- makeVariables();
-
- switch( column ) {
- case 0:
- return info.name();
- case 1:
- if ( info.isFile() )
- return QString::number(info.size());
- else
- return QString::fromLatin1("");
- case 2:
- if ( info.isFile() && info.isSymLink() ) {
- return d->symLinkToFile;
- } else if ( info.isFile() ) {
- return d->file;
- } else if ( info.isDir() && info.isSymLink() ) {
- return d->symLinkToDir;
- } else if ( info.isDir() ) {
- return d->dir;
- } else if ( info.isSymLink() ) {
- return d->symLinkToSpecial;
- } else {
- return d->special;
- }
- case 3: {
- return info.lastModified().toString( Qt::LocalDate );
- }
- case 4:
- if ( info.isReadable() )
- return info.isWritable() ? d->rw : d->ro;
- else
- return info.isWritable() ? d->wo : d->inaccessible;
- }
-
- return QString::fromLatin1("<--->");
-}
-
-const QPixmap * QFileDialogPrivate::File::pixmap( int column ) const
-{
- if ( column ) {
- return 0;
- } else if ( QListViewItem::pixmap( column ) ) {
- return QListViewItem::pixmap( column );
- } else if ( info.isSymLink() ) {
- if ( info.isFile() )
- return symLinkFileIcon;
- else
- return symLinkDirIcon;
- } else if ( info.isDir() ) {
- return closedFolderIcon;
- } else if ( info.isFile() ) {
- return fileIcon;
- } else {
- return fifteenTransparentPixels;
- }
-}
-
-QFileDialogPrivate::MCItem::MCItem( QListBox * lb, QListViewItem * item )
- : QListBoxItem()
-{
- i = item;
- if ( lb )
- lb->insertItem( this );
-}
-
-QFileDialogPrivate::MCItem::MCItem( QListBox * lb, QListViewItem * item, QListBoxItem *after )
- : QListBoxItem()
-{
- i = item;
- if ( lb )
- lb->insertItem( this, after );
-}
-
-QString QFileDialogPrivate::MCItem::text() const
-{
- return i->text( 0 );
-}
-
-
-const QPixmap *QFileDialogPrivate::MCItem::pixmap() const
-{
- return i->pixmap( 0 );
-}
-
-
-int QFileDialogPrivate::MCItem::height( const QListBox * lb ) const
-{
- if ( pixmap() )
- return QMAX( lb->fontMetrics().height(), pixmap()->height()) + 2;
-
- return lb->fontMetrics().height() + 2;
-}
-
-
-int QFileDialogPrivate::MCItem::width( const QListBox * lb ) const
-{
- QFontMetrics fm = lb->fontMetrics();
- int w = 2;
- if ( pixmap() )
- w += pixmap()->width() + 4;
- else
- w += 18;
- w += fm.width( text() );
- w += -fm.minLeftBearing();
- w += -fm.minRightBearing();
- w += 6;
- return w;
-}
-
-
-void QFileDialogPrivate::MCItem::paint( QPainter * ptr )
-{
- QFontMetrics fm = ptr->fontMetrics();
-
- int h;
-
- if ( pixmap() )
- h = QMAX( fm.height(), pixmap()->height()) + 2;
- else
- h = fm.height() + 2;
-
- const QPixmap * pm = pixmap();
- if ( pm )
- ptr->drawPixmap( 2, 1, *pm );
-
- ptr->drawText( pm ? pm->width() + 4 : 22, h - fm.descent() - 2,
- text() );
-}
-
-static QStringList makeFiltersList( const QString &filter )
-{
- if ( filter.isEmpty() )
- return QStringList();
-
- int i = filter.find( ";;", 0 );
- QString sep( ";;" );
- if ( i == -1 ) {
- if ( filter.find( "\n", 0 ) != -1 ) {
- sep = "\n";
- i = filter.find( sep, 0 );
- }
- }
-
- return QStringList::split( sep, filter );
-}
-
-/*!
- \class QFileDialogP qfiledialog.h
- \brief The QFileDialogP class provides dialogs that allow users to select files or directories.
- \ingroup dialogs
- \mainclass
-
- The QFileDialogP class enables a user to traverse their file system in
- order to select one or many files or a directory.
-
- The easiest way to create a QFileDialogP is to use the static
- functions. On Windows, these static functions will call the native
- Windows file dialog and on Mac OS X, these static function will call
- the native Mac OS X file dialog.
-
- \code
- QString s = QFileDialogP::getOpenFileName(
- "/home",
- "Images (*.png *.xpm *.jpg)",
- this,
- "open file dialog"
- "Choose a file" );
- \endcode
-
- In the above example, a modal QFileDialogP is created using a static
- function. The startup directory is set to "/home". The file filter
- is set to "Images (*.png *.xpm *.jpg)". The parent of the file dialog
- is set to \e this and it is given the identification name - "open file
- dialog". The caption at the top of file dialog is set to "Choose a
- file".
-
- You can create your own QFileDialogP without using the static
- functions. By calling setMode(), you can set what can be returned by
- the QFileDialogP.
-
- \code
- QFileDialogP* fd = new QFileDialogP( this, "file dialog", TRUE );
- fd->setMode( QFileDialogP::AnyFile );
- \endcode
-
- In the above example, the mode of the file dialog is set to \c
- AnyFile, meaning that the user can select any file, or even specify a
- file that doesn't exist. This mode is useful for creating a "File Save
- As" file dialog. Use \c ExistingFile if the user must select an
- existing file or \c Directory if only a directory may be selected.
- (See the \l QFileDialogP::Mode enum for the complete list of modes.)
-
- You can retrieve the dialog's mode with mode(). Use setFilter() to set
- the dialog's file filter, e.g.
-
- \code
- fd->setFilter( "Images (*.png *.xpm *.jpg)" );
- \endcode
-
- In the above example, the filter is set to "Images (*.png *.xpm
- *.jpg)", this means that only files with the extension \c png, \c xpm
- or \c jpg will be shown in the QFileDialogP. You can apply
- several filters by using setFilters() and add additional filters with
- addFilter(). Use setSelectedFilter() to select one of the filters
- you've given as the file dialog's default filter. Whenever the user
- changes the filter the filterSelected() signal is emitted.
-
- The file dialog has two view modes, QFileDialogP::List which simply
- lists file and directory names and QFileDialogP::Detail which
- displays additional information alongside each name, e.g. file size,
- modification date, etc. Set the mode with setViewMode().
-
- \code
- fd->setViewMode( QFileDialogP::Detail );
- \endcode
-
- The last important function you will need to use when creating your
- own file dialog is selectedFile().
-
- \code
- QString fileName;
- if ( fd->exec() == QDialog::Accepted )
- fileName = fd->selectedFile();
- \endcode
-
- In the above example, a modal file dialog is created and shown. If
- the user clicked OK, then the file they selected is put in \c
- fileName.
-
- If you are using the \c ExistingFiles mode then you will need to use
- selectedFiles() which will return the selected files in a QStringList.
-
- The dialog's working directory can be set with setDir(). The display
- of hidden files is controlled with setShowHiddenFiles(). The dialog
- can be forced to re-read the directory with rereadDir() and re-sort
- the directory with resortDir(). All the files in the current directory
- can be selected with selectAll().
-
- \section1 Creating and using preview widgets
-
- There are two kinds of preview widgets that can be used with
- QFileDialogPs: \e content preview widgets and \e information preview
- widgets. They are created and used in the same way except that the
- function names differ, e.g. setContentsPreview() and setInfoPreview().
-
- A preview widget is a widget that is placed inside a QFileDialogP so
- that the user can see either the contents of the file, or information
- about the file.
-
- \code
- class Preview : public QLabel, public QFilePreviewP
- {
- public:
- Preview( QWidget *parent=0 ) : QLabel( parent ) {}
-
- void previewUrl( const QUrl &u )
- {
- QString path = u.path();
- QPixmap pix( path );
- if ( pix.isNull() )
- setText( "This is not a pixmap" );
- else
- setPixmap( pix );
- }
- };
- \endcode
-
- In the above snippet, we create a preview widget which inherits from
- QLabel and QFilePreviewP. File preview widgets \e must inherit from
- QFilePreviewP.
-
- Inside the class we reimplement QFilePreviewP::previewUrl(), this is
- where we determine what happens when a file is selected. In the
- above example we only show a preview of the file if it is a valid
- pixmap. Here's how to make a file dialog use a preview widget:
-
- \code
- Preview* p = new Preview;
-
- QFileDialogP* fd = new QFileDialogP( this );
- fd->setContentsPreviewEnabled( TRUE );
- fd->setContentsPreview( p, p );
- fd->setPreviewMode( QFileDialogP::Contents );
- fd->show();
- \endcode
-
- The first line creates an instance of our preview widget. We then
- create our file dialog and call setContentsPreviewEnabled( TRUE ),
- this tell the file dialog to preview the contents of the currently
- selected file. We then call setContentsPreview() -- note that we pass
- the same preview widget twice. Finally, before showing the file
- dialog, we call setPreviewMode() setting the mode to \e Contents which
- will show the contents preview of the file that the user has selected.
-
- If you create another preview widget that is used for displaying
- information about a file, create it in the same way as the contents
- preview widget and call setInfoPreviewEnabled(), and
- setInfoPreview(). Then the user will be able to switch between the
- two preview modes.
-
- For more information about creating a QFilePreviewP widget see
- \l{QFilePreviewP}.
-
- <img src=qfiledlg-m.png> <img src=qfiledlg-w.png>
-
-*/
-
-
-/*! \enum QFileDialogP::Mode
-
- This enum is used to indicate what the user may select in the file
- dialog, i.e. what the dialog will return if the user clicks OK.
-
- \value AnyFile The name of a file, whether it exists or not.
- \value ExistingFile The name of a single existing file.
- \value Directory The name of a directory. Both files and directories
- are displayed.
- \value DirectoryOnly The name of a directory. The file dialog will only display directories.
- \value ExistingFiles The names of zero or more existing files.
-
- See setMode().
-*/
-
-/*!
- \enum QFileDialogP::ViewMode
-
- This enum describes the view mode of the file dialog, i.e. what
- information about each file will be displayed.
-
- \value List Display file and directory names with icons.
- \value Detail Display file and directory names with icons plus
- additional information, such as file size and modification date.
-
- See setViewMode().
-*/
-
-/*!
- \enum QFileDialogP::PreviewMode
-
- This enum describes the preview mode of the file dialog.
-
- \value NoPreview No preview is shown at all.
- \value Contents Show a preview of the contents of the current file
- using the contents preview widget.
- \value Info Show information about the current file using the
- info preview widget.
-
- See setPreviewMode(), setContentsPreview() and setInfoPreview().
-*/
-
-/*!
- \fn void QFileDialogP::detailViewSelectionChanged()
- \internal
-*/
-
-/*!
- \fn void QFileDialogP::listBoxSelectionChanged()
- \internal
-*/
-
-extern const char qt_file_dialog_filter_reg_exp[] =
- "([a-zA-Z0-9 ]*)\\(([a-zA-Z0-9_.*? +;#\\[\\]]*)\\)$";
-
-/*!
- Constructs a file dialog called \a name, with the parent, \a parent.
- If \a modal is TRUE then the file dialog is modal; otherwise it is
- modeless.
-*/
-
-QFileDialogP::QFileDialogP( QWidget *parent, const char *name, bool modal )
- : QDialog( parent, name, modal,
- (modal ?
- (WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu) : 0) )
-{
- init();
- d->mode = ExistingFile;
- d->types->insertItem( tr( "All Files (*)" ) );
- emit dirEntered( d->url.dirPath() );
- rereadDir();
-}
-
-
-/*!
- Constructs a file dialog called \a name with the parent, \a parent.
- If \a modal is TRUE then the file dialog is modal; otherwise it is
- modeless.
-
- If \a dirName is specified then it will be used as the dialog's
- working directory, i.e. it will be the directory that is shown when
- the dialog appears. If \a filter is specified it will be used as the
- dialog's file filter.
-
-*/
-
-QFileDialogP::QFileDialogP( const QString& dirName, const QString & filter,
- QWidget *parent, const char *name, bool modal )
- : QDialog( parent, name, modal,
- (modal ?
- (WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu) : 0) )
-{
- init();
- d->mode = ExistingFile;
- rereadDir();
- if ( !dirName.isEmpty() )
- setSelection( dirName );
- else if ( workingDirectory && !workingDirectory->isEmpty() )
- setDir( *workingDirectory );
-
- if ( !filter.isEmpty() ) {
- setFilters( filter );
- if ( !dirName.isEmpty() ) {
- int dotpos = dirName.find( QChar('.'), 0, FALSE );
- if ( dotpos != -1 ) {
- for ( int b=0 ; b<d->types->count() ; b++ ) {
- if ( d->types->text(b).contains( dirName.right( dirName.length() - dotpos ) ) ) {
- d->types->setCurrentItem( b );
- setFilter( d->types->text( b ) );
- return;
- }
- }
- }
- }
- } else {
- d->types->insertItem( tr( "All Files (*)" ) );
- }
-}
-
-
-/*!
- \internal
- Initializes the file dialog.
-*/
-
-void QFileDialogP::init()
-{
- setSizeGripEnabled( TRUE );
- d = new QFileDialogPrivate();
- d->mode = AnyFile;
- d->last = 0;
- d->moreFiles = 0;
- d->infoPreview = FALSE;
- d->contentsPreview = FALSE;
- d->hadDotDot = FALSE;
- d->ignoreNextKeyPress = FALSE;
- d->progressDia = 0;
- d->checkForFilter = FALSE;
- d->ignoreReturn = FALSE;
- d->ignoreNextRefresh = FALSE;
- d->ignoreStop = FALSE;
- d->pendingItems.setAutoDelete( FALSE );
- d->mimeTypeTimer = new QTimer( this );
- connect( d->mimeTypeTimer, SIGNAL( timeout() ),
- this, SLOT( doMimeTypeLookup() ) );
-
- d->url = QUrlOperator( QDir::currentDirPath() );
- d->oldUrl = d->url;
- d->currListChildren = 0;
-
- connect( &d->url, SIGNAL( start( QNetworkOperation * ) ),
- this, SLOT( urlStart( QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( finished( QNetworkOperation * ) ),
- this, SLOT( urlFinished( QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( newChildren( const QValueList<QUrlInfo> &, QNetworkOperation * ) ),
- this, SLOT( insertEntry( const QValueList<QUrlInfo> &, QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( removed( QNetworkOperation * ) ),
- this, SLOT( removeEntry( QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ),
- this, SLOT( createdDirectory( const QUrlInfo &, QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( itemChanged( QNetworkOperation * ) ),
- this, SLOT( itemChanged( QNetworkOperation * ) ) );
- connect( &d->url, SIGNAL( dataTransferProgress( int, int, QNetworkOperation * ) ),
- this, SLOT( dataTransferProgress( int, int, QNetworkOperation * ) ) );
-
- nameEdit = new QLineEdit( this, "name/filter editor" );
- nameEdit->setMaxLength( 255 ); //_POSIX_MAX_PATH
- connect( nameEdit, SIGNAL(textChanged(const QString&)),
- this, SLOT(fileNameEditDone()) );
- nameEdit->installEventFilter( this );
-
- d->splitter = new QSplitter( this, "qt_splitter" );
-
- d->stack = new QWidgetStack( d->splitter, "files and more files" );
-
- d->splitter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-
- files = new QFileDialogQFileListView( d->stack, this );
- QFontMetrics fm = fontMetrics();
- files->addColumn( tr("Name") );
- files->addColumn( tr("Size") );
- files->setColumnAlignment( 1, AlignRight );
- files->addColumn( tr("Type") );
- files->addColumn( tr("Date") );
- files->addColumn( tr("Attributes") );
- files->header()->setStretchEnabled( TRUE, 0 );
-
- files->setMinimumSize( 50, 25 + 2*fm.lineSpacing() );
-
- connect( files, SIGNAL( selectionChanged() ),
- this, SLOT( detailViewSelectionChanged() ) );
- connect( files, SIGNAL(currentChanged(QListViewItem *)),
- this, SLOT(updateFileNameEdit(QListViewItem *)) );
- connect( files, SIGNAL(doubleClicked(QListViewItem *)),
- this, SLOT(selectDirectoryOrFile(QListViewItem *)) );
- connect( files, SIGNAL(returnPressed(QListViewItem *)),
- this, SLOT(selectDirectoryOrFile(QListViewItem *)) );
- connect( files, SIGNAL(rightButtonPressed(QListViewItem *,
- const QPoint &, int)),
- this, SLOT(popupContextMenu(QListViewItem *,
- const QPoint &, int)) );
-
- files->installEventFilter( this );
- files->viewport()->installEventFilter( this );
-
- d->moreFiles = new QFileListBox( d->stack, this );
- d->moreFiles->setRowMode( QListBox::FitToHeight );
- d->moreFiles->setVariableWidth( TRUE );
-
- connect( d->moreFiles, SIGNAL(selected(QListBoxItem *)),
- this, SLOT(selectDirectoryOrFile(QListBoxItem *)) );
- connect( d->moreFiles, SIGNAL( selectionChanged() ),
- this, SLOT( listBoxSelectionChanged() ) );
- connect( d->moreFiles, SIGNAL(highlighted(QListBoxItem *)),
- this, SLOT(updateFileNameEdit(QListBoxItem *)) );
- connect( d->moreFiles, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ),
- this, SLOT( popupContextMenu( QListBoxItem *, const QPoint & ) ) );
-
- d->moreFiles->installEventFilter( this );
- d->moreFiles->viewport()->installEventFilter( this );
-
- okB = new QPushButton( tr("OK"), this, "OK" ); //### Or "Save (see other "OK")
- okB->setDefault( TRUE );
- okB->setEnabled( FALSE );
- connect( okB, SIGNAL(clicked()), this, SLOT(okClicked()) );
- cancelB = new QPushButton( tr("Cancel") , this, "Cancel" );
- connect( cancelB, SIGNAL(clicked()), this, SLOT(cancelClicked()) );
-
- d->paths = new QComboBox( TRUE, this, "directory history/editor" );
- d->paths->setDuplicatesEnabled( FALSE );
- d->paths->setInsertionPolicy( QComboBox::NoInsertion );
- const QFileInfoList * rootDrives = QDir::drives();
- QFileInfoListIterator it( *rootDrives );
- QFileInfo *fi;
- makeVariables();
-
- while ( (fi = it.current()) != 0 ) {
- ++it;
- d->paths->insertItem( *openFolderIcon, fi->absFilePath() );
- }
-
- if ( !!QDir::homeDirPath() ) {
- if ( !d->paths->listBox()->findItem( QDir::homeDirPath() ) )
- d->paths->insertItem( *openFolderIcon, QDir::homeDirPath() );
- }
-
- connect( d->paths, SIGNAL(activated(const QString&)),
- this, SLOT(setDir(const QString&)) );
-
- d->paths->installEventFilter( this );
- QObjectList *ol = d->paths->queryList( "QLineEdit" );
- if ( ol && ol->first() )
- ( (QLineEdit*)ol->first() )->installEventFilter( this );
- delete ol;
-
- d->geometryDirty = TRUE;
- d->types = new QComboBox( TRUE, this, "file types" );
- d->types->setDuplicatesEnabled( FALSE );
- d->types->setEditable( FALSE );
- connect( d->types, SIGNAL(activated(const QString&)),
- this, SLOT(setFilter(const QString&)) );
- connect( d->types, SIGNAL(activated(const QString&)),
- this, SIGNAL(filterSelected(const QString&)) );
-
- d->pathL = new QLabel( d->paths, tr("Look &in:"), this, "qt_looin_lbl" );
- d->fileL = new QLabel( nameEdit, tr("File &name:"), this, "qt_filename_lbl" );
- d->typeL = new QLabel( d->types, tr("File &type:"), this, "qt_filetype_lbl" );
-
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP ) {
- d->goBack = new QToolButton( this, "go back" );
- d->goBack->setAutoRaise( TRUE );
- d->goBack->setEnabled( FALSE );
- d->goBack->setFocusPolicy( TabFocus );
- connect( d->goBack, SIGNAL( clicked() ),
- this, SLOT( goBack() ) );
- QToolTip::add( d->goBack, tr( "Back" ) );
- d->goBack->setIconSet( *goBackIcon );
- } else {
- d->goBack = 0;
- }
-#else
- d->goBack = 0;
-#endif
-
- d->cdToParent = new QToolButton( this, "cd to parent" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->cdToParent->setAutoRaise( TRUE );
-#endif
- d->cdToParent->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->cdToParent, tr( "One directory up" ) );
-#endif
- d->cdToParent->setIconSet( *cdToParentIcon );
- connect( d->cdToParent, SIGNAL(clicked()),
- this, SLOT(cdUpClicked()) );
-
- d->newFolder = new QToolButton( this, "new folder" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->newFolder->setAutoRaise( TRUE );
-#endif
- d->newFolder->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->newFolder, tr( "Create New Folder" ) );
-#endif
- d->newFolder->setIconSet( *newFolderIcon );
- connect( d->newFolder, SIGNAL(clicked()),
- this, SLOT(newFolderClicked()) );
-
- d->modeButtons = new QButtonGroup( 0, "invisible group" );
- connect( d->modeButtons, SIGNAL(destroyed()),
- this, SLOT(modeButtonsDestroyed()) );
- d->modeButtons->setExclusive( TRUE );
- connect( d->modeButtons, SIGNAL(clicked(int)),
- d->stack, SLOT(raiseWidget(int)) );
- connect( d->modeButtons, SIGNAL(clicked(int)),
- this, SLOT(changeMode(int)) );
-
- d->mcView = new QToolButton( this, "mclistbox view" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->mcView->setAutoRaise( TRUE );
-#endif
- d->mcView->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->mcView, tr( "List View" ) );
-#endif
- d->mcView->setIconSet( *multiColumnListViewIcon );
- d->mcView->setToggleButton( TRUE );
- d->stack->addWidget( d->moreFiles, d->modeButtons->insert( d->mcView ) );
- d->detailView = new QToolButton( this, "list view" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->detailView->setAutoRaise( TRUE );
-#endif
- d->detailView->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->detailView, tr( "Detail View" ) );
-#endif
- d->detailView->setIconSet( *detailViewIcon );
- d->detailView->setToggleButton( TRUE );
- d->stack->addWidget( files, d->modeButtons->insert( d->detailView ) );
-
- d->previewInfo = new QToolButton( this, "preview info view" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->previewInfo->setAutoRaise( TRUE );
-#endif
- d->previewInfo->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->previewInfo, tr( "Preview File Info" ) );
-#endif
- d->previewInfo->setIconSet( *previewInfoViewIcon );
- d->previewInfo->setToggleButton( TRUE );
- d->modeButtons->insert( d->previewInfo );
-
- d->previewContents = new QToolButton( this, "preview info view" );
-#if defined(Q_WS_WIN)
- if ( qt_winver == Qt::WV_2000 || qt_winver == Qt::WV_XP )
- d->previewContents->setAutoRaise( TRUE );
-#endif
- d->previewContents->setFocusPolicy( TabFocus );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( d->previewContents, tr( "Preview File Contents" ) );
-#endif
- d->previewContents->setIconSet( *previewContentsViewIcon );
- d->previewContents->setToggleButton( TRUE );
- d->modeButtons->insert( d->previewContents );
-
- connect( d->detailView, SIGNAL( clicked() ),
- d->moreFiles, SLOT( cancelRename() ) );
- connect( d->detailView, SIGNAL( clicked() ),
- files, SLOT( cancelRename() ) );
- connect( d->mcView, SIGNAL( clicked() ),
- d->moreFiles, SLOT( cancelRename() ) );
- connect( d->mcView, SIGNAL( clicked() ),
- files, SLOT( cancelRename() ) );
-
- d->stack->raiseWidget( d->moreFiles );
- d->mcView->setOn( TRUE );
-
- QHBoxLayout *lay = new QHBoxLayout( this );
- lay->setMargin( 6 );
- d->leftLayout = new QHBoxLayout( lay, 5 );
- d->topLevelLayout = new QVBoxLayout( (QWidget*)0, 5 );
- lay->addLayout( d->topLevelLayout, 1 );
- d->extraWidgetsLayouts.setAutoDelete( FALSE );
- d->extraLabels.setAutoDelete( FALSE );
- d->extraWidgets.setAutoDelete( FALSE );
- d->extraButtons.setAutoDelete( FALSE );
- d->toolButtons.setAutoDelete( FALSE );
-
- QHBoxLayout * h;
-
- d->preview = new QWidgetStack( d->splitter, "qt_preview" );
-
- d->infoPreviewWidget = new QWidget( d->preview, "qt_preview_info" );
- d->contentsPreviewWidget = new QWidget( d->preview, "qt_preview_contents" );
- d->infoPreviewer = d->contentsPreviewer = 0;
-
- h = new QHBoxLayout( 0 );
- d->buttonLayout = h;
- d->topLevelLayout->addLayout( h );
- h->addWidget( d->pathL );
- h->addSpacing( 8 );
- h->addWidget( d->paths );
- h->addSpacing( 8 );
- if ( d->goBack )
- h->addWidget( d->goBack );
- h->addWidget( d->cdToParent );
- h->addSpacing( 2 );
- h->addWidget( d->newFolder );
- h->addSpacing( 4 );
- h->addWidget( d->mcView );
- h->addWidget( d->detailView );
- h->addWidget( d->previewInfo );
- h->addWidget( d->previewContents );
-
- d->topLevelLayout->addWidget( d->splitter );
-
- h = new QHBoxLayout();
- d->topLevelLayout->addLayout( h );
- h->addWidget( d->fileL );
- h->addWidget( nameEdit );
- h->addSpacing( 15 );
- h->addWidget( okB );
-
- h = new QHBoxLayout();
- d->topLevelLayout->addLayout( h );
- h->addWidget( d->typeL );
- h->addWidget( d->types );
- h->addSpacing( 15 );
- h->addWidget( cancelB );
-
- d->rightLayout = new QHBoxLayout( lay, 5 );
- d->topLevelLayout->setStretchFactor( d->mcView, 1 );
- d->topLevelLayout->setStretchFactor( files, 1 );
-
- updateGeometries();
-
- if ( d->goBack ) {
- setTabOrder( d->paths, d->goBack );
- setTabOrder( d->goBack, d->cdToParent );
- } else {
- setTabOrder( d->paths, d->cdToParent );
- }
- setTabOrder( d->cdToParent, d->newFolder );
- setTabOrder( d->newFolder, d->mcView );
- setTabOrder( d->mcView, d->detailView );
- setTabOrder( d->detailView, d->moreFiles );
- setTabOrder( d->moreFiles, files );
- setTabOrder( files, nameEdit );
- setTabOrder( nameEdit, d->types );
- setTabOrder( d->types, okB );
- setTabOrder( okB, cancelB );
-
- d->rw = tr( "Read-write" );
- d->ro = tr( "Read-only" );
- d->wo = tr( "Write-only" );
- d->inaccessible = tr( "Inaccessible" );
-
- d->symLinkToFile = tr( "Symlink to File" );
- d->symLinkToDir = tr( "Symlink to Directory" );
- d->symLinkToSpecial = tr( "Symlink to Special" );
- d->file = tr( "File" );
- d->dir = tr( "Dir" );
- d->special = tr( "Special" );
-
- if ( !lastSize ) {
- QRect screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( pos() ) );
- if ( screen.width() < 1024 ||
- screen.height() < 768 ) {
- resize( QMIN(screen.width(),420),
- QMIN(screen.height(),236) );
- } else {
- QSize s( files->sizeHint() );
- s = QSize( s.width() + 300, s.height() + 82 );
-
- if ( s.width() * 3 > screen.width() * 2 )
- s.setWidth( screen.width() * 2 / 3 );
-
- if ( s.height() * 3 > screen.height() * 2 )
- s.setHeight( screen.height() * 2 / 3 );
- else if ( s.height() * 3 < screen.height() )
- s.setHeight( screen.height() / 3 );
-
- resize( s );
- }
- lastSize = new QSize;
- qfd_cleanup_size.add( &lastSize );
- *lastSize = size();
- } else
- resize( *lastSize );
-
- if ( detailViewMode ) {
- d->stack->raiseWidget( files );
- d->mcView->setOn( FALSE );
- d->detailView->setOn( TRUE );
- }
-
- d->preview->hide();
- nameEdit->setFocus();
-
- connect( nameEdit, SIGNAL( returnPressed() ),
- this, SLOT( fileNameEditReturnPressed() ) );
-}
-
-/*!
- \internal
-*/
-
-void QFileDialogP::fileNameEditReturnPressed()
-{
- d->oldUrl = d->url;
- if ( !isDirectoryMode( d->mode ) ) {
- okClicked();
- } else {
- d->currentFileName = QString::null;
- if ( nameEdit->text().isEmpty() ) {
- emit fileSelected( selectedFile() );
- accept();
- } else {
- QUrlInfo f;
- QFileDialogPrivate::File * c
- = (QFileDialogPrivate::File *)files->currentItem();
- if ( c && files->isSelected(c) )
- f = c->info;
- else
- f = QUrlInfo( d->url, nameEdit->text() );
- if ( f.isDir() ) {
- setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text() + "/" ) ) );
- d->checkForFilter = TRUE;
- trySetSelection( TRUE, d->url, TRUE );
- d->checkForFilter = FALSE;
- }
- }
- nameEdit->setText( QString::null );
- d->ignoreReturn = TRUE;
- }
-}
-
-/*!
- \internal
- Changes the preview mode to the mode specified at \a id.
-*/
-
-void QFileDialogP::changeMode( int id )
-{
- if ( !d->infoPreview && !d->contentsPreview )
- return;
-
- QButton *btn = (QButton*)d->modeButtons->find( id );
- if ( !btn )
- return;
-
- if ( btn == d->previewContents && !d->contentsPreview )
- return;
- if ( btn == d->previewInfo && !d->infoPreview )
- return;
-
- if ( btn != d->previewContents && btn != d->previewInfo ) {
- d->preview->hide();
- } else {
- if ( files->currentItem() ) {
- if ( d->infoPreviewer )
- d->infoPreviewer->previewUrl( QUrl( d->url, files->currentItem()->text( 0 ) ) );
- if ( d->contentsPreviewer )
- d->contentsPreviewer->previewUrl( QUrl( d->url, files->currentItem()->text( 0 ) ) );
- }
- if ( btn == d->previewInfo )
- d->preview->raiseWidget( d->infoPreviewWidget );
- else
- d->preview->raiseWidget( d->contentsPreviewWidget );
- d->preview->show();
- }
-}
-
-/*!
- Destroys the file dialog.
-*/
-
-QFileDialogP::~QFileDialogP()
-{
- // since clear might call setContentsPos which would emit
- // a signal and thus cause a recompute of sizes...
- files->blockSignals( TRUE );
- d->moreFiles->blockSignals( TRUE );
- files->clear();
- d->moreFiles->clear();
- d->moreFiles->blockSignals( FALSE );
- files->blockSignals( FALSE );
- if ( QApplication::overrideCursor() )
- QApplication::restoreOverrideCursor();
- delete d;
- d = 0;
-}
-
-
-/*!
- \property QFileDialogP::selectedFile
-
- \brief the name of the selected file
-
- If a file was selected selectedFile contains the file's name including
- its absolute path; otherwise selectedFile is empty.
-
- \sa QString::isEmpty(), selectedFiles, selectedFilter
-*/
-
-QString QFileDialogP::selectedFile() const
-{
- QString s = d->currentFileName;
- // remove the protocol because we do not want to encode it...
- QString prot = QUrl( s ).protocol();
- if ( !prot.isEmpty() ) {
- prot += ":";
- s.remove( 0, prot.length() );
- }
- QUrl u( prot + QFileDialogPrivate::encodeFileName( s ) );
- if ( u.isLocalFile() ) {
- QString s = u.toString();
- if ( s.left( 5 ) == "file:" )
- s.remove( 0, 5 );
- return s;
- }
- return d->currentFileName;
-}
-
-/*!
- \property QFileDialogP::selectedFilter
-
- \brief the filter which the user has selected in the file dialog
-
- \sa filterSelected(), selectedFiles, selectedFile
-*/
-
-QString QFileDialogP::selectedFilter() const
-{
- return d->types->currentText();
-}
-
-/*! \overload
-
- Sets the current filter selected in the file dialog to the
- \a{n}-th filter in the filter list.
-
- \sa filterSelected(), selectedFilter(), selectedFiles(), selectedFile()
-*/
-
-void QFileDialogP::setSelectedFilter( int n )
-{
- d->types->setCurrentItem( n );
- QString f = d->types->currentText();
- QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
- int index = r.search( f );
- if ( index >= 0 )
- f = r.cap( 2 );
- d->url.setNameFilter( f );
- rereadDir();
-}
-
-/*!
- Sets the current filter selected in the file dialog to the first
- one that contains the text \a mask.
-*/
-
-void QFileDialogP::setSelectedFilter( const QString& mask )
-{
- int n;
-
- for ( n = 0; n < d->types->count(); n++ ) {
- if ( d->types->text( n ).contains( mask, FALSE ) ) {
- d->types->setCurrentItem( n );
- QString f = mask;
- QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
- int index = r.search( f );
- if ( index >= 0 )
- f = r.cap( 2 );
- d->url.setNameFilter( f );
- rereadDir();
- return;
- }
- }
-}
-
-/*!
- \property QFileDialogP::selectedFiles
-
- \brief the list of selected files
-
- If one or more files are selected, selectedFiles contains their
- names including their absolute paths. If no files are selected or
- the mode isn't ExistingFiles selectedFiles is an empty list.
-
- It is more convenient to use selectedFile() if the mode is
- \c ExistingFile, \c Directory or \c DirectoryOnly.
-
- Note that if you want to iterate over the list, you should
- iterate over a copy, e.g.
- \code
- QStringList list = myFileDialog.selectedFiles();
- QStringList::Iterator it = list.begin();
- while( it != list.end() ) {
- myProcessing( *it );
- ++it;
- }
- \endcode
-
- \sa selectedFile, selectedFilter, QValueList::empty()
-*/
-
-QStringList QFileDialogP::selectedFiles() const
-{
- QStringList lst;
-
- if ( mode() == ExistingFiles ) {
- QStringList selectedLst;
- QString selectedFiles = nameEdit->text();
- selectedFiles.truncate( selectedFiles.findRev( '\"' ) );
- selectedLst = selectedLst.split( QString("\" "), selectedFiles );
- for ( QStringList::Iterator it = selectedLst.begin(); it != selectedLst.end(); ++it ) {
- QUrl u;
- if ( (*it)[0] == '\"' ) {
- u = QUrl( d->url, QFileDialogPrivate::encodeFileName( (*it).mid(1) ) );
- } else {
- u = QUrl( d->url, QFileDialogPrivate::encodeFileName( (*it) ) );
- }
- if ( u.isLocalFile() ) {
- QString s = u.toString();
- if ( s.left( 5 ) == "file:" )
- s.remove( 0, 5 );
- lst << s;
- } else {
- lst << u.toString();
- }
- }
- }
-
- return lst;
-}
-
-/*!
- Sets the default selection to \a filename. If \a filename is
- absolute, setDir() is also called to set the file dialog's working
- directory to the filename's directory.
-
- \omit
- Only for external use. Not useful inside QFileDialogP.
- \endomit
-*/
-
-void QFileDialogP::setSelection( const QString & filename )
-{
- d->oldUrl = d->url;
- QString nf = d->url.nameFilter();
- if ( QUrl::isRelativeUrl( filename ) )
- d->url = QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( filename ) );
- else
- d->url = QUrlOperator( filename );
- d->url.setNameFilter( nf );
- d->checkForFilter = TRUE;
- bool isDirOk;
- bool isDir = d->url.isDir( &isDirOk );
- if ( !isDirOk )
- isDir = d->url.path().right( 1 ) == "/";
- if ( !isDir ) {
- QUrlOperator u( d->url );
- d->url.setPath( d->url.dirPath() );
- trySetSelection( FALSE, u, TRUE );
- d->ignoreNextRefresh = TRUE;
- nameEdit->selectAll();
- rereadDir();
- emit dirEntered( d->url.dirPath() );
- } else {
- if ( !d->url.path().isEmpty() &&
- d->url.path().right( 1 ) != "/" ) {
- QString p = d->url.path();
- p += "/";
- d->url.setPath( p );
- }
- trySetSelection( TRUE, d->url, FALSE );
- rereadDir();
- emit dirEntered( d->url.dirPath() );
- nameEdit->setText( QString::fromLatin1("") );
- }
- d->checkForFilter = FALSE;
-}
-
-/*!
- \property QFileDialogP::dirPath
-
- \brief the file dialog's working directory
-
- \sa dir(), setDir()
-*/
-
-QString QFileDialogP::dirPath() const
-{
- return d->url.dirPath();
-}
-
-
-/*!
-
- Sets the filter used in the file dialog to \a newFilter.
-
- If \a newFilter contains a pair of parentheses containing one or more
- of <em><b>anything*something</b></em> separated by spaces or by
- semi-colons then only the text contained in the parentheses is used as
- the filter. This means that these calls are all equivalent:
-
- \code
- fd->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
- fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
- fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
- fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
- \endcode
-
- \sa setFilters()
-*/
-
-void QFileDialogP::setFilter( const QString & newFilter )
-{
- if ( newFilter.isEmpty() )
- return;
- QString f = newFilter;
- QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
- int index = r.search( f );
- if ( index >= 0 )
- f = r.cap( 2 );
- d->url.setNameFilter( f );
- if ( d->types->count() == 1 ) {
- d->types->clear();
- d->types->insertItem( newFilter );
- } else {
- for ( int i = 0; i < d->types->count(); ++i ) {
- if ( d->types->text( i ).left( newFilter.length() ) == newFilter ) {
- d->types->setCurrentItem( i );
- break;
- }
- }
- }
- rereadDir();
-}
-
-
-/*! \overload
- Sets the file dialog's working directory to \a pathstr.
-
- \sa dir()
-*/
-
-void QFileDialogP::setDir( const QString & pathstr )
-{
- QString dr = pathstr;
- if ( dr.isEmpty() )
- return;
-
-#if defined(Q_OS_UNIX)
- if ( dr.length() && dr[0] == '~' ) {
- struct passwd *pw;
- int i;
-
- i = 0;
- while( i < (int)dr.length() && dr[i] != '/' )
- i++;
- QCString user;
- if ( i == 1 ) {
- user = ::getlogin();
- if ( !user )
- user = getenv( "LOGNAME" );
- } else
- user = dr.mid( 1, i-1 ).local8Bit();
- dr = dr.mid( i, dr.length() );
- pw = ::getpwnam( user );
- if ( pw )
- dr.prepend( QString::fromLocal8Bit(pw->pw_dir) );
- }
-#endif
-
- setUrl( dr );
-}
-
-/*!
- Returns the current directory shown in the file dialog.
-
- The ownership of the QDir pointer is transferred to the caller, so
- it must be deleted by the caller when no longer required.
-
- \sa setDir()
-*/
-
-const QDir *QFileDialogP::dir() const
-{
- if ( d->url.isLocalFile() )
- return new QDir( d->url.path() );
- else
- return 0;
-}
-
-/*!
- Sets the file dialog's working directory to \a dir.
- \sa dir()
-*/
-
-void QFileDialogP::setDir( const QDir &dir )
-{
- d->oldUrl = d->url;
- QString nf( d->url.nameFilter() );
- d->url = dir.canonicalPath();
- d->url.setNameFilter( nf );
- QUrlInfo i( d->url, nameEdit->text() );
- d->checkForFilter = TRUE;
- trySetSelection( i.isDir(), QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text() ) ), FALSE );
- d->checkForFilter = FALSE;
- rereadDir();
- emit dirEntered( d->url.path() );
-}
-
-/*!
- Sets the file dialog's working directory to the directory specified at \a url.
-
- \sa url()
-*/
-
-void QFileDialogP::setUrl( const QUrlOperator &url )
-{
- QString nf = d->url.nameFilter();
-
- d->url = QUrl( d->url, url.toString( FALSE, FALSE ) );
- d->url.setNameFilter( nf );
-
- d->checkForFilter = TRUE;
- if ( !d->url.isDir() ) {
- QUrlOperator u = d->url;
- d->url.setPath( d->url.dirPath() );
- trySetSelection( FALSE, u, FALSE );
- rereadDir();
- emit dirEntered( d->url.dirPath() );
- QString fn = u.fileName();
- nameEdit->setText( fn );
- } else {
- trySetSelection( TRUE, d->url, FALSE );
- rereadDir();
- emit dirEntered( d->url.dirPath() );
- }
- d->checkForFilter = FALSE;
-}
-
-/*!
- \property QFileDialogP::showHiddenFiles
-
- \brief whether hidden files are shown in the file dialog
-
- The default is FALSE, i.e. don't show hidden files.
-*/
-
-void QFileDialogP::setShowHiddenFiles( bool s )
-{
- if ( s == bShowHiddenFiles )
- return;
-
- bShowHiddenFiles = s;
- rereadDir();
-}
-
-bool QFileDialogP::showHiddenFiles() const
-{
- return bShowHiddenFiles;
-}
-
-/*!
- Rereads the current directory shown in the file dialog.
-
- The only time you will need to call this function is if the contents of
- the directory change and you wish to refresh the file dialog to reflect
- the change.
-
- \sa resortDir()
-*/
-
-void QFileDialogP::rereadDir()
-{
- if ( !QApplication::overrideCursor() )
- QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
- d->pendingItems.clear();
- if ( d->mimeTypeTimer->isActive() )
- d->mimeTypeTimer->stop();
- d->currListChildren = d->url.listChildren();
-}
-
-
-/*!
- \fn void QFileDialogP::fileHighlighted( const QString& )
-
- This signal is emitted when the user highlights a file.
-
- \sa fileSelected(), filesSelected()
-*/
-
-/*!
- \fn void QFileDialogP::fileSelected( const QString& )
-
- This signal is emitted when the user selects a file.
-
- \sa filesSelected(), fileHighlighted(), selectedFile()
-*/
-
-/*!
- \fn void QFileDialogP::filesSelected( const QStringList& )
-
- This signal is emitted when the user selects one or more files in \e
- ExistingFiles mode.
-
- \sa fileSelected(), fileHighlighted(), selectedFiles()
-*/
-
-/*!
- \fn void QFileDialogP::dirEntered( const QString& )
-
- This signal is emitted when the user enters a directory.
-
- \sa dir()
-*/
-
-/*!
- \fn void QFileDialogP::filterSelected( const QString& )
-
- This signal is emitted when the user selects a filter.
-
- \sa selectedFilter()
-*/
-
-extern bool qt_resolve_symlinks; // defined in qapplication.cpp
-
-/*!
- This is a convenience static function that returns an existing file
- selected by the user. If the user pressed Cancel, it returns a null
- string.
-
- \code
- QString s = QFileDialogP::getOpenFileName(
- "/home",
- "Images (*.png *.xpm *.jpg)",
- this,
- "open file dialog",
- "Choose a file to open" );
- \endcode
-
- The function creates a modal file dialog called \a name, with
- parent, \a parent. If a parent is not 0, the dialog will be shown
- centered over the parent.
-
- The file dialog's working directory will be set to \a startWith. If \a
- startWith includes a file name, the file will be selected. The filter
- is set to \a filter so that only those files which match the filter
- are shown. The filter selected is set to \a selectedFilter. The parameters
- \a startWith, \a selectedFilter and \a filter may be QString::null.
-
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
-
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialogP, unless the style of the application
- is set to something other than the native style.
-
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
- the file dialog will change to /var/tmp after entering /usr/tmp.
- If \a resolveSymlinks is FALSE, the file dialog will treat
- symlinks as regular directories.
-
- \sa getOpenFileNames(), getSaveFileName(), getExistingDirectory()
-*/
-
-QString QFileDialogP::getOpenFileName( const QString & startWith,
- const QString& filter,
- QWidget *parent, const char* name,
- const QString& caption,
- QString *selectedFilter,
- bool resolveSymlinks )
-{
- bool save_qt_resolve_symlinks = qt_resolve_symlinks;
- qt_resolve_symlinks = resolveSymlinks;
-
- QStringList filters;
- if ( !filter.isEmpty() )
- filters = makeFiltersList( filter );
-
- makeVariables();
- QString initialSelection;
- //### Problem with the logic here: If a startWith is given and a file
- // with that name exists in D->URL, the box will be opened at D->URL instead of
- // the last directory used ('workingDirectory').
- //
- // hm... isn't that problem exactly the documented behaviour? the
- // documented behaviour sounds meaningful.
- if ( !startWith.isEmpty() ) {
- QUrlOperator u( startWith );
- if ( u.isLocalFile() && QFileInfo( u.path() ).isDir() ) {
- *workingDirectory = startWith;
- } else {
- if ( u.isLocalFile() ) {
- QFileInfo fi( u.dirPath() );
- if ( fi.exists() ) {
- *workingDirectory = u.dirPath();
- initialSelection = u.fileName();
- }
- } else {
- *workingDirectory = u.toString();
- initialSelection = QString::null;//u.fileName();
- }
- }
- }
-
- if ( workingDirectory->isNull() )
- *workingDirectory = QDir::currentDirPath();
-
-#if defined(Q_WS_WIN)
- if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
- return winGetOpenFileName( initialSelection, filter, workingDirectory,
- parent, name, caption, selectedFilter );
-#elif defined(Q_WS_MAC)
- if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) ) {
- QString f = macGetOpenFileNames(filter, workingDirectory,
- parent, name, caption, FALSE).first();
- return f;
- }
-#endif
-
- QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gofn", TRUE );
-
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( parent && parent->icon() && !parent->icon()->isNull() )
- dlg->setIcon( *parent->icon() );
- else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
- dlg->setIcon( *qApp->mainWidget()->icon() );
-
- if ( !caption.isNull() )
- dlg->setCaption( caption );
- else
- dlg->setCaption( QFileDialogP::tr( "Open" ) );
-#endif
-
- dlg->setFilters( filters );
- if ( selectedFilter )
- dlg->setFilter( *selectedFilter );
- dlg->setMode( QFileDialogP::ExistingFile );
- QString result;
- if ( !initialSelection.isEmpty() )
- dlg->setSelection( initialSelection );
- if ( dlg->exec() == QDialog::Accepted ) {
- result = dlg->selectedFile();
- *workingDirectory = dlg->d->url;
- if ( selectedFilter )
- *selectedFilter = dlg->selectedFilter();
- }
- delete dlg;
-
- qt_resolve_symlinks = save_qt_resolve_symlinks;
-
- return result;
-}
-
-/*!
- This is a convenience static function that will return a file name
- selected by the user. The file does not have to exist.
-
- It creates a modal file dialog called \a name, with parent, \a parent.
- If a parent is not 0, the dialog will be shown centered over the
- parent.
-
- \code
- QString s = QFileDialogP::getSaveFileName(
- "/home",
- "Images (*.png *.xpm *.jpg)",
- this,
- "save file dialog"
- "Choose a filename to save under" );
- \endcode
-
- The file dialog's working directory will be set to \a startWith. If \a
- startWith includes a file name, the file will be selected. The filter
- is set to \a filter so that only those files which match the filter
- are shown. The filter selected is set to \a selectedFilter. The parameters
- \a startWith, \a selectedFilter and \a filter may be QString::null.
-
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
-
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialogP, unless the style of the application
- is set to something other than the native style.
-
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
- the file dialog will change to /var/tmp after entering /usr/tmp.
- If \a resolveSymlinks is FALSE, the file dialog will treat
- symlinks as regular directories.
-
- \sa getOpenFileName(), getOpenFileNames(), getExistingDirectory()
-*/
-
-QString QFileDialogP::getSaveFileName( const QString & startWith,
- const QString& filter,
- QWidget *parent, const char* name,
- const QString& caption,
- QString *selectedFilter,
- bool resolveSymlinks)
-{
- bool save_qt_resolve_symlinks = qt_resolve_symlinks;
- qt_resolve_symlinks = resolveSymlinks;
-
- QStringList filters;
- if ( !filter.isEmpty() )
- filters = makeFiltersList( filter );
-
- makeVariables();
- QString initialSelection;
- if ( !startWith.isEmpty() ) {
- QUrlOperator u( startWith );
- if ( u.isLocalFile() && QFileInfo( u.path() ).isDir() ) {
- *workingDirectory = startWith;
- } else {
- if ( u.isLocalFile() ) {
- QFileInfo fi( u.dirPath() );
- if ( fi.exists() ) {
- *workingDirectory = u.dirPath();
- initialSelection = u.fileName();
- }
- } else {
- *workingDirectory = u.toString();
- initialSelection = QString::null;//u.fileName();
- }
- }
- }
-
- if ( workingDirectory->isNull() )
- *workingDirectory = QDir::currentDirPath();
-
-#if defined(Q_WS_WIN)
- if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
- return winGetSaveFileName( initialSelection, filter, workingDirectory,
- parent, name, caption, selectedFilter );
-#elif defined(Q_WS_MAC)
- if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
- return macGetSaveFileName( initialSelection, filter, workingDirectory,
- parent, name, caption );
-#endif
-
- QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gsfn", TRUE );
-
- Q_CHECK_PTR( dlg );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( parent && parent->icon() && !parent->icon()->isNull() )
- dlg->setIcon( *parent->icon() );
- else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
- dlg->setIcon( *qApp->mainWidget()->icon() );
-
- if ( !caption.isNull() )
- dlg->setCaption( caption );
- else
- dlg->setCaption( QFileDialogP::tr( "Save As" ) );
-#endif
-
- QString result;
- dlg->setFilters( filters );
- if ( selectedFilter )
- dlg->setFilter( *selectedFilter );
- dlg->setMode( QFileDialogP::AnyFile );
- if ( !initialSelection.isEmpty() )
- dlg->setSelection( initialSelection );
- if ( dlg->exec() == QDialog::Accepted ) {
- result = dlg->selectedFile();
- *workingDirectory = dlg->d->url;
- if ( selectedFilter )
- *selectedFilter = dlg->selectedFilter();
- }
- delete dlg;
-
- qt_resolve_symlinks = save_qt_resolve_symlinks;
-
- return result;
-}
-
-/*!
- \internal
- Activated when the "OK" button is clicked.
-*/
-
-void QFileDialogP::okClicked()
-{
- QString fn( nameEdit->text() );
-
-#if defined(Q_WS_WIN)
- QFileInfo fi( d->url.path() + fn );
- if ( fi.isSymLink() ) {
- nameEdit->setText( fi.readLink() );
- }
-#endif
-
- if ( fn.contains("*") ) {
- addFilter( fn );
- nameEdit->blockSignals( TRUE );
- nameEdit->setText( QString::fromLatin1("") );
- nameEdit->blockSignals( FALSE );
- return;
- }
-
- *workingDirectory = d->url;
- detailViewMode = files->isVisible();
- *lastSize = size();
-
- if ( isDirectoryMode( d->mode ) ) {
- if ( d->ignoreReturn ) {
- d->ignoreReturn = FALSE;
- return;
- }
- QUrlInfo f( d->url, nameEdit->text() );
- if ( f.isDir() ) {
- d->currentFileName = d->url;
- if ( d->currentFileName.right(1) != "/" )
- d->currentFileName += '/';
- if ( f.name() != "." )
- d->currentFileName += f.name();
- accept();
- return;
- }
- }
-
- // if we're in multi-selection mode and something is selected,
- // accept it and be done.
- if ( mode() == ExistingFiles ) {
- if ( ! nameEdit->text().isEmpty() ) {
- QStringList sf = selectedFiles();
- bool isdir = FALSE;
- if ( sf.count() == 1 ) {
- QUrlOperator u( d->url, sf[0] );
- bool ok;
- isdir = u.isDir(&ok) && ok;
- }
- if ( !isdir ) {
- emit filesSelected( sf );
- accept();
- return;
- }
- }
- }
-
- if ( mode() == AnyFile ) {
- QUrlOperator u( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text()) );
- if ( !u.isDir() ) {
- d->currentFileName = u;
- emit fileSelected( selectedFile() );
- accept();
- return;
- }
- }
-
- if ( mode() == ExistingFile ) {
- QUrl u( d->url, QFileDialogPrivate::encodeFileName(nameEdit->text()) );
- if ( u.isLocalFile() ) {
- QFileInfo f( u.path() );
- if ( !f.exists() )
- return;
- } else {
- QNetworkProtocol *p = QNetworkProtocol::getNetworkProtocol( d->url.protocol() );
- if ( p && (p->supportedOperations()&QNetworkProtocol::OpListChildren) ) {
- QUrlInfo ui( d->url, nameEdit->text() );
- if ( !ui.isValid() )
- return;
- }
- }
- }
-
- // If selection is valid, return it, else try
- // using selection as a directory to change to.
- if ( !d->currentFileName.isNull() && !d->currentFileName.contains( "*" ) ) {
- emit fileSelected( selectedFile() );
- accept();
- } else {
- QUrlInfo f;
- QFileDialogPrivate::File * c
- = (QFileDialogPrivate::File *)files->currentItem();
- QFileDialogPrivate::MCItem * m
- = (QFileDialogPrivate::MCItem *)d->moreFiles->item( d->moreFiles->currentItem() );
- if ( c && files->isVisible() && files->hasFocus() ||
- m && d->moreFiles->isVisible() && d->moreFiles->hasFocus() ) {
- if ( c && files->isVisible() )
- f = c->info;
- else
- f = ( (QFileDialogPrivate::File*)m->i )->info;
- } else {
- f = QUrlInfo( d->url, nameEdit->text() );
- }
- if ( f.isDir() ) {
- setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(f.name() + "/" ) ) );
- d->checkForFilter = TRUE;
- trySetSelection( TRUE, d->url, TRUE );
- d->checkForFilter = FALSE;
- } else {
- if ( !nameEdit->text().contains( "/" ) &&
- !nameEdit->text().contains( "\\" )
-#if defined(Q_OS_WIN32)
- && nameEdit->text()[ 1 ] != ':'
-#endif
- )
- addFilter( nameEdit->text() );
- else if ( nameEdit->text()[ 0 ] == '/' ||
- nameEdit->text()[ 0 ] == '\\'
-#if defined(Q_OS_WIN32)
- || nameEdit->text()[ 1 ] == ':'
-#endif
- )
- setDir( nameEdit->text() );
- else if ( nameEdit->text().left( 3 ) == "../" || nameEdit->text().left( 3 ) == "..\\" )
- setDir( QUrl( d->url.toString(), QFileDialogPrivate::encodeFileName(nameEdit->text() ) ).toString() );
- }
- nameEdit->setText( "" );
- }
-}
-
-/*!
- \internal
- Activated when the "Filter" button is clicked.
-*/
-
-void QFileDialogP::filterClicked()
-{
- // unused
-}
-
-/*!
- \internal
- Activated when the "Cancel" button is clicked.
-*/
-
-void QFileDialogP::cancelClicked()
-{
- *workingDirectory = d->url;
- detailViewMode = files->isVisible();
- *lastSize = size();
- reject();
-}
-
-
-/*!\reimp
-*/
-
-void QFileDialogP::resizeEvent( QResizeEvent * e )
-{
- QDialog::resizeEvent( e );
- updateGeometries();
-}
-
-/*
- \internal
- The only correct way to try to set currentFileName
-*/
-bool QFileDialogP::trySetSelection( bool isDir, const QUrlOperator &u, bool updatelined )
-{
- if ( !isDir && !u.path().isEmpty() && u.path().right( 1 ) == "/" )
- isDir = TRUE;
- if ( u.fileName().contains( "*") && d->checkForFilter ) {
- QString fn( u.fileName() );
- if ( fn.contains( "*" ) ) {
- addFilter( fn );
- d->currentFileName = QString::null;
- d->url.setFileName( QString::null );
- nameEdit->setText( QString::fromLatin1("") );
- return FALSE;
- }
- }
-
- if ( isDir ) {
- if ( d->preview && d->preview->isVisible() ) {
- if ( d->infoPreviewer )
- d->infoPreviewer->previewUrl( u );
- if ( d->contentsPreviewer )
- d->contentsPreviewer->previewUrl( u );
- }
- }
-
- QString old = d->currentFileName;
-
- if ( isDirectoryMode( mode() ) ) {
- if ( isDir )
- d->currentFileName = u;
- else
- d->currentFileName = QString::null;
- } else if ( !isDir && mode() == ExistingFiles ) {
- d->currentFileName = u;
- } else if ( !isDir || ( mode() == AnyFile && !isDir ) ) {
- d->currentFileName = u;
- } else {
- d->currentFileName = QString::null;
- }
- if ( updatelined && !d->currentFileName.isEmpty() ) {
- // If the selection is valid, or if its a directory, allow OK.
- if ( !d->currentFileName.isNull() || isDir ) {
- if ( u.fileName() != ".." ) {
- QString fn = u.fileName();
- nameEdit->setText( fn );
- } else {
- nameEdit->setText("");
- }
- } else
- nameEdit->setText( QString::fromLatin1("") );
- }
-
- if ( !d->currentFileName.isNull() || isDir ) {
- okB->setEnabled( TRUE );
- } else if ( !isDirectoryMode( d->mode ) ) {
- okB->setEnabled( FALSE );
- }
-
- if ( d->currentFileName.length() && old != d->currentFileName )
- emit fileHighlighted( selectedFile() );
-
- return !d->currentFileName.isNull();
-}
-
-
-/*! Make sure the minimum and maximum sizes of everything are sane.
-*/
-
-void QFileDialogP::updateGeometries()
-{
- if ( !d || !d->geometryDirty )
- return;
-
- d->geometryDirty = FALSE;
-
- QSize r, t;
-
- // we really should have a QSize::unite()
-#define RM r.setWidth( QMAX(r.width(),t.width()) ); \
-r.setHeight( QMAX(r.height(),t.height()) )
-
- // labels first
- r = d->pathL->sizeHint();
- t = d->fileL->sizeHint();
- RM;
- t = d->typeL->sizeHint();
- RM;
- d->pathL->setFixedSize( d->pathL->sizeHint() );
- d->fileL->setFixedSize( r );
- d->typeL->setFixedSize( r );
-
- // single-line input areas
- r = d->paths->sizeHint();
- t = nameEdit->sizeHint();
- RM;
- t = d->types->sizeHint();
- RM;
- r.setWidth( t.width() * 2 / 3 );
- t.setWidth( QWIDGETSIZE_MAX );
- t.setHeight( r.height() );
- d->paths->setMinimumSize( r );
- d->paths->setMaximumSize( t );
- nameEdit->setMinimumSize( r );
- nameEdit->setMaximumSize( t );
- d->types->setMinimumSize( r );
- d->types->setMaximumSize( t );
-
- // buttons on top row
- r = QSize( 0, d->paths->minimumSize().height() );
- t = QSize( 21, 20 );
- RM;
- if ( r.height()+1 > r.width() )
- r.setWidth( r.height()+1 );
- if ( d->goBack )
- d->goBack->setFixedSize( r );
- d->cdToParent->setFixedSize( r );
- d->newFolder->setFixedSize( r );
- d->mcView->setFixedSize( r );
- d->detailView->setFixedSize( r );
-
- QButton *b = 0;
- if ( !d->toolButtons.isEmpty() ) {
- for ( b = d->toolButtons.first(); b; b = d->toolButtons.next() )
- b->setFixedSize( b->sizeHint().width(), r.height() );
- }
-
- if ( d->infoPreview ) {
- d->previewInfo->show();
- d->previewInfo->setFixedSize( r );
- } else {
- d->previewInfo->hide();
- d->previewInfo->setFixedSize( QSize( 0, 0 ) );
- }
-
- if ( d->contentsPreview ) {
- d->previewContents->show();
- d->previewContents->setFixedSize( r );
- } else {
- d->previewContents->hide();
- d->previewContents->setFixedSize( QSize( 0, 0 ) );
- }
-
- // open/save, cancel
- r = QSize( 75, 20 );
- t = okB->sizeHint();
- RM;
- t = cancelB->sizeHint();
- RM;
-
- okB->setFixedSize( r );
- cancelB->setFixedSize( r );
-
- d->topLevelLayout->activate();
-
-#undef RM
-}
-
-
-/*! Updates the file name edit box to \a newItem in the file dialog
- when the cursor moves in the listview.
-*/
-
-void QFileDialogP::updateFileNameEdit( QListViewItem * newItem )
-{
- if ( !newItem )
- return;
-
- if ( mode() == ExistingFiles ) {
- detailViewSelectionChanged();
- QUrl u = QUrl( d->url, QFileDialogPrivate::encodeFileName( ((QFileDialogPrivate::File*)files->currentItem())->info.name() ) );
- QFileInfo fi( u.toString( FALSE, FALSE ) );
- if ( !fi.isDir() )
- emit fileHighlighted( u.toString( FALSE, FALSE ) );
- } else if ( files->isSelected( newItem ) ) {
- QFileDialogPrivate::File * i = (QFileDialogPrivate::File *)newItem;
- if ( i && i->i && !i->i->isSelected() ) {
- d->moreFiles->blockSignals( TRUE );
- d->moreFiles->setSelected( i->i, TRUE );
- d->moreFiles->blockSignals( FALSE );
- }
- // Encode the filename in case it had any special characters in it
- QString encFile = QFileDialogPrivate::encodeFileName( newItem->text( 0 ) );
- trySetSelection( i->info.isDir(), QUrlOperator( d->url, encFile ), TRUE );
- }
-}
-
-void QFileDialogP::detailViewSelectionChanged()
-{
- if ( d->mode != ExistingFiles )
- return;
-
- nameEdit->clear();
- QString str;
- QListViewItem * i = files->firstChild();
- d->moreFiles->blockSignals( TRUE );
- while( i ) {
- if ( d->moreFiles && isVisible() ) {
- if ( ( (QFileDialogPrivate::File *)i )->i->isSelected() != i->isSelected() )
- d->moreFiles->setSelected( ( (QFileDialogPrivate::File *)i )->i, i->isSelected() );
- }
- if ( i->isSelected() && !( (QFileDialogPrivate::File *)i )->info.isDir() )
- str += QString( "\"%1\" " ).arg( i->text( 0 ) );
- i = i->nextSibling();
- }
- d->moreFiles->blockSignals( FALSE );
- nameEdit->setText( str );
- nameEdit->setCursorPosition( str.length() );
- okB->setEnabled( TRUE );
- if ( d->preview && d->preview->isVisible() && files->currentItem() ) {
- QUrl u = QUrl( d->url, QFileDialogPrivate::encodeFileName( ((QFileDialogPrivate::File*)files->currentItem())->info.name() ) );
- if ( d->infoPreviewer )
- d->infoPreviewer->previewUrl( u );
- if ( d->contentsPreviewer )
- d->contentsPreviewer->previewUrl( u );
- }
-}
-
-void QFileDialogP::listBoxSelectionChanged()
-{
- if ( d->mode != ExistingFiles )
- return;
-
- if ( d->ignoreNextRefresh ) {
- d->ignoreNextRefresh = FALSE;
- return;
- }
-
- nameEdit->clear();
- QString str;
- QListBoxItem * i = d->moreFiles->item( 0 );
- QListBoxItem * j = 0;
- int index = 0;
- files->blockSignals( TRUE );
- while( i ) {
- if ( files && isVisible() ) {
- if ( ( (QFileDialogPrivate::MCItem *)i )->i->isSelected() != i->isSelected() )
- files->setSelected( ( (QFileDialogPrivate::MCItem *)i )->i, i->isSelected() );
- }
- if ( d->moreFiles->isSelected( i )
- && !( (QFileDialogPrivate::File*)( (QFileDialogPrivate::MCItem *)i )->i )->info.isDir() )
- {
- str += QString( "\"%1\" " ).arg( i->text() );
- if ( j == 0 )
- j = i;
- }
- i = d->moreFiles->item( ++index );
- }
- files->blockSignals( FALSE );
- nameEdit->setText( str );
- nameEdit->setCursorPosition( str.length() );
- okB->setEnabled( TRUE );
- if ( d->preview && d->preview->isVisible() && j ) {
- QUrl u = QUrl( d->url,
- QFileDialogPrivate::encodeFileName( ( (QFileDialogPrivate::File*)( (QFileDialogPrivate::MCItem*)j )->i )->info.name() ) );
- if ( d->infoPreviewer )
- d->infoPreviewer->previewUrl( u );
- if ( d->contentsPreviewer )
- d->contentsPreviewer->previewUrl( u );
- }
-}
-
-/*! \overload */
-
-void QFileDialogP::updateFileNameEdit( QListBoxItem * newItem )
-{
- if ( !newItem )
- return;
- QFileDialogPrivate::MCItem * i = (QFileDialogPrivate::MCItem *)newItem;
- if ( d->mode != ExistingFiles && i->i ) {
- i->i->listView()->setSelected( i->i, i->isSelected() );
- updateFileNameEdit( i->i );
- }
-}
-
-
-/*! Updates the dialog when the file name edit changes. */
-
-void QFileDialogP::fileNameEditDone()
-{
- QUrlInfo f( d->url, nameEdit->text() );
- if ( mode() != QFileDialogP::ExistingFiles ) {
- QUrlOperator u( d->url, QFileDialogPrivate::encodeFileName( nameEdit->text() ) );
- trySetSelection( f.isDir(), u, FALSE );
- if ( d->preview && d->preview->isVisible() ) {
- if ( d->infoPreviewer )
- d->infoPreviewer->previewUrl( u );
- if ( d->contentsPreviewer )
- d->contentsPreviewer->previewUrl( u );
- }
- }
-}
-
-
-
-/*! This private slot reacts to double-clicks in the list view. The item that
-was double-clicked is specified in \a newItem */
-
-void QFileDialogP::selectDirectoryOrFile( QListViewItem * newItem )
-{
-
- *workingDirectory = d->url;
- detailViewMode = files->isVisible();
- *lastSize = size();
-
- if ( !newItem )
- return;
-
-#if defined(Q_WS_WIN)
- QFileInfo fi( d->url.path() + newItem->text(0) );
- if ( fi.isSymLink() ) {
- nameEdit->setText( fi.readLink() );
- okClicked();
- return;
- }
-#endif
-
- QFileDialogPrivate::File * i = (QFileDialogPrivate::File *)newItem;
-
- QString oldName = nameEdit->text();
- if ( i->info.isDir() ) {
- setUrl( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( i->info.name() ) + "/" ) );
- if ( isDirectoryMode( mode() ) ) {
- QUrlInfo f ( d->url, QString::fromLatin1( "." ) );
- trySetSelection( f.isDir(), d->url, TRUE );
- }
- } else if ( newItem->isSelectable() &&
- trySetSelection( i->info.isDir(), QUrlOperator( d->url, QFileDialogPrivate::encodeFileName( i->info.name() ) ), TRUE ) ) {
- if ( !isDirectoryMode( mode() ) ) {
- emit fileSelected( selectedFile() );
- accept();
- }
- } else if ( isDirectoryMode( d->mode ) ) {
- d->currentFileName = d->url;
- accept();
- }
- if ( !oldName.isEmpty() && !isDirectoryMode( mode() ) )
- nameEdit->setText( oldName );
-}
-
-
-void QFileDialogP::selectDirectoryOrFile( QListBoxItem * newItem )
-{
- if ( !newItem )
- return;
-
- QFileDialogPrivate::MCItem * i = (QFileDialogPrivate::MCItem *)newItem;
- if ( i->i ) {
- i->i->listView()->setSelected( i->i, i->isSelected() );
- selectDirectoryOrFile( i->i );
- }
-}
-
-
-void QFileDialogP::popupContextMenu( QListViewItem *item, const QPoint &p,
- int )
-{
- if ( item && d->mode == ExistingFiles )
- return;
- if ( item ) {
- files->setCurrentItem( item );
- files->setSelected( item, TRUE );
- }
-
- PopupAction action;
- popupContextMenu( item ? item->text( 0 ) : QString::null, TRUE, action, p );
-
- if ( action == PA_Open )
- selectDirectoryOrFile( item );
- else if ( action == PA_Rename )
- files->startRename( FALSE );
- else if ( action == PA_Delete )
- deleteFile( item ? item->text( 0 ) : QString::null );
- else if ( action == PA_Reload )
- rereadDir();
- else if ( action == PA_Hidden ) {
- bShowHiddenFiles = !bShowHiddenFiles;
- rereadDir();
- } else if ( action == PA_SortName ) {
- sortFilesBy = (int)QDir::Name;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortSize ) {
- sortFilesBy = (int)QDir::Size;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortDate ) {
- sortFilesBy = (int)QDir::Time;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortUnsorted ) {
- sortFilesBy = (int)QDir::Unsorted;
- sortAscending = TRUE;
- resortDir();
- }
-
-}
-
-void QFileDialogP::popupContextMenu( QListBoxItem *item, const QPoint & p )
-{
- if ( item && d->mode == ExistingFiles )
- return;
-
- PopupAction action;
- popupContextMenu( item ? item->text() : QString::null, FALSE, action, p );
-
- if ( action == PA_Open )
- selectDirectoryOrFile( item );
- else if ( action == PA_Rename )
- d->moreFiles->startRename( FALSE );
- else if ( action == PA_Delete )
- deleteFile( item->text() );
- else if ( action == PA_Reload )
- rereadDir();
- else if ( action == PA_Hidden ) {
- bShowHiddenFiles = !bShowHiddenFiles;
- rereadDir();
- } else if ( action == PA_SortName ) {
- sortFilesBy = (int)QDir::Name;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortSize ) {
- sortFilesBy = (int)QDir::Size;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortDate ) {
- sortFilesBy = (int)QDir::Time;
- sortAscending = TRUE;
- resortDir();
- } else if ( action == PA_SortUnsorted ) {
- sortFilesBy = (int)QDir::Unsorted;
- sortAscending = TRUE;
- resortDir();
- }
-}
-
-void QFileDialogP::popupContextMenu( const QString &filename, bool,
- PopupAction &action, const QPoint &p )
-{
- action = PA_Cancel;
-
- bool glob = filename.isEmpty();
-
- QPopupMenu m( 0, "file dialog context menu" );
- m.setCheckable( TRUE );
-
- if ( !glob ) {
- QString okt;
- if ( QUrlInfo( d->url, filename ).isDir() ) {
- okt = tr( "&Open" );
- } else {
- if ( mode() == AnyFile )
- okt = tr( "&Save" );
- else
- okt = tr( "&Open" );
- }
- int ok = m.insertItem( okt );
-
- m.insertSeparator();
- int rename = m.insertItem( tr( "&Rename" ) );
- int del = m.insertItem( tr( "&Delete" ) );
-
- if ( filename.isEmpty() || !QUrlInfo( d->url, filename ).isWritable() ||
- filename == ".." ) {
- if ( filename.isEmpty() || !QUrlInfo( d->url, filename ).isReadable() )
- m.setItemEnabled( ok, FALSE );
- m.setItemEnabled( rename, FALSE );
- m.setItemEnabled( del, FALSE );
- }
-
- if ( mode() == QFileDialogP::ExistingFiles )
- m.setItemEnabled( rename, FALSE );
-
- m.move( p );
- int res = m.exec();
-
- if ( res == ok )
- action = PA_Open;
- else if ( res == rename )
- action = PA_Rename;
- else if ( res == del )
- action = PA_Delete;
- } else {
- int reload = m.insertItem( tr( "R&eload" ) );
-
- QPopupMenu m2( 0, "sort menu" );
-
- int sname = m2.insertItem( tr( "Sort by &Name" ) );
- //int stype = m2.insertItem( tr( "Sort by &Type" ) );
- int ssize = m2.insertItem( tr( "Sort by &Size" ) );
- int sdate = m2.insertItem( tr( "Sort by &Date" ) );
- m2.insertSeparator();
- int sunsorted = m2.insertItem( tr( "&Unsorted" ) );
-
- //m2.setItemEnabled( stype, FALSE );
-
- if ( sortFilesBy == (int)QDir::Name )
- m2.setItemChecked( sname, TRUE );
- else if ( sortFilesBy == (int)QDir::Size )
- m2.setItemChecked( ssize, TRUE );
-// else if ( sortFilesBy == 0x16 )
-// m2.setItemChecked( stype, TRUE );
- else if ( sortFilesBy == (int)QDir::Time )
- m2.setItemChecked( sdate, TRUE );
- else if ( sortFilesBy == (int)QDir::Unsorted )
- m2.setItemChecked( sunsorted, TRUE );
-
- m.insertItem( tr( "Sort" ), &m2 );
-
- m.insertSeparator();
-
- int hidden = m.insertItem( tr( "Show &hidden files" ) );
- m.setItemChecked( hidden, bShowHiddenFiles );
-
- m.move( p );
- int res = m.exec();
-
- if ( res == reload )
- action = PA_Reload;
- else if ( res == hidden )
- action = PA_Hidden;
- else if ( res == sname )
- action = PA_SortName;
-// else if ( res == stype )
-// action = PA_SortType;
- else if ( res == sdate )
- action = PA_SortDate;
- else if ( res == ssize )
- action = PA_SortSize;
- else if ( res == sunsorted )
- action = PA_SortUnsorted;
- }
-
-}
-
-void QFileDialogP::deleteFile( const QString &filename )
-{
- if ( filename.isEmpty() )
- return;
-
- QUrlInfo fi( d->url, QFileDialogPrivate::encodeFileName( filename ) );
- QString t = tr( "the file" );
- if ( fi.isDir() )
- t = tr( "the directory" );
- if ( fi.isSymLink() )
- t = tr( "the symlink" );
-
- if ( QMessageBox::warning( this,
- tr( "Delete %1" ).arg( t ),
- tr( "<qt>Are you sure you wish to delete %1 \"%2\"?</qt>" )
- .arg( t ).arg(filename),
- tr( "&Yes" ), tr( "&No" ), QString::null, 1 ) == 0 )
- d->url.remove( QFileDialogPrivate::encodeFileName( filename ) );
-
-}
-
-void QFileDialogP::fileSelected( int )
-{
- // unused
-}
-
-void QFileDialogP::fileHighlighted( int )
-{
- // unused
-}
-
-void QFileDialogP::dirSelected( int )
-{
- // unused
-}
-
-void QFileDialogP::pathSelected( int )
-{
- // unused
-}
-
-
-void QFileDialogP::cdUpClicked()
-{
- QString oldName = nameEdit->text();
- setUrl( QUrlOperator( d->url, ".." ) );
- if ( !oldName.isEmpty() )
- nameEdit->setText( oldName );
-}
-
-void QFileDialogP::newFolderClicked()
-{
- QString foldername( tr( "New Folder 1" ) );
- int i = 0;
- QStringList lst;
- QListViewItemIterator it( files );
- for ( ; it.current(); ++it )
- if ( it.current()->text( 0 ).contains( tr( "New Folder" ) ) )
- lst.append( it.current()->text( 0 ) );
-
- if ( !lst.count() == 0 )
- while ( lst.contains( foldername ) )
- foldername = tr( "New Folder %1" ).arg( ++i );
-
- d->url.mkdir( foldername );
-}
-
-void QFileDialogP::createdDirectory( const QUrlInfo &info, QNetworkOperation * )
-{
- resortDir();
- if ( d->moreFiles->isVisible() ) {
- for ( uint i = 0; i < d->moreFiles->count(); ++i ) {
- if ( d->moreFiles->text( i ) == info.name() ) {
- d->moreFiles->setCurrentItem( i );
- d->moreFiles->startRename( FALSE );
- break;
- }
- }
- } else {
- QListViewItem *item = files->firstChild();
- while ( item ) {
- if ( item->text( 0 ) == info.name() ) {
- files->setSelected( item, TRUE );
- files->setCurrentItem( item );
- files->startRename( FALSE );
- break;
- }
- item = item->nextSibling();
- }
- }
-}
-
-
-/*!
- This is a convenience static function that will return an existing directory
- selected by the user.
-
- \code
- QString s = QFileDialogP::getExistingDirectory(
- "/home",
- this,
- "get existing directory"
- "Choose a directory",
- TRUE );
- \endcode
-
- This function creates a modal file dialog called \a name, with
- parent, \a parent. If parent is not 0, the dialog will be shown
- centered over the parent.
-
- The dialog's working directory is set to \a dir, and the caption is
- set to \a caption. Either of these may be QString::null in which case
- the current directory and a default caption will be used respectively.
-
- If \a dirOnly is TRUE, then only directories will be shown in
- the file dialog; otherwise both directories and files will be shown.
-
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
- the file dialog will change to /var/tmp after entering /usr/tmp.
- If \a resolveSymlinks is FALSE, the file dialog will treat
- symlinks as regular directories.
-
- \sa getOpenFileName(), getOpenFileNames(), getSaveFileName()
-*/
-
-QString QFileDialogP::getExistingDirectory( const QString & dir,
- QWidget *parent,
- const char* name,
- const QString& caption,
- bool dirOnly,
- bool resolveSymlinks)
-{
- bool save_qt_resolve_symlinks = qt_resolve_symlinks;
- qt_resolve_symlinks = resolveSymlinks;
-
- makeVariables();
- QString wd;
- if ( workingDirectory )
- wd = *workingDirectory;
-
-#if defined(Q_WS_WIN)
- QString initialDir;
- if ( !dir.isEmpty() ) {
- QUrlOperator u( dir );
- if ( QFileInfo( u.path() ).isDir() )
- initialDir = dir;
- } else
- initialDir = QString::null;
- if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle && dirOnly )
- return winGetExistingDirectory( initialDir, parent, name, caption );
-#endif
-#if defined(Q_WS_MAC)
- if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
- return macGetOpenFileNames("", 0,
- parent, name, caption, FALSE, TRUE).first();
-#endif
-
- QFileDialogP *dialog = new QFileDialogP( parent, name ? name : "qt_filedlg_ged", TRUE );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( !caption.isNull() )
- dialog->setCaption( caption );
- else
- dialog->setCaption( QFileDialogP::tr("Find Directory") );
-#endif
-
- dialog->setMode( dirOnly ? DirectoryOnly : Directory );
-
- dialog->d->types->clear();
- dialog->d->types->insertItem( QFileDialogP::tr("Directories") );
- dialog->d->types->setEnabled( FALSE );
-
- QString dir_( dir );
- dir_ = dir_.simplifyWhiteSpace();
- if ( dir_.isEmpty() && !wd.isEmpty() )
- dir_ = wd;
- QUrlOperator u( dir_ );
- if ( u.isLocalFile() ) {
- if ( !dir_.isEmpty() ) {
- QFileInfo f( u.path() );
- if ( f.exists() )
- if ( f.isDir() ) {
- dialog->setDir( dir_ );
- wd = dir_;
- }
- } else if ( !wd.isEmpty() ) {
- QUrl tempUrl( wd );
- QFileInfo f( tempUrl.path() );
- if ( f.isDir() ) {
- dialog->setDir( wd );
- }
- } else {
- QString theDir = dir_;
- if ( theDir.isEmpty() ) {
- theDir = QDir::currentDirPath();
- } if ( !theDir.isEmpty() ) {
- QUrl tempUrl( theDir );
- QFileInfo f( tempUrl.path() );
- if ( f.isDir() ) {
- wd = theDir;
- dialog->setDir( theDir );
- }
- }
- }
- } else {
- dialog->setUrl( dir_ );
- }
-
- QString result;
- dialog->setSelection( dialog->d->url.toString() );
-
- if ( dialog->exec() == QDialog::Accepted ) {
- result = dialog->selectedFile();
- wd = result;
- }
- delete dialog;
-
- if ( !result.isEmpty() && result.right( 1 ) != "/" )
- result += "/";
-
- qt_resolve_symlinks = save_qt_resolve_symlinks;
-
- return result;
-}
-
-
-/*!
- \property QFileDialogP::mode
- \brief the file dialog's mode
-
- The default mode is \c ExistingFile.
-*/
-
-void QFileDialogP::setMode( Mode newMode )
-{
- if ( d->mode != newMode ) {
- d->mode = newMode;
- QString sel = d->currentFileName;
- if ( isDirectoryMode( newMode ) ) {
- files->setMultiSelection( FALSE );
- d->moreFiles->setMultiSelection( FALSE );
- if ( sel.isNull() )
- sel = QString::fromLatin1(".");
- d->types->setEnabled( FALSE );
- } else if ( newMode == ExistingFiles ) {
- files->setSelectionMode( QListView::Extended );
- d->moreFiles->setSelectionMode( QListBox::Extended );
- d->types->setEnabled( TRUE );
- } else {
- files->setMultiSelection( FALSE );
- d->moreFiles->setMultiSelection( FALSE );
- d->types->setEnabled( TRUE );
- }
- rereadDir();
- QUrlInfo f( d->url, "." );
- trySetSelection( f.isDir(), d->url, FALSE );
- }
-
- QString okt;
- bool changeFilters = FALSE;
- if ( mode() == AnyFile ) {
- okt = tr("Save");
- d->fileL->setText( tr("File &name:") );
- if ( d->types->count() == 1 ) {
- d->types->setCurrentItem( 0 );
- if ( d->types->currentText() == "Directories" ) {
- changeFilters = TRUE;
- }
- }
- }
- else if ( mode() == Directory || mode() == DirectoryOnly ) {
- okt = tr("OK");
- d->fileL->setText( tr("Directory:") );
- d->types->clear();
- d->types->insertItem( tr("Directories") );
- }
- else {
- okt = tr("Open");
- d->fileL->setText( tr("File &name:") );
- if ( d->types->count() == 1 ) {
- d->types->setCurrentItem( 0 );
- if ( d->types->currentText() == "Directories" ) {
- changeFilters = TRUE;
- }
- }
- }
-
- if ( changeFilters ) {
- d->types->clear();
- d->types->insertItem( tr("All Files (*)") );
- }
-
- okB->setText( okt );
-}
-
-QFileDialogP::Mode QFileDialogP::mode() const
-{
- return d->mode;
-}
-
-/*! \reimp
-*/
-
-void QFileDialogP::done( int i )
-{
- if ( i == QDialog::Accepted && (d->mode == ExistingFile || d->mode == ExistingFiles) ) {
- QStringList selection = selectedFiles();
- for ( uint f = 0; f < selection.count(); f++ ) {
- QString file = selection[f];
- if ( file.isNull() )
- continue;
- if ( d->url.isLocalFile() && !QFile::exists( file ) ) {
- QMessageBox::information( this, tr("Error"), tr("%1\nFile not found.\nCheck path and filename.").arg( file ) );
- return;
- }
- }
- }
- QDialog::done( i );
-}
-
-/*!
- \property QFileDialogP::viewMode
-
- \brief the file dialog's view mode
-
- If you set the view mode to be \e Detail (the default), then you
- will see the file's details, such as the size of the file and the
- date the file was last modified in addition to the file's name.
-
- If you set the view mode to be \e List, then you will just
- see a list of the files and folders.
-
- See \l QFileDialogP::ViewMode
-*/
-
-
-QFileDialogP::ViewMode QFileDialogP::viewMode() const
-{
- if ( detailViewMode )
- return Detail;
- else
- return List;
-}
-
-void QFileDialogP::setViewMode( ViewMode m )
-{
- if ( m == Detail ) {
- detailViewMode = TRUE;
- d->stack->raiseWidget( files );
- d->detailView->setOn( TRUE );
- d->mcView->setOn( FALSE );
- } else if ( m == List ) {
- detailViewMode = FALSE;
- d->stack->raiseWidget( d->moreFiles );
- d->detailView->setOn( FALSE );
- d->mcView->setOn( TRUE );
- }
-}
-
-
-/*!
- \property QFileDialogP::previewMode
-
- \brief the preview mode for the file dialog
-
- If you set the mode to be a mode other than \e NoPreview, you must
- use setInfoPreview() or setContentsPreview() to set the dialog's
- preview widget to your preview widget and enable the preview
- widget(s) with setInfoPreviewEnabled() or
- setContentsPreviewEnabled().
-
- \sa infoPreview, contentsPreview, viewMode
-*/
-
-void QFileDialogP::setPreviewMode( PreviewMode m )
-{
- if ( m == NoPreview ) {
- d->previewInfo->setOn( FALSE );
- d->previewContents->setOn( FALSE );
- } else if ( m == Info && d->infoPreview ) {
- d->previewInfo->setOn( TRUE );
- d->previewContents->setOn( FALSE );
- changeMode( d->modeButtons->id( d->previewInfo ) );
- } else if ( m == Contents && d->contentsPreview ) {
- d->previewInfo->setOn( FALSE );
- d->previewContents->setOn( TRUE );
- changeMode( d->modeButtons->id( d->previewContents ) );
- }
-}
-QFileDialogP::PreviewMode QFileDialogP::previewMode() const
-{
- if ( d->infoPreview && d->previewInfo->isVisible() )
- return Info;
- else if ( d->contentsPreview && d->previewContents->isVisible() )
- return Contents;
-
- return NoPreview;
-}
-
-
-/*!
- Adds the specified widgets to the bottom of the file dialog. The
- label \a l is placed underneath the "file name" and the "file types"
- labels. The widget \a w is placed underneath the file types combobox.
- The button \a b is placed underneath the Cancel pushbutton.
-
- \code
- MyFileDialog::MyFileDialog( QWidget* parent, const char* name ) :
- QFileDialogP( parent, name )
- {
- QLabel* label = new QLabel( "Added widgets", this );
- QLineEdit* lineedit = new QLineEdit( this );
- QToolButton* toolbutton = new QToolButton( this );
-
- addWidgets( label, lineedit, toolbutton );
- }
- \endcode
-
- If you don't want to have one of the widgets added, pass 0 in that
- widget's position.
-
- Every time you call this function, a new row of widgets will be added
- to the bottom of the file dialog.
-
- \sa addToolButton(), addLeftWidget(), addRightWidget()
-*/
-
-void QFileDialogP::addWidgets( QLabel * l, QWidget * w, QPushButton * b )
-{
- if ( !l && !w && !b )
- return;
-
- d->geometryDirty = TRUE;
-
- QHBoxLayout *lay = new QHBoxLayout();
- d->extraWidgetsLayouts.append( lay );
- d->topLevelLayout->addLayout( lay );
-
- if ( !l )
- l = new QLabel( this, "qt_intern_lbl" );
- d->extraLabels.append( l );
- lay->addWidget( l );
-
- if ( !w )
- w = new QWidget( this, "qt_intern_widget" );
- d->extraWidgets.append( w );
- lay->addWidget( w );
- lay->addSpacing( 15 );
-
- if ( b ) {
- d->extraButtons.append( b );
- lay->addWidget( b );
- } else {
- QWidget *wid = new QWidget( this, "qt_extrabuttons_widget" );
- d->extraButtons.append( wid );
- lay->addWidget( wid );
- }
-
- updateGeometries();
-}
-
-/*!
- Adds the tool button \a b to the row of tool buttons at the top of the
- file dialog. The button is appended to the right of
- this row. If \a separator is TRUE, a small space is inserted between the
- last button of the row and the new button \a b.
-
- \sa addWidgets(), addLeftWidget(), addRightWidget()
-*/
-
-void QFileDialogP::addToolButton( QButton *b, bool separator )
-{
- if ( !b || !d->buttonLayout )
- return;
-
- d->geometryDirty = TRUE;
-
- d->toolButtons.append( b );
- if ( separator )
- d->buttonLayout->addSpacing( 8 );
- d->buttonLayout->addWidget( b );
-
- updateGeometries();
-}
-
-/*!
- Adds the widget \a w to the left-hand side of the file dialog.
-
- \sa addRightWidget(), addWidgets(), addToolButton()
-*/
-
-void QFileDialogP::addLeftWidget( QWidget *w )
-{
- if ( !w )
- return;
- d->geometryDirty = TRUE;
-
- d->leftLayout->addWidget( w );
- d->leftLayout->addSpacing( 5 );
-
- updateGeometries();
-}
-
-/*!
- Adds the widget \a w to the right-hand side of the file dialog.
-
- \sa addLeftWidget(), addWidgets(), addToolButton()
-*/
-
-void QFileDialogP::addRightWidget( QWidget *w )
-{
- if ( !w )
- return;
- d->geometryDirty = TRUE;
-
- d->rightLayout->addSpacing( 5 );
- d->rightLayout->addWidget( w );
-
- updateGeometries();
-}
-
-/*! \reimp */
-
-void QFileDialogP::keyPressEvent( QKeyEvent * ke )
-{
- if ( !d->ignoreNextKeyPress &&
- ke && ( ke->key() == Key_Enter ||
- ke->key() == Key_Return ) ) {
- ke->ignore();
- if ( d->paths->hasFocus() ) {
- ke->accept();
- if ( d->url == QUrl(d->paths->currentText()) )
- nameEdit->setFocus();
- } else if ( d->types->hasFocus() ) {
- ke->accept();
- // ### is there a suitable condition for this? only valid
- // wildcards?
- nameEdit->setFocus();
- } else if ( nameEdit->hasFocus() ) {
- if ( d->currentFileName.isNull() ) {
- // maybe change directory
- QUrlInfo i( d->url, nameEdit->text() );
- if ( i.isDir() ) {
- nameEdit->setText( QString::fromLatin1("") );
- setDir( QUrlOperator( d->url, QFileDialogPrivate::encodeFileName(i.name()) ) );
- }
- ke->accept();
- } else if ( mode() == ExistingFiles ) {
- QUrlInfo i( d->url, nameEdit->text() );
- if ( i.isFile() ) {
- QListViewItem * i = files->firstChild();
- while ( i && nameEdit->text() != i->text( 0 ) )
- i = i->nextSibling();
- if ( i )
- files->setSelected( i, TRUE );
- else
- ke->accept(); // strangely, means to ignore that event
- }
- }
- } else if ( files->hasFocus() || d->moreFiles->hasFocus() ) {
- ke->accept();
- }
- } else if ( ke->key() == Key_Escape ) {
- ke->ignore();
- }
-
- d->ignoreNextKeyPress = FALSE;
-
- if ( !ke->isAccepted() ) {
- QDialog::keyPressEvent( ke );
- }
-}
-
-
-/*! \class QFileIconProviderP qfiledialog.h
-
- \brief The QFileIconProviderP class provides icons for QFileDialogP to
- use.
-
- \ingroup misc
-
- By default QFileIconProviderP is not used, but any application or
- library can subclass it, reimplement pixmap() to return a suitable
- icon, and make all QFileDialogP objects use it by calling the static
- function QFileDialogP::setIconProvider().
-
- It is advisable to make all the icons that QFileIconProviderP returns be
- the same size or at least the same width. This makes the list view
- look much better.
-
- \sa QFileDialogP
-*/
-
-
-/*! Constructs an empty file icon provider called \a name, with the
- parent \a parent.
-*/
-
-QFileIconProviderP::QFileIconProviderP( QObject * parent, const char* name )
- : QObject( parent, name )
-{
- // nothing necessary
-}
-
-
-/*!
- Returns a pointer to a pixmap that should be used to
- signify the file with the information \a info.
-
- If pixmap() returns 0, QFileDialogP draws the default pixmap.
-
- The default implementation returns particular icons for files, directories,
- link-files and link-directories. It returns a blank "icon" for other types.
-
- If you return a pixmap here, it should measure 16x16 pixels.
-*/
-
-const QPixmap * QFileIconProviderP::pixmap( const QFileInfo & info )
-{
- if ( info.isSymLink() ) {
- if ( info.isFile() )
- return symLinkFileIcon;
- else
- return symLinkDirIcon;
- } else if ( info.isDir() ) {
- return closedFolderIcon;
- } else if ( info.isFile() ) {
- return fileIcon;
- } else {
- return fifteenTransparentPixels;
- }
-}
-
-/*!
- Sets the QFileIconProviderP used by the file dialog to \a provider.
-
- The default is that there is no QFileIconProviderP and QFileDialogP
- just draws a folder icon next to each directory and nothing next
- to files.
-
- \sa QFileIconProviderP, iconProvider()
-*/
-
-void QFileDialogP::setIconProvider( QFileIconProviderP * provider )
-{
- fileIconProvider = provider;
-}
-
-
-/*!
- Returns a pointer to the icon provider currently set on the file dialog.
- By default there is no icon provider, and this function returns 0.
-
- \sa setIconProvider(), QFileIconProviderP
-*/
-
-QFileIconProviderP * QFileDialogP::iconProvider()
-{
- return fileIconProvider;
-}
-
-
-#if defined(Q_WS_WIN)
-
-static QString getWindowsRegString( HKEY key, const char *subKey )
-{
- QString s;
- char buf[512];
- DWORD bsz = sizeof(buf);
-#ifdef Q_OS_TEMP
- int r = RegQueryValueEx( key, (LPCTSTR)qt_winTchar(subKey, TRUE), 0, 0, (LPBYTE)buf, &bsz );
-#else
- int r = RegQueryValueExA( key, subKey, 0, 0, (LPBYTE)buf, &bsz );
-#endif
- if ( r == ERROR_SUCCESS ) {
- s = buf;
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
-#ifdef Q_OS_TEMP
- r = RegQueryValueEx( key, (LPCTSTR)qt_winTchar(subKey, TRUE), 0, 0, (LPBYTE)ptr, &bsz );
-#else
- r = RegQueryValueExA( key, subKey, 0, 0, (LPBYTE)ptr, &bsz );
-#endif
- if ( r == ERROR_SUCCESS )
- s = ptr;
- delete [] ptr;
- }
- return s;
-}
-
-static void initPixmap( QPixmap &pm )
-{
- pm.fill( Qt::white );
-}
-
-QWindowsIconProvider::QWindowsIconProvider( QObject *parent, const char *name )
- : QFileIconProviderP( parent, name )
-{
- pixw = GetSystemMetrics( SM_CXSMICON );
- pixh = GetSystemMetrics( SM_CYSMICON );
-
- HKEY k;
- HICON si;
- int r;
- QString s;
- UINT res;
-
-#ifdef Q_OS_TEMP
- // ---------- get default folder pixmap
- r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
- L"folder\\DefaultIcon",
- 0, KEY_READ, &k );
-#else
- // ---------- get default folder pixmap
- r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
- "folder\\DefaultIcon",
- 0, KEY_READ, &k );
-#endif
- if ( r == ERROR_SUCCESS ) {
- s = getWindowsRegString( k, 0 );
- RegCloseKey( k );
-
- QStringList lst = QStringList::split( ",", s );
-
-#ifdef Q_OS_TEMP
- res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar( lst[ 0 ].simplifyWhiteSpace(), TRUE ),
- lst[ 1 ].simplifyWhiteSpace().toInt(),
- 0, &si, 1 );
-#else
- res = ExtractIconExA( lst[ 0 ].simplifyWhiteSpace().latin1(),
- lst[ 1 ].simplifyWhiteSpace().toInt(),
- 0, &si, 1 );
-#endif
-
- if ( res ) {
- defaultFolder.resize( pixw, pixh );
- initPixmap( defaultFolder );
- QPainter p( &defaultFolder );
- DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
- p.end();
- defaultFolder.setMask( defaultFolder.createHeuristicMask() );
- *closedFolderIcon = defaultFolder;
- DestroyIcon( si );
- } else {
- defaultFolder = *closedFolderIcon;
- }
- } else {
- RegCloseKey( k );
- }
-
-#ifdef Q_OS_TEMP
- //------------------------------- get default file pixmap
- res = (UINT)ExtractIconEx( L"shell32.dll",
- 0, 0, &si, 1 );
-#else
- //------------------------------- get default file pixmap
- res = ExtractIconExA( "shell32.dll",
- 0, 0, &si, 1 );
-#endif
-
- if ( res ) {
- defaultFile.resize( pixw, pixh );
- initPixmap( defaultFile );
- QPainter p( &defaultFile );
- DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
- p.end();
- defaultFile.setMask( defaultFile.createHeuristicMask() );
- *fileIcon = defaultFile;
- DestroyIcon( si );
- } else {
- defaultFile = *fileIcon;
- }
-
-#ifdef Q_OS_TEMP
- //------------------------------- get default exe pixmap
- res = (UINT)ExtractIconEx( L"shell32.dll",
- 2, 0, &si, 1 );
-#else
- //------------------------------- get default exe pixmap
- res = ExtractIconExA( "shell32.dll",
- 2, 0, &si, 1 );
-#endif
-
- if ( res ) {
- defaultExe.resize( pixw, pixh );
- initPixmap( defaultExe );
- QPainter p( &defaultExe );
- DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
- p.end();
- defaultExe.setMask( defaultExe.createHeuristicMask() );
- DestroyIcon( si );
- } else {
- defaultExe = *fileIcon;
- }
-}
-
-QWindowsIconProvider::~QWindowsIconProvider()
-{
- if ( this == fileIconProvider )
- fileIconProvider = 0;
-}
-
-const QPixmap * QWindowsIconProvider::pixmap( const QFileInfo &fi )
-{
- QString ext = fi.extension().upper();
- QString key = ext;
- ext.prepend( "." );
- QMap< QString, QPixmap >::Iterator it;
-
- if ( fi.isDir() ) {
- return &defaultFolder;
- } else if ( ext.lower() != ".exe" ) {
- it = cache.find( key );
- if ( it != cache.end() )
- return &( *it );
-
- HKEY k, k2;
-#ifdef Q_OS_TEMP
- int r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
- (LPCTSTR)qt_winTchar(ext, TRUE),
- 0, KEY_READ, &k );
-#else
- int r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
- ext.latin1(),
- 0, KEY_READ, &k );
-#endif
- QString s;
- if ( r == ERROR_SUCCESS ) {
- s = getWindowsRegString( k, 0 );
- } else {
- cache[ key ] = defaultFile;
- RegCloseKey( k );
- return &defaultFile;
- }
- RegCloseKey( k );
-
-#ifdef Q_OS_TEMP
- r = RegOpenKeyEx( HKEY_CLASSES_ROOT,
- (LPCTSTR)qt_winTchar( s + "\\DefaultIcon", TRUE ),
- 0, KEY_READ, &k2 );
-#else
- r = RegOpenKeyExA( HKEY_CLASSES_ROOT,
- QString( s + "\\DefaultIcon" ).latin1() ,
- 0, KEY_READ, &k2 );
-#endif
- if ( r == ERROR_SUCCESS ) {
- s = getWindowsRegString( k2, 0 );
- } else {
- cache[ key ] = defaultFile;
- RegCloseKey( k2 );
- return &defaultFile;
- }
- RegCloseKey( k2 );
-
- QStringList lst = QStringList::split( ",", s );
-
- HICON si;
- UINT res;
- QString filepath = lst[ 0 ].stripWhiteSpace();
- if ( filepath.find("%1") != -1 ) {
- filepath = filepath.arg( fi.filePath() );
- if ( ext.lower() == ".dll" ) {
- pix = defaultFile;
- return &pix;
- }
- }
-
-#ifdef Q_OS_TEMP
- res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(filepath, TRUE),
- lst[ 1 ].stripWhiteSpace().toInt(),
- NULL, &si, 1 );
-#else
- res = ExtractIconExA( filepath.latin1(),
- lst[ 1 ].stripWhiteSpace().toInt(),
- NULL, &si, 1 );
-#endif
-
- if ( res ) {
- pix.resize( pixw, pixh );
- initPixmap( pix );
- QPainter p( &pix );
- DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
- p.end();
- pix.setMask( pix.createHeuristicMask() );
- DestroyIcon( si );
- } else {
- pix = defaultFile;
- }
-
- cache[ key ] = pix;
- return &pix;
- } else {
- HICON si;
- UINT res;
-#ifdef Q_OS_TEMP
- res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(fi.absFilePath(), TRUE),
- -1,
- 0, 0, 1 );
-#else
- res = ExtractIconExA( fi.absFilePath().latin1(),
- -1,
- 0, 0, 1 );
-#endif
-
- if ( res == 0 ) {
- return &defaultExe;
- } else {
-#ifdef Q_OS_TEMP
- res = (UINT)ExtractIconEx( (LPCTSTR)qt_winTchar(fi.absFilePath(), TRUE),
- res - 1,
- 0, &si, 1 );
-#else
- res = ExtractIconExA( fi.absFilePath().latin1(),
- res - 1,
- 0, &si, 1 );
-#endif
- }
-
- if ( res ) {
- pix.resize( pixw, pixh );
- initPixmap( pix );
- QPainter p( &pix );
- DrawIconEx( p.handle(), 0, 0, si, pixw, pixh, 0, NULL, DI_NORMAL );
- p.end();
- pix.setMask( pix.createHeuristicMask() );
- DestroyIcon( si );
- } else {
- pix = defaultExe;
- }
-
- return &pix;
- }
-
- // can't happen!
- return 0;
-}
-#endif
-
-
-
-/*!
- \reimp
-*/
-bool QFileDialogP::eventFilter( QObject * o, QEvent * e )
-{
- if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F5 ) {
- rereadDir();
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F2 &&
- ( o == files || o == files->viewport() ) ) {
- if ( files->isVisible() && files->currentItem() ) {
- if ( mode() != QFileDialogP::ExistingFiles &&
- QUrlInfo( d->url, "." ).isWritable() && files->currentItem()->text( 0 ) != ".." ) {
- files->renameItem = files->currentItem();
- files->startRename( TRUE );
- }
- }
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress && ( (QKeyEvent*)e )->key() == Key_F2 &&
- ( o == d->moreFiles || o == d->moreFiles->viewport() ) ) {
- if ( d->moreFiles->isVisible() && d->moreFiles->currentItem() != -1 ) {
- if ( mode() != QFileDialogP::ExistingFiles &&
- QUrlInfo( d->url, "." ).isWritable() &&
- d->moreFiles->item( d->moreFiles->currentItem() )->text() != ".." ) {
- d->moreFiles->renameItem = d->moreFiles->item( d->moreFiles->currentItem() );
- d->moreFiles->startRename( TRUE );
- }
- }
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress && d->moreFiles->renaming ) {
- d->moreFiles->lined->setFocus();
- QApplication::sendEvent( d->moreFiles->lined, e );
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress && files->renaming ) {
- files->lined->setFocus();
- QApplication::sendEvent( files->lined, e );
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress &&
- ((QKeyEvent *)e)->key() == Key_Backspace &&
- ( o == files ||
- o == d->moreFiles ||
- o == files->viewport() ||
- o == d->moreFiles->viewport() ) ) {
- cdUpClicked();
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress &&
- ((QKeyEvent *)e)->key() == Key_Delete &&
- ( o == files ||
- o == files->viewport() ) ) {
- if ( files->currentItem() )
- deleteFile( files->currentItem()->text( 0 ) );
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( e->type() == QEvent::KeyPress &&
- ((QKeyEvent *)e)->key() == Key_Delete &&
- ( o == d->moreFiles ||
- o == d->moreFiles->viewport() ) ) {
- int c = d->moreFiles->currentItem();
- if ( c >= 0 )
- deleteFile( d->moreFiles->item( c )->text() );
- ((QKeyEvent *)e)->accept();
- return TRUE;
- } else if ( o == files && e->type() == QEvent::FocusOut &&
- files->currentItem() && mode() != ExistingFiles ) {
- } else if ( o == files && e->type() == QEvent::KeyPress ) {
- QTimer::singleShot( 0, this, SLOT(fixupNameEdit()) );
- } else if ( o == nameEdit && e->type() == QEvent::KeyPress ) {
- if ( ( nameEdit->cursorPosition() == (int)nameEdit->text().length() || nameEdit->hasSelectedText() ) &&
- isprint(((QKeyEvent *)e)->ascii()) ) {
-#if defined(_WS_WIN_)
- QString nt( nameEdit->text().lower() );
-#else
- QString nt( nameEdit->text() );
-#endif
- nt.truncate( nameEdit->cursorPosition() );
- nt += (char)(((QKeyEvent *)e)->ascii());
- QListViewItem * i = files->firstChild();
-#if defined(_WS_WIN_)
- while( i && i->text( 0 ).left(nt.length()).lower() != nt )
-#else
- while( i && i->text( 0 ).left(nt.length()) != nt )
-#endif
- i = i->nextSibling();
- if ( i ) {
- nt = i->text( 0 );
- int cp = nameEdit->cursorPosition()+1;
- nameEdit->validateAndSet( nt, cp, cp, nt.length() );
- return TRUE;
- }
- }
- } else if ( o == nameEdit && e->type() == QEvent::FocusIn ) {
- fileNameEditDone();
- } else if ( d->moreFiles->renaming && o != d->moreFiles->lined && e->type() == QEvent::FocusIn ) {
- d->moreFiles->lined->setFocus();
- return TRUE;
- } else if ( files->renaming && o != files->lined && e->type() == QEvent::FocusIn ) {
- files->lined->setFocus();
- return TRUE;
- } else if ( ( o == d->moreFiles || o == d->moreFiles->viewport() ) &&
- e->type() == QEvent::FocusIn ) {
- if ( o == d->moreFiles->viewport() && !d->moreFiles->viewport()->hasFocus() ||
- o == d->moreFiles && !d->moreFiles->hasFocus() )
- ((QWidget*)o)->setFocus();
- return FALSE;
- }
-
- return QDialog::eventFilter( o, e );
-}
-
-/*!
- Sets the filters used in the file dialog to \a filters. Each group
- of filters must be separated by \c{;;} (\e two semi-colons).
-
- \code
- QString types("*.png;;*.xpm;;*.jpg");
- QFileDialogP fd = new QFileDialogP( this );
- fd->setFilters( types );
- fd->show();
- \endcode
-
-*/
-
-void QFileDialogP::setFilters( const QString &filters )
-{
- QStringList lst = makeFiltersList( filters );
- setFilters( lst );
-}
-
-/*!
- \overload
-
- \a types must be a null-terminated list of strings.
-
-*/
-
-void QFileDialogP::setFilters( const char ** types )
-{
- if ( !types || !*types )
- return;
-
- d->types->clear();
- while( types && *types ) {
- d->types->insertItem( QString::fromLatin1(*types) );
- types++;
- }
- d->types->setCurrentItem( 0 );
- setFilter( d->types->text( 0 ) );
-}
-
-
-/*! \overload void QFileDialogP::setFilters( const QStringList & )
-*/
-
-void QFileDialogP::setFilters( const QStringList & types )
-{
- if ( types.count() < 1 )
- return;
-
- d->types->clear();
- for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it )
- d->types->insertItem( *it );
- d->types->setCurrentItem( 0 );
- setFilter( d->types->text( 0 ) );
-}
-
-/*!
- Adds the filter \a filter to the list of filters and makes it the
- current filter.
-
- \code
- QFileDialogP* fd = new QFileDialogP( this );
- fd->addFilter( "Images (*.png *.jpg *.xpm)" );
- fd->show();
- \endcode
-
- In the above example, a file dialog is created, and the file filter "Images
- (*.png *.jpg *.xpm)" is added and is set as the current filter. The original
- filter, "All Files (*)", is still available.
-
- \sa setFilter(), setFilters()
-*/
-
-void QFileDialogP::addFilter( const QString &filter )
-{
- if ( filter.isEmpty() )
- return;
- QString f = filter;
- QRegExp r( QString::fromLatin1(qt_file_dialog_filter_reg_exp) );
- int index = r.search( f );
- if ( index >= 0 )
- f = r.cap( 2 );
- for ( int i = 0; i < d->types->count(); ++i ) {
- QString f2( d->types->text( i ) );
- int index = r.search( f2 );
- if ( index >= 0 )
- f2 = r.cap( 1 );
- if ( f2 == f ) {
- d->types->setCurrentItem( i );
- setFilter( f2 );
- return;
- }
- }
-
- d->types->insertItem( filter );
- d->types->setCurrentItem( d->types->count() - 1 );
- setFilter( d->types->text( d->types->count() - 1 ) );
-}
-
-/*!
- Since modeButtons is a top-level widget, it may be destroyed by the
- kernel at application exit. Notice if this happens to
- avoid double deletion.
-*/
-
-void QFileDialogP::modeButtonsDestroyed()
-{
- if ( d )
- d->modeButtons = 0;
-}
-
-
-/*!
- This is a convenience static function that will return one or more
- existing files selected by the user.
-
- \code
- QStringList files = QFileDialogP::getOpenFileNames(
- "Images (*.png *.xpm *.jpg)",
- "/home",
- this,
- "open files dialog"
- "Select one or more files to open" );
- \endcode
-
- This function creates a modal file dialog called \a name, with
- parent \a parent. If \a parent is not 0, the dialog will be shown
- centered over the parent.
-
- The file dialog's working directory will be set to \a dir. If \a
- dir includes a file name, the file will be selected. The filter
- is set to \a filter so that only those files which match the filter
- are shown. The filter selected is set to \a selectedFilter. The parameters
- \a dir, \a selectedFilter and \a filter may be QString::null.
-
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
-
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialogP, unless the style of the application
- is set to something other than the native style.
-
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
- the file dialog will change to /var/tmp after entering /usr/tmp.
- If \a resolveSymlinks is FALSE, the file dialog will treat
- symlinks as regular directories.
-
- Note that if you want to iterate over the list of files, you should
- iterate over a copy, e.g.
- \code
- QStringList list = files;
- QStringList::Iterator it = list.begin();
- while( it != list.end() ) {
- myProcessing( *it );
- ++it;
- }
- \endcode
-
- \sa getOpenFileName(), getSaveFileName(), getExistingDirectory()
-*/
-
-QStringList QFileDialogP::getOpenFileNames( const QString & filter,
- const QString& dir,
- QWidget *parent,
- const char* name,
- const QString& caption,
- QString *selectedFilter,
- bool resolveSymlinks )
-{
- bool save_qt_resolve_symlinks = qt_resolve_symlinks;
- qt_resolve_symlinks = resolveSymlinks;
-
- QStringList filters;
- if ( !filter.isEmpty() )
- filters = makeFiltersList( filter );
-
- makeVariables();
-
- if ( workingDirectory->isNull() )
- *workingDirectory = QDir::currentDirPath();
-
- if ( !dir.isEmpty() ) {
- // #### works only correct for local files
- QUrlOperator u( dir );
- if ( u.isLocalFile() && QFileInfo( u ).isDir() ) {
- *workingDirectory = dir;
- } else {
- *workingDirectory = u.toString();
- }
- }
-
-#if defined(Q_WS_WIN)
- if ( qApp->style().styleHint( QStyle::SH_GUIStyle ) == WindowsStyle )
- return winGetOpenFileNames( filter, workingDirectory, parent, name, caption, selectedFilter );
-#elif defined(Q_WS_MAC)
- if( ( qApp->style().inherits(QMAC_DEFAULT_STYLE) ) )
- return macGetOpenFileNames(filter, workingDirectory, parent, name, caption );
-#endif
-
- QFileDialogP *dlg = new QFileDialogP( *workingDirectory, QString::null, parent, name ? name : "qt_filedlg_gofns", TRUE );
-
- Q_CHECK_PTR( dlg );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( parent && parent->icon() && !parent->icon()->isNull() )
- dlg->setIcon( *parent->icon() );
- else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
- dlg->setIcon( *qApp->mainWidget()->icon() );
-#endif
-
- dlg->setFilters( filters );
- if ( selectedFilter )
- dlg->setFilter( *selectedFilter );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( !caption.isNull() )
- dlg->setCaption( caption );
- else
- dlg->setCaption( QFileDialogP::tr("Open") );
-#endif
- dlg->setMode( QFileDialogP::ExistingFiles );
- QString result;
- QStringList lst;
- if ( dlg->exec() == QDialog::Accepted ) {
- lst = dlg->selectedFiles();
- *workingDirectory = dlg->d->url;
- if ( selectedFilter )
- *selectedFilter = dlg->selectedFilter();
- }
- delete dlg;
-
- qt_resolve_symlinks = save_qt_resolve_symlinks;
-
- return lst;
-}
-
-/*! Updates the line edit to match the speed-key usage in QListView. */
-
-void QFileDialogP::fixupNameEdit()
-{
- if ( files->currentItem() && d->mode != ExistingFiles ) {
- if ( ( (QFileDialogPrivate::File*)files->currentItem() )->info.isFile() )
- nameEdit->setText( files->currentItem()->text( 0 ) );
- }
-}
-
-/*!
- Returns the URL of the current working directory in the file dialog.
-
- \sa setUrl()
-*/
-
-QUrl QFileDialogP::url() const
-{
- return d->url;
-}
-
-static bool isRoot( const QUrl &u )
-{
-#if defined(Q_OS_MAC9)
- QString p = QDir::convertSeparators(u.path());
- if(p.contains(':') == 1)
- return TRUE;
-#elif defined(Q_OS_UNIX)
- if ( u.path() == "/" )
- return TRUE;
-#elif defined(Q_OS_WIN32)
- QString p = u.path();
- if ( p.length() == 3 &&
- p.right( 2 ) == ":/" )
- return TRUE;
- if ( p[ 0 ] == '/' && p[ 1 ] == '/' ) {
- int slashes = p.contains( '/' );
- if ( slashes <= 3 )
- return TRUE;
- if ( slashes == 4 && p[ (int)p.length() - 1 ] == '/' )
- return TRUE;
- }
-#else
-#if defined(Q_CC_GNU)
-#warning "case not covered.."
-#endif
-#endif
-
- if ( !u.isLocalFile() && u.path() == "/" )
- return TRUE;
-
- return FALSE;
-}
-
-void QFileDialogP::urlStart( QNetworkOperation *op )
-{
- if ( !op )
- return;
-
- if ( op->operation() == QNetworkProtocol::OpListChildren ) {
- if ( isRoot( d->url ) )
- d->cdToParent->setEnabled( FALSE );
- else
- d->cdToParent->setEnabled( TRUE );
- d->mimeTypeTimer->stop();
- d->sortedList.clear();
- d->pendingItems.clear();
- d->moreFiles->clearSelection();
- files->clearSelection();
- d->moreFiles->clear();
- files->clear();
- files->setSorting( -1 );
-
- QString s = d->url.toString( FALSE, FALSE );
- bool found = FALSE;
- for ( int i = 0; i < d->paths->count(); ++i ) {
-#if defined(Q_WS_WIN)
- if ( d->paths->text( i ).lower() == s.lower() ) {
-#else
- if ( d->paths->text( i ) == s ) {
-#endif
- found = TRUE;
- d->paths->setCurrentItem( i );
- break;
- }
- }
- if ( !found ) {
- d->paths->insertItem( *openFolderIcon, s, -1 );
- d->paths->setCurrentItem( d->paths->count() - 1 );
- }
- d->last = 0;
- d->hadDotDot = FALSE;
-
- if ( d->goBack && d->history.last() != d->url.toString() ) {
- d->history.append( d->url.toString() );
- if ( d->history.count() > 1 )
- d->goBack->setEnabled( TRUE );
- }
- }
-}
-
-void QFileDialogP::urlFinished( QNetworkOperation *op )
-{
- if ( !op )
- return;
-
- if ( op->operation() == QNetworkProtocol::OpListChildren ) {
- if ( QApplication::overrideCursor() )
- QApplication::restoreOverrideCursor();
- }
- if ( op->state() == QNetworkProtocol::StFailed ) {
- if ( d->paths->hasFocus() )
- d->ignoreNextKeyPress = TRUE;
-
- if ( d->progressDia ) {
- d->ignoreStop = TRUE;
- d->progressDia->close();
- delete d->progressDia;
- d->progressDia = 0;
- }
-
- QMessageBox::critical( this, tr( "Error" ), op->protocolDetail() );
-
- int ecode = op->errorCode();
- if ( ecode == QNetworkProtocol::ErrListChildren || ecode == QNetworkProtocol::ErrParse ||
- ecode == QNetworkProtocol::ErrUnknownProtocol || ecode == QNetworkProtocol::ErrLoginIncorrect ||
- ecode == QNetworkProtocol::ErrValid || ecode == QNetworkProtocol::ErrHostNotFound ||
- ecode == QNetworkProtocol::ErrFileNotExisting ) {
- if (d->url != d->oldUrl) {
- QString nf = d->url.nameFilter();
- d->url = d->oldUrl;
- d->url.setNameFilter( nf );
- rereadDir();
- }
- } else {
- // another error happened, no need to go back to last dir
- }
- } else if ( op->operation() == QNetworkProtocol::OpListChildren &&
- op == d->currListChildren ) {
- if ( !d->hadDotDot && !isRoot( d->url ) ) {
- bool ok = TRUE;
-#if defined(Q_WS_WIN)
- if ( d->url.path().left( 2 ) == "//" )
- ok = FALSE;
-#endif
- if ( ok ) {
- QUrlInfo ui( d->url, ".." );
- ui.setName( ".." );
- ui.setDir( TRUE );
- ui.setFile( FALSE );
- ui.setSymLink( FALSE );
- ui.setSize( 0 );
- QValueList<QUrlInfo> lst;
- lst << ui;
- insertEntry( lst, 0 );
- }
- }
- resortDir();
- } else if ( op->operation() == QNetworkProtocol::OpGet ) {
- } else if ( op->operation() == QNetworkProtocol::OpPut ) {
- rereadDir();
- if ( d->progressDia ) {
- d->ignoreStop = TRUE;
- d->progressDia->close();
- }
- delete d->progressDia;
- d->progressDia = 0;
- }
-}
-
-void QFileDialogP::dataTransferProgress( int bytesDone, int bytesTotal, QNetworkOperation *op )
-{
- if ( !op )
- return;
-
- QString label;
- QUrl u( op->arg( 0 ) );
- if ( u.isLocalFile() ) {
- label = u.path();
- } else {
- label = QString( "%1 (on %2)" );
- label = label.arg( u.path() ).arg( u.host() );
- }
-
- if ( !d->progressDia ) {
- if ( bytesDone < bytesTotal) {
- d->ignoreStop = FALSE;
- d->progressDia = new QFDProgressDialog( this, label, bytesTotal );
- connect( d->progressDia, SIGNAL( cancelled() ),
- this, SLOT( stopCopy() ) );
- d->progressDia->show();
- } else
- return;
- }
-
- if ( d->progressDia ) {
- if ( op->operation() == QNetworkProtocol::OpGet ) {
- if ( d->progressDia ) {
- d->progressDia->setReadProgress( bytesDone );
- }
- } else if ( op->operation() == QNetworkProtocol::OpPut ) {
- if ( d->progressDia ) {
- d->progressDia->setWriteLabel( label );
- d->progressDia->setWriteProgress( bytesDone );
- }
- } else {
- return;
- }
- }
-}
-
-void QFileDialogP::insertEntry( const QValueList<QUrlInfo> &lst, QNetworkOperation *op )
-{
- if ( op && op->operation() == QNetworkProtocol::OpListChildren &&
- op != d->currListChildren )
- return;
- QValueList<QUrlInfo>::ConstIterator it = lst.begin();
- for ( ; it != lst.end(); ++it ) {
- const QUrlInfo &inf = *it;
- if ( d->mode == DirectoryOnly && !inf.isDir() )
- continue;
- if ( inf.name() == ".." ) {
- d->hadDotDot = TRUE;
- if ( isRoot( d->url ) )
- continue;
-#if defined(Q_WS_WIN)
- if ( d->url.path().left( 2 ) == "//" )
- continue;
-#endif
- } else if ( inf.name() == "." )
- continue;
-
-#if defined(Q_WS_WIN)
- if ( !bShowHiddenFiles ) {
- if ( d->url.isLocalFile() ) {
- QString file = d->url.path() + inf.name();
-#if defined(UNICODE)
- if ( qWinVersion() & Qt::WV_NT_based ) {
- if ( GetFileAttributesW( (TCHAR*)qt_winTchar( file, TRUE ) ) & FILE_ATTRIBUTE_HIDDEN )
- continue;
- }
- else
-#endif
- {
- if ( GetFileAttributesA( file.local8Bit() ) & FILE_ATTRIBUTE_HIDDEN )
- continue;
- }
- } else {
- if ( inf.name() != ".." && inf.name()[0] == QChar('.') )
- continue;
- }
- }
-#else
- if ( !bShowHiddenFiles && inf.name() != ".." ) {
- if ( inf.name()[ 0 ] == QChar( '.' ) )
- continue;
- }
-
-#endif
- if ( !d->url.isLocalFile() ) {
- QFileDialogPrivate::File * i = 0;
- QFileDialogPrivate::MCItem *i2 = 0;
- i = new QFileDialogPrivate::File( d, &inf, files );
- i2 = new QFileDialogPrivate::MCItem( d->moreFiles, i );
-
- if ( d->mode == ExistingFiles && inf.isDir() ||
- ( isDirectoryMode( d->mode ) && inf.isFile() ) ) {
- i->setSelectable( FALSE );
- i2->setSelectable( FALSE );
- }
-
- i->i = i2;
- }
-
- d->sortedList.append( new QUrlInfo( inf ) );
- }
-}
-
-void QFileDialogP::removeEntry( QNetworkOperation *op )
-{
- if ( !op )
- return;
-
- QUrlInfo *i = 0;
- QListViewItemIterator it( files );
- bool ok1 = FALSE, ok2 = FALSE;
- for ( i = d->sortedList.first(); it.current(); ++it, i = d->sortedList.next() ) {
- if ( ( (QFileDialogPrivate::File*)it.current() )->info.name() == op->arg( 0 ) ) {
- d->pendingItems.removeRef( (QFileDialogPrivate::File*)it.current() );
- delete ( (QFileDialogPrivate::File*)it.current() )->i;
- delete it.current();
- ok1 = TRUE;
- }
- if ( i && i->name() == op->arg( 0 ) ) {
- d->sortedList.removeRef( i );
- i = d->sortedList.prev();
- ok2 = TRUE;
- }
- if ( ok1 && ok2 )
- break;
- }
-}
-
-void QFileDialogP::itemChanged( QNetworkOperation *op )
-{
- if ( !op )
- return;
-
- QUrlInfo *i = 0;
- QListViewItemIterator it1( files );
- bool ok1 = FALSE, ok2 = FALSE;
- // first check whether the new file replaces an existing file.
- for ( i = d->sortedList.first(); it1.current(); ++it1, i = d->sortedList.next() ) {
- if ( ( (QFileDialogPrivate::File*)it1.current() )->info.name() == op->arg( 1 ) ) {
- delete ( (QFileDialogPrivate::File*)it1.current() )->i;
- delete it1.current();
- ok1 = TRUE;
- }
- if ( i && i->name() == op->arg( 1 ) ) {
- d->sortedList.removeRef( i );
- i = d->sortedList.prev();
- ok2 = TRUE;
- }
- if ( ok1 && ok2 )
- break;
- }
-
- i = 0;
- QListViewItemIterator it( files );
- ok1 = FALSE;
- ok2 = FALSE;
- for ( i = d->sortedList.first(); it.current(); ++it, i = d->sortedList.next() ) {
- if ( ( (QFileDialogPrivate::File*)it.current() )->info.name() == op->arg( 0 ) ) {
- ( (QFileDialogPrivate::File*)it.current() )->info.setName( op->arg( 1 ) );
- ok1 = TRUE;
- }
- if ( i && i->name() == op->arg( 0 ) ) {
- i->setName( op->arg( 1 ) );
- ok2 = TRUE;
- }
- if ( ok1 && ok2 )
- break;
- }
-
- resortDir();
-}
-
-/*!
- \property QFileDialogP::infoPreview
-
- \brief whether the file dialog can provide preview information about
- the currently selected file
-
- The default is FALSE.
-*/
-bool QFileDialogP::isInfoPreviewEnabled() const
-{
- return d->infoPreview;
-}
-
-void QFileDialogP::setInfoPreviewEnabled( bool info )
-{
- if ( info == d->infoPreview )
- return;
- d->geometryDirty = TRUE;
- d->infoPreview = info;
- updateGeometries();
-}
-
-
-/*!
- \property QFileDialogP::contentsPreview
-
- \brief whether the file dialog can provide a contents preview of the
- currently selected file
-
- The default is FALSE.
-
- \sa setContentsPreview() setInfoPreviewEnabled()
-*/
-// ### improve the above documentation: how is the preview done, how can I add
-// support for customized preview, etc.
-
-bool QFileDialogP::isContentsPreviewEnabled() const
-{
- return d->contentsPreview;
-}
-
-void QFileDialogP::setContentsPreviewEnabled( bool contents )
-{
- if ( contents == d->contentsPreview )
- return;
- d->geometryDirty = TRUE;
- d->contentsPreview = contents;
- updateGeometries();
-}
-
-
-/*!
- Sets the widget to be used for displaying information about the file
- to the widget \a w and a preview of that information to the
- QFilePreviewP \a preview.
-
- Normally you would create a preview widget that derives from both QWidget and
- QFilePreviewP, so you should pass the same widget twice.
-
- \code
- class Preview : public QLabel, public QFilePreviewP
- {
- public:
- Preview( QWidget *parent=0 ) : QLabel( parent ) {}
-
- void previewUrl( const QUrl &u )
- {
- QString path = u.path();
- QPixmap pix( path );
- if ( pix.isNull() )
- setText( "This is not a pixmap" );
- else
- setText( "This is a pixmap" );
- }
- };
-
- //...
-
- int main( int argc, char** argv )
- {
- Preview* p = new Preview;
-
- QFileDialogP* fd = new QFileDialogP( this );
- fd->setInfoPreviewEnabled( TRUE );
- fd->setInfoPreview( p, p );
- fd->setPreviewMode( QFileDialogP::Info );
- fd->show();
- }
-
- \endcode
-
- \sa setContentsPreview(), setInfoPreviewEnabled(), setPreviewMode()
-
-*/
-
-void QFileDialogP::setInfoPreview( QWidget *w, QFilePreviewP *preview )
-{
- if ( !w || !preview )
- return;
-
- if ( d->infoPreviewWidget ) {
- d->preview->removeWidget( d->infoPreviewWidget );
- delete d->infoPreviewWidget;
- }
- if ( d->infoPreviewer )
- delete d->infoPreviewer;
- d->infoPreviewWidget = w;
- d->infoPreviewer = preview;
- w->reparent( d->preview, 0, QPoint( 0, 0 ) );
-}
-
-/*!
- Sets the widget to be used for displaying the contents of the file
- to the widget \a w and a preview of those contents to the
- QFilePreviewP \a preview.
-
- Normally you would create a preview widget that derives from both QWidget and
- QFilePreviewP, so you should pass the same widget twice.
-
- \code
- class Preview : public QLabel, public QFilePreviewP
- {
- public:
- Preview( QWidget *parent=0 ) : QLabel( parent ) {}
-
- void previewUrl( const QUrl &u )
- {
- QString path = u.path();
- QPixmap pix( path );
- if ( pix.isNull() )
- setText( "This is not a pixmap" );
- else
- setPixmap( pix );
- }
- };
-
- //...
-
- int main( int argc, char** argv )
- {
- Preview* p = new Preview;
-
- QFileDialogP* fd = new QFileDialogP( this );
- fd->setContentsPreviewEnabled( TRUE );
- fd->setContentsPreview( p, p );
- fd->setPreviewMode( QFileDialogP::Contents );
- fd->show();
- }
- \endcode
-
- \sa setContentsPreviewEnabled(), setInfoPreview(), setPreviewMode()
-*/
-
-void QFileDialogP::setContentsPreview( QWidget *w, QFilePreviewP *preview )
-{
- if ( !w || !preview )
- return;
-
- if ( d->contentsPreviewWidget ) {
- d->preview->removeWidget( d->contentsPreviewWidget );
- delete d->contentsPreviewWidget;
- }
- if ( d->contentsPreviewer )
- delete d->contentsPreviewer;
- d->contentsPreviewWidget = w;
- d->contentsPreviewer = preview;
- w->reparent( d->preview, 0, QPoint( 0, 0 ) );
-}
-
-/*!
- Re-sorts the displayed directory.
-
- \sa rereadDir()
-*/
-
-void QFileDialogP::resortDir()
-{
- d->mimeTypeTimer->stop();
- d->pendingItems.clear();
-
- QFileDialogPrivate::File *item = 0;
- QFileDialogPrivate::MCItem *item2 = 0;
-
- d->sortedList.sort();
-
- if ( files->childCount() > 0 || d->moreFiles->count() > 0 ) {
- d->moreFiles->clear();
- files->clear();
- d->last = 0;
- files->setSorting( -1 );
- }
-
- QUrlInfo *i = sortAscending ? d->sortedList.first() : d->sortedList.last();
- for ( ; i; i = sortAscending ? d->sortedList.next() : d->sortedList.prev() ) {
- item = new QFileDialogPrivate::File( d, i, files );
- item2 = new QFileDialogPrivate::MCItem( d->moreFiles, item, item2 );
- item->i = item2;
- d->pendingItems.append( item );
- if ( d->mode == ExistingFiles && item->info.isDir() ||
- ( isDirectoryMode( d->mode ) && item->info.isFile() ) ) {
- item->setSelectable( FALSE );
- item2->setSelectable( FALSE );
- }
- }
-
- // ##### As the QFileIconProviderP only support QFileInfo and no
- // QUrlInfo it can be only used for local files at the moment. In
- // 3.0 we have to change the API of QFileIconProviderP to work on
- // QUrlInfo so that also remote filesystems can be show mime-type
- // specific icons.
- if ( d->url.isLocalFile() )
- d->mimeTypeTimer->start( 0 );
-}
-
-/*!
- Stops the current copy operation.
-*/
-
-void QFileDialogP::stopCopy()
-{
- if ( d->ignoreStop )
- return;
-
- d->url.blockSignals( TRUE );
- d->url.stop();
- if ( d->progressDia ) {
- d->ignoreStop = TRUE;
- QTimer::singleShot( 100, this, SLOT( removeProgressDia() ) );
- }
- d->url.blockSignals( FALSE );
-}
-
-/*!
- \internal
-*/
-
-void QFileDialogP::removeProgressDia()
-{
- if ( d->progressDia )
- delete d->progressDia;
- d->progressDia = 0;
-}
-
-/*!
- \internal
-*/
-
-void QFileDialogP::doMimeTypeLookup()
-{
- if ( !iconProvider() ) {
- d->pendingItems.clear();
- d->mimeTypeTimer->stop();
- return;
- }
-
- d->mimeTypeTimer->stop();
- if ( d->pendingItems.count() == 0 ) {
- return;
- }
-
- QRect r;
- QFileDialogPrivate::File *item = d->pendingItems.first();
- if ( item ) {
- QFileInfo fi;
- if ( d->url.isLocalFile() ) {
- fi.setFile( QUrl( d->url.path(), QFileDialogPrivate::encodeFileName( item->info.name() ) ).path( FALSE ) );
- } else
- fi.setFile( item->info.name() ); // #####
- const QPixmap *p = iconProvider()->pixmap( fi );
- if ( p && p != item->pixmap( 0 ) &&
- ( !item->pixmap( 0 ) || p->serialNumber() != item->pixmap( 0 )->serialNumber() ) &&
- p != fifteenTransparentPixels ) {
- item->hasMimePixmap = TRUE;
-
- // evil hack to avoid much too much repaints!
- qApp->processEvents();
- files->setUpdatesEnabled( FALSE );
- files->viewport()->setUpdatesEnabled( FALSE );
- if ( item != d->pendingItems.first() )
- return;
- item->setPixmap( 0, *p );
- qApp->processEvents();
- files->setUpdatesEnabled( TRUE );
- files->viewport()->setUpdatesEnabled( TRUE );
-
- if ( files->isVisible() ) {
- QRect ir( files->itemRect( item ) );
- if ( ir != QRect( 0, 0, -1, -1 ) ) {
- r = r.unite( ir );
- }
- } else {
- QRect ir( d->moreFiles->itemRect( item->i ) );
- if ( ir != QRect( 0, 0, -1, -1 ) ) {
- r = r.unite( ir );
- }
- }
- }
- if ( d->pendingItems.count() )
- d->pendingItems.removeFirst();
- }
-
- if ( d->moreFiles->isVisible() ) {
- d->moreFiles->viewport()->repaint( r, FALSE );
- } else {
- files->viewport()->repaint( r, FALSE );
- }
-
- if ( d->pendingItems.count() )
- d->mimeTypeTimer->start( 0 );
- else if ( d->moreFiles->isVisible() )
- d->moreFiles->triggerUpdate( TRUE );
-}
-
-/*!
- If \a b is TRUE then all the files in the current directory are selected;
- otherwise, they are deselected.
-*/
-
-void QFileDialogP::selectAll( bool b )
-{
- if ( d->mode != ExistingFiles )
- return;
- d->moreFiles->selectAll( b );
- files->selectAll( b );
-}
-
-void QFileDialogP::goBack()
-{
- if ( !d->goBack || !d->goBack->isEnabled() )
- return;
- d->history.remove( d->history.last() );
- if ( d->history.count() < 2 )
- d->goBack->setEnabled( FALSE );
- setUrl( d->history.last() );
-}
-
-// a class with wonderfully inflexible flexibility. why doesn't it
-// just subclass QWidget in the first place? 'you have to derive your
-// preview widget from QWidget and from this class' indeed.
-
-/*!
- \class QFilePreviewP qfiledialog.h
- \ingroup misc
- \brief The QFilePreviewP class provides file previewing in QFileDialogP.
-
- This class is an abstract base class which is used to implement
- widgets that can display a preview of a file in a QFileDialogP.
-
- You must derive the preview widget from both QWidget and from this
- class. Then you must reimplement this class's previewUrl() function,
- which is called by the file dialog if the preview of a file
- (specified as a URL) should be shown.
-
- See also QFileDialog::setPreviewMode(), QFileDialogP::setContentsPreview(),
- QFileDialogP::setInfoPreview(), QFileDialogP::setInfoPreviewEnabled(),
- QFileDialogP::setContentsPreviewEnabled().
-
- For an example of a preview widget see qt/examples/qdir/qdir.cpp.
-*/
-
-/*!
- Constructs the QFilePreviewP.
-*/
-
-QFilePreviewP::QFilePreviewP()
-{
-}
-
-/*!
- \fn void QFilePreviewP::previewUrl( const QUrl &url )
-
- This function is called by QFileDialogP if a preview
- for the \a url should be shown. Reimplement this
- function to provide file previewing.
-*/
-
-#endif
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qfiledialogP.h
-// Description : the patch for Qt's QFileDialog class (qfiledialog.h)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Definition of QFileDialog class
-**
-** Created : 950428
-**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the dialogs module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#ifndef QFILEDIALOGP_H
-#define QFILEDIALOGP_H
-
-class QPushButton;
-class QButton;
-class QLabel;
-class QWidget;
-class QFileDialog;
-class QTimer;
-class QNetworkOperation;
-class QLineEdit;
-class QListViewItem;
-class QListBoxItem;
-class QProgressBar;
-class QFileDialogPrivate;
-class QFileDialogQFileListView;
-
-#ifndef QT_H
-#include "qdir.h"
-#include "qdialog.h"
-#include "qurloperator.h"
-#include "qurlinfo.h"
-#include "qlistbox.h"
-#include "qlistview.h"
-#include "qlineedit.h"
-#endif // QT_H
-
-#ifndef QT_NO_FILEDIALOG
-
-class Q_EXPORT QFileIconProviderP : public QObject
-{
- Q_OBJECT
-public:
- QFileIconProviderP( QObject * parent = 0, const char* name = 0 );
- virtual const QPixmap * pixmap( const QFileInfo & );
-
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QFileIconProviderP( const QFileIconProviderP & );
- QFileIconProviderP& operator=( const QFileIconProviderP & );
-#endif
-};
-
-class Q_EXPORT QFilePreviewP
-{
-public:
- QFilePreviewP();
- virtual void previewUrl( const QUrl &url ) = 0;
-
-};
-
-class Q_EXPORT QFileDialogP : public QDialog
-{
- Q_OBJECT
- Q_ENUMS( Mode ViewMode PreviewMode )
- // ##### Why are this read-only properties ?
- Q_PROPERTY( QString selectedFile READ selectedFile )
- Q_PROPERTY( QString selectedFilter READ selectedFilter )
- Q_PROPERTY( QStringList selectedFiles READ selectedFiles )
- // #### Should not we be able to set the path ?
- Q_PROPERTY( QString dirPath READ dirPath )
- Q_PROPERTY( bool showHiddenFiles READ showHiddenFiles WRITE setShowHiddenFiles )
- Q_PROPERTY( Mode mode READ mode WRITE setMode )
- Q_PROPERTY( ViewMode viewMode READ viewMode WRITE setViewMode )
- Q_PROPERTY( PreviewMode previewMode READ previewMode WRITE setPreviewMode )
- Q_PROPERTY( bool infoPreview READ isInfoPreviewEnabled WRITE setInfoPreviewEnabled )
- Q_PROPERTY( bool contentsPreview READ isContentsPreviewEnabled WRITE setContentsPreviewEnabled )
-
-public:
- QFileDialogP( const QString& dirName, const QString& filter = QString::null,
- QWidget* parent=0, const char* name=0, bool modal = FALSE );
- QFileDialogP( QWidget* parent=0, const char* name=0, bool modal = FALSE );
- ~QFileDialogP();
-
- // recommended static functions
-
- static QString getOpenFileName( const QString &initially = QString::null,
- const QString &filter = QString::null,
- QWidget *parent = 0, const char* name = 0,
- const QString &caption = QString::null,
- QString *selectedFilter = 0,
- bool resolveSymlinks = TRUE);
- static QString getSaveFileName( const QString &initially = QString::null,
- const QString &filter = QString::null,
- QWidget *parent = 0, const char* name = 0,
- const QString &caption = QString::null,
- QString *selectedFilter = 0,
- bool resolveSymlinks = TRUE);
- static QString getExistingDirectory( const QString &dir = QString::null,
- QWidget *parent = 0,
- const char* name = 0,
- const QString &caption = QString::null,
- bool dirOnly = TRUE,
- bool resolveSymlinks = TRUE);
- static QStringList getOpenFileNames( const QString &filter= QString::null,
- const QString &dir = QString::null,
- QWidget *parent = 0,
- const char* name = 0,
- const QString &caption = QString::null,
- QString *selectedFilter = 0,
- bool resolveSymlinks = TRUE);
-
- // other static functions
-
- static void setIconProvider( QFileIconProviderP * );
- static QFileIconProviderP* iconProvider();
-
- // non-static function for special needs
-
- QString selectedFile() const;
- QString selectedFilter() const;
- virtual void setSelectedFilter( const QString& );
- virtual void setSelectedFilter( int );
-
- void setSelection( const QString &);
-
- void selectAll( bool b );
-
- QStringList selectedFiles() const;
-
- QString dirPath() const;
-
- void setDir( const QDir & );
- const QDir *dir() const;
-
- void setShowHiddenFiles( bool s );
- bool showHiddenFiles() const;
-
- void rereadDir();
- void resortDir();
-
- enum Mode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
- void setMode( Mode );
- Mode mode() const;
-
- enum ViewMode { Detail, List };
- enum PreviewMode { NoPreview, Contents, Info };
- void setViewMode( ViewMode m );
- ViewMode viewMode() const;
- void setPreviewMode( PreviewMode m );
- PreviewMode previewMode() const;
-
- bool eventFilter( QObject *, QEvent * );
-
- bool isInfoPreviewEnabled() const;
- bool isContentsPreviewEnabled() const;
- void setInfoPreviewEnabled( bool );
- void setContentsPreviewEnabled( bool );
-
- void setInfoPreview( QWidget *w, QFilePreviewP *preview );
- void setContentsPreview( QWidget *w, QFilePreviewP *preview );
-
- QUrl url() const;
-
- void addFilter( const QString &filter );
-
-public slots:
- void done( int );
- void setDir( const QString& );
- void setUrl( const QUrlOperator &url );
- void setFilter( const QString& );
- void setFilters( const QString& );
- void setFilters( const char ** );
- void setFilters( const QStringList& );
-
-protected:
- void resizeEvent( QResizeEvent * );
- void keyPressEvent( QKeyEvent * );
-
- void addWidgets( QLabel *, QWidget *, QPushButton * );
- void addToolButton( QButton *b, bool separator = FALSE );
- void addLeftWidget( QWidget *w );
- void addRightWidget( QWidget *w );
-
-signals:
- void fileHighlighted( const QString& );
- void fileSelected( const QString& );
- void filesSelected( const QStringList& );
- void dirEntered( const QString& );
- void filterSelected( const QString& );
-
-private slots:
- void detailViewSelectionChanged();
- void listBoxSelectionChanged();
- void changeMode( int );
- void fileNameEditReturnPressed();
- void stopCopy();
- void removeProgressDia();
-
- void fileSelected( int );
- void fileHighlighted( int );
- void dirSelected( int );
- void pathSelected( int );
-
- void updateFileNameEdit( QListViewItem *);
- void selectDirectoryOrFile( QListViewItem * );
- void popupContextMenu( QListViewItem *, const QPoint &, int );
- void popupContextMenu( QListBoxItem *, const QPoint & );
- void updateFileNameEdit( QListBoxItem *);
- void selectDirectoryOrFile( QListBoxItem * );
- void fileNameEditDone();
-
- void okClicked();
- void filterClicked(); // not used
- void cancelClicked();
-
- void cdUpClicked();
- void newFolderClicked();
-
- void fixupNameEdit();
-
- void doMimeTypeLookup();
-
- void updateGeometries();
- void modeButtonsDestroyed();
- void urlStart( QNetworkOperation *op );
- void urlFinished( QNetworkOperation *op );
- void dataTransferProgress( int bytesDone, int bytesTotal, QNetworkOperation * );
- void insertEntry( const QValueList<QUrlInfo> &fi, QNetworkOperation *op );
- void removeEntry( QNetworkOperation * );
- void createdDirectory( const QUrlInfo &info, QNetworkOperation * );
- void itemChanged( QNetworkOperation * );
- void goBack();
-
-private:
- enum PopupAction {
- PA_Open = 0,
- PA_Delete,
- PA_Rename,
- PA_SortName,
- PA_SortSize,
- PA_SortType,
- PA_SortDate,
- PA_SortUnsorted,
- PA_Cancel,
- PA_Reload,
- PA_Hidden
- };
-
- void init();
- bool trySetSelection( bool isDir, const QUrlOperator &, bool );
- void deleteFile( const QString &filename );
- void popupContextMenu( const QString &filename, bool withSort,
- PopupAction &action, const QPoint &p );
-
- QDir reserved; // was cwd
- QString fileName;
-
- friend class QFileDialogQFileListView;
- friend class QFileListBox;
-
- QFileDialogPrivate *d;
- QFileDialogQFileListView *files;
-
- QLineEdit *nameEdit; // also filter
- QPushButton *okB;
- QPushButton *cancelB;
-
-#if defined(Q_WS_WIN)
- static QString winGetOpenFileName( const QString &initialSelection,
- const QString &filter,
- QString* workingDirectory,
- QWidget *parent = 0,
- const char* name = 0,
- const QString& caption = QString::null,
- QString* selectedFilter = 0 );
- static QString winGetSaveFileName( const QString &initialSelection,
- const QString &filter,
- QString* workingDirectory,
- QWidget *parent = 0,
- const char* name = 0,
- const QString& caption = QString::null,
- QString* selectedFilter = 0 );
- static QStringList winGetOpenFileNames( const QString &filter,
- QString* workingDirectory,
- QWidget *parent = 0,
- const char* name = 0,
- const QString& caption = QString::null,
- QString* selectedFilter = 0 );
- static QString winGetExistingDirectory( const QString &initialDirectory,
- QWidget* parent = 0,
- const char* name = 0,
- const QString& caption = QString::null);
- static QString resolveLinkFile( const QString& linkfile );
-#endif
-#if defined(Q_WS_MACX) || defined(Q_WS_MAC9)
- static QString macGetSaveFileName( const QString &, const QString &,
- QString *, QWidget *, const char*,
- const QString& );
- static QStringList macGetOpenFileNames( const QString &, QString*,
- QWidget *, const char *,
- const QString&, bool = TRUE,
- bool = FALSE );
-#endif
-
-
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QFileDialogP( const QFileDialogP & );
- QFileDialogP &operator=( const QFileDialogP & );
-#endif
-};
-
-/******************************************************************
- *
- * Definitions of view classes
- *
- ******************************************************************/
-
-class QRenameEdit : public QLineEdit
-{
- Q_OBJECT
-
-public:
- QRenameEdit( QWidget *parent )
- : QLineEdit( parent, "qt_rename_edit" )
- {}
-
-protected:
- void keyPressEvent( QKeyEvent *e );
- void focusOutEvent( QFocusEvent *e );
-
-signals:
- void escapePressed();
-
-};
-
-class QFileListBox : public QListBox
-{
- friend class QFileDialogP;
-
- Q_OBJECT
-
-private:
- QFileListBox( QWidget *parent, QFileDialogP *d );
-
- void clear();
- void show();
- void startRename( bool check = TRUE );
- void viewportMousePressEvent( QMouseEvent *e );
- void viewportMouseReleaseEvent( QMouseEvent *e );
- void viewportMouseDoubleClickEvent( QMouseEvent *e );
- void viewportMouseMoveEvent( QMouseEvent *e );
-#ifndef QT_NO_DRAGANDDROP
- void viewportDragEnterEvent( QDragEnterEvent *e );
- void viewportDragMoveEvent( QDragMoveEvent *e );
- void viewportDragLeaveEvent( QDragLeaveEvent *e );
- void viewportDropEvent( QDropEvent *e );
- bool acceptDrop( const QPoint &pnt, QWidget *source );
- void setCurrentDropItem( const QPoint &pnt );
-#endif
- void keyPressEvent( QKeyEvent *e );
-
-private slots:
- void rename();
- void cancelRename();
- void doubleClickTimeout();
- void changeDirDuringDrag();
- void dragObjDestroyed();
- void contentsMoved( int, int );
-
-private:
- QRenameEdit *lined;
- QFileDialogP *filedialog;
- bool renaming;
- QTimer* renameTimer;
- QListBoxItem *renameItem, *dragItem;
- QPoint pressPos, oldDragPos;
- bool mousePressed;
- int urls;
- QString startDragDir;
- QListBoxItem *currDropItem;
- QTimer *changeDirTimer;
- bool firstMousePressEvent;
- QUrlOperator startDragUrl;
-
-};
-
-
-class QFileDialogQFileListView : public QListView
-{
- Q_OBJECT
-
-public:
- QFileDialogQFileListView( QWidget *parent, QFileDialogP *d );
-
- void clear();
- void startRename( bool check = TRUE );
- void setSorting( int column, bool increasing = TRUE );
-
- QRenameEdit *lined;
- bool renaming;
- QListViewItem *renameItem;
-
-private:
- void viewportMousePressEvent( QMouseEvent *e );
- void viewportMouseDoubleClickEvent( QMouseEvent *e );
- void keyPressEvent( QKeyEvent *e );
- void viewportMouseReleaseEvent( QMouseEvent *e );
- void viewportMouseMoveEvent( QMouseEvent *e );
-#ifndef QT_NO_DRAGANDDROP
- void viewportDragEnterEvent( QDragEnterEvent *e );
- void viewportDragMoveEvent( QDragMoveEvent *e );
- void viewportDragLeaveEvent( QDragLeaveEvent *e );
- void viewportDropEvent( QDropEvent *e );
- bool acceptDrop( const QPoint &pnt, QWidget *source );
- void setCurrentDropItem( const QPoint &pnt );
-#endif
-
-private slots:
- void rename();
- void cancelRename();
- void changeSortColumn2( int column );
- void doubleClickTimeout();
- void changeDirDuringDrag();
- void dragObjDestroyed();
- void contentsMoved( int, int );
-
-private:
- QFileDialogP *filedialog;
- QTimer* renameTimer;
- QPoint pressPos, oldDragPos;
- bool mousePressed;
- int urls;
- QString startDragDir;
- QListViewItem *currDropItem, *dragItem;
- QTimer *changeDirTimer;
- bool firstMousePressEvent;
- bool ascending;
- int sortcolumn;
- QUrlOperator startDragUrl;
-
-};
-
-/****************************************************************************
- *
- * Classes for copy progress dialog
- *
- ****************************************************************************/
-
-class QFDProgressAnimation : public QWidget
-{
- Q_OBJECT
-
-public:
- QFDProgressAnimation( QWidget *parent );
- void start();
-
-private slots:
- void next();
-
-protected:
- void paintEvent( QPaintEvent *e );
-
-private:
- int step;
- QTimer *timer;
-
-};
-
-class QFDProgressDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- QFDProgressDialog( QWidget *parent, const QString &fn, int steps );
-
- void setReadProgress( int p );
- void setWriteProgress( int p );
- void setWriteLabel( const QString &s );
-
-signals:
- void cancelled();
-
-private:
- QProgressBar *readBar;
- QProgressBar *writeBar;
- QLabel *writeLabel;
- QFDProgressAnimation *animation;
-
-};
-
-#endif
-
-#endif // QFILEDIALOG_H
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qsplitterP.cxx
-// Description : the patch for Qt's QSplitter class (qsplitter.cpp)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Splitter widget
-**
-** Created: 980105
-**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the widgets module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#include "qsplitterP.h"
-#ifndef QT_NO_COMPLEXWIDGETS
-
-#include <qglobal.h>
-#include <qpainter.h>
-#include <qdrawutil.h>
-#include <qbitmap.h>
-#include <private/qlayoutengine_p.h>
-#if QT_VERSION < 300
- #include <qlist.h>
- #include <qarray.h>
-#else
- #include <qptrlist.h> //qt3.x
- #include <qmemarray.h> //qt3.x
- #include <qstyle.h> //qt3.x
-#endif
-
-#include <qobjectlist.h>
-#include <qapplication.h> //sendPostedEvents
-using namespace std;
-
-#define SPLITTER_ICON_WIDTH 10
-#define SPLITTER_ICON_HEIGHT 12
-
-static int mouseOffset;
-static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
-
-static const char* splitter_left_xpm[] = {
- "5 5 2 1 0 0",
- " s none m none c none",
- ". s iconColor1 m black c black",
- " ..",
- " ....",
- ".....",
- " ....",
- " .."
-};
-
-static const char* splitter_right_xpm[] = {
- "5 5 2 1 0 0",
- " s iconColor1 m black c black",
- ". s none m none c none",
- " ...",
- " .",
- " ",
- " .",
- " ..."
-};
-
-static const char* splitter_up_xpm[] = {
- "5 5 2 1 0 0",
- " s none m none c none",
- ". s iconColor1 m black c black",
- " . ",
- " ... ",
- " ... ",
- ".....",
- "....."
-};
-
-static const char* splitter_down_xpm[] = {
- "5 5 2 1 0 0",
- " s iconColor1 m black c black",
- ". s none m none c none",
- " ",
- " ",
- ". .",
- ". .",
- ".. .."
-};
-
-QSplitterPHandle::QSplitterPHandle( Qt::Orientation o,
- QSplitterP *parent, const char * name )
- : QWidget( parent, name )
-{
- s = parent;
-
- left = new QPushButton(this);
- right = new QPushButton(this);
- unleft = new QPushButton(this);
- unright = new QPushButton(this);
-
- setOrientation(o);
-
- left->setAutoDefault(false); unleft->setAutoDefault(false);
- right->setAutoDefault(false); unright->setAutoDefault(false);
- left->setFlat(true); right->setFlat(true); unleft->setFlat(true); unright->setFlat(true);
- left->setCursor( arrowCursor ); right->setCursor( arrowCursor );
- unleft->setCursor( arrowCursor ); unright->setCursor( arrowCursor );
-
- connect(left, SIGNAL(clicked()), this, SLOT(onBeforeCompress()));
- connect(right, SIGNAL(clicked()), this, SLOT(onAfterCompress()));
- connect(unleft, SIGNAL(clicked()), this, SLOT(onBeforeUnCompress()));
- connect(unright, SIGNAL(clicked()), this, SLOT(onAfterUnCompress()));
-}
-
-void QSplitterPHandle::onBeforeCompress() {
- oldpos = s->pick(pos());
- int pos = s->pick(s->widgetBefore(id())->pos());
- s->compress(s->widgetBefore(id()));
- s->moveSplitter(pos, id());
- s->updateSplitterHandles();
-}
-
-void QSplitterPHandle::onBeforeUnCompress() {
- s->unCompress(s->widgetBefore(id()));
- s->moveSplitter(oldpos, id());
- s->updateSplitterHandles();
-}
-
-void QSplitterPHandle::onAfterCompress() {
- oldpos = s->pick(pos());
- int pos = s->pick(s->widgetAfter(id())->pos()) + s->pick(s->widgetAfter(id())->size()) - s->pick(size());
- s->compress(s->widgetAfter(id()));
- s->moveSplitter(pos, id());
- s->updateSplitterHandles();
-}
-
-void QSplitterPHandle::onAfterUnCompress() {
- s->unCompress(s->widgetAfter(id()));
- s->moveSplitter(oldpos, id());
- s->updateSplitterHandles();
-}
-
-// VSR 21/11/02 -> ================================
-void QSplitterPHandle::compressAfter()
-{
- onAfterCompress();
-}
-
-void QSplitterPHandle::unCompressAfter()
-{
- onAfterUnCompress();
-}
-
-void QSplitterPHandle::compressBefore()
-{
- onBeforeCompress();
-}
-
-void QSplitterPHandle::unCompressBefore()
-{
- onBeforeUnCompress();
-}
-// VSR 21/11/02 <- ================================
-
-QSizePolicy QSplitterPHandle::sizePolicy() const
-{
- //### removeme 3.0
- return QWidget::sizePolicy();
-}
-
-QSize QSplitterPHandle::sizeHint() const
-{
-#if QT_VERSION < 300
- int sw = style().splitterWidth();
- return QSize(sw,sw).expandedTo( QApplication::globalStrut() );
-#else
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
- return (style().sizeFromContents(QStyle::CT_Splitter, s, QSize(sw, sw)).
- expandedTo(QApplication::globalStrut()));
-#endif
-}
-
-void QSplitterPHandle::setOrientation( Qt::Orientation o )
-{
- orient = o;
-#ifndef QT_NO_CURSOR
- if ( o == QSplitterP::Horizontal )
- setCursor( splitHCursor );
- else
- setCursor( splitVCursor );
-#endif
-
- QPixmap lp, rp;
- if ( orient == QSplitterP::Horizontal )
- {
- lp = QPixmap(splitter_left_xpm);
- rp = QPixmap(splitter_right_xpm);
- }
- else
- {
- lp = QPixmap(splitter_up_xpm);
- rp = QPixmap(splitter_down_xpm);
- }
- left->setPixmap(lp);
- right->setPixmap(rp);
- unleft->setPixmap(rp);
- unright->setPixmap(lp);
-}
-
-void QSplitterPHandle::mouseMoveEvent( QMouseEvent *e )
-{
- if ( !(e->state()&LeftButton) )
- return;
- QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- - mouseOffset;
- if ( opaque() ) {
- s->moveSplitter( pos, id() );
- } else {
- int min = pos; int max = pos;
- s->getRange( id(), &min, &max );
- s->setRubberband( QMAX( min, QMIN(max, pos )));
- }
-}
-
-void QSplitterPHandle::mousePressEvent( QMouseEvent *e )
-{
- if ( e->button() == LeftButton )
- mouseOffset = s->pick(e->pos());
-}
-
-void QSplitterPHandle::mouseReleaseEvent( QMouseEvent *e )
-{
- if ( !opaque() && e->button() == LeftButton ) {
- QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()));
- s->setRubberband( -1 );
- s->moveSplitter( pos, id() );
- }
-}
-
-void QSplitterPHandle::paintEvent( QPaintEvent * )
-{
- updateButtonState();
- QPainter p( this );
- s->drawSplitter( &p, 0, 0, width(), height() );
-}
-
-void QSplitterPHandle::updateButtonState() {
- if (!s->isCompressEnabled()) {
- left->hide();
- right->hide();
- unleft->hide();
- unright->hide();
- }
- else {
- if ( orient == QSplitterP::Horizontal )
- {
- left->setGeometry( QRect( QPoint( (width() - SPLITTER_ICON_WIDTH)/2, 0 ),
- QSize ( SPLITTER_ICON_WIDTH, SPLITTER_ICON_HEIGHT ) ) );
- right->setGeometry( QRect( QPoint( (width() - SPLITTER_ICON_WIDTH)/2, SPLITTER_ICON_HEIGHT ),
- QSize ( SPLITTER_ICON_WIDTH, SPLITTER_ICON_HEIGHT ) ) );
- unleft->setGeometry( left->geometry() );
- unright->setGeometry( right->geometry() );
- }
- else
- {
- left->setGeometry( QRect( QPoint( 0, (height() - SPLITTER_ICON_WIDTH)/2 ),
- QSize ( SPLITTER_ICON_HEIGHT, SPLITTER_ICON_WIDTH ) ) );
- right->setGeometry( QRect( QPoint( SPLITTER_ICON_HEIGHT, (height() - SPLITTER_ICON_WIDTH)/2),
- QSize ( SPLITTER_ICON_HEIGHT, SPLITTER_ICON_WIDTH ) ) );
- unleft->setGeometry( left->geometry() );
- unright->setGeometry( right->geometry() );
- }
- if ( s->isCompressed( s->widgetBefore( id() ) ) ) {
- left->hide();
- unleft->show();
- right->setEnabled(false);
- }
- else {
- unleft->hide();
- left->show();
- right->setEnabled(true);
- }
- if ( s->isCompressed( s->widgetAfter( id() ) ) ) {
- right->hide();
- unright->show();
- left->setEnabled(false);
- }
- else {
- unright->hide();
- right->show();
- left->setEnabled(true);
- }
- }
-}
-
-class QSplitterPLayoutStruct
-{
-public:
- QSplitterP::ResizeMode mode;
- QCOORD sizer;
- bool isSplitter;
- QWidget *wid;
-};
-
-class QSplitterPData
-{
-public:
- QSplitterPData() : opaque( FALSE ), firstShow( TRUE ) {}
-
- QList<QSplitterPLayoutStruct> list;
- bool opaque;
- bool firstShow;
-};
-
-
-// NOT REVISED
-/*!
- \class QSplitter qsplitter.h
- \brief The QSplitter class implements a splitter widget.
-
- \ingroup organizers
-
- A splitter lets the user control the size of child widgets by
- dragging the boundary between the children. Any number of widgets
- may be controlled.
-
- To show a QListBox, a QListView and a QMultiLineEdit side by side:
-
- \code
- QSplitter *split = new QSplitter( parent );
- QListBox *lb = new QListBox( split );
- QListView *lv = new QListView( split );
- QMultiLineEdit *ed = new QMultiLineEdit( split );
- \endcode
-
- In QSplitter the boundary can be either horizontal or vertical. The
- default is horizontal (the children are side by side) and you
- can use setOrientation( QSplitter::Vertical ) to set it to vertical.
-
- By default, all widgets can be as large or as small as the user
- wishes, down to \link QWidget::minimumSizeHint() minimumSizeHint()\endlink.
- You can naturally use setMinimumSize() and/or
- setMaximumSize() on the children. Use setResizeMode() to specify that
- a widget should keep its size when the splitter is resized.
-
- QSplitter normally resizes the children only at the end of a
- resize operation, but if you call setOpaqueResize( TRUE ), the
- widgets are resized as often as possible.
-
- The initial distribution of size between the widgets is determined
- by the initial size of each widget. You can also use setSizes() to
- set the sizes of all the widgets. The function sizes() returns the
- sizes set by the user.
-
- If you hide() a child, its space will be distributed among the other
- children. When you show() it again, it will be reinstated.
-
- <img src=qsplitter-m.png> <img src=qsplitter-w.png>
-
- \sa QTabBar
-*/
-
-
-
-QSize QSplitterP::minSize( const QWidget *w ) const
-{
- if ( isCompressed(w) && (data->list.count() > 1 ) ) return QSize(0,0);
- QSize min = w->minimumSize();
- QSize s;
- if ( min.height() <= 0 || min.width() <= 0 )
- s = w->minimumSizeHint();
- if ( min.height() > 0 )
- s.setHeight( min.height() );
- if ( min.width() > 0 )
- s.setWidth( min.width() );
- return s.expandedTo(QSize(0,0));
-}
-
-QSize QSplitterP::maxSize( const QWidget* w ) const
-{
- if ( isCompressed(w) && (data->list.count() > 1 ) ) return QSize(0,0);
- else return w->maximumSize();
-}
-
-/*!
- Constructs a horizontal splitter.
-*/
-
-QSplitterP::QSplitterP( QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
-{
- orient = Horizontal;
- init();
-}
-
-
-/*!
- Constructs splitter with orientation \a o.
-*/
-
-QSplitterP::QSplitterP( Orientation o, QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
-{
- orient = o;
- init();
-}
-
-
-/*!
- Destructs the splitter.
-*/
-
-QSplitterP::~QSplitterP()
-{
- data->list.setAutoDelete( TRUE );
- delete data;
-}
-
-
-void QSplitterP::init()
-{
- data = new QSplitterPData;
- if ( orient == Horizontal )
- setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum) );
- else
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed) );
- compressed_widgets.clear();
- compress_flag = false;
-}
-
-
-/*!
- \fn void QSplitter::refresh()
-
- Updates the splitter state. You should not need to call this
- function during normal use of the splitter.
-*/
-
-
-/*! Sets the orientation to \a o. By default the orientation is
- horizontal (the widgets are side by side).
-
- \sa orientation()
-*/
-
-void QSplitterP::setOrientation( Orientation o )
-{
- if ( orient == o )
- return;
- orient = o;
-
- if ( orient == Horizontal )
- setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ) );
- else
- setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
-
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->isSplitter )
- ((QSplitterPHandle*)s->wid)->setOrientation( o );
- s = data->list.next(); // ### next at end of loop, no iterator
- }
- recalc( isVisible() );
-}
-
-
-/*!
- \fn Orientation QSplitter::orientation() const
-
- Returns the orientation (\c Horizontal or \c Vertical) of the splitter.
- \sa setOrientation()
-*/
-
-/*!
- \reimp
-*/
-void QSplitterP::resizeEvent( QResizeEvent * )
-{
- doResize();
-}
-
-
-/*!
- Inserts the widget \a w at the end, or at the beginning if \a first is TRUE
-
- It is the responsibility of the caller of this function to make sure
- that \a w is not already in the splitter, and to call recalcId if
- needed. (If \a first is TRUE, then recalcId is very probably
- needed.)
-*/
-
-QSplitterPLayoutStruct *QSplitterP::addWidget( QWidget *w, bool first )
-{
- QSplitterPLayoutStruct *s;
- QSplitterPHandle *newHandle = 0;
- if ( data->list.count() > 0 ) {
- s = new QSplitterPLayoutStruct;
- s->mode = KeepSize;
- newHandle = new QSplitterPHandle( orientation(), this );
- s->wid = newHandle;
- newHandle->setId(data->list.count());
- s->isSplitter = TRUE;
- s->sizer = pick( newHandle->sizeHint() );
- if ( first )
- data->list.insert( 0, s );
- else
- data->list.append( s );
- }
- s = new QSplitterPLayoutStruct;
- s->mode = Stretch;
- s->wid = w;
- if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
- s->sizer = pick( w->sizeHint() );
- else
- s->sizer = pick( w->size() );
- s->isSplitter = FALSE;
- if ( first )
- data->list.insert( 0, s );
- else
- data->list.append( s );
- if ( newHandle && isVisible() )
- newHandle->show(); //will trigger sending of post events
- return s;
-}
-
-
-/*!
- Tells the splitter that a child widget has been inserted/removed.
-*/
-
-void QSplitterP::childEvent( QChildEvent *c )
-{
- if ( c->type() == QEvent::ChildInserted ) {
- if ( !c->child()->isWidgetType() )
- return;
-
- if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
- return;
-
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->wid == c->child() )
- return;
- s = data->list.next();
- }
- addWidget( (QWidget*)c->child() );
- recalc( isVisible() );
-
- } else if ( c->type() == QEvent::ChildRemoved ) {
- QSplitterPLayoutStruct *p = 0;
- if ( data->list.count() > 1 )
- p = data->list.at(1); //remove handle _after_ first widget.
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->wid == c->child() ) {
- data->list.removeRef( s );
- delete s;
- if ( p && p->isSplitter ) {
- data->list.removeRef( p );
- delete p->wid; //will call childEvent
- delete p;
- }
- recalcId();
- doResize();
- return;
- }
- p = s;
- s = data->list.next();
- }
- }
-}
-
-
-/*!
- Shows a rubber band at position \a p. If \a p is negative, the
- rubber band is removed.
-*/
-
-void QSplitterP::setRubberband( int p )
-{
- QPainter paint( this );
- paint.setPen( gray );
- paint.setBrush( gray );
- paint.setRasterOp( XorROP );
- QRect r = contentsRect();
- const int rBord = 3; //Themable????
-#if QT_VERSION < 300
- const int sw = style().splitterWidth();
-#else
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); //qt3.x
-#endif
- if ( orient == Horizontal ) {
- if ( opaqueOldPos >= 0 )
- paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
- 2*rBord, r.height() );
- if ( p >= 0 )
- paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
- } else {
- if ( opaqueOldPos >= 0 )
- paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
- r.width(), 2*rBord );
- if ( p >= 0 )
- paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
- }
- opaqueOldPos = p;
-}
-
-
-/*! \reimp */
-
-bool QSplitterP::event( QEvent *e )
-{
- if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) {
- recalc( isVisible() );
- if ( e->type() == QEvent::Show )
- data->firstShow = FALSE;
- }
- return QWidget::event( e );
-}
-
-
-/*!
- Draws the splitter handle in the rectangle described by \a x, \a y,
- \a w, \a h using painter \a p.
- \sa QStyle::drawSplitter
-*/
-
-void QSplitterP::drawSplitter( QPainter *p,
- QCOORD x, QCOORD y, QCOORD w, QCOORD h )
-{
-#if QT_VERSION < 300
- style().drawSplitter( p, x, y, w, h, colorGroup(), orient );
-#else
- style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
- (orientation() == Qt::Horizontal ?
- QStyle::Style_Horizontal : 0));
-#endif
-}
-
-
-/*!
- Returns the id of the splitter to the right of or below the widget \a w,
- or 0 if there is no such splitter.
- (ie. it is either not in this QSplitter, or it is at the end).
-*/
-
-int QSplitterP::idAfter( QWidget* w ) const
-{
- QSplitterPLayoutStruct *s = data->list.first();
- bool seen_w = FALSE;
- while ( s ) {
- if ( s->isSplitter && seen_w )
- return data->list.at();
- if ( !s->isSplitter && s->wid == w )
- seen_w = TRUE;
- s = data->list.next();
- }
- return 0;
-}
-
-// VSR 21/11/02 -> ================================
-QSplitterPHandle* QSplitterP::getHandleAfter(QWidget* w)
-{
- QSplitterPLayoutStruct *s = data->list.first();
- bool seen_w = FALSE;
- while ( s ) {
- if ( s->isSplitter && seen_w )
- return (QSplitterPHandle*)s->wid;
- if ( !s->isSplitter && s->wid == w )
- seen_w = TRUE;
- s = data->list.next();
- }
- return 0;
-}
-
-QSplitterPHandle* QSplitterP::getHandleBefore(QWidget* w)
-{
- QSplitterPLayoutStruct *s = data->list.first();
- QSplitterPHandle* h = 0;
- while ( s ) {
- if ( s->isSplitter )
- h = (QSplitterPHandle*)s;
- if ( !s->isSplitter && s->wid == w )
- return h;
- s = data->list.next();
- }
- return 0;
-}
-// VSR 21/11/02 <- ================================
-
-QWidget* QSplitterP::widgetBefore( int id ) const
-{
- QSplitterPLayoutStruct *s = data->list.first();
- QWidget* w;
- while ( s ) {
- if ( !s->isSplitter ) {
- w = s->wid;
- if (idAfter(w) == id) return w;
- }
- s = data->list.next();
- }
- return 0;
-}
-
-QWidget* QSplitterP::widgetAfter( int id ) const
-{
- QSplitterPLayoutStruct *s = data->list.first();
- bool seen_s = FALSE;
- while ( s ) {
- if ( !s->isSplitter && seen_s )
- return s->wid;
- if ( s->isSplitter && data->list.at() == id )
- seen_s = TRUE;
- s = data->list.next();
- }
- return 0;
-}
-
-void QSplitterP::unCompress(QWidget* w) {
- compressed_widgets.remove(w);
-}
-
-void QSplitterP::compress(QWidget* w)
-{
- if (!isCompressed(w)) compressed_widgets.append(w);
-}
-
-bool QSplitterP::isCompressed(const QWidget* w) const {
- QWidget* t = (QWidget*)w;
- if (compressed_widgets.containsRef(t)==0) return false;
- else return true;
-}
-
-/*!
- Moves the left/top edge of the splitter handle with id \a id as
- close as possible to \a p which is the distance from the left (or
- top) edge of the widget.
-
- \sa idAfter()
-*/
-void QSplitterP::moveSplitter( QCOORD p, int id )
-{
- p = adjustPos( p, id );
-
- QSplitterPLayoutStruct *s = data->list.at(id);
- int oldP = orient == Horizontal? s->wid->x() : s->wid->y();
- bool upLeft = p < oldP;
-
- moveAfter( p, id, upLeft );
- moveBefore( p-1, id-1, upLeft );
-
- storeSizes();
-}
-
-
-void QSplitterP::setG( QWidget *w, int p, int s )
-{
- if ( orient == Horizontal )
- w->setGeometry( p, contentsRect().y(), s, contentsRect().height() );
- else
- w->setGeometry( contentsRect().x(), p, contentsRect().width(), s );
-}
-
-
-/*!
- Places the right/bottom edge of the widget at \a id at position \a pos.
-
- \sa idAfter()
-*/
-
-void QSplitterP::moveBefore( int pos, int id, bool upLeft )
-{
- QSplitterPLayoutStruct *s = data->list.at(id);
- if ( !s )
- return;
- QWidget *w = s->wid;
- if ( w->isHidden() ) {
- moveBefore( pos, id-1, upLeft );
- } else if ( s->isSplitter ) {
- int dd = s->sizer;
- if ( upLeft ) {
- setG( w, pos-dd+1, dd );
- moveBefore( pos-dd, id-1, upLeft );
- } else {
- moveBefore( pos-dd, id-1, upLeft );
- setG( w, pos-dd+1, dd );
- }
- } else {
- int left = pick( w->pos() );
- int dd = pos - left + 1;
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(maxSize(w))));
- int newLeft = pos-dd+1;
- setG( w, newLeft, dd );
- if ( left != newLeft )
- moveBefore( newLeft-1, id-1, upLeft );
- }
-}
-
-
-/*!
- Places the left/top edge of the widget at \a id at position \a pos.
-
- \sa idAfter()
-*/
-
-void QSplitterP::moveAfter( int pos, int id, bool upLeft )
-{
- QSplitterPLayoutStruct *s = id < int(data->list.count()) ?
- data->list.at(id) : 0;
- if ( !s )
- return;
- QWidget *w = s->wid;
- if ( w->isHidden() ) {
- moveAfter( pos, id+1, upLeft );
- } else if ( pick( w->pos() ) == pos ) {
- //No need to do anything if it's already there.
- return;
- } else if ( s->isSplitter ) {
- int dd = s->sizer;
- if ( upLeft ) {
- setG( w, pos, dd );
- moveAfter( pos+dd, id+1, upLeft );
- } else {
- moveAfter( pos+dd, id+1, upLeft );
- setG( w, pos, dd );
- }
- } else {
- int right = pick( w->geometry().bottomRight() );
- int ddd = pick( QSize(contentsRect().width(), contentsRect().height() ) ) - pos;
- int dd = QMIN(right - pos + 1, ddd);
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(maxSize(w))));
- int newRight = pos+dd-1;
- setG( w, pos, dd );
- moveAfter( newRight+1, id+1, upLeft );
- }
-}
-
-
-/*!
- Returns the valid range of the splitter with id \a id in \a min and \a max.
-
- \sa idAfter()
-*/
-
-void QSplitterP::getRange( int id, int *min, int *max )
-{
- int minB = 0; //before
- int maxB = 0;
- int minA = 0;
- int maxA = 0; //after
- int n = data->list.count();
- if ( id < 0 || id >= n )
- return;
- int i;
- for ( i = 0; i < id; i++ ) {
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( s->isSplitter ) {
- minB += s->sizer;
- maxB += s->sizer;
- } else {
- minB += pick( minSize(s->wid) );
- maxB += pick( maxSize(s->wid) );
- }
- }
- for ( i = id; i < n; i++ ) {
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( s->isSplitter ) {
- minA += s->sizer;
- maxA += s->sizer;
- } else {
- minA += pick( minSize(s->wid) );
- maxA += pick( maxSize(s->wid) );
- }
- }
- QRect r = contentsRect();
- if ( min )
- *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA );
- if ( max )
- *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA );
-
-}
-
-
-/*!
- Returns the legal position closest to \a p of the splitter with id \a id.
-
- \sa idAfter()
-*/
-
-int QSplitterP::adjustPos( int p, int id )
-{
- int min = 0;
- int max = 0;
- getRange( id, &min, &max );
- p = QMAX( min, QMIN( p, max ) );
-
- return p;
-}
-
-
-void QSplitterP::doResize()
-{
- QRect r = contentsRect();
- int i;
- int n = data->list.count();
- QArray<QLayoutStruct> a( n );
- for ( i = 0; i< n; i++ ) {
- a[i].init();
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( s->wid->isHidden() ) {
- a[i].stretch = 0;
- a[i].sizeHint = a[i].minimumSize = 0;
- a[i].maximumSize = 0;
- } else if ( s->isSplitter ) {
- a[i].stretch = 0;
- a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer;
- a[i].empty = FALSE;
- } else if ( s->mode == KeepSize ) {
- a[i].stretch = 0;
- a[i].minimumSize = pick( minSize(s->wid) );
- a[i].sizeHint = s->sizer;
- a[i].maximumSize = pick( maxSize(s->wid) );
- a[i].empty = FALSE;
- } else if ( s->mode == FollowSizeHint ) {
- a[i].stretch = 0;
- a[i].minimumSize = a[i].sizeHint = pick( s->wid->sizeHint() );
- a[i].maximumSize = pick( maxSize(s->wid) );
- a[i].empty = FALSE;
- } else { //proportional
- a[i].stretch = s->sizer;
- a[i].maximumSize = pick( maxSize(s->wid) );
- a[i].sizeHint = a[i].minimumSize = pick( minSize(s->wid) );
- a[i].empty = FALSE;
- }
- }
-
- qGeomCalc( a, 0, n, pick( r.topLeft() ), pick( r.size() ), 0 );
- for ( i = 0; i< n; i++ ) {
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( orient == Horizontal )
- s->wid->setGeometry( a[i].pos, r.top(), a[i].size, r.height() );
- else
- s->wid->setGeometry( r.left(), a[i].pos, r.width(), a[i].size );
- }
-
-}
-
-
-void QSplitterP::recalc( bool update )
-{
- int fi = 2*frameWidth();
- int maxl = fi;
- int minl = fi;
- int maxt = QWIDGETSIZE_MAX;
- int mint = fi;
- int n = data->list.count();
- bool first = TRUE;
- /*
- The splitter before a hidden widget is always hidden.
- The splitter before the first visible widget is hidden.
- The splitter before any other visible widget is visible.
- */
- for ( int i = 0; i< n; i++ ) {
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( !s->isSplitter ) {
- QSplitterPLayoutStruct *p = (i > 0) ? p = data->list.at( i-1 ) : 0;
- if ( p && p->isSplitter )
- if ( first || s->wid->isHidden() )
- p->wid->hide(); //may trigger new recalc
- else
- p->wid->show(); //may trigger new recalc
- if ( !s->wid->isHidden() )
- first = FALSE;
- }
- }
-
- bool empty=TRUE;
- for ( int j = 0; j< n; j++ ) {
- QSplitterPLayoutStruct *s = data->list.at(j);
- if ( !s->wid->isHidden() ) {
- empty = FALSE;
- if ( s->isSplitter ) {
- minl += s->sizer;
- maxl += s->sizer;
- } else {
- QSize minS = minSize(s->wid);
- minl += pick( minS );
- maxl += pick( maxSize(s->wid) );
- mint = QMAX( mint, trans( minS ));
- int tm = trans( maxSize(s->wid) );
- if ( tm > 0 )
- maxt = QMIN( maxt, tm );
- }
- }
- }
- if ( empty )
- maxl = maxt = 0;
- else
- maxl = QMIN( maxl, QWIDGETSIZE_MAX );
- if ( maxt < mint )
- maxt = mint;
-
- if ( orient == Horizontal ) {
- setMaximumSize( maxl, maxt );
- setMinimumSize( minl, mint );
- } else {
- setMaximumSize( maxt, maxl );
- setMinimumSize( mint, minl );
- }
- if ( update )
- doResize();
-}
-
-/*! \enum QSplitter::ResizeMode
-
- This enum type describes how QSplitter will resize each of its child widgets. The currently defined values are: <ul>
-
- <li> \c Stretch - the widget will be resized when the splitter
- itself is resized.
-
- <li> \c KeepSize - QSplitter will try to keep this widget's size
- unchanged.
-
- <li> \c FollowSizeHint - QSplitter will resize the widget when its
- size hint changes.
-
- </ul>
-
-*/
-
-/*!
- Sets resize mode of \a w to \a mode.
-
- \sa ResizeMode
-*/
-
-void QSplitterP::setResizeMode( QWidget *w, ResizeMode mode )
-{
- processChildEvents();
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->wid == w ) {
- s->mode = mode;
- return;
- }
- s = data->list.next();
- }
- s = addWidget( w, TRUE );
- s->mode = mode;
-}
-
-
-/*!
- Returns TRUE if opaque resize is on, FALSE otherwise.
-
- \sa setOpaqueResize()
-*/
-
-bool QSplitterP::opaqueResize() const
-{
- return data->opaque;
-}
-
-
-/*!
- Sets opaque resize to \a on. Opaque resize is initially turned off.
-
- \sa opaqueResize()
-*/
-
-void QSplitterP::setOpaqueResize( bool on )
-{
- data->opaque = on;
-}
-
-
-/*!
- Moves \a w to the leftmost/top position.
-*/
-
-void QSplitterP::moveToFirst( QWidget *w )
-{
- processChildEvents();
- bool found = FALSE;
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->wid == w ) {
- found = TRUE;
- QSplitterPLayoutStruct *p = data->list.prev();
- if ( p ) { // not already at first place
- data->list.take(); //take p
- data->list.take(); // take s
- data->list.insert( 0, p );
- data->list.insert( 0, s );
- }
- break;
- }
- s = data->list.next();
- }
- if ( !found )
- addWidget( w, TRUE );
- recalcId();
-}
-
-
-/*!
- Moves \a w to the rightmost/bottom position.
-*/
-
-void QSplitterP::moveToLast( QWidget *w )
-{
- processChildEvents();
- bool found = FALSE;
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->wid == w ) {
- found = TRUE;
- data->list.take(); // take s
- QSplitterPLayoutStruct *p = data->list.current();
- if ( p ) { // the splitter handle after s
- data->list.take(); //take p
- data->list.append( p );
- }
- data->list.append( s );
- break;
- }
- s = data->list.next();
- }
- if ( !found )
- addWidget( w);
- recalcId();
-}
-
-
-void QSplitterP::recalcId()
-{
- int n = data->list.count();
- for ( int i = 0; i < n; i++ ) {
- QSplitterPLayoutStruct *s = data->list.at(i);
- if ( s->isSplitter )
- ((QSplitterPHandle*)s->wid)->setId(i);
- }
-}
-
-
-/*!\reimp
-*/
-QSize QSplitterP::sizeHint() const
-{
- constPolish();
- int l = 0;
- int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
- if ( o->isWidgetType() &&
- !((QWidget*)o)->isHidden() ) {
- QSize s = ((QWidget*)o)->sizeHint();
- if ( s.isValid() ) {
- l += pick( s );
- t = QMAX( t, trans( s ) );
- }
- }
- }
- }
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
-}
-
-
-/*!
-\reimp
-*/
-
-QSize QSplitterP::minimumSizeHint() const
-{
- constPolish();
- int l = 0;
- int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
- if ( o->isWidgetType() &&
- !((QWidget*)o)->isHidden() ) {
- QSize s = minSize((QWidget*)o);
- if ( s.isValid() ) {
- l += pick( s );
- t = QMAX( t, trans( s ) );
- }
- }
- }
- }
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
-}
-
-
-
-/*!\reimp
-*/
-QSizePolicy QSplitterP::sizePolicy() const
-{
- return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
-}
-
-
-/*!
- Calculates stretch parameters from current sizes
-*/
-
-void QSplitterP::storeSizes()
-{
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( !s->isSplitter )
- s->sizer = pick( s->wid->size() );
- s = data->list.next();
- }
-}
-
-
-#if 0 // ### remove this code ASAP
-
-/*!
- Hides \a w if \a hide is TRUE, and updates the splitter.
-
- \warning Due to a limitation in the current implementation,
- calling QWidget::hide() will not work.
-*/
-
-void QSplitterP::setHidden( QWidget *w, bool hide )
-{
- if ( w == w1 ) {
- w1show = !hide;
- } else if ( w == w2 ) {
- w2show = !hide;
- } else {
-#ifdef CHECK_RANGE
- qWarning( "QSplitterP::setHidden(), unknown widget" );
-#endif
- return;
- }
- if ( hide )
- w->hide();
- else
- w->show();
- recalc( TRUE );
-}
-
-
-/*!
- Returns the hidden status of \a w
-*/
-
-bool QSplitterP::isHidden( QWidget *w ) const
-{
- if ( w == w1 )
- return !w1show;
- else if ( w == w2 )
- return !w2show;
-#ifdef CHECK_RANGE
- else
- qWarning( "QSplitterP::isHidden(), unknown widget" );
-#endif
- return FALSE;
-}
-#endif
-
-
-/*!
- Returns a list of the size parameters of all the widgets in this
- splitter.
-
- Giving the values to setSizes() will give a splitter with the same
- layout as this one.
-*/
-
-QValueList<int> QSplitterP::sizes() const
-{
- if ( !testWState(WState_Polished) ) {
- QWidget* that = (QWidget*) this;
- that->polish();
- }
- QValueList<int> list;
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( !s->isSplitter )
- list.append( s->sizer );
- s = data->list.next();
- }
- return list;
-}
-
-
-
-/*!
- Sets the size parameters to the values given in \a list.
- If the splitterP is horizontal, the values set the sizes from
- left to right. If it is vertical, the sizes are applied from
- top to bottom.
- Extra values in \a list are ignored.
-
- If \a list contains too few values, the result is undefined
- but the program will still be well-behaved.
-*/
-
-void QSplitterP::setSizes( QValueList<int> list )
-{
- processChildEvents();
- QValueList<int>::Iterator it = list.begin();
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s && it != list.end() ) {
- if ( !s->isSplitter ) {
- s->sizer = *it;
- ++it;
- }
- s = data->list.next();
- }
- doResize();
-}
-
-
-/*!
- Gets all posted child events, ensuring that the internal state of
- the splitter is consistent with the programmer's idea.
-*/
-
-void QSplitterP::processChildEvents()
-{
- QApplication::sendPostedEvents( this, QEvent::ChildInserted );
-}
-
-
-/*!
- \reimp
-*/
-
-void QSplitterP::styleChange( QStyle& old )
-{
-#if QT_VERSION < 300
- int sw = style().splitterWidth();
-#else
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); //qt3.x
-#endif
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->isSplitter )
- s->sizer = sw;
- s = data->list.next();
- }
- doResize();
- QFrame::styleChange( old );
-}
-#endif
-
-bool QSplitterP::isCompressEnabled() const
-{
- return compress_flag;
-}
-
-void QSplitterP::setCompressEnabled(bool on) {
- compress_flag = on;
-}
-
-void QSplitterP::updateSplitterHandles() const {
- QSplitterPLayoutStruct *s = data->list.first();
- while ( s ) {
- if ( s->isSplitter )
- ((QSplitterPHandle*)s->wid)->updateButtonState();
- s = data->list.next();
- }
-}
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qsplitterP.h
-// Description : the patch for Qt's QSplitter class (qsplitter.h)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Defintion of QSplitter class
-**
-** Created: 980105
-**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the widgets module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-#ifndef QSPLITTERP_H
-#define QSPLITTERP_H
-
-#ifndef QT_H
-#include <qframe.h>
-#include <qvaluelist.h>
-#include <qwidgetlist.h> // by STV
-#endif // QT_H
-#include <qpushbutton.h>
-
-#ifndef QT_NO_COMPLEXWIDGETS
-
-class QSplitterPHandle;
-class QSplitterPData;
-class QSplitterPLayoutStruct;
-
-class Q_EXPORT QSplitterP : public QFrame
-{
- Q_OBJECT
- Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
-
-public:
- enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
-
- QSplitterP( QWidget *parent=0, const char *name=0 );
- QSplitterP( Orientation, QWidget *parent=0, const char *name=0 );
- ~QSplitterP();
-
- virtual void setOrientation( Orientation );
- Orientation orientation() const { return orient; }
-
- virtual void setResizeMode( QWidget *w, ResizeMode );
- virtual void setOpaqueResize( bool = TRUE );
- bool opaqueResize() const;
-
- void moveToFirst( QWidget * );
- void moveToLast( QWidget * );
-
- void refresh() { recalc( TRUE ); }
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
- QSizePolicy sizePolicy() const;
-
- QValueList<int> sizes() const;
- void setSizes( QValueList<int> );
- bool isCompressEnabled() const;
- void setCompressEnabled(bool on);
-
- void compress(QWidget*);
- void unCompress(QWidget*);
-
-// VSR 21/11/02 -> ================================
- QSplitterPHandle* getHandleAfter(QWidget* w);
- QSplitterPHandle* getHandleBefore(QWidget* w);
-// VSR 21/11/02 <- ================================
-
-// ASL 07/09/04
- bool isCompressed( const QWidget* ) const;
-// ASL 07/09/04
-
-protected:
- void childEvent( QChildEvent * );
-
- bool event( QEvent * );
- void resizeEvent( QResizeEvent * );
-
- int idAfter( QWidget* ) const;
- QWidget* widgetBefore( int id ) const;
- QWidget* widgetAfter( int id ) const;
-
- QSize minSize( const QWidget *w ) const;
- QSize maxSize( const QWidget *w ) const;
-
- void moveSplitter( QCOORD pos, int id );
- virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
- QCOORD w, QCOORD h );
- void styleChange( QStyle& );
- int adjustPos( int , int );
- virtual void setRubberband( int );
- void getRange( int id, int*, int* );
-
-private:
- void init();
- void recalc( bool update = FALSE );
- int hit( QPoint p );
- void doResize();
- void storeSizes();
- void processChildEvents();
- QSplitterPLayoutStruct *addWidget( QWidget*, bool first = FALSE );
- void recalcId();
- void moveBefore( int pos, int id, bool upLeft );
- void moveAfter( int pos, int id, bool upLeft );
- void setG( QWidget *w, int p, int s );
- void updateSplitterHandles() const;
-
- QCOORD pick( const QPoint &p ) const
- { return orient == Horizontal ? p.x() : p.y(); }
- QCOORD pick( const QSize &s ) const
- { return orient == Horizontal ? s.width() : s.height(); }
-
- QCOORD trans( const QPoint &p ) const
- { return orient == Vertical ? p.x() : p.y(); }
- QCOORD trans( const QSize &s ) const
- { return orient == Vertical ? s.width() : s.height(); }
-
- QSplitterPData *data;
- QWidgetList compressed_widgets;
-
- Orientation orient;
- bool compress_flag;
- friend class QSplitterPHandle;
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QSplitterP( const QSplitterP & );
- QSplitterP& operator=( const QSplitterP & );
-#endif
-};
-
-#endif // QT_NO_COMPLEXWIDGETS
-
-
-class Q_EXPORT QSplitterPHandle : public QWidget
-{
- Q_OBJECT
-public:
- QSplitterPHandle( Qt::Orientation o,
- QSplitterP *parent, const char* name=0 );
- void setOrientation( Qt::Orientation o );
- Qt::Orientation orientation() const { return orient; }
-
- bool opaque() const { return s->opaqueResize(); }
-
- QSize sizeHint() const;
- QSizePolicy sizePolicy() const;
-
- int id() const { return myId; } // data->list.at(id())->wid == this
- void setId( int i ) { myId = i; }
- void updateButtonState();
-
-// VSR 21/11/02 -> ================================
- void compressAfter();
- void unCompressAfter();
- void compressBefore();
- void unCompressBefore();
-// VSR 21/11/02 <- ================================
-
-protected:
- void paintEvent( QPaintEvent * );
- void mouseMoveEvent( QMouseEvent * );
- void mousePressEvent( QMouseEvent * );
- void mouseReleaseEvent( QMouseEvent * );
-
-protected slots:
- void onBeforeCompress();
- void onAfterCompress();
- void onBeforeUnCompress();
- void onAfterUnCompress();
-
-private:
- Qt::Orientation orient;
- bool opaq;
- int myId;
-
- QSplitterP *s;
- int oldpos;
- QPushButton* left;
- QPushButton* right;
- QPushButton* unleft;
- QPushButton* unright;
-};
-
-
-#endif // QSPLITTERP_H
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qworkspaceP.cxx
-// Description : the patch for Qt's QWorkspace class (qworkspace.cpp)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Implementation of the QWorkspace class
-**
-** Created : 931107
-**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the workspace module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition licenses may use this
-** file in accordance with the Qt Commercial License Agreement provided
-** with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#include "qworkspaceP.h"
-
-#include <qapplication.h>
-#include <qobjectlist.h>
-#include <qlayout.h>
-#include <qtoolbutton.h>
-#include <qlabel.h>
-#include <qvbox.h>
-#include <qaccel.h>
-#include <qcursor.h>
-#include <qpopupmenu.h>
-#include <qmenubar.h>
-#include <qguardedptr.h>
-#include <qiconset.h>
-#include <qfocusdata.h>
-#include <qdatetime.h>
-#include <qtooltip.h>
-#include <qwmatrix.h>
-#include <qimage.h>
-#include <qscrollbar.h>
-#include <qstyle.h>
-#include <qframe.h>
-#if defined(Q_WS_WIN)
-#include <qt_windows.h>
-#endif
-#include <qplatformdefs.h>
-#include <qtimer.h>
-#include <qpainter.h>
-
-#include <private/qapplication_p.h>
-#include <private/qinternal_p.h>
-using namespace std;
-
-#define BUTTON_WIDTH 16
-#define BUTTON_HEIGHT 14
-
-
-/*!
- \class QWorkspaceP qworkspace.h
- \brief The QWorkspaceP widget provides a workspace window that can
- contain decorated windows, e.g. for MDI.
-
- \module workspace
-
- \ingroup application
- \ingroup organizers
- \mainclass
-
- An MDI (multiple document interface) application has one main
- window with a menu bar. The central widget of this window is a
- workspace. The workspace itself contains zero, one or more
- document windows, each of which displays a document.
-
- The workspace itself is an ordinary Qt widget. It has a standard
- constructor that takes a parent widget and an object name. The
- parent window is usually a QMainWindow, but it need not be.
-
- Document windows (i.e. MDI windows) are also ordinary Qt widgets
- which have the workspace as parent widget. When you call show(),
- hide(), showMaximized(), setCaption(), etc. on a document window,
- it is shown, hidden, etc. with a frame, caption, icon and icon
- text, just as you'd expect. You can provide widget flags which
- will be used for the layout of the decoration or the behaviour of
- the widget itself.
-
- To change the geometry of the MDI windows it is necessary to make
- the function calls to the parentWidget() of the widget, as this
- will move or resize the decorated window.
-
- A document window becomes active when it gets the keyboard focus.
- You can activate it using setFocus(), and the user can activate it
- by moving focus in the normal ways. The workspace emits a signal
- windowActivated() when it detects the activation change, and the
- function activeWindow() always returns a pointer to the active
- document window.
-
- The convenience function windowList() returns a list of all
- document windows. This is useful to create a popup menu
- "<u>W</u>indows" on the fly, for example.
-
- QWorkspaceP provides two built-in layout strategies for child
- windows: cascade() and tile(). Both are slots so you can easily
- connect menu entries to them.
-
- If you want your users to be able to work with document windows
- larger than the actual workspace, set the scrollBarsEnabled
- property to TRUE.
-
- If the top-level window contains a menu bar and a document window
- is maximised, QWorkspaceP moves the document window's minimize,
- restore and close buttons from the document window's frame to the
- workspace window's menu bar. It then inserts a window operations
- menu at the far left of the menu bar.
-*/
-
-static bool inCaptionChange = FALSE;
-
-class QWorkspacePPrivate {
-public:
- QWorkspacePChild* active;
- QPtrList<QWorkspacePChild> windows;
- QPtrList<QWorkspacePChild> focus;
- QPtrList<QWidget> icons;
- QWorkspacePChild* maxWindow;
- QRect maxRestore;
- QGuardedPtr<QFrame> maxcontrols;
- QGuardedPtr<QMenuBar> maxmenubar;
-
- int px;
- int py;
- QWidget *becomeActive;
- QGuardedPtr<QLabel> maxtools;
- QPopupMenu* popup;
- QPopupMenu* toolPopup;
- int menuId;
- int controlId;
- QString topCaption;
- bool autoFocusChange;
-
- QScrollBar *vbar, *hbar;
- QWidget *corner;
- int yoffset, xoffset;
-};
-
-/*!
- Constructs a workspace with a \a parent and a \a name.
- */
-QWorkspaceP::QWorkspaceP( QWidget *parent, const char *name )
- : QWidget( parent, name, WNoMousePropagation )
-{
- d = new QWorkspacePPrivate;
- d->maxcontrols = 0;
- d->active = 0;
- d->maxWindow = 0;
- d->maxtools = 0;
- d->px = 0;
- d->py = 0;
- d->becomeActive = 0;
- d->autoFocusChange = FALSE;
-#if defined(Q_WS_WIN)
- d->popup = new QPopupMenu( this, "qt_internal_mdi_popup" );
- d->toolPopup = new QPopupMenu( this, "qt_internal_mdi_popup" );
-#else
- d->popup = new QPopupMenu( parentWidget(), "qt_internal_mdi_popup" );
- d->toolPopup = new QPopupMenu( parentWidget(), "qt_internal_mdi_popup" );
-#endif
-
- d->menuId = -1;
- d->controlId = -1;
- connect( d->popup, SIGNAL( aboutToShow() ), this, SLOT(operationMenuAboutToShow() ));
- connect( d->popup, SIGNAL( activated(int) ), this, SLOT( operationMenuActivated(int) ) );
- d->popup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarNormalButton)), tr("&Restore"), 1);
- d->popup->insertItem(tr("&Move"), 2);
- d->popup->insertItem(tr("&Size"), 3);
- d->popup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarMinButton)), tr("Mi&nimize"), 4);
- d->popup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarMaxButton)), tr("Ma&ximize"), 5);
- d->popup->insertSeparator();
- d->popup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarCloseButton)),
- tr("&Close")
-#ifndef QT_NO_ACCEL
- +"\t"+QAccel::keyToString(CTRL+Key_F4)
-#endif
- , this, SLOT( closeActiveWindow() ) );
-
- connect( d->toolPopup, SIGNAL( aboutToShow() ), this, SLOT(toolMenuAboutToShow() ));
- connect( d->toolPopup, SIGNAL( activated(int) ), this, SLOT( operationMenuActivated(int) ) );
- d->toolPopup->insertItem(tr("&Move"), 2);
- d->toolPopup->insertItem(tr("&Size"), 3);
- d->toolPopup->insertItem(tr("Stay on &Top"), 7);
- d->toolPopup->setItemChecked( 7, TRUE );
- d->toolPopup->setCheckable( TRUE );
- d->toolPopup->insertSeparator();
- d->toolPopup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarShadeButton)), tr("Sh&ade"), 6);
- d->toolPopup->insertItem(QIconSet(style().stylePixmap(QStyle::SP_TitleBarCloseButton)),
- tr("&Close")
-#ifndef QT_NO_ACCEL
- +"\t"+QAccel::keyToString( CTRL+Key_F4)
-#endif
- , this, SLOT( closeActiveWindow() ) );
-
-#ifndef QT_NO_ACCEL
- QAccel* a = new QAccel( this );
- a->connectItem( a->insertItem( ALT + Key_Minus),
- this, SLOT( showOperationMenu() ) );
-
- a->connectItem( a->insertItem( CTRL + Key_F6),
- this, SLOT( activateNextWindow() ) );
- a->connectItem( a->insertItem( CTRL + Key_Tab),
- this, SLOT( activateNextWindow() ) );
-
- a->connectItem( a->insertItem( CTRL + SHIFT + Key_F6),
- this, SLOT( activatePreviousWindow() ) );
- a->connectItem( a->insertItem( CTRL + SHIFT + Key_Tab),
- this, SLOT( activatePreviousWindow() ) );
-
- a->connectItem( a->insertItem( CTRL + Key_F4 ),
- this, SLOT( closeActiveWindow() ) );
-#endif
-
- setBackgroundMode( PaletteDark );
- setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-
-#ifndef QT_NO_WIDGET_TOPEXTRA
- d->topCaption = topLevelWidget()->caption();
-#endif
-
- d->hbar = d->vbar = 0;
- d->corner = 0;
- d->xoffset = d->yoffset = 0;
-
- updateWorkspace();
-
- topLevelWidget()->installEventFilter( this );
-}
-
-/*! Destroys the workspace and frees any allocated resources. */
-
-QWorkspaceP::~QWorkspaceP()
-{
- delete d;
- d = 0;
-}
-
-/*!\reimp */
-QSize QWorkspaceP::sizeHint() const
-{
- QSize s( QApplication::desktop()->size() );
- return QSize( s.width()*2/3, s.height()*2/3);
-}
-
-/*! \reimp */
-void QWorkspaceP::setPaletteBackgroundColor( const QColor & c )
-{
- setEraseColor( c );
-}
-
-
-/*! \reimp */
-void QWorkspaceP::setPaletteBackgroundPixmap( const QPixmap & pm )
-{
- setErasePixmap( pm );
-}
-
-/*! \reimp */
-void QWorkspaceP::childEvent( QChildEvent * e)
-{
- if (e->inserted() && e->child()->isWidgetType()) {
- QWidget* w = (QWidget*) e->child();
- if ( !w || !w->testWFlags( WStyle_Title | WStyle_NormalBorder | WStyle_DialogBorder )
- || d->icons.contains( w ) || w == d->vbar || w == d->hbar || w == d->corner )
- return; // nothing to do
-
- bool hasBeenHidden = w->isHidden();
- bool hasSize = w->testWState( WState_Resized );
- int x = w->x();
- int y = w->y();
- bool hasPos = x != 0 || y != 0;
- QSize s = w->size().expandedTo( w->minimumSizeHint() );
- if ( !hasSize && w->sizeHint().isValid() )
- w->adjustSize();
-
- QWorkspacePChild* child = new QWorkspacePChild( w, this, "qt_workspacechild" );
- child->installEventFilter( this );
-
- connect( child, SIGNAL( popupOperationMenu( const QPoint& ) ),
- this, SLOT( popupOperationMenu( const QPoint& ) ) );
- connect( child, SIGNAL( showOperationMenu() ),
- this, SLOT( showOperationMenu() ) );
- d->windows.append( child );
- if ( child->isVisibleTo( this ) )
- d->focus.append( child );
- child->internalRaise();
-
- if ( hasBeenHidden )
- w->hide();
- else if ( !isVisible() ) // that's a case were we don't receive a showEvent in time. Tricky.
- child->show();
-
- if ( !hasPos )
- place( child );
- if ( hasSize )
- child->resize( s + child->baseSize() );
- else
- child->adjustSize();
- if ( hasPos )
- child->move( x, y );
-
- activateWindow( w );
- updateWorkspace();
- } else if (e->removed() ) {
- if ( d->windows.contains( (QWorkspacePChild*)e->child() ) ) {
- d->windows.removeRef( (QWorkspacePChild*)e->child() );
- d->focus.removeRef( (QWorkspacePChild*)e->child() );
- if (d->windows.count() <= 0) { // VSR+ 26/03/03 -->
- activateWindow( 0 );
- d->maxWindow = 0;
- hideMaximizeControls();
- } // <-- VSR+ 26/03/03
- updateWorkspace();
- }
- }
-}
-
-/*! \reimp
-*/
-#ifndef QT_NO_WHEELEVENT
-void QWorkspaceP::wheelEvent( QWheelEvent *e )
-{
- if ( !scrollBarsEnabled() )
- return;
- if ( d->vbar && d->vbar->isVisible() && !( e->state() & AltButton ) )
- QApplication::sendEvent( d->vbar, e );
- else if ( d->hbar && d->hbar->isVisible() )
- QApplication::sendEvent( d->hbar, e );
-}
-#endif
-
-void QWorkspaceP::activateWindow( QWidget* w, bool change_focus )
-{
- if ( !w ) {
- d->active = 0;
- emit windowActivated( 0 );
- return;
- }
- if ( !isVisibleTo( 0 ) ) {
- d->becomeActive = w;
- return;
- }
- if ( d->active && d->active->windowWidget() == w )
- return;
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- c->setActive( c->windowWidget() == w );
- if (c->windowWidget() == w)
- d->active = c;
- }
-
- if (!d->active)
- return;
-
- if ( d->maxWindow && d->maxWindow != d->active && d->active->windowWidget() &&
- d->active->windowWidget()->testWFlags( WStyle_MinMax ) &&
- !d->active->windowWidget()->testWFlags( WStyle_Tool ) ) {
- maximizeWindow( d->active->windowWidget() );
- if ( d->maxtools ) {
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( w->icon() ) {
- QPixmap pm(*w->icon());
- if(pm.width() != 14 || pm.height() != 14) {
- QImage im;
- im = pm;
- pm = im.smoothScale( 14, 14 );
- }
- d->maxtools->setPixmap( pm );
- } else
-#endif
- {
- QPixmap pm(14,14);
- pm.fill( white );
- d->maxtools->setPixmap( pm );
- }
- }
- }
-
- d->active->internalRaise();
-
- if ( change_focus ) {
- if ( d->focus.find( d->active ) >=0 ) {
- d->focus.removeRef( d->active );
-// d->focus.append( d->active ); //VSR-
- }
- d->focus.append( d->active ); //VSR+
- }
-
- updateWorkspace();
- emit windowActivated( w );
-}
-
-
-/*!
- Returns the active window, or 0 if no window is active.
- */
-QWidget* QWorkspaceP::activeWindow() const
-{
- return d->active?d->active->windowWidget():0;
-}
-
-
-void QWorkspaceP::place( QWidget* w)
-{
- int overlap, minOverlap = 0;
- int possible;
-
- QRect r1(0, 0, 0, 0);
- QRect r2(0, 0, 0, 0);
- QRect maxRect = rect();
- int x = maxRect.left(), y = maxRect.top();
- QPoint wpos(maxRect.left(), maxRect.top());
-
- bool firstPass = TRUE;
-
- do {
- if ( y + w->height() > maxRect.bottom() ) {
- overlap = -1;
- } else if( x + w->width() > maxRect.right() ) {
- overlap = -2;
- } else {
- overlap = 0;
-
- r1.setRect(x, y, w->width(), w->height());
-
- QWidget *l;
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- l = it.current();
- ++it;
- if (! d->icons.contains(l) && ! l->isHidden() && l != w ) {
- if ( d->maxWindow == l )
- r2 = d->maxRestore;
- else
- r2.setRect(l->x(), l->y(), l->width(), l->height());
-
- if (r2.intersects(r1)) {
- r2.setCoords(QMAX(r1.left(), r2.left()),
- QMAX(r1.top(), r2.top()),
- QMIN(r1.right(), r2.right()),
- QMIN(r1.bottom(), r2.bottom())
- );
-
- overlap += (r2.right() - r2.left()) *
- (r2.bottom() - r2.top());
- }
- }
- }
- }
-
- if (overlap == 0) {
- wpos = QPoint(x, y);
- break;
- }
-
- if (firstPass) {
- firstPass = FALSE;
- minOverlap = overlap;
- } else if ( overlap >= 0 && overlap < minOverlap) {
- minOverlap = overlap;
- wpos = QPoint(x, y);
- }
-
- if ( overlap > 0 ) {
- possible = maxRect.right();
- if ( possible - w->width() > x) possible -= w->width();
-
- QWidget *l;
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- l = it.current();
- ++it;
- if (! d->icons.contains(l) && ! l->isHidden() && l != w ) {
- if ( d->maxWindow == l )
- r2 = d->maxRestore;
- else
- r2.setRect(l->x(), l->y(), l->width(), l->height());
-
- if( ( y < r2.bottom() ) && ( r2.top() < w->height() + y ) ) {
- if( r2.right() > x )
- possible = possible < r2.right() ?
- possible : r2.right();
-
- if( r2.left() - w->width() > x )
- possible = possible < r2.left() - w->width() ?
- possible : r2.left() - w->width();
- }
- }
- }
-
- x = possible;
- } else if ( overlap == -2 ) {
- x = maxRect.left();
- possible = maxRect.bottom();
-
- if ( possible - w->height() > y ) possible -= w->height();
-
- QWidget *l;
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- l = it.current();
- ++it;
- if (l != w && ! d->icons.contains(w)) {
- if ( d->maxWindow == l )
- r2 = d->maxRestore;
- else
- r2.setRect(l->x(), l->y(), l->width(), l->height());
-
- if( r2.bottom() > y)
- possible = possible < r2.bottom() ?
- possible : r2.bottom();
-
- if( r2.top() - w->height() > y )
- possible = possible < r2.top() - w->height() ?
- possible : r2.top() - w->height();
- }
- }
-
- y = possible;
- }
- }
- while( overlap != 0 && overlap != -1 );
-
- w->move(wpos);
- updateWorkspace();
-}
-
-
-void QWorkspaceP::insertIcon( QWidget* w )
-{
- if ( !w || d->icons.contains( w ) )
- return;
- d->icons.append( w );
- if (w->parentWidget() != this )
- w->reparent( this, 0, QPoint(0,0), FALSE);
-
-
- QRect cr = updateWorkspace();
- int x = 0;
- int y = cr.height() - w->height();
-
- QPtrListIterator<QWidget> it( d->icons );
- while ( it.current () ) {
- QWidget* i = it.current();
- ++it;
- if ( x > 0 && x + i->width() > cr.width() ){
- x = 0;
- y -= i->height();
- }
-
- if ( i != w &&
- i->geometry().intersects( QRect( x, y, w->width(), w->height() ) ) )
- x += i->width();
- }
- w->move( x, y );
-
- if ( isVisibleTo( parentWidget() ) ) {
- w->show();
- w->lower();
- }
- updateWorkspace();
-}
-
-
-void QWorkspaceP::removeIcon( QWidget* w)
-{
- if ( !d->icons.contains( w ) )
- return;
- d->icons.remove( w );
- w->hide();
-}
-
-
-/*! \reimp */
-void QWorkspaceP::resizeEvent( QResizeEvent * )
-{
- if ( d->maxWindow ) {
- d->maxWindow->adjustToFullscreen();
- ((QWorkspaceP*)d->maxWindow->windowWidget())->setWState( WState_Maximized );
- }
-
- QRect cr = updateWorkspace();
-
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- if ( c->windowWidget() && !c->windowWidget()->testWFlags( WStyle_Tool ) )
- continue;
-
- int x = c->x();
- int y = c->y();
- if ( c->snappedDown )
- y = cr.height() - c->height();
- if ( c->snappedRight )
- x = cr.width() - c->width();
-
- if ( x != c->x() || y != c->y() )
- c->move( x, y );
- }
-
-}
-
-/*! \reimp */
-void QWorkspaceP::showEvent( QShowEvent *e )
-{
- if ( d->maxWindow && !style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this))
- showMaximizeControls();
- QWidget::showEvent( e );
- if ( d->becomeActive ) {
- activateWindow( d->becomeActive );
- d->becomeActive = 0;
- }
- else if ( d->windows.count() > 0 && !d->active )
- activateWindow( d->windows.first()->windowWidget() );
-
- updateWorkspace();
-}
-
-/*! \reimp */
-void QWorkspaceP::hideEvent( QHideEvent * )
-{
-
- if ( !isVisibleTo(0) && !style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this))
- hideMaximizeControls();
-}
-
-void QWorkspaceP::minimizeWindow( QWidget* w)
-{
- QWorkspacePChild* c = findChild( w );
- QWorkspacePChild* oldActive = d->active; //VSR+
-
- if ( !w || w && (!w->testWFlags( WStyle_Minimize ) || w->testWFlags( WStyle_Tool) ) )
- return;
-
- if ( c ) {
- QWorkspaceP *fake = (QWorkspaceP*)w;
-
- setUpdatesEnabled( FALSE );
- bool wasMax = FALSE;
- if ( c == d->maxWindow ) {
- wasMax = TRUE;
- d->maxWindow = 0;
- inCaptionChange = TRUE;
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( !!d->topCaption )
- topLevelWidget()->setCaption( d->topCaption );
-#endif
- inCaptionChange = FALSE;
- if ( !style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this) )
- hideMaximizeControls();
- for (QPtrListIterator<QWorkspacePChild> it( d->windows ); it.current(); ++it ) {
- QWorkspacePChild* c = it.current();
- if ( c->titlebar )
- c->titlebar->setMovable( TRUE );
- c->widgetResizeHandler->setActive( TRUE );
- }
- }
- insertIcon( c->iconWidget() );
- bool wasFocused = c->titlebar->isActive();
- blockSignals( TRUE );//VSR+
- c->hide();
- blockSignals( FALSE );//VSR+
- if ( wasFocused && ( !d->active || d->active && d->active->testWState( WState_Minimized ) ) ) { //VSR+
-// if ( wasFocused && d->active && d->active->testWState( WState_Minimized ) ) { //VSR-
-//VSR- blockSignals( TRUE );
- activateWindow( w, FALSE );
-//VSR- blockSignals( FALSE );
- }
- else if ( oldActive != d->active ) { //VSR+
- emit ( windowActivated( d->active ? d->active->windowWidget() : 0 ) ); //VSR+
- } //VSR+
- if ( wasMax )
- c->setGeometry( d->maxRestore );
- if ( d->focus.find( c ) < 0 ) // VSR+
- d->focus.append( c );
-
- setUpdatesEnabled( TRUE );
- updateWorkspace();
-
- fake->clearWState( WState_Maximized );
- fake->setWState( WState_Minimized );
- c->clearWState( WState_Maximized );
- c->setWState( WState_Minimized );
- }
-}
-
-void QWorkspaceP::normalizeWindow( QWidget* w)
-{
- QWorkspacePChild* c = findChild( w );
- if ( !w )
- return;
- if ( c ) {
- QWorkspaceP *fake = (QWorkspaceP*)w;
- fake->clearWState( WState_Minimized | WState_Maximized );
- if ( !style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this) && d->maxWindow ) {
- hideMaximizeControls();
- } else {
- c->widgetResizeHandler->setActive( TRUE );
- if ( c->titlebar )
- c->titlebar->setMovable(TRUE);
- }
- fake->clearWState( WState_Minimized | WState_Maximized );
- c->clearWState( WState_Minimized | WState_Maximized );
-
- if ( c == d->maxWindow ) {
- c->setGeometry( d->maxRestore );
- d->maxWindow = 0;
-#ifndef QT_NO_WIDGET_TOPEXTRA
- inCaptionChange = TRUE;
- if ( !!d->topCaption )
- topLevelWidget()->setCaption( d->topCaption );
- inCaptionChange = FALSE;
-#endif
- } else {
- if ( c->iconw )
- removeIcon( c->iconw->parentWidget() );
- c->show();
- }
-
- if ( !style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this))
- hideMaximizeControls();
- for (QPtrListIterator<QWorkspacePChild> it( d->windows ); it.current(); ++it ) {
- QWorkspacePChild* c = it.current();
- if ( c->titlebar )
- c->titlebar->setMovable( TRUE );
- c->widgetResizeHandler->setActive( TRUE );
- }
- activateWindow( w, TRUE );
-
- updateWorkspace();
- }
-}
-
-void QWorkspaceP::maximizeWindow( QWidget* w)
-{
- QWorkspacePChild* c = findChild( w );
-
- if ( !w || w && (!w->testWFlags( WStyle_Maximize ) || w->testWFlags( WStyle_Tool) ) )
- return;
- if ( w->maximumSize().isValid() && ( w->maximumWidth() < width() || w->maximumHeight() < height() ) ) {
- w->resize( w->maximumSize() );
- return;
- }
-
- if ( c ) {
- setUpdatesEnabled( FALSE );
- if (c->iconw && d->icons.contains( c->iconw->parentWidget() ) )
- normalizeWindow( w );
- QWorkspaceP *fake = (QWorkspaceP*)w;
-
- QRect r( c->geometry() );
- c->adjustToFullscreen();
- c->show();
- c->internalRaise();
- qApp->sendPostedEvents( c, QEvent::Resize );
- qApp->sendPostedEvents( c, QEvent::Move );
- qApp->sendPostedEvents( c, QEvent::ShowWindowRequest );
- if ( d->maxWindow != c ) {
- if ( d->maxWindow )
- d->maxWindow->setGeometry( d->maxRestore );
- d->maxWindow = c;
- d->maxRestore = r;
- }
-
- activateWindow( w );
- if(!style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this)) {
- showMaximizeControls();
- } else {
- c->widgetResizeHandler->setActive( FALSE );
- if ( c->titlebar )
- c->titlebar->setMovable( FALSE );
- }
-#ifndef QT_NO_WIDGET_TOPEXTRA
- inCaptionChange = TRUE;
- if ( !!d->topCaption )
- topLevelWidget()->setCaption( tr("%1 - [%2]")
- .arg(d->topCaption).arg(c->caption()) );
- inCaptionChange = FALSE;
-#endif
- setUpdatesEnabled( TRUE );
-
- updateWorkspace();
-
- fake->clearWState( WState_Minimized );
- fake->setWState( WState_Maximized );
- c->clearWState( WState_Minimized );
- c->setWState( WState_Maximized );
- }
-}
-
-void QWorkspaceP::showWindow( QWidget* w)
-{
- if ( d->maxWindow && w->testWFlags( WStyle_Maximize ) && !w->testWFlags( WStyle_Tool) )
- maximizeWindow( w );
- else if ( !w->testWFlags( WStyle_Tool ) )
- normalizeWindow( w );
- else
- w->parentWidget()->show();
- if ( d->maxWindow )
- d->maxWindow->raise();
- updateWorkspace();
-}
-
-
-QWorkspacePChild* QWorkspaceP::findChild( QWidget* w)
-{
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- if (c->windowWidget() == w)
- return c;
- }
- return 0;
-}
-
-/*!
- Returns a list of all windows.
- */
-QWidgetList QWorkspaceP::windowList() const
-{
- QWidgetList windows;
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- if ( c->windowWidget() )
- windows.append( c->windowWidget() );
- }
- return windows;
-}
-
-/*!\reimp*/
-bool QWorkspaceP::eventFilter( QObject *o, QEvent * e)
-{
- static QTime* t = 0;
- static QWorkspaceP* tc = 0;
-#ifndef QT_NO_MENUBAR
- if ( o == d->maxtools && d->menuId != -1 ) {
- switch ( e->type() ) {
- case QEvent::MouseButtonPress:
- {
- QMenuBar* b = (QMenuBar*)o->parent();
- if ( !t )
- t = new QTime;
- if ( tc != this || t->elapsed() > QApplication::doubleClickInterval() ) {
- if ( QApplication::reverseLayout() ) {
- QPoint p = b->mapToGlobal( QPoint( b->x() + b->width(), b->y() + b->height() ) );
- p.rx() -= d->popup->sizeHint().width();
- popupOperationMenu( p );
- } else {
- popupOperationMenu( b->mapToGlobal( QPoint( b->x(), b->y() + b->height() ) ) );
- }
- t->start();
- tc = this;
- } else {
- tc = 0;
- closeActiveWindow();
- }
- return TRUE;
- }
- default:
- break;
- }
- return QWidget::eventFilter( o, e );
- }
-#endif
- switch ( e->type() ) {
- case QEvent::Hide:
- case QEvent::HideToParent:
- if ( !o->isA( "QWorkspacePChild" ) || !isVisible() )
- break;
- d->focus.removeRef( (QWorkspacePChild*)o );
- if ( d->active != o )
- break;
- if ( d->focus.isEmpty() ) {
- activateWindow( 0 );
- } else {
- d->autoFocusChange = TRUE;
- activatePreviousWindow();
- QWorkspacePChild* c = d->active;
- while ( d->active &&
- d->active->windowWidget() &&
- d->active->windowWidget()->testWFlags( WStyle_Tool ) ) {
- activatePreviousWindow();
- if ( d->active == c )
- break;
- }
- d->autoFocusChange = FALSE;
- }
- if ( d->maxWindow == o && d->maxWindow->isHidden() ) {
- d->maxWindow->setGeometry( d->maxRestore );
- d->maxWindow = 0;
- if ( d->active )
- maximizeWindow( d->active );
-
- if ( !d->maxWindow ) {
-
- if ( style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this)) {
- QWorkspacePChild *wc = (QWorkspacePChild *)o;
- wc->widgetResizeHandler->setActive( TRUE );
- if ( wc->titlebar )
- wc->titlebar->setMovable( TRUE );
- } else {
- hideMaximizeControls();
- }
-#ifndef QT_NO_WIDGET_TOPEXTRA
- inCaptionChange = TRUE;
- if ( !!d->topCaption )
- topLevelWidget()->setCaption( d->topCaption );
- inCaptionChange = FALSE;
-#endif
- }
- }
- break;
- case QEvent::Show:
- if ( o->isA("QWorkspacePChild") && !d->focus.containsRef( (QWorkspacePChild*)o ) )
- d->focus.append( (QWorkspacePChild*)o );
- updateWorkspace();
- break;
- case QEvent::CaptionChange:
- if ( inCaptionChange )
- break;
-
-#ifndef QT_NO_WIDGET_TOPEXTRA
- inCaptionChange = TRUE;
- if ( o == topLevelWidget() )
- d->topCaption = ((QWidget*)o)->caption();
-
- if ( d->maxWindow && !!d->topCaption )
- topLevelWidget()->setCaption( tr("%1 - [%2]")
- .arg(d->topCaption).arg(d->maxWindow->caption()));
- inCaptionChange = FALSE;
-#endif
-
- break;
- case QEvent::Close:
- if ( o == topLevelWidget() )
- {
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- if ( c->shademode )
- c->showShaded();
- }
- } else if ( o->inherits("QWorkspacePChild") ) {
- d->popup->hide();
- }
- if ( d->windows.count() > 1 || d->windows.first() && d->active != d->windows.first() )
- activatePreviousWindow();
- updateWorkspace();
- break;
- default:
- break;
- }
- return QWidget::eventFilter( o, e);
-}
-
-void QWorkspaceP::showMaximizeControls()
-{
-#ifndef QT_NO_MENUBAR
- Q_ASSERT(d->maxWindow);
- QMenuBar* b = 0;
-
- // Do a breadth-first search first on every parent,
- QWidget* w = parentWidget();
- QObjectList * l = 0;
- while ( !l && w ) {
- l = w->queryList( "QMenuBar", 0, FALSE, FALSE );
- w = w->parentWidget();
- if ( l && !l->count() ) {
- delete l;
- l = 0;
- }
- }
-
- // and query recursively if nothing is found.
- if ( !l || !l->count() ) {
- if ( l )
- delete l;
- l = topLevelWidget()->queryList( "QMenuBar", 0, 0, TRUE );
- }
- if ( l && l->count() )
- b = (QMenuBar *)l->first();
- delete l;
-
- if ( !b )
- return;
-
- if ( !d->maxcontrols ) {
- d->maxmenubar = b;
- d->maxcontrols = new QFrame( topLevelWidget(), "qt_maxcontrols" );
- QHBoxLayout* l = new QHBoxLayout( d->maxcontrols,
- d->maxcontrols->frameWidth(), 0 );
- if ( d->maxWindow->windowWidget()->testWFlags(WStyle_Minimize) ) {
- QToolButton* iconB = new QToolButton( d->maxcontrols, "iconify" );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( iconB, tr( "Minimize" ) );
-#endif
- l->addWidget( iconB );
- iconB->setFocusPolicy( NoFocus );
- iconB->setIconSet(style().stylePixmap(QStyle::SP_TitleBarMinButton));
- iconB->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
- connect( iconB, SIGNAL( clicked() ),
- this, SLOT( minimizeActiveWindow() ) );
- }
-
- QToolButton* restoreB = new QToolButton( d->maxcontrols, "restore" );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( restoreB, tr( "Restore Down" ) );
-#endif
- l->addWidget( restoreB );
- restoreB->setFocusPolicy( NoFocus );
- restoreB->setIconSet( style().stylePixmap(QStyle::SP_TitleBarNormalButton));
- restoreB->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
- connect( restoreB, SIGNAL( clicked() ),
- this, SLOT( normalizeActiveWindow() ) );
-
- l->addSpacing( 2 );
- QToolButton* closeB = new QToolButton( d->maxcontrols, "close" );
-#ifndef QT_NO_TOOLTIP
- QToolTip::add( closeB, tr( "Close" ) );
-#endif
- l->addWidget( closeB );
- closeB->setFocusPolicy( NoFocus );
- closeB->setIconSet( style().stylePixmap(QStyle::SP_TitleBarCloseButton) );
- closeB->setFixedSize(BUTTON_WIDTH, BUTTON_HEIGHT);
- connect( closeB, SIGNAL( clicked() ),
- this, SLOT( closeActiveWindow() ) );
-
- d->maxcontrols->setFixedSize( d->maxcontrols->minimumSizeHint() );
- }
-
- if ( d->controlId == -1 || b->indexOf( d->controlId ) == -1 ) {
- QFrame* dmaxcontrols = d->maxcontrols;
- d->controlId = b->insertItem( dmaxcontrols, -1, b->count() );
- }
- if ( d->active && ( d->menuId == -1 || b->indexOf( d->menuId ) == -1 ) ) {
- if ( !d->maxtools ) {
- d->maxtools = new QLabel( topLevelWidget(), "qt_maxtools" );
- d->maxtools->installEventFilter( this );
- }
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( d->active->windowWidget() && d->active->windowWidget()->icon() ) {
- QPixmap pm(*d->active->windowWidget()->icon());
- if(pm.width() != 14 || pm.height() != 14) {
- QImage im;
- im = pm;
- pm = im.smoothScale( 14, 14 );
- }
- d->maxtools->setPixmap( pm );
- } else
-#endif
- {
- QPixmap pm(14,14);
- pm.fill( white );
- d->maxtools->setPixmap( pm );
- }
- d->menuId = b->insertItem( d->maxtools, -1, 0 );
- }
-#endif
-}
-
-
-void QWorkspaceP::hideMaximizeControls()
-{
-#ifndef QT_NO_MENUBAR
- if ( d->maxmenubar ) {
- int mi = d->menuId;
- if ( mi != -1 ) {
- if ( d->maxmenubar->indexOf( mi ) != -1 )
- d->maxmenubar->removeItem( mi );
- d->maxtools = 0;
- }
- int ci = d->controlId;
- if ( ci != -1 && d->maxmenubar->indexOf( ci ) != -1 )
- d->maxmenubar->removeItem( ci );
- }
- d->maxcontrols = 0;
- d->menuId = -1;
- d->controlId = -1;
-#endif
-}
-
-void QWorkspaceP::closeActiveWindow()
-{
- setUpdatesEnabled( FALSE );
- if ( d->maxWindow && d->maxWindow->windowWidget() )
- d->maxWindow->windowWidget()->close();
- else if ( d->active && d->active->windowWidget() )
- d->active->windowWidget()->close();
- setUpdatesEnabled( TRUE );
- updateWorkspace();
-}
-
-void QWorkspaceP::closeAllWindows()
-{
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- QWorkspacePChild *c = 0;
- while ( ( c = it.current() ) != 0 ) {
- ++it;
- if ( c->windowWidget() )
- c->windowWidget()->close();
- }
-}
-
-void QWorkspaceP::normalizeActiveWindow()
-{
- if ( d->maxWindow )
- d->maxWindow->showNormal();
- else if ( d->active )
- d->active->showNormal();
-}
-
-void QWorkspaceP::minimizeActiveWindow()
-{
- if ( d->maxWindow )
- d->maxWindow->showMinimized();
- else if ( d->active )
- d->active->showMinimized();
-}
-
-void QWorkspaceP::showOperationMenu()
-{
- if ( !d->active || !d->active->windowWidget() )
- return;
- Q_ASSERT( d->active->windowWidget()->testWFlags( WStyle_SysMenu ) );
- QPoint p;
- QPopupMenu *popup = d->active->windowWidget()->testWFlags( WStyle_Tool ) ? d->toolPopup : d->popup;
- if ( QApplication::reverseLayout() ) {
- p = QPoint( d->active->windowWidget()->mapToGlobal( QPoint(d->active->windowWidget()->width(),0) ) );
- p.rx() -= popup->sizeHint().width();
- } else {
- p = QPoint( d->active->windowWidget()->mapToGlobal( QPoint(0,0) ) );
- }
- if ( !d->active->isVisible() ) {
- p = d->active->iconWidget()->mapToGlobal( QPoint(0,0) );
- p.ry() -= popup->sizeHint().height();
- }
- popupOperationMenu( p );
-}
-
-void QWorkspaceP::popupOperationMenu( const QPoint& p)
-{
- if ( !d->active || !d->active->windowWidget() || !d->active->windowWidget()->testWFlags( WStyle_SysMenu ) )
- return;
- if ( d->active->windowWidget()->testWFlags( WStyle_Tool ))
- d->toolPopup->popup( p );
- else
- d->popup->popup( p );
-}
-
-void QWorkspaceP::operationMenuAboutToShow()
-{
- for ( int i = 1; i < 6; i++ ) {
- bool enable = d->active != 0;
- d->popup->setItemEnabled( i, enable );
- }
-
- if ( !d->active || !d->active->windowWidget() )
- return;
-
- d->popup->setItemEnabled( 4, d->active->windowWidget()->testWFlags( WStyle_Minimize ) );
- d->popup->setItemEnabled( 5, d->active->windowWidget()->testWFlags( WStyle_Maximize ) );
-
- if ( d->active == d->maxWindow ) {
- d->popup->setItemEnabled( 2, FALSE );
- d->popup->setItemEnabled( 3, FALSE );
- d->popup->setItemEnabled( 5, FALSE );
- } else if ( d->active->isVisible() ){
- d->popup->setItemEnabled( 1, FALSE );
- } else {
- d->popup->setItemEnabled( 2, FALSE );
- d->popup->setItemEnabled( 3, FALSE );
- d->popup->setItemEnabled( 4, FALSE );
- }
-}
-
-void QWorkspaceP::toolMenuAboutToShow()
-{
- if ( !d->active || !d->active->windowWidget() )
- return;
-
- d->toolPopup->setItemEnabled( 3, !d->active->shademode );
- if ( d->active->shademode )
- d->toolPopup->changeItem( 6,
- QIconSet(style().stylePixmap(QStyle::SP_TitleBarUnshadeButton)), tr("&Unshade") );
- else
- d->toolPopup->changeItem( 6, QIconSet(style().stylePixmap(QStyle::SP_TitleBarShadeButton)), tr("Sh&ade") );
- d->toolPopup->setItemEnabled( 6, d->active->windowWidget()->testWFlags( WStyle_MinMax ) );
- d->toolPopup->setItemChecked( 7, d->active->windowWidget()->testWFlags( WStyle_StaysOnTop ) );
-}
-
-void QWorkspaceP::operationMenuActivated( int a )
-{
- if ( !d->active )
- return;
- switch ( a ) {
- case 1:
- d->active->showNormal();
- break;
- case 2:
- d->active->doMove();
- break;
- case 3:
- if ( d->active->shademode )
- d->active->showShaded();
- d->active->doResize();
- break;
- case 4:
- d->active->showMinimized();
- break;
- case 5:
- d->active->showMaximized();
- break;
- case 6:
- d->active->showShaded();
- break;
- case 7:
- {
- QWorkspaceP* w = (QWorkspaceP*)d->active->windowWidget();
- if ( !w )
- break;
- if ( w->testWFlags( WStyle_StaysOnTop ) ) {
- w->clearWFlags( WStyle_StaysOnTop );
- } else {
- w->setWFlags( WStyle_StaysOnTop );
- w->parentWidget()->raise();
- }
- }
- break;
- default:
- break;
- }
-}
-
-void QWorkspaceP::activateNextWindow()
-{
- if ( d->focus.isEmpty() )
- return;
- if ( !d->active ) {
- if ( d->focus.first() )
- activateWindow( d->focus.first()->windowWidget(), FALSE );
- return;
- }
-
- int a = d->focus.find( d->active ) + 1;
-
- a = a % d->focus.count();
-
- if ( d->focus.at( a ) )
- activateWindow( d->focus.at( a )->windowWidget(), FALSE );
- else
- d->active = 0;
-}
-
-void QWorkspaceP::activatePreviousWindow()
-{
- if ( d->focus.isEmpty() ) {
- if ( d->windows.count() > 0 ) { //VSR+
- activateWindow( d->windows.last()->windowWidget() ); //VSR+
- } //VSR+
- return;
- }
- if ( !d->active ) {
- if ( d->focus.last() )
- activateWindow( d->focus.first()->windowWidget(), FALSE );
- else
- activateWindow( 0 );
-
- return;
- }
-
- int a = d->focus.find( d->active ) - 1;
-
- if ( a < 0 )
- a = d->focus.count()-1;
-
- if ( d->autoFocusChange ) {
- QWidget *widget = 0;
- while ( a >= 0 && d->focus.at( a ) && ( widget = d->focus.at( a )->windowWidget() ) && !widget->isVisible() )
- a--;
- if ( a < 0 )
- a = d->focus.count() - 1;
- }
-
- if ( d->focus.at( a ) )
- activateWindow( d->focus.at( a )->windowWidget(), FALSE );
- else
- activateWindow( 0 );
-}
-
-
-/*!
- \fn void QWorkspaceP::windowActivated( QWidget* w )
-
- This signal is emitted when the window widget \a w becomes active.
- Note that \a w can be null, and that more than one signal may be
- fired for one activation event.
-
- \sa activeWindow(), windowList()
-*/
-
-
-
-/*!
- Arranges all child windows in a cascade pattern.
-
- \sa tile()
- */
-void QWorkspaceP::cascade()
-{
- if ( d->maxWindow )
- d->maxWindow->showNormal();
-
- if ( d->vbar ) {
- d->vbar->blockSignals( TRUE );
- d->vbar->setValue( 0 );
- d->vbar->blockSignals( FALSE );
- d->hbar->blockSignals( TRUE );
- d->hbar->setValue( 0 );
- d->hbar->blockSignals( FALSE );
- scrollBarChanged();
- }
-
- const int xoffset = 13;
- const int yoffset = 20;
-
- // make a list of all relevant mdi clients
- QPtrList<QWorkspacePChild> widgets;
- QWorkspacePChild* wc = 0;
- for ( wc = d->windows.first(); wc; wc = d->windows.next() )
- if ( wc->iconw )
- normalizeWindow( wc->windowWidget() );
- for ( wc = d->focus.first(); wc; wc = d->focus.next() )
- if ( wc->windowWidget()->isVisibleTo( this ) && !wc->windowWidget()->testWFlags( WStyle_Tool ) )
- widgets.append( wc );
-
- int x = 0;
- int y = 0;
-
- setUpdatesEnabled( FALSE );
- QPtrListIterator<QWorkspacePChild> it( widgets );
- int children = d->windows.count() - 1;
- while ( it.current () ) {
- QWorkspacePChild *child = it.current();
- ++it;
- child->setUpdatesEnabled( FALSE );
- bool hasSizeHint = FALSE;
- QSize prefSize = child->windowWidget()->sizeHint().expandedTo( child->windowWidget()->minimumSizeHint() );
-
- if ( !prefSize.isValid() )
- prefSize = QSize( width() - children * xoffset, height() - children * yoffset );
- else
- hasSizeHint = TRUE;
- prefSize = prefSize.expandedTo( child->windowWidget()->minimumSize() ).boundedTo( child->windowWidget()->maximumSize() );
- if ( hasSizeHint )
- prefSize += QSize( child->baseSize().width(), child->baseSize().height() );
-
- int w = prefSize.width();
- int h = prefSize.height();
-
- child->showNormal();
- qApp->sendPostedEvents( 0, QEvent::ShowNormal );
- if ( y + h > height() )
- y = 0;
- if ( x + w > width() )
- x = 0;
- child->setGeometry( x, y, w, h );
- x += xoffset;
- y += yoffset;
- child->internalRaise();
- child->setUpdatesEnabled( TRUE );
- }
- setUpdatesEnabled( TRUE );
- updateWorkspace();
-}
-
-/*!
- Arranges all child windows in a tile pattern.
-
- \sa cascade()
- */
-void QWorkspaceP::tile()
-{
- if ( d->maxWindow )
- d->maxWindow->showNormal();
-
- if ( d->vbar ) {
- d->vbar->blockSignals( TRUE );
- d->vbar->setValue( 0 );
- d->vbar->blockSignals( FALSE );
- d->hbar->blockSignals( TRUE );
- d->hbar->setValue( 0 );
- d->hbar->blockSignals( FALSE );
- scrollBarChanged();
- }
-
- int rows = 1;
- int cols = 1;
- int n = 0;
- QWorkspacePChild* c;
-
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- c = it.current();
- ++it;
- if ( !c->windowWidget()->isHidden() &&
- !c->windowWidget()->testWFlags( WStyle_StaysOnTop ) &&
- !c->windowWidget()->testWFlags( WStyle_Tool ) )
- n++;
- }
-
- while ( rows * cols < n ) {
- if ( cols <= rows )
- cols++;
- else
- rows++;
- }
- int add = cols * rows - n;
- bool* used = new bool[ cols*rows ];
- for ( int i = 0; i < rows*cols; i++ )
- used[i] = FALSE;
-
- int row = 0;
- int col = 0;
- int w = width() / cols;
- int h = height() / rows;
-
- it.toFirst();
- while ( it.current () ) {
- c = it.current();
- ++it;
- if ( c->windowWidget()->isHidden() || c->windowWidget()->testWFlags( WStyle_Tool ) )
- continue;
- if ( c->windowWidget()->testWFlags( WStyle_StaysOnTop ) ) {
- QPoint p = c->pos();
- if ( p.x()+c->width() < 0 )
- p.setX( 0 );
- if ( p.x() > width() )
- p.setX( width() - c->width() );
- if ( p.y() + 10 < 0 )
- p.setY( 0 );
- if ( p.y() > height() )
- p.setY( height() - c->height() );
-
-
- if ( p != c->pos() )
- c->QFrame::move( p );
- } else {
- c->showNormal();
- qApp->sendPostedEvents( 0, QEvent::ShowNormal );
- used[row*cols+col] = TRUE;
- if ( add ) {
- c->setGeometry( col*w, row*h, QMIN( w, c->windowWidget()->maximumWidth()+c->baseSize().width() ),
- QMIN( 2*h, c->windowWidget()->maximumHeight()+c->baseSize().height() ) );
- used[(row+1)*cols+col] = TRUE;
- add--;
- } else {
- c->setGeometry( col*w, row*h, QMIN( w, c->windowWidget()->maximumWidth()+c->baseSize().width() ),
- QMIN( h, c->windowWidget()->maximumHeight()+c->baseSize().height() ) );
- }
- while( row < rows && col < cols && used[row*cols+col] ) {
- col++;
- if ( col == cols ) {
- col = 0;
- row++;
- }
- }
- }
- }
- delete [] used;
- updateWorkspace();
-}
-
-QWorkspacePChild::QWorkspacePChild( QWidget* window, QWorkspaceP *parent,
- const char *name )
- : QFrame( parent, name,
- WStyle_Customize | WStyle_NoBorder | WDestructiveClose | WNoMousePropagation | WSubWindow )
-{
- setMouseTracking( TRUE );
- act = FALSE;
- iconw = 0;
- lastfocusw = 0;
- shademode = FALSE;
- titlebar = 0;
- snappedRight = FALSE;
- snappedDown = FALSE;
-
- if (window) {
- switch (window->focusPolicy()) {
- case QWidget::NoFocus:
- window->setFocusPolicy(QWidget::ClickFocus);
- break;
- case QWidget::TabFocus:
- window->setFocusPolicy(QWidget::StrongFocus);
- break;
- default:
- break;
- }
- }
-
- if ( window && window->testWFlags( WStyle_Title ) ) {
- titlebar = new QTitleBarP( window, this, "qt_ws_titlebar" );
- connect( titlebar, SIGNAL( doActivate() ),
- this, SLOT( activate() ) );
- connect( titlebar, SIGNAL( doClose() ),
- window, SLOT( close() ) );
- connect( titlebar, SIGNAL( doMinimize() ),
- this, SLOT( showMinimized() ) );
- connect( titlebar, SIGNAL( doNormal() ),
- this, SLOT( showNormal() ) );
- connect( titlebar, SIGNAL( doMaximize() ),
- this, SLOT( showMaximized() ) );
- connect( titlebar, SIGNAL( popupOperationMenu( const QPoint& ) ),
- this, SIGNAL( popupOperationMenu( const QPoint& ) ) );
- connect( titlebar, SIGNAL( showOperationMenu() ),
- this, SIGNAL( showOperationMenu() ) );
- connect( titlebar, SIGNAL( doShade() ),
- this, SLOT( showShaded() ) );
- connect( titlebar, SIGNAL( doubleClicked() ),
- this, SLOT( titleBarDoubleClicked() ) );
- }
-
- if ( window && window->testWFlags( WStyle_Tool ) ) {
- setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
- setLineWidth( 2 );
- setMinimumSize( 128, 0 );
- } else {
- setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
- setLineWidth( 2 );
- setMinimumSize( 128, 0 );
- }
-
- childWidget = window;
- if (!childWidget)
- return;
-
-#ifndef QT_NO_WIDGET_TOPEXTRA
- setCaption( childWidget->caption() );
-#endif
-
- QPoint p;
- QSize s;
- QSize cs;
-
- bool hasBeenResized = childWidget->testWState( WState_Resized );
-
- if ( !hasBeenResized )
- cs = childWidget->sizeHint().expandedTo( childWidget->minimumSizeHint() );
- else
- cs = childWidget->size();
-
- int th = titlebar ? titlebar->sizeHint().height() : 0;
- if ( titlebar ) {
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if( childWidget->icon() ) {
- QPixmap pm(*childWidget->icon());
- if(pm.width() != 14 || pm.height() != 14) {
- QImage im;
- im = pm;
- pm = im.smoothScale( 14, 14 );
- }
- titlebar->setIcon( pm );
- }
-#endif
- p = QPoint( contentsRect().x(),
- th + contentsRect().y() );
- s = QSize( cs.width() + 2*frameWidth(),
- cs.height() + 2*frameWidth() + th + 2 );
- } else {
- p = QPoint( contentsRect().x(), contentsRect().y() );
- s = QSize( cs.width() + 2*frameWidth(),
- cs.height() + 2*frameWidth() );
- }
-
- childWidget->reparent( this, p);
- resize( s );
-
- childWidget->installEventFilter( this );
-
- widgetResizeHandler = new QWidgetResizeHandlerP( this, window );
- widgetResizeHandler->setMovingEnabled( FALSE );
- widgetResizeHandler->setSizeProtection( !parent->scrollBarsEnabled() );
- connect( widgetResizeHandler, SIGNAL( activate() ),
- this, SLOT( activate() ) );
- widgetResizeHandler->setExtraHeight( th + 2 );
-
- setBaseSize( baseSize() );
-}
-
-QWorkspacePChild::~QWorkspacePChild()
-{
- if ( iconw )
- delete iconw->parentWidget();
-}
-
-void QWorkspacePChild::moveEvent( QMoveEvent * )
-{
- ((QWorkspaceP*) parentWidget() )->updateWorkspace();
-}
-
-void QWorkspacePChild::resizeEvent( QResizeEvent * )
-{
- QRect r = contentsRect();
- QRect cr;
-
- if ( titlebar ) {
- int th = titlebar->sizeHint().height();
- QRect tbrect( 0, 0, width(), th );
- if ( !style().styleHint( QStyle::SH_TitleBar_NoBorder ) )
- tbrect = QRect( r.x(), r.y(), r.width(), th );
- titlebar->setGeometry( tbrect );
- cr = QRect( r.x(), r.y() + titlebar->height() + (shademode ? 5 : 1),
- r.width(), r.height() - titlebar->height() - 2 );
- } else {
- cr = r;
- }
-
- if (!childWidget)
- return;
-
- windowSize = cr.size();
- childWidget->setGeometry( cr );
- ((QWorkspaceP*) parentWidget() )->updateWorkspace();
-}
-
-QSize QWorkspacePChild::baseSize() const
-{
- int th = titlebar ? titlebar->sizeHint().height() : 0;
- return QSize( 2*frameWidth(), 2*frameWidth() + th + 2 );
-}
-
-QSize QWorkspacePChild::sizeHint() const
-{
- if ( !childWidget )
- return QFrame::sizeHint() + baseSize();
- return childWidget->sizeHint().expandedTo( childWidget->minimumSizeHint() ) + baseSize();
-}
-
-QSize QWorkspacePChild::minimumSizeHint() const
-{
- if ( !childWidget )
- return QFrame::minimumSizeHint() + baseSize();
- QSize s = childWidget->minimumSize();
- if ( s.isEmpty() )
- s = childWidget->minimumSizeHint();
- return s + baseSize();
-}
-
-void QWorkspacePChild::activate()
-{
- ((QWorkspaceP*)parentWidget())->activateWindow( windowWidget() );
-}
-
-bool QWorkspacePChild::eventFilter( QObject * o, QEvent * e)
-{
- if ( !isActive() && ( e->type() == QEvent::MouseButtonPress ||
- e->type() == QEvent::FocusIn ) ) {
- if ( iconw ) {
- ((QWorkspaceP*)parentWidget())->normalizeWindow( windowWidget() );
- if ( iconw ) {
- ((QWorkspaceP*)parentWidget())->removeIcon( iconw->parentWidget() );
- delete iconw->parentWidget();
- iconw = 0;
- }
- }
- activate();
- }
-
- // for all widgets except the window, we that's the only thing we
- // process, and if we have no childWidget we skip totally
- if ( o != childWidget || childWidget == 0 )
- return FALSE;
-
- switch ( e->type() ) {
- case QEvent::Show:
- if ( ((QWorkspaceP*)parentWidget())->d->focus.find( this ) < 0 )
- ((QWorkspaceP*)parentWidget())->d->focus.append( this );
- if ( isVisibleTo( parentWidget() ) )
- break;
- if (( (QShowEvent*)e)->spontaneous() )
- break;
- // fall through
- case QEvent::ShowToParent:
- if ( windowWidget() && windowWidget()->testWFlags( WStyle_StaysOnTop ) ) {
- internalRaise();
- show();
- }
- ((QWorkspaceP*)parentWidget())->showWindow( windowWidget() );
- break;
- case QEvent::ShowMaximized:
- if ( windowWidget()->maximumSize().isValid() &&
- ( windowWidget()->maximumWidth() < parentWidget()->width() ||
- windowWidget()->maximumHeight() < parentWidget()->height() ) ) {
- windowWidget()->resize( windowWidget()->maximumSize() );
- break;
- }
- if ( windowWidget()->testWFlags( WStyle_Maximize ) && !windowWidget()->testWFlags( WStyle_Tool ) )
- ((QWorkspaceP*)parentWidget())->maximizeWindow( windowWidget() );
- else
- ((QWorkspaceP*)parentWidget())->normalizeWindow( windowWidget() );
- break;
- case QEvent::ShowMinimized:
- ((QWorkspaceP*)parentWidget())->minimizeWindow( windowWidget() );
- break;
- case QEvent::ShowNormal:
- ((QWorkspaceP*)parentWidget())->normalizeWindow( windowWidget() );
- if (iconw) {
- ((QWorkspaceP*)parentWidget())->removeIcon( iconw->parentWidget() );
- delete iconw->parentWidget();
- }
- break;
- case QEvent::Hide:
- case QEvent::HideToParent:
- if ( !childWidget->isVisibleTo( this ) ) {
- QWidget * w = iconw;
- if ( w && ( w = w->parentWidget() ) ) {
- ((QWorkspaceP*)parentWidget())->removeIcon( w );
- delete w;
- }
- hide();
- }
- break;
- case QEvent::CaptionChange:
-#ifndef QT_NO_WIDGET_TOPEXTRA
- setCaption( childWidget->caption() );
- if ( iconw )
- iconw->setCaption( childWidget->caption() );
-#endif
- break;
- case QEvent::IconChange:
- {
- QWorkspaceP* ws = (QWorkspaceP*)parentWidget();
- if ( !titlebar )
- break;
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( childWidget->icon() ) {
- titlebar->setIcon( *childWidget->icon() );
- } else
-#endif
- {
- QPixmap pm;
- titlebar->setIcon( pm );
- }
-
- if ( ws->d->maxWindow != this )
- break;
-
- if ( ws->d->maxtools ) {
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( childWidget->icon() ) {
- QPixmap pm(*childWidget->icon());
- if(pm.width() != 14 || pm.height() != 14) {
- QImage im;
- im = pm;
- pm = im.smoothScale( 14, 14 );
- }
- ws->d->maxtools->setPixmap( pm );
- } else
-#endif
- {
- QPixmap pm(14,14);
- pm.fill( white );
- ws->d->maxtools->setPixmap( pm );
- }
- }
- }
- break;
- case QEvent::Resize:
- {
- QResizeEvent* re = (QResizeEvent*)e;
- if ( re->size() != windowSize && !shademode )
- resize( re->size() + baseSize() );
- }
- break;
-
- case QEvent::WindowDeactivate:
- if ( titlebar )
- titlebar->setActive( FALSE );
- break;
-
- case QEvent::WindowActivate:
- if ( titlebar )
- titlebar->setActive( act );
- break;
-
- default:
- break;
- }
-
- return QFrame::eventFilter(o, e);
-}
-
-bool QWorkspacePChild::focusNextPrevChild( bool next )
-{
- QFocusData *f = focusData();
-
- QWidget *startingPoint = f->home();
- QWidget *candidate = 0;
- QWidget *w = next ? f->next() : f->prev();
- while( !candidate && w != startingPoint ) {
- if ( w != startingPoint &&
- (w->focusPolicy() & TabFocus) == TabFocus
- && w->isEnabled() &&!w->focusProxy() && w->isVisible() )
- candidate = w;
- w = next ? f->next() : f->prev();
- }
-
- if ( candidate ) {
- QObjectList *ol = queryList();
- bool ischild = ol->findRef( candidate ) != -1;
- delete ol;
- if ( !ischild ) {
- startingPoint = f->home();
- QWidget *nw = next ? f->prev() : f->next();
- QObjectList *ol2 = queryList();
- QWidget *lastValid = 0;
- candidate = startingPoint;
- while ( nw != startingPoint ) {
- if ( ( candidate->focusPolicy() & TabFocus ) == TabFocus
- && candidate->isEnabled() &&!candidate->focusProxy() && candidate->isVisible() )
- lastValid = candidate;
- if ( ol2->findRef( nw ) == -1 ) {
- candidate = lastValid;
- break;
- }
- candidate = nw;
- nw = next ? f->prev() : f->next();
- }
- delete ol2;
- }
- }
-
- if ( !candidate )
- return FALSE;
-
- candidate->setFocus();
- return TRUE;
-}
-
-void QWorkspacePChild::childEvent( QChildEvent* e)
-{
- if ( e->type() == QEvent::ChildRemoved && e->child() == childWidget ) {
- childWidget = 0;
- if ( iconw ) {
- ((QWorkspaceP*)parentWidget())->removeIcon( iconw->parentWidget() );
- delete iconw->parentWidget();
- }
- close();
- }
-}
-
-
-void QWorkspacePChild::doResize()
-{
- widgetResizeHandler->doResize();
-}
-
-void QWorkspacePChild::doMove()
-{
- widgetResizeHandler->doMove();
-}
-
-void QWorkspacePChild::enterEvent( QEvent * )
-{
-}
-
-void QWorkspacePChild::leaveEvent( QEvent * )
-{
-#ifndef QT_NO_CURSOR
- if ( !widgetResizeHandler->isButtonDown() )
- setCursor( arrowCursor );
-#endif
-}
-
-void QWorkspacePChild::drawFrame( QPainter *p )
-{
- QStyle::SFlags flags = QStyle::Style_Default;
- QStyleOption opt(lineWidth(),midLineWidth());
-
- if ( act )
- flags |= QStyle::Style_Active;
-
- style().drawPrimitive( QStyle::PE_WindowFrame, p, rect(), colorGroup(), flags, opt );
-}
-
-void QWorkspacePChild::styleChange( QStyle & )
-{
- resizeEvent( 0 );
- if ( iconw ) {
- QVBox *vbox = (QVBox*)iconw->parentWidget()->qt_cast( "QVBox" );
- Q_ASSERT(vbox);
- if ( !style().styleHint( QStyle::SH_TitleBar_NoBorder ) ) {
- vbox->setFrameStyle( QFrame::WinPanel | QFrame::Raised );
- vbox->resize( 196+2*vbox->frameWidth(), 20 + 2*vbox->frameWidth() );
- } else {
- vbox->resize( 196, 20 );
- }
- }
-}
-
-static bool isChildOf( QWidget * child, QWidget * parent )
-{
- if ( !parent || !child )
- return FALSE;
- QWidget * w = child;
- while( w && w != parent )
- w = w->parentWidget();
- return w != 0;
-}
-
-
-void QWorkspacePChild::setActive( bool b )
-{
- if ( !childWidget )
- return;
-
- if ( act == b )
- return;
-
- act = b;
- repaint( FALSE );
-
- if ( titlebar )
- titlebar->setActive( act );
- if ( iconw )
- iconw->setActive( act );
-
- QObjectList* ol = childWidget->queryList( "QWidget" );
- if ( act ) {
- QObject *o;
- for ( o = ol->first(); o; o = ol->next() )
- o->removeEventFilter( this );
- bool hasFocus = isChildOf( focusWidget(), childWidget );
- if ( !hasFocus ) {
- if ( lastfocusw && ol->contains( lastfocusw ) &&
- lastfocusw->focusPolicy() != NoFocus ) {
- // this is a bug if lastfocusw has been deleted, a new
- // widget has been created, and the new one is a child
- // of the same window as the old one. but even though
- // it's a bug the behaviour is reasonable
- lastfocusw->setFocus();
- } else if ( childWidget->focusPolicy() != NoFocus ) {
- childWidget->setFocus();
- } else {
- // find something, anything, that accepts focus, and use that.
- o = ol->first();
- while( o && ((QWidget*)o)->focusPolicy() == NoFocus )
- o = ol->next();
- if ( o )
- ((QWidget*)o)->setFocus();
- }
- }
- } else {
- lastfocusw = 0;
- if ( isChildOf( focusWidget(), childWidget ) )
- lastfocusw = focusWidget();
- QObject * o;
- for ( o = ol->first(); o; o = ol->next() ) {
- o->removeEventFilter( this );
- o->installEventFilter( this );
- }
- }
- delete ol;
-}
-
-bool QWorkspacePChild::isActive() const
-{
- return act;
-}
-
-QWidget* QWorkspacePChild::windowWidget() const
-{
- return childWidget;
-}
-
-
-QWidget* QWorkspacePChild::iconWidget() const
-{
- if ( !iconw ) {
- QWorkspacePChild* that = (QWorkspacePChild*) this;
- QVBox* vbox = new QVBox(0, "qt_vbox" );
- if ( !style().styleHint( QStyle::SH_TitleBar_NoBorder ) ) {
- vbox->setFrameStyle( QFrame::WinPanel | QFrame::Raised );
- vbox->resize( 196+2*vbox->frameWidth(), 20 + 2*vbox->frameWidth() );
- } else {
- vbox->resize( 196, 20 );
- }
- QTitleBarP *tb = new QTitleBarP( windowWidget(), vbox, "_workspacechild_icon_");
- ((QWorkspacePChild*)tb)->setWState( WState_Minimized );
- that->iconw = tb;
- iconw->setActive( isActive() );
- connect( iconw, SIGNAL( doActivate() ),
- this, SLOT( activate() ) );
- connect( iconw, SIGNAL( doClose() ),
- windowWidget(), SLOT( close() ) );
- connect( iconw, SIGNAL( doNormal() ),
- this, SLOT( showNormal() ) );
- connect( iconw, SIGNAL( doMaximize() ),
- this, SLOT( showMaximized() ) );
- connect( iconw, SIGNAL( popupOperationMenu( const QPoint& ) ),
- this, SIGNAL( popupOperationMenu( const QPoint& ) ) );
- connect( iconw, SIGNAL( showOperationMenu() ),
- this, SIGNAL( showOperationMenu() ) );
- connect( iconw, SIGNAL( doubleClicked() ),
- this, SLOT( titleBarDoubleClicked() ) );
- }
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( windowWidget() ) {
- iconw->setCaption( windowWidget()->caption() );
- if ( windowWidget()->icon() )
- iconw->setIcon( *windowWidget()->icon() );
- }
-#endif
- return iconw->parentWidget();
-}
-
-void QWorkspacePChild::showMinimized()
-{
- QApplication::postEvent( windowWidget(), new QEvent( QEvent::ShowMinimized ) );
-}
-
-void QWorkspacePChild::showMaximized()
-{
- QApplication::postEvent( windowWidget(), new QEvent( QEvent::ShowMaximized ) );
-}
-
-void QWorkspacePChild::showNormal()
-{
- QApplication::postEvent( windowWidget(), new QEvent( QEvent::ShowNormal ) );
-}
-
-void QWorkspacePChild::showShaded()
-{
- if ( !titlebar)
- return;
- Q_ASSERT( windowWidget()->testWFlags( WStyle_MinMax ) && windowWidget()->testWFlags( WStyle_Tool ) );
- ((QWorkspaceP*)parentWidget())->activateWindow( windowWidget() );
- if ( shademode ) {
- QWorkspacePChild* fake = (QWorkspacePChild*)windowWidget();
- fake->clearWState( WState_Minimized );
- clearWState( WState_Minimized );
-
- shademode = FALSE;
- resize( shadeRestore );
- setMinimumSize( shadeRestoreMin );
- } else {
- shadeRestore = size();
- shadeRestoreMin = minimumSize();
- setMinimumHeight(0);
- shademode = TRUE;
- QWorkspacePChild* fake = (QWorkspacePChild*)windowWidget();
- fake->setWState( WState_Minimized );
- setWState( WState_Minimized );
-
- resize( width(), titlebar->height() + 2*lineWidth() + 1 );
- }
- titlebar->update();
-}
-
-void QWorkspacePChild::titleBarDoubleClicked()
-{
- if ( !windowWidget() )
- return;
- if ( windowWidget()->testWFlags( WStyle_MinMax ) ) {
- if ( windowWidget()->testWFlags( WStyle_Tool ) )
- showShaded();
- else if ( iconw )
- showNormal();
- else if ( windowWidget()->testWFlags( WStyle_Maximize ) )
- showMaximized();
- }
-}
-
-void QWorkspacePChild::adjustToFullscreen()
-{
- qApp->sendPostedEvents( this, QEvent::Resize );
- qApp->sendPostedEvents( childWidget, QEvent::Resize );
- qApp->sendPostedEvents( childWidget, QEvent::Move );
- if(style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this)) {
- setGeometry( 0, 0, parentWidget()->width(), parentWidget()->height());
- } else {
- setGeometry( -childWidget->x(), -childWidget->y(),
- parentWidget()->width() + width() - childWidget->width(),
- parentWidget()->height() + height() - childWidget->height() );
- }
- setWState( WState_Maximized );
- ((QWorkspacePChild*)childWidget)->setWState( WState_Maximized );
-}
-
-void QWorkspacePChild::adjustSize()
-{
- if ( !testWState(WState_Polished) )
- polish();
-
- QSize prefSize = windowWidget()->sizeHint().expandedTo( windowWidget()->minimumSizeHint() );
- prefSize = prefSize.expandedTo( windowWidget()->minimumSize() ).boundedTo( windowWidget()->maximumSize() );
- prefSize += baseSize();
-
- resize( prefSize );
-}
-
-void QWorkspacePChild::setCaption( const QString& cap )
-{
- if ( titlebar )
- titlebar->setCaption( cap );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- QWidget::setCaption( cap );
-#endif
-}
-
-void QWorkspacePChild::internalRaise()
-{
- setUpdatesEnabled( FALSE );
- if ( iconw )
- iconw->parentWidget()->raise();
- raise();
-
- if ( !windowWidget() || windowWidget()->testWFlags( WStyle_StaysOnTop ) ) {
- setUpdatesEnabled( TRUE );
- return;
- }
-
- QPtrListIterator<QWorkspacePChild> it( ((QWorkspaceP*)parent())->d->windows );
- while ( it.current () ) {
- QWorkspacePChild* c = it.current();
- ++it;
- if ( c->windowWidget() &&
- !c->windowWidget()->isHidden() &&
- c->windowWidget()->testWFlags( WStyle_StaysOnTop ) )
- c->raise();
- }
-
- setUpdatesEnabled( TRUE );
-}
-
-void QWorkspacePChild::move( int x, int y )
-{
- int nx = x;
- int ny = y;
-
- if ( windowWidget() && windowWidget()->testWFlags( WStyle_Tool ) ) {
- int dx = 10;
- int dy = 10;
-
- if ( QABS( x ) < dx )
- nx = 0;
- if ( QABS( y ) < dy )
- ny = 0;
- if ( QABS( x + width() - parentWidget()->width() ) < dx ) {
- nx = parentWidget()->width() - width();
- snappedRight = TRUE;
- } else
- snappedRight = FALSE;
-
- if ( QABS( y + height() - parentWidget()->height() ) < dy ) {
- ny = parentWidget()->height() - height();
- snappedDown = TRUE;
- } else
- snappedDown = FALSE;
- }
- QFrame::move( nx, ny );
-}
-
-bool QWorkspaceP::scrollBarsEnabled() const
-{
- return d->vbar != 0;
-}
-
-/*! \property QWorkspaceP::scrollBarsEnabled
- \brief whether the workspace provides scrollbars
-
- If this property is set to TRUE, it is possible to resize child
- windows over the right or the bottom edge out of the visible area
- of the workspace. The workspace shows scrollbars to make it
- possible for the user to access those windows. If this property is
- set to FALSE (the default), resizing windows out of the visible
- area of the workspace is not permitted.
-*/
-void QWorkspaceP::setScrollBarsEnabled( bool enable )
-{
- if ( (d->vbar != 0) == enable )
- return;
-
- d->xoffset = d->yoffset = 0;
- if ( enable ) {
- d->vbar = new QScrollBar( Vertical, this, "vertical scrollbar" );
- connect( d->vbar, SIGNAL( valueChanged(int) ), this, SLOT( scrollBarChanged() ) );
- d->hbar = new QScrollBar( Horizontal, this, "horizontal scrollbar" );
- connect( d->hbar, SIGNAL( valueChanged(int) ), this, SLOT( scrollBarChanged() ) );
- d->corner = new QWidget( this, "qt_corner" );
- updateWorkspace();
- } else {
- delete d->vbar;
- delete d->hbar;
- delete d->corner;
- d->vbar = d->hbar = 0;
- d->corner = 0;
- }
-
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild *child = it.current();
- ++it;
- child->widgetResizeHandler->setSizeProtection( !enable );
- }
-}
-
-QRect QWorkspaceP::updateWorkspace()
-{
- if ( !isUpdatesEnabled() )
- return rect();
-
- QRect cr( rect() );
-
- if ( scrollBarsEnabled() && !d->maxWindow ) {
- d->corner->raise();
- d->vbar->raise();
- d->hbar->raise();
- if ( d->maxWindow )
- d->maxWindow->raise();
-
- QRect r( 0, 0, 0, 0 );
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild *child = it.current();
- ++it;
- if ( !child->isHidden() )
- r = r.unite( child->geometry() );
- }
- d->vbar->blockSignals( TRUE );
- d->hbar->blockSignals( TRUE );
-
- int hsbExt = d->hbar->sizeHint().height();
- int vsbExt = d->vbar->sizeHint().width();
-
-
- bool showv = d->yoffset || d->yoffset + r.bottom() - height() + 1 > 0 || d->yoffset + r.top() < 0;
- bool showh = d->xoffset || d->xoffset + r.right() - width() + 1 > 0 || d->xoffset + r.left() < 0;
-
- if ( showh && !showv)
- showv = d->yoffset + r.bottom() - height() + hsbExt + 1 > 0;
- if ( showv && !showh )
- showh = d->xoffset + r.right() - width() + vsbExt + 1 > 0;
-
- if ( !showh )
- hsbExt = 0;
- if ( !showv )
- vsbExt = 0;
-
- if ( showv ) {
- d->vbar->setSteps( QMAX( height() / 12, 30 ), height() - hsbExt );
- d->vbar->setRange( QMIN( 0, d->yoffset + QMIN( 0, r.top() ) ), QMAX( 0, d->yoffset + QMAX( 0, r.bottom() - height() + hsbExt + 1) ) );
- d->vbar->setGeometry( width() - vsbExt, 0, vsbExt, height() - hsbExt );
- d->vbar->setValue( d->yoffset );
- d->vbar->show();
- } else {
- d->vbar->hide();
- }
-
- if ( showh ) {
- d->hbar->setSteps( QMAX( width() / 12, 30 ), width() - vsbExt );
- d->hbar->setRange( QMIN( 0, d->xoffset + QMIN( 0, r.left() ) ), QMAX( 0, d->xoffset + QMAX( 0, r.right() - width() + vsbExt + 1) ) );
- d->hbar->setGeometry( 0, height() - hsbExt, width() - vsbExt, hsbExt );
- d->hbar->setValue( d->xoffset );
- d->hbar->show();
- } else {
- d->hbar->hide();
- }
-
- if ( showh && showv ) {
- d->corner->setGeometry( width() - vsbExt, height() - hsbExt, vsbExt, hsbExt );
- d->corner->show();
- } else {
- d->corner->hide();
- }
-
- d->vbar->blockSignals( FALSE );
- d->hbar->blockSignals( FALSE );
-
- cr.setRect( 0, 0, width() - vsbExt, height() - hsbExt );
- }
-
- QPtrListIterator<QWidget> ii( d->icons );
- while ( ii.current() ) {
- QWorkspacePChild* w = (QWorkspacePChild*)ii.current();
- ++ii;
- int x = w->x();
- int y = w->y();
- bool m = FALSE;
- if ( x+w->width() > cr.width() ) {
- m = TRUE;
- x = cr.width() - w->width();
- }
- if ( y+w->height() > cr.height() ) {
- y = cr.height() - w->height();
- m = TRUE;
- }
- if ( m )
- w->move( x, y );
- }
-
- return cr;
-
-}
-
-void QWorkspaceP::scrollBarChanged()
-{
- int ver = d->yoffset - d->vbar->value();
- int hor = d->xoffset - d->hbar->value();
- d->yoffset = d->vbar->value();
- d->xoffset = d->hbar->value();
-
- QPtrListIterator<QWorkspacePChild> it( d->windows );
- while ( it.current () ) {
- QWorkspacePChild *child = it.current();
- ++it;
- // we do not use move() due to the reimplementation in QWorkspacePChild
- child->setGeometry( child->x() + hor, child->y() + ver, child->width(), child->height() );
- }
- updateWorkspace();
-}
-
-#ifndef QT_NO_STYLE
-/*!\reimp */
-void QWorkspaceP::styleChange( QStyle &olds )
-{
- int fs = style().styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this);
- if ( isVisibleTo(0) && d->maxWindow &&
- fs != olds.styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, this)) {
- if( fs )
- hideMaximizeControls();
- else
- showMaximizeControls();
- }
- QWidget::styleChange(olds);
-}
-#endif
-
-#define RANGE 4
-
-static bool resizeHorizontalDirectionFixed = FALSE;
-static bool resizeVerticalDirectionFixed = FALSE;
-
-QWidgetResizeHandlerP::QWidgetResizeHandlerP( QWidget *parent, QWidget *cw, const char *name )
- : QObject( parent, name ), widget( parent ), childWidget( cw ? cw : parent ),
- extrahei( 0 ), buttonDown( FALSE ), moveResizeMode( FALSE ), sizeprotect( TRUE ), moving( TRUE )
-{
- mode = Nowhere;
- widget->setMouseTracking( TRUE );
- range = widget->inherits( "QFrame" ) ? ((QFrame*)widget)->frameWidth() : RANGE;
- range = QMAX( RANGE, range );
- active = TRUE;
- qApp->installEventFilter( this );
-}
-
-static QWidget *childOf( QWidget *w, QWidget *child )
-{
- while ( child ) {
- if ( child == w )
- return child;
- child = child->parentWidget();
- }
- return 0;
-}
-
-bool QWidgetResizeHandlerP::eventFilter( QObject *o, QEvent *ee )
-{
- if ( !active || !o->isWidgetType() )
- return FALSE;
-
- QWidget *w = childOf( widget, (QWidget*)o );
- if ( !w || o->inherits( "QSizeGrip" ) )
- return FALSE;
-
- QMouseEvent *e = (QMouseEvent*)ee;
- switch ( e->type() ) {
- case QEvent::MouseButtonPress: {
- if ( w->isMaximized() )
- break;
- if ( !widget->rect().contains( widget->mapFromGlobal( e->globalPos() ) ) )
- return FALSE;
- if ( e->button() == LeftButton ) {
- emit activate();
- bool me = isMovingEnabled();
- setMovingEnabled( me && o == widget );
- mouseMoveEvent( e );
- setMovingEnabled( me );
- buttonDown = TRUE;
- moveOffset = widget->mapFromGlobal( e->globalPos() );
- invertedMoveOffset = widget->rect().bottomRight() - moveOffset;
- }
- } break;
- case QEvent::MouseButtonRelease:
- if ( w->isMaximized() )
- break;
- if ( e->button() == LeftButton ) {
- moveResizeMode = FALSE;
- buttonDown = FALSE;
- widget->releaseMouse();
- widget->releaseKeyboard();
- }
- break;
- case QEvent::MouseMove: {
- if ( w->isMaximized() )
- break;
- bool me = isMovingEnabled();
- setMovingEnabled( me && o == widget );
- mouseMoveEvent( e );
- setMovingEnabled( me );
- if ( buttonDown && mode != Center )
- return TRUE;
- } break;
- case QEvent::KeyPress:
- keyPressEvent( (QKeyEvent*)e );
- break;
- case QEvent::AccelOverride:
- if ( buttonDown ) {
- ((QKeyEvent*)ee)->accept();
- return TRUE;
- }
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-void QWidgetResizeHandlerP::mouseMoveEvent( QMouseEvent *e )
-{
- QPoint pos = widget->mapFromGlobal( e->globalPos() );
- if ( !moveResizeMode && ( !buttonDown || ( e->state() & LeftButton ) == 0 ) ) {
- if ( pos.y() <= range && pos.x() <= range)
- mode = TopLeft;
- else if ( pos.y() >= widget->height()-range && pos.x() >= widget->width()-range)
- mode = BottomRight;
- else if ( pos.y() >= widget->height()-range && pos.x() <= range)
- mode = BottomLeft;
- else if ( pos.y() <= range && pos.x() >= widget->width()-range)
- mode = TopRight;
- else if ( pos.y() <= range )
- mode = Top;
- else if ( pos.y() >= widget->height()-range )
- mode = Bottom;
- else if ( pos.x() <= range )
- mode = Left;
- else if ( pos.x() >= widget->width()-range )
- mode = Right;
- else
- mode = Center;
-
- if ( widget->isMinimized() )
- mode = Center;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
-#endif
- return;
- }
-
- if ( buttonDown && !isMovingEnabled() && mode == Center && !moveResizeMode )
- return;
-
- if ( widget->testWState( WState_ConfigPending ) )
- return;
-
- QPoint globalPos = widget->parentWidget( TRUE ) ?
- widget->parentWidget( TRUE )->mapFromGlobal( e->globalPos() ) : e->globalPos();
- if ( widget->parentWidget( TRUE ) && !widget->parentWidget( TRUE )->rect().contains( globalPos ) ) {
- if ( globalPos.x() < 0 )
- globalPos.rx() = 0;
- if ( globalPos.y() < 0 )
- globalPos.ry() = 0;
- if ( sizeprotect && globalPos.x() > widget->parentWidget()->width() )
- globalPos.rx() = widget->parentWidget()->width();
- if ( sizeprotect && globalPos.y() > widget->parentWidget()->height() )
- globalPos.ry() = widget->parentWidget()->height();
- }
-
- QPoint p = globalPos + invertedMoveOffset;
- QPoint pp = globalPos - moveOffset;
-
- int fw = 0;
- int mw = QMAX( childWidget->minimumSizeHint().width(),
- childWidget->minimumWidth() );
- int mh = QMAX( childWidget->minimumSizeHint().height(),
- childWidget->minimumHeight() );
- if ( childWidget != widget ) {
- if ( widget->inherits( "QFrame" ) )
- fw = ( (QFrame *) widget )->frameWidth();
- mw += 2 * fw;
- mh += 2 * fw + extrahei;
- }
-
- QSize mpsize( widget->geometry().right() - pp.x() + 1,
- widget->geometry().bottom() - pp.y() + 1 );
- mpsize = mpsize.expandedTo( widget->minimumSize() ).expandedTo( QSize(mw, mh) );
- QPoint mp( widget->geometry().right() - mpsize.width() + 1,
- widget->geometry().bottom() - mpsize.height() + 1 );
-
- QRect geom = widget->geometry();
-
- switch ( mode ) {
- case TopLeft:
- geom = QRect( mp, widget->geometry().bottomRight() ) ;
- break;
- case BottomRight:
- geom = QRect( widget->geometry().topLeft(), p ) ;
- break;
- case BottomLeft:
- geom = QRect( QPoint(mp.x(), widget->geometry().y() ), QPoint( widget->geometry().right(), p.y()) ) ;
- break;
- case TopRight:
- geom = QRect( QPoint( widget->geometry().x(), mp.y() ), QPoint( p.x(), widget->geometry().bottom()) ) ;
- break;
- case Top:
- geom = QRect( QPoint( widget->geometry().left(), mp.y() ), widget->geometry().bottomRight() ) ;
- break;
- case Bottom:
- geom = QRect( widget->geometry().topLeft(), QPoint( widget->geometry().right(), p.y() ) ) ;
- break;
- case Left:
- geom = QRect( QPoint( mp.x(), widget->geometry().top() ), widget->geometry().bottomRight() ) ;
- break;
- case Right:
- geom = QRect( widget->geometry().topLeft(), QPoint( p.x(), widget->geometry().bottom() ) ) ;
- break;
- case Center:
- if ( isMovingEnabled() || moveResizeMode )
- geom.moveTopLeft( pp );
- break;
- default:
- break;
- }
-
- QSize maxsize( childWidget->maximumSize() );
- if ( childWidget != widget )
- maxsize += QSize( 2 * fw, 2 * fw + extrahei );
-
- geom = QRect( geom.topLeft(),
- geom.size().expandedTo( widget->minimumSize() )
- .expandedTo( QSize(mw, mh) )
- .boundedTo( maxsize ) );
-
- if ( geom != widget->geometry() &&
- ( widget->isTopLevel() || widget->parentWidget()->rect().intersects( geom ) ) ) {
- if ( widget->isMinimized() )
- widget->move( geom.topLeft() );
- else
- widget->setGeometry( geom );
- }
-
-#if defined(Q_WS_WIN)
- MSG msg;
-#if defined(UNICODE)
-# ifndef Q_OS_TEMP
- if ( qWinVersion() & WV_NT_based ) {
-# endif
- while(PeekMessageW( &msg, widget->winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ))
- ;
-# ifndef Q_OS_TEMP
- } else
-# endif
-#endif
-#ifndef Q_OS_TEMP
- {
- while(PeekMessageA( &msg, widget->winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ))
- ;
- }
-#endif
-#endif
-
- QApplication::syncX();
-}
-
-void QWidgetResizeHandlerP::setMouseCursor( MousePosition m )
-{
-#ifndef QT_NO_CURSOR
- switch ( m ) {
- case TopLeft:
- case BottomRight:
- widget->setCursor( sizeFDiagCursor );
- break;
- case BottomLeft:
- case TopRight:
- widget->setCursor( sizeBDiagCursor );
- break;
- case Top:
- case Bottom:
- widget->setCursor( sizeVerCursor );
- break;
- case Left:
- case Right:
- widget->setCursor( sizeHorCursor );
- break;
- default:
- widget->setCursor( arrowCursor );
- break;
- }
-#endif
-}
-
-void QWidgetResizeHandlerP::keyPressEvent( QKeyEvent * e )
-{
- if ( !isMove() && !isResize() )
- return;
- bool is_control = e->state() & ControlButton;
- int delta = is_control?1:8;
- QPoint pos = QCursor::pos();
- switch ( e->key() ) {
- case Key_Left:
- pos.rx() -= delta;
- if ( pos.x() <= QApplication::desktop()->geometry().left() ) {
- if ( mode == TopLeft || mode == BottomLeft ) {
- moveOffset.rx() += delta;
- invertedMoveOffset.rx() += delta;
- } else {
- moveOffset.rx() -= delta;
- invertedMoveOffset.rx() -= delta;
- }
- }
- if ( isResize() && !resizeHorizontalDirectionFixed ) {
- resizeHorizontalDirectionFixed = TRUE;
- if ( mode == BottomRight )
- mode = BottomLeft;
- else if ( mode == TopRight )
- mode = TopLeft;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
- widget->grabMouse( widget->cursor() );
-#else
- widget->grabMouse();
-#endif
- }
- break;
- case Key_Right:
- pos.rx() += delta;
- if ( pos.x() >= QApplication::desktop()->geometry().right() ) {
- if ( mode == TopRight || mode == BottomRight ) {
- moveOffset.rx() += delta;
- invertedMoveOffset.rx() += delta;
- } else {
- moveOffset.rx() -= delta;
- invertedMoveOffset.rx() -= delta;
- }
- }
- if ( isResize() && !resizeHorizontalDirectionFixed ) {
- resizeHorizontalDirectionFixed = TRUE;
- if ( mode == BottomLeft )
- mode = BottomRight;
- else if ( mode == TopLeft )
- mode = TopRight;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
- widget->grabMouse( widget->cursor() );
-#else
- widget->grabMouse();
-#endif
- }
- break;
- case Key_Up:
- pos.ry() -= delta;
- if ( pos.y() <= QApplication::desktop()->geometry().top() ) {
- if ( mode == TopLeft || mode == TopRight ) {
- moveOffset.ry() += delta;
- invertedMoveOffset.ry() += delta;
- } else {
- moveOffset.ry() -= delta;
- invertedMoveOffset.ry() -= delta;
- }
- }
- if ( isResize() && !resizeVerticalDirectionFixed ) {
- resizeVerticalDirectionFixed = TRUE;
- if ( mode == BottomLeft )
- mode = TopLeft;
- else if ( mode == BottomRight )
- mode = TopRight;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
- widget->grabMouse( widget->cursor() );
-#else
- widget->grabMouse();
-#endif
- }
- break;
- case Key_Down:
- pos.ry() += delta;
- if ( pos.y() >= QApplication::desktop()->geometry().bottom() ) {
- if ( mode == BottomLeft || mode == BottomRight ) {
- moveOffset.ry() += delta;
- invertedMoveOffset.ry() += delta;
- } else {
- moveOffset.ry() -= delta;
- invertedMoveOffset.ry() -= delta;
- }
- }
- if ( isResize() && !resizeVerticalDirectionFixed ) {
- resizeVerticalDirectionFixed = TRUE;
- if ( mode == TopLeft )
- mode = BottomLeft;
- else if ( mode == TopRight )
- mode = BottomRight;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
- widget->grabMouse( widget->cursor() );
-#else
- widget->grabMouse();
-#endif
- }
- break;
- case Key_Space:
- case Key_Return:
- case Key_Enter:
- case Key_Escape:
- moveResizeMode = FALSE;
- widget->releaseMouse();
- widget->releaseKeyboard();
- buttonDown = FALSE;
- break;
- default:
- return;
- }
- QCursor::setPos( pos );
-}
-
-
-void QWidgetResizeHandlerP::doResize()
-{
- if ( !active )
- return;
-
- moveResizeMode = TRUE;
- buttonDown = TRUE;
- moveOffset = widget->mapFromGlobal( QCursor::pos() );
- if ( moveOffset.x() < widget->width()/2) {
- if ( moveOffset.y() < widget->height()/2)
- mode = TopLeft;
- else
- mode = BottomLeft;
- } else {
- if ( moveOffset.y() < widget->height()/2)
- mode = TopRight;
- else
- mode = BottomRight;
- }
- invertedMoveOffset = widget->rect().bottomRight() - moveOffset;
-#ifndef QT_NO_CURSOR
- setMouseCursor( mode );
- widget->grabMouse( widget->cursor() );
-#else
- widget->grabMouse();
-#endif
- widget->grabKeyboard();
- resizeHorizontalDirectionFixed = FALSE;
- resizeVerticalDirectionFixed = FALSE;
-}
-
-void QWidgetResizeHandlerP::doMove()
-{
- if ( !active )
- return;
-
- mode = Center;
- moveResizeMode = TRUE;
- buttonDown = TRUE;
- moveOffset = widget->mapFromGlobal( QCursor::pos() );
- invertedMoveOffset = widget->rect().bottomRight() - moveOffset;
-#ifndef QT_NO_CURSOR
- widget->grabMouse( SizeAllCursor );
-#else
- widget->grabMouse();
-#endif
- widget->grabKeyboard();
-}
-
-#ifndef QT_NO_TOOLTIP
-class QTitleBarPTip : public QToolTip
-{
-public:
- QTitleBarPTip( QWidget * parent ) : QToolTip( parent ) { }
-
- void maybeTip( const QPoint &pos )
- {
- if ( !parentWidget()->inherits( "QTitleBarP" ) )
- return;
- QTitleBarP *t = (QTitleBarP *)parentWidget();
-
- QString tipstring;
- QStyle::SubControl ctrl = t->style().querySubControl(QStyle::CC_TitleBar, t, pos);
- QSize controlSize = t->style().querySubControlMetrics(QStyle::CC_TitleBar, t, ctrl).size();
-
- QWidget *window = t->window();
- if ( window ) {
- switch(ctrl) {
- case QStyle::SC_TitleBarSysMenu:
- if ( t->testWFlags( WStyle_SysMenu ) )
- tipstring = QTitleBarP::tr( "System Menu" );
- break;
-
- case QStyle::SC_TitleBarShadeButton:
- if ( t->testWFlags( WStyle_Tool ) && t->testWFlags( WStyle_MinMax ) )
- tipstring = QTitleBarP::tr( "Shade" );
- break;
-
- case QStyle::SC_TitleBarUnshadeButton:
- if ( t->testWFlags( WStyle_Tool ) && t->testWFlags( WStyle_MinMax ) )
- tipstring = QTitleBarP::tr( "Unshade" );
- break;
-
- case QStyle::SC_TitleBarNormalButton:
- case QStyle::SC_TitleBarMinButton:
- if ( !t->testWFlags( WStyle_Tool ) && t->testWFlags( WStyle_Minimize ) ) {
- if( window->isMinimized() )
- tipstring = QTitleBarP::tr( "Normalize" );
- else
- tipstring = QTitleBarP::tr( "Minimize" );
- }
- break;
-
- case QStyle::SC_TitleBarMaxButton:
- if ( !t->testWFlags( WStyle_Tool ) && t->testWFlags( WStyle_Maximize ) )
- tipstring = QTitleBarP::tr( "Maximize" );
- break;
-
- case QStyle::SC_TitleBarCloseButton:
- if ( t->testWFlags( WStyle_SysMenu ) )
- tipstring = QTitleBarP::tr( "Close" );
- break;
-
- default:
- break;
- }
- }
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if ( tipstring.isEmpty() ) {
- if ( t->visibleText() != t->caption() )
- tipstring = t->caption();
- }
-#endif
- if(!tipstring.isEmpty())
- tip( QRect(pos, controlSize), tipstring );
- }
-};
-#endif
-
-class QTitleBarPPrivate
-{
-public:
- QTitleBarPPrivate()
- : toolTip( 0 ), act( 0 ), window( 0 ), movable( 1 ), pressed( 0 ), autoraise(0)
- {
- }
-
- QStyle::SCFlags buttonDown;
- QPoint moveOffset;
- QToolTip *toolTip;
- bool act :1;
- QWidget* window;
- bool movable :1;
- bool pressed :1;
- bool autoraise :1;
- QString cuttext;
-};
-
-QTitleBarP::QTitleBarP(QWidget* w, QWidget* parent, const char* name)
- : QWidget( parent, name, WStyle_Customize | WStyle_NoBorder | WResizeNoErase | WRepaintNoErase )
-{
- d = new QTitleBarPPrivate();
-
-#ifndef QT_NO_TOOLTIP
- d->toolTip = new QTitleBarPTip( this );
-#endif
- d->window = w;
- d->buttonDown = QStyle::SC_None;
- d->act = 0;
- if ( w ) {
- setWFlags( ((QTitleBarP*)w)->getWFlags() | WResizeNoErase | WRepaintNoErase );
-#ifndef QT_NO_WIDGET_TOPEXTRA
- setCaption( w->caption() );
-#endif
- } else {
- setWFlags( WStyle_Customize | WResizeNoErase | WRepaintNoErase );
- }
-
- readColors();
- setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- setMouseTracking(TRUE);
-}
-
-QTitleBarP::~QTitleBarP()
-{
-#ifndef QT_NO_TOOLTIP
- delete d->toolTip;
-#endif
-
- delete d;
- d = 0;
-}
-
-#ifdef Q_WS_WIN
-extern QRgb qt_colorref2qrgb(COLORREF col);
-#endif
-
-void QTitleBarP::readColors()
-{
- QPalette pal = palette();
-
-#ifdef Q_WS_WIN // ask system properties on windows
-#ifndef SPI_GETGRADIENTCAPTIONS
-#define SPI_GETGRADIENTCAPTIONS 0x1008
-#endif
-#ifndef COLOR_GRADIENTACTIVECAPTION
-#define COLOR_GRADIENTACTIVECAPTION 27
-#endif
-#ifndef COLOR_GRADIENTINACTIVECAPTION
-#define COLOR_GRADIENTINACTIVECAPTION 28
-#endif
- if ( QApplication::desktopSettingsAware() ) {
- pal.setColor( QPalette::Active, QColorGroup::Highlight, qt_colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)) );
- pal.setColor( QPalette::Inactive, QColorGroup::Highlight, qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)) );
- pal.setColor( QPalette::Active, QColorGroup::HighlightedText, qt_colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)) );
- pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText, qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)) );
- if ( qt_winver != Qt::WV_95 && qt_winver != WV_NT ) {
- BOOL gradient;
-#ifdef Q_OS_TEMP
- SystemParametersInfo( SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0 );
-#else
-#if defined(UNICODE)
- if ( qt_winver & Qt::WV_NT_based )
- SystemParametersInfo( SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0 );
- else
-#endif
- SystemParametersInfoA( SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0 );
-#endif
- if ( gradient ) {
- pal.setColor( QPalette::Active, QColorGroup::Base, qt_colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)) );
- pal.setColor( QPalette::Inactive, QColorGroup::Base, qt_colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)) );
- } else {
- pal.setColor( QPalette::Active, QColorGroup::Base, palette().active().highlight() );
- pal.setColor( QPalette::Inactive, QColorGroup::Base, palette().inactive().highlight() );
- }
- }
- } else
-#endif // Q_WS_WIN
- {
- pal.setColor( QPalette::Active, QColorGroup::Highlight, palette().active().highlight() );
- pal.setColor( QPalette::Active, QColorGroup::Base, palette().active().highlight() );
- pal.setColor( QPalette::Inactive, QColorGroup::Highlight, palette().inactive().dark() );
- pal.setColor( QPalette::Inactive, QColorGroup::Base, palette().inactive().dark() );
- pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText, palette().inactive().background() );
- }
-
- setPalette( pal );
- setActive( d->act );
-}
-
-void QTitleBarP::mousePressEvent( QMouseEvent * e)
-{
- emit doActivate();
- if ( e->button() == LeftButton ) {
- d->pressed = TRUE;
- QStyle::SCFlags ctrl = style().querySubControl(QStyle::CC_TitleBar, this, e->pos());
- switch (ctrl) {
- case QStyle::SC_TitleBarSysMenu:
- if ( testWFlags( WStyle_SysMenu ) && !testWFlags( WStyle_Tool ) ) {
- d->buttonDown = QStyle::SC_None;
- static QTime* t = 0;
- static QTitleBarP* tc = 0;
- if ( !t )
- t = new QTime;
- if ( tc != this || t->elapsed() > QApplication::doubleClickInterval() ) {
- emit showOperationMenu();
- t->start();
- tc = this;
- } else {
- tc = 0;
- emit doClose();
- return;
- }
- }
- break;
-
- case QStyle::SC_TitleBarShadeButton:
- case QStyle::SC_TitleBarUnshadeButton:
- if ( testWFlags( WStyle_MinMax ) && testWFlags( WStyle_Tool ) )
- d->buttonDown = ctrl;
- break;
-
- case QStyle::SC_TitleBarNormalButton:
- if( testWFlags( WStyle_Minimize ) && !testWFlags( WStyle_Tool ) )
- d->buttonDown = ctrl;
- break;
-
- case QStyle::SC_TitleBarMinButton:
- if( testWFlags( WStyle_Minimize ) && !testWFlags( WStyle_Tool ) )
- d->buttonDown = ctrl;
- break;
-
- case QStyle::SC_TitleBarMaxButton:
- if ( testWFlags( WStyle_Maximize ) && !testWFlags( WStyle_Tool ) )
- d->buttonDown = ctrl;
- break;
-
- case QStyle::SC_TitleBarCloseButton:
- if ( testWFlags( WStyle_SysMenu ) )
- d->buttonDown = ctrl;
- break;
-
- case QStyle::SC_TitleBarLabel:
- d->buttonDown = ctrl;
- d->moveOffset = mapToParent( e->pos() );
- break;
-
- default:
- break;
- }
- repaint( FALSE );
- } else {
- d->pressed = FALSE;
- }
-}
-
-void QTitleBarP::contextMenuEvent( QContextMenuEvent *e )
-{
- QStyle::SCFlags ctrl = style().querySubControl(QStyle::CC_TitleBar, this, e->pos());
- if( ctrl == QStyle::SC_TitleBarLabel || ctrl == QStyle::SC_TitleBarSysMenu ) {
- emit popupOperationMenu(e->globalPos());
- e->accept();
- }
-}
-
-void QTitleBarP::mouseReleaseEvent( QMouseEvent * e)
-{
- if ( e->button() == LeftButton && d->pressed) {
- QStyle::SCFlags ctrl = style().querySubControl(QStyle::CC_TitleBar, this, e->pos());
-
- if (ctrl == d->buttonDown) {
- switch(ctrl) {
- case QStyle::SC_TitleBarShadeButton:
- case QStyle::SC_TitleBarUnshadeButton:
- if( testWFlags( WStyle_MinMax ) && testWFlags( WStyle_Tool ) )
- emit doShade();
- break;
-
- case QStyle::SC_TitleBarNormalButton:
- if( testWFlags( WStyle_MinMax ) && !testWFlags( WStyle_Tool ) )
- emit doNormal();
- break;
-
- case QStyle::SC_TitleBarMinButton:
- if( testWFlags( WStyle_Minimize ) && !testWFlags( WStyle_Tool ) )
- emit doMinimize();
- break;
-
- case QStyle::SC_TitleBarMaxButton:
- if( d->window && testWFlags( WStyle_Maximize ) && !testWFlags( WStyle_Tool ) ) {
- if(d->window->isMaximized())
- emit doNormal();
- else
- emit doMaximize();
- }
- break;
-
- case QStyle::SC_TitleBarCloseButton:
- if( testWFlags( WStyle_SysMenu ) ) {
- d->buttonDown = QStyle::SC_None;
- repaint(FALSE);
- emit doClose();
- return;
- }
- break;
-
- default:
- break;
- }
- }
- d->buttonDown = QStyle::SC_None;
- repaint(FALSE);
- d->pressed = FALSE;
- }
-}
-
-void QTitleBarP::mouseMoveEvent( QMouseEvent * e)
-{
- switch (d->buttonDown) {
- case QStyle::SC_None:
- if(autoRaise())
- repaint( FALSE );
- break;
- case QStyle::SC_TitleBarSysMenu:
- break;
- case QStyle::SC_TitleBarShadeButton:
- case QStyle::SC_TitleBarUnshadeButton:
- case QStyle::SC_TitleBarNormalButton:
- case QStyle::SC_TitleBarMinButton:
- case QStyle::SC_TitleBarMaxButton:
- case QStyle::SC_TitleBarCloseButton:
- {
- QStyle::SCFlags last_ctrl = d->buttonDown;
- d->buttonDown = style().querySubControl(QStyle::CC_TitleBar, this, e->pos());
- if( d->buttonDown != last_ctrl)
- d->buttonDown = QStyle::SC_None;
- repaint(FALSE);
- d->buttonDown = last_ctrl;
- }
- break;
-
- case QStyle::SC_TitleBarLabel:
- if ( d->buttonDown == QStyle::SC_TitleBarLabel && d->movable && d->pressed ) {
- if ( (d->moveOffset - mapToParent( e->pos() ) ).manhattanLength() >= 4 ) {
- QPoint p = mapFromGlobal(e->globalPos());
-#ifndef QT_NO_WORKSPACE
- if(d->window && d->window->parentWidget()->inherits("QWorkspacePChild")) {
- QWidget *w = d->window->parentWidget()->parentWidget();
- if(w && w->inherits("QWorkspaceP")) {
- QWorkspaceP *workspace = (QWorkspaceP*)w;
- p = workspace->mapFromGlobal( e->globalPos() );
- if ( !workspace->rect().contains(p) ) {
- if ( p.x() < 0 )
- p.rx() = 0;
- if ( p.y() < 0 )
- p.ry() = 0;
- if ( p.x() > workspace->width() )
- p.rx() = workspace->width();
- if ( p.y() > workspace->height() )
- p.ry() = workspace->height();
- }
- }
- }
-#endif
- QPoint pp = p - d->moveOffset;
- parentWidget()->move( pp );
- }
- } else {
- QStyle::SCFlags last_ctrl = d->buttonDown;
- d->buttonDown = QStyle::SC_None;
- if( d->buttonDown != last_ctrl)
- repaint(FALSE);
- }
- break;
- }
-}
-
-void QTitleBarP::resizeEvent( QResizeEvent *r)
-{
- QWidget::resizeEvent(r);
- cutText();
-}
-
-void QTitleBarP::paintEvent(QPaintEvent *)
-{
- QStyle::SCFlags ctrls = QStyle::SC_TitleBarLabel;
- if ( testWFlags( WStyle_SysMenu) ) {
- if ( testWFlags( WStyle_Tool ) ) {
- ctrls |= QStyle::SC_TitleBarCloseButton;
- if ( d->window && testWFlags( WStyle_MinMax ) ) {
- if ( d->window->isMinimized() )
- ctrls |= QStyle::SC_TitleBarUnshadeButton;
- else
- ctrls |= QStyle::SC_TitleBarShadeButton;
- }
- } else {
- ctrls |= QStyle::SC_TitleBarSysMenu | QStyle::SC_TitleBarCloseButton;
- if ( d->window && testWFlags( WStyle_Minimize ) ) {
- if( d->window && d->window->isMinimized() )
- ctrls |= QStyle::SC_TitleBarNormalButton;
- else
- ctrls |= QStyle::SC_TitleBarMinButton;
- }
- if ( d->window && testWFlags( WStyle_Maximize ) && !d->window->isMaximized() )
- ctrls |= QStyle::SC_TitleBarMaxButton;
- }
- }
-
- QStyle::SCFlags under_mouse = QStyle::SC_None;
- if( autoRaise() && hasMouse() ) {
- QPoint p(mapFromGlobal(QCursor::pos()));
- under_mouse = style().querySubControl(QStyle::CC_TitleBar, this, p);
- ctrls ^= under_mouse;
- }
-
- // QSharedDoubleBuffer buffer( (bool)FALSE, (bool)FALSE );
- // buffer.begin( this, rect() );
- QSharedDoubleBuffer buffer( this, rect() );
- style().drawComplexControl(QStyle::CC_TitleBar, buffer.painter(), this, rect(),
- colorGroup(),
- isEnabled() ? QStyle::Style_Enabled :
- QStyle::Style_Default, ctrls, d->buttonDown);
- if(under_mouse != QStyle::SC_None)
- style().drawComplexControl(QStyle::CC_TitleBar, buffer.painter(), this, rect(),
- colorGroup(),
- QStyle::Style_MouseOver |
- (isEnabled() ? QStyle::Style_Enabled : 0),
- under_mouse, d->buttonDown);
-}
-
-void QTitleBarP::mouseDoubleClickEvent( QMouseEvent *e )
-{
- if ( e->button() != LeftButton )
- return;
-
- switch(style().querySubControl(QStyle::CC_TitleBar, this, e->pos())) {
- case QStyle::SC_TitleBarLabel:
- emit doubleClicked();
- break;
-
- case QStyle::SC_TitleBarSysMenu:
- if ( testWFlags( WStyle_SysMenu ) )
- emit doClose();
- break;
-
- default:
- break;
- }
-}
-
-void QTitleBarP::cutText()
-{
-#ifndef QT_NO_WIDGET_TOPEXTRA
- QFontMetrics fm( font() );
-
- int maxw = style().querySubControlMetrics(QStyle::CC_TitleBar, this,
- QStyle::SC_TitleBarLabel).width();
- if ( !d->window )
- maxw = width() - 20;
- const QString txt = caption();
- d->cuttext = txt;
- if ( fm.width( txt + "m" ) > maxw ) {
- int i = txt.length();
- int dotlength = fm.width( "..." );
- while ( i>0 && fm.width(txt.left( i )) + dotlength > maxw )
- i--;
- if(i != (int)txt.length())
- d->cuttext = txt.left( i ) + "...";
- }
-#endif
-}
-
-void QTitleBarP::setCaption( const QString& title )
-{
-#ifndef QT_NO_WIDGET_TOPEXTRA
- if( caption() == title)
- return;
- QWidget::setCaption( title );
- cutText();
-
- update();
-#endif
-}
-
-
-void QTitleBarP::setIcon( const QPixmap& icon )
-{
-#ifndef QT_NO_WIDGET_TOPEXTRA
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
- QRect menur = style().querySubControlMetrics(QStyle::CC_TitleBar, this,
- QStyle::SC_TitleBarSysMenu);
-
- QPixmap theIcon;
- if (icon.width() > menur.width()) {
- // try to keep something close to the same aspect
- int aspect = (icon.height() * 100) / icon.width();
- int newh = (aspect * menur.width()) / 100;
- theIcon.convertFromImage( icon.convertToImage().smoothScale(menur.width(),
- newh) );
- } else if (icon.height() > menur.height()) {
- // try to keep something close to the same aspect
- int aspect = (icon.width() * 100) / icon.height();
- int neww = (aspect * menur.height()) / 100;
- theIcon.convertFromImage( icon.convertToImage().smoothScale(neww,
- menur.height()) );
- } else
- theIcon = icon;
-
- QWidget::setIcon( theIcon );
-#else
- QWidget::setIcon( icon );
-#endif
-
- update();
-#endif
-}
-
-void QTitleBarP::leaveEvent( QEvent * )
-{
- if(autoRaise() && !d->pressed)
- repaint( FALSE );
-}
-
-void QTitleBarP::enterEvent( QEvent * )
-{
- if(autoRaise() && !d->pressed)
- repaint( FALSE );
- QEvent e( QEvent::Leave );
- QApplication::sendEvent( parentWidget(), &e );
-}
-
-void QTitleBarP::setActive( bool active )
-{
- if ( d->act == active )
- return ;
-
- d->act = active;
- update();
-}
-
-bool QTitleBarP::isActive() const
-{
- return d->act;
-}
-
-bool QTitleBarP::usesActiveColor() const
-{
- return ( isActive() && isActiveWindow() ) ||
- ( !window() && topLevelWidget()->isActiveWindow() );
-}
-
-QString QTitleBarP::visibleText() const
-{
- return d->cuttext;
-}
-
-QWidget *QTitleBarP::window() const
-{
- return d->window;
-}
-
-bool QTitleBarP::event( QEvent* e )
-{
- if ( e->type() == QEvent::ApplicationPaletteChange ) {
- readColors();
- return TRUE;
- } else if ( e->type() == QEvent::WindowActivate ) {
- setActive( d->act );
- } else if ( e->type() == QEvent::WindowDeactivate ) {
- bool wasActive = d->act;
- setActive( FALSE );
- d->act = wasActive;
- }
-
- return QWidget::event( e );
-}
-
-void QTitleBarP::setMovable(bool b)
-{
- d->movable = b;
-}
-
-bool QTitleBarP::isMovable() const
-{
- return d->movable;
-}
-
-void QTitleBarP::setAutoRaise(bool b)
-{
- d->autoraise = b;
-}
-
-bool QTitleBarP::autoRaise() const
-{
- return d->autoraise;
-}
-
-QSize QTitleBarP::sizeHint() const
-{
- constPolish();
- QRect menur = style().querySubControlMetrics(QStyle::CC_TitleBar, this,
- QStyle::SC_TitleBarSysMenu);
- return QSize( menur.width(), style().pixelMetric( QStyle::PM_TitleBarHeight, this ) );
-}
-
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Module : PatchQt
-// File : qworkspaceP.h
-// Description : the patch for Qt's QWorkspace class (qworkspace.h)
-/////////////////////////////////////////////////////////////////////////////
-
-/****************************************************************************
-** $Id$
-**
-** Definition of the QWorkspace class
-**
-** Created : 990210
-**
-** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
-**
-** This file is part of the workspace module of the Qt GUI Toolkit.
-**
-** This file may be distributed under the terms of the Q Public License
-** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid Qt Enterprise Edition licenses may use this
-** file in accordance with the Qt Commercial License Agreement provided
-** with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-#ifndef QWORKSPACEP_H
-#define QWORKSPACEP_H
-
-#ifndef QT_H
-#include <qobject.h>
-#include <qwidget.h>
-#include <qwidgetlist.h>
-#include <qframe.h>
-#include <qguardedptr.h>
-#include <qbutton.h>
-#include <qlabel.h>
-#endif // QT_H
-
-class QWorkspacePChild;
-class QShowEvent;
-class QWorkspacePPrivate;
-class QPopupMenu;
-class QWidgetResizeHandlerP;
-class QTitleBarP;
-
-class Q_EXPORT QWorkspaceP : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY( bool scrollBarsEnabled READ scrollBarsEnabled WRITE setScrollBarsEnabled )
-public:
- QWorkspaceP( QWidget* parent=0, const char* name=0 );
- ~QWorkspaceP();
-
- QWidget* activeWindow() const;
- QWidgetList windowList() const;
-
- QSize sizeHint() const;
-
- bool scrollBarsEnabled() const;
- void setScrollBarsEnabled( bool enable );
-
- void setPaletteBackgroundColor( const QColor & );
- void setPaletteBackgroundPixmap( const QPixmap & );
-
-signals:
- void windowActivated( QWidget* w);
-
-public slots:
- void cascade();
- void tile();
-
-protected:
-#ifndef QT_NO_STYLE
- void styleChange( QStyle& );
-#endif
- void childEvent( QChildEvent * );
- void resizeEvent( QResizeEvent * );
- bool eventFilter( QObject *, QEvent * );
- void showEvent( QShowEvent *e );
- void hideEvent( QHideEvent *e );
-#ifndef QT_NO_WHEELEVENT
- void wheelEvent( QWheelEvent *e );
-#endif
-
-private slots:
- void closeActiveWindow();
- void closeAllWindows();
- void normalizeActiveWindow();
- void minimizeActiveWindow();
- void showOperationMenu();
- void popupOperationMenu( const QPoint& );
- void operationMenuActivated( int );
- void operationMenuAboutToShow();
- void toolMenuAboutToShow();
- void scrollBarChanged();
-public slots:
- void activateNextWindow();
- void activatePreviousWindow();
-
-public:
- void activateWindow( QWidget* w, bool change_focus = TRUE );
-
-private:
- void insertIcon( QWidget* w);
- void removeIcon( QWidget* w);
- void place( QWidget* );
-
- QWorkspacePChild* findChild( QWidget* w);
- void showMaximizeControls();
- void hideMaximizeControls();
- void showWindow( QWidget* w);
- void maximizeWindow( QWidget* w);
- void minimizeWindow( QWidget* w);
- void normalizeWindow( QWidget* w);
-
- QRect updateWorkspace();
-
- QPopupMenu* popup;
- QWorkspacePPrivate* d;
-
- friend class QWorkspacePChild;
-
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QWorkspaceP( const QWorkspaceP & );
- QWorkspaceP& operator=( const QWorkspaceP & );
-#endif
-};
-
-class QWorkspacePChild : public QFrame
-{
- Q_OBJECT
-
- friend class QWorkspaceP;
- friend class QTitleBarP;
-
-public:
- QWorkspacePChild( QWidget* window,
- QWorkspaceP* parent=0, const char* name=0 );
- ~QWorkspacePChild();
-
- void setActive( bool );
- bool isActive() const;
-
- void adjustToFullscreen();
- void adjustSize();
-
- QWidget* windowWidget() const;
- QWidget* iconWidget() const;
-
- void doResize();
- void doMove();
-
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
-
- QSize baseSize() const;
-
-signals:
- void showOperationMenu();
- void popupOperationMenu( const QPoint& );
-
-public slots:
- void activate();
- void showMinimized();
- void showMaximized();
- void showNormal();
- void showShaded();
- void setCaption( const QString& );
- void internalRaise();
- void titleBarDoubleClicked();
-
- void move( int x, int y );
-
-protected:
- void enterEvent( QEvent * );
- void leaveEvent( QEvent * );
- void childEvent( QChildEvent* );
- void resizeEvent( QResizeEvent * );
- void moveEvent( QMoveEvent * );
- bool eventFilter( QObject *, QEvent * );
-
- bool focusNextPrevChild( bool );
-
- void drawFrame( QPainter * );
- void styleChange( QStyle & );
-
-private:
- QWidget* childWidget;
- QWidget* lastfocusw;
- QWidgetResizeHandlerP *widgetResizeHandler;
- QTitleBarP* titlebar;
- QGuardedPtr<QTitleBarP> iconw;
- QSize windowSize;
- QSize shadeRestore;
- QSize shadeRestoreMin;
- bool act :1;
- bool shademode :1;
- bool snappedRight :1;
- bool snappedDown :1;
-};
-
-#ifndef QT_H
-#endif // QT_H
-class QMouseEvent;
-class QKeyEvent;
-
-class Q_EXPORT QWidgetResizeHandlerP : public QObject
-{
- Q_OBJECT
-
-public:
- QWidgetResizeHandlerP( QWidget *parent, QWidget *cw = 0, const char *name = 0 );
- void setActive( bool b ) { active = b; if ( !active ) setMouseCursor( Nowhere ); }
- bool isActive() const { return active; }
- void setMovingEnabled( bool b ) { moving = b; }
- bool isMovingEnabled() const { return moving; }
-
- bool isButtonDown() const { return buttonDown; }
-
- void setExtraHeight( int h ) { extrahei = h; }
- void setSizeProtection( bool b ) { sizeprotect = b; }
-
- void doResize();
- void doMove();
-
-signals:
- void activate();
-
-protected:
- bool eventFilter( QObject *o, QEvent *e );
- void mouseMoveEvent( QMouseEvent *e );
- void keyPressEvent( QKeyEvent *e );
-
-private:
- enum MousePosition {
- Nowhere,
- TopLeft, BottomRight, BottomLeft, TopRight,
- Top, Bottom, Left, Right,
- Center
- };
-
- QWidget *widget;
- QWidget *childWidget;
- QPoint moveOffset;
- QPoint invertedMoveOffset;
- MousePosition mode;
- int extrahei;
- int range;
- uint buttonDown :1;
- uint moveResizeMode :1;
- uint active :1;
- uint sizeprotect :1;
- uint moving :1;
-
- void setMouseCursor( MousePosition m );
- bool isMove() const {
- return moveResizeMode && mode == Center;
- }
- bool isResize() const {
- return moveResizeMode && !isMove();
- }
-
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QWidgetResizeHandlerP( const QWidgetResizeHandlerP & );
- QWidgetResizeHandlerP& operator=( const QWidgetResizeHandlerP & );
-#endif
-
-};
-
-class QToolTip;
-class QTitleBarPPrivate;
-class QPixmap;
-
-class Q_EXPORT QTitleBarP : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY( bool autoRaise READ autoRaise WRITE setAutoRaise )
- Q_PROPERTY( bool movable READ isMovable WRITE setMovable )
-
-public:
- QTitleBarP (QWidget* w, QWidget* parent, const char* name=0);
- ~QTitleBarP();
-
- bool isActive() const;
- bool usesActiveColor() const;
- virtual QString visibleText() const;
-
- bool isMovable() const;
- void setMovable(bool);
-
- bool autoRaise() const;
- void setAutoRaise(bool);
-
- QWidget *window() const;
-
- QSize sizeHint() const;
-
-public slots:
- void setActive( bool );
- void setCaption( const QString& title );
- void setIcon( const QPixmap& icon );
-
-signals:
- void doActivate();
- void doNormal();
- void doClose();
- void doMaximize();
- void doMinimize();
- void doShade();
- void showOperationMenu();
- void popupOperationMenu( const QPoint& );
- void doubleClicked();
-
-protected:
- bool event( QEvent *);
- void resizeEvent( QResizeEvent *);
- void contextMenuEvent( QContextMenuEvent * );
- void mousePressEvent( QMouseEvent * );
- void mouseDoubleClickEvent( QMouseEvent * );
- void mouseReleaseEvent( QMouseEvent * );
- void mouseMoveEvent( QMouseEvent * );
- void enterEvent( QEvent *e );
- void leaveEvent( QEvent *e );
- void paintEvent( QPaintEvent *p );
-
- virtual void cutText();
-
-private:
- void readColors();
-
- QTitleBarPPrivate *d;
-};
-
-#endif // QWORKSPACEP_H
+++ /dev/null
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- Plot2d.h \
- Plot2d_Curve.h \
- Plot2d_CurveContainer.h \
- Plot2d_ViewFrame.h \
- Plot2d_SetupViewDlg.h \
- Plot2d_SetupPlot2dDlg.h \
- Plot2d_FitDataDlg.h \
- Plot2d_Prs.h
-
-# .po files to transform in .qm
-#PO_FILES = \
-
-# Libraries targets
-
-LIB = libPlot2d.la
-LIB_SRC = \
- Plot2d.cxx \
- Plot2d_Curve.cxx \
- Plot2d_CurveContainer.cxx \
- Plot2d_ViewFrame.cxx \
- Plot2d_SetupViewDlg.cxx \
- Plot2d_SetupPlot2dDlg.cxx \
- Plot2d_FitDataDlg.cxx \
- Plot2d_Prs.cxx
-
-LIB_MOC = \
- Plot2d.h \
- Plot2d_ViewFrame.h \
- Plot2d_SetupViewDlg.h \
- Plot2d_SetupPlot2dDlg.h \
- Plot2d_FitDataDlg.h
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Component.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS) $(QWT_LIBS) -lSalomePrs -lSalomeGUI
-
-
-@CONCLUDE@
-
-
-
-
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "Plot2d.h"
-#include "Plot2d_ViewFrame.h"
-using namespace std;
-
-QAD_ViewFrame* Plot2d::createView(QAD_RightFrame* parent)
-{
- return new Plot2d_ViewFrame( parent, "plotView" );
-}
-
-extern "C"
-{
- QAD_ViewFrame* createView(QAD_RightFrame* parent)
- {
- return Plot2d::createView(parent);
- }
-}
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_HeaderFile
-#define Plot2d_HeaderFile
-
-#include "QAD_RightFrame.h"
-#include "QAD_ViewFrame.h"
-
-class Plot2d : public QObject
-{
- Q_OBJECT
-
-public :
-
- Standard_EXPORT static QAD_ViewFrame* createView ( QAD_RightFrame* parent);
-
-};
-
-#endif // Plot2d_HeaderFile
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_Curve.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_Curve.h"
-#include "utilities.h"
-using namespace std;
-
-/*!
- Constructor
-*/
-Plot2d_Curve::Plot2d_Curve()
- : myHorTitle( "" ), myVerTitle( "" ),
- myHorUnits( "" ), myVerUnits( "" ),
- myAutoAssign( true ), myColor( 0,0,0 ), myMarker( Circle ), myLine( Solid ), myLineWidth( 0 )
-{
-}
-/*!
- Destructor
-*/
-Plot2d_Curve::~Plot2d_Curve()
-{
-// MESSAGE("Plot2d_Curve::~Plot2d_Curve");
-}
-/*!
- Copy constructor. Makes deep copy of data.
-*/
-Plot2d_Curve::Plot2d_Curve( const Plot2d_Curve& curve )
-{
- myAutoAssign = curve.isAutoAssign();
- myHorTitle = curve.getHorTitle();
- myVerTitle = curve.getVerTitle();
- myHorUnits = curve.getHorUnits();
- myVerUnits = curve.getVerUnits();
- myColor = curve.getColor();
- myMarker = curve.getMarker();
- myLine = curve.getLine();
- myLineWidth = curve.getLineWidth();
- myHorData.duplicate( curve.horData(), curve.nbPoints() );
- myVerData.duplicate( curve.verData(), curve.nbPoints() );
-}
-/*!
- operator=. Makes deep copy of data.
-*/
-Plot2d_Curve& Plot2d_Curve::operator=( const Plot2d_Curve& curve )
-{
- myAutoAssign = curve.isAutoAssign();
- myHorTitle = curve.getHorTitle();
- myVerTitle = curve.getVerTitle();
- myHorUnits = curve.getHorUnits();
- myVerUnits = curve.getVerUnits();
- myColor = curve.getColor();
- myMarker = curve.getMarker();
- myLine = curve.getLine();
- myLineWidth = curve.getLineWidth();
- myHorData.duplicate( curve.horData(), curve.nbPoints() );
- myVerData.duplicate( curve.verData(), curve.nbPoints() );
- return *this;
-}
-/*!
- Sets curve's horizontal title
-*/
-void Plot2d_Curve::setHorTitle( const QString& title )
-{
- myHorTitle = title;
-}
-/*!
- Gets curve's horizontal title
-*/
-QString Plot2d_Curve::getHorTitle() const
-{
- return myHorTitle;
-}
-/*!
- Sets curve's vertical title
-*/
-void Plot2d_Curve::setVerTitle( const QString& title )
-{
- myVerTitle = title;
-}
-/*!
- Gets curve's vertical title
-*/
-QString Plot2d_Curve::getVerTitle() const
-{
- return myVerTitle;
-}
-/*!
- Sets curve's horizontal units
-*/
-void Plot2d_Curve::setHorUnits( const QString& units )
-{
- myHorUnits = units;
-}
-/*!
- Gets curve's horizontal units
-*/
-QString Plot2d_Curve::getHorUnits() const
-{
- return myHorUnits;
-}
-/*!
- Sets curve's vertical units
-*/
-void Plot2d_Curve::setVerUnits( const QString& units )
-{
- myVerUnits = units;
-}
-/*!
- Gets curve's vertical units
-*/
-QString Plot2d_Curve::getVerUnits() const
-{
- return myVerUnits;
-}
-/*!
- Sets curve's data. Makes shallow copy of data.
-*/
-void Plot2d_Curve::setData( const double* hData, const double* vData, long size )
-{
- myHorData.assign( hData, size );
- myVerData.assign( vData, size );
-}
-/*!
- Gets curve's data : abscissas of points
-*/
-double* Plot2d_Curve::horData() const
-{
- return myHorData.data();
-}
-/*!
- Gets curve's data : ordinates of points
-*/
-double* Plot2d_Curve::verData() const
-{
- return myVerData.data();
-}
-/*!
- Gets curve's data : number of points
-*/
-long Plot2d_Curve::nbPoints() const
-{
- return myHorData.size();
-}
-/*!
- Returns true if curve has no data
-*/
-bool Plot2d_Curve::isEmpty() const
-{
- return ( myHorData.isEmpty() || myVerData.isEmpty() );
-}
-/*!
- Sets curve's AutoAssign flag - in this case attributes will be set automatically
-*/
-void Plot2d_Curve::setAutoAssign( bool on )
-{
- myAutoAssign = on;
-}
-/*!
- Gets curve's AutoAssign flag state
-*/
-bool Plot2d_Curve::isAutoAssign() const
-{
- return myAutoAssign;
-}
-/*!
- Sets curve's color ( and resets AutoAssign flag )
-*/
-void Plot2d_Curve::setColor( const QColor color )
-{
- myColor = color;
- myAutoAssign = false;
-}
-/*!
- Gets curve's color
-*/
-QColor Plot2d_Curve::getColor() const
-{
- return myColor;
-}
-/*!
- Sets curve's marker ( and resets AutoAssign flag )
-*/
-void Plot2d_Curve::setMarker( MarkerType marker )
-{
- myMarker = marker;
- myAutoAssign = false;
-}
-/*!
- Gets curve's marker
-*/
-Plot2d_Curve::MarkerType Plot2d_Curve::getMarker() const
-{
- return myMarker;
-}
-/*!
- Sets curve's line type and width ( and resets AutoAssign flag )
- NOTE : A line width of 0 will produce a 1 pixel wide line using a fast algorithm for diagonals.
- A line width of 1 will also produce a 1 pixel wide line, but uses a slower more accurate algorithm for diagonals.
- For horizontal and vertical lines a line width of 0 is the same as a line width of 1.
-*/
-void Plot2d_Curve::setLine( LineType line, const int lineWidth )
-{
- myLine = line;
- myLineWidth = lineWidth;
- if ( myLineWidth < 0 ) myLineWidth = 0;
- myAutoAssign = false;
-}
-/*!
- Gets curve's line type
-*/
-Plot2d_Curve::LineType Plot2d_Curve::getLine() const
-{
- return myLine;
-}
-/*!
- Gets curve's line width
-*/
-int Plot2d_Curve::getLineWidth() const
-{
- return myLineWidth;
-}
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_Curve.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_Curve_h
-#define Plot2d_Curve_h
-
-#include <qstring.h>
-#include <qcolor.h>
-#include <qmemarray.h>
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#include "SALOME_InteractiveObject.hxx"
-
-typedef QMemArray<double> DoubleArray;
-
-class Plot2d_Curve
-{
-public:
- enum MarkerType { None, Circle, Rectangle, Diamond,
- DTriangle, UTriangle, LTriangle, RTriangle,
- Cross, XCross };
- enum LineType { NoPen, Solid, Dash, Dot, DashDot, DashDotDot };
-
- Plot2d_Curve();
- ~Plot2d_Curve();
- Plot2d_Curve( const Plot2d_Curve& curve );
- Plot2d_Curve& operator= ( const Plot2d_Curve& curve );
-
- void setHorTitle( const QString& title );
- QString getHorTitle() const;
- void setVerTitle( const QString& title );
- QString getVerTitle() const;
- void setHorUnits( const QString& units );
- QString getHorUnits() const;
- void setVerUnits( const QString& units );
- QString getVerUnits() const;
- void setData( const double* hData, const double* vData, long size );
- double* horData() const;
- double* verData() const;
- long nbPoints() const;
- bool isEmpty() const;
-
- void setAutoAssign( bool on );
- bool isAutoAssign() const;
- void setColor( const QColor color );
- QColor getColor() const;
- void setMarker( MarkerType marker );
- MarkerType getMarker() const;
- void setLine( LineType line, const int lineWidth = 0 );
- LineType getLine() const;
- int getLineWidth() const;
-
- virtual bool hasIO() { return !myIO.IsNull(); }
- virtual Handle(SALOME_InteractiveObject) getIO() { return myIO; }
- virtual void setIO( const Handle(SALOME_InteractiveObject)& io ) { myIO = io; }
-
- virtual bool hasTableIO() { return !myTableIO.IsNull(); }
- virtual Handle(SALOME_InteractiveObject) getTableIO() { return myTableIO; }
- virtual void setTableIO( const Handle(SALOME_InteractiveObject)& io ) { myTableIO = io; }
-
-private:
- Handle(SALOME_InteractiveObject) myIO;
- Handle(SALOME_InteractiveObject) myTableIO;
-
- bool myAutoAssign;
- QString myHorTitle;
- QString myVerTitle;
- QString myHorUnits;
- QString myVerUnits;
- QColor myColor;
- MarkerType myMarker;
- LineType myLine;
- int myLineWidth;
- DoubleArray myHorData;
- DoubleArray myVerData;
-};
-
-#endif // Plot2d_Curve_h
-
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_CurveContainer.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_CurveContainer.h"
-using namespace std;
-
-/*!
- Constructor
-*/
-Plot2d_CurveContainer::Plot2d_CurveContainer()
-{
- myCurves.setAutoDelete( false );
-}
-/*!
- Destructor
-*/
-Plot2d_CurveContainer::~Plot2d_CurveContainer()
-{
-
-}
-/*!
- Adds curve if not exist yet in the container
-*/
-void Plot2d_CurveContainer::addCurve( Plot2d_Curve* curve )
-{
- if ( myCurves.find( curve ) < 0 )
- myCurves.append( curve );
-}
-/*!
- Removes curve form the container ( and deletes it if <alsoDelete> is true )
-*/
-void Plot2d_CurveContainer::removeCurve( const int index, bool alsoDelete )
-{
- Plot2d_Curve* curve = myCurves.take( index );
- if ( curve && alsoDelete )
- delete curve;
-}
-/*!
- Clears container contents ( removes and deletes all curves )
-*/
-void Plot2d_CurveContainer::clear( bool alsoDelete )
-{
- while( myCurves.count() > 0 ) {
- Plot2d_Curve* curve = myCurves.take( 0 );
- if ( curve && alsoDelete )
- delete curve;
- }
-}
-/*!
- Gets nb of curves in container
-*/
-int Plot2d_CurveContainer::count()
-{
- return myCurves.count();
-}
-/*!
- Returns true if contains no curves
-*/
-bool Plot2d_CurveContainer::isEmpty() const
-{
- return myCurves.isEmpty();
-}
-/*!
- Gets curve by index
-*/
-Plot2d_Curve* Plot2d_CurveContainer::curve( const int index )
-{
- return myCurves.at( index );
-}
-
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_CurveContainer.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_CurveContainer_h
-#define Plot2d_CurveContainer_h
-
-#include "Plot2d_Curve.h"
-#include <qlist.h>
-
-class Plot2d_CurveContainer
-{
-public:
- Plot2d_CurveContainer();
- ~Plot2d_CurveContainer();
-
- void addCurve( Plot2d_Curve* curve );
- void removeCurve( const int index, bool alsoDelete = false ) ;
- void clear( bool alsoDelete = false );
- int count();
- bool isEmpty() const;
- Plot2d_Curve* curve( const int index );
-
-private:
- QList<Plot2d_Curve> myCurves;
-};
-
-#endif // Plot2d_CurveContainer_h
-
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_FitDataDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_FitDataDlg.h"
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qvalidator.h>
-#include "QAD_Tools.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-using namespace std;
-
-#define SPACING_SIZE 6
-#define MARGIN_SIZE 11
-#define MIN_EDIT_SIZE 100
-
-/*!
- Constructor
-*/
-Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent )
- : QDialog( parent ? parent : QAD_Application::getDesktop(),
- "Plot2d_FitDataDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr( "FIT_DATA_TLT" ) );
- setSizeGripEnabled( TRUE );
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- // 'Range' group
- myRangeGrp = new QButtonGroup( this );
- myRangeGrp->setColumnLayout( 0, Qt::Vertical );
- myRangeGrp->layout()->setSpacing( 0 );
- myRangeGrp->layout()->setMargin( 0 );
- QGridLayout* aGridLayout = new QGridLayout( myRangeGrp->layout() );
- aGridLayout->setAlignment( Qt::AlignTop );
- aGridLayout->setMargin( MARGIN_SIZE );
- aGridLayout->setSpacing( SPACING_SIZE );
-
- myModeAllRB = new QRadioButton( tr( "FIT_ALL" ), myRangeGrp );
- myModeHorRB = new QRadioButton( tr( "FIT_HORIZONTAL" ), myRangeGrp );
- myModeVerRB = new QRadioButton( tr( "FIT_VERTICAL" ), myRangeGrp );
-
- QDoubleValidator* aValidator = new QDoubleValidator( this );
- myXMinEdit = new QLineEdit( myRangeGrp );
- myXMinEdit->setValidator( aValidator );
- myXMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
- myXMinEdit->setText( "0.0" );
-
- myYMinEdit = new QLineEdit( myRangeGrp );
- myYMinEdit->setValidator( aValidator );
- myYMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myYMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
- myYMinEdit->setText( "0.0" );
-
- myXMaxEdit = new QLineEdit( myRangeGrp );
- myXMaxEdit->setValidator( aValidator );
- myXMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
- myXMaxEdit->setText( "0.0" );
-
- myYMaxEdit = new QLineEdit( myRangeGrp );
- myYMaxEdit->setValidator( aValidator );
- myYMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myYMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
- myYMaxEdit->setText( "0.0" );
-
- QFrame* aHLine = new QFrame( myRangeGrp );
- aHLine->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-
- QHBoxLayout* aModeLayout = new QHBoxLayout;
- aModeLayout->setMargin( 0 );
- aModeLayout->setSpacing( SPACING_SIZE );
- aModeLayout->addWidget( myModeAllRB );
- aModeLayout->addWidget( myModeHorRB );
- aModeLayout->addWidget( myModeVerRB );
-
- QLabel* horLab = new QLabel( tr( "HORIZONTAL_AXIS" ), myRangeGrp );
- QLabel* verLab = new QLabel( tr( "VERTICAL_AXIS" ), myRangeGrp );
- QFont font = horLab->font(); font.setBold( true );
- horLab->setFont( font ); verLab->setFont( font );
-
- aGridLayout->addMultiCellLayout( aModeLayout, 0, 0, 0, 4 );
- aGridLayout->addMultiCellWidget( aHLine, 1, 1, 0, 4 );
- aGridLayout->addWidget ( horLab, 2, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 2, 1 );
- aGridLayout->addWidget ( myXMinEdit, 2, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 2, 3 );
- aGridLayout->addWidget ( myXMaxEdit, 2, 4 );
- aGridLayout->addWidget ( verLab, 3, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 3, 1 );
- aGridLayout->addWidget ( myYMinEdit, 3, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 3, 3 );
- aGridLayout->addWidget ( myYMaxEdit, 3, 4 );
-
- // OK/Cancel buttons
- myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
- myCancelBtn->setAutoDefault( TRUE );
-
- topLayout->addMultiCellWidget( myRangeGrp, 0, 0, 0, 2 );
- topLayout->addWidget( myOkBtn, 1, 0 );
- topLayout->setColStretch( 1, 5 );
- topLayout->addWidget( myCancelBtn, 1, 2 );
-
- // connect signals
- connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( myRangeGrp, SIGNAL( clicked( int ) ), this, SLOT( onModeChanged( int ) ) );
-
- // initial state
- myModeAllRB->setChecked( true );
- onModeChanged( 0 );
-
- /* Center widget inside it's parent widget */
- QAD_Tools::centerWidget( this, parentWidget() );
-}
-
-/*!
- Sets range
-*/
-void Plot2d_FitDataDlg::setRange( const double xMin,
- const double xMax,
- const double yMin,
- const double yMax )
-{
- myXMinEdit->setText( QString::number( xMin ) );
- myXMaxEdit->setText( QString::number( xMax ) );
- myYMinEdit->setText( QString::number( yMin ) );
- myYMaxEdit->setText( QString::number( yMax ) );
-}
-
-/*!
- Gets range, returns mode (see getMode())
-*/
-int Plot2d_FitDataDlg::getRange( double& xMin,
- double& xMax,
- double& yMin,
- double& yMax )
-{
- xMin = myXMinEdit->text().toDouble();
- xMax = myXMaxEdit->text().toDouble();
- yMin = myYMinEdit->text().toDouble();
- yMax = myYMaxEdit->text().toDouble();
- int myMode = 0;
- if ( myModeAllRB->isChecked() )
- myMode = 0;
- if ( myModeHorRB->isChecked() )
- myMode = 1;
- if ( myModeVerRB->isChecked() )
- myMode = 2;
- return myMode;
-}
-
-/*!
- Gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
-*/
-int Plot2d_FitDataDlg::getMode()
-{
- int myMode = 0;
- if ( myModeAllRB->isChecked() )
- myMode = 0;
- if ( myModeHorRB->isChecked() )
- myMode = 1;
- if ( myModeVerRB->isChecked() )
- myMode = 2;
- return myMode;
-}
-
-/*!
- Called when range mode changed
-*/
-void Plot2d_FitDataDlg::onModeChanged(int mode)
-{
- bool badFocus;
- switch( mode ) {
- case 0: // fit all mode
- myXMinEdit->setEnabled(true);
- myXMaxEdit->setEnabled(true);
- myYMinEdit->setEnabled(true);
- myYMaxEdit->setEnabled(true);
- break;
- case 1: // fit horizontal mode
- badFocus = myYMinEdit->hasFocus() || myYMaxEdit->hasFocus();
- myXMinEdit->setEnabled(true);
- myXMaxEdit->setEnabled(true);
- myYMinEdit->setEnabled(false);
- myYMaxEdit->setEnabled(false);
- if (badFocus)
- myXMinEdit->setFocus();
- break;
- case 2: // fit vertical mode
- badFocus = myXMinEdit->hasFocus() || myXMaxEdit->hasFocus();
- myXMinEdit->setEnabled(false);
- myXMaxEdit->setEnabled(false);
- myYMinEdit->setEnabled(true);
- myYMaxEdit->setEnabled(true);
- if (badFocus)
- myYMinEdit->setFocus();
- break;
- }
-}
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_FitDataDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#if !defined(Plot2d_FitDataDlg_H)
-#define Plot2d_FitDataDlg_H
-
-#include <qdialog.h>
-
-#include <qspinbox.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-
-//================================================================
-// Class : Plot2d_FitDataDlg
-// Description : Dialog to fit view for given data area
-//================================================================
-class Plot2d_FitDataDlg : public QDialog
-{
- Q_OBJECT
-public:
-// constuctor
- Plot2d_FitDataDlg(QWidget* parent);
-
-// sets range
- void setRange(const double xMin,
- const double xMax,
- const double yMin,
- const double yMax);
-// gets range, returns mode (see getMode())
- int getRange(double& xMin,
- double& xMax,
- double& yMin,
- double& yMax);
-// gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
- int getMode();
-
-protected slots:
-// called when range mode changed
- void onModeChanged(int);
-
-private:
- QButtonGroup* myRangeGrp;
- QRadioButton* myModeAllRB;
- QRadioButton* myModeHorRB;
- QRadioButton* myModeVerRB;
- QLineEdit* myXMinEdit;
- QLineEdit* myYMinEdit;
- QLineEdit* myXMaxEdit;
- QLineEdit* myYMaxEdit;
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
-};
-
-#endif // !defined(Plot2d_FitDataDlg_H)
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Plot2d_Prs.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_Prs.h"
-using namespace std;
-
-//==========================================================
-/*!
- * Plot2d_Prs::Plot2d_Prs
- * Default constructor
- */
-//==========================================================
-Plot2d_Prs::Plot2d_Prs()
-{
-}
-
-//==========================================================
-/*!
- * Plot2d_Prs::Plot2d_Prs
- * Standard constructor
- */
-//==========================================================
-Plot2d_Prs::Plot2d_Prs( const Plot2d_Curve* obj )
-{
- AddObject( obj );
-}
-
-//==========================================================
-/*!
- * Plot2d_Prs::~Plot2d_Prs
- * Destructor
- */
-//==========================================================
-Plot2d_Prs::~Plot2d_Prs()
-{
- myObjects.clear();
-}
-
-//==========================================================
-/*!
- * Plot2d_Prs::GetObjects
- * Get curves list
- */
-//==========================================================
-Plot2d_CurveContainer Plot2d_Prs::GetObjects() const
-{
- return myObjects;
-}
-
-//==========================================================
-/*!
- * Plot2d_Prs::AddObject
- * Add curbe
- */
-//==========================================================
-void Plot2d_Prs::AddObject( const Plot2d_Curve* obj )
-{
- myObjects.addCurve( (Plot2d_Curve*)obj );
-}
-
-//==========================================================
-/*!
- * Plot2d_Prs::IsNull
- * Return 0 if list of the curves is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
-bool Plot2d_Prs::IsNull() const
-{
- return myObjects.isEmpty();
-}
+++ /dev/null
-// SALOME OCCViewer : build OCC Viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : Plot2d_Prs.h
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef PLOT2D_PRS_H
-#define PLOT2D_PRS_H
-
-#include "SALOME_Prs.h"
-#include <Plot2d_CurveContainer.h>
-
-class Plot2d_Curve;
-
-class Plot2d_Prs : public SALOME_Prs2d
-{
-public:
- Plot2d_Prs();
- // Default constructor
- Plot2d_Prs( const Plot2d_Curve* obj );
- // Standard constructor
- ~Plot2d_Prs();
- // Destructor
-
- Plot2d_CurveContainer GetObjects() const;
- // Get curves list
- void AddObject( const Plot2d_Curve* obj );
- // Add curve
-
- bool IsNull() const;
- // Reimplemented from SALOME_Prs
-
-private:
- Plot2d_CurveContainer myObjects; // list of curves
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_SetupPlot2dDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_SetupPlot2dDlg.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Tools.h"
-#include "QAD_MessageBox.h"
-#include "Plot2d_Curve.h"
-#include "Plot2d_CurveContainer.h"
-
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcheckbox.h>
-#include <qtoolbutton.h>
-#include <qcombobox.h>
-#include <qscrollview.h>
-#include <qlayout.h>
-#include <qcolordialog.h>
-#include <qspinbox.h>
-
-#include "utilities.h"
-
-using namespace std;
-
-#define DLG_SIZE_WIDTH 500
-#define DLG_SIZE_HEIGHT 400
-#define MAX_LINE_WIDTH 100
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-
-/*!
- Constructor
-*/
-Plot2d_SetupPlot2dDlg::Plot2d_SetupPlot2dDlg( SALOMEDS::SObject_var object, QWidget* parent )
- : QDialog( parent ? parent : QAD_Application::getDesktop(),
- "Plot2d_SetupPlot2dDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_SETUP_PLOT2D") );
- setSizeGripEnabled( TRUE );
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- myItems.setAutoDelete( false );
-
- myObject = SALOMEDS::SObject::_duplicate( object );
-
- /* Top scroll view */
- myView = new QScrollView( this );
- QFrame* frame = new QFrame( myView );
- frame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
- QGridLayout* frameLayout = new QGridLayout( frame, 1, 12 );
- frameLayout->setMargin( MARGIN_SIZE ); frameLayout->setSpacing( SPACING_SIZE );
-
- QFrame* lin;
-
- QLabel* labAxis = new QLabel( tr( "AXIS_LBL" ), frame );
- QLabel* labData = new QLabel( tr( "DATA_LBL" ), frame );
- QLabel* labUnit = new QLabel( tr( "UNITS_LBL" ), frame );
- QLabel* labAttr = new QLabel( tr( "ATTRIBUTES_LBL" ), frame );
- labAxis->setAlignment( AlignCenter );
- labData->setAlignment( AlignCenter );
- labUnit->setAlignment( AlignCenter );
- labAttr->setAlignment( AlignCenter );
- QFont font = labAxis->font(); font.setBold( true );
- labAxis->setFont( font );
- labData->setFont( font );
- labUnit->setFont( font );
- labAttr->setFont( font );
-
- frameLayout->addMultiCellWidget( labAxis, 0, 0, 0, 1 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addWidget( lin, 0, 2 );
- frameLayout->addWidget( labData, 0, 3 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addWidget( lin, 0, 4 );
- frameLayout->addWidget( labUnit, 0, 5 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addWidget( lin, 0, 6 );
- frameLayout->addMultiCellWidget( labAttr, 0, 0, 7, 11 );
- frameLayout->setColStretch( 12, 5 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- frameLayout->addMultiCellWidget( lin, 1, 1, 0, 12 );
-
- int row = 2;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeTableOfInteger_var tblIntAttr;
- SALOMEDS::AttributeTableOfReal_var tblRealAttr;
-
- /* Try table of integer */
- if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
- tblIntAttr = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- if ( !tblIntAttr->_is_nil() ) {
- try {
- int nbRows = tblIntAttr->GetNbRows() ;
- SALOMEDS::StringSeq_var rowTitles = tblIntAttr->GetRowTitles();
- SALOMEDS::StringSeq_var rowUnits = tblIntAttr->GetRowUnits();
- for ( int i = 0; i < nbRows; i++ ) {
- Plot2d_ItemContainer* item = new Plot2d_ItemContainer( this );
- item->createWidgets( frame );
- frameLayout->addWidget( item->myHBtn, row, 0 );
- frameLayout->addWidget( item->myVBtn, row, 1 );
- frameLayout->addWidget( item->myTitleLab, row, 3 );
- if ( rowTitles->length() > 0 )
- item->myTitleLab->setText( QString( rowTitles[ i ] ) );
- frameLayout->addWidget( item->myUnitLab, row, 5 );
- if ( rowUnits->length() > 0 )
- item->myUnitLab->setText( QString( rowUnits[ i ] ) );
- frameLayout->addWidget( item->myAutoCheck, row, 7 );
- frameLayout->addWidget( item->myLineCombo, row, 8 );
- frameLayout->addWidget( item->myLineSpin, row, 9 );
- frameLayout->addWidget( item->myMarkerCombo, row, 10 );
- frameLayout->addWidget( item->myColorBtn, row, 11 );
- connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
- connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
- myItems.append( item );
- row++;
- }
- }
- catch( ... ) {
- MESSAGE("Plot2d_SetupPlot2dDlg::Plot2d_SetupPlot2dDlg : Exception has been caught (int)!!!");
- }
- }
- }
- /* Try table of real */
- else if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
- tblRealAttr = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- if ( !tblRealAttr->_is_nil() ) {
- try {
- int nbRows = tblRealAttr->GetNbRows() ;
- SALOMEDS::StringSeq_var rowTitles = tblRealAttr->GetRowTitles();
- SALOMEDS::StringSeq_var rowUnits = tblRealAttr->GetRowUnits();
- for ( int i = 0; i < nbRows; i++ ) {
- Plot2d_ItemContainer* item = new Plot2d_ItemContainer( this );
- item->createWidgets( frame );
- frameLayout->addWidget( item->myHBtn, row, 0 );
- frameLayout->addWidget( item->myVBtn, row, 1 );
- frameLayout->addWidget( item->myTitleLab, row, 3 );
- if ( rowTitles->length() > 0 )
- item->myTitleLab->setText( QString( rowTitles[ i ] ) );
- frameLayout->addWidget( item->myUnitLab, row, 5 );
- if ( rowUnits->length() > 0 )
- item->myUnitLab->setText( QString( rowUnits[ i ] ) );
- frameLayout->addWidget( item->myAutoCheck, row, 7 );
- frameLayout->addWidget( item->myLineCombo, row, 8 );
- frameLayout->addWidget( item->myLineSpin, row, 9 );
- frameLayout->addWidget( item->myMarkerCombo, row, 10 );
- frameLayout->addWidget( item->myColorBtn, row, 11 );
- connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
- connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
- myItems.append( item );
- row++;
- }
- }
- catch( ... ) {
- MESSAGE("Plot2d_SetupPlot2dDlg::Plot2d_SetupPlot2dDlg : Exception has been caught (real)!!!");
- }
- }
- }
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addMultiCellWidget( lin, 2, row+1, 2, 2 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addMultiCellWidget( lin, 2, row+1, 4, 4 );
- lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
- frameLayout->addMultiCellWidget( lin, 2, row+1, 6, 6 );
- frameLayout->setRowStretch( row+1, 5 );
-
- myView->addChild( frame, 0, 0 );
- myView->setResizePolicy( QScrollView::AutoOneFit );
-
- myView->setMinimumWidth( frame->sizeHint().width() + MARGIN_SIZE * 2 );
-
- /* OK/Cancel buttons */
- myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
- myCancelBtn->setAutoDefault( TRUE );
-
- topLayout->addMultiCellWidget( myView, 0, 0, 0, 2 );
- topLayout->addWidget( myOkBtn, 1, 0 );
- topLayout->setColStretch( 1, 5 );
- topLayout->addWidget( myCancelBtn, 1, 2 );
-
- connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- enableControls();
-
- /* Center widget inside it's parent widget */
- resize( DLG_SIZE_WIDTH, DLG_SIZE_HEIGHT );
- QAD_Tools::centerWidget( this, parentWidget() );
-}
-/*!
- Destructor
-*/
-Plot2d_SetupPlot2dDlg::~Plot2d_SetupPlot2dDlg()
-{
-}
-/*!
- Gets curves info ( indexes of row data in the table for horizontal and verical axes )
-*/
-void Plot2d_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList<int>& verIndexes )
-{
- /* collecting horizontal and vertical axis items */
- horIndex = -1;
- int i, j;
- for ( i = 0; i < myItems.count(); i++ ) {
- if ( myItems.at( i )->isHorizontalOn() ) {
- horIndex = i;
- }
- else if ( myItems.at( i )->isVerticalOn() ) {
- verIndexes.append( i );
- }
- }
-}
-/*!
- Gets curve attributes
-*/
-bool Plot2d_SetupPlot2dDlg::getCurveAttributes( const int vIndex,
- bool& isAuto,
- int& marker,
- int& line,
- int& lineWidth,
- QColor& color)
-{
- if ( vIndex >= 0 && vIndex < myItems.count() ) {
- isAuto = myItems.at( vIndex )->isAutoAssign();
- marker = myItems.at( vIndex )->getMarker();
- line = myItems.at( vIndex )->getLine();
- lineWidth = myItems.at( vIndex )->getLineWidth();
- color = myItems.at( vIndex )->getColor();
- return true;
- }
- return false;
-}
-/*!
- Creates and returns curves presentations
-*/
-void Plot2d_SetupPlot2dDlg::getCurves( Plot2d_CurveContainer& container )
-{
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeTableOfInteger_var tblIntAttr;
- SALOMEDS::AttributeTableOfReal_var tblRealAttr;
-
- /* clearing container contents */
- container.clear();
-
- /* collecting horizontal and vertical axis items */
- int horIndex;
- int i, j;
- QValueList<int> verIndex;
- getCurvesSource( horIndex, verIndex );
- if ( horIndex < 0 || verIndex.isEmpty() ) /* no curves can be created */
- return;
-
- /* Try table of integer */
- if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
- tblIntAttr = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- if ( !tblIntAttr->_is_nil() ) {
- try {
- int nbCols = tblIntAttr->GetNbColumns() ;
- SALOMEDS::StringSeq_var rowTitles = tblIntAttr->GetRowTitles();
- SALOMEDS::StringSeq_var rowUnits = tblIntAttr->GetRowUnits();
-
- for ( i = 0; i < verIndex.count(); i++ ) {
- Plot2d_Curve* curve = new Plot2d_Curve();
- // curve titles
- if ( rowTitles->length() > 0 ) {
- curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
- curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
- }
- // curve units
- if ( rowUnits->length() > 0 ) {
- curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
- curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
- }
- // curve data
- int nbPoints = 0;
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) )
- nbPoints++;
- }
- if ( nbPoints > 0 ) {
- double* xList = new double[ nbPoints ];
- double* yList = new double[ nbPoints ];
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) ) {
- xList[j-1] = tblIntAttr->GetValue( horIndex +1, j );
- yList[j-1] = tblIntAttr->GetValue( verIndex[i]+1, j );
- }
- }
- curve->setData( xList, yList, nbPoints );
- }
- // curve attributes
- curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
- curve->setMarker( (Plot2d_Curve::MarkerType)myItems.at( verIndex[i] )->getMarker() );
- curve->setColor( myItems.at( verIndex[i] )->getColor() );
- curve->setAutoAssign( myItems.at( verIndex[i] )->isAutoAssign() );
- // add curve into container
- container.addCurve( curve );
- }
- }
- catch( ... ) {
- MESSAGE("Plot2d_SetupPlot2dDlg::getCurves : Exception has been caught (int)!!!");
- }
- }
- }
- /* Try table of real */
- else if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
- tblRealAttr = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- if ( !tblRealAttr->_is_nil() ) {
- try {
- int nbCols = tblRealAttr->GetNbColumns() ;
- SALOMEDS::StringSeq_var rowTitles = tblRealAttr->GetRowTitles();
- SALOMEDS::StringSeq_var rowUnits = tblRealAttr->GetRowUnits();
-
- for ( i = 0; i < verIndex.count(); i++ ) {
- Plot2d_Curve* curve = new Plot2d_Curve();
- // curve titles
- if ( rowTitles->length() > 0 ) {
- curve->setHorTitle( QString( rowTitles[ horIndex ] ) );
- curve->setVerTitle( QString( rowTitles[ verIndex[i] ] ) );
- }
- // curve units
- if ( rowUnits->length() > 0 ) {
- curve->setHorUnits( QString( rowUnits[ horIndex ] ) );
- curve->setVerUnits( QString( rowUnits[ verIndex[i] ] ) );
- }
- // curve data
- int nbPoints = 0;
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) )
- nbPoints++;
- }
- if ( nbPoints > 0 ) {
- double* xList = new double[ nbPoints ];
- double* yList = new double[ nbPoints ];
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) ) {
- xList[j-1] = tblRealAttr->GetValue( horIndex +1, j );
- yList[j-1] = tblRealAttr->GetValue( verIndex[i]+1, j );
- }
- }
- curve->setData( xList, yList, nbPoints );
- }
- // curve attributes
- curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
- curve->setMarker( (Plot2d_Curve::MarkerType)myItems.at( verIndex[i] )->getMarker() );
- curve->setColor( myItems.at( verIndex[i] )->getColor() );
- curve->setAutoAssign( myItems.at( verIndex[i] )->isAutoAssign() );
- // add curve into container
- container.addCurve( curve );
- }
- }
- catch( ... ) {
- MESSAGE("Plot2d_SetupPlot2dDlg::getCurves : Exception has been caught (real)!!!");
- }
- }
- }
-}
-/*!
- Slot, called when any <H> button is clicked
-*/
-void Plot2d_SetupPlot2dDlg::onHBtnToggled( bool on )
-{
- Plot2d_ItemContainer* item = ( Plot2d_ItemContainer* )sender();
- if ( on ) {
- for ( int i = 0; i < myItems.count(); i++ ) {
- if ( myItems.at( i ) != item )
- myItems.at( i )->setHorizontalOn( false );
- }
- }
- enableControls();
-}
-/*!
- Slot, called when any <V> button is clicked
-*/
-void Plot2d_SetupPlot2dDlg::onVBtnToggled( bool on )
-{
- Plot2d_ItemContainer* item = ( Plot2d_ItemContainer* )sender();
- QList<Plot2d_ItemContainer> itemList;
- itemList.setAutoDelete( false );
- int i;
- if ( on ) {
- int totalOn = 0;
- for ( i = 0; i < myItems.count(); i++ ) {
- if ( myItems.at( i ) != item && !myItems.at( i )->isHorizontalOn() ) {
- if ( myItems.at( i )->myUnitLab->text() == item->myUnitLab->text() ) {
- if ( myItems.at( i )->isVerticalOn() )
- totalOn++;
- else
- itemList.append( myItems.at( i ) );
- }
- else {
- myItems.at( i )->setVerticalOn( false );
- }
- }
- }
- if ( totalOn == 0 && !itemList.isEmpty() &&
- QAD_MessageBox::info2( this,
- this->caption(),
- tr( "QUE_WANT_SAME_UNITS" ),
- tr( "BUT_YES" ),
- tr( "BUT_NO" ),
- 0, 1, 1 ) == 0 ) {
- for ( i = 0; i < itemList.count(); i++ ) {
- itemList.at( i )->blockSignals( true );
- itemList.at( i )->setVerticalOn( true );
- itemList.at( i )->blockSignals( false );
- }
- }
- }
- enableControls();
-}
-/*!
- Enables/disables buttons
-*/
-void Plot2d_SetupPlot2dDlg::enableControls()
-{
- bool bHSet = false;
- bool bVSet = false;
- for ( int i = 0; i < myItems.count(); i++ ) {
- if ( myItems.at( i )->isHorizontalOn() ) {
- bHSet = true;
- break;
- }
- }
- for ( int i = 0; i < myItems.count(); i++ ) {
- if ( myItems.at( i )->isVerticalOn() )
- bVSet = true;
- myItems.at( i )->enableWidgets( bHSet && myItems.at( i )->isVerticalOn() );
- }
- myOkBtn->setEnabled( bHSet && bVSet );
-}
-
-// ====================================================================================
-/*!
- Constructor
-*/
-Plot2d_ItemContainer::Plot2d_ItemContainer( QObject* parent, const char* name )
- : QObject( parent, name ),
- myEnabled( true )
-{
-}
-/*!
- Creates widgets
-*/
-void Plot2d_ItemContainer::createWidgets( QWidget* parentWidget )
-{
- myHBtn = new QToolButton( parentWidget );
- myHBtn->setText( tr( " H " ) );
- myHBtn->setToggleButton( true );
- myHBtn->setOn( false );
-
- myVBtn = new QToolButton( parentWidget );
- myVBtn->setText( tr( " V " ) );
- myVBtn->setToggleButton( true );
- myVBtn->setOn( false );
-
- myTitleLab = new QLabel( parentWidget );
- myUnitLab = new QLabel( parentWidget );
- myUnitLab->setAlignment( AlignCenter);
-
- myAutoCheck = new QCheckBox( tr( "AUTO_CHECK_LBL" ), parentWidget );
- myAutoCheck->setChecked( true );
-
- myLineCombo = new QComboBox( false, parentWidget );
- myLineCombo->insertItem( tr( "NONE_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "SOLID_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASH_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
- myLineCombo->setCurrentItem( 1 ); // SOLID by default
-
- myLineSpin = new QSpinBox( 0, MAX_LINE_WIDTH, 1, parentWidget );
- myLineSpin->setValue( 0 ); // width = 0 by default
-
- myMarkerCombo = new QComboBox( false, parentWidget );
- myMarkerCombo->insertItem( tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "XCROSS_MARKER_LBL" ) );
- myMarkerCombo->setCurrentItem( 1 ); // CIRCLE by default
-
- myColorBtn = new QToolButton( parentWidget );
-
- connect( myAutoCheck, SIGNAL( clicked() ), this, SLOT( onAutoChanged() ) );
- connect( myColorBtn, SIGNAL( clicked() ), this, SLOT( onColorChanged() ) );
- connect( myHBtn, SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
- connect( myVBtn, SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
- setColor( QColor( 0, 0, 0 ) );
- updateState();
-}
-/*!
- Enables attributes widgets
-*/
-void Plot2d_ItemContainer::enableWidgets( bool enable )
-{
- myEnabled = enable;
- updateState();
-}
-/*!
- Sets horizontal button's state on
-*/
-void Plot2d_ItemContainer::setHorizontalOn( bool on )
-{
- myHBtn->setOn( on );
-}
-/*!
- Gets horizontal button's state
-*/
-bool Plot2d_ItemContainer::isHorizontalOn() const
-{
- return myHBtn->isOn();
-}
-/*!
- Sets vertical button's state on
-*/
-void Plot2d_ItemContainer::setVerticalOn( bool on )
-{
- myVBtn->setOn( on );
-}
-/*!
- Gets vertical button's state
-*/
-bool Plot2d_ItemContainer::isVerticalOn() const
-{
- return myVBtn->isOn();
-}
-/*!
- Sets item AutoAssign flag state
-*/
-void Plot2d_ItemContainer::setAutoAssign( bool on )
-{
- myAutoCheck->setChecked( on );
- updateState();
-}
-/*!
- Gets item AutoAssign flag state
-*/
-bool Plot2d_ItemContainer::isAutoAssign() const
-{
- return myAutoCheck->isChecked();
-}
-/*!
- Sets item line type and width
-*/
-void Plot2d_ItemContainer::setLine( const int line, const int width )
-{
- myLineCombo->setCurrentItem( line );
-}
-/*!
- Gets item line type
-*/
-int Plot2d_ItemContainer::getLine() const
-{
- return myLineCombo->currentItem();
-}
-/*!
- Gets item line width
-*/
-int Plot2d_ItemContainer::getLineWidth() const
-{
- return myLineSpin->value();
-}
-/*!
- Sets item marker type
-*/
-void Plot2d_ItemContainer::setMarker( const int marker )
-{
- myMarkerCombo->setCurrentItem( marker );
-}
-/*!
- Gets item marker type
-*/
-int Plot2d_ItemContainer::getMarker() const
-{
- return myMarkerCombo->currentItem();
-}
-/*!
- Sets item color
-*/
-void Plot2d_ItemContainer::setColor( const QColor& color )
-{
- QPalette pal = myColorBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
- myColorBtn->setPalette( pal );
-}
-/*!
- Gets item color
-*/
-QColor Plot2d_ItemContainer::getColor() const
-{
- return myColorBtn->palette().active().button();
-}
-/*!
- Enables/disables widgets
-*/
-void Plot2d_ItemContainer::updateState()
-{
- myAutoCheck->setEnabled( myEnabled );
- myLineCombo->setEnabled( myEnabled && !myAutoCheck->isChecked() );
- myLineSpin->setEnabled( myEnabled && !myAutoCheck->isChecked() );
- myMarkerCombo->setEnabled( myEnabled && !myAutoCheck->isChecked() );
- myColorBtn->setEnabled( myEnabled && !myAutoCheck->isChecked() );
-}
-/*!
- Slot, called when user clickes <Auto assign> check box
-*/
-void Plot2d_ItemContainer::onAutoChanged()
-{
- updateState();
- emit( autoClicked() );
-}
-/*!
- <Color> button slot, invokes color selection dialog box
-*/
-void Plot2d_ItemContainer::onColorChanged()
-{
- QColor color = QColorDialog::getColor( getColor() );
- if ( color.isValid() ) {
- setColor( color );
- }
-}
-/*!
- <H> and <V> buttons slot
-*/
-void Plot2d_ItemContainer::onHVToggled( bool on )
-{
- const QObject* snd = sender();
- if ( snd == myHBtn ) {
- if ( on ) {
- if ( myVBtn->isOn() ) {
-// blockSignals( true );
- myVBtn->setOn( false );
-// blockSignals( false );
- }
- }
- emit horToggled( on );
- }
- else {
- if ( on ) {
- if ( myHBtn->isOn() ) {
-// blockSignals( true );
- myHBtn->setOn( false );
-// blockSignals( false );
- }
- }
- emit verToggled( on );
- }
-}
-
-
-
-
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_SetupPlot2dDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_SetupPlot2dDlg_H
-#define Plot2d_SetupPlot2dDlg_H
-
-#include <qdialog.h>
-#include <qlist.h>
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-//=================================================================================
-// class : Plot2d_SetupPlot2dDlg
-// purpose : Dialog box for setup Plot2d view
-//=================================================================================
-
-class QScrollView;
-class QPushButton;
-class QLabel;
-class QCheckBox;
-class QComboBox;
-class QSpinBox;
-class QToolButton;
-class Plot2d_ItemContainer;
-class Plot2d_CurveContainer;
-
-class Plot2d_SetupPlot2dDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- Plot2d_SetupPlot2dDlg( SALOMEDS::SObject_var object, QWidget* parent = 0 );
- ~Plot2d_SetupPlot2dDlg();
-
- void getCurves( Plot2d_CurveContainer& container );
- void getCurvesSource( int& horIndex, QValueList<int>& verIndexes );
- bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
-
-private slots:
- void onHBtnToggled( bool );
- void onVBtnToggled( bool );
- void enableControls();
-
-private:
- QScrollView* myView;
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
- QList<Plot2d_ItemContainer> myItems;
-
- SALOMEDS::SObject_var myObject;
-};
-
-class Plot2d_ItemContainer : public QObject
-{
- Q_OBJECT
-
-public:
- Plot2d_ItemContainer( QObject* parent = 0, const char* name = 0 );
-
- void createWidgets( QWidget* parentWidget );
- void enableWidgets( bool enable );
-
- void setHorizontalOn( bool on );
- bool isHorizontalOn() const;
- void setVerticalOn( bool on );
- bool isVerticalOn() const;
- bool isAutoAssign() const;
- void setAutoAssign( bool on );
- void setLine( const int line, const int width );
- int getLine() const;
- int getLineWidth() const;
- void setMarker( const int marker );
- int getMarker() const;
- void setColor( const QColor& color );
- QColor getColor() const;
-
-protected:
- void updateState();
-
-signals:
- void autoClicked();
- void horToggled( bool );
- void verToggled( bool );
-
-public slots:
- void onAutoChanged();
- void onColorChanged();
- void onHVToggled( bool );
-
-public:
- bool myEnabled;
- QToolButton* myHBtn;
- QToolButton* myVBtn;
- QLabel* myTitleLab;
- QLabel* myUnitLab;
- QCheckBox* myAutoCheck;
- QComboBox* myLineCombo;
- QSpinBox* myLineSpin;
- QComboBox* myMarkerCombo;
- QToolButton* myColorBtn;
-};
-
-#endif // Plot2d_SetupPlot2dDlg_H
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_SetupViewDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_SetupViewDlg.h"
-#include "QAD_Tools.h"
-
-#include <qcheckbox.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-#include <qtoolbutton.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcolordialog.h>
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_EDIT_WIDTH 200
-#define MIN_COMBO_WIDTH 100
-#define MIN_SPIN_WIDTH 70
-
-/*!
- Constructor
-*/
-Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, bool showDefCheck )
- : QDialog( parent, "Plot2d_SetupViewDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_SETUP_PLOT2D_VIEW") );
- setSizeGripEnabled( TRUE );
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- // main title
- myTitleCheck = new QCheckBox( tr( "PLOT2D_ENABLE_MAIN_TITLE" ), this );
- myTitleEdit = new QLineEdit( this );
- myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- // horizontal axis title
- myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), this );
- myTitleXEdit = new QLineEdit( this );
- myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- // vertical axis title
- myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), this );
- myTitleYEdit = new QLineEdit( this );
- myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- // curve type : points, lines, spline
- QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
- myCurveCombo = new QComboBox( false, this );
- myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
- // legend
- myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
- myLegendCombo = new QComboBox( false, this );
- myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
- // marker size
- QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
- myMarkerSpin = new QSpinBox( 0, 100, 1, this );
- myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- // background color
- QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
- myBackgroundBtn = new QToolButton( this );
- // scale mode
- QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
- aScaleGrp->setColumnLayout(0, Qt::Vertical );
- aScaleGrp->layout()->setSpacing( 0 ); aScaleGrp->layout()->setMargin( 0 );
- QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp->layout() );
- aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
-
- QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
- myXModeCombo = new QComboBox( false, aScaleGrp );
- myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
- QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
- myYModeCombo = new QComboBox( false, aScaleGrp );
- myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
-
- aScaleLayout->addWidget( xScaleLab, 0, 0 );
- aScaleLayout->addWidget( myXModeCombo, 0, 1 );
- aScaleLayout->addWidget( yScaleLab, 0, 2 );
- aScaleLayout->addWidget( myYModeCombo, 0, 3 );
-
- // grid
- QGroupBox* aGridGrp = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), this );
- aGridGrp->setColumnLayout(0, Qt::Vertical );
- aGridGrp->layout()->setSpacing( 0 ); aGridGrp->layout()->setMargin( 0 );
- QGridLayout* aGridLayout = new QGridLayout( aGridGrp->layout() );
- aGridLayout->setMargin( MARGIN_SIZE ); aGridLayout->setSpacing( SPACING_SIZE );
-
- myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrp );
- myXGridSpin = new QSpinBox( 1, 100, 1, aGridGrp );
- myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrp );
- myYGridSpin = new QSpinBox( 1, 100, 1, aGridGrp );
- myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrp );
- myXMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrp );
- myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrp );
- myYMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrp );
- myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
-
- aGridLayout->addWidget( myXGridCheck, 0, 0 );
- aGridLayout->addWidget( myXGridSpin, 0, 1 );
- aGridLayout->addWidget( myYGridCheck, 0, 2 );
- aGridLayout->addWidget( myYGridSpin, 0, 3 );
- aGridLayout->addWidget( myXMinGridCheck, 1, 0 );
- aGridLayout->addWidget( myXMinGridSpin, 1, 1 );
- aGridLayout->addWidget( myYMinGridCheck, 1, 2 );
- aGridLayout->addWidget( myYMinGridSpin, 1, 3 );
-
- /* "Set as default" check box */
- myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
-
- /* OK/Cancel buttons */
- myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
- myCancelBtn->setAutoDefault( TRUE );
- QHBoxLayout* btnLayout = new QHBoxLayout;
- btnLayout->addWidget( myOkBtn );
- btnLayout->addStretch();
- btnLayout->addWidget( myCancelBtn );
-
- // layout widgets
- topLayout->addWidget( myTitleCheck, 0, 0 );
- topLayout->addMultiCellWidget( myTitleEdit, 0, 0, 1, 3 );
- topLayout->addWidget( myTitleXCheck, 1, 0 );
- topLayout->addMultiCellWidget( myTitleXEdit, 1, 1, 1, 3 );
- topLayout->addWidget( myTitleYCheck, 2, 0 );
- topLayout->addMultiCellWidget( myTitleYEdit, 2, 2, 1, 3 );
- topLayout->addWidget( aCurveLab, 3, 0 );
- topLayout->addWidget( myCurveCombo, 3, 1 );
- topLayout->addWidget( myLegendCheck, 3, 2 );
- topLayout->addWidget( myLegendCombo, 3, 3 );
- topLayout->addWidget( aMarkerLab, 4, 0 );
- topLayout->addWidget( myMarkerSpin, 4, 1 );
- QHBoxLayout* bgLayout = new QHBoxLayout;
- bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
- topLayout->addWidget( aBGLab, 4, 2 );
- topLayout->addLayout( bgLayout, 4, 3 );
- topLayout->addMultiCellWidget( aScaleGrp, 5, 5, 0, 3 );
- topLayout->addMultiCellWidget( aGridGrp, 6, 6, 0, 3 );
- topLayout->addMultiCellWidget( myDefCheck, 7, 7, 0, 3 );
- topLayout->setRowStretch( 8, 5 );
- topLayout->addMultiCellLayout( btnLayout, 9, 9, 0, 3 );
-
- if ( !showDefCheck )
- myDefCheck->hide();
-
- connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
- connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
- connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
- connect( myBackgroundBtn, SIGNAL( clicked() ), this, SLOT( onBackgroundClicked() ) );
- connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
- connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
- connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
- connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
- connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
-
- connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- /* Center widget inside it's parent widget */
- QAD_Tools::centerWidget( this, parentWidget() );
-
- // init fields
- setBackgroundColor( Qt::gray );
- onMainTitleChecked();
- onXTitleChecked();
- onYTitleChecked();
- onLegendChecked();
- onXGridMajorChecked();
- onYGridMajorChecked();
- onXGridMinorChecked();
- onYGridMinorChecked();
-}
-
-/*!
- Destructor
-*/
-Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
-{
-}
-/*!
- Sets main title attributes
-*/
-void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
-{
- myTitleCheck->setChecked( enable );
- if ( !title.isNull() )
- myTitleEdit->setText( title );
- onMainTitleChecked();
-}
-/*!
- Returns TRUE if main title is enabled
-*/
-bool Plot2d_SetupViewDlg::isMainTitleEnabled()
-{
- return myTitleCheck->isChecked();
-}
-/*!
- Gets main title
-*/
-QString Plot2d_SetupViewDlg::getMainTitle()
-{
- return myTitleEdit->text();
-}
-/*!
- Sets horizontal axis title attributes
-*/
-void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
-{
- myTitleXCheck->setChecked( enable );
- if ( !title.isNull() )
- myTitleXEdit->setText( title );
- onXTitleChecked();
-}
-/*!
- Returns TRUE if horizontal axis title is enabled
-*/
-bool Plot2d_SetupViewDlg::isXTitleEnabled()
-{
- return myTitleXCheck->isChecked();
-}
-/*!
- Gets horizontal axis title
-*/
-QString Plot2d_SetupViewDlg::getXTitle()
-{
- return myTitleXEdit->text();
-}
-/*!
- Sets horizontal axis title attributes
-*/
-void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
-{
- myTitleYCheck->setChecked( enable );
- if ( !title.isNull() )
- myTitleYEdit->setText( title );
- onYTitleChecked();
-}
-/*!
- Returns TRUE if vertical axis title is enabled
-*/
-bool Plot2d_SetupViewDlg::isYTitleEnabled()
-{
- return myTitleYCheck->isChecked();
-}
-/*!
- Gets vertical axis title
-*/
-QString Plot2d_SetupViewDlg::getYTitle()
-{
- return myTitleYEdit->text();
-}
-/*!
- Sets curve type : 0 - points, 1 - lines, 2 - splines
-*/
-void Plot2d_SetupViewDlg::setCurveType( const int type )
-{
- myCurveCombo->setCurrentItem( type );
-}
-/*!
- Gets curve type : 0 - points, 1 - lines, 2 - splines
-*/
-int Plot2d_SetupViewDlg::getCurveType()
-{
- return myCurveCombo->currentItem();
-}
-/*!
- Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
-*/
-void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
-{
- myLegendCheck->setChecked( enable );
- myLegendCombo->setCurrentItem( pos );
- onLegendChecked();
-}
-/*!
- Returns TRUE if legend is enabled
-*/
-bool Plot2d_SetupViewDlg::isLegendEnabled()
-{
- return myLegendCheck->isChecked();
-}
-/*!
- Returns legend position
-*/
-int Plot2d_SetupViewDlg::getLegendPos()
-{
- return myLegendCombo->currentItem();
-}
-/*!
- Sets marker size
-*/
-void Plot2d_SetupViewDlg::setMarkerSize( const int size )
-{
- myMarkerSpin->setValue( size );
-}
-/*!
- Gets marker size
-*/
-int Plot2d_SetupViewDlg::getMarkerSize()
-{
- return myMarkerSpin->value();
-}
-/*!
- Sets background color
-*/
-void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
-{
- QPalette pal = myBackgroundBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
- myBackgroundBtn->setPalette( pal );
-}
-/*!
- Gets background color
-*/
-QColor Plot2d_SetupViewDlg::getBackgroundColor()
-{
- return myBackgroundBtn->palette().active().button();
-}
-/*!
- Sets major grid parameters
-*/
-void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX, bool enableY, const int divY )
-{
- myXGridCheck->setChecked( enableX );
- myXGridSpin->setValue( divX );
- myYGridCheck->setChecked( enableY );
- myYGridSpin->setValue( divY );
- onXGridMajorChecked();
- onYGridMajorChecked();
-}
-/*!
- Gets major grid parameters
-*/
-void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX, bool& enableY, int& divY )
-{
- enableX = myXGridCheck->isChecked();
- divX = myXGridSpin->value();
- enableY = myYGridCheck->isChecked();
- divY = myYGridSpin->value();
-}
-/*!
- Sets minor grid parameters
-*/
-void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX, bool enableY, const int divY )
-{
- myXMinGridCheck->setChecked( enableX );
- myXMinGridSpin->setValue( divX );
- myYMinGridCheck->setChecked( enableY );
- myYMinGridSpin->setValue( divY );
- onXGridMinorChecked();
- onYGridMinorChecked();
-}
-/*!
- Gets minor grid parameters
-*/
-void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX, bool& enableY, int& divY )
-{
- enableX = myXMinGridCheck->isChecked();
- divX = myXMinGridSpin->value();
- enableY = myYMinGridCheck->isChecked();
- divY = myYMinGridSpin->value();
-}
-/*!
- Sets scale mode for hor. and ver. axes : 0 - linear, 1 - logarithmic
-*/
-void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
-{
- myXModeCombo->setCurrentItem( xMode );
- myYModeCombo->setCurrentItem( yMode );
-}
-/*!
- Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
-*/
-int Plot2d_SetupViewDlg::getXScaleMode()
-{
- return myXModeCombo->currentItem();
-}
-/*!
- Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
-*/
-int Plot2d_SetupViewDlg::getYScaleMode()
-{
- return myYModeCombo->currentItem();
-}
-/*!
- Slot, called when user clicks "Show main title" check box
-*/
-void Plot2d_SetupViewDlg::onMainTitleChecked()
-{
- myTitleEdit->setEnabled( myTitleCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Show horizontal axis title" check box
-*/
-void Plot2d_SetupViewDlg::onXTitleChecked()
-{
- myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Show vertical axis title" check box
-*/
-void Plot2d_SetupViewDlg::onYTitleChecked()
-{
- myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Change bacground color" button
-*/
-void Plot2d_SetupViewDlg::onBackgroundClicked()
-{
- QColor color = QColorDialog::getColor( getBackgroundColor() );
- if ( color.isValid() ) {
- setBackgroundColor( color );
- }
-}
-/*!
- Slot, called when user clicks "Show Legend" check box
-*/
-void Plot2d_SetupViewDlg::onLegendChecked()
-{
- myLegendCombo->setEnabled( myLegendCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Enable hor. major grid" check box
-*/
-void Plot2d_SetupViewDlg::onXGridMajorChecked()
-{
- myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Enable ver. major grid" check box
-*/
-void Plot2d_SetupViewDlg::onYGridMajorChecked()
-{
- myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
-}
-/*!
- Slot, called when user clicks "Enable hor. minor grid" check box
-*/
-void Plot2d_SetupViewDlg::onXGridMinorChecked()
-{
-}
-/*!
- Slot, called when user clicks "Enable ver. minor grid" check box
-*/
-void Plot2d_SetupViewDlg::onYGridMinorChecked()
-{
-}
-/*!
- Retursns true if "Set as default" check box is on
-*/
-bool Plot2d_SetupViewDlg::isSetAsDefault()
-{
- return myDefCheck->isChecked();
-}
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_SetupViewDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_SetupViewDlg_H
-#define Plot2d_SetupViewDlg_H
-
-#include <qdialog.h>
-
-//=================================================================================
-// class : Plot2d_SetupViewDlg
-// purpose : Settings dialog for Plot2d view
-//=================================================================================
-
-class QCheckBox;
-class QLineEdit;
-class QComboBox;
-class QSpinBox;
-class QToolButton;
-class QPushButton;
-
-class Plot2d_SetupViewDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- Plot2d_SetupViewDlg( QWidget* parent = 0, bool showDefCheck = false );
- ~Plot2d_SetupViewDlg();
-
- void setMainTitle( bool enable, const QString& title = QString::null );
- bool isMainTitleEnabled();
- QString getMainTitle();
- void setXTitle( bool enable, const QString& title = QString::null );
- bool isXTitleEnabled();
- QString getXTitle();
- void setYTitle( bool enable, const QString& title = QString::null );
- bool isYTitleEnabled();
- QString getYTitle();
- void setCurveType( const int type );
- int getCurveType();
- void setLegend( bool enable, int pos );
- bool isLegendEnabled();
- int getLegendPos();
- void setMarkerSize( const int size );
- int getMarkerSize();
- void setBackgroundColor( const QColor& color );
- QColor getBackgroundColor();
- void setMajorGrid( bool enableX, const int xdiv, bool enableY, const int divY );
- void getMajorGrid( bool& enableX, int& xdiv, bool& enableY, int& divY );
- void setMinorGrid( bool enableX, const int xdiv, bool enableY, const int divY );
- void getMinorGrid( bool& enableX, int& xdiv, bool& enableY, int& divY );
- void setScaleMode( const int xMode, const int yMode );
- int getXScaleMode();
- int getYScaleMode();
- bool isSetAsDefault();
-
-protected slots:
- void onMainTitleChecked();
- void onXTitleChecked();
- void onYTitleChecked();
- void onBackgroundClicked();
- void onLegendChecked();
- void onXGridMajorChecked();
- void onYGridMajorChecked();
- void onXGridMinorChecked();
- void onYGridMinorChecked();
-
-private:
- QCheckBox* myTitleCheck;
- QLineEdit* myTitleEdit;
- QCheckBox* myTitleXCheck;
- QLineEdit* myTitleXEdit;
- QCheckBox* myTitleYCheck;
- QLineEdit* myTitleYEdit;
- QToolButton* myBackgroundBtn;
- QCheckBox* myXGridCheck;
- QSpinBox* myXGridSpin;
- QCheckBox* myYGridCheck;
- QSpinBox* myYGridSpin;
- QCheckBox* myXMinGridCheck;
- QSpinBox* myXMinGridSpin;
- QCheckBox* myYMinGridCheck;
- QSpinBox* myYMinGridSpin;
- QComboBox* myCurveCombo;
- QCheckBox* myLegendCheck;
- QComboBox* myLegendCombo;
- QSpinBox* myMarkerSpin;
- QComboBox* myXModeCombo;
- QComboBox* myYModeCombo;
- QCheckBox* myDefCheck;
-
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
-};
-
-#endif // Plot2d_SetupViewDlg_H
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_ViewFrame.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "Plot2d_ViewFrame.h"
-#include "Plot2d_SetupViewDlg.h"
-#include "Plot2d_Prs.h"
-
-#include "QAD_Desktop.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_FileDlg.h"
-#include "QAD_Tools.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Config.h"
-#include "SALOME_Selection.h"
-#include "Plot2d_CurveContainer.h"
-#include "Plot2d_Curve.h"
-#include "Plot2d_FitDataDlg.h"
-#include "utilities.h"
-#include "qapplication.h"
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qcursor.h>
-#include <qcolordialog.h>
-#include <qwt_math.h>
-#include <qwt_plot_canvas.h>
-#include <stdlib.h>
-#include "utilities.h"
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-using namespace std;
-
-#define DEFAULT_LINE_WIDTH 0 // (default) line width
-#define DEFAULT_MARKER_SIZE 9 // default marker size
-#define MIN_RECT_SIZE 11 // min sensibility area size
-
-/* XPM */
-const char* imageZoomCursor[] = {
-"32 32 3 1",
-". c None",
-"a c #000000",
-"# c #ffffff",
-"................................",
-"................................",
-".#######........................",
-"..aaaaaaa.......................",
-"................................",
-".............#####..............",
-"...........##.aaaa##............",
-"..........#.aa.....a#...........",
-".........#.a.........#..........",
-".........#a..........#a.........",
-"........#.a...........#.........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-".........#...........#.a........",
-".........#a..........#a.........",
-".........##.........#.a.........",
-"........#####.....##.a..........",
-".......###aaa#####.aa...........",
-"......###aa...aaaaa.......#.....",
-".....###aa................#a....",
-"....###aa.................#a....",
-"...###aa...............#######..",
-"....#aa.................aa#aaaa.",
-".....a....................#a....",
-"..........................#a....",
-"...........................a....",
-"................................",
-"................................",
-"................................",
-"................................"};
-
-
-//=================================================================================
-// Plot2d_ViewFrame implementation
-//=================================================================================
-
-/*!
- Constructor
-*/
-Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title )
- : QAD_ViewFrame( parent, title ),
- myOperation( NoOpId ),
- myCurveType( 1 ),
- myShowLegend( true ), myLegendPos( 1 ),
- myMarkerSize( DEFAULT_MARKER_SIZE ),
- myTitle( "" ), myXTitle( "" ), myYTitle( "" ),
- myBackground( white ),
- myTitleEnabled( true ), myXTitleEnabled( true ), myYTitleEnabled( true ),
- myXGridMajorEnabled( true ), myYGridMajorEnabled( true ),
- myXGridMinorEnabled( false ), myYGridMinorEnabled( false ),
- myXGridMaxMajor( 8 ), myYGridMaxMajor( 8 ), myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ),
- myXMode( 0 ), myYMode( 0 )
-
-{
- myCurves.setAutoDelete( true );
- /* Plot 2d View */
- myPlot = new Plot2d_Plot2d( this );
- setCentralWidget( myPlot );
-
- createActions();
-
- connect( myPlot, SIGNAL( plotMouseMoved( const QMouseEvent& ) ),
- this, SLOT( plotMouseMoved( const QMouseEvent& ) ) );
- connect( myPlot, SIGNAL( plotMousePressed( const QMouseEvent& ) ),
- this, SLOT( plotMousePressed( const QMouseEvent& ) ) );
- connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
- this, SLOT( plotMouseReleased( const QMouseEvent& ) ) );
- connect( myPlot, SIGNAL( legendClicked( long ) ),
- this, SLOT( onLegendClicked( long ) ) );
-
- /* Initial Setup - get from the preferences */
- readPreferences();
-
- myPlot->setMargin( 5 );
- setCurveType( myCurveType, false );
- setXGrid( myXGridMajorEnabled, myXGridMaxMajor, myXGridMinorEnabled, myXGridMaxMinor, false );
- setYGrid( myYGridMajorEnabled, myYGridMaxMajor, myYGridMinorEnabled, myYGridMaxMinor, false );
- setMainTitle( myTitleEnabled, myTitle, false );
- setXTitle( myXTitleEnabled, myXTitle, false );
- setYTitle( myYTitleEnabled, myYTitle, false );
- setHorScaleMode( myXMode, false );
- setVerScaleMode( myYMode, false );
- setBackgroundColor( myBackground );
- setLegendPos( myLegendPos );
- showLegend( myShowLegend, false );
- myPlot->replot();
-
- if ( parent ) {
- resize( (int)(0.8 * parent->width()), (int)(0.8 * parent->height()) );
- }
-}
-/*!
- Destructor
-*/
-Plot2d_ViewFrame::~Plot2d_ViewFrame()
-{
- myActions.clear();
- qApp->removeEventFilter( this );
-}
-/*!
- Creates popup menu actions
-*/
-void Plot2d_ViewFrame::createActions()
-{
- QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
- /* Linear/logarithmic mode */
- // Horizontal axis
- QActionPGroup* modeHorGrp = new QActionPGroup( this );
- modeHorGrp->setExclusive( TRUE );
- QActionP* linearXAction = new QActionP ( tr( "TOT_PLOT2D_MODE_LINEAR_HOR"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_MODE_LINEAR_HOR") ) ,
- tr( "MEN_PLOT2D_MODE_LINEAR_HOR" ), 0, modeHorGrp );
- linearXAction->setStatusTip ( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
- linearXAction->setToggleAction( true );
- myActions.insert( ModeXLinearId, linearXAction );
- QActionP* logXAction = new QActionP ( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_MODE_LOGARITHMIC_HOR") ) ,
- tr( "MEN_PLOT2D_MODE_LOGARITHMIC_HOR" ), 0, modeHorGrp );
- logXAction->setStatusTip ( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) );
- logXAction->setToggleAction( true );
- myActions.insert( ModeXLogarithmicId, logXAction );
- connect( modeHorGrp, SIGNAL( selected( QActionP* ) ), this, SLOT( onHorMode() ) );
-
- // Vertical axis
- QActionPGroup* modeVerGrp = new QActionPGroup( this );
- modeVerGrp->setExclusive( TRUE );
- QActionP* linearYAction = new QActionP ( tr( "TOT_PLOT2D_MODE_LINEAR_VER"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_MODE_LINEAR_VER") ) ,
- tr( "MEN_PLOT2D_MODE_LINEAR_VER" ), 0, modeVerGrp );
- linearYAction->setStatusTip ( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) );
- linearYAction->setToggleAction( true );
- myActions.insert( ModeYLinearId, linearYAction );
- QActionP* logYAction = new QActionP ( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_MODE_LOGARITHMIC_VER") ) ,
- tr( "MEN_PLOT2D_MODE_LOGARITHMIC_VER" ), 0, modeVerGrp );
- logYAction->setStatusTip ( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) );
- logYAction->setToggleAction( true );
- myActions.insert( ModeYLogarithmicId, logYAction );
- connect( modeVerGrp, SIGNAL( selected( QActionP* ) ), this, SLOT( onVerMode() ) );
-
- /* Legend */
- QActionP* legendAction = new QActionP ( tr( "TOT_PLOT2D_SHOW_LEGEND"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_SHOW_LEGEND") ) ,
- tr( "MEN_PLOT2D_SHOW_LEGEND" ), 0, this );
- legendAction->setStatusTip ( tr( "PRP_PLOT2D_SHOW_LEGEND" ) );
- legendAction->setToggleAction( true );
- myActions.insert( LegendId, legendAction );
- connect( legendAction, SIGNAL( activated() ), this, SLOT( onLegend() ) );
-
- /* Curve type */
- QActionPGroup* curveGrp = new QActionPGroup( this );
- curveGrp->setExclusive( TRUE );
- QActionP* pointsAction = new QActionP ( tr( "TOT_PLOT2D_CURVES_POINTS"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_CURVES_POINTS") ) ,
- tr( "MEN_PLOT2D_CURVES_POINTS" ), 0, curveGrp );
- pointsAction->setStatusTip ( tr( "PRP_PLOT2D_CURVES_POINTS" ) );
- pointsAction->setToggleAction( true );
- myActions.insert( CurvePointsId, pointsAction );
- QActionP* linesAction = new QActionP ( tr( "TOT_PLOT2D_CURVES_LINES"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_CURVES_LINES") ) ,
- tr( "MEN_PLOT2D_CURVES_LINES" ), 0, curveGrp );
- linesAction->setStatusTip ( tr( "PRP_PLOT2D_CURVES_LINES" ) );
- linesAction->setToggleAction( true );
- myActions.insert( CurveLinesId, linesAction );
- QActionP* splinesAction = new QActionP ( tr( "TOT_PLOT2D_CURVES_SPLINES"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_CURVES_SPLINES") ) ,
- tr( "MEN_PLOT2D_CURVES_SPLINES" ), 0, curveGrp );
- splinesAction->setStatusTip ( tr( "PRP_PLOT2D_CURVES_SPLINES" ) );
- splinesAction->setToggleAction( true );
- myActions.insert( CurveSplinesId, splinesAction );
- connect( curveGrp, SIGNAL( selected( QActionP* ) ), this, SLOT( onCurves() ) );
-
- // Settings
- QActionP* settingsAction = new QActionP ( tr( "TOT_PLOT2D_SETTINGS"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_SETTINGS") ) ,
- tr( "MEN_PLOT2D_SETTINGS" ), 0, this );
- settingsAction->setStatusTip ( tr( "PRP_PLOT2D_SETTINGS" ) );
- myActions.insert( SettingsId, settingsAction );
- connect( settingsAction, SIGNAL( activated() ), this, SLOT( onSettings() ) );
-
- // Fit Data
- QActionP* fitDataAction = new QActionP ( tr( "TOT_PLOT2D_FITDATA"),
- rmgr->loadPixmap( "SALOMEGUI", tr("ICON_PLOT2D_FITDATA") ) ,
- tr( "MEN_PLOT2D_FITDATA" ), 0, this );
- fitDataAction->setStatusTip ( tr( "PRP_PLOT2D_FITDATA" ) );
- myActions.insert( FitDataId, fitDataAction );
- connect( fitDataAction, SIGNAL( activated() ), this, SLOT( onFitData() ) );
-
- // Change background
- QActionP* changeBGAction = new QActionP ( tr( "TOT_PLOT2D_CHANGE_BACKGROUND"),
- tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), 0, this );
- fitDataAction->setStatusTip ( tr( "PRP_PLOT2D_CHANGE_BACKGROUND" ) );
- myActions.insert( ChangeBackgroundId, changeBGAction );
- connect( changeBGAction, SIGNAL( activated() ), this, SLOT( onChangeBackground() ) );
-}
-/*!
- Gets window's central widget
-*/
-QWidget* Plot2d_ViewFrame::getViewWidget()
-{
- return (QWidget*)myPlot;
-}
-/* Popup management : sets Popup server */
-void Plot2d_ViewFrame::setPopupServer( QAD_Application* App )
-{
-// QAD_PopupClientServer::setPopupServer( (QAD_PopupServer*)App );
-}
-/*!
- Popup menu creation
-*/
-void Plot2d_ViewFrame::onCreatePopup()
-{
- if ( myPopup ) {
- myPopup->clear();
- // scaling
- QPopupMenu* scalingPopup = new QPopupMenu( myPopup );
- myActions[ ModeXLinearId ]->addTo( scalingPopup );
- myActions[ ModeXLogarithmicId ]->addTo( scalingPopup );
- scalingPopup->insertSeparator();
- myActions[ ModeYLinearId ]->addTo( scalingPopup );
- myActions[ ModeYLogarithmicId ]->addTo( scalingPopup );
- myActions[ FitDataId ]->addTo( myPopup );
- myPopup->insertItem( tr( "SCALING_POPUP" ), scalingPopup );
- // curve type
- QPopupMenu* curTypePopup = new QPopupMenu( myPopup );
- myActions[ CurvePointsId ]->addTo( curTypePopup );
- myActions[ CurveLinesId ]->addTo( curTypePopup );
- myActions[ CurveSplinesId ]->addTo( curTypePopup );
- myPopup->insertItem( tr( "CURVE_TYPE_POPUP" ), curTypePopup );
- // legend
- myPopup->insertSeparator();
- myActions[ LegendId ]->addTo( myPopup );
- // settings
- myPopup->insertSeparator();
- myActions[ SettingsId ]->addTo( myPopup );
- // Change background
- myPopup->insertSeparator();
- myActions[ ChangeBackgroundId ]->addTo( myPopup );
- }
-}
-/*!
- Renames curve if it is found
-*/
-void Plot2d_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
-{
- Plot2d_Curve* curve = getCurveByIO( IObject );
- if ( curve ) {
- curve->setVerTitle( newName );
- int key = hasCurve( curve );
- if ( key ) {
- myPlot->setCurveTitle( key, newName );
-// int legendIndex = myPlot->getLegend()->findFirstKey( key );
-// if ( legendIndex != myPlot->getLegend()->itemCnt() )
-// myPlot->getLegend()->setText( legendIndex, aSymbol );
- }
- }
- updateTitles();
-}
-/*!
- Returns true if interactive object is presented in the viewer
-*/
-bool Plot2d_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
-{
- if( getCurveByIO( IObject ) != NULL )
- return 1;
- else{
- if(!IObject.IsNull()){
- QIntDictIterator<Plot2d_Curve> it(myCurves);
- for(; it.current();++it){
- if(it.current()->hasIO() && it.current()->getTableIO()->isSame(IObject))
- return 1;
- }}
- }
- return 0;
-}
-/*!
- Returns true if interactive object is presented in the viewer and displayed
-*/
-bool Plot2d_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
-{
- Plot2d_Curve* curve = getCurveByIO( IObject );
- if ( curve ) {
- int key = hasCurve( curve );
- if ( key )
- return myPlot->curve( key )->enabled();
- }
- return false;
-}
-/*!
- Return interactive obeject if is presented in the viewer
-*/
-Handle(SALOME_InteractiveObject) Plot2d_ViewFrame::FindIObject( const char* Entry )
-{
- Handle(SALOME_InteractiveObject) o;
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- if ( it.current()->hasIO() && !strcmp( it.current()->getIO()->getEntry(), Entry ) ) {
- o = it.current()->getIO();
- break;
- }
- }
- return o;
-}
-/*!
- Actually this method just re-displays curves which refers to the <IObject>
-*/
-void Plot2d_ViewFrame::Display( const Handle(SALOME_InteractiveObject)& IObject, bool update )
-{
- Plot2d_Curve* curve = getCurveByIO( IObject );
- if ( curve )
- updateCurve( curve, update );
-}
-/*!
- Actually this method just erases all curves which don't refer to <IOBject>
- and re-displays curve which is of <IObject>
-*/
-void Plot2d_ViewFrame::DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject )
-{
- Plot2d_Curve* curve = getCurveByIO( IObject );
- QList<Plot2d_Curve> clist;
- getCurves( clist );
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i ) != curve )
- eraseCurve( curve );
- else
- updateCurve( curve, false );
- }
- myPlot->replot();
-}
-/*!
- Removes from the viewer the curves which refer to <IObject>
-*/
-void Plot2d_ViewFrame::Erase( const Handle(SALOME_InteractiveObject)& IObject, bool update )
-{
- Plot2d_Curve* curve = getCurveByIO( IObject );
- if ( curve )
- eraseCurve( curve, update );
- // it can be table or container object selected
- QAD_Study* activeStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::SObject_var aSO = activeStudy->getStudyDocument()->FindObjectID(IObject->getEntry());
- if ( !aSO->_is_nil() ) {
- SALOMEDS::ChildIterator_var aIter = activeStudy->getStudyDocument()->NewChildIterator( aSO );
- for ( ; aIter->More(); aIter->Next() ) {
- SALOMEDS::SObject_var aChildSO = aIter->Value();
- SALOMEDS::SObject_var refSO;
- if ( aChildSO->ReferencedObject( refSO ) && !refSO->_is_nil() )
- aChildSO = refSO;
- curve = getCurveByIO( new SALOME_InteractiveObject( aChildSO->GetID(), "", "" ) );
- if ( curve )
- eraseCurve( curve, update );
- }
- }
-}
-/*!
- Actually this method just re-displays all curves which are presented in the viewer
-*/
-void Plot2d_ViewFrame::DisplayAll()
-{
- QList<Plot2d_Curve> clist;
- getCurves( clist );
- for ( int i = 0; i < clist.count(); i++ ) {
- updateCurve( clist.at( i ), false );
- }
- myPlot->replot();
-}
-/*!
- Removes all curves from the view
-*/
-void Plot2d_ViewFrame::EraseAll()
-{
- myPlot->clear();
- myCurves.clear();
- myPlot->replot();
-}
-/*!
- Redraws viewframe contents
-*/
-void Plot2d_ViewFrame::Repaint()
-{
- myPlot->replot();
-}
-/*!
- Event filter
-*/
-bool Plot2d_ViewFrame::eventFilter( QObject* o, QEvent* e )
-{
- if ( ( e->type() == QEvent::MouseButtonPress || e->type() == QEvent::KeyPress ) && o != myPlot->canvas() ) {
- myOperation = NoOpId;
- qApp->removeEventFilter( this );
- }
- return QMainWindow::eventFilter( o, e );
-}
-/*!
- Sets title
-*/
-void Plot2d_ViewFrame::setTitle( const QString& title )
-{
- setMainTitle( myTitleEnabled, title, true );
-}
-/*!
- Reads Plot2d view settings from the preferences
-*/
-void Plot2d_ViewFrame::readPreferences()
-{
- if ( QAD_CONFIG->hasSetting( "Plot2d:CurveType" ) ) { // curve type
- myCurveType = QAD_CONFIG->getSetting( "Plot2d:CurveType" ).toInt();
- if ( myCurveType < 0 || myCurveType > 2 ) myCurveType = 1;
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:ShowLegend" ) ) {
- myShowLegend = QAD_CONFIG->getSetting( "Plot2d:ShowLegend" ) == QString( "true" ); // show legend
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:LegendPos" ) ) { // legend position
- myLegendPos = QAD_CONFIG->getSetting( "Plot2d:LegendPos" ).toInt();
- if ( myLegendPos < 0 || myLegendPos > 3 ) myLegendPos = 1;
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:MarkerSize" ) ) { // marker size
- myMarkerSize = QAD_CONFIG->getSetting( "Plot2d:MarkerSize" ).toInt();
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:Background" ) ) { // background color
- QString bgString = QAD_CONFIG->getSetting( "Plot2d:Background" );
- QStringList bgData = QStringList::split( ":", bgString, true );
- int bgRed = 0, bgGreen = 0, bgBlue = 0;
- if ( bgData.count() > 0 ) bgRed = bgData[ 0 ].toInt();
- if ( bgData.count() > 1 ) bgGreen = bgData[ 1 ].toInt();
- if ( bgData.count() > 2 ) bgBlue = bgData[ 2 ].toInt();
- myBackground = QColor( bgRed, bgGreen, bgBlue );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:ShowTitle" ) ) { // main title
- myTitleEnabled = QAD_CONFIG->getSetting( "Plot2d:ShowTitle" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:ShowHorTitle" ) ) { // hor.axis title
- myXTitleEnabled = QAD_CONFIG->getSetting( "Plot2d:ShowHorTitle" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:ShowVerTitle" ) ) { // ver.axisn title
- myYTitleEnabled = QAD_CONFIG->getSetting( "Plot2d:ShowVerTitle" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:EnableHorMajorGrid" ) ) { // grid
- myXGridMajorEnabled = QAD_CONFIG->getSetting( "Plot2d:EnableHorMajorGrid" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:EnableVerMajorGrid" ) ) {
- myYGridMajorEnabled = QAD_CONFIG->getSetting( "Plot2d:EnableVerMajorGrid" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:EnableHorMinorGrid" ) ) {
- myXGridMinorEnabled = QAD_CONFIG->getSetting( "Plot2d:EnableHorMinorGrid" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:EnableVerMinorGrid" ) ) {
- myYGridMinorEnabled = QAD_CONFIG->getSetting( "Plot2d:EnableVerMinorGrid" ) == QString( "true" );
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:HorMajorGridMax" ) ) {
- myXGridMaxMajor = QAD_CONFIG->getSetting( "Plot2d:HorMajorGridMax" ).toInt();
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:VerMajorGridMax" ) ) {
- myYGridMaxMajor = QAD_CONFIG->getSetting( "Plot2d:VerMajorGridMax" ).toInt();
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:HorMinorGridMax" ) ) {
- myXGridMaxMinor = QAD_CONFIG->getSetting( "Plot2d:HorMinorGridMax" ).toInt();
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:VerMinorGridMax" ) ) {
- myYGridMaxMinor = QAD_CONFIG->getSetting( "Plot2d:VerMinorGridMax" ).toInt();
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:HorScaleMode" ) ) { // scale mode
- myXMode = QAD_CONFIG->getSetting( "Plot2d:HorScaleMode" ).toInt();
- if ( myXMode < 0 || myXMode > 1 ) myXMode = 0;
- }
- if ( QAD_CONFIG->hasSetting( "Plot2d:VerScaleMode" ) ) {
- myYMode = QAD_CONFIG->getSetting( "Plot2d:VerScaleMode" ).toInt();
- if ( myYMode < 0 || myYMode > 1 ) myYMode = 0;
- }
-}
-/*!
- Writes Plot2d view settings to the preferences
-*/
-void Plot2d_ViewFrame::writePreferences()
-{
- QAD_CONFIG->addSetting( "Plot2d:CurveType", myCurveType ); // curve type
- QAD_CONFIG->addSetting( "Plot2d:ShowLegend", myShowLegend ? "true" : "false" ); // show legend
- QAD_CONFIG->addSetting( "Plot2d:LegendPos", myLegendPos ); // legend position
- QAD_CONFIG->addSetting( "Plot2d:MarkerSize", myMarkerSize ); // marker size
- QStringList bgData;
- bgData.append( QString::number( myBackground.red() ) );
- bgData.append( QString::number( myBackground.green() ) );
- bgData.append( QString::number( myBackground.blue() ) );
- QAD_CONFIG->addSetting( "Plot2d:Background", bgData.join( ":" ) ); // background color
- QAD_CONFIG->addSetting( "Plot2d:ShowTitle", myTitleEnabled ? "true" : "false" ); // titles
- QAD_CONFIG->addSetting( "Plot2d:ShowHorTitle", myXTitleEnabled ? "true" : "false" );
- QAD_CONFIG->addSetting( "Plot2d:ShowVerTitle", myYTitleEnabled ? "true" : "false" );
- QAD_CONFIG->addSetting( "Plot2d:EnableHorMajorGrid", myXGridMajorEnabled ? "true" : "false" ); // grid
- QAD_CONFIG->addSetting( "Plot2d:EnableVerMajorGrid", myYGridMajorEnabled ? "true" : "false" );
- QAD_CONFIG->addSetting( "Plot2d:EnableHorMinorGrid", myXGridMinorEnabled ? "true" : "false" );
- QAD_CONFIG->addSetting( "Plot2d:EnableVerMinorGrid", myYGridMinorEnabled ? "true" : "false" );
- QAD_CONFIG->addSetting( "Plot2d:HorMajorGridMax", myXGridMaxMajor );
- QAD_CONFIG->addSetting( "Plot2d:VerMajorGridMax", myYGridMaxMajor );
- QAD_CONFIG->addSetting( "Plot2d:HorMinorGridMax", myXGridMaxMinor );
- QAD_CONFIG->addSetting( "Plot2d:VerMinorGridMax", myYGridMaxMinor );
- QAD_CONFIG->addSetting( "Plot2d:HorScaleMode", myXMode ); // scale mode
- QAD_CONFIG->addSetting( "Plot2d:VerScaleMode", myYMode );
-}
-/*!
- Prints mouse cursor coordinates into string
-*/
-QString Plot2d_ViewFrame::getInfo( const QPoint& pnt )
-{
- bool xFound = false, yFound = false;
- double xCoord, yCoord;
- const QwtScaleDiv* aXscale = myPlot->axisScale( QwtPlot::xBottom );
- for ( int i = 0; i < aXscale->majCnt(); i++ ) {
- double majXmark = aXscale->majMark( i );
- int xmark = myPlot->transform( QwtPlot::xBottom, majXmark );
- if ( xmark-2 == pnt.x() ) {
- xCoord = majXmark;
- xFound = true;
- MESSAGE("Plot2d_ViewFrame::getInfo : close maj X mark("<<i<<") = "<<majXmark<<" "<<xmark<<" "<<pnt.x());
- break;
- }
- }
- if ( !xFound ) {
- for ( int i = 0; i < aXscale->minCnt(); i++ ) {
- double minXmark = aXscale->minMark( i );
- int xmark = myPlot->transform( QwtPlot::xBottom, minXmark );
- if ( xmark-2 == pnt.x() ) {
- xCoord = minXmark;
- xFound = true;
- MESSAGE("Plot2d_ViewFrame::getInfo : close min X mark("<<i<<") = "<<minXmark<<" "<<xmark<<" "<<pnt.x());
- break;
- }
- }
- }
- const QwtScaleDiv* aYscale = myPlot->axisScale( QwtPlot::yLeft );
- for ( int i = 0; i < aYscale->majCnt(); i++ ) {
- double majYmark = aYscale->majMark( i );
- int ymark = myPlot->transform( QwtPlot::yLeft, majYmark );
- if ( ymark-2 == pnt.y() ) {
- yCoord = majYmark;
- yFound = true;
- break;
- }
- }
- if ( !yFound ) {
- for ( int i = 0; i < aYscale->minCnt(); i++ ) {
- double minYmark = aYscale->minMark( i );
- int ymark = myPlot->transform( QwtPlot::yLeft, minYmark );
- if ( ymark-2 == pnt.y() ) {
- yCoord = minYmark;
- yFound = true;
- break;
- }
- }
- }
- QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).stripWhiteSpace();
- if ( strX == "-0" )
- strX = "0";
- QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).stripWhiteSpace();
- if ( strY == "-0" )
- strY = "0";
- QString info = tr("INF_COORDINATES").arg( strX ).arg( strY );
- return info;
-}
-/*!
- Converts Plot2d_Curve's marker style to Qwt marker style [ static ]
-*/
-static QwtSymbol::Style plot2qwtMarker( Plot2d_Curve::MarkerType m )
-{
- QwtSymbol::Style ms = QwtSymbol::None;
- switch ( m ) {
- case Plot2d_Curve::Circle:
- ms = QwtSymbol::Ellipse; break;
- case Plot2d_Curve::Rectangle:
- ms = QwtSymbol::Rect; break;
- case Plot2d_Curve::Diamond:
- ms = QwtSymbol::Diamond; break;
- case Plot2d_Curve::DTriangle:
- ms = QwtSymbol::DTriangle; break;
- case Plot2d_Curve::UTriangle:
- ms = QwtSymbol::UTriangle; break;
- case Plot2d_Curve::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = QwtSymbol::RTriangle; break;
- case Plot2d_Curve::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = QwtSymbol::LTriangle; break;
- case Plot2d_Curve::Cross:
- ms = QwtSymbol::Cross; break;
- case Plot2d_Curve::XCross:
- ms = QwtSymbol::XCross; break;
- case Plot2d_Curve::None:
- default:
- ms = QwtSymbol::None; break;
- }
- return ms;
-}
-/*!
- Converts Qwt marker style to Plot2d_Curve's marker style [ static ]
-*/
-static Plot2d_Curve::MarkerType qwt2plotMarker( QwtSymbol::Style m )
-{
- Plot2d_Curve::MarkerType ms = Plot2d_Curve::None;
- switch ( m ) {
- case QwtSymbol::Ellipse:
- ms = Plot2d_Curve::Circle; break;
- case QwtSymbol::Rect:
- ms = Plot2d_Curve::Rectangle; break;
- case QwtSymbol::Diamond:
- ms = Plot2d_Curve::Diamond; break;
- case QwtSymbol::DTriangle:
- ms = Plot2d_Curve::DTriangle; break;
- case QwtSymbol::UTriangle:
- ms = Plot2d_Curve::UTriangle; break;
- case QwtSymbol::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = Plot2d_Curve::LTriangle; break;
- case QwtSymbol::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = Plot2d_Curve::RTriangle; break;
- case QwtSymbol::Cross:
- ms = Plot2d_Curve::Cross; break;
- case QwtSymbol::XCross:
- ms = Plot2d_Curve::XCross; break;
- case QwtSymbol::None:
- default:
- ms = Plot2d_Curve::None; break;
- }
- return ms;
-}
-/*!
- Converts Plot2d_Curve's line style to Qwt line style [ static ]
-*/
-static Qt::PenStyle plot2qwtLine( Plot2d_Curve::LineType p )
-{
- Qt::PenStyle ps = Qt::NoPen;
- switch ( p ) {
- case Plot2d_Curve::Solid:
- ps = Qt::SolidLine; break;
- case Plot2d_Curve::Dash:
- ps = Qt::DashLine; break;
- case Plot2d_Curve::Dot:
- ps = Qt::DotLine; break;
- case Plot2d_Curve::DashDot:
- ps = Qt::DashDotLine; break;
- case Plot2d_Curve::DashDotDot:
- ps = Qt::DashDotDotLine; break;
- case Plot2d_Curve::NoPen:
- default:
- ps = Qt::NoPen; break;
- }
- return ps;
-}
-/*!
- Converts Qwt line style to Plot2d_Curve's line style [ static ]
-*/
-static Plot2d_Curve::LineType qwt2plotLine( Qt::PenStyle p )
-{
- Plot2d_Curve::LineType ps = Plot2d_Curve::NoPen;
- switch ( p ) {
- case Qt::SolidLine:
- ps = Plot2d_Curve::Solid; break;
- case Qt::DashLine:
- ps = Plot2d_Curve::Dash; break;
- case Qt::DotLine:
- ps = Plot2d_Curve::Dot; break;
- case Qt::DashDotLine:
- ps = Plot2d_Curve::DashDot; break;
- case Qt::DashDotDotLine:
- ps = Plot2d_Curve::DashDotDot; break;
- case Qt::NoPen:
- default:
- ps = Plot2d_Curve::NoPen; break;
- }
- return ps;
-}
-/*!
- Adds curve into view
-*/
-void Plot2d_ViewFrame::displayCurve( Plot2d_Curve* curve, bool update )
-{
- if ( !curve )
- return;
- if ( hasCurve( curve ) ) {
- updateCurve( curve, update );
- }
- else {
- long curveKey = myPlot->insertCurve( curve->getVerTitle() );
- myCurves.insert( curveKey, curve );
- if ( curve->isAutoAssign() ) {
- QwtSymbol::Style typeMarker;
- QColor color;
- Qt::PenStyle typeLine;
- myPlot->getNextMarker( typeMarker, color, typeLine );
- myPlot->setCurvePen( curveKey, QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( typeMarker,
- QBrush( color ),
- QPen( color ),
- QSize( myMarkerSize, myMarkerSize ) ) );
- curve->setColor( color );
- curve->setLine( qwt2plotLine( typeLine ) );
- curve->setMarker( qwt2plotMarker( typeMarker ) );
- }
- else {
- Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
- QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
- QBrush( curve->getColor() ),
- QPen( curve->getColor() ),
- QSize( myMarkerSize, myMarkerSize ) ) );
- }
- if ( myCurveType == 0 )
- myPlot->setCurveStyle( curveKey, QwtCurve::NoCurve );
- else if ( myCurveType == 1 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Lines );
- else if ( myCurveType == 2 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Spline );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
- }
- updateTitles();
- if ( update )
- myPlot->replot();
-}
-/*!
- Adds curves into view
-*/
-void Plot2d_ViewFrame::displayCurves( Plot2d_CurveContainer& curves, bool update )
-{
- myPlot->setUpdatesEnabled( false );
- for ( int i = 0; i < curves.count(); i++ ) {
- displayCurve( curves.curve( i ), false );
- }
-// fitAll();
- myPlot->setUpdatesEnabled( true );
- if ( update )
- myPlot->replot();
-}
-/*!
- Erases curve
-*/
-void Plot2d_ViewFrame::eraseCurve( Plot2d_Curve* curve, bool update )
-{
- if ( !curve )
- return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
- myPlot->removeCurve( curveKey );
- myCurves.remove( curveKey );
- updateTitles();
- if ( update )
- myPlot->replot();
- }
-}
-/*!
- Erases curves
-*/
-void Plot2d_ViewFrame::eraseCurves( Plot2d_CurveContainer& curves, bool update )
-{
- for ( int i = 0; i < curves.count(); i++ ) {
- eraseCurve( curves.curve( i ), false );
- }
-// fitAll();
- if ( update )
- myPlot->replot();
-}
-/*!
- Updates curves attributes
-*/
-void Plot2d_ViewFrame::updateCurve( Plot2d_Curve* curve, bool update )
-{
- if ( !curve )
- return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
- if ( !curve->isAutoAssign() ) {
- Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
- QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
- QBrush( curve->getColor() ),
- QPen( curve->getColor() ),
- QSize( myMarkerSize, myMarkerSize ) ) );
- }
- myPlot->setCurveTitle( curveKey, curve->getVerTitle() );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
- myPlot->curve( curveKey )->setEnabled( true );
- updateTitles();
- if ( update )
- myPlot->replot();
- }
-}
-/*!
- Returns curve key if is is displayed in the viewer and 0 otherwise
-*/
-int Plot2d_ViewFrame::hasCurve( Plot2d_Curve* curve )
-{
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- if ( it.current() == curve )
- return it.currentKey();
- }
- return 0;
-}
-Plot2d_Curve* Plot2d_ViewFrame::getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject )
-{
- if ( !theIObject.IsNull() ) {
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- if ( it.current()->hasIO() && it.current()->getIO()->isSame( theIObject ) )
- return it.current();
- }
- }
- return 0;
-}
-/*!
- Gets lsit of displayed curves
-*/
-int Plot2d_ViewFrame::getCurves( QList<Plot2d_Curve>& clist )
-{
- clist.clear();
- clist.setAutoDelete( false );
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- clist.append( it.current() );
- }
- return clist.count();
-}
-
-/*!
- Updates titles according to curves
-*/
-#define BRACKETIZE(x) QString( "[ " ) + x + QString( " ]" )
-void Plot2d_ViewFrame::updateTitles()
-{
- QAD_Study* activeStudy = QAD_Application::getDesktop()->getActiveStudy();
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- QStringList aXTitles;
- QStringList aYTitles;
- QStringList aXUnits;
- QStringList aYUnits;
- QStringList aTables;
- int i = 0;
- while ( it.current() ) {
- // collect titles and units from all curves...
- QString xTitle = it.current()->getHorTitle().stripWhiteSpace();
- QString yTitle = it.current()->getVerTitle().stripWhiteSpace();
- QString xUnits = it.current()->getHorUnits().stripWhiteSpace();
- QString yUnits = it.current()->getVerUnits().stripWhiteSpace();
-
- aYTitles.append( yTitle );
- if ( aXTitles.find( xTitle ) == aXTitles.end() )
- aXTitles.append( xTitle );
- if ( aXUnits.find( xUnits ) == aXUnits.end() )
- aXUnits.append( xUnits );
- if ( aYUnits.find( yUnits ) == aYUnits.end() )
- aYUnits.append( yUnits );
-
- if ( activeStudy && it.current()->hasTableIO() ) {
- SALOMEDS::SObject_var SO = activeStudy->getStudyDocument()->FindObjectID( it.current()->getTableIO()->getEntry() );
- if ( !SO->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
- QString aName = aNameAttr->Value();
- if ( !aName.isEmpty() && aTables.find( aName ) == aTables.end() )
- aTables.append( aName );
- }
- }
- }
-
- ++it;
- ++i;
- }
- // ... and update plot 2d view
- QString xUnits, yUnits;
- if ( aXUnits.count() == 1 && !aXUnits[0].isEmpty() )
- xUnits = BRACKETIZE( aXUnits[0] );
- if ( aYUnits.count() == 1 && !aYUnits[0].isEmpty())
- yUnits = BRACKETIZE( aYUnits[0] );
- QString xTitle, yTitle;
- if ( aXTitles.count() == 1 && aXUnits.count() == 1 )
- xTitle = aXTitles[0];
- if ( aYTitles.count() == 1 )
- yTitle = aYTitles[0];
-
- if ( !xTitle.isEmpty() && !xUnits.isEmpty() )
- xTitle += " ";
- if ( !yTitle.isEmpty() && !yUnits.isEmpty() )
- yTitle += " ";
-
- setXTitle( myXTitleEnabled, xTitle + xUnits );
- setYTitle( myYTitleEnabled, yTitle + yUnits );
- setTitle( aTables.join("; ") );
-}
-/*!
- Fits the view to see all data
-*/
-void Plot2d_ViewFrame::fitAll()
-{
- myPlot->setAxisAutoScale( QwtPlot::yLeft );
- myPlot->setAxisAutoScale( QwtPlot::xBottom );
- myPlot->replot();
-}
-/*!
- Fits the view to rectangle area (pixels)
-*/
-void Plot2d_ViewFrame::fitArea( const QRect& area )
-{
- QRect rect = area.normalize();
- if ( rect.width() < MIN_RECT_SIZE ) {
- rect.setWidth( MIN_RECT_SIZE );
- rect.setLeft( rect.left() - MIN_RECT_SIZE/2 );
- }
- if ( rect.height() < MIN_RECT_SIZE ) {
- rect.setHeight( MIN_RECT_SIZE );
- rect.setTop( rect.top() - MIN_RECT_SIZE/2 );
- }
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, rect.top() ),
- myPlot->invTransform( QwtPlot::yLeft, rect.bottom() ) );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, rect.left() ),
- myPlot->invTransform( QwtPlot::xBottom, rect.right() ) );
- myPlot->replot();
-}
-/*!
- Tests if it is necessary to start operation on mouse action
-*/
-int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
-{
- int btn = me.button() | me.state();
- int zoomBtn = ControlButton | LeftButton;
- int panBtn = ControlButton | MidButton;
- int fitBtn = ControlButton | RightButton;
-
- if ( btn == zoomBtn )
- return ZoomId;
- if ( btn == panBtn )
- return PanId;
- if ( btn == fitBtn )
- return FitAreaId;
- return NoOpId;
-}
-/*!
- Mode toolbar buttons slot - horizontal axis (<Linear>/<Logarithmic>)
-*/
-void Plot2d_ViewFrame::onHorMode()
-{
- if ( myActions[ ModeXLinearId ]->isOn() )
- setHorScaleMode( 0 );
- else if ( myActions[ ModeXLogarithmicId ]->isOn() )
- setHorScaleMode( 1 );
-}
-/*!
- Mode toolbar buttons slot - vertical axis (<Linear>/<Logarithmic>)
-*/
-void Plot2d_ViewFrame::onVerMode()
-{
- if ( myActions[ ModeYLinearId ]->isOn() )
- setVerScaleMode( 0 );
- else if ( myActions[ ModeYLogarithmicId ]->isOn() )
- setVerScaleMode( 1 );
-}
-/*!
- "Show/hide legend" toolbar action slot
-*/
-void Plot2d_ViewFrame::onLegend()
-{
- showLegend( myActions[ LegendId ]->isOn() );
-}
-/*!
- "Curve type" toolbar action slot
-*/
-void Plot2d_ViewFrame::onCurves()
-{
- if ( myActions[ CurvePointsId ]->isOn() )
- setCurveType( 0 );
- else if ( myActions[ CurveLinesId ]->isOn() )
- setCurveType( 1 );
- else if ( myActions[ CurveSplinesId ]->isOn() )
- setCurveType( 2 );
-}
-/*!
- "Settings" toolbar action slot
-*/
-void Plot2d_ViewFrame::onSettings()
-{
-#ifdef TEST_AUTOASSIGN
- typedef QMap<int,int> IList;
- typedef QMap<QString,int> SList;
- IList mars, lins;
- SList cols;
- cols[ "red-min" ] = 1000;
- cols[ "red-max" ] = -1;
- cols[ "green-min" ] = 1000;
- cols[ "green-max" ] = -1;
- cols[ "blue-min" ] = 1000;
- cols[ "blue-max" ] = -1;
- for ( unsigned i = 0; i < 10000; i++ ) {
- QwtSymbol::Style typeMarker;
- QColor color;
- Qt::PenStyle typeLine;
- myPlot->getNextMarker( typeMarker, color, typeLine );
- if ( mars.contains(typeMarker) )
- mars[ typeMarker ] = mars[ typeMarker ]+1;
- else
- mars[ typeMarker ] = 0;
- if ( lins.contains(typeLine) )
- lins[ typeLine ] = lins[ typeLine ]+1;
- else
- lins[ typeLine ] = 0;
- if ( cols[ "red-max" ] < color.red() )
- cols[ "red-max" ] = color.red();
- if ( cols[ "red-min" ] > color.red() )
- cols[ "red-min" ] = color.red();
- if ( cols[ "green-max" ] < color.green() )
- cols[ "green-max" ] = color.green();
- if ( cols[ "green-min" ] > color.green() )
- cols[ "green-min" ] = color.green();
- if ( cols[ "blue-max" ] < color.blue() )
- cols[ "blue-max" ] = color.blue();
- if ( cols[ "blue-min" ] > color.blue() )
- cols[ "blue-min" ] = color.blue();
- }
- for (IList::Iterator it = mars.begin(); it != mars.end(); ++it)
- MESSAGE("markers( " << it.key() << ") = " << it.data() );
- for (IList::Iterator it = lins.begin(); it != lins.end(); ++it)
- MESSAGE("lines( " << it.key() << ") = " << it.data() );
- for (SList::Iterator it = cols.begin(); it != cols.end(); ++it)
- MESSAGE("colors( " << it.key() << ") = " << it.data() );
-#endif
-
- Plot2d_SetupViewDlg* dlg = new Plot2d_SetupViewDlg( this, true );
- dlg->setMainTitle( myTitleEnabled, myTitle );
- dlg->setXTitle( myXTitleEnabled, myXTitle );
- dlg->setYTitle( myYTitleEnabled, myYTitle );
- dlg->setCurveType( myCurveType );
- dlg->setLegend( myShowLegend, myLegendPos );
- dlg->setMarkerSize( myMarkerSize );
- dlg->setBackgroundColor( myBackground );
- dlg->setMajorGrid( myXGridMajorEnabled, myPlot->axisMaxMajor( QwtPlot::xBottom ),
- myYGridMajorEnabled, myPlot->axisMaxMajor( QwtPlot::yLeft ) );
- dlg->setMinorGrid( myXGridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::xBottom ),
- myYGridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yLeft ) );
- dlg->setScaleMode( myXMode, myYMode );
-
- if ( dlg->exec() == QDialog::Accepted ) {
- // horizontal axis title
- setXTitle( dlg->isXTitleEnabled(), dlg->getXTitle(), false );
- // vertical axis title
- setYTitle( dlg->isYTitleEnabled(), dlg->getYTitle(), false );
- // main title
- setMainTitle( dlg->isMainTitleEnabled(), dlg->getMainTitle(), true );
- // curve type
- if ( myCurveType != dlg->getCurveType() ) {
- setCurveType( dlg->getCurveType(), false );
- }
- // legend
- if ( myShowLegend != dlg->isLegendEnabled() ) {
- showLegend( dlg->isLegendEnabled(), false );
- }
- if ( myLegendPos != dlg->getLegendPos() ) {
- setLegendPos( dlg->getLegendPos() );
- }
- // marker size
- if ( myMarkerSize != dlg->getMarkerSize() ) {
- setMarkerSize( dlg->getMarkerSize(), false );
- }
- // background color
- if ( myBackground != dlg->getBackgroundColor() ) {
- setBackgroundColor( dlg->getBackgroundColor() );
- }
- // grid
- bool aXGridMajorEnabled, aXGridMinorEnabled, aYGridMajorEnabled, aYGridMinorEnabled;
- int aXGridMaxMajor, aXGridMaxMinor, aYGridMaxMajor, aYGridMaxMinor;
- dlg->getMajorGrid( aXGridMajorEnabled, aXGridMaxMajor, aYGridMajorEnabled, aYGridMaxMajor );
- dlg->getMinorGrid( aXGridMinorEnabled, aXGridMaxMinor, aYGridMinorEnabled, aYGridMaxMinor );
- setXGrid( aXGridMajorEnabled, aXGridMaxMajor, aXGridMinorEnabled, aXGridMaxMinor, false );
- setYGrid( aYGridMajorEnabled, aYGridMaxMajor, aYGridMinorEnabled, aYGridMaxMinor, false );
- // scale mode
- if ( myXMode != dlg->getXScaleMode() ) {
- setHorScaleMode( dlg->getXScaleMode() );
- }
- if ( myYMode != dlg->getYScaleMode() ) {
- setVerScaleMode( dlg->getYScaleMode() );
- }
- // update view
- myPlot->replot();
- // update preferences
- if ( dlg->isSetAsDefault() )
- writePreferences();
- }
- delete dlg;
-}
-/*!
- "Fit Data" command slot
-*/
-void Plot2d_ViewFrame::onFitData()
-{
- Plot2d_FitDataDlg* dlg = new Plot2d_FitDataDlg( this );
- int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).i1();
- int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).i2();
- int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).i1();
- int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).i2();
- double xMin = myPlot->invTransform(QwtPlot::xBottom, ixMin);
- double xMax = myPlot->invTransform(QwtPlot::xBottom, ixMax);
- double yMin = myPlot->invTransform(QwtPlot::yLeft, iyMin);
- double yMax = myPlot->invTransform(QwtPlot::yLeft, iyMax);
-
- dlg->setRange( xMin, xMax, yMin, yMax );
- if ( dlg->exec() == QDialog::Accepted ) {
- int mode = dlg->getRange( xMin, xMax, yMin, yMax );
- if ( mode == 0 || mode == 2 )
- myPlot->setAxisScale( QwtPlot::yLeft, yMax, yMin );
- if ( mode == 0 || mode == 1 )
- myPlot->setAxisScale( QwtPlot::xBottom, xMin, xMax );
- myPlot->replot();
- }
- delete dlg;
-}
-/*!
- Change background color
-*/
-void Plot2d_ViewFrame::onChangeBackground()
-{
- QColor selColor = QColorDialog::getColor ( backgroundColor(), this );
- if ( selColor.isValid() ) {
- setBackgroundColor( selColor );
- }
-}
-/*!
- Sets curve type
-*/
-void Plot2d_ViewFrame::setCurveType( int curveType, bool update )
-{
- myCurveType = curveType;
- if ( curveType == 0 )
- myActions[ CurvePointsId ]->setOn( true );
- else if ( curveType == 1 )
- myActions[ CurveLinesId ]->setOn( true );
- else if ( curveType == 2 )
- myActions[ CurveSplinesId ]->setOn( true );
-
- QArray<long> keys = myPlot->curveKeys();
- for ( int i = 0; i < keys.count(); i++ ) {
- if ( myCurveType == 0 )
- myPlot->setCurveStyle( keys[i], QwtCurve::NoCurve );
- else if ( myCurveType == 1 )
- myPlot->setCurveStyle( keys[i], QwtCurve::Lines );
- else if ( myCurveType == 2 )
- myPlot->setCurveStyle( keys[i], QwtCurve::Spline );
- }
- if ( update )
- myPlot->replot();
-}
-/*!
- Shows/hides legend
-*/
-void Plot2d_ViewFrame::showLegend( bool show, bool update )
-{
- myShowLegend = show;
- myActions[ LegendId ]->setOn( myShowLegend );
- {
- myPlot->setAutoLegend( myShowLegend );
- myPlot->enableLegend( myShowLegend );
- }
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets legend position : 0 - left, 1 - right, 2 - top, 3 - bottom
-*/
-void Plot2d_ViewFrame::setLegendPos( int pos )
-{
- myLegendPos = pos;
- switch( pos ) {
- case 0:
- myPlot->setLegendPos( Qwt::Left );
- break;
- case 1:
- myPlot->setLegendPos( Qwt::Right );
- break;
- case 2:
- myPlot->setLegendPos( Qwt::Top );
- break;
- case 3:
- myPlot->setLegendPos( Qwt::Bottom );
- break;
- }
-}
-/*!
- Sets new marker size
-*/
-void Plot2d_ViewFrame::setMarkerSize( const int size, bool update )
-{
- if ( myMarkerSize != size ) {
- myMarkerSize = size;
- QArray<long> keys = myPlot->curveKeys();
- for ( int i = 0; i < keys.count(); i++ ) {
- QwtPlotCurve* crv = myPlot->curve( keys[i] );
- if ( crv ) {
- QwtSymbol aSymbol = crv->symbol();
- aSymbol.setSize( myMarkerSize, myMarkerSize );
- crv->setSymbol( aSymbol );
- int legendIndex = myPlot->getLegend()->findFirstKey( keys[i] );
- if ( legendIndex != myPlot->getLegend()->itemCnt() )
- myPlot->getLegend()->setSymbol( legendIndex, aSymbol );
- }
- }
- if ( update )
- myPlot->replot();
- }
-}
-/*!
- Sets background color
-*/
-void Plot2d_ViewFrame::setBackgroundColor( const QColor& color )
-{
- myBackground = color;
- //myPlot->setCanvasBackground( myBackground );
- myPlot->canvas()->setPalette( myBackground );
- myPlot->setPalette( myBackground );
- QPalette aPal = myPlot->getLegend()->palette();
- for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
- QPalette::ColorGroup cg = (QPalette::ColorGroup)i;
- aPal.setColor( cg, QColorGroup::Base, myBackground );
- aPal.setColor( cg, QColorGroup::Background, myBackground );
- }
- myPlot->getLegend()->setPalette( aPal );
-}
-/*!
- Gets background color
-*/
-QColor Plot2d_ViewFrame::backgroundColor() const
-{
- return myBackground;
-}
-/*!
- Sets hor.axis grid parameters
-*/
-void Plot2d_ViewFrame::setXGrid( bool xMajorEnabled, const int xMajorMax,
- bool xMinorEnabled, const int xMinorMax,
- bool update )
-{
- myXGridMajorEnabled = xMajorEnabled;
- myXGridMinorEnabled = xMinorEnabled;
- myXGridMaxMajor = xMajorMax;
- myXGridMaxMinor = xMinorMax;
- myPlot->setAxisMaxMajor( QwtPlot::xBottom, myXGridMaxMajor );
- myPlot->setAxisMaxMinor( QwtPlot::xBottom, myXGridMaxMinor );
- myPlot->enableGridX( myXGridMajorEnabled );
- myPlot->enableGridXMin( myXGridMinorEnabled );
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets ver.axis grid parameters
-*/
-void Plot2d_ViewFrame::setYGrid( bool yMajorEnabled, const int yMajorMax,
- bool yMinorEnabled, const int yMinorMax,
- bool update )
-{
- myYGridMajorEnabled = yMajorEnabled;
- myYGridMinorEnabled = yMinorEnabled;
- myYGridMaxMajor = yMajorMax;
- myYGridMaxMinor = yMinorMax;
- myPlot->setAxisMaxMajor( QwtPlot::yLeft, myYGridMaxMajor );
- myPlot->setAxisMaxMinor( QwtPlot::yLeft, myYGridMaxMinor );
- myPlot->enableGridY( myYGridMajorEnabled );
- myPlot->enableGridYMin( myYGridMinorEnabled );
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets main title
-*/
-void Plot2d_ViewFrame::setMainTitle( bool enabled, const QString& title, bool update )
-{
- myTitleEnabled = enabled;
- myTitle = title;
- myPlot->setTitle( myTitleEnabled ? myTitle : QString::null );
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets hor.axis title
-*/
-void Plot2d_ViewFrame::setXTitle( bool enabled, const QString& title, bool update )
-{
- myXTitleEnabled = enabled;
- myXTitle = title;
- myPlot->setAxisTitle( QwtPlot::xBottom, myXTitleEnabled ? myXTitle : QString::null );
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets ver.axis title
-*/
-void Plot2d_ViewFrame::setYTitle( bool enabled, const QString& title, bool update )
-{
- myYTitleEnabled = enabled;
- myYTitle = title;
- myPlot->setAxisTitle( QwtPlot::yLeft, myYTitleEnabled ? myYTitle : QString::null );
- if ( update )
- myPlot->replot();
-}
-/*!
- Sets scale mode for horizontal axis: 0 - linear, 1 - logarithmic
-*/
-void Plot2d_ViewFrame::setHorScaleMode( const int mode, bool update )
-{
- myXMode = mode;
- if ( myXMode == 0 ) { // linear
- myActions[ ModeXLogarithmicId ]->setOn( false );
- myActions[ ModeXLinearId ]->setOn( true );
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
- }
- else { // logarithmic
- myActions[ ModeXLinearId ]->setOn( false );
- myActions[ ModeXLogarithmicId ]->setOn( true );
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, true );
- }
- if ( update )
-// myPlot->replot();
- fitAll();
-}
-/*!
- Sets scale mode for vertical axis: 0 - linear, 1 - logarithmic
-*/
-void Plot2d_ViewFrame::setVerScaleMode( const int mode, bool update )
-{
- myYMode = mode;
- if ( myYMode == 0 ) { // linear
- myActions[ ModeYLogarithmicId ]->setOn( false );
- myActions[ ModeYLinearId ]->setOn( true );
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
- }
- else { // logarithmic
- myActions[ ModeYLinearId ]->setOn( false );
- myActions[ ModeYLogarithmicId ]->setOn( true );
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, true );
- }
- if ( update )
-// myPlot->replot();
- fitAll();
-}
-/*!
- Slot, called when Legend item is clicked
-*/
-void Plot2d_ViewFrame::onLegendClicked( long key )
-{
- Plot2d_Curve* curve = myCurves[ key ];
- if ( curve && curve->hasIO() ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
- Sel->ClearIObjects();
- Sel->AddIObject( curve->getIO(), true );
- }
-}
-
-/*!
- Slot, called when user presses mouse button
-*/
-void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me )
-{
- if ( myOperation == NoOpId )
- myOperation = testOperation( me );
- if ( myOperation != NoOpId ) {
- myPnt = me.pos();
- if ( myOperation == ZoomId ) {
- myPlot->canvas()->setCursor( QCursor( QPixmap( imageZoomCursor ) ) );
- }
- else if ( myOperation == PanId ) {
- myPlot->canvas()->setCursor( QCursor( Qt::SizeAllCursor ) );
- }
- else if ( myOperation == FitAreaId ) {
- myPlot->canvas()->setCursor( QCursor( Qt::PointingHandCursor ) );
- myPlot->setOutlineStyle( Qwt::Rect );
- }
- }
- else {
- int btn = me.button() | me.state();
- if ( btn == RightButton ) {
- createPopup();
- if ( myPopup ) {
- QAD_Tools::checkPopup( myPopup );
- if ( myPopup->count()>0 ) {
- myPopup->exec( QCursor::pos() );
- }
- destroyPopup();
- }
- }
- else {
- myPlot->setOutlineStyle( Qwt::Cross );
- QAD_Application::getDesktop()->putInfo( getInfo( me.pos() ) );
- }
- }
-}
-/*!
- Slot, called when user moves mouse
-*/
-void Plot2d_ViewFrame::plotMouseMoved( const QMouseEvent& me )
-{
- int dx = me.pos().x() - myPnt.x();
- int dy = me.pos().y() - myPnt.y();
-
- if ( myOperation != NoOpId) {
- if ( myOperation == ZoomId ) {
- this->incrementalZoom( dx, dy );
- myPnt = me.pos();
- }
- else if ( myOperation == PanId ) {
- this->incrementalPan( dx, dy );
- myPnt = me.pos();
- }
- }
- else {
- QAD_Application::getDesktop()->putInfo( getInfo( me.pos() ) );
- }
-}
-/*!
- Slot, called when user releases mouse
-*/
-void Plot2d_ViewFrame::plotMouseReleased( const QMouseEvent& me )
-{
- if ( myOperation == FitAreaId ) {
- QRect rect( myPnt, me.pos() );
- fitArea( rect );
- }
- myPlot->canvas()->setCursor( QCursor( Qt::CrossCursor ) );
- myPlot->setOutlineStyle( Qwt::Triangle );
- QAD_Application::getDesktop()->putInfo( tr( "INF_READY" ) );
- myOperation = NoOpId;
-}
-/*!
- View operations : Pan view
-*/
-void Plot2d_ViewFrame::onViewPan()
-{
- myOperation = PanId;
- qApp->installEventFilter( this );
-}
-/*!
- View operations : Zoom view
-*/
-void Plot2d_ViewFrame::onViewZoom()
-{
- myOperation = ZoomId;
- qApp->installEventFilter( this );
-}
-/*!
- View operations : Fot All
-*/
-void Plot2d_ViewFrame::onViewFitAll()
-{
- fitAll();
-}
-/*!
- View operations : Fit Area
-*/
-void Plot2d_ViewFrame::onViewFitArea()
-{
- myOperation = FitAreaId;
- qApp->installEventFilter( this );
-}
-/*!
- View operations : Global panning
-*/
-void Plot2d_ViewFrame::onViewGlobalPan()
-{ MESSAGE( "Plot2d_ViewFrame::onViewGlobalPan : NOT SUPPORTED" ); }
-/*!
- View operations : Rotate view
-*/
-void Plot2d_ViewFrame::onViewRotate()
-{ MESSAGE( "Plot2d_ViewFrame::onViewRotate : NOT SUPPORTED" ); }
-/*!
- View operations : Reset view
-*/
-void Plot2d_ViewFrame::onViewReset()
-{ MESSAGE( "Plot2d_ViewFrame::onViewReset : NOT SUPPORTED" ); }
-/*!
- View operations : View front
-*/
-void Plot2d_ViewFrame::onViewFront()
-{ MESSAGE( "Plot2d_ViewFrame::onViewFront : NOT SUPPORTED" ); }
-/*!
- View operations : View back
-*/
-void Plot2d_ViewFrame::onViewBack()
-{ MESSAGE( "Plot2d_ViewFrame::onViewBack : NOT SUPPORTED" ); }
-/*!
- View operations : View right
-*/
-void Plot2d_ViewFrame::onViewRight()
-{ MESSAGE( "Plot2d_ViewFrame::onViewRight : NOT SUPPORTED" ); }
-/*!
- View operations : View left
-*/
-void Plot2d_ViewFrame::onViewLeft()
-{ MESSAGE( "Plot2d_ViewFrame::onViewLeft : NOT SUPPORTED" ); }
-/*!
- View operations : View bottom
-*/
-void Plot2d_ViewFrame::onViewBottom()
-{ MESSAGE( "Plot2d_ViewFrame::onViewBottom : NOT SUPPORTED" ); }
-/*!
- View operations : View top
-*/
-void Plot2d_ViewFrame::onViewTop()
-{ MESSAGE( "Plot2d_ViewFrame::onViewTop : NOT SUPPORTED" ); }
-/*!
- View operations : Show/hide trihedron
-*/
-void Plot2d_ViewFrame::onViewTrihedron()
-{ MESSAGE( "Plot2d_ViewFrame::onViewTrihedron : NOT SUPPORTED" ); }
-
-
-//=================================================================================
-// Plot2d_Plot2d implementation
-//=================================================================================
-
-/*!
- Constructor
-*/
-Plot2d_Plot2d::Plot2d_Plot2d( QWidget* parent )
- : QwtPlot( parent )
-{
- // outline
- enableOutline( true );
- setOutlineStyle( Qwt::Triangle );
- setOutlinePen( green );
- // legend
- setAutoLegend( false );
- setLegendFrameStyle( QFrame::Box | QFrame::Sunken );
- enableLegend( false );
- // grid
- enableGridX( false );
- enableGridXMin( false );
- enableGridY( false );
- enableGridYMin( false );
- // auto scaling by default
- setAxisAutoScale( QwtPlot::yLeft );
- setAxisAutoScale( QwtPlot::xBottom );
-}
-/*!
- Recalculates and redraws Plot 2d view
-*/
-void Plot2d_Plot2d::replot()
-{
- updateLayout(); // to fix bug(?) of Qwt - view is not updated when title is changed
- QwtPlot::replot();
-}
-/*!
- Checks if two colors are close to each other [ static ]
- uses COLOR_DISTANCE variable as max tolerance for comparing of colors
-*/
-const long COLOR_DISTANCE = 100;
-const int MAX_ATTEMPTS = 10;
-static bool closeColors( const QColor& color1, const QColor& color2 )
-{
- long tol = abs( color2.red() - color1.red() ) +
- abs( color2.green() - color1.green() ) +
- abs( color2.blue() - color1.blue() );
-
- return ( tol <= COLOR_DISTANCE );
-}
-/*!
- Gets new unique marker for item if possible
-*/
-void Plot2d_Plot2d::getNextMarker( QwtSymbol::Style& typeMarker, QColor& color, Qt::PenStyle& typeLine )
-{
- bool bOk = false;
- int cnt = 1;
- while ( !bOk ) {
- int aRed = (int)( 256.0 * random() / RAND_MAX); // generate random color
- int aGreen = (int)( 256.0 * random() / RAND_MAX); // ...
- int aBlue = (int)( 256.0 * random() / RAND_MAX); // ...
- int aMarker = (int)( 9.0 * random() / RAND_MAX) + 1; // 9 markers types ( not including empty )
- int aLine = (int)( 5.0 * random() / RAND_MAX) + 1; // 5 line types ( not including empty )
-
- typeMarker = ( QwtSymbol::Style )aMarker;
- color = QColor( aRed, aGreen, aBlue );
- typeLine = ( Qt::PenStyle )aLine;
-
- cnt++;
- if ( cnt == MAX_ATTEMPTS )
- bOk = true;
- else
- bOk = !existMarker( typeMarker, color, typeLine );
- }
-/*
- static int aMarker = -1;
- static int aColor = -1;
- static int aLine = -1;
-
- if ( myColors.isEmpty() ) {
- // creating colors list
- myColors.append( Qt::white );
- myColors.append( Qt::blue );
- myColors.append( Qt::gray );
- myColors.append( Qt::darkGreen );
- myColors.append( Qt::magenta );
- myColors.append( Qt::darkGray );
- myColors.append( Qt::red );
- myColors.append( Qt::darkBlue );
- myColors.append( Qt::darkYellow );
- myColors.append( Qt::cyan );
- myColors.append( Qt::darkRed );
- myColors.append( Qt::darkCyan );
- myColors.append( Qt::yellow );
- myColors.append( Qt::darkMagenta );
- myColors.append( Qt::green );
- myColors.append( Qt::black );
- }
-
- int nbMarkers = 11; // QwtSymbol supports 11 marker types
- int nbLines = 6; // Qt supports 6 line types
- int nbColors = myColors.count(); // number of default colors supported
-
- aMarker = ( aMarker + 1 ) % nbMarkers;
- if ( aMarker == QwtSymbol::None || aMarker == QwtSymbol::Triangle ) aMarker++;
- aColor = ( aColor + 1 ) % nbColors;
- aLine = ( aLine + 1 ) % nbLines;
- if ( aLine == Qt::NoPen ) aLine++;
-
- typeMarker = ( QwtSymbol::Style )aMarker;
- color = myColors[ aColor ];
- typeLine = ( Qt::PenStyle )aLine;
- if ( !existMarker( typeMarker, color, typeLine ) )
- return;
-
- int i, j, k;
- for ( i = 0; i < nbMarkers; i++ ) {
- aMarker = ( aMarker + 1 ) % nbMarkers;
- if ( aMarker == QwtSymbol::None || aMarker == QwtSymbol::Triangle ) aMarker++;
- for ( j = 0; j < nbColors; j++ ) {
- aColor = ( aColor + 1 ) % nbColors;
- for ( k = 0; k < nbLines; k++ ) {
- aLine = ( aLine + 1 ) % nbLines;
- if ( aLine == Qt::NoPen ) aLine++;
- if ( !existMarker( ( QwtSymbol::Style )aMarker, aColor, ( Qt::PenStyle )aLine ) ) {
- typeMarker = ( QwtSymbol::Style )aMarker;
- color = myColors[ aColor ];
- typeLine = ( Qt::PenStyle )aLine;
- return;
- }
- }
- }
- }
-*/
-}
-/*!
- Checks if marker belongs to any enitity
-*/
-bool Plot2d_Plot2d::existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine )
-{
- // getting all curves
- QArray<long> keys = curveKeys();
- QColor aRgbColor;
-
- if ( closeColors( color, backgroundColor() ) )
- return true;
- for ( int i = 0; i < keys.count(); i++ ) {
- QwtPlotCurve* crv = curve( keys[i] );
- if ( crv ) {
- QwtSymbol::Style aStyle = crv->symbol().style();
- QColor aColor = crv->pen().color();
- Qt::PenStyle aLine = crv->pen().style();
-// if ( aStyle == typeMarker && aColor == color && aLine == typeLine )
- if ( aStyle == typeMarker && closeColors( aColor,color ) && aLine == typeLine )
- return true;
- }
- }
- return false;
-}
-
-//==========================================================
-/*!
- * Plot2d_ViewFrame::Display
- * Display presentation
- */
-//==========================================================
-void Plot2d_ViewFrame::Display( const SALOME_Prs2d* prs )
-{
- // try do downcast object
- const Plot2d_Prs* aPlot2dPrs = dynamic_cast<const Plot2d_Prs*>( prs );
- if ( !aPlot2dPrs || aPlot2dPrs->IsNull() )
- return;
-
- // display all curves from presentation
- Plot2d_CurveContainer aCurves = aPlot2dPrs->GetObjects();
- displayCurves( aCurves );
-}
-
-//==========================================================
-/*!
- * Plot2d_ViewFrame::Erase
- * Erase presentation
- */
-//==========================================================
-void Plot2d_ViewFrame::Erase( const SALOME_Prs2d* prs, const bool )
-{
- // try do downcast object
- const Plot2d_Prs* aPlot2dPrs = dynamic_cast<const Plot2d_Prs*>( prs );
- if ( !aPlot2dPrs || aPlot2dPrs->IsNull() )
- return;
-
- // erase all curves from presentation
- Plot2d_CurveContainer aCurves = aPlot2dPrs->GetObjects();
- eraseCurves( aCurves );
-}
-
-//==========================================================
-/*!
- * Plot2d_ViewFrame::CreatePrs
- * Create presentation by entry
- */
-//==========================================================
-SALOME_Prs* Plot2d_ViewFrame::CreatePrs( const char* entry )
-{
- Plot2d_Prs* prs = new Plot2d_Prs();
- if ( entry ) {
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- if ( it.current()->hasIO() && !strcmp( it.current()->getIO()->getEntry(), entry ) ) {
- prs->AddObject( it.current() );
- }
- }
- }
- return prs;
-}
-
-//==========================================================
-/*!
- * Plot2d_ViewFrame::BeforeDisplay
- * Axiluary method called before displaying of objects
- */
-//==========================================================
-void Plot2d_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
-{
- d->BeforeDisplay( this, SALOME_Plot2dViewType() );
-}
-
-//==========================================================
-/*!
- * Plot2d_ViewFrame::AfterDisplay
- * Axiluary method called after displaying of objects
- */
-//==========================================================
-void Plot2d_ViewFrame::AfterDisplay( SALOME_Displayer* d )
-{
- d->AfterDisplay( this, SALOME_Plot2dViewType() );
-}
-
-#define INCREMENT_FOR_OP 10
-
-//=======================================================================
-// Plot2d_ViewFrame::onPanLeft
-// Performs incremental panning to the left
-//=======================================================================
-void Plot2d_ViewFrame::onPanLeft()
-{
- this->incrementalPan( -INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::onPanRight
-// Performs incremental panning to the right
-//=======================================================================
-void Plot2d_ViewFrame::onPanRight()
-{
- this->incrementalPan( INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::onPanUp
-// Performs incremental panning to the top
-//=======================================================================
-void Plot2d_ViewFrame::onPanUp()
-{
- this->incrementalPan( 0, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::onPanDown
-// Performs incremental panning to the bottom
-//=======================================================================
-void Plot2d_ViewFrame::onPanDown()
-{
- this->incrementalPan( 0, INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::onZoomIn
-// Performs incremental zooming in
-//=======================================================================
-void Plot2d_ViewFrame::onZoomIn()
-{
- this->incrementalZoom( INCREMENT_FOR_OP, INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::onZoomOut
-// Performs incremental zooming out
-//=======================================================================
-void Plot2d_ViewFrame::onZoomOut()
-{
- this->incrementalZoom( -INCREMENT_FOR_OP, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::incrementalPan
-// Incremental zooming operation
-//=======================================================================
-void Plot2d_ViewFrame::incrementalPan( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
-
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1()-incrY ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2()-incrY ) );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1()-incrX ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2()-incrX ) );
- myPlot->replot();
-}
-
-//=======================================================================
-// Plot2d_ViewFrame::incrementalZoom
-// Incremental panning operation
-//=======================================================================
-void Plot2d_ViewFrame::incrementalZoom( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
-
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() + incrY ) );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() - incrX ) );
- myPlot->replot();
-}
-
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : Plot2d_ViewFrame.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef Plot2d_ViewFrame_H
-#define Plot2d_ViewFrame_H
-
-#include "QAD_ViewFrame.h"
-#include "QAD_Popup.h"
-#include "QAD_Action.h"
-#include "Plot2d_Curve.h"
-#include "Plot2d_CurveContainer.h"
-#include "SALOME_Selection.h"
-#include <qmainwindow.h>
-#include <qmap.h>
-#include <qintdict.h>
-#include <qwt_plot.h>
-#include <qwt_legend.h>
-
-//=================================================================================
-// class : Plot2d_ViewFrame
-// purpose : Plot2d view frame
-//=================================================================================
-class Plot2d_Plot2d;
-typedef QIntDict<Plot2d_Curve> CurveDict;
-
-class QAD_EXPORT Plot2d_ViewFrame : public QAD_ViewFrame, public QAD_PopupClientServer
-{
- Q_OBJECT
-
- enum { NoOpId, FitAllId, FitAreaId, ZoomId, PanId, DumpId,
- ModeXLinearId, ModeXLogarithmicId, ModeYLinearId, ModeYLogarithmicId,
- LegendId, CurvePointsId, CurveLinesId, CurveSplinesId, SettingsId, FitDataId, ChangeBackgroundId };
-public:
- /* Construction/destruction */
- Plot2d_ViewFrame( QWidget* parent, const QString& title = "" );
- virtual ~Plot2d_ViewFrame();
-
-public:
- /* inherited */
- ViewType getTypeView() const { return VIEW_PLOT2D; }
- QWidget* getViewWidget();
- void SetSelectionMode( Selection_Mode mode ) {}
- void onAdjustTrihedron( ) {}
-
- /* popup management */
- void setPopupServer( QAD_Application* );
- void onCreatePopup();
-
- /* interactive object management */
- void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool update = true ) {}
- void unHighlightAll() {}
- void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
- bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
-
- /* undo/redo management */
- void undo( SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry ) {}
- void redo( SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry ) {}
-
- /* interactive objects handling */
- Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );
-
- /* display */
- void Display( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
- void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
- void Erase( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
- void DisplayAll();
- void EraseAll();
- void Repaint();
-
- /* Reimplemented from SALOME_View */
- void Display( const SALOME_Prs2d* );
- void Erase( const SALOME_Prs2d*, const bool = false );
- SALOME_Prs* CreatePrs( const char* entry = 0 );
- virtual void BeforeDisplay( SALOME_Displayer* d );
- virtual void AfterDisplay ( SALOME_Displayer* d );
-
- /* event filter */
- bool eventFilter( QObject* o, QEvent* e );
-
- /* operations */
- void setTitle( const QString& title );
- QString getTitle() const { return myTitle; }
- void displayCurve( Plot2d_Curve* curve, bool update = false );
- void displayCurves( Plot2d_CurveContainer& curves, bool update = false );
- void eraseCurve( Plot2d_Curve* curve, bool update = false );
- void eraseCurves( Plot2d_CurveContainer& curves, bool update = false );
- int getCurves( QList<Plot2d_Curve>& clist );
- int hasCurve( Plot2d_Curve* curve );
- Plot2d_Curve* getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject );
- void updateCurve( Plot2d_Curve* curve, bool update = false );
- void fitAll();
- void fitArea( const QRect& area );
-
- /* view parameters */
- void setCurveType( int curveType, bool update = true );
- int getCurveType() const { return myCurveType; }
- void showLegend( bool show, bool update = true );
- void setLegendPos( int pos );
- int getLegendPos() const { return myLegendPos; }
- void setMarkerSize( const int size, bool update = true );
- int getMarkerSize() const { return myMarkerSize; }
- void setBackgroundColor( const QColor& color );
- QColor backgroundColor() const;
- void setXGrid( bool xMajorEnabled, const int xMajorMax, bool xMinorEnabled, const int xMinorMax, bool update = true );
- void setYGrid( bool yMajorEnabled, const int yMajorMax, bool yMinorEnabled, const int yMinorMax, bool update = true );
- void setMainTitle( bool enabled, const QString& title, bool update = true);
- void setXTitle( bool enabled, const QString& title, bool update = true );
- QString getXTitle() const { return myXTitle; }
- void setYTitle( bool enabled, const QString& title, bool update = true );
- QString getYTitle() const { return myYTitle; }
- void setHorScaleMode( const int mode, bool update = true );
- int getHorScaleMode() const { return myXMode; }
- void setVerScaleMode( const int mode, bool update = true );
- int getVerScaleMode() const { return myYMode; }
-
- void incrementalPan ( const int incrX, const int incrY );
- void incrementalZoom( const int incrX, const int incrY );
-
-protected:
- void createActions();
- int testOperation( const QMouseEvent& );
- void readPreferences();
- void writePreferences();
- QString getInfo( const QPoint& pnt );
- void updateTitles();
-
-public slots:
- void onViewPan();
- void onViewZoom();
- void onViewFitAll();
- void onViewFitArea();
- void onViewGlobalPan();
- void onViewRotate();
- void onViewReset();
- void onViewFront();
- void onViewBack();
- void onViewRight();
- void onViewLeft();
- void onViewBottom();
- void onViewTop();
- void onViewTrihedron();
- void onHorMode();
- void onVerMode();
- void onLegend();
- void onCurves();
- void onSettings();
- void onFitData();
- void onChangeBackground();
-
- void onPanLeft();
- void onPanRight();
- void onPanUp();
- void onPanDown();
- void onZoomIn();
- void onZoomOut();
-
-protected slots:
- void onLegendClicked( long key );
- void plotMousePressed( const QMouseEvent& );
- void plotMouseMoved( const QMouseEvent& );
- void plotMouseReleased( const QMouseEvent& );
-
-private:
- Plot2d_Plot2d* myPlot;
- ActionMap myActions;
- int myOperation;
- QPoint myPnt;
- CurveDict myCurves;
-
- int myCurveType;
- bool myShowLegend;
- int myLegendPos;
- int myMarkerSize;
- QColor myBackground;
- QString myTitle, myXTitle, myYTitle;
- bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled;
- bool myXGridMajorEnabled, myYGridMajorEnabled;
- bool myXGridMinorEnabled, myYGridMinorEnabled;
- int myXGridMaxMajor, myYGridMaxMajor;
- int myXGridMaxMinor, myYGridMaxMinor;
- int myXMode, myYMode;
-};
-
-//=================================================================================
-// class : Plot2d_Plot2d
-// purpose : Plot2d View
-//=================================================================================
-class Plot2d_Plot2d : public QwtPlot
-{
-public:
- Plot2d_Plot2d( QWidget* parent );
-
- void replot();
- void getNextMarker( QwtSymbol::Style& typeMarker, QColor& color, Qt::PenStyle& typeLine );
- QwtLegend* getLegend() { return d_legend; }
-
-protected:
- bool existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine );
-
-protected:
- QValueList<QColor> myColors;
-};
-
-#endif // Plot2d_ViewFrame_H
-
-
-
-
+++ /dev/null
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = SALOME_Prs.h
-
-# Libraries targets
-
-LIB = libSalomePrs.la
-LIB_SRC = SALOME_Prs.cxx
-
-LIB_CLIENT_IDL =
-
-# Executables targets
-BIN =
-BIN_SRC =
-
-CPPFLAGS+=
-LDFLAGS+=
-
-
-@CONCLUDE@
+++ /dev/null
-// File: SALOME_Prs.cxx
-// Created: Wed Apr 28 15:03:43 2004
-// Author: Sergey ANIKIN
-// <san@startrex.nnov.opencascade.com>
-
-
-#include "SALOME_Prs.h"
-
-#include "utilities.h"
-
-using namespace std;
-
-//===========================================================
-/*!
- * Function: SALOME_OCCPrs::DisplayIn
- * Purpose: Dispatches display operation to proper Display()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
-{
- if ( v ) v->Display( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_OCCPrs::EraseIn
- * Purpose: Dispatches display operation to proper Erase()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
-{
- if ( v ) v->Erase( this, forced );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_OCCPrs::LocalSelectionIn
- * Purpose: Dispatches operation to proper LocalSelectionIn()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
-{
- if ( v ) v->LocalSelection( this, mode );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_OCCPrs::Update
- * Purpose: Dispatches update operation to proper Update()
- * method of SALOME_Displayer
- */
-//===========================================================
-void SALOME_OCCPrs::Update( SALOME_Displayer* d )
-{
- if ( d ) d->Update( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_VTKPrs::DisplayIn
- * Purpose: Dispatches display operation to proper Display()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
-{
- if ( v ) v->Display( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_VTKPrs::EraseIn
- * Purpose: Dispatches display operation to proper Erase()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
-{
- if ( v ) v->Erase( this, forced );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_VTKPrs::LocalSelectionIn
- * Purpose: Dispatches operation to proper LocalSelectionIn()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
-{
- if ( v ) v->LocalSelection( this, mode );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_VTKPrs::Update
- * Purpose: Dispatches update operation to proper Update()
- * method of SALOME_Displayer
- */
-//===========================================================
-void SALOME_VTKPrs::Update( SALOME_Displayer* d )
-{
- if ( d ) d->Update( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Prs2d::DisplayIn
- * Purpose: Dispatches display operation to proper Display()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
-{
- if ( v ) v->Display( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Prs2d::EraseIn
- * Purpose: Dispatches display operation to proper Erase()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
-{
- if ( v ) v->Erase( this, forced );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Prs2d::LocalSelectionIn
- * Purpose: Dispatches operation to proper LocalSelectionIn()
- * method of SALOME_View
- */
-//===========================================================
-void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
-{
- if ( v ) v->LocalSelection( this, mode );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Prs2d::Update
- * Purpose: Dispatches update operation to proper Update()
- * method of SALOME_Displayer
- */
-//===========================================================
-void SALOME_Prs2d::Update( SALOME_Displayer* d )
-{
- if ( d ) d->Update( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Display
- * Purpose: Gives control to SALOME_Prs object, so that
- * it could perform double dispatch
- */
-//===========================================================
-void SALOME_View::Display( const SALOME_Prs* prs )
-{
- prs->DisplayIn( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Erase
- * Purpose: Gives control to SALOME_Prs object, so that
- * it could perform double dispatch
- */
-//===========================================================
-void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
-{
- prs->EraseIn( this, forced );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::LocalSelection
- * Purpose: Gives control to SALOME_Prs object, so that
- * it could perform double dispatch
- */
-//===========================================================
-void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
-{
- prs->LocalSelectionIn( this, mode );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Display
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Display( const SALOME_OCCPrs* )
-{
- MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Display
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Display( const SALOME_VTKPrs* )
-{
- MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Display
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Display( const SALOME_Prs2d* )
-{
- MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Erase
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
-{
- MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Erase
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
-{
- MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::Erase
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
-{
- MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::LocalSelection
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
-{
- MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called! \
- Probably, selection is being activated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::LocalSelection
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
-{
- MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called! \
- Probably, selection is being activated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::LocalSelection
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
-{
- MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called! \
- Probably, selection is being activated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_View::GlobalSelection
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_View::GlobalSelection( const bool ) const
-{
- MESSAGE( "SALOME_View::GlobalSelection() called! \
- Probably, selection is being activated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Displayer::UpdatePrs
- * Purpose: Gives control to SALOME_Prs object, so that
- * it could perform double dispatch
- */
-//===========================================================
-void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
-{
- prs->Update( this );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Displayer::Update
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_Displayer::Update( SALOME_OCCPrs* )
-{
- MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Displayer::Update
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_Displayer::Update( SALOME_VTKPrs* )
-{
- MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
-}
-
-//===========================================================
-/*!
- * Function: SALOME_Displayer::Update
- * Purpose: Virtual method, should be reimplemented in successors,
- * by default issues a warning and does nothing.
- */
-//===========================================================
-void SALOME_Displayer::Update( SALOME_Prs2d* )
-{
- MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
-}
-
+++ /dev/null
-// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_Prs.h
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef SALOME_PRS_H
-#define SALOME_PRS_H
-
-class SALOME_View;
-class SALOME_Displayer;
-
-//===========================================================
-/*!
- * Class: SALOME_Prs
- * Description: Base class for SALOME graphic object wrappers - presentations.
- * Presentations are temporary objects, so they can be created on the stack.
- */
-//===========================================================
-
-class SALOME_Prs
-{
-public:
- virtual ~SALOME_Prs() {}
- // Destructor
-
- virtual void DisplayIn( SALOME_View* ) const = 0;
- // Key method for double dispatch of display operation
-
- virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
- // Key method for double dispatch of erase operation
-
- virtual void Update( SALOME_Displayer* ) = 0;
- // Key method for double dispatch of update operation
-
- virtual bool IsNull() const = 0;
- // Should return true, if this presentation contains a graphic object
-
- virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
- // Key method for double dispatch of activation of subshapes selection
-};
-
-//===========================================================
-/*!
- * Class: SALOME_OCCPrs
- * Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
- * This intermediate class is necessary to avoid dependencies from OCC libs.
- */
-//===========================================================
-
-class SALOME_OCCPrs : public SALOME_Prs
-{
-public:
- virtual void DisplayIn( SALOME_View* ) const;
- // It uses double dispatch in order to
- // invoke Display() method corresponding to the actual type of presentation.
-
- virtual void EraseIn( SALOME_View*, const bool = false ) const;
- // It uses double dispatch in order to
- // invoke Erase() method corresponding to the actual type of presentation.
-
- virtual void Update( SALOME_Displayer* );
- // It uses double dispatch in order to
- // invoke Update() method corresponding to the actual type of presentation.
-
- virtual void LocalSelectionIn( SALOME_View*, const int ) const;
- // Key method for double dispatch of activation of subshapes selection
-};
-
-//===========================================================
-/*!
- * Class: SALOME_VTKPrs
- * Description: Base class for VTK graphic object (vtkActor) wrappers
- * This intermediate class is necessary to avoid dependencies from VTK libs.
- */
-//===========================================================
-
-class SALOME_VTKPrs : public SALOME_Prs
-{
-public:
- virtual void DisplayIn( SALOME_View* ) const;
- // It uses double dispatch in order to
- // invoke Display() method corresponding to the actual type of presentation.
-
- virtual void EraseIn( SALOME_View*, const bool = false ) const;
- // It uses double dispatch in order to
- // invoke Erase() method corresponding to the actual type of presentation.
-
- virtual void Update( SALOME_Displayer* );
- // It uses double dispatch in order to
- // invoke Update() method corresponding to the actual type of presentation.
-
- virtual void LocalSelectionIn( SALOME_View*, const int ) const;
- // Key method for double dispatch of activation of subshapes selection
-};
-
-//===========================================================
-/*!
- * Class: SALOME_Prs2d
- * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
- */
-//===========================================================
-
-class SALOME_Prs2d : public SALOME_Prs
-{
-public:
- virtual void DisplayIn( SALOME_View* ) const;
- // It uses double dispatch in order to
- // invoke Display() method corresponding to the actual type of presentation.
-
- virtual void EraseIn( SALOME_View*, const bool = false ) const;
- // It uses double dispatch in order to
- // invoke Erase() method corresponding to the actual type of presentation.
-
- virtual void Update( SALOME_Displayer* );
- // It uses double dispatch in order to
- // invoke Update() method corresponding to the actual type of presentation.
-
- virtual void LocalSelectionIn( SALOME_View*, const int ) const;
- // Key method for double dispatch of activation of subshapes selection
-};
-
-/////////////////////////////////////////////////////////////////////////
-// Base classes for object wrappers for any other visualization libraries
-// should be added here!
-/////////////////////////////////////////////////////////////////////////
-
-//===========================================================
-/*!
- * Class: SALOME_View
- * Description: Base class for SALOME views (or view frames)
- */
-//===========================================================
-
-class SALOME_View
-{
-public:
- virtual ~SALOME_View() {}
- // Destructor
-
- void Display( const SALOME_Prs* );
- // This Display() method should be called to display given presentation
- // created anywhere by anybody. It simply passes control to SALOME_Prs object
- // so that it could perform double dispatch.
- void Erase( const SALOME_Prs*, const bool = false );
- // This Erase() method should be called to erase given presentation
- // created anywhere by anybody. It simply passes control to SALOME_Prs object
- // so that it could perform double dispatch.
-
- void LocalSelection( const SALOME_Prs*, const int );
- // This LocalSelection() method should be called to activate sub-shapes selection
- // created anywhere by anybody. It simply passes control to SALOME_Prs object
- // so that it could perform double dispatch.
-
- // Interface for derived views
-
- // Display() methods for ALL kinds of presentation should appear here
- virtual void Display( const SALOME_OCCPrs* );
- virtual void Display( const SALOME_VTKPrs* );
- virtual void Display( const SALOME_Prs2d* );
- // Add new Display() methods here...
-
- // Erase() methods for ALL kinds of presentation should appear here
- virtual void Erase( const SALOME_OCCPrs*, const bool = false );
- virtual void Erase( const SALOME_VTKPrs*, const bool = false );
- virtual void Erase( const SALOME_Prs2d*, const bool = false );
- // Add new Erase() methods here...
-
- // LocalSelection() methods for ALL kinds of presentation should appear here
- virtual void LocalSelection( const SALOME_OCCPrs*, const int );
- virtual void LocalSelection( const SALOME_VTKPrs*, const int );
- virtual void LocalSelection( const SALOME_Prs2d* , const int );
-
- virtual void GlobalSelection( const bool = false ) const;
- // Deactivates selection of sub-shapes (must be redefined with OCC viewer)
-
- // Creates empty presenation of corresponding type
- virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
-
- // Axiluary methods called before and after displaying of objects
- virtual void BeforeDisplay( SALOME_Displayer* d ) {}
- virtual void AfterDisplay ( SALOME_Displayer* d ) {}
-};
-
-//===========================================================
-/*!
- * Classes: SALOME_Displayer
- * Description: These classes are used to specify type of view
- * VTK, OCC or Plot2d
- */
-//===========================================================
-
-class SALOME_OCCViewType {};
-class SALOME_VTKViewType {};
-class SALOME_Plot2dViewType {};
-
-//===========================================================
-/*!
- * Class: SALOME_Displayer
- * Description: Base class for SALOME displayers
- */
-//===========================================================
-
-class SALOME_Displayer
-{
-public:
- virtual ~SALOME_Displayer() {}
- // Destructor
-
- void UpdatePrs( SALOME_Prs* );
- // This Update() method should be called to update given presentation
- // created anywhere by anybody. It simply passes control to SALOME_Prs object
- // so that it could perform double dispatch.
-
- // Interface for derived displayers
-
- // Update() methods for ALL kinds of presentation should appear here
- virtual void Update( SALOME_OCCPrs* );
- virtual void Update( SALOME_VTKPrs* );
- virtual void Update( SALOME_Prs2d* );
- // Add new Update() methods here...
-
- // Axiluary methods called before and after displaying of objects
- virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ) {};
- virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ) {};
- virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ) {};
- virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ) {};
- virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ) {};
- virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ) {};
-};
-
-#endif
-
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// 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 : HelpWindow.cxx
-// Author : Pascale NOYRET, EDF
-// Module : SALOME
-// $Header$
-
-# include "HelpWindow.hxx"
-# include "utilities.h"
-
-# include <qtextview.h>
-# include <qpushbutton.h>
-# include <qtextstream.h>
-# include <qfile.h>
-using namespace std;
-
-HelpWindow::HelpWindow(QWidget* parent, const char* name )
- : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
-{
- BEGIN_OF("Constructeur HelpWindow");
-
- setCaption( tr( "Help" ) );
-
- myTextView = new QTextView( this, "myTextView" );
- QPalette pal = myTextView->palette();
- QColorGroup cg = pal.active();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setActive ( cg );
- cg = pal.inactive();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setInactive( cg );
- cg = pal.disabled();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setDisabled( cg );
- myTextView->setPalette( pal );
-
- setCentralWidget( myTextView );
- setMinimumSize( 450, 250 );
-
- QFile f ( "tmp.txt" );
- if ( f.open( IO_ReadOnly ) )
- {
- QTextStream t( &f );
- while ( !t.eof() )
- {
- myTextView->append(t.readLine());
- }
- }
- f.close();
-
- END_OF("Constructeur HelpWindow");
-}
-
-/*!
- Destructor
-*/
-HelpWindow::~HelpWindow()
-{
- BEGIN_OF("Destructeur HelpWindow");
- END_OF("Destructeur HelpWindow");
-};
-
-/*!
- Sets text
-*/
-void HelpWindow::setText( const QString& text )
-{
- myTextView->setText( text );
-}
-
-
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// 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 : HelpWindow.hxx
-// Author : Pascale NOYRET, EDF
-// Module : SALOME
-// $Header$
-
-# ifndef __HELPWINDOW_H__
-# define __HELPWINDOW_H__
-
-# include <qapplication.h>
-# include <qmainwindow.h>
-
-class QTextView;
-
-class HelpWindow : public QMainWindow
-{
-public:
- HelpWindow( QWidget* parent = 0, const char* name = 0);
- ~HelpWindow();
-
- void setText( const QString& text );
- QTextView* textView() const { return myTextView; }
-
-private:
- QTextView* myTextView;
-};
-# endif /* __HELPWINDOW_H__ */
-
-
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : IntervalWindow.cxx
-// Author : Oksana TCHEBANOVA
-// Module : SALOME
-
-#include <IntervalWindow.hxx>
-
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-# include "utilities.h"
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_SPIN_WIDTH 100
-
-IntervalWindow::IntervalWindow ( QWidget* parent )
- : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
-{
- BEGIN_OF("IntervalWindow constructor")
- setCaption( tr( "Refresh Interval" ) );
- setSizeGripEnabled( true );
-
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
- intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
- intervalGrp->layout()->setSpacing( 0 );
- intervalGrp->layout()->setMargin( 0 );
- QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
- intervalGrpLayout->setAlignment( Qt::AlignTop );
- intervalGrpLayout->setSpacing( SPACING_SIZE );
- intervalGrpLayout->setMargin( MARGIN_SIZE );
-
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- myButtonOk = new QPushButton( this, "buttonOk" );
- myButtonOk->setText( tr( "BUT_OK" ) );
- myButtonOk->setAutoDefault( TRUE );
- myButtonOk->setDefault( TRUE );
-
- myButtonCancel = new QPushButton( this, "buttonCancel" );
- myButtonCancel->setText( tr( "BUT_CANCEL" ) );
- myButtonCancel->setAutoDefault( TRUE );
-
- QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
- TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
-
- mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
- mySpinBox->setValue( 100 );
- mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
-
- intervalGrpLayout->addWidget(TextLabel, 0, 0);
- intervalGrpLayout->addWidget(mySpinBox, 0, 1);
-
- aBtnLayout->addWidget( myButtonOk );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( myButtonCancel );
-
- topLayout->addWidget( intervalGrp, 0, 0 );
- topLayout->addLayout( aBtnLayout, 1, 0 );
-
- END_OF("IntervalWindow constructor")
-}
-IntervalWindow::~IntervalWindow() {}
-/*
- Sets start interval size
-*/
-void IntervalWindow::setValue(const int size)
-{
- mySpinBox->setValue(size);
-}
-
-/*
- Gets interval size
-*/
-int IntervalWindow::getValue()
-{
- return mySpinBox->value();
-}
-
-/*
- gets a pointer to myButtonOk
-*/
-QPushButton* IntervalWindow::Ok()
-{
- return myButtonOk;
-}
-
-/*
- gets a pointer to myButtonCancel
-*/
-QPushButton* IntervalWindow::Cancel()
-{
- return myButtonCancel;
-}
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : IntervalWindow.hxx
-// Author : Oksana TCHEBANOVA
-// Module : SALOME
-
-#ifndef IntervalWindow_HeaderFile
-#define IntervalWindow_HeaderFile
-
-# include <qwidget.h>
-# include <qdialog.h>
-# include <qpushbutton.h>
-# include <qspinbox.h>
-
-
-class IntervalWindow : public QDialog
-{
-public:
- IntervalWindow( QWidget* parent = 0 );
- ~IntervalWindow();
-
- QPushButton* Ok();
- QPushButton* Cancel();
-
- int getValue();
- void setValue( int );
-
-private:
- QSpinBox* mySpinBox;
- QPushButton* myButtonOk;
- QPushButton* myButtonCancel;
-};
-
-#endif
+++ /dev/null
-# SALOME RegistryDisplay : GUI for Registry server implementation
-#
-# 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 : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-@COMMENCE@
-
-EXPORT_PYSCRIPTS =
-
-EXPORT_HEADERS =
-
-# Libraries targets
-
-LIB = libRegistryDisplay.la
-
-LIB_SRC = HelpWindow.cxx \
- RegWidget.cxx \
- RegWidgetFactory.cxx \
- RegWidget_moc.cxx \
- IntervalWindow.cxx
-
-LIB_CLIENT_IDL = SALOME_Registry.idl
-
-CPPFLAGS+=$(QT_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil
-
-%_moc.cxx: %.hxx
- $(MOC) $< -o $@
-
-@CONCLUDE@
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// 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 : RegWidget.cxx
-// Author : Pascale NOYRET, EDF
-// Module : SALOME
-// $Header$
-
-# include <qpushbutton.h>
-# include <qlistview.h>
-# include <qtabwidget.h>
-# include <qstatusbar.h>
-# include <qtextview.h>
-# include <qtimer.h>
-# include <qinputdialog.h>
-# include <qtoolbar.h>
-# include <qdir.h>
-# include <qtooltip.h>
-
-# include "SALOME_NamingService.hxx"
-# include "ServiceUnreachable.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "Utils_CommException.hxx"
-
-# include "utilities.h"
-# include "OpUtil.hxx"
-
-# include "RegWidget.hxx"
-# include "HelpWindow.hxx"
-# include "IntervalWindow.hxx"
-using namespace std;
-
-typedef int PIXELS;
-RegWidget* RegWidget::myRegWidgetPtr = 0;
-QString addSlash( const QString& );
-QString findFile( QString filename );
-
-#define BOLD( text ) ( QString( "<b>" ) + QString( text ) + QString( "</b>" ) )
-
-/*!
- Creates components list
-*/
-
-Registry::Components_var MakeRegistry( CORBA::ORB_var &orb )
-{
-
- const char *registryName="Registry" ;
-
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- naming.init_orb( orb ) ;
-
- // Recuperation de la reference de l'objet
- CORBA::Object_var object = 0 ;
- try
- {
- SCRUTE(registryName) ;
- object = naming.Resolve( registryName ) ;
- if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
- }
- catch( const ServiceUnreachable &ex )
- {
- MESSAGE( ex.what() )
- exit( EXIT_FAILURE ) ;
- }
- catch( const CORBA::Exception &exx )
- {
- exit( EXIT_FAILURE ) ;
- }
-
- // Specialisation de l'objet generique
-
- return Registry::Components::_narrow( object ) ;
-}
-
-/*!
- Only one global registry window should exist at the moment
- This method creates registry window if necessary and returns it
- [ static ]
-*/
-RegWidget* RegWidget::GetRegWidget( CORBA::ORB_var &orb , QWidget *parent, const char *name )
-{
- if ( !myRegWidgetPtr )
- myRegWidgetPtr = new RegWidget( orb, parent, name );
- return myRegWidgetPtr;
-}
-
-/*!
- Constructor
-*/
-RegWidget::RegWidget(CORBA::ORB_var &orb, QWidget *parent, const char *name )
- : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose ),
- _VarComponents( MakeRegistry(orb) ),
- _clients(0), _history(0), _parent( parent ),
- _tabWidget(0), _refresh(0), _interval(0),
- myInfoWindow(0), myHelpWindow(0), myIntervalWindow(0)
-{
- QString aFile = findFile("default.png");
- /* char* dir = getenv( "CSF_ResourcesDefaults" );
- QString path( "" );
- if ( dir ) {
- QDir qDir( dir );
- path = qDir.filePath( "default.png" );
- }*/
- QPixmap pm ( aFile );
- if ( !pm.isNull() )
- setIcon( pm );
-
- // Buttons definition
- QToolBar* topbar = new QToolBar( tr("Toolbar"), this );
- setDockEnabled( topbar, DockTornOff, false );
- setDockMenuEnabled( false );
-
- _refresh = new QPushButton( tr( "Refresh" ), topbar );
- connect( _refresh, SIGNAL( clicked() ), this, SLOT( slotListeSelect() ) );
- QToolTip::add( _refresh, "", toolTipGroup(), tr("Immediately updates list of components") );
-
- /* PAL5540 - this button is needless
- QPushButton* help = new QPushButton( tr( "Help" ), topbar );
- connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
- QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") );
- */
-
- _interval = new QPushButton( tr( "Interval" ), topbar );
- connect( _interval, SIGNAL( clicked() ), this, SLOT( slotSelectRefresh() ) );
- QToolTip::add( _interval, "", toolTipGroup(), tr("Changes refresh interval") );
-
- // Display area and associated slots definition
- _tabWidget = new QTabWidget( this );
- _clients = new QListView( _tabWidget );
- SetListe();
- _history = new QListView( _tabWidget );
- SetListeHistory();
-
- _tabWidget->addTab( _clients, tr( "Running" ) );
- _tabWidget->addTab( _history, tr( "History" ) );
- connect( _tabWidget, SIGNAL( currentChanged( QWidget* )), this, SLOT( slotListeSelect() ) );
- connect( _clients, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotClientChanged( QListViewItem* ) ) );
- connect( _history, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotHistoryChanged( QListViewItem* ) ) );
- setCentralWidget( _tabWidget );
-
- // Timer definition (used to automaticaly refresh the display area)
- _counter = new QTimer( this );
- connect( _counter, SIGNAL( timeout() ), this, SLOT( slotListeSelect() ) );
- myRefreshInterval = 10;
- _counter->start( myRefreshInterval * 1000 );
-
- PIXELS xpos = 160 ;
- PIXELS ypos = 100 ;
- PIXELS largeur = 800 ;
- PIXELS hauteur = 350 ;
- setGeometry( xpos, ypos, largeur, hauteur ) ;
- setCaption( name ) ;
- statusBar()->message(" ");
-}
-
-/*!
- Destructor
-*/
-RegWidget::~RegWidget()
-{
- MESSAGE("Debut du Destructeur");
- _counter->stop();
- myRegWidgetPtr = 0;
-};
-
-/*!
- Event filter
-*/
-bool RegWidget::eventFilter( QObject* object, QEvent* event )
-{
- if ( object ) {
- if ( object == myHelpWindow && event->type() == QEvent::Close ) {
- myHelpWindow = 0;
- }
- else if ( object == myInfoWindow && event->type() == QEvent::Close ) {
- myInfoWindow = 0;
- }
- else if ( object == myIntervalWindow && event->type() == QEvent::Close ) {
- myIntervalWindow = 0;
- }
- }
- return QMainWindow::eventFilter( object, event );
-}
-
-/*!
- Searches item in the list and returns it's index or -1 if not found
-*/
-int RegWidget::numitem(const QString &name, const QString &pid, const QString &machine,const Registry::AllInfos *listclient)
-{
- BEGIN_OF("numitem");
- for (CORBA::ULong i=0; i<listclient->length(); i++)
- {
- const Registry::Infos & c_info=(*listclient)[i];
- ASSERT( c_info.name!=NULL);
- QString b;
- b.setNum(int(c_info.pid));
- if ( (name.compare(QString(c_info.name)) == 0) &&
- (machine.compare(QString(c_info.machine)) == 0) &&
- (pid.compare(b) == 0) )
- {
- END_OF("numitem");
- return i;
- }
- }
- END_OF("numitem");
- return -1;
-}
-
-/*!
- Returns text, containing information about client [ static ]
-*/
-QString RegWidget::setlongText( const Registry::Infos &c_info)
-{
- BEGIN_OF("setlongText");
- ASSERT( c_info.name != NULL );
- QString a = QString( "<hr><h2>" ) + tr( "Code" ) + QString( " : " );
- a.append( QString( c_info.name ) );
- a.append( "</h1><hr><br>" );
- a.append( tr( "Process Id" ) + QString( " : " ) );
- a.append( BOLD( QString::number( int( c_info.pid ) ) ) );
- a.append( QString( " " ) + tr( "on machine" ) + QString( " " ) );
- a.append( BOLD( c_info.machine ) );
- a.append( QString( " " ) + tr( "ip address" ) + QString( " : " ) );
- a.append( BOLD( c_info.adip ) );
- a.append( "<br>" );
-
- a.append( tr( "launched by user" ) + QString( " " ) );
- a.append( BOLD( c_info.pwname ) );
- a.append( QString( " ( " ) + tr( "pid" ) + QString( " : " ) );
- a.append( BOLD( QString::number( int( c_info.uid ) ) ) );
- a.append( QString( " )<br> " ) + tr( "in directory" ) + QString( " " ));
- a.append( BOLD( c_info.cdir ) );
-
- a.append( QString( "<br>" ) + tr( "begins" ) + QString( " " ) );
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
- t1 [strlen(t1) -1 ] = ' ';
- a.append( BOLD( t1 ) );
- delete [] t1;
- a.append( "<br>" );
-
- if (c_info.tc_hello != 0 )
- {
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
- t2 [strlen(t2) -1 ] = ' ';
- a.append( tr( "last signal" ) + QString(" : ") );
- a.append( BOLD( t2 ) );
- a.append( "<br>" );
- delete [] t2;
- }
- if ((c_info.tc_end - c_info.difftime) != 0)
- {
- char * t3 = (char * )duplicate(ctime(&c_info.tc_end));
- t3 [strlen(t3) -1 ] = ' ';
- a.append( tr( "ends" ) + QString( " " ) );
- a.append( BOLD( t3 ) );
- a.append( "<br>" );
- delete [] t3;
- }
- else
- {
- a.append( tr( "still running" ) + QString( "<br>" ) );
- }
-
- SCRUTE(c_info.difftime);
- if (c_info.difftime!= 0)
- {
- a.append( QString( "(" ) + tr( "Time on" ) + QString( " " ) );
- a.append( BOLD( c_info.machine ) );
- a.append( QString( " " ) + tr( "differs from server's time. The difference is" ) + QString( " " ));
- a.append( BOLD( QString::number( int( c_info.difftime ) ) ) );
- a.append( QString( " " ) + tr( "seconds" ) + QString( ")<br>" ) );
- }
- END_OF("setlongText");
- return a;
-
-}
-
-/*!
- Close event
-*/
-void RegWidget::closeEvent( QCloseEvent *e)
-{
- BEGIN_OF("closeEvent");
- if ( myInfoWindow )
- myInfoWindow->close();
- if ( myHelpWindow )
- myHelpWindow->close();
- if (myIntervalWindow)
- myIntervalWindow->close();
- e->accept();
- END_OF("closeEvent");
-};
-
-/*!
- Setups Clients list
-*/
-void RegWidget::SetListe()
-{
- BEGIN_OF("SetListe");
- _clients->addColumn( tr( "Component" ), -1);
- _clients->addColumn( tr( "PID" ), -1 );
- _clients->addColumn( tr( "User Name" ), -1 );
- _clients->addColumn( tr( "Machine" ), -1 );
- _clients->addColumn( tr( "begins" ), -1 );
- _clients->addColumn( tr( "hello" ) , -1 );
- _clients->setColumnAlignment( 1, Qt::AlignRight );
- END_OF("SetListe");
-}
-
-/*!
- Setups History list
-*/
-void RegWidget::SetListeHistory()
-{
- BEGIN_OF("SetListeHistory")
- _history->addColumn( tr( "Component" ), -1);
- _history->addColumn( tr( "PID" ), -1 );
- _history->addColumn( tr( "User Name" ), -1 );
- _history->addColumn( tr( "Machine" ), -1 );
- _history->addColumn( tr( "begins" ), -1 );
- _history->addColumn( tr( "ends" ), -1 );
- _history->setColumnAlignment( 1, Qt::AlignRight );
- END_OF("SetListeHistory")
-}
-
-/*!
- Updates History list
-*/
-void RegWidget::InfoHistory()
-{
-
- BEGIN_OF("InfoHistory")
- _history->clear();
- try
- {
- _serverhistory = _VarComponents->history();
- for (CORBA::ULong i=0; i<_serverhistory->length(); i++)
- {
- const Registry::Infos & c_info=(*_serverhistory)[i];
- ASSERT( c_info.name!=NULL);
- QString a;
- a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
- t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_end));
- t2 [strlen(t2) -1 ] = ' ';
- QListViewItem * item = new QListViewItem(_history, QString(c_info.name),\
- a, QString(c_info.pwname), QString(c_info.machine), \
- QString(t1), QString(t2));
- item=0 ;
- delete [] t1;
- delete [] t2;
-
- }
- }
- catch( ... )
- {
- _interval->setDisabled( TRUE ) ;
- _refresh->setDisabled( TRUE ) ;
- _counter->stop();
- MESSAGE("Sorry, No more Registry Server") ;
- statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
- }
- END_OF("InfoHistory")
-}
-
-/*!
- Updates clients list
-*/
-void RegWidget::InfoReg()
-{
- BEGIN_OF("InfoReg")
- _clients->clear();
- try
- {
- _serverclients = _VarComponents->getall();
- for (CORBA::ULong i=0; i<_serverclients->length(); i++)
- {
- const Registry::Infos & c_info=(*_serverclients)[i];
- ASSERT( c_info.name!=NULL);
- QString a;
- a.setNum(int(c_info.pid));
- char * t1 = (char * )duplicate(ctime(&c_info.tc_start));
- t1 [strlen(t1) -1 ] = ' ';
- char * t2 = (char * )duplicate(ctime(&c_info.tc_hello));
- t2 [strlen(t2) -1 ] = ' ';
- QListViewItem * item = new QListViewItem(_clients, QString(c_info.name),\
- a, QString(c_info.pwname), QString(c_info.machine), \
- QString(t1), QString(t2));
- item=0 ;
- delete [] t1;
- delete [] t2;
-
- }
- }
- catch( ... )
- {
- _interval->setDisabled( TRUE ) ;
- _refresh->setDisabled( TRUE ) ;
- _counter->stop();
- MESSAGE("Sorry, No more Registry Server") ;
- statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
- }
- END_OF("InfoReg")
-}
-
-/*!
- Called when <Refresh> button is clicked
-*/
-void RegWidget::slotListeSelect()
-{
- try
- {
- ASSERT(_tabWidget->currentPage() != NULL);
- if (_tabWidget->currentPage () == _clients) InfoReg();
- else if (_tabWidget->currentPage () == _history) InfoHistory();
- }
- catch( ... )
- {
- MESSAGE("Sorry, No more Registry Server") ;
- statusBar()->message( tr( "Sorry, No more Registry Server" ) ) ;
- }
-}
-
-/*!
- Called when <Interval> button is clicked (changing refresh interval)
-*/
-void RegWidget::slotSelectRefresh()
-{
- BEGIN_OF("slotSelectRefresh");
- myIntervalWindow = new IntervalWindow(this);
- myIntervalWindow->installEventFilter( this );
- myIntervalWindow->setValue(myRefreshInterval);
- myIntervalWindow->show();
- connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( close() ) );
- connect( myIntervalWindow->Ok(), SIGNAL( clicked() ), this, SLOT( slotIntervalOk() ) );
- END_OF("slotSelectRefresh");
-}
-
-void RegWidget::slotIntervalOk()
-{
- BEGIN_OF("slotIntervalOk");
- myRefreshInterval = myIntervalWindow->getValue();
- _counter->changeInterval( myRefreshInterval * 1000 );
- SCRUTE(myRefreshInterval);
- myIntervalWindow->close();
- END_OF("slotIntervalOk");
-}
-/*!
- Called when <Help> button is clicked
-*/
-void RegWidget::slotHelp()
-{
- BEGIN_OF("slotHelp()");
-
- if ( !myHelpWindow ) {
- myHelpWindow = new HelpWindow( this );
- myHelpWindow->installEventFilter( this );
- }
- myHelpWindow->show();
- myHelpWindow->raise();
- myHelpWindow->setActiveWindow();
-
- END_OF("slotHelp()") ;
-}
-
-/*!
- Called when user clicks on item in <Running> list
-*/
-void RegWidget::slotClientChanged( QListViewItem* item )
-{
- BEGIN_OF("slotClientChanged()") ;
-
- if ( item <= 0)
- return;
-
- blockSignals( true ); // for sure that item will not be deleted when refreshing
-
- int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverclients);
- SCRUTE(numeroItem) ;
- SCRUTE(item->text(1)) ;
-
- ASSERT(numeroItem>=0) ;
- ASSERT((size_t)numeroItem<_serverclients->length()) ;
- const Registry::Infos & c_info=(*_serverclients)[numeroItem];
- ASSERT( c_info.name!=NULL);
-
- if ( !myInfoWindow ) {
- myInfoWindow = new InfoWindow( this );
- myInfoWindow->installEventFilter( this );
- }
- QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
- myInfoWindow->setCaption(a);
- myInfoWindow->setText( RegWidget::setlongText( c_info) );
- myInfoWindow->show();
- myInfoWindow->raise();
- myInfoWindow->setActiveWindow();
-
- blockSignals( false ); // enabling signals again
-
- END_OF("slotClientChanged()") ;
- return ;
-}
-
-/*!
- Called when user clicks on item in <History> list
-*/
-void RegWidget::slotHistoryChanged( QListViewItem* item )
-{
-
- BEGIN_OF("slotHistoryChanged()") ;
-
- if ( item <= 0)
- return;
-
- blockSignals( true ); // for sure that item will not be deleted when refreshing
-
- int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverhistory);
-
- SCRUTE(numeroItem) ;
- SCRUTE(item->text(1)) ;
- ASSERT(numeroItem>=0) ;
- ASSERT((size_t)numeroItem<_serverhistory->length()) ;
- const Registry::Infos & c_info=(*_serverhistory)[numeroItem];
- ASSERT( c_info.name!=NULL);
-
- if ( !myInfoWindow ) {
- myInfoWindow = new InfoWindow( this );
- myInfoWindow->installEventFilter( this );
- }
- QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name );
- myInfoWindow->setCaption(a);
- myInfoWindow->setText( RegWidget::setlongText( c_info ) );
- myInfoWindow->show();
- myInfoWindow->raise();
- myInfoWindow->setActiveWindow();
-
- blockSignals( false ); // enabling signals again
-
- END_OF("slotHistoryChanged()") ;
- return ;
-}
-
-/*!
- Constructor
-*/
-InfoWindow::InfoWindow( QWidget* parent, const char* name )
- : QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
-{
- BEGIN_OF("InfoWindow");
- myTextView = new QTextView( this, "myTextView" );
- setCentralWidget( myTextView );
- setMinimumSize( 450, 250 );
- END_OF("InfoWindow");
-}
-
-/*!
- Sets text
-*/
-void InfoWindow::setText( const QString& text )
-{
- myTextView->setText( text );
-}
-
-static const char* SEPARATOR = ":";
-
-QString findFile( QString filename )
-{
- QString dir;
- char* cenv;
-
- // Try ${HOME}/.salome/resources directory
- cenv = getenv( "HOME" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + ".salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try ${SALOME_SITE_DIR}/share/salome/resources directory
- cenv = getenv( "SALOME_SITE_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- cenv = getenv("SALOME_SITE_NAME");
- if (cenv) dir = dir + cenv;
- else dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
- cenv = getenv( "KERNEL_ROOT_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = addSlash(dir) ;
- dir = dir + "share" ;
- dir = addSlash(dir) ;
- dir = dir + "salome" ;
- dir = addSlash(dir) ;
- dir = dir + "resources" ;
- dir = addSlash(dir) ;
- QFileInfo fileInfo( dir + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- // Try CSF_SaloameResources env.var directory ( or directory list )
- cenv = getenv( "CSF_SalomeResources" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- QStringList dirList = QStringList::split( SEPARATOR, dir, false ); // skip empty entries
- for ( int i = 0; i < dirList.count(); i++ ) {
- QFileInfo fileInfo( addSlash( dirList[ i ] ) + filename );
- if ( fileInfo.isFile() && fileInfo.exists() )
- return fileInfo.filePath();
- }
- }
- }
- return filename;
-}
-QString addSlash( const QString& path )
-{
- if (!path.isNull()) {
-#ifdef WNT
- QChar slash ('\\');
-#else
- QChar slash ('/');
-#endif
- if ( path.at(path.length()-1) != slash )
- return path + slash;
- }
- return path;
-}
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// 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 : RegWidget.hxx
-// Author : Pascale NOYRET, EDF
-// Module : SALOME
-// $Header$
-
-# ifndef __REGWIDGET_H__
-# define __REGWIDGET_H__
-# include <qapplication.h>
-# include <qmainwindow.h>
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Registry)
-
-#include <IntervalWindow.hxx>
-
-class QTabWidget;
-class QListView;
-class QListViewItem;
-class QWidget;
-class QTimer;
-class QCloseEvent;
-class QTextView;
-#if QT_VERSION > 300
-class QPushButton;
-#endif
-class HelpWindow;
-class InfoWindow;
-
-class RegWidget : public QMainWindow
-{
-
- Q_OBJECT
-
-public:
- RegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
- ~RegWidget();
- void SetListe();
- void SetListeHistory();
- void InfoReg();
- void InfoHistory();
-
- bool eventFilter( QObject* object, QEvent* event );
-
- static RegWidget* GetRegWidget( CORBA::ORB_var &orb , QWidget *parent = 0, const char *name = 0 );
-
-public slots:
- void slotHelp();
- void slotListeSelect();
- void slotClientChanged( QListViewItem* );
- void slotHistoryChanged( QListViewItem* );
- void slotSelectRefresh();
- void slotIntervalOk();
-protected:
- static QString setlongText( const Registry::Infos &c_info );
- int numitem( const QString& name, const QString& pid, const QString& machine, const Registry::AllInfos* c_info );
- void closeEvent( QCloseEvent *e);
-
-protected :
- QListView* _clients;
- QListView* _history;
- QWidget* _parent;
- QTabWidget* _tabWidget;
- QPushButton* _refresh;
- QPushButton* _interval;
- QTimer* _counter;
- Registry::AllInfos* _serverhistory;
- Registry::AllInfos* _serverclients;
- InfoWindow* myInfoWindow;
- HelpWindow* myHelpWindow;
- IntervalWindow* myIntervalWindow;
- int myRefreshInterval;
-
-private:
- const Registry::Components_var _VarComponents;
- static RegWidget* myRegWidgetPtr;
-};
-
-class InfoWindow : public QMainWindow {
-public:
- InfoWindow( QWidget* parent = 0, const char* name = 0);
-
- void setText( const QString& text );
- QTextView* textView() const { return myTextView; }
-
-private:
- QTextView* myTextView;
-
-};
-
-# endif /* # ifndef __REGWIDGET_H__ */
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// SALOME RegistryDisplay : GUI for Registry server implementation
-//
-// 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 : RegWidgetFactory.cxx
-// Author : Pascale NOYRET, EDF
-// Module : SALOME
-// $Header$
-
-# include "RegWidget.hxx"
-# include "utilities.h"
-using namespace std;
-
-extern "C"
-{
-
-void OnGUIEvent( CORBA::ORB_var &orb, QWidget *parent, const char *name )
-{
- // N.B. parent can be 0
- RegWidget* ptrRegWidget = RegWidget::GetRegWidget( orb, parent, name );
- //ASSERT ( !ptrRegWidget );
- ptrRegWidget->show();
- ptrRegWidget->raise();
- ptrRegWidget->setActiveWindow();
- return;
-}
-
-}
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : CLIENT_icons.po
-# Module : SALOME
-
-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"
-
-#--------------
-# DESKTOP
-#--------------
-
-msgid "ICON_DESK_DEFAULTICON"
-msgstr "default.png"
-
-msgid "ICON_DESK_BACKGROUNDICON"
-msgstr "Desktop.png"
-
-#--------------
-# APPLICATION
-#--------------
-
-msgid "ICON_APP_DEFAULTICON"
-msgstr "default.png"
-
-#--------------
-# ABOUT
-#--------------
-
-msgid "ICON_ABOUT"
-msgstr "Application-About.png"
-
-msgid "ICON_DESK_LOGO"
-msgstr "Application-Logo.png"
\ No newline at end of file
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : CLIENT_msg_en.po
-# Module : SALOME
-
-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"
-
-#---------------
-# INFORMATIONS
-#---------------
-
-msgid "INF_VERSION"
-msgstr "Version 2.2.0"
-
-msgid "INF_COPYRIGHT"
-msgstr "Copyright (C) 2003-2004 OPEN CASCADE, EADS/CCR, LIP6,\nCEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS"
-
-msgid "INF_LICENSE"
-msgstr "GNU LGPL"
-
-#: SALOMEGUI_AboutDlg.cxx:42
-msgid "ABOUT_TLT"
-msgstr "About SALOME"
-
-#: QAD_Config.cxx:84
-msgid "MEN_APPNAME"
-msgstr "salome"
-
-#: QAD_Application.cxx:133
-msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 2.2.0"
-
-#: QAD_Desktop.cxx:424
-msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 2.2.0"
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#define _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TCollection_MapNode_HeaderFile
-#include <Handle_TCollection_MapNode.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TCollection_MapNode);
-class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger);
-
-class Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) : public Handle(TCollection_MapNode) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)():Handle(TCollection_MapNode)() {}
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)(const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle)
- {
- }
-
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)(const SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
- {
- }
-
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& operator=(const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& operator=(const SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* operator->()
- {
- return (SALOME_DataMapNodeOfDataMapOfIOMapOfInteger *)ControlAccess();
- }
-
- SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* operator->() const
- {
- return (SALOME_DataMapNodeOfDataMapOfIOMapOfInteger *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)();
-
- Standard_EXPORT static const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_Filter.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#define _Handle_SALOME_Filter_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_MMgt_TShared_HeaderFile
-#include <Handle_MMgt_TShared.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(MMgt_TShared);
-class SALOME_Filter;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_Filter);
-
-class Handle(SALOME_Filter) : public Handle(MMgt_TShared) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_Filter)():Handle(MMgt_TShared)() {}
- Handle(SALOME_Filter)(const Handle(SALOME_Filter)& aHandle) : Handle(MMgt_TShared)(aHandle)
- {
- }
-
- Handle(SALOME_Filter)(const SALOME_Filter* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
- {
- }
-
- Handle(SALOME_Filter)& operator=(const Handle(SALOME_Filter)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_Filter)& operator=(const SALOME_Filter* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_Filter* operator->()
- {
- return (SALOME_Filter *)ControlAccess();
- }
-
- SALOME_Filter* operator->() const
- {
- return (SALOME_Filter *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_Filter)();
-
- Standard_EXPORT static const Handle(SALOME_Filter) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_ListNodeOfListIO.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
-#define _Handle_SALOME_ListNodeOfListIO_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TCollection_MapNode_HeaderFile
-#include <Handle_TCollection_MapNode.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TCollection_MapNode);
-class SALOME_ListNodeOfListIO;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_ListNodeOfListIO);
-
-class Handle(SALOME_ListNodeOfListIO) : public Handle(TCollection_MapNode) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOME_ListNodeOfListIO)():Handle(TCollection_MapNode)() {}
- Handle(SALOME_ListNodeOfListIO)(const Handle(SALOME_ListNodeOfListIO)& aHandle) : Handle(TCollection_MapNode)(aHandle)
- {
- }
-
- Handle(SALOME_ListNodeOfListIO)(const SALOME_ListNodeOfListIO* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
- {
- }
-
- Handle(SALOME_ListNodeOfListIO)& operator=(const Handle(SALOME_ListNodeOfListIO)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_ListNodeOfListIO)& operator=(const SALOME_ListNodeOfListIO* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_ListNodeOfListIO* operator->()
- {
- return (SALOME_ListNodeOfListIO *)ControlAccess();
- }
-
- SALOME_ListNodeOfListIO* operator->() const
- {
- return (SALOME_ListNodeOfListIO *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_ListNodeOfListIO)();
-
- Standard_EXPORT static const Handle(SALOME_ListNodeOfListIO) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_ListNodeOfListOfFilter.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_ListNodeOfListOfFilter_HeaderFile
-#define _Handle_SALOME_ListNodeOfListOfFilter_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TCollection_MapNode_HeaderFile
-#include <Handle_TCollection_MapNode.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TCollection_MapNode);
-class SALOME_ListNodeOfListOfFilter;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_ListNodeOfListOfFilter);
-
-class Handle(SALOME_ListNodeOfListOfFilter) : public Handle(TCollection_MapNode) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_ListNodeOfListOfFilter)():Handle(TCollection_MapNode)() {}
- Handle(SALOME_ListNodeOfListOfFilter)(const Handle(SALOME_ListNodeOfListOfFilter)& aHandle) : Handle(TCollection_MapNode)(aHandle)
- {
- }
-
- Handle(SALOME_ListNodeOfListOfFilter)(const SALOME_ListNodeOfListOfFilter* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
- {
- }
-
- Handle(SALOME_ListNodeOfListOfFilter)& operator=(const Handle(SALOME_ListNodeOfListOfFilter)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_ListNodeOfListOfFilter)& operator=(const SALOME_ListNodeOfListOfFilter* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_ListNodeOfListOfFilter* operator->()
- {
- return (SALOME_ListNodeOfListOfFilter *)ControlAccess();
- }
-
- SALOME_ListNodeOfListOfFilter* operator->() const
- {
- return (SALOME_ListNodeOfListOfFilter *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_ListNodeOfListOfFilter)();
-
- Standard_EXPORT static const Handle(SALOME_ListNodeOfListOfFilter) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_NumberFilter.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_NumberFilter_HeaderFile
-#define _Handle_SALOME_NumberFilter_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(SALOME_Filter);
-class SALOME_NumberFilter;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_NumberFilter);
-
-class Handle(SALOME_NumberFilter) : public Handle(SALOME_Filter) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_NumberFilter)():Handle(SALOME_Filter)() {}
- Handle(SALOME_NumberFilter)(const Handle(SALOME_NumberFilter)& aHandle) : Handle(SALOME_Filter)(aHandle)
- {
- }
-
- Handle(SALOME_NumberFilter)(const SALOME_NumberFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem)
- {
- }
-
- Handle(SALOME_NumberFilter)& operator=(const Handle(SALOME_NumberFilter)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_NumberFilter)& operator=(const SALOME_NumberFilter* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_NumberFilter* operator->()
- {
- return (SALOME_NumberFilter *)ControlAccess();
- }
-
- SALOME_NumberFilter* operator->() const
- {
- return (SALOME_NumberFilter *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_NumberFilter)();
-
- Standard_EXPORT static const Handle(SALOME_NumberFilter) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : Handle_SALOME_TypeFilter.hxx
-// Module : SALOME
-
-#ifndef _Handle_SALOME_TypeFilter_HeaderFile
-#define _Handle_SALOME_TypeFilter_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(SALOME_Filter);
-class SALOME_TypeFilter;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_TypeFilter);
-
-class Handle(SALOME_TypeFilter) : public Handle(SALOME_Filter) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOME_TypeFilter)():Handle(SALOME_Filter)() {}
- Handle(SALOME_TypeFilter)(const Handle(SALOME_TypeFilter)& aHandle) : Handle(SALOME_Filter)(aHandle)
- {
- }
-
- Handle(SALOME_TypeFilter)(const SALOME_TypeFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem)
- {
- }
-
- Handle(SALOME_TypeFilter)& operator=(const Handle(SALOME_TypeFilter)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOME_TypeFilter)& operator=(const SALOME_TypeFilter* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOME_TypeFilter* operator->()
- {
- return (SALOME_TypeFilter *)ControlAccess();
- }
-
- SALOME_TypeFilter* operator->() const
- {
- return (SALOME_TypeFilter *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOME_TypeFilter)();
-
- Standard_EXPORT static const Handle(SALOME_TypeFilter) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : Makefile.in
-# Module : SALOME
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- QAD.h \
- QAD_Action.h \
- QAD_Application.h \
- QAD_Config.h \
- QAD_Desktop.h \
- QAD_DirListDlg.h \
- QAD_XmlHandler.h \
- QAD_FileDlg.h \
- QAD_FileValidator.h \
- QAD_Help.h \
- QAD_PyInterp.h \
- QAD_LeftFrame.h \
- QAD_ListMenuIdAction.h \
- QAD_ListPopupMenu.h \
- QAD_ListView.h \
- QAD_Menus.h \
- QAD_Message.h \
- QAD_MessageBox.h \
- QAD_Operation.h \
- QAD_OperatorMenus.h \
- QAD_ObjectBrowser.h \
- QAD_ObjectBrowserItem.h \
- QAD_Popup.h \
- QAD_PyEditor.h \
- PyInterp_base.h \
- PyInterp_PyQt.h \
- QAD_Resource.h \
- QAD_ResourceMgr.h \
- QAD_RightFrame.h \
- QAD_Settings.h \
- QAD_SpinBoxDbl.h \
- QAD_Splitter.h \
- QAD_Study.h \
- QAD_StudyFrame.h \
- QAD_Tools.h \
- QAD_ViewFrame.h \
- QAD_WaitCursor.h \
- SALOMEGUI_Application.h \
- SALOMEGUI_Desktop.h \
- SALOMEGUI_ImportOperation.h \
- SALOMEGUI_ViewChoiceDlg.h \
- SALOMEGUI_Swig.hxx \
- SALOMEGUI_Swig.i \
- SALOMEGUI_QtCatchCorbaException.hxx \
- SALOME_ListIO.hxx \
- SALOME_ListIteratorOfListIO.hxx \
- Handle_SALOME_ListNodeOfListIO.hxx \
- SALOME_Selection.h \
- Handle_SALOME_Filter.hxx \
- SALOME_Filter.hxx \
- SALOME_TypeFilter.hxx \
- Handle_SALOME_TypeFilter.hxx \
- SALOME_ListOfFilter.hxx \
- SALOME_ListIteratorOfListOfFilter.hxx \
- Handle_SALOME_ListNodeOfListOfFilter.hxx \
- SALOME_NumberFilter.hxx \
- Handle_SALOME_NumberFilter.hxx \
- SALOME_DataMapOfIOMapOfInteger.hxx \
- SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx \
- Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx \
- SALOMEGUI.h \
- SALOMEGUI_LoadStudiesDlg.h \
- SALOMEGUI_TableDlg.h \
- SALOMEGUI_NameDlg.h \
- SALOMEGUI_SetValueDlg.h \
- SALOMEGUI_SetupCurveDlg.h \
- SALOMEGUI_CloseDlg.h
-
-# .po files to transform in .qm
-PO_FILES = \
- QAD_icons.po \
- QAD_msg_en.po \
- QAD_msg_fr.po \
- SALOMEGUI_icons.po \
- SALOMEGUI_msg_en.po \
- SALOMEGUI_msg_fr.po \
- CLIENT_icons.po \
- CLIENT_msg_en.po
-
-# Libraries targets
-
-LIB = libSalomeGUI.la
-LIB_SRC = \
- QAD_Application.cxx \
- QAD_Config.cxx \
- QAD_Desktop.cxx \
- QAD_DirListDlg.cxx \
- QAD_XmlHandler.cxx \
- QAD_FileDlg.cxx \
- QAD_FileValidator.cxx \
- QAD_Help.cxx \
- PyInterp_base.cxx \
- QAD_PyInterp.cxx \
- QAD_PyInterp_mono.cxx \
- PyInterp_PyQt.cxx \
- QAD_LeftFrame.cxx \
- QAD_ListMenuIdAction.cxx \
- QAD_ListPopupMenu.cxx \
- QAD_ListView.cxx \
- QAD_Menus.cxx \
- QAD_Message.cxx \
- QAD_MessageBox.cxx \
- QAD_Operation.cxx \
- QAD_OperatorMenus.cxx \
- QAD_ObjectBrowser.cxx \
- QAD_ObjectBrowserItem.cxx \
- QAD_ParserSettings.cxx \
- QAD_Popup.cxx \
- QAD_PyEditor.cxx \
- QAD_ResourceMgr.cxx \
- QAD_RightFrame.cxx \
- QAD_Settings.cxx \
- QAD_SpinBoxDbl.cxx \
- QAD_Splitter.cxx \
- QAD_Study.cxx \
- QAD_StudyFrame.cxx \
- QAD_Tools.cxx \
- QAD_ViewFrame.cxx \
- SALOMEGUI.cxx \
- SALOMEGUI_Application.cxx \
- SALOMEGUI_Desktop.cxx \
- SALOMEGUI_ImportOperation.cxx \
- SALOMEGUI_ViewChoiceDlg.cxx \
- SALOMEGUI_AboutDlg.cxx \
- SALOMEGUI_Swig.cxx \
- SALOMEGUI_OpenWith.cxx \
- SALOMEGUI_StudyPropertiesDlg.cxx \
- SALOMEGUI_QtCatchCorbaException.cxx \
- SALOME_ListIO_0.cxx \
- SALOME_ListNodeOfListIO_0.cxx \
- SALOME_ListIteratorOfListIO_0.cxx \
- SALOME_Selection.cxx \
- SALOME_Filter.cxx \
- SALOME_ListOfFilter_0.cxx \
- SALOME_ListNodeOfListOfFilter_0.cxx \
- SALOME_ListIteratorOfListOfFilter_0.cxx \
- SALOME_TypeFilter.cxx \
- SALOME_NumberFilter.cxx \
- SALOME_DataMapOfIOMapOfInteger_0.cxx \
- SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx \
- SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx \
- SALOMEGUI_TrihedronSizeDlg.cxx \
- SALOMEGUI_ExternalBrowserDlg.cxx \
- SALOMEGUI_LoadStudiesDlg.cxx \
- SALOMEGUI_TableDlg.cxx \
- SALOMEGUI_NameDlg.cxx \
- SALOMEGUI_SetValueDlg.cxx \
- SALOMEGUI_SetupCurveDlg.cxx \
- SALOMEGUI_CloseDlg.cxx \
- SALOMEGUI_ActivateComponentDlg.cxx
-LIB_MOC = \
- SALOMEGUI.h \
- SALOMEGUI_Application.h \
- SALOMEGUI_Desktop.h \
- QAD_Application.h \
- QAD_Action.h \
- QAD_Desktop.h \
- QAD_DirListDlg.h \
- QAD_FileDlg.h \
- QAD_ListView.h \
- QAD_ObjectBrowser.h \
- QAD_Operation.h \
- QAD_PyEditor.h \
- QAD_ResourceMgr.h \
- QAD_Settings.h \
- QAD_SpinBoxDbl.h \
- QAD_Study.h \
- QAD_StudyFrame.h \
- QAD_ViewFrame.h \
- SALOMEGUI_OpenWith.h \
- SALOMEGUI_StudyPropertiesDlg.h \
- SALOMEGUI_TrihedronSizeDlg.h \
- SALOMEGUI_ExternalBrowserDlg.h \
- SALOME_Selection.h \
- SALOMEGUI_LoadStudiesDlg.h \
- SALOMEGUI_ViewChoiceDlg.h \
- SALOMEGUI_TableDlg.h \
- SALOMEGUI_NameDlg.h \
- SALOMEGUI_SetupCurveDlg.h \
- SALOMEGUI_CloseDlg.h \
- SALOMEGUI_ActivateComponentDlg.h
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOMEDS_Attributes.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Component.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSalomePrs
-
-LIBS+= $(PYTHON_LIBS)
-
-
-@CONCLUDE@
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : PyInterp_PyQt.cxx
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include "PyInterp_PyQt.h"
-#include "utilities.h"
-
-using namespace std;
-
-
-/*!
- * constructor : the main SALOME Python interpreter is used for PyQt GUI.
- * calls initialize method defined in base class, which calls virtual methods
- * initstate & initcontext redefined here
- */
-PyInterp_PyQt::PyInterp_PyQt(): PyInterp_base()
-{
-}
-
-PyInterp_PyQt::~PyInterp_PyQt()
-{
-}
-
-void PyInterp_PyQt::initState()
-{
- SCRUTE(PyInterp_base::_gtstate);
- _tstate=PyInterp_base::_gtstate;
- PyThreadState_Swap(_tstate);
- SCRUTE(_tstate);
-}
-
-void PyInterp_PyQt::initContext()
-{
- _g = PyDict_New(); // create interpreter dictionnary context
- PyObject *bimod = PyImport_ImportModule("__builtin__");
- PyDict_SetItemString(_g, "__builtins__", bimod);
- Py_DECREF(bimod);
-}
-
-void PyInterp_PyQt::run(const char *command)
-{
- MESSAGE("compile");
- PyLockWrapper aLock(_tstate);
- PyObject *code = Py_CompileString((char *)command,"PyGUI",Py_file_input);
- if(!code){
- // Une erreur s est produite en general SyntaxError
- PyErr_Print();
- return;
- }
- PyObject *r = PyEval_EvalCode(code,_g,_g);
- Py_DECREF(code);
- if(!r){
- // Une erreur s est produite a l execution
- PyErr_Print();
- return;
- }
- Py_DECREF(r);
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : PyInterp_PyQt.h
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _PYINTERP_PYQT_H_
-#define _PYINTERP_PYQT_H_
-
-#include "PyInterp_base.h"
-
-class PyInterp_PyQt : public PyInterp_base
-{
- public:
- PyInterp_PyQt();
- ~PyInterp_PyQt();
-
- void run(const char *command);
-
- protected:
- virtual void initState();
- virtual void initContext();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : PyInterp_base.cxx
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-
-#include <string>
-#include <vector>
-
-#include <Python.h>
-#include <cStringIO.h>
-
-#include <qmutex.h>
-
-#include "PyInterp_base.h"
-#include "utilities.h"
-
-
-using namespace std;
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYPYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-static int MYPYDEBUG = 0;
-#endif
-
-
-static QMutex myMutex(true);
-
-
-PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
- myThreadState(theThreadState),
- mySaveThreadState(PyInterp_base::_gtstate)
-{
- PyEval_AcquireLock();
- mySaveThreadState = PyThreadState_Swap(myThreadState);
-}
-
-
-PyLockWrapper::~PyLockWrapper(){
- PyThreadState_Swap(mySaveThreadState);
- PyEval_ReleaseLock();
-}
-
-
-ThreadLock::ThreadLock(QMutex* theMutex, const char* theComment):
- myMutex(theMutex),
- myComment(theComment)
-{
- if(MYDEBUG && myComment != "") MESSAGE(" ThreadLock "<<this<<"::"<<myMutex<<" - "<<myComment<<" - "<<myMutex->locked());
- myMutex->lock();
-}
-
-
-ThreadLock::~ThreadLock(){
- if(MYDEBUG && myComment != "") MESSAGE("~ThreadLock "<<this<<"::"<<myMutex<<" - "<<myComment);
- myMutex->unlock();
-}
-
-
-bool IsPyLocked(){
- return myMutex.locked();
-}
-
-
-ThreadLock GetPyThreadLock(const char* theComment){
- return ThreadLock(&myMutex,theComment);
-}
-
-
-class PyReleaseLock{
-public:
- ~PyReleaseLock(){
- if(MYPYDEBUG) MESSAGE("~PyReleaseLock()");
- PyEval_ReleaseLock();
- }
-};
-
-
-PyLockWrapper PyInterp_base::GetLockWrapper(){
- return _tstate;
-}
-
-
-// main python interpreter
-
-PyThreadState *PyInterp_base::_gtstate = 0; // force 0 before execution
-int PyInterp_base::_argc = 1;
-char* PyInterp_base::_argv[] = {""};
-
-PyObject *PyInterp_base::builtinmodule = NULL;
-PyObject *PyInterp_base::salome_shared_modules_module = NULL;
-
-
-/*!
- * basic constructor here : herited classes constructors must call initalize() method
- * defined here.
- */
-PyInterp_base::PyInterp_base(): _tstate(0), _vout(0), _verr(0), _g(0), _atFirst(true)
-{
- if(MYPYDEBUG) MESSAGE("PyInterp_base::PyInterp_base() - this = "<<this);
-}
-
-PyInterp_base::~PyInterp_base()
-{
- if(MYPYDEBUG) MESSAGE("PyInterp_base::~PyInterp_base() - this = "<<this);
- PyLockWrapper aLock(_tstate);
- //Py_EndInterpreter(_tstate);
-}
-
-
-/*!
- * Must be called by herited classes constructors. initialize() calls virtuals methods
- * initstate & initcontext, not defined here in base class. initstate & initcontext methods
- * must be implemented in herited classes, following the Python interpreter policy
- * (mono or multi interpreter...).
- */
-void PyInterp_base::initialize()
-{
- _history.clear(); // start a new list of user's commands
- _ith = _history.begin();
-
- if(!_gtstate){
- PyReleaseLock aReleaseLock;
- Py_Initialize(); // Initialize the interpreter
- PyEval_InitThreads(); // Initialize and acquire the global interpreter lock
- PySys_SetArgv(_argc,_argv); // initialize sys.argv
- _gtstate = PyThreadState_Get();
-
- /*
- * salome_shared_modules should be imported only once
- */
- salome_shared_modules_module = PyImport_ImportModule("salome_shared_modules");
- if(!salome_shared_modules_module)
- {
- INFOS("PyInterp_base::initialize() - salome_shared_modules_module == NULL");
- PyErr_Print();
- PyErr_Clear();
- }
- }
- // Here the global lock is released
- if(MYPYDEBUG) MESSAGE("PyInterp_base::initialize() - this = "<<this<<"; _gtstate = "<<_gtstate);
-
- // The lock will be acquired in initState. Make provision to release it on exit
- PyReleaseLock aReleaseLock;
-
- initState();
- initContext();
-
- // used to interpret & compile commands
- PyObjWrapper m(PyImport_ImportModule("codeop"));
- if(!m){
- INFOS("PyInterp_base::initialize() - PyImport_ImportModule('codeop') failed");
- PyErr_Print();
- ASSERT(0);
- return;
- }
-
- // Create cStringIO to capture stdout and stderr
- //PycString_IMPORT;
- PycStringIO = (PycStringIO_CAPI *)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI");
- _vout = PycStringIO->NewOutput(128);
- _verr = PycStringIO->NewOutput(128);
-
- // All the initRun outputs are redirected to the standard output (console)
- initRun();
-}
-
-
-string PyInterp_base::getbanner()
-{
- string aBanner("Python ");
- aBanner = aBanner + Py_GetVersion() + " on " + Py_GetPlatform() ;
- aBanner = aBanner + "\ntype help to get general information on environment\n";
- return aBanner;
-}
-
-
-int PyInterp_base::initRun()
-{
- PySys_SetObject("stderr",_verr);
- PySys_SetObject("stdout",_vout);
-
- PyObjWrapper verr(PyObject_CallMethod(_verr,"reset",""));
- PyObjWrapper vout(PyObject_CallMethod(_vout,"reset",""));
-
- PyObject *m = PyImport_GetModuleDict();
-
- PySys_SetObject("stdout",PySys_GetObject("__stdout__"));
- PySys_SetObject("stderr",PySys_GetObject("__stderr__"));
-
- if(MYPYDEBUG) MESSAGE("PyInterp_base::initRun() - this = "<<this<<"; _verr = "<<_verr<<"; _vout = "<<_vout);
- return 0;
-}
-
-
-/*!
- * This function compiles a string (command) and then evaluates it in the dictionnary
- * context if possible.
- * Returns :
- * -1 : fatal error
- * 1 : incomplete text
- * 0 : complete text executed with success
- */
-int compile_command(const char *command,PyObject *context)
-{
- PyObject *m = PyImport_AddModule("codeop");
- if(!m){ // Fatal error. No way to go on.
- PyErr_Print();
- return -1;
- }
- PyObjWrapper v(PyObject_CallMethod(m,"compile_command","s",command));
- if(!v){
- // Error encountered. It should be SyntaxError,
- //so we don't write out traceback
- PyObjWrapper exception, value, tb;
- PyErr_Fetch(&exception, &value, &tb);
- PyErr_NormalizeException(&exception, &value, &tb);
- PyErr_Display(exception, value, NULL);
- return -1;
- }else if (v == Py_None){
- // Incomplete text we return 1 : we need a complete text to execute
- return 1;
- }else{
- // Complete and correct text. We evaluate it.
- PyObjWrapper r(PyEval_EvalCode(v,context,context));
- if(!r){
- // Execution error. We return -1
- PyErr_Print();
- return -1;
- }
- // The command has been successfully executed. Return 0
- return 0;
- }
-}
-
-
-int PyInterp_base::run(const char *command)
-{
- if(_atFirst){
- int ret = 0;
- ret = simpleRun("from Help import *");
- if (ret) {
- _atFirst = false;
- return ret;
- }
- ret = simpleRun("import salome");
- if (ret) {
- _atFirst = false;
- return ret;
- }
- ret = simpleRun("salome.salome_init()");
- if (ret) {
- _atFirst = false;
- return ret;
- }
- _atFirst = false;
- }
- return simpleRun(command);
-}
-
-
-int PyInterp_base::simpleRun(const char *command)
-{
- if( !_atFirst && strcmp(command,"") != 0 ) {
- _history.push_back(command);
- _ith = _history.end();
- }
-
- // We come from C++ to enter Python world
- // We need to acquire the Python global lock
- PyLockWrapper aLock(_tstate);
-
- // Reset redirected outputs before treatment
- PySys_SetObject("stderr",_verr);
- PySys_SetObject("stdout",_vout);
-
- PyObjWrapper verr(PyObject_CallMethod(_verr,"reset",""));
- PyObjWrapper vout(PyObject_CallMethod(_vout,"reset",""));
-
- int ier = compile_command(command,_g);
-
- // Outputs are redirected on standards outputs (console)
- PySys_SetObject("stdout",PySys_GetObject("__stdout__"));
- PySys_SetObject("stderr",PySys_GetObject("__stderr__"));
- return ier;
-}
-
-
-const char * PyInterp_base::getPrevious()
-{
- if(_ith != _history.begin()){
- _ith--;
- return (*_ith).c_str();
- }
- else
- return BEGIN_HISTORY_PY;
-}
-
-
-const char * PyInterp_base::getNext()
-{
- if(_ith != _history.end()){
- _ith++;
- }
- if (_ith == _history.end())
- return TOP_HISTORY_PY;
- else
- return (*_ith).c_str();
-}
-
-
-string PyInterp_base::getverr(){
- PyLockWrapper aLock(_tstate);
- PyObjWrapper v(PycStringIO->cgetvalue(_verr));
- string aRet(PyString_AsString(v));
- return aRet;
-}
-
-
-string PyInterp_base::getvout(){
- PyLockWrapper aLock(_tstate);
- PyObjWrapper v(PycStringIO->cgetvalue(_vout));
- string aRet(PyString_AsString(v));
- return aRet;
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : PyInterp_base.h
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _PYINTERP_BASE_H_
-#define _PYINTERP_BASE_H_
-
-#include <list>
-#include <string>
-#include <iostream>
-
-#include <Python.h>
-
-class QSemaphore;
-class QMutex;
-
-extern "C" PyObject * PyEval_EvalCode(PyObject *co, PyObject *g, PyObject *l);
-
-#define TOP_HISTORY_PY "--- top of history ---"
-#define BEGIN_HISTORY_PY "--- begin of history ---"
-
-
-class SemaphoreLock{
- QSemaphore* mySemaphore;
- std::string myComment;
- public:
- SemaphoreLock(QSemaphore* theSemaphore, const char* theComment = "");
- ~SemaphoreLock();
-};
-
-
-class PyLockWrapper{
- PyThreadState* myThreadState;
- PyThreadState* mySaveThreadState;
- public:
- PyLockWrapper(PyThreadState* theThreadState);
- ~PyLockWrapper();
-};
-
-
-class ThreadLock{
- QMutex* myMutex;
- std::string myComment;
- public:
- ThreadLock(QMutex* theMutex, const char* theComment = "");
- ~ThreadLock();
-};
-
-
-bool IsPyLocked();
-
-ThreadLock GetPyThreadLock(const char* theComment = "");
-
-
-class PyInterp_base{
- public:
- static PyThreadState *_gtstate;
- static int _argc;
- static char* _argv[];
- static PyObject *builtinmodule;
- static PyObject *salome_shared_modules_module;
-
- PyInterp_base();
- ~PyInterp_base();
-
- virtual void initialize();
-
- int run(const char *command);
-
- PyLockWrapper GetLockWrapper();
-
- std::string getbanner();
- std::string getverr();
- std::string getvout();
-
- const char * getPrevious();
- const char * getNext();
-
- protected:
- PyThreadState * _tstate;
- PyObject * _vout;
- PyObject * _verr;
- PyObject * _g;
- std::list<std::string> _history;
- std::list<std::string>::iterator _ith;
- bool _atFirst;
-
- int simpleRun(const char* command);
- int initRun();
-
- virtual void initState() = 0;
- virtual void initContext() = 0;
-};
-
-
-class PyObjWrapper{
- PyObject* myObject;
-public:
- PyObjWrapper(PyObject* theObject): myObject(theObject) {}
- PyObjWrapper(): myObject(0) {}
- operator PyObject*(){
- return myObject;
- }
- PyObject* operator->(){
- return myObject;
- }
- PyObject* get(){
- return myObject;
- }
- bool operator!(){
- return !myObject;
- }
- bool operator==(PyObject* theObject){
- return myObject == theObject;
- }
- PyObject** operator&(){
- return &myObject;
- }
- PyObjWrapper& operator=(PyObjWrapper* theObjWrapper){
- Py_XDECREF(myObject);
- myObject = theObjWrapper->myObject;
- return *this;
- }
- virtual ~PyObjWrapper(){
- Py_XDECREF(myObject);
- }
-};
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD.h
-// Module : SALOME
-
-/***********************************************************
-** File: QAD.h
-** Descr: General definitions for QAD
-** Created: UI team, 20.09.00
-************************************************************/
-#ifndef QAD_H
-#define QAD_H
-
-#include <assert.h>
-
-#if defined QAD_DLL
-#if defined WNT
-#define QAD_EXPORT _declspec( dllexport )
-#else
-#define QAD_EXPORT
-#endif
-#else
-#if defined WNT
-#define QAD_EXPORT _declspec( dllimport )
-#else
-#define QAD_EXPORT
-#endif
-#endif
-
-#if defined SOLARIS
-#define bool int
-#define false 0
-#define true 1
-#endif
-
-#if defined WNT
-#pragma warning ( disable: 4251 )
-#endif
-
-#if defined (_DEBUG)
-#define QAD_ASSERT(x) assert(x)
-#define QAD_ASSERT_DEBUG_ONLY(x) assert(x)
-
-#else /* _DEBUG */
-#define QAD_ASSERT(x) x
-#define QAD_ASSERT_DEBUG_ONLY(x)
-#endif
-
-/* Message box button's IDs */
-#define QAD_OK 1
-#define QAD_CANCEL 2
-#define QAD_YES 3
-#define QAD_NO 4
-#define QAD_HELP 5
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Action.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_ACTION_H
-#define QAD_ACTION_H
-
-#include "qactionP.h"
-#include <qmap.h>
-
-class ActionMap {
- public:
- ActionMap() {}
- ~ActionMap()
- {
- QMapIterator<int, QActionP*> it;
- for ( it = myMap.begin(); it != myMap.end(); it++ ) delete (QActionP*)it.data();
- myMap.clear();
- }
- bool isEmpty() { return myMap.isEmpty(); }
- void insert( const int id, QActionP* action ) { myMap[id] = action; }
- QActionP* at( const int id ) { return myMap[id]; }
- void clear() { myMap.clear(); }
- QActionP*& operator[] (const int id) { return myMap[id]; }
- bool hasAction( const int id ) { return myMap.contains(id); }
-
- private:
- QMap<int, QActionP*> myMap;
-
-};
-
-class ToggleAction : public QActionP {
- Q_OBJECT
- public:
- ToggleAction( const QString& text, const QString& menuText,
- QKeySequence accel, QObject* parent,
- const char* name = 0, bool toggle = FALSE)
- : QActionP( text, menuText, accel, parent, name, toggle )
- {
- connect( this, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool)));
- }
- private slots:
- void onToggled( bool on)
- {
- on ? emit( toggledOn() ) : emit( toggledOff() );
- }
-
- signals:
- void toggledOn();
- void toggledOff();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Application.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Application QAD_Application.h
- \brief Study manager for QAD-based application.
-*/
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_Application.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Config.h"
-#include "SALOMEGUI_AboutDlg.h"
-#include "SALOME_Selection.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Exception)
-
-// QT Includes
-#include <qapplication.h>
-#include <qtranslator.h>
-#include <qpopupmenu.h>
-#include <qstatusbar.h>
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qdialog.h>
-#include <qstring.h>
-#include <qpixmap.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qmessagebox.h>
-
-// Open CASCADE Includes
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <Standard_Failure.hxx>
-using namespace std;
-
-static bool checkPermission(QString fileName) {
- if ( QFile::exists( fileName ) ) {
- // if file exists - check it for writeability
- if ( !QFileInfo( fileName ).isWritable() ) {
- return false;
- }
- }
- else {
- // if file doesn't exist - try to create it
- QFile qf( fileName );
- if ( !qf.open( IO_WriteOnly ) ) {
- return false;
- }
- else {
- qf.close();
- qf.remove();
- }
- }
- return true;
-}
-
-QAD_Desktop* QAD_Application::desktop = 0;
-
-/*!
- Registers a new application object and
- adds it to the desktop [ static ]
-*/
-bool QAD_Application::addToDesktop( QAD_Application* app, SALOME_NamingService* name_service )
-{
- /* create CAF application */
- if ( !app->initApp(name_service) )
- return false;
-
- /* create the only desktop */
- if ( !app->getDesktop() )
- {
- app->createDesktop(name_service);
- emit app->desktopCreated();
- }
-
- /* add application to the desktop */
- desktop->addApplication( app );
- return true;
-}
-
-/*!
- Runs the application [ static ]
-*/
-void QAD_Application::run()
-{
- /* at least one application must be on desktop */
- QAD_ASSERT_DEBUG_ONLY ( desktop );
- desktop->showDesktop();
-}
-
-
-/*!
- Returns reference to main desktop [ static ]
-*/
-QAD_Desktop* QAD_Application::getDesktop()
-{
- return desktop;
-}
-
-/*!
- Returns standard Palette [ static ]
-*/
-QPalette QAD_Application::getPalette(bool alternative)
-{
-/* $$$ ---> commented 20.09.2002 - application uses global palette but little changed if <alternative> is true
- QPalette pal;
- QColorGroup cg;
- cg.setColor( QColorGroup::Foreground, Qt::black );
- cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Light, Qt::white );
- cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) );
- cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
- cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Text, Qt::black );
- cg.setColor( QColorGroup::BrightText, Qt::white );
- cg.setColor( QColorGroup::ButtonText, Qt::black );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Shadow, Qt::black );
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- pal.setActive( cg );
- cg.setColor( QColorGroup::Foreground, Qt::black );
- cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Light, Qt::white );
- cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
- cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
- cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Text, Qt::black );
- cg.setColor( QColorGroup::BrightText, Qt::white );
- cg.setColor( QColorGroup::ButtonText, Qt::black );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Shadow, Qt::black );
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- pal.setInactive( cg );
- cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Light, Qt::white );
- cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
- cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
- cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Text, Qt::black );
- cg.setColor( QColorGroup::BrightText, Qt::white );
- cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Shadow, Qt::black );
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- pal.setDisabled( cg );
- $$$ <--------------------------------------------------------------------- */
- QPalette pal = QApplication::palette();
- // $$$ --> this prevents qt bug - bag child window's icon drawing (not transparent)
- // when it is maximized
- pal.setColor(QPalette::Active, QColorGroup::Background, pal.active().button());
- pal.setColor(QPalette::Inactive, QColorGroup::Background, pal.inactive().button());
- pal.setColor(QPalette::Disabled, QColorGroup::Background, pal.disabled().button());
- // $$$ <---
- if (alternative) {
- // alternative palette is used for Object Browser, PyEditor, Message and Help windows
- QColorGroup cg = pal.active();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setActive ( cg );
- cg = pal.inactive();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setInactive( cg );
- cg = pal.disabled();
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- cg.setColor( QColorGroup::Base, QColor( 255,255,220 ) );
- cg.setColor( QColorGroup::Text, Qt::black );
- pal.setDisabled( cg );
- }
- return pal;
-}
-
-/*!
- Constructor
-*/
-QAD_Application::QAD_Application( const QString& format, const QString& description,
- const QString& extension ) :
-myActiveStudy( 0 ),
-myStudyFormat( format ),
-myStudyExtension( extension ),
-myStudyDescription( description )
-{
- /* actions are stored in vectors only */
-
- /* studies are managed by me */
- myStudies.setAutoDelete( true );
-
- /* load resources for all QAD */
- QAD_ResourceMgr* resMgr = QAD_Desktop::getResourceManager();
- if ( !resMgr ) resMgr = QAD_Desktop::createResourceManager();
- QString message;
- resMgr->loadResources( "QAD", message );
- resMgr->loadResources( "CLIENT", message );
-
- /* set default icon */
- myIcon = resMgr->loadPixmap( "CLIENT", tr("ICON_APP_DEFAULTICON") );
- myName = tr("APP_DEFAULTTITLE");
-
- /* We need to know that desktop is created in order
- to have some additional internal initialization */
- QAD_ASSERT( connect( this, SIGNAL(desktopCreated()), this,
- SLOT(onDesktopCreated()) ));
-}
-
-/*!
- Destructor
-*/
-QAD_Application::~QAD_Application ()
-{
- myEditActions.clear();
- myViewActions.clear();
- myHelpActions.clear();
- QMap<int, QToolBar*>::Iterator it;
- for ( it = myToolBars.begin(); it != myToolBars.end(); it++ ) {
- delete it.data();
- }
- myToolBars.clear();
-}
-
-/*!
- Creates the main desktop( called once )
-*/
-bool QAD_Application::createDesktop( SALOME_NamingService* name_service )
-{
- QAD_ASSERT_DEBUG_ONLY( !desktop );
- desktop = new QAD_Desktop ( name_service );
- return ( desktop != NULL );
-}
-
-/*!
- Creates the actions provided by this application
- ( internal )
-*/
-void QAD_Application::createActions()
-{
- /* Basic application provides only Undo/Redo
- functionalities which is disabled by default.
- All others must be added by subclasses.
- */
- QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
- // Undo
- if ( !myEditActions.at( EditUndoId ) )
- {
- QActionP* editUndo = new QActionP( tr("TOT_APP_EDIT_UNDO"),
- rmgr->loadPixmap( "QAD",
- tr("ICON_APP_EDIT_UNDO") ),
- tr("MEN_APP_EDIT_UNDO"),
- CTRL+Key_Z, desktop );
- editUndo->setStatusTip ( tr("PRP_APP_EDIT_UNDO") );
- QAD_ASSERT ( connect( editUndo, SIGNAL( activated() ), this, SLOT( onUndo() )));
- myEditActions.insert( EditUndoId, editUndo );
- }
- // Redo
- if ( !myEditActions.at( EditRedoId ) )
- {
- QActionP* editRedo = new QActionP ( tr("TOT_APP_EDIT_REDO"),
- rmgr->loadPixmap( "QAD", tr("ICON_APP_EDIT_REDO") ),
- tr("MEN_APP_EDIT_REDO"), CTRL+Key_Y, desktop );
- editRedo->setStatusTip ( tr("PRP_APP_EDIT_REDO") );
- QAD_ASSERT ( connect( editRedo, SIGNAL( activated() ), this, SLOT( onRedo() )));
- myEditActions.insert( EditRedoId, editRedo );
- }
- // Copy
- if ( !myEditActions.at( EditCopyId ) )
- {
- QActionP* editCopy = new QActionP ( tr("TOT_APP_EDIT_COPY"),
- rmgr->loadPixmap( "QAD",
- tr("ICON_APP_EDIT_COPY") ),
- tr("MEN_APP_EDIT_COPY"),
- CTRL+Key_C, desktop );
- editCopy->setStatusTip ( tr("PRP_APP_EDIT_COPY") );
- QAD_ASSERT ( connect( editCopy, SIGNAL( activated() ), this, SLOT( onCopy() )));
- myEditActions.insert( EditCopyId, editCopy );
- }
- // Paste
- if ( !myEditActions.at( EditPasteId ) )
- {
- QActionP* editPaste = new QActionP ( tr("TOT_APP_EDIT_PASTE"),
- rmgr->loadPixmap( "QAD",
- tr("ICON_APP_EDIT_PASTE") ),
- tr("MEN_APP_EDIT_PASTE"),
- CTRL+Key_V, desktop );
- editPaste->setStatusTip ( tr("PRP_APP_EDIT_PASTE") );
- QAD_ASSERT ( connect( editPaste, SIGNAL( activated() ), this, SLOT( onPaste() )));
- myEditActions.insert( EditPasteId, editPaste );
- }
- // Update action state
- updateActions();
-}
-
-/*!
- Enables/disables the actions according to the
- application state
-*/
-void QAD_Application::updateActions()
-{
- QAD_ASSERT_DEBUG_ONLY( !myEditActions.isEmpty() );
- if ( myActiveStudy ) {
- myEditActions.at( EditUndoId )->setEnabled( myActiveStudy->canUndo() );
- myEditActions.at( EditRedoId )->setEnabled( myActiveStudy->canRedo() );
- myEditActions.at( EditCopyId )->setEnabled( canCopy() );
- myEditActions.at( EditPasteId )->setEnabled( canPaste() );
- }
- else {
- myEditActions.at( EditUndoId )->setEnabled( false );
- myEditActions.at( EditRedoId )->setEnabled( false );
- myEditActions.at( EditCopyId )->setEnabled( false );
- myEditActions.at( EditPasteId )->setEnabled( false );
- }
-}
-
-/*!
- Returns the aplication name
-*/
-const QString& QAD_Application::getApplicationName() const
-{
- return myName;
-}
-
-/*!
- Returns the application icon
-*/
-const QPixmap& QAD_Application::getApplicationIcon() const
-{
- return myIcon;
-}
-
-/*!
- Returns the study description
-*/
-const QString& QAD_Application::getStudyDescription() const
-{
- return myStudyDescription;
-}
-
-/*!
- Returns the CAF study format
-*/
-const QString& QAD_Application::getStudyFormat() const
-{
- return myStudyFormat;
-}
-
-/*!
- Returns the extension of supported type of files
-*/
-const QString& QAD_Application::getStudyExtension() const
-{
- return myStudyExtension;
-}
-
-/*!
- Returns 'true' if study is opened
-*/
-bool QAD_Application::isStudyOpened( const QString& studyName )
-{
- QString Name = QAD_Tools::getFileNameFromPath( studyName, true );
- return (( getStudyByName( studyName ) != NULL ) || (getStudyByName( Name ) != NULL ));
-}
-
-/*!
- Returns the study object by its name
-*/
-QAD_Study* QAD_Application::getStudyByName( const QString& studyname )
-{
- for ( QAD_Study* study = myStudies.first(); study; study = myStudies.next() )
- {
- if ( (studyname.compare( study->getPath() ) == 0 ) ||
- (studyname.compare( study->getTitle() ) == 0 ))
- return study;
- }
- return NULL;
-}
-
-/*!
- Returns vector of all opened studies
-*/
-QList<QAD_Study>& QAD_Application::getStudies()
-{
- return myStudies;
-}
-
-/*!
- Adds the study to the list of opened studies
- and set listeners for the study signals.
-*/
-void QAD_Application::addStudy( QAD_Study* study )
-{
- if ( !study ) return;
-
- QAD_ASSERT( connect(study,SIGNAL(docClosing(QAD_Study*)),desktop,
- SLOT(onCloseStudy(QAD_Study*))) );
- myStudies.append( study );
-}
-
-/*!
- Removes the study from the list of opened studies
-*/
-void QAD_Application::removeStudy( QAD_Study* study )
-{
- if ( study )
- {
- /* close and destroy */
- if ( study == myActiveStudy )
- myActiveStudy = 0;
- myStudies.removeRef( study );
- }
-}
-
-/*!
- Activates 'About' dialog
-*/
-void QAD_Application::helpAbout()
-{
- /* just calls QAD_Desktop::helpAbout() but can have own implementation */
- getDesktop()->helpAbout();
-}
-
-/*!
- Activates search in help
-*/
-void QAD_Application::helpSearch()
-{
- /* just calls QAD_Desktop::helpSearch() but can have own implementation */
-// getDesktop()->helpSearch();
-}
-
-/*!
- Activates help contents
-*/
-void QAD_Application::helpContents()
-{
- /* just calls QAD_Desktop::helpContents() but can have own implementation */
-// getDesktop()->helpContents();
-}
-
-/*!
- Customizes menu "File" for the active application
-*/
-void QAD_Application::updateFilePopup( QPopupMenu* menu, bool add, int index )
-{
- if ( !menu ) return;
-
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateFileActions( menu, add, index );
-}
-
-/*!
- Customizes menu "Edit" for the active application
-*/
-void QAD_Application::updateEditPopup( QPopupMenu* menu, bool add, int index )
-{
- if ( !menu ) return;
-
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateEditActions( menu, add, index );
-}
-
-/*!
- Customizes menu "View" for the active application
-*/
-void QAD_Application::updateViewPopup( QPopupMenu* menu, bool add, int index )
-{
- if ( !menu ) return;
-
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateViewActions( menu, add, index );
-}
-
-/*!
- Customizes menu "Help" for the active application
-*/
-void QAD_Application::updateHelpPopup( QPopupMenu* menu, bool add, int index )
-{
- if ( !menu ) return;
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateHelpActions ( menu, add, index );
-}
-
-/*!
- Customizes the main menu bar to add some new popup,
- 'Options' or 'Tools' for example.
-*/
-void QAD_Application::updateMainMenu( QMenuBar* menubar, bool add, int index )
-{
- if ( !menubar ) return;
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateMainMenuItems ( menubar, add, index );
-}
-
-/*!
- Adds specific application buttons for standard toolbar
-*/
-void QAD_Application::updateToolBars( bool add )
-{
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateToolBars ( add );
-}
-
-/*!
- Customizes the status bar
-*/
-void QAD_Application::updateStatusBar( QStatusBar* statusBar, bool add )
-{
-#ifdef DEBUG
- /* ensure that 'add' command is followed by 'remove' */
- static bool isAdded = false;
- QAD_ASSERT_DEBUG_ONLY ( (add && !isAdded) || (!add && isAdded) );
- isAdded = add;
-#endif
- onUpdateStatusBar( statusBar, add );
-}
-
-/*!
- Creates toolbar to be managed by QAD_Application
-*/
-QToolBar* QAD_Application::createToolBar( int id,
- const QString& label, Dock dock,
- bool dockTop, bool dockBottom,
- bool dockLeft, bool dockRight,
- bool dockMinimized, bool dockTornOff )
-{
- QToolBar* tb = 0;
- if ( getDesktop() ) {
- tb = new QToolBar( label, getDesktop(), 0 );
- tb->setCloseMode( QDockWindow::Undocked );
- getDesktop()->setDockEnabled( tb, DockTop, dockTop );
- getDesktop()->setDockEnabled( tb, DockBottom, dockBottom );
- getDesktop()->setDockEnabled( tb, DockLeft, dockLeft );
- getDesktop()->setDockEnabled( tb, DockRight, dockRight );
- getDesktop()->setDockEnabled( tb, DockMinimized, dockMinimized );
- getDesktop()->setDockEnabled( tb, DockTornOff, dockTornOff );
- getDesktop()->addDockWindow( tb, label, dock );
- getDesktop()->setAppropriate( tb, false );
- tb->hide();
- removeToolBar( id );
- myToolBars.insert( id, tb);
- }
- return tb;
-}
-
-/*!
- Removes toolbar
-*/
-void QAD_Application::removeToolBar( int id )
-{
- QToolBar* tb = myToolBars[ id ];
- if ( tb ) {
- myToolBars.remove( id );
- getDesktop()->removeDockWindow( tb );
- delete tb;
- }
-}
-
-/*!
- Gets toolbar by id
-*/
-QToolBar* QAD_Application::getToolBar( int id )
-{
- return myToolBars[ id ];
-}
-
-/*!
- Gets all toolbars managed by QAD_Applica
-*/
-QList<QToolBar> QAD_Application::getToolBars()
-{
- QList<QToolBar> toolbars;
- QMap<int, QToolBar*>::Iterator it;
- for ( it = myToolBars.begin(); it != myToolBars.end(); it++ )
- toolbars.append( it.data() );
- return toolbars;
-}
-
-/*!
- Called by 'updateMainMenu' when application is activated/deactivated.
- Redefine to insert/remove the actions provided by the application
- to the main menu at 'index'.
- Returns the number of added/removed items.
-*/
-int QAD_Application::onUpdateMainMenuItems ( QMenuBar* mb, bool add, int index )
-{
- return 0;
-}
-
-/*!
- Called by 'updateFilePopup' when application is activated/deactivated.
- Redefine to insert/remove the actions provided by the application to
- 'File' menu of the desktop at 'index'.
- Returns the number of added/removed items.
-*/
-int QAD_Application::onUpdateFileActions ( QPopupMenu* popup, bool add, int index )
-{
- return 0;
-}
-
-/*!
- Called by 'updateEditPopup' when application is activated/deactivated.
- Redefine to insert/remove the actions provided by the application to
- 'Edit' menu of the desktop at 'index'.
- Returns the number of added/removed items.
-*/
-int QAD_Application::onUpdateEditActions ( QPopupMenu* popup, bool add, int index )
-{
- QAD_ASSERT_DEBUG_ONLY( !myEditActions.isEmpty() );
- QToolBar* tb = getDesktop()->getStdToolBar();
- QActionP* undo = myEditActions.at( EditUndoId );
- QActionP* redo = myEditActions.at( EditRedoId );
- QActionP* copy = myEditActions.at( EditCopyId );
- QActionP* paste = myEditActions.at( EditPasteId );
- if ( add )
- {
- undo->addTo( popup );
- index++;
- redo->addTo( popup );
- index++;
- copy->addTo( popup );
- index++;
- paste->addTo( popup );
- index++;
- undo->addTo( tb );
- redo->addTo( tb );
- copy->addTo( tb );
- paste->addTo( tb );
- }
- else
- {
- popup->removeItemAt(index);
- popup->removeItemAt(index);
- popup->removeItemAt(index);
- popup->removeItemAt(index);
-
- undo->removeFrom( tb );
- redo->removeFrom( tb );
- copy->removeFrom( tb );
- paste->removeFrom( tb );
- }
- return index;
-}
-
-/*!
- Called by 'updateViewPopup' when application is activated/deactivated.
- Redefine to insert/remove the actions provided by the application to the
- 'View' menu of the desktop at 'index'.
- Returns the number of added/removed items.
-*/
-int QAD_Application::onUpdateViewActions ( QPopupMenu* popup, bool add, int index )
-{
- return 0;
-}
-
-/*!
- Called by 'updateHelpPopup' when application is activated/deactivated.
- Redefine to insert/remove the actions provided by the application
- to 'Help' menu of the desktop at 'index'.
- Returns the number of added/removed items.
-*/
-int QAD_Application::onUpdateHelpActions ( QPopupMenu* popup, bool add, int index )
-{
- return 0;
-}
-
-/*!
- Called by 'updateStatusBar' when application is activated/deactivated.
- Redefine to customize status bar.
-*/
-void QAD_Application::onUpdateStatusBar( QStatusBar* sb, bool activate )
-{
-}
-
-/*!
- Called by 'updateToolBars' when application is activated/deactivated.
- Redefine to show your specific toolbars on the desktop.
-*/
-void QAD_Application::onUpdateToolBars( bool activate )
-{
- QMap<int, QToolBar*>::Iterator it;
- for ( it = myToolBars.begin(); it != myToolBars.end(); it++ ) {
- activate ? it.data()->show() : it.data()->hide();
- getDesktop()->setAppropriate( it.data(), activate );
- }
-}
-
-//=======================================================================//
-// Study management //
-//=======================================================================//
-/*!
- Returns the active study
-*/
-QAD_Study* QAD_Application::getActiveStudy() const
-{
- return myActiveStudy;
-}
-
-//=======================================================================//
-// Operation management //
-//=======================================================================//
-/*!
- Runs a new operation of class appointed
-*/
-void QAD_Application::startOperation( QAD_Operation* op )
-{
- if ( op ) op->start();
-}
-
-
-//=======================================================================//
-// Study management //
-//=======================================================================//
-/*!
- Creates new study
-*/
-QAD_Study* QAD_Application::newStudy()
-{
- QAD_Study* newStudy = 0;
- QAD_ASSERT_DEBUG_ONLY( !myStudyMgr->_is_nil() );
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- /* create QAD study*/
- QString StudyName = getDesktop()->getNewStudyName();
-
- CORBA::Object_var obj = getDesktop()->getNameService()->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
- ASSERT(! CORBA::is_nil(myStudyMgr));
- SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
-
- bool exist = true;
-
- while ( exist ) {
- exist = false;
- for (unsigned int ind = 0; ind < List->length();ind++) {
- QString NameS = QAD_Tools::getFileNameFromPath( QString( List[ind] ), true );
- if ( NameS.compare( StudyName ) == 0 ) {
- StudyName = getDesktop()->getNewStudyName();
- exist = true;
- break;
- }
- }
- }
-
- if (getStudyByName ( StudyName ) != NULL )
- {
- /* create StudyDS */
- SALOMEDS::Study_var aStudy = myStudyMgr->NewStudy(getDesktop()->getNewStudyName());
- newStudy = new QAD_Study( this, aStudy, getDesktop()->getNewStudyName());
- }
- else
- {
- /* create StudyDS */
- SALOMEDS::Study_var aStudy = myStudyMgr->NewStudy(StudyName);
- newStudy = new QAD_Study( this, aStudy, StudyName);
- }
-
- newStudy->Init();
-
- if ( newStudy->getResult() ) {
- addStudy( newStudy );
-
- /* activate */
- onStudyActivated( newStudy );
-
- /* customization on create ( called only once )*/
- onStudyCreated( newStudy );
-
- /* show */
- newStudy->show();
-
- /* customization on show ( called only once ) */
- onStudyShown( newStudy );
- }
- }
- catch( Standard_Failure ) {
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- return newStudy;
-}
-
-/*!
- Loads the existed study in StudyManager
-*/
-QAD_Study* QAD_Application::loadStudy( const QString& fileName )
-{
- /* connect CAF document to CAF application */
- QAD_ASSERT_DEBUG_ONLY( !myStudyMgr->_is_nil() );
-
- SALOMEDS::Study_var aStudy = myStudyMgr->GetStudyByName( fileName );
-
- // SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
-// for (unsigned int ind = 0; ind < List->length();ind++) {
-// MESSAGE ( " Study index : " << List[ind] )
-// aStudy = myStudyMgr->GetStudyByName(List[ind]);
-// }
-
- QAD_Study* loadStudy = 0;
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- /* create QAD study */
- loadStudy = new QAD_Study( this, aStudy, aStudy->Name() );
-
- if ( loadStudy->getResult() ) {
- addStudy( loadStudy );
-
- /* activate */
- onStudyActivated( loadStudy );
-
- /* customisation on load ( called only once ) */
- onStudyOpened( loadStudy );
-
- /* show */
- loadStudy->show();
-
- /* customization on show ( called only once ) */
- onStudyShown( loadStudy );
- }
-
- }
- catch( Standard_Failure ) {
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- return loadStudy;
-}
-
-/*!
- Opens the existed study
-*/
-QAD_Study* QAD_Application::openStudy( const QString& fileName )
-{
-#ifdef WNT
- /* Qt uses UNIX-like slashes even on WIN platform */
- QString name = QAD_Tools::unix2win( fileName );
-#else
- QString name = fileName;
-#endif
- SALOMEDS::Study_var aStudy;
-
- /* connect CAF document to CAF application */
- QAD_ASSERT_DEBUG_ONLY( !myStudyMgr->_is_nil() );
-
- QAD_Study* openStudy = 0;
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- /* open StudyDS */
- SALOMEDS::Study_var aStudy = myStudyMgr->Open((char*) name.latin1());
-
- //MPV: name of the study is set in the study manager now
- //NRI DEBUG : 11/02/2002
- //aStudy->Name( QAD_Tools::getFileNameFromPath(name,true) );
-
- /* create QAD study */
- openStudy = new QAD_Study( this, aStudy, fileName );
-
- if ( openStudy->getResult() ) {
- addStudy( openStudy );
-
- /* activate */
- onStudyActivated( openStudy );
-
- /* customisation on open ( called only once ) */
- onStudyOpened( openStudy );
-
- /* show */
- openStudy->show();
-
- /* customization on show ( called only once ) */
- onStudyShown( openStudy );
- }
-
- }
- // Handle SALOME::SALOME_Exception raised by SALOMEDS::StudyMgr
- // Ensure that null study is returned in case of errors
- catch(SALOME::SALOME_Exception&) {
- if (openStudy) {
- delete openStudy;
- openStudy = 0;
- }
- }
- catch( Standard_Failure ) {
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- return openStudy;
-}
-
-/*!
- Saves the study
-*/
-bool QAD_Application::saveStudy( QAD_Study* study )
-{
- bool MultiSave = QAD_CONFIG->getSetting("Desktop:MultiFileSave") == "true";
- bool ASCIISave = QAD_CONFIG->getSetting("Desktop:ASCIISave") == "true";
- bool success = true;
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- /* save StudyDS */
- if (ASCIISave) myStudyMgr->SaveASCII(study->getStudyDocument(), MultiSave);
- else myStudyMgr->Save(study->getStudyDocument(), MultiSave);
- study->updateCaptions();
- }
- catch ( Standard_Failure ) {
- success = false;
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- return success;
-}
-
-/*!
- Saves the study in a new file
-*/
-bool QAD_Application::saveAsStudy( QAD_Study* study, const QString& fileName )
-{
- bool MultiSave = QAD_CONFIG->getSetting("Desktop:MultiFileSave") == "true";
- bool ASCIISave = QAD_CONFIG->getSetting("Desktop:ASCIISave") == "true";
- bool success = false;
-#ifdef WNT
- /* Qt uses UNIX-like slashes even on WIN platform */
- QString name = QAD_Tools::unix2win( fileName );
-#else
- QString name = fileName;
-#endif
- if ( !name.isNull() )
- {
- /* check permission */
- if (!checkPermission(name))
- return false;
- QApplication::setOverrideCursor( Qt::waitCursor );
- TCollection_ExtendedString fileNameExt ( (char*) name.latin1() );
- try {
- /* save as StudyDS */
- if (ASCIISave) myStudyMgr->SaveAsASCII(name.latin1(), study->getStudyDocument(), MultiSave);
- else myStudyMgr->SaveAs(name.latin1(), study->getStudyDocument(), MultiSave);
-
- study->setTitle( fileName );
- study->updateCaptions();
- success = true;
- }
- catch (Standard_Failure) {
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- }
- return success;
-}
-
-/*!
- Closes the study
-*/
-bool QAD_Application::closeStudy( QAD_Study* study, bool permanently /*=false*/ )
-{
- bool success = true;
- /* close CAF document */
- QApplication::setOverrideCursor( Qt::waitCursor );
- try
- {
- SALOMEDS::Study_var aStudyDocument = study->getStudyDocument();
-
- /* customization */
- onStudyClosed( study );
-
- /* remove */
- removeStudy( study );
-
- /* activate */
- myActiveStudy = myStudies.last();
-
- /* close application when the last study is closed */
- if ( myStudies.isEmpty() )
- emit appDeactivated ( this );
-
- if ( permanently )
- {
- /* close StudyDS */
- myStudyMgr->Close( aStudyDocument );
- }
- }
- catch ( Standard_Failure )
- {
- success = false;
- }
- qApp->processEvents(); /* update desktop*/
- QApplication::restoreOverrideCursor();
- return success;
-}
-
-/*!
- Undo operation on the active study.
- Calls undo( activeStudy ).
-*/
-bool QAD_Application::onUndo()
-{
- bool ok = undo( myActiveStudy );
- updateActions(); /* enable/disable undo/redo */
- return ok;
-}
-
-/*!
- Undo operation on the given study
-*/
-bool QAD_Application::undo(QAD_Study* study)
-{
- bool status = false;
- if ( study )
- {
- status = study->undo();
- }
- return status;
-}
-
-/*!
- Redo operation on the active study.
- Calls redo( myActiveStudy ).
-*/
-bool QAD_Application::onRedo()
-{
- bool ok = redo( myActiveStudy );
- updateActions(); /* enable/disable undo/redo */
- return ok;
-}
-
-/*!
- Redo operation on the given study.
-*/
-bool QAD_Application::redo(QAD_Study* study)
-{
- bool status = false;
- if ( study )
- {
- status = study->redo();
- }
- return status;
-}
-
-/*!
- Copies object to the pseudo-clipboard
-*/
-bool QAD_Application::onCopy()
-{
- bool status = false;
- if ( myActiveStudy) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( Sel && Sel->IObjectCount() == 1 ) {
- SALOMEDS::SObject_var SO = myActiveStudy->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() ) {
- SALOMEDS::SComponent_var SComp = SALOMEDS::SComponent::_narrow( SO );
- if ( SComp->_is_nil() ) { // disable 'copy' operations for components
- status = myStudyMgr->Copy( SO );
- updateActions();
- }
- }
- }
- }
- return status;
-}
-
-/*!
- Pastes object from the pseudo-clipboard
-*/
-bool QAD_Application::onPaste()
-{
- SALOMEDS::SObject_var aResult;
- if ( myActiveStudy) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( Sel && Sel->IObjectCount() == 1 ) {
- SALOMEDS::SObject_var SO = myActiveStudy->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() ) {
- try {
- aResult = myStudyMgr->Paste( SO );
- }
- catch ( SALOMEDS::StudyBuilder::LockProtection& ) {
- myActiveStudy->updateObjBrowser( true );
- updateActions();
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- return false;
- }
- myActiveStudy->updateObjBrowser( true );
- updateActions();
- }
- }
- }
- return aResult->_is_nil();
-}
-
-/*!
- Checks if it is possible to make 'copy' operation
-*/
-bool QAD_Application::canCopy()
-{
- bool status = false;
- if ( myActiveStudy) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( Sel && Sel->IObjectCount() == 1 ) {
- SALOMEDS::SObject_var SO = myActiveStudy->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() ) {
- SALOMEDS::SComponent_var SComp = SALOMEDS::SComponent::_narrow( SO );
- if ( SComp->_is_nil() ) // disable copy for components
- status = myStudyMgr->CanCopy( SO );
- }
- }
- }
- return status;
-}
-
-/*!
- Checks if it is possible to make 'paste' operation
-*/
-bool QAD_Application::canPaste()
-{
- bool status = false;
- if ( myActiveStudy) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( Sel && Sel->IObjectCount() == 1 ) {
- SALOMEDS::SObject_var SO = myActiveStudy->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() ) {
- status = myStudyMgr->CanPaste( SO );
- }
- }
- }
- return status;
-}
-
-/*!
- Called when the main desktop is created ( internal )
-*/
-void QAD_Application::onDesktopCreated()
-{
- createActions();
-}
-
-/*!
- Called after creating the given study
-*/
-void QAD_Application::onStudyCreated(QAD_Study* study)
-{
-}
-
-/*!
- Called after opening the given study
-*/
-void QAD_Application::onStudyOpened(QAD_Study* study)
-{
-}
-
-/*!
- Called after the first showing of the given study
-*/
-void QAD_Application::onStudyShown( QAD_Study* study )
-{
-}
-
-/*!
- Called when the given study is activated
-*/
-void QAD_Application::onStudyActivated(QAD_Study* study)
-{
- // MESSAGE ("QAD_Application::onStudyActivated init. ");
-
- /* deactivate old study, activate new study*/
-
- /* NRI : init DEBUG IAP_001 */
- QAD_Study* oldActiveStudy = 0;
- if ( myActiveStudy != NULL )
- oldActiveStudy = myActiveStudy;
- /* NRI : end DEBUG IAP_001 */
-
-
- if ( myActiveStudy )
- onStudyDeactivated( myActiveStudy );
-
- myActiveStudy = study;
-
- // VSR : call app activate before informing modules that active study is changed ===>
- /* application activated */
- emit appActivated( this );
-
- /* notification */
- onActiveStudyChanged( oldActiveStudy, myActiveStudy );
- // VSR : call app activate before informing modules that active study is changed <===
-}
-
-/*!
- Called when the given study is deactivated
-*/
-void QAD_Application::onStudyDeactivated(QAD_Study* study)
-{
- // MESSAGE ("QAD_Application::onStudyDeactivated init. ");
- QAD_ASSERT_DEBUG_ONLY ( myActiveStudy == study );
- if ( study )
- study->onStudyDeactivated();
- // MESSAGE ("QAD_Application::onStudyDeactivated done. ");
-}
-
-/*!
- Called before closing the given study
-*/
-void QAD_Application::onStudyClosed(QAD_Study* study)
-{
-}
-
-/*!
- Called when the active study changed
-*/
-void QAD_Application::onActiveStudyChanged( QAD_Study* oldActiveStudy,
- QAD_Study* newActiveStudy )
-{
- getDesktop()->onActiveStudyChanged();
-
- if ( oldActiveStudy )
- QAD_ASSERT( disconnect( oldActiveStudy, SIGNAL(docOperationTerminated( bool )),
- this, SLOT( onOperationTerminated( bool ) ) ));
- if ( newActiveStudy )
- QAD_ASSERT( connect( newActiveStudy, SIGNAL(docOperationTerminated( bool )),
- this, SLOT( onOperationTerminated( bool ) ) ));
- updateActions();
-}
-
-/*!
- Called when the operation 'op' terminated [ protected slot ]
-*/
-void QAD_Application::onOperationTerminated( bool successfully )
-{
- if ( successfully )
- updateActions(); /* enable/disable undo/redo */
-}
-
-/*!
- Adds the specific items to context popup menu activated usually by MB3.
- Redefine to fill with desired items.
-*/
-void QAD_Application::onCreatePopup ()
-{
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Application.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_Application_H
-#define QAD_Application_H
-
-#include "QAD.h"
-#include "QAD_Popup.h"
-#include "QAD_Study.h"
-#include "QAD_Action.h"
-
-#include "SALOME_NamingService.hxx"
-
-// QT Includes
-#include <qlist.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
-#include <qtranslator.h>
-#include <qtoolbar.h>
-#include <qmap.h>
-
-class QAD_Operation;
-class QAD_Desktop;
-class QAD_EXPORT QAD_Application : public QObject, public QAD_PopupServer
-{
- Q_OBJECT
- enum { EditUndoId, EditRedoId, EditCopyId, EditPasteId };
-
-friend class QAD_Desktop;
-
-public:
- QAD_Application ( const QString& format, const QString& description,
- const QString& filter);
- ~QAD_Application();
-
-public:
- static void run();
- static bool addToDesktop( QAD_Application* app, SALOME_NamingService* name_service );
- static QAD_Desktop* getDesktop();
-
- static QPalette getPalette(bool alternative = false);
-
- const QString& getApplicationName() const;
- const QPixmap& getApplicationIcon() const;
-
- /* studies management */
- const QString& getStudyFormat() const;
- const QString& getStudyExtension() const;
- const QString& getStudyDescription() const;
-
- /* studies */
- bool isStudyOpened( const QString& studyname );
- QAD_Study* getStudyByName( const QString& studyname );
- QAD_Study* getActiveStudy() const;
- QList<QAD_Study>& getStudies();
-
- QAD_Study* newStudy();
- QAD_Study* loadStudy( const QString& fileName);
- QAD_Study* openStudy( const QString& fileName);
- bool saveStudy( QAD_Study* study );
- bool saveAsStudy( QAD_Study* study, const QString& fileName );
- bool closeStudy( QAD_Study* study, bool permanently = false );
-
- /* customization */
- void updateFilePopup( QPopupMenu* menu, bool add, int index = -1 );
- void updateEditPopup( QPopupMenu* menu, bool add, int index = -1 );
- void updateViewPopup( QPopupMenu* menu, bool add, int index = -1 );
- void updateHelpPopup( QPopupMenu* menu, bool add, int index = -1 );
- void updateMainMenu( QMenuBar* menu, bool add, int index = -1 );
- void updateStatusBar( QStatusBar*, bool add );
- void updateToolBars( bool add );
-
- /* toolbars */
- QToolBar* createToolBar( int id,
- const QString& label, Dock dock = DockTop,
- bool dockTop = true, bool dockBottom = true,
- bool dockLeft = true, bool dockRight = true,
- bool dockMinimized = true, bool dockTornOff = true );
- void removeToolBar( int id );
- QToolBar* getToolBar( int id );
- QList<QToolBar> getToolBars();
-
- virtual void onStudyActivated( QAD_Study* );
- virtual void onStudyDeactivated( QAD_Study* );
- virtual void startOperation( QAD_Operation* op );
-
- virtual void helpAbout();
- virtual void helpSearch();
- virtual void helpContents();
-
-public slots:
- void updateActions();
-
-signals:
- void appActivated ( QAD_Application* );
- void appDeactivated ( QAD_Application* );
- void desktopCreated();
-
-protected slots:
- virtual bool onUndo();
- virtual bool onRedo();
- virtual bool onCopy();
- virtual bool onPaste();
- virtual void onOperationTerminated( bool );
-
-private slots:
- void onDesktopCreated();
-
-protected:
- /* menu */
- virtual int onUpdateMainMenuItems ( QMenuBar*, bool add, int index );
- virtual int onUpdateFileActions ( QPopupMenu*, bool add, int index );
- virtual int onUpdateEditActions ( QPopupMenu*, bool add, int index );
- virtual int onUpdateViewActions ( QPopupMenu*, bool add, int index );
- virtual int onUpdateHelpActions ( QPopupMenu*, bool add, int index );
- virtual void onUpdateStatusBar( QStatusBar*, bool activate );
- virtual void onUpdateToolBars( bool activate );
-
- /* study */
- virtual void onStudyCreated( QAD_Study* );
- virtual void onStudyOpened( QAD_Study* );
- virtual void onStudyClosed( QAD_Study* );
- virtual void onStudyShown( QAD_Study* );
- virtual void onActiveStudyChanged( QAD_Study* oldActiveStudy,
- QAD_Study* newActiveStudy );
- /* specific initialization ( CAF etc. ) */
- virtual bool initApp(SALOME_NamingService* name_service) = 0;
- virtual bool createDesktop(SALOME_NamingService* name_service);
-
- /* undo/redo */
- virtual bool undo( QAD_Study* study );
- virtual bool redo( QAD_Study* study );
- /* copy/paste */
- bool canCopy();
- bool canPaste();
-
- /* popup */
- void onCreatePopup();
-
-protected:
-
- SALOMEDS::StudyManager_var myStudyMgr;
-
- QAD_Study* myActiveStudy;
- QList<QAD_Study> myStudies;
- QPixmap myIcon;
- QString myName;
-
- QString myStudyFormat;
- QString myStudyExtension;
- QString myStudyDescription;
-
-#if defined SOLARIS
-/* SUN C++ v4.1 compiler BUG ?
- Error when using protected 'desktop' in subclasses.
- */
-public:
-#endif
- static QAD_Desktop* desktop; /* the only QAD desktop */
-
-private:
- void createActions();
-
- void addStudy( QAD_Study* study );
- void removeStudy( QAD_Study* study );
-
-private :
- ActionMap myEditActions;
- ActionMap myViewActions;
- ActionMap myHelpActions;
- QMap<int, QToolBar*> myToolBars;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Config.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Config QAD_Config.h
- \brief Settings file management for QAD-based application.
-*/
-
-#include "QAD_Config.h"
-#include "QAD_ParserSettings.h"
-
-// QT Includes
-#include <qapplication.h>
-#include <qfile.h>
-#include <qregexp.h>
-#include <qtextstream.h>
-using namespace std;
-
-
-/*!
- QAD_Config provides access to global settings.
-*/
-QAD_Config* QAD_Config::theOneAndOnlyConfig=0;
-
-
-/*!
- Creates a new one on first call.
-*/
-QAD_Config* QAD_Config::getConfig()
-{
- if(theOneAndOnlyConfig==0) {
- theOneAndOnlyConfig = new QAD_Config;
- theOneAndOnlyConfig->ini();
- }
- return theOneAndOnlyConfig;
-}
-
-
-
-/*!
- Constructor.
-*/
-QAD_Config::QAD_Config()
- : QAD_Settings('=', '"', '"')
-{
-}
-
-/*!
- Destructor.
-*/
-QAD_Config::~QAD_Config()
-{
-}
-
-/*!
- Initializes the config object (only called once).
-*/
-void QAD_Config::ini()
-{
-}
-
-
-/*!
- Set default directory for config files.
-*/
-void QAD_Config::setDefaultConfigDir()
-{
-#ifdef DEF_WINDOWS
- setConfigDir(QDir(prgDir.absPath()));
-#else
- QString vers = tr("INF_VERSION");
- int first_dot = vers.find('.');
- int blanc_before = vers.findRev(' ', first_dot) + 1;
- int blanc_after = vers.find(' ', first_dot);
- if (blanc_after == -1) blanc_after = vers.length();
- int vers_len = blanc_after - blanc_before;
- vers.truncate(blanc_after);
- QString vers_nb = vers.right(vers_len);
- setConfigDir(QDir(QDir::home().absPath() + "/." + tr("MEN_APPNAME") + "_" + vers_nb));
-#endif
-}
-
-/*!
- Creates not existing config files.
-*/
-bool QAD_Config::createConfigFile( bool overwrite )
-{
- bool ret = true;
-
- setDefaultConfigDir();
-
- // Create config directory:
- if(!configDir.exists()) {
- if(!configDir.mkdir(configDir.absPath(), true)) {
- // Can't create directory for config file!
- return false;
- }
- }
-
- // Create ".<app>.conf":
- QFile configFile(configDir.absPath() + "/" + tr("MEN_APPNAME") + ".conf");
-
- if(!configFile.exists() || overwrite) {
- if(configFile.open(IO_WriteOnly)) { // file opened successfully
- QTextStream ts(&configFile);
- QAD_Setting* setting;
-
- ts <<
- "# This file is automatically generated by " << tr("MEN_APPNAME") << ".\n"
- "# Please edit only if " << tr("MEN_APPNAME") << " is not running.\n";
-
- int sep;
- QString section;
- QString variable;
- QStringList sectionList; // List of all sections
-
- // Collect section list:
- for(setting=settingList.first(); setting!=0; setting=settingList.next()) {
- sep = setting->getName().find( ':' );
- section = setting->getName().left( sep );
-
- if( sectionList.find( section ) == sectionList.end() ) {
- sectionList += section;
- }
- }
-
- sectionList.sort();
-
- // Write the sections:
- for( QStringList::Iterator it = sectionList.begin(); it!=sectionList.end(); ++it ) {
- ts << "\n[" << (*it) << "]\n";
- for( setting=settingList.first(); setting!=0; setting=settingList.next() ) {
- sep = setting->getName().find( ':' );
- section = setting->getName().left( sep );
-
- if( section==(*it) ) {
- variable = setting->getName().right( setting->getName().length()-sep-1 );
- ts << variable << "=\"" << setting->getValue() << "\"\n";
- }
- }
- }
-
- configFile.close();
- }
-
- else {
- // Can't create file
- ret=false;
- }
- }
-
- return ret;
-}
-
-/*!
- Reads the config file.
-*/
-bool QAD_Config::readConfigFile()
-{
- setDefaultConfigDir();
-
- QString configPath;
- configPath = configDir.absPath() + "/" + tr("MEN_APPNAME") + ".conf";
-
- int i=0, j, l=0; // Index, length of matching string
- QRegExp regSection("\\[[^]]*\\]"); // Reg exp for a section including brackets
- QRegExp regName("[^=[]*"); // Reg exp for a setting name (lvalue)
- QRegExp regValue("\"[^\"]*\""); // Reg exp for a setting value (rvalue) including quote marks
- QString lSectionName; // Section name excluding brackets
- QString setName; // Setting name
- QString setValue; // Setting value
-
- // Get file contents without comments:
- QString cont = QAD_ParserSettings::getContents(configPath, false);
-
- do {
- // Read next section (name/contents):
- i=regSection.match(cont, i, &l);
- if(i==-1) break;
- lSectionName = cont.mid(i+1, l-2);
- i+=l;
-
- // Read next setting:
- do {
- j=regName.match(cont, i, &l);
- if(j==-1) break;
- setName = cont.mid(j, l);
- if(setName.stripWhiteSpace().isEmpty()) break;
- i=j+l;
-
- j=regValue.match(cont, i, &l);
- if(j==-1) break;
- setValue = cont.mid(j+1, l-2);
- i=j+l;
-
- addSetting(lSectionName + ":" + setName.stripWhiteSpace(), setValue);
-
- } while(true);
-
- } while(true);
-
- // Add some values which were not saved in config file:
-
- return false;
-}
-
-
-// EOF
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Config.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_CONFIG_H
-#define QAD_CONFIG_H
-
-// Used for access to the configuration file e.g.: QAD_CONFIG->getSetting("Language:Language")
-#define QAD_CONFIG QAD_Config::getConfig()
-
-#include <qdir.h>
-#include <qfont.h>
-
-#include "QAD_Settings.h"
-
-class QAD_Config : public QAD_Settings
-{
-
-protected:
- QAD_Config();
-
- void ini();
-
-public:
- ~QAD_Config();
-
- static QAD_Config* getConfig();
-
- /** Sets directory of the local configuration file. */
- void setConfigDir(QDir _configDir) { configDir=_configDir; }
- /** Gets directory of the local configuration file. */
- QDir getConfigDir() const { return configDir; }
-
- /** Sets directory of KERNEL_ROOT. */
- void setPrgDir(QDir _prgDir) { prgDir=_prgDir; }
- /** Gets directory of KERNEL_ROOT. */
- QDir getPrgDir() const { return prgDir; }
-
- void setDefaultConfigDir();
- bool createConfigFile( bool overwrite=false );
- bool readConfigFile();
-
-private:
- static QAD_Config* theOneAndOnlyConfig;
-
- QDir prgDir;
- QDir configDir;
-};
-
-
-#endif
-
-// EOF
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Desktop.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Desktop QAD_Desktop.h
- \brief Main desktop of QAD-based application.
-*/
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-
-#define INCLUDE_MENUITEM_DEF
-#define DEFAULT_BROWSER "mozilla"
-
-
-#include "QAD.h"
-#include "QAD_Help.h"
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_PyEditor.h"
-#include "QAD_Operation.h"
-#include "QAD_XmlHandler.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_Resource.h"
-#include "QAD_FileDlg.h"
-//NRI #include "QAD_HelpWindow.h"
-#include "QAD_DirListDlg.h"
-#include "QAD_WaitCursor.h"
-#include "SALOMEGUI.h"
-#include "SALOMEGUI_OpenWith.h"
-#include "SALOMEGUI_StudyPropertiesDlg.h"
-#include "SALOMEGUI_TrihedronSizeDlg.h"
-#include "SALOMEGUI_ExternalBrowserDlg.h"
-#include "SALOMEGUI_LoadStudiesDlg.h"
-//#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOMEGUI_AboutDlg.h"
-#include "SALOMEGUI_ViewChoiceDlg.h"
-#include "SALOMEGUI_SetValueDlg.h"
-#include "utilities.h"
-
-#include "SALOMEGUI_CloseDlg.h"
-#include "SALOMEGUI_ActivateComponentDlg.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
-#include "SALOME_Event.hxx"
-
-// QT Includes
-#include <qaccel.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qmessagebox.h>
-#include <qcolordialog.h>
-#include <qradiobutton.h>
-#include <qapplication.h>
-#include <qvbuttongroup.h>
-#include <qpixmap.h>
-#include <qmessagebox.h>
-#include <qwidget.h>
-#include <stdio.h>
-#include <qpopupmenu.h>
-#include <qlistview.h>
-#include <qspinbox.h>
-#include <qhbox.h>
-#include <qiconset.h>
-#include <qfontdialog.h>
-#include <qlineedit.h>
-#include <qdatetime.h>
-#include <qthread.h>
-#include <qtooltip.h>
-#include <qstringlist.h>
-
-#if QT_VERSION > 300
- #include <qlistbox.h>
- #include <qregexp.h>
-#endif
-
-// Open CASCADE Includes
-#include <OSD_SharedLibrary.hxx>
-#include <OSD_LoadMode.hxx>
-#include <OSD_Function.hxx>
-#include <TCollection_AsciiString.hxx>
-using namespace std;
-
-static const char* SEPARATOR = ":";
-
-extern "C"
-{
-# include <string.h>
-}
-
-enum { voPanLeft,
- voPanRight,
- voPanUp,
- voPanDown,
- voZoomIn,
- voZoomOut,
- voZoomFit,
- voRotateLeft,
- voRotateRight,
- voRotateUp,
- voRotateDown };
-
-QAD_ResourceMgr* QAD_Desktop::resourceMgr = 0;
-QPalette* QAD_Desktop::palette = 0;
-
-static QString createString( int theItemId, int thePosId )
-{
- QString aRetString = QString("item-id=");
- QString aString;
- QString aItemId = aString.setNum(theItemId);
- QString aPosId = aString.setNum(thePosId);
- aRetString = aRetString + '"'; aRetString = aRetString + aItemId; aRetString = aRetString + '"';
- aRetString = aRetString + " pos-id="; aRetString = aRetString + '"';
- aRetString = aRetString + aPosId;
- aRetString = aRetString + '"'; aRetString = aRetString + ">";
- return aRetString;
-}
-
-/*!
- Creates the resource manager [ static ]
-*/
-QAD_ResourceMgr* QAD_Desktop::createResourceManager()
-{
- if ( !resourceMgr )
- resourceMgr = new QAD_ResourceMgr;
- return resourceMgr;
-}
-
-/*!
- Returns the resource manager [ static ]
-*/
-QAD_ResourceMgr* QAD_Desktop::getResourceManager()
-{
- return resourceMgr;
-}
-
-
-/*!
- Loads the palette from settings [ static ]
-*/
-QPalette* QAD_Desktop::createPalette()
-{
- if ( !palette )
- palette = new QPalette();
-
- return palette;
-}
-
-/*!
- Returns the palette [ static ]
-*/
-QPalette* QAD_Desktop::getPalette()
-{
- return palette;
-}
-
-///*!
-// Gets window ratio width/heght [ static ]
-//*/
-//static double = 1;
-//static double getWindowRatio()
-//{
-// return myWindowRatio;
-//}
-//
-///*!
-// Sets window ratio width/heght [ static ]
-//*/
-//static void setWindowRatio(double aRatio)
-//{
-// myWindowRatio = aRatio;
-//}
-
-/*!
- Constructor
-*/
-QAD_Desktop::QAD_Desktop(SALOME_NamingService* name_service) :
-QMainWindow(0, 0, WType_TopLevel | WDestructiveClose),
-myStdToolBar(0),
-myStatusBar(0),
-myActiveApp(0),
-myActiveStudy(0),
-myCntUntitled(0),
-//NRImyHelpWindow(0),
-myDefaultTitle( tr("DESK_DEFAULTTITLE") ),
-myQueryClose( true ),
-myAboutToClose( false )
-{
- /* Force reading of user config file */
- QAD_CONFIG->readConfigFile();
-
- /* menubar and status bar */
- myStatusBar = statusBar();
- myMainMenu = menuBar();
- myActiveComp = "";
- myNameService = name_service;
-
- /* default background icon */
- QPixmap backgroundicon ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
- tr("ICON_DESK_BACKGROUNDICON") ));
-//myToolBarAction.setAutoDelete( true );
-
- /* default icon and title */
- QPixmap icon ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
- tr("ICON_DESK_DEFAULTICON") ));
- if ( !icon.isNull() ) {
- myDefaultIcon = icon;
- setIcon( myDefaultIcon );
- }
- setCaption( myDefaultTitle );
-
- /* set size as 1/2 of the screen and center it */
- QWidget* d = QApplication::desktop();
- resize( 2*d->width()/3, 2*d->height()/3 );
- QAD_Tools::centerWidget( this, d );
-
- /* workspace will manage child frames */
- QHBox* border = new QHBox ( this );
- border->setFrameStyle ( QFrame::Panel | QFrame::Sunken );
- setCentralWidget( border );
- myWorkspace = new QWorkspaceP( border );
-
- QPalette pal = QAD_Application::getPalette();
- setPalette(pal);
- QColorGroup cgA = pal.active();
- QColorGroup cgI = pal.inactive();
- QColorGroup cgD = pal.disabled();
- cgA.setColor( QColorGroup::Background, QColor(192, 192, 192));
- cgI.setColor( QColorGroup::Background, QColor(192, 192, 192));
- cgD.setColor( QColorGroup::Background, QColor(192, 192, 192));
- pal.setActive ( cgA );
- pal.setInactive( cgI );
- pal.setDisabled( cgD );
- myWorkspace->setPalette( pal );
- if ( !backgroundicon.isNull() ) {
- MESSAGE("!!!DESKTOP background icon found!!!");
- myWorkspace->setPaletteBackgroundPixmap(backgroundicon);
- }
-
- /* define standard file commands */
- createActions();
-
- /* define operator menus for xml */
- myOperatorMenus = new QAD_OperatorMenus(this);
- myXmlHandler = new QAD_XmlHandler();
-
- /* New catalogue */
- CORBA::Object_var objVarN = myNameService->Resolve("/Kernel/ModulCatalog");
- myCatalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
-
- SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants =
- myCatalogue->GetComponentIconeList();
-
-
- QToolBar* tbComponent = new QToolBar( tr("MEN_DESK_COMPONENTTOOLBAR"), this );
- tbComponent->setCloseMode( QDockWindow::Undocked );
- addToolBar(tbComponent, tr("MEN_DESK_COMPONENTTOOLBAR"), Bottom, TRUE );
- setDockEnabled( tbComponent, DockLeft, false );
- setDockEnabled( tbComponent, DockRight, false );
-
- myCombo = new QComboBox( FALSE, tbComponent, "comboBox" );
- myCombo->setFocusPolicy( NoFocus );
-
- tbComponent->addSeparator();
-
- // PG : add ResourceManager to get function findFile !!
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
-
- for (unsigned int ind = 0; ind < list_composants->length();ind++) {
- QString resDir;
-
- /* find component icon */
- QString iconfile = CORBA::string_dup(list_composants[ind].moduleicone) ;
- QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
- QString moduleusername = CORBA::string_dup(list_composants[ind].moduleusername) ;
- QString moduleversion = CORBA::string_dup(list_composants[ind].moduleversion) ;
- QString modulecomment = CORBA::string_dup(list_composants[ind].modulecomment) ;
-
- // MESSAGE ( " MODULE = " << modulename )
- // MESSAGE ( " MODULE icon = " << iconfile )
- // MESSAGE ( " MODULE username = " << moduleusername )
-
- if ( mapComponentName.contains( moduleusername ) ) {
- QMessageBox::warning( this, tr("WRN_WARNING"), QString( moduleusername + " is already associated with " + mapComponentName[moduleusername] + ".\nPlease, change the component username of " + modulename) , tr ("BUT_OK") );
- continue;
- }
- mapComponentName.insert( moduleusername, modulename );
-
- resDir = resMgr->findFile(iconfile,modulename) ;
- if (resDir)
- {
- MESSAGE ( "resDir" << resDir )
- //resDir = QAD_Tools::addSlash(resDir) ;
- //QPixmap Icone(resDir+iconfile) ;
- QPixmap Icone( QAD_Tools::addSlash( resDir ) + iconfile );
- QToolButton * toolb =
- new QToolButton( QIconSet( Icone ), moduleusername, QString::null, this,
- SLOT( onButtonActiveComponent () ),tbComponent );
- QString ttip = QString("<b>") + moduleusername + QString("</b>");
- if ( !moduleversion.isEmpty() ) ttip += QString("<br>Version: ") + moduleversion;
- toolb->setToggleButton( true );
- QToolTip::add(toolb, ttip, this->toolTipGroup(), modulecomment);
- myComponentButton.append(toolb);
- }
- else
- {
- QString errMsg = tr("INF_ICON_RESOURCES").arg(iconfile).arg(modulename) +
- tr("INF_RESOURCES");
- //QMessageBox::warning( this, tr("WRN_WARNING"), errMsg, tr ("BUT_OK") );
- }
- if ( ( resDir || moduleusername == "Salome" ) && !modulename.isEmpty() ) // VSR: Force "Salome" component to appear in the combo box
- myCombo->insertItem( moduleusername );
- }
-
- myCombo->adjustSize();
- connect( myCombo, SIGNAL(activated(const QString&)),
- this, SLOT( onComboActiveComponent(const QString&) ) );
-
- /* new LifeCycleCORBA client, for Engines */
- myEnginesLifeCycle = new SALOME_LifeCycleCORBA(name_service);
-
- /* VSR 13/01/03 : installing global event filter for the application */
- qApp->installEventFilter( this );
-
- /* init pseudo random numbers generator */
- QTime cTime = QTime::currentTime();
- int secs = cTime.second() + 1;
- for ( int s = 0; s < secs; s++ ) random();
-}
-
-/*!
- Destructor
-*/
-QAD_Desktop::~QAD_Desktop ()
-{
- qApp->removeEventFilter( this );
- myFilePopup.clear();
- myEditPopup.clear();
- myViewPopup.clear();
- myObjBrowserPopup.clear();
- //VRV: T2.5 - add default viewer
- myDefaultViewer.clear();
- //VRV: T2.5 - add default viewer
- myViewerPopup.clear();
- //NRI : SAL2214
- myNewViewPopup.clear();
- //NRI : SAL2214
- myHelpContentsModulePopup.clear();
- myToolsPopup.clear();
- myPrefPopup.clear();
- myStdActions.clear();
- myHelpPopup.clear();
- myToolBarsPopup.clear();
- myToolBarAction.clear();
- myApps.clear();
- delete resourceMgr;
-//NRI if (myHelpWindow)
-// myHelpWindow->close();
- resourceMgr = 0;
- QAD_Application::desktop = 0;
-}
-
-const int IdCut = 1001;
-const int IdCopy = 1002;
-const int IdPaste = 1003;
-const int IdSelectAll = 1004;
-#ifndef QT_NO_ACCEL
-#include <qkeysequence.h>
-#define ACCEL_KEY(k) "\t" + QString(QKeySequence( Qt::CTRL | Qt::Key_ ## k ))
-#else
-#define ACCEL_KEY(k) "\t" + QString("Ctrl+" #k)
-#endif
-#include <qclipboard.h>
-/*!
- Global event filter for qapplication (VSR 13/01/03)
-*/
-bool QAD_Desktop::eventFilter( QObject* o, QEvent* e )
-{
- if (e->type() == QEvent::Close && o == this )
- myAboutToClose = true;
- else if (e->type() == 2000 ) {
- QMessageBox::information (this, tr ( "Help Information" ), tr ( "Can't run choosen browser.\nRunning default browser (Mozilla). "));
- return TRUE;
- }
- else if (e->type() == 2001 ) {
- QMessageBox::critical(this, tr ( "Help Error" ), tr ( "Can't run the default browser.") );
- return TRUE;
- }
- else if ( e->type() == QEvent::ContextMenu ) {
- QContextMenuEvent* ce = (QContextMenuEvent*)e;
- if ( o->inherits("QRenameEdit") ) {
- return TRUE;
- }
- else if ( o->inherits("QLineEdit") ) {
- QLineEdit* le = (QLineEdit*)o;
- if ( le->parentWidget() ) {
- if ( ( le->parentWidget()->inherits("QSpinBox") ||
- le->parentWidget()->inherits("QSpinWidget") ||
- le->parentWidget()->inherits("QAD_SpinBoxDbl") ) &&
- le->isEnabled() ) {
- QPopupMenu* popup = new QPopupMenu( 0, "qt_edit_menu" );
- popup->insertItem( tr( "EDIT_CUT_CMD" ) + ACCEL_KEY( X ), IdCut );
- popup->insertItem( tr( "EDIT_COPY_CMD" ) + ACCEL_KEY( C ), IdCopy );
- popup->insertItem( tr( "EDIT_PASTE_CMD" ) + ACCEL_KEY( V ), IdPaste );
- popup->insertSeparator();
-#if defined(Q_WS_X11)
- popup->insertItem( tr( "EDIT_SELECTALL_CMD" ), IdSelectAll );
-#else
- popup->insertItem( tr( "EDIT_SELECTALL_CMD" ) + ACCEL_KEY( A ), IdSelectAll );
-#endif
- bool enableCut = !le->isReadOnly() && le->hasSelectedText();
- popup->setItemEnabled( IdCut, enableCut );
- popup->setItemEnabled( IdCopy, le->hasSelectedText() );
- bool enablePaste = !le->isReadOnly() && !QApplication::clipboard()->text().isEmpty();
- popup->setItemEnabled( IdPaste, enablePaste );
- bool allSelected = (le->selectedText() == le->text() );
- popup->setItemEnabled( IdSelectAll, (bool)(le->text().length()) && !allSelected );
-
- QPoint pos = ce->reason() == QContextMenuEvent::Mouse ? ce->globalPos() :
- le->mapToGlobal( QPoint(ce->pos().x(), 0) ) + QPoint( le->width() / 2, le->height() / 2 );
- if ( popup ) {
- int r = popup->exec( pos );
- switch ( r ) {
- case IdCut:
- le->cut();
- break;
- case IdCopy:
- le->copy();
- break;
- case IdPaste:
- le->paste();
- break;
- case IdSelectAll:
- le->selectAll();
- break;
- }
- delete popup;
- }
- return TRUE;
- }
- }
- }
- }
- else if ( e->type() == SALOME_EVENT ) {
- SALOME_Event* aSE = (SALOME_Event*)((QCustomEvent*)e)->data();
- processEvent(aSE);
- ((QCustomEvent*)e)->setData( 0 );
- return TRUE;
- }
- return QMainWindow::eventFilter( o, e );
-}
-
-/*!
- Dispatches <theEvent> to the target component GUI
-*/
-void QAD_Desktop::processEvent( SALOME_Event* theEvent )
-{
- if(theEvent){
- theEvent->Execute();
- // Signal the calling thread that the event has been processed
- theEvent->processed();
- }
-}
-
-/*!
- Creates and initializes the standard file operations
- such as 'New/Open/Save/SaveAs/Close' and 'Help'.
-*/
-void QAD_Desktop::createActions()
-{
-
- /* Used for string compare */
- const QString& aTrueQString = "true" ;
-
- /* create 'standard' toolbar */
- if ( !myStdToolBar ) {
- myStdToolBar = new QToolBar ( tr("MEN_DESK_VIEW_STDTOOLBAR"), this );
- myStdToolBar->setCloseMode( QDockWindow::Undocked );
- }
-
- if ( !myMainMenu->count() ) {
- /* Create main menu bar */
- myMainMenu->insertItem ( tr("MEN_DESK_FILE"), &myFilePopup, 1 ); /* add popup FILE */
- myMainMenu->insertItem ( tr("MEN_DESK_VIEW"), &myViewPopup, 2 ); /* add popup VIEW */
- myMainMenu->insertItem ( tr("MEN_DESK_TOOLS"), &myToolsPopup, 5 ); /* add popup TOOLS */
- myMainMenu->insertItem ( tr("MEN_DESK_PREF"), &myPrefPopup, 4 ); /* add popup PREF */
- myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 ); /* add popup WINDOW */
- myMainMenu->insertItem ( tr("MEN_DESK_HELP"), &myHelpPopup, 7 ); /* add popup HELP */
-
- /* Applications will insert their items after 'File' 'Edit' and 'View'
- ( 'Edit' will be inserted later )
- */
- myMainMenuPos = 3;
- }
-
- /* insert logo picture to menu bar */
- QHBox* aLogoFrm = new QHBox(this);
- aLogoFrm->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
- QPixmap aLogoPixmap ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
- tr("ICON_DESK_LOGO") ));
- QLabel* aLogoLab = new QLabel(aLogoFrm);
- aLogoLab->setPixmap(aLogoPixmap);
- aLogoLab->setAlignment(AlignCenter);
- aLogoLab->setScaledContents(false);
- myMainMenu->insertItem(aLogoFrm);
-
- if ( myStdActions.isEmpty() ) {
- /* Define standard actions. They should be inserted
- into the list in order of their IDs.
- */
-
- /* 'File' actions */
- /* new */
- QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
- QActionP* fileNewAction = new QActionP ( tr("TOT_DESK_FILE_NEW"),
- rmgr->loadPixmap( "QAD", tr("ICON_FILE_NEW") ) ,
- tr("MEN_DESK_FILE_NEW"), CTRL+Key_N, this );
- fileNewAction->setStatusTip ( tr("PRP_DESK_FILE_NEW") );
- fileNewAction->setEnabled ( true );
- QAD_ASSERT ( connect( fileNewAction, SIGNAL( activated() ), this, SLOT( onNewStudy() )));
- fileNewAction->addTo( myStdToolBar );
- fileNewAction->addTo( &myFilePopup );
- myStdActions.insert ( FileNewId, fileNewAction );
-
- /* open */
- QActionP* fileOpenAction = new QActionP( tr("TOT_DESK_FILE_OPEN"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_OPEN") ),
- tr("MEN_DESK_FILE_OPEN"), CTRL+Key_O, this );
- fileOpenAction->setStatusTip ( tr("PRP_DESK_FILE_OPEN") );
- fileOpenAction->setEnabled ( true );
- QAD_ASSERT ( connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( onOpenStudy() )));
- fileOpenAction->addTo( myStdToolBar );
- fileOpenAction->addTo( &myFilePopup );
- myStdActions.insert ( FileOpenId, fileOpenAction );
-
- /* load */
- QActionP* fileLoadAction = new QActionP( tr("TOT_DESK_FILE_LOAD"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_LOAD") ),
- tr("MEN_DESK_FILE_LOAD"), CTRL+Key_L, this );
- fileLoadAction->setStatusTip ( tr("PRP_DESK_FILE_LOAD") );
- fileLoadAction->setEnabled ( true );
- QAD_ASSERT ( connect( fileLoadAction, SIGNAL( activated() ), this, SLOT( onLoadStudy() )));
- fileLoadAction->addTo( &myFilePopup );
- myStdActions.insert ( FileLoadId, fileLoadAction );
-
- /* close */
- QActionP* fileCloseAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_FILE_CLOSE") ),
- tr("MEN_DESK_FILE_CLOSE"), CTRL+Key_W, this );
- fileCloseAction->setStatusTip ( tr("PRP_DESK_FILE_CLOSE") );
- QAD_ASSERT ( connect( fileCloseAction, SIGNAL( activated() ), this, SLOT( onCloseStudy() )));
- fileCloseAction->addTo( &myFilePopup );
- myStdActions.insert ( FileCloseId, fileCloseAction );
-
- /* separator */
- myFilePopup.insertSeparator();
-
- /* save */
- QActionP* fileSaveAction = new QActionP( tr("TOT_DESK_FILE_SAVE"), rmgr->loadPixmap( "QAD", tr("ICON_FILE_SAVE") ),
- tr("MEN_DESK_FILE_SAVE"), CTRL+Key_S, this );
- fileSaveAction->setStatusTip ( tr("PRP_DESK_FILE_SAVE") );
- QAD_ASSERT ( connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( onSaveStudy() )));
- fileSaveAction->addTo( myStdToolBar );
- fileSaveAction->addTo( &myFilePopup );
- myStdActions.insert ( FileSaveId, fileSaveAction );
-
- /* save as */
- QActionP* fileSaveAsAction = new QActionP( "", tr("MEN_DESK_FILE_SAVEAS"), 0, this );
- fileSaveAsAction->setStatusTip ( tr("PRP_DESK_FILE_SAVEAS") );
- QAD_ASSERT ( connect( fileSaveAsAction, SIGNAL( activated() ),
- this, SLOT( onSaveAsStudy() )));
- fileSaveAsAction->addTo( &myFilePopup );
- myStdActions.insert ( FileSaveAsId, fileSaveAsAction );
-
-
- /* separator */
- myFilePopup.insertSeparator();
-
- // Study properties
- QActionP* filePropsAction = new QActionP( "", QPixmap(), tr("MEN_DESK_FILE_PROPERTIES"), 0, this );
- filePropsAction->setStatusTip ( tr("PRP_DESK_FILE_PROPERTIES") );
- filePropsAction->setEnabled(false);
- QAD_ASSERT ( connect( filePropsAction, SIGNAL( activated() ), this, SLOT( onStudyProperties() )));
- filePropsAction->addTo( &myFilePopup );
- myStdActions.insert ( FilePropsId, filePropsAction );
-
-
- int id = myFilePopup.insertSeparator();
- /* keep the position from which an application will insert its items
- to menu 'File' at the time of customization of the desktop */
-
- myFilePos = myFilePopup.indexOf( id ) + 1;
-
- /* exit application */
- QActionP* exitAction = new QActionP( "", tr("MEN_DESK_FILE_EXIT"),
- CTRL+Key_X, this );
- exitAction->setStatusTip ( tr("PRP_DESK_FILE_EXIT") );
- QAD_ASSERT ( connect( exitAction, SIGNAL( activated() ),
- this, SLOT( onExit() )));
- exitAction->addTo( &myFilePopup );
- myStdActions.insert ( FileExitId, exitAction );
-
- QAD_ASSERT( connect( &myFilePopup, SIGNAL(highlighted( int )),
- this, SLOT(onFilePopupStatusText( int )) ));
-
-
- /* 'Edit' actions : provided by application only */
- myEditPos = 0;
-
- QAD_ASSERT( connect( &myEditPopup, SIGNAL(highlighted( int )),
- this, SLOT(onEditPopupStatusText( int )) ));
-
- /* 'View' actions */
- /* toolbars popup menu */
- myViewPopup.insertItem( tr("MEN_DESK_VIEW_TOOLBARS"), &myToolBarsPopup );
- QAD_ASSERT( connect ( &myViewPopup, SIGNAL(aboutToShow()),
- this, SLOT(onToolBarPopupAboutToShow()) ));
-
- /* status bar */
- QActionP* viewStatusBarAction = new QActionP( "",
- tr("MEN_DESK_VIEW_STATUSBAR"),
- 0, this, 0, true );
- viewStatusBarAction->setStatusTip ( tr("PRP_DESK_VIEW_STATUSBAR") );
- viewStatusBarAction->setOn( true );
- QAD_ASSERT(connect( viewStatusBarAction, SIGNAL(activated()), this, SLOT(onViewStatusBar() )));
- viewStatusBarAction->addTo( &myViewPopup );
- myStdActions.insert( ViewStatusBarId, viewStatusBarAction );
-
-// myViewPopup.insertItem( tr("MEN_DESK_SELECTION_MODE"), &mySelectionModePopup );
-
- QActionP* SelectionPointAction = new QActionP( "", tr("MEN_DESK_SELECTION_POINT"), 0, this, 0, true );
- QAD_ASSERT(connect( SelectionPointAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
- SelectionPointAction->addTo( &mySelectionModePopup );
- myStdActions.insert( SelectionPointId, SelectionPointAction );
-
- QActionP* SelectionEdgeAction = new QActionP( "", tr("MEN_DESK_SELECTION_EDGE"), 0, this, 0, true );
- QAD_ASSERT(connect( SelectionEdgeAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
- SelectionEdgeAction->addTo( &mySelectionModePopup );
- myStdActions.insert( SelectionEdgeId, SelectionEdgeAction );
-
- QActionP* SelectionCellAction = new QActionP( "", tr("MEN_DESK_SELECTION_CELL"), 0, this, 0, true );
- QAD_ASSERT(connect( SelectionCellAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
- SelectionCellAction->addTo( &mySelectionModePopup );
- myStdActions.insert( SelectionCellId, SelectionCellAction );
-
- QActionP* SelectionActorAction = new QActionP( "", tr("MEN_DESK_SELECTION_ACTOR"), 0, this, 0, true );
- QAD_ASSERT(connect( SelectionActorAction, SIGNAL(activated()), this, SLOT(onSelectionMode() )));
- SelectionActorAction->addTo( &mySelectionModePopup );
- myStdActions.insert( SelectionActorId, SelectionActorAction );
- SelectionActorAction->setOn(true);
-
- myViewPos = myViewPopup.count();
-
- QAD_ASSERT( connect( &myViewPopup, SIGNAL(highlighted( int )),
- this, SLOT(onViewPopupStatusText( int )) ));
-
- /* Parse xml file */
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
- if ( resMgr ) {
- QString msg;
- if(!resMgr->loadResources( "ToolsGUI", msg ))
- {
- //NRI QCString errMsg;
- // errMsg.sprintf( "Do not load all resources for module ToolsGUI.\n" );
- QMessageBox::warning( this, tr("WRN_WARNING"), msg, tr ("BUT_OK") );
- }
- }
-
- myOperatorMenus = new QAD_OperatorMenus(this);
- myXmlHandler = new QAD_XmlHandler();
- ASSERT(myXmlHandler) ;
- myXmlHandler->setMainWindow(this);
- if ( myXmlHandler->setComponent( resMgr->resources( "ToolsGUI" ) ) ) {
- QString language = resMgr->language( "ToolsGUI" );
- QString ToolsXml = QString( "Tools_" ) + language + QString( ".xml" );
-
- //ToolsXml = resMgr->resources("ToolsGUI") ;
- //ToolsXml = QAD_Tools::addSlash(ToolsXml) ;
- //ToolsXml = ToolsXml + "Tools_" + language + ".xml" ;
- ToolsXml = QAD_Tools::addSlash( resMgr->findFile( ToolsXml, "ToolsGUI" ) ) + ToolsXml;
-
- QFile file( QAD_Tools::unix2win( ToolsXml ) );
- if ( file.exists() && file.open( IO_ReadOnly ) ) {
- file.close();
- QXmlInputSource source( file );
- QXmlSimpleReader reader;
- reader.setContentHandler( myXmlHandler );
- reader.setErrorHandler( myXmlHandler );
- bool ok = reader.parse( source );
- file.close();
- if ( !ok ) {
- QMessageBox::critical( 0,
- tr( "INF_PARSE_ERROR" ),
- tr( myXmlHandler->errorProtocol() ) );
- } else {
- myMenusList=myXmlHandler->myMenusList;
- myActiveMenus=myMenusList.at(0);
- myOperatorMenus->showMenuBar(0);
- myActiveMenus->showAllToolBars();
- }
- }
- }
- // }
-
- if ( myToolsPopup.count() == 0 ) {
- myMainMenu->removeItem(5);
- }
-
- /* 'Pref' actions */
- /* Viewer BackgroundColor */
- myPrefPopup.insertItem( tr("MEN_DESK_PREF_VIEWER"), &myViewerPopup );
-
- QActionP* viewerOCCAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
- QAD_ASSERT(connect( viewerOCCAction, SIGNAL(activated()), this, SLOT(onViewerOCC() )));
- viewerOCCAction->addTo( &myViewerPopup );
- myStdActions.insert( PrefViewerOCCId, viewerOCCAction );
-
- QActionP* viewerVTKAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
- QAD_ASSERT(connect( viewerVTKAction, SIGNAL(activated()), this, SLOT(onViewerVTK() )));
- viewerVTKAction->addTo( &myViewerPopup );
- myStdActions.insert( PrefViewerVTKId, viewerVTKAction );
-
- QActionP* graphSupervisorAction = new QActionP( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
- QAD_ASSERT(connect( graphSupervisorAction, SIGNAL(activated()), this, SLOT(onGraphSupervisor() )));
- graphSupervisorAction->addTo( &myViewerPopup );
- myStdActions.insert( PrefGraphSupervisorId, graphSupervisorAction );
-
- QActionP* viewerPlot2dAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
- QAD_ASSERT(connect( viewerPlot2dAction, SIGNAL(activated()), this, SLOT(onPlot2d() )));
- viewerPlot2dAction->addTo( &myViewerPopup );
- myStdActions.insert( PrefViewerPlot2dId, viewerPlot2dAction );
-
- //VRV: T2.5 - add default viewer
- QString viewerValue = QAD_CONFIG->getSetting( "Viewer:DefaultViewer" );
- bool ok;
- int aViewerValue = viewerValue.toInt( &ok, 10 );
- if (!ok || aViewerValue < VIEW_OCC || aViewerValue >= VIEW_TYPE_MAX)
- aViewerValue = VIEW_VTK;
-
- myPrefPopup.insertItem( tr("MEN_DESK_PREF_DEFAULT_VIEWER"), &myDefaultViewer );
- QActionPGroup* myQAG = new QActionPGroup ( this);
- QActionP* viewerOCCAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_OCC"), 0, this );
- viewerOCCAction1->setToggleAction ( true);
- viewerOCCAction1->setOn ( aViewerValue == VIEW_OCC );
- myQAG->insert( viewerOCCAction1 );
- myStdActions.insert( DefaultViewerOCCId, viewerOCCAction1 );
-
- QActionP* viewerVTKAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_VTK"), 0, this );
- viewerVTKAction1->setToggleAction ( true);
- viewerVTKAction1->setOn ( aViewerValue == VIEW_VTK );
- myQAG->insert( viewerVTKAction1 );
- myStdActions.insert( DefaultViewerVTKId, viewerVTKAction1 );
-
-/* Remove Supervisor viewer from setting the background */
-// QActionP* graphSupervisorAction1 = new QActionP( "", tr("MEN_DESK_PREF_GRAPH_SUPERVISOR"), 0, this );
-// graphSupervisorAction1->setToggleAction ( true);
-// graphSupervisorAction1->setOn ( aViewerValue == VIEW_GRAPHSUPERV );
-// myQAG->insert( graphSupervisorAction1 );
-// myStdActions.insert( DefaultGraphSupervisorId, graphSupervisorAction1 );
-
- QActionP* viewerPlot2dAction1 = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_PLOT2D"), 0, this );
- viewerPlot2dAction1->setToggleAction ( true);
- viewerPlot2dAction1->setOn ( aViewerValue == VIEW_PLOT2D );
- myQAG->insert( viewerPlot2dAction1 );
- myStdActions.insert( DefaultPlot2dId, viewerPlot2dAction1 );
-
- myQAG->addTo( &myDefaultViewer );
- QAD_ASSERT(connect( myQAG, SIGNAL(selected(QActionP * )), this, SLOT(onDefaultViewer(QActionP *) )));
- //VRV: T2.5 - add default viewer
-
- myPrefPopup.insertSeparator();
-
- QActionP* viewerTrihedronAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_TRIHEDRON"), 0, this );
- QAD_ASSERT(connect( viewerTrihedronAction, SIGNAL(activated()), this, SLOT(onViewerTrihedron() )));
- viewerTrihedronAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefViewerTrihedronId, viewerTrihedronAction );
-
- QActionP* consoleFontAction = new QActionP( "", tr("MEN_DESK_PREF_CONSOLE_FONT"), 0, this );
- QAD_ASSERT(connect( consoleFontAction, SIGNAL(activated()), this, SLOT(onConsoleFontAction() )));
- consoleFontAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefConsoleFontId, consoleFontAction );
-
- /* MultiFile save */
- QActionP* multiFileSaveAction = new QActionP( "", tr("MEN_DESK_PREF_MULTI_FILE_SAVE"), 0, this, 0, true );
- QAD_ASSERT(connect( multiFileSaveAction, SIGNAL(activated()), this, SLOT(onMultiFileSave() )));
- multiFileSaveAction->setToggleAction( true );
- QString MultiSave = QAD_CONFIG->getSetting("Desktop:MultiFileSave");
- multiFileSaveAction->setOn( MultiSave.compare( aTrueQString ) == 0 );
- multiFileSaveAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefMultiFileSave, multiFileSaveAction );
-
- /* ASCII save */
- QActionP* ASCIISaveAction = new QActionP( "", tr("MEN_DESK_PREF_ASCII_SAVE"), 0, this, 0, true );
- QAD_ASSERT(connect( ASCIISaveAction, SIGNAL(activated()), this, SLOT(onASCIISave() )));
- ASCIISaveAction->setToggleAction( true );
- QString ASCIISave = QAD_CONFIG->getSetting("Desktop:ASCIISave");
- ASCIISaveAction->setOn( ASCIISave.compare( aTrueQString ) == 0 );
- ASCIISaveAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefASCIISave, ASCIISaveAction );
-
- /* Undo level */
- QActionP* UndoLevelAction = new QActionP( "", tr("MEN_DESK_PREF_UNDO_LEVEL"), 0, this );
- QAD_ASSERT(connect( UndoLevelAction, SIGNAL(activated()), this, SLOT(onUndoLevel() )));
- UndoLevelAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefUndoLevelId, UndoLevelAction );
-
- myPrefPopup.insertSeparator();
-
- /* External Browser */
- QActionP* externalBrowserAction = new QActionP( "", tr("MEN_DESK_PREF_EXTERNAL_BROWSER"), 0, this );
- QAD_ASSERT(connect( externalBrowserAction, SIGNAL(activated()), this, SLOT(onExternalBrowser() )));
- externalBrowserAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefExternalBrowserId, externalBrowserAction );
-
- myPrefPopup.insertSeparator();
- /* BrowserPopup */
- myPrefPopup.insertItem( tr("MEN_DESK_PREF_OBJECTBROWSER"), &myObjBrowserPopup );
-
- QActionP* objectBrowserEntryAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_ENTRY"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserEntryAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserEntryAction->setToggleAction(true);
- QString AddColumn = QAD_CONFIG->getSetting("ObjectBrowser:AddColumn");
-
- if ( AddColumn.compare( aTrueQString ) == 0 )
- objectBrowserEntryAction->setOn(true);
- else
- objectBrowserEntryAction->setOn(false);
-
- objectBrowserEntryAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserEntryId, objectBrowserEntryAction );
-
- QActionP* objectBrowserValueAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_VALUE"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserValueAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserValueAction->setToggleAction(true);
- QString ValueColumn = QAD_CONFIG->getSetting("ObjectBrowser:ValueColumn");
-
- if ( ValueColumn.compare( aTrueQString ) == 0 )
- objectBrowserValueAction->setOn(true);
- else
- objectBrowserValueAction->setOn(false);
-
- objectBrowserValueAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserValueId, objectBrowserValueAction );
-
- QActionP* objectBrowserIAPPAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_IAPP"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserIAPPAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserIAPPAction->setToggleAction(true);
- QString showIAPP = QAD_CONFIG->getSetting("ObjectBrowser:IAPP");
-
- if ( showIAPP.compare( aTrueQString ) == 0 )
- objectBrowserIAPPAction->setOn(true);
- else
- objectBrowserIAPPAction->setOn(false);
-
- objectBrowserIAPPAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserIAPPId, objectBrowserIAPPAction );
-
- /* Chronological sorting of shapes on the entry creation */
- QActionP* objectBrowserCHRONO_SORTAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserCHRONO_SORTAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserCHRONO_SORTAction->setToggleAction(true);
- QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:ChronologicalSort");
-
- if ( showSORT.compare( aTrueQString ) == 0 )
- objectBrowserCHRONO_SORTAction->setOn(true) ;
- else
- objectBrowserCHRONO_SORTAction->setOn(false) ;
-
- objectBrowserCHRONO_SORTAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserCHRONO_SORTId, objectBrowserCHRONO_SORTAction ) ;
-
- /* Show or don't Show UseCase browser */
- QActionP* objectBrowserShowUseCaseAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserShowUseCaseAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserShowUseCaseAction->setToggleAction(true);
- QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser");
-
- if ( showUseCase.compare( aTrueQString ) == 0 )
- objectBrowserShowUseCaseAction->setOn(true) ;
- else
- objectBrowserShowUseCaseAction->setOn(false) ;
-
- objectBrowserShowUseCaseAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserShowUseCaseId, objectBrowserShowUseCaseAction ) ;
-
- /* Resize or don't resize columns automatically */
- QActionP* objectBrowserNoAutoSizeAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE"), 0, this, 0, true );
- QAD_ASSERT(connect( objectBrowserNoAutoSizeAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() )));
- objectBrowserNoAutoSizeAction->setToggleAction(true);
- QString noAutoSize = QAD_CONFIG->getSetting("ObjectBrowser:NoAutoSizeColumns");
-
- if ( noAutoSize.compare( aTrueQString ) == 0 )
- objectBrowserNoAutoSizeAction->setOn(true) ;
- else
- objectBrowserNoAutoSizeAction->setOn(false) ;
-
- objectBrowserNoAutoSizeAction->addTo( &myObjBrowserPopup );
- myStdActions.insert( PrefObjectBrowserNoAutoSizeColumnsId, objectBrowserNoAutoSizeAction ) ;
-
- myPrefPopup.insertSeparator();
-
- QActionP* dirAction = new QActionP( "", tr("MEN_DESK_PREF_DIRICTORIES"), ALT+Key_D, this );
- QAD_ASSERT(connect( dirAction, SIGNAL(activated()), this, SLOT(onDirList() )));
- dirAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefDirsId, dirAction );
-
- myPrefPopup.insertSeparator();
-
- QActionP* saveAction = new QActionP( "", tr("MEN_DESK_PREF_SAVE"), 0, this );
- QAD_ASSERT(connect( saveAction, SIGNAL(activated()), this, SLOT(onSavePref() )));
- saveAction->addTo( &myPrefPopup );
- myStdActions.insert( PrefSaveId, saveAction );
-
- /* 'Window' actions */
- /* new Window 3D */
- //NRI : SAL2214
- myWindowPopup.insertItem( tr("MEN_DESK_WINDOW_NEW3D"), &myNewViewPopup, WindowNew3dId );
-
- QActionP* viewOCCAction = new QActionP( "", tr("MEN_DESK_VIEW_OCC"), ALT+Key_O, this );
- QAD_ASSERT(connect( viewOCCAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
- viewOCCAction->addTo( &myNewViewPopup );
- myStdActions.insert( ViewOCCId, viewOCCAction );
-
- QActionP* viewVTKAction = new QActionP( "", tr("MEN_DESK_VIEW_VTK"), ALT+Key_K, this );
- QAD_ASSERT(connect( viewVTKAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
- viewVTKAction->addTo( &myNewViewPopup );
- myStdActions.insert( ViewVTKId, viewVTKAction );
-
- QActionP* viewPlot2dAction = new QActionP( "", tr("MEN_DESK_VIEW_PLOT2D"), ALT+Key_P, this );
- QAD_ASSERT(connect( viewPlot2dAction, SIGNAL(activated()), this, SLOT(onNewWindow3d() )));
- viewPlot2dAction->addTo( &myNewViewPopup );
- myStdActions.insert( ViewPlot2dId, viewPlot2dAction );
-
- // QActionP* windowNew3dAction = new QActionP( "",/* rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_NEW3D") ), */
- /*tr("MEN_DESK_WINDOW_NEW3D"), 0, this );
- windowNew3dAction->addTo( &myWindowPopup );
- QAD_ASSERT( connect( windowNew3dAction, SIGNAL(activated()), this ,
- SLOT( onNewWindow3d() )));
- myStdActions.insert( WindowNew3dId, windowNew3dAction );
- */
-
- //NRI : SAL2214
-
- /* cascaded */
- QActionP* windowCascadeAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_CASCADE") ),
- tr("MEN_DESK_WINDOW_CASCADE"), 0, this );
- windowCascadeAction->setStatusTip ( tr("PRP_DESK_WINDOW_CASCADE") );
- QAD_ASSERT( connect( windowCascadeAction, SIGNAL(activated()), this,
- SLOT( onCascade() )));
- myStdActions.insert( WindowCascadeId, windowCascadeAction );
-
- /* tiled */
- QActionP* windowTileAction = new QActionP( "", rmgr->loadPixmap( "QAD", tr("ICON_DESK_WINDOW_TILE") ),
- tr("MEN_DESK_WINDOW_TILE"), 0, this );
- windowTileAction->setStatusTip ( tr("PRP_DESK_WINDOW_TILE") );
- QAD_ASSERT( connect( windowTileAction, SIGNAL(activated()), myWorkspace, SLOT( tile() )));
- myStdActions.insert( WindowTileId, windowTileAction );
-
- QAD_ASSERT( connect ( &myWindowPopup, SIGNAL(aboutToShow()),
- this, SLOT(onWindowPopupAboutToShow()) ));
- /* 'Help' actions
- */
- /* contents */
- // MZN : Commented
- // QActionP* helpContentsAction = new QActionP( "", tr("MEN_DESK_HELP_CONTENTS"), Key_F1, this );
- // helpContentsAction->setStatusTip ( tr("PRP_DESK_HELP_CONTENTS") );
-// QAD_ASSERT(connect( helpContentsAction, SIGNAL(activated()),
-// this, SLOT( onHelpContents() )));
-// helpContentsAction->addTo( &myHelpPopup );
-// myStdActions.insert( HelpContentsId , helpContentsAction );
-
-// id = myHelpPopup.insertSeparator();
-
- /* GUI contents */
- myHelpPopup.insertItem( tr("MEN_DESK_HELP_MODULECONTENTS"), &myHelpContentsModulePopup, HelpContentsModuleId);
- bool toEnable = false;
-
- CORBA::Object_var objVarN = myNameService->Resolve("/Kernel/ModulCatalog");
- myCatalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
-
- SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants =
- myCatalogue->GetComponentIconeList();
-
- for (unsigned int ind = 0; ind < list_composants->length(); ind++) {
- QString aModuleName = CORBA::string_dup(list_composants[ind].modulename) ;
- QString dir;
- if (dir = getenv( aModuleName + "_ROOT_DIR")) {
- dir = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + "doc/salome/" );
- QString aFileName = aModuleName + "_index.html";
- if ( QFileInfo( dir + aFileName ).exists() ) {
- QString aModuleUserName = CORBA::string_dup(list_composants[ind].moduleusername) ;
- if ( aModuleUserName == "Salome" ) aModuleUserName = "Kernel" ;
- QActionP* moduleHelpAction = new QActionP( "", aModuleUserName + " Help" , 0, this, aModuleName);
- QAD_ASSERT(connect( moduleHelpAction, SIGNAL(activated()), this, SLOT(onHelpContentsModule() )));
- moduleHelpAction->addTo( &myHelpContentsModulePopup );
- if (!toEnable) toEnable = true;
- }
- }
- }
-
- myHelpContentsModulePopup.setEnabled(toEnable);
-
- // NRI : Temporary commented
-
-// QActionP* helpContentsActionGUI = new QActionP( "", tr("MEN_DESK_HELP_GUICONTENTS"), 0, this );
-// helpContentsActionGUI->setStatusTip ( tr("PRP_DESK_HELP_GUICONTENTS") );
-// QAD_ASSERT(connect( helpContentsActionGUI, SIGNAL(activated()),
-// this, SLOT( onHelpContentsGUI() )));
-// helpContentsActionGUI->addTo( &myHelpPopup );
-// myStdActions.insert( HelpContentsId , helpContentsActionGUI );
-
-
- /* TUI contents */
- /*
- QActionP* helpContentsActionTUI = new QActionP( "", tr("MEN_DESK_HELP_TUICONTENTS"), 0, this );
- helpContentsActionTUI->setStatusTip ( tr("PRP_DESK_HELP_TUICONTENTS") );
- QAD_ASSERT(connect( helpContentsActionTUI, SIGNAL(activated()),
- this, SLOT( onHelpContentsTUI() )));
- helpContentsActionTUI->addTo( &myHelpPopup );
- myStdActions.insert( HelpContentsId , helpContentsActionTUI );
- */
-
-
- // Provide status tip for Module help menu item
- QAD_ASSERT( connect( &myHelpPopup, SIGNAL(highlighted( int )), this,
- SLOT(onHelpModulePopupStatusText( int )) ));
-
-
- /* search */
-// QActionP* helpSearchAction = new QActionP( "", tr("MEN_DESK_HELP_SEARCH"), 0, this );
-// helpSearchAction->setStatusTip ( tr("PRP_DESK_HELP_SEARCH") );
-// QAD_ASSERT( connect( helpSearchAction, SIGNAL(activated()), this, SLOT( onHelpSearch() )));
-// helpSearchAction->addTo( &myHelpPopup );
-// myStdActions.insert( HelpSearchId, helpSearchAction );
-
- /* What's This */
-// QActionP* helpWhatsThisAction = new QActionP( "", tr("MEN_DESK_HELP_WHATSTHIS"), SHIFT+Key_F1, this );
-// helpWhatsThisAction->setStatusTip ( tr("PRP_DESK_HELP_WHATSTHIS" ));
-// QAD_ASSERT( connect( helpWhatsThisAction, SIGNAL(activated()), this, SLOT( whatsThis() )));
-// helpWhatsThisAction->addTo( &myHelpPopup );
-// myStdActions.insert( HelpWhatsThisId, helpWhatsThisAction );
-// (void)QWhatsThis::whatsThisButton( myStdToolBar );
-
- id = myHelpPopup.insertSeparator();
- myHelpPos = myHelpPopup.indexOf( id );
-
- /* about */
- QActionP* helpAboutAction = new QActionP( "", tr("MEN_DESK_HELP_ABOUT"), 0, this );
- helpAboutAction->setStatusTip ( tr("PRP_DESK_HELP_ABOUT") );
- QAD_ASSERT( connect( helpAboutAction, SIGNAL(activated()), this, SLOT( onHelpAbout() )));
- helpAboutAction->addTo( &myHelpPopup );
- myStdActions.insert(HelpAboutId, helpAboutAction );
-
- /* additional key accelerators */
- QAccel* accel = new QAccel( this );
- // pan left
- myAccelMap[ accel->insertItem( CTRL+Key_Left ) ] = voPanLeft;
- // pan right
- myAccelMap[ accel->insertItem( CTRL+Key_Right ) ] = voPanRight;
- // pan up
- myAccelMap[ accel->insertItem( CTRL+Key_Up ) ] = voPanUp;
- // pan down
- myAccelMap[ accel->insertItem( CTRL+Key_Down ) ] = voPanDown;
- // zoom in
- myAccelMap[ accel->insertItem( CTRL+Key_Plus ) ] = voZoomIn;
- // zoom out
- myAccelMap[ accel->insertItem( CTRL+Key_Minus ) ] = voZoomOut;
- // zoom in
- myAccelMap[ accel->insertItem( CTRL+Key_Equal ) ] = voZoomIn;
- // fit all
- myAccelMap[ accel->insertItem( CTRL+Key_Asterisk ) ] = voZoomFit;
- // fit all
- myAccelMap[ accel->insertItem( CTRL+SHIFT+Key_Asterisk ) ] = voZoomFit;
- // rotate left
- myAccelMap[ accel->insertItem( ALT+Key_Left ) ] = voRotateLeft;
- // rotate right
- myAccelMap[ accel->insertItem( ALT+Key_Right ) ] = voRotateRight;
- // rotate up
- myAccelMap[ accel->insertItem( ALT+Key_Up ) ] = voRotateUp;
- // rotate down
- myAccelMap[ accel->insertItem( ALT+Key_Down ) ] = voRotateDown;
- // connect signal to slot
- connect( accel, SIGNAL( activated(int) ), this, SLOT( onKeyAccel(int) ) );
- }
- updateActions();
-}
-
-/*!
- Adds the given application into the list of supported applications
-*/
-void QAD_Desktop::addApplication(QAD_Application* app)
-{
- /* add only if is not already in the list */
- if ( myApps.findRef( app ) == -1 )
- {
- myApps.append( app );
-
- /* set activation/deactivation listener */
- QAD_ASSERT ( connect( app, SIGNAL(appActivated(QAD_Application*)),
- this, SLOT(onActivateApp(QAD_Application*))) );
-
- QAD_ASSERT ( connect( app, SIGNAL(appDeactivated(QAD_Application*)),
- this, SLOT(onDeactivateApp(QAD_Application*))) );
- }
-}
-
-/*!
- Displays the control panel of the application.
- This function is called when the desktop is shown first time.
-*/
-void QAD_Desktop::showDesktop()
-{
- show();
-}
-
-/*!
- Closes Desktop. If <forceClose> is true query for exit will be skipped.
-*/
-void QAD_Desktop::closeDesktop( bool forceClose )
-{
- if ( forceClose)
- myQueryClose = false;
- close();
-}
-
-/*!
- Puts the message to the status bar
-*/
-void QAD_Desktop::putInfo ( const QString& msg )
-{
- if ( myStatusBar )
- //NRI : bug 1209. message is now displayed during 3000 ms
- myStatusBar->message ( msg, 3000 );
-}
-
-/*!
- Puts the message to the status bar for ms milli-seconds
-*/
-void QAD_Desktop::putInfo ( const QString& msg, int ms )
-{
- if ( myStatusBar )
- myStatusBar->message ( msg, ms );
-}
-
-/*!
- Returns the standard toolbar
-*/
-QMenuBar* QAD_Desktop::getMainMenuBar() const
-{
- return myMainMenu;
-}
-
-/*!
- Returns the standard toolbar
-*/
-QToolBar* QAD_Desktop::getStdToolBar() const
-{
- return myStdToolBar;
-}
-
-/*!
- Updates desktop panel (menu, toolbar and status bar) according to current state of
- the application. Calls update() for the active application.
- The command { UD_ADD_APP or UD_REMOVE_APP ) specifies the desktop components
- will be changed according to new active application.
- This function is called after activating new study, closing current study etc.
-*/
-void QAD_Desktop::updateDesktop( UpdateCommand cmd )
-{
- updateMenu( cmd );
- updateToolBars( cmd );
- updateStatusBar( cmd );
- updateActions();
-}
-
-/*!
- Updates the desktop caption
-*/
-void QAD_Desktop::updateCaption( UpdateCommand cmd )
-{
- if ( cmd == ActivateApp )
- { /* application's icon and title */
- setIcon( myActiveApp->getApplicationIcon() );
- setCaption( myActiveApp->getApplicationName() );
- }
- else
- { /* default icon and title */
- setIcon( myDefaultIcon );
- qApp->processEvents();
- setCaption( myDefaultTitle );
- }
-}
-
-/*!
- Updates status bar when a new application becomes current
-*/
-void QAD_Desktop::updateStatusBar( UpdateCommand cmd )
-{
- if ( myActiveApp )
- {
- bool activate = ( cmd == ActivateApp );
- myActiveApp->updateStatusBar ( myStatusBar, activate );
- }
-}
-
-/*!
- Updates toolbars according to current active application.
- This function is called from updateDesktop().
-*/
-void QAD_Desktop::updateToolBars( UpdateCommand cmd )
-{
- if ( myActiveApp )
- {
- bool activate = ( cmd == ActivateApp );
- myActiveApp->updateToolBars ( activate );
- }
-}
-
-/*!
- Updates main menu bar of the application when application is activated
- or deactivated.
- This function is called by updateDesktop()
-*/
-void QAD_Desktop::updateMenu( UpdateCommand cmd )
-{
- if ( myActiveApp )
- {
- bool activate = ( cmd == ActivateApp );
- myActiveApp->updateFilePopup( &myFilePopup, activate, myFilePos );
- myActiveApp->updateEditPopup( &myEditPopup, activate, myEditPos );
- myActiveApp->updateViewPopup( &myViewPopup, activate, myViewPos );
- myActiveApp->updateHelpPopup( &myHelpPopup, activate, myHelpPos );
- myActiveApp->updateMainMenu( myMainMenu, activate, myMainMenuPos );
-
- /* NOTE:
- Since 'Edit' popup is completely customized by applications
- desktop doesn't show it in main menubar without the active
- application and we insert/remove this popup from the menubar
- when activating/deactivating applications.
-
- We can't have 'Edit' popup be customized by an application
- via UpdateMainMenu() method because applications may insert
- its items to the menubar only AFTER 'View' item ( this fact
- is respected by myMainMenuPos ) and the possibility of an
- application to add its items into any arbitrary positions of
- the main menubar requires a bit sophisticated implementation,
- so we decided to avoid it, sorry :-(.
- */
-#if defined( DEBUG )
- if ( !activate )
- /* applications MUST clear 'Edit' after themselves */
- QAD_ASSERT_DEBUG_ONLY( !myEditPopup.count() );
-#endif
-
- if ( activate ) /* insert after 'File' item */
- myMainMenu->insertItem( tr("MEN_DESK_EDIT"), &myEditPopup, 3, 1 );
- else
- myMainMenu->removeItem( 3 );
- }
-}
-
-/*!
- Returns icon file name used by the application
-*/
-const QPixmap& QAD_Desktop::getDefaultIcon() const
-{
- static QPixmap defaultPixmap( QAD_Desktop::getResourceManager()->loadPixmap( "QAD",
- tr("ICON_DESK_DEFAULTICON") ));
- return defaultPixmap;
-}
-
-/*!
- Returns name of the application used as the title of desktop panel
-*/
-const QString& QAD_Desktop::getDefaultTitle() const
-{
- static QString defaultTitle ( tr("DESK_DEFAULTTITLE") );
- return defaultTitle;
-}
-
-/*!
- Returns default name of new studies
-*/
-const QString& QAD_Desktop::getDefaultStudyName() const
-{
- static QString defaultStudyName( tr("DESK_DEFAULTDOC") );
- return defaultStudyName;
-}
-
-/*!
- Returns next name for new study
-*/
-QString QAD_Desktop::getNewStudyName()
-{
- QString number;
- number.sprintf( "%d", ++myCntUntitled );
- return ( getDefaultStudyName() + number );
-}
-
-/*!
- Searches QAD_Study corresponding to <study>, returns NULL if fails
-*/
-QAD_Study* QAD_Desktop::findStudy( SALOMEDS::Study_ptr theStudy )
-{
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() ) {
- QList<QAD_Study> studies;
- studies.setAutoDelete( false );
- studies = app->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- if ( study->getStudyDocument()->_is_equivalent( theStudy ) )
- return study;
- }
- }
- return 0;
-}
-
-/*!
- Gets value of max undo level for SALOMEDS::Study's from preferences
-*/
-int QAD_Desktop::getUndoLevel()
-{
- static int MAX_UNDO = 10;
- int anUndoLevel = MAX_UNDO;
- QString aLevel = QAD_CONFIG->getSetting("Desktop:UndoLevel");
- if(!aLevel.isEmpty()) anUndoLevel = aLevel.toInt();
- return anUndoLevel;
-}
-
-/*!
- Returns current active application
-*/
-QAD_Application* QAD_Desktop::getActiveApp() const
-{
- return myActiveApp;
-}
-
-/*!
- Returns current active study
-*/
-QAD_Study* QAD_Desktop::getActiveStudy() const
-{
- return myActiveStudy;
-}
-
-/*!
- Returns main frame
-*/
-QWorkspaceP* QAD_Desktop::getMainFrame() const
-{
- return myWorkspace;
-}
-
-/*!
- Find or load Engine, given a container name and an engine name
-*/
-Engines::Component_var QAD_Desktop::getEngine(const char *containerName,
- const char *componentName)
-{
- Engines::Component_var eng =
- myEnginesLifeCycle->FindOrLoad_Component(containerName,
- componentName);
- return eng._retn();
-}
-
-QString QAD_Desktop::getComponentName(const char *componentUserName)
-{
- if ( mapComponentName.contains(componentUserName) )
- return mapComponentName[ componentUserName ] ;
- else
- return "";
-}
-
-QString QAD_Desktop::getComponentUserName(const char *componentName)
-{
- QMap<QString,QString>::Iterator it;
- for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it )
- if (it.data() == componentName )
- return it.key();
- return "";
-}
-
-// /*!
-// gets application Help Window (and creates if necessary)
-// */
-// QAD_HelpWindow* QAD_Desktop::getHelpWindow()
-// {
-// if (!myHelpWindow) {
-// myHelpWindow = new QAD_HelpWindow();
-
-// QMap<QString,QString>::Iterator it;
-// for( it = mapComponentName.begin(); it != mapComponentName.end(); ++it ) {
-// QCString dir;
-// QString root;
-
-// // look for index.html and set homeDir
-// // 1. $(MODULE_ROOT_DIR)/doc/index.html
-// // 2. $(MODULE_ROOT_DIR)/doc/html/index.html
-// // 3. $(MODULE_ROOT_DIR)/doc/html/html/index.html
-
-// if (dir = getenv( QString( it.data() + "_ROOT_DIR")) ) {
-// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// else {
-// root = QAD_Tools::addSlash( root + "html" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// else {
-// root = QAD_Tools::addSlash( root + "html" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// }
-// }
-// }
-// }
-
-// connect(myHelpWindow, SIGNAL(helpWindowClosed()), this, SLOT(onHelpWindowClosed()));
-// }
-// return myHelpWindow;
-// }
-
-/*!
- Called when desktop is closing
-*/
-void QAD_Desktop::closeEvent ( QCloseEvent* e )
-{
- bool doClose = true;
- if ( myQueryClose ) {
- doClose = QAD_MessageBox::info2 ( this, tr("INF_DESK_EXIT"),
- tr("QUE_DESK_EXIT"), tr ("BUT_OK"),
- tr ("BUT_CANCEL"), QAD_YES,
- QAD_NO, QAD_NO ) == QAD_YES;
- }
-
- for ( QAD_Application* app = myApps.first(); doClose && app; app = myApps.next() ) {
- QList<QAD_Study>& studies = app->getStudies();
- for(QAD_Study* study = studies.first(); doClose && study != 0; study = studies.next()) {
- if(myQueryClose && study->getStudyDocument()->IsModified()) {
- SALOMEGUI_CloseDlg aDlg( this );
- switch ( aDlg.exec() ) {
- case 1:
- if ( !onSaveStudy( study ) ) {
- putInfo( tr("INF_CANCELLED") );
- doClose = false;
- }
- break;
- case 2:
- case 3:
- break;
- case 0:
- default:
- doClose = false;
- putInfo( tr("INF_CANCELLED") );
- }
- }
- if ( doClose )
- study->close();
- }
- }
-
- myQueryClose = true;
-
- if ( !doClose ) {
- myAboutToClose = false;
- // onActiveStudyChanged() is normally caused by QWorkspace::eventFilter(),
- // but this call was blocked by myAboutToClose == true, so now we should do it manually
- onActiveStudyChanged();
-
- e->ignore();
- }
- else
- e->accept();
-}
-
-/*!
- Called when desktop is resized
-*/
-void QAD_Desktop::resizeEvent( QResizeEvent* e )
-{
- QMainWindow::resizeEvent( e );
- myWorkspace->setGeometry( 1,1, centralWidget()->width()-2,
- centralWidget()->height()-2 );
-}
-
-
-/*!
- Terminates the application.
-*/
-void QAD_Desktop::onExit()
-{
- close();
-}
-
-/************************************************************************
-** Study operations
-*************************************************************************/
-
-/*!
- Creates new study.
- If several application are supported it displays dialog window
- to choose type of study.
-*/
-void QAD_Desktop::createStudy(){
- onNewStudy();
-}
-void QAD_Desktop::onNewStudy()
-{
- unsigned numApps = myApps.count();
- if ( numApps ) {
- if ( numApps == 1 )
- onNewStudy ( myApps.at(0) );
- else { /* select the type of application for new study */
- Desktop_AppSelectionDlg selDlg( this, myApps );
- if ( selDlg.exec() == QDialog::Accepted ) {
- onNewStudy ( selDlg.selectedApp() );
- }
- }
- } else { /* no applications available in desktop */
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_APP_NOAPP"),
- tr("BUT_OK") );
- }
-}
-
-/*!
- Creates new study for the given application.
- Calls the respective function of the application class.
-*/
-void QAD_Desktop::onNewStudy( QAD_Application* app )
-{
- if ( !app ) return;
-
- /* create new study of the specific app */
- putInfo ( tr ("INF_DOC_CREATING") );
- QAD_Study* newStudy = app->newStudy();
-
- if ( !newStudy ) {
- /* can't create new study */
- QAD_MessageBox::error1( this, tr("ERR_ERROR"),
- tr("ERR_DOC_CANTCREATE"),
- tr("BUT_OK") );
- }
- putInfo ( tr("INF_READY") );
-}
-
-/*!
- Loads the existing study.
-*/
-void QAD_Desktop::onLoadStudy()
-{
- QString name, studyname, ext;
-
- SALOMEGUI_LoadStudiesDlg* aDlg = new SALOMEGUI_LoadStudiesDlg( this, "Load Study", TRUE);
-
- CORBA::Object_var obj = myNameService->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
- ASSERT(! CORBA::is_nil(myStudyMgr));
- SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
- for (unsigned int ind = 0; ind < List->length();ind++) {
- studyname = List[ind];
- aDlg->ListComponent->insertItem( studyname );
- }
-
- int retVal = aDlg->exec();
- studyname = aDlg->ListComponent->currentText();
- delete aDlg;
- if (retVal == QDialog::Rejected)
- return;
-
- if ( studyname.isNull() || studyname.isEmpty() )
- return;
-
- name = studyname;
- name.replace( QRegExp(":"), "/" );
-
- /*
- Try to associate an application to the opened study.
- Assumed that the association study<->application is unique.
- */
- bool appFound = false;
- putInfo ( tr("INF_DOC_OPENING") + " " + name );
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() )
- {
- /* application found */
- if ( app->isStudyOpened( name ) )
- {
- /* already opened: prompt for reopen */
- if ( QAD_MessageBox::warn2 ( this, tr("WRN_WARNING"),
- tr("QUE_DOC_ALREADYOPEN").arg( name ),
- tr ("BUT_YES"), tr ("BUT_NO"), QAD_YES, QAD_NO,
- QAD_NO ) == QAD_NO )
- {
- putInfo ( tr("INF_READY") );
- return;
- }
- /* now the study is closed to be re-opened */
- //don't ask user to remove study permanently
- if (app->getStudyByName ( name ) != NULL)
- onCloseStudy ( app->getStudyByName ( name ), false );
- else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL)
- onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false );
- }
- appFound = true;
-
- /* open the study */
- QAD_Study* openStudy = app->loadStudy( studyname );
- if ( !openStudy ) {
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_DOC_CANTOPEN") + "\n" + name,
- tr("BUT_OK") );
- }
- break;
- }
-
- if ( !appFound ) {
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_DOC_UNKNOWNTYPE"),
- tr("BUT_OK") );
- }
- putInfo ( tr("INF_READY") );
-}
-
-
-
-QAD_Study* QAD_Desktop::loadStudy(QString theStudyName) {
- QString studyname("");
-
- CORBA::Object_var obj = myNameService->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
- ASSERT(! CORBA::is_nil(myStudyMgr));
-
- SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
- for (unsigned int ind = 0; ind < List->length();ind++) {
- if (theStudyName == QString(List[ind])) {
- studyname = theStudyName;
- break;
- }
- }
- if (studyname == "") {
- return NULL;
- }
- bool appFound = false;
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() ) {
- appFound = true;
- QAD_Study* openStudy = app->loadStudy( studyname );
- if (openStudy) {
- // if (myActiveApp == 0)
- //myActiveApp = app;
- return openStudy;
- }
- break;
- }
- return NULL;
-}
-
-
-/*!
- Opens the existing study.
- Displays select file dialog and calls corresponding function of
- application class
- (application is defined according to extension of selected file).
-*/
-void QAD_Desktop::onOpenStudy()
-{
- QString name, ext;
-
- /* Select a file to open */
- name = selectFileName ( true );
- if ( name.isNull() || name.isEmpty() )
- return;
-
- // Workaround for non-existent files
- QFileInfo fi(name);
- if (!fi.exists() || !fi.isFile()) {
- QAD_MessageBox::error1 ( this, tr("ERR_ERROR"),
- tr("ERR_DOC_CANTOPEN") +": " + name,
- tr("BUT_OK") );
- return;
- }
-
- CORBA::Object_var obj = myNameService->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
- ASSERT(! CORBA::is_nil(myStudyMgr));
- SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies();
- for (unsigned int ind = 0; ind < List->length();ind++) {
- QString NameExistingStudy(List[ind]);
- QString NameOpeningStudy = QAD_Tools::getFileNameFromPath( name, true );
- if ( NameExistingStudy.compare( NameOpeningStudy ) == 0 ) {
- if ( QAD_MessageBox::warn2 ( this, tr("WRN_WARNING"),
- tr("QUE_DOC_ALREADYEXIST").arg( name ),
- tr ("BUT_YES"), tr ("BUT_NO"), QAD_YES, QAD_NO,
- QAD_NO ) == QAD_NO )
- {
- putInfo ( tr("INF_READY") );
- return;
- }
-// else
-// {
-// onLoadStudy();
-// return;
-// }
- }
- }
-
- /*
- Try to associate an application to the opened study.
- Assumed that the association study<->application is unique.
- */
- bool appFound = false;
- putInfo ( tr("INF_DOC_OPENING") + " " + name );
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() )
- {
- QString ext = QAD_Tools::getFileExtensionFromPath ( name );
- if ( app->getStudyExtension() == ext )
- {
- /* application found */
- if ( app->isStudyOpened( name ) )
- {
- /* already opened: prompt for reopen */
- if ( QAD_MessageBox::warn2 ( this, tr("WRN_WARNING"),
- tr("QUE_DOC_ALREADYOPEN").arg( name ),
- tr ("BUT_YES"), tr ("BUT_NO"), QAD_YES, QAD_NO,
- QAD_NO ) == QAD_NO )
- {
- putInfo ( tr("INF_READY") );
- return;
- }
- /* now the study is closed to be re-opened */
- //don't ask user to remove study permanently
- if (app->getStudyByName ( name ) != NULL)
- onCloseStudy ( app->getStudyByName ( name ), false );
- else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL)
- onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false );
- }
- appFound = true;
-
- /* open the study */
- QAD_Study* openStudy = app->openStudy( name );
- if ( !openStudy ) {
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_DOC_CANTOPEN") + "\n" + name,
- tr("BUT_OK") );
- }
- break;
- }
- }
-
- if ( !appFound )
- {
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_DOC_UNKNOWNTYPE"),
- tr("BUT_OK"));
- }
- putInfo ( tr("INF_READY") );
-}
-
-bool QAD_Desktop::loadComponentData( const QString& compName )
-{
- QAD_WaitCursor wc;
-
- if ( compName.isEmpty() ) {
- MESSAGE("loadComponentData(): empty component name passed!")
- return false;
- }
-
- // Open component's data in active study if any
- MESSAGE("loadComponentData(): Opening " << compName << " component data ")
- if (!myActiveStudy) {
- MESSAGE("loadComponentData(): No active study exists")
- return false;
- }
-
- Engines::Component_var comp ;
- if ( compName.compare("SUPERV") == 0 ) {
- comp = getEngine( "SuperVisionContainer", compName) ;
- }
- else {
- /* comp = ( compName.compare("Data1") != 0 ) ? getEngine( "FactoryServer", compName) :
- getEngine( "FactoryServerPy", compName);
- */
- comp = getEngine( "FactoryServer", compName);
- if ( comp->_is_nil() )
- comp = getEngine( "FactoryServerPy", compName);
- }
-
- if ( CORBA::is_nil( comp ) ) {
- MESSAGE("loadComponentData(): Engine is null");
- return false;
- }
-
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::SComponent_var SCO = SALOMEDS::SComponent::_narrow(aStudy->FindObject( getComponentUserName(compName) ));
-
- if (!SCO->_is_nil()) {
- SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
- if (!CORBA::is_nil(driver)) {
- SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder();
- if (!CORBA::is_nil(B)) {
- try {
- B->LoadWith(SCO,driver);
- }
- catch( const SALOME::SALOME_Exception& ) {
- // Oops, something went wrong while loading -> return an error
- return false;
- }
- }
- } else {
- MESSAGE("loadComponentData(): Driver is null");
- // Incorrect! All components should inherit SALOMEDS::Driver
- return false;
- }
- } else {
- MESSAGE("loadComponentData(): SComponent is null");
- // Don't return false here, for there might be no data
- // for a given component in the study yet
- }
-
- return true;
-}
-
-/*!
- Saves the active study
-*/
-bool QAD_Desktop::onSaveStudy()
-{
- return onSaveStudy ( myActiveStudy );
-}
-
-/*!
- Saves the given study
-*/
-bool QAD_Desktop::onSaveStudy( QAD_Study* study )
-{
- if ( !study ) return true;
-
- if ( !study->isSaved() )
- return onSaveAsStudy ( study );
-
- /* saving study... */
- QAD_Application* app = study->getApp();
- QAD_ASSERT_DEBUG_ONLY ( app );
- putInfo ( tr("INF_DOC_SAVING") + study->getTitle() );
- if ( !app->saveStudy( study ) )
- {
- putInfo( tr("INF_CANCELLED") );
- return false;
- }
-
- /* saved ok */
- putInfo ( tr("INF_DOC_SAVED").arg( "" ) );
- return true;
-}
-
-/*!
- Saves the active study under a new name
-*/
-bool QAD_Desktop::onSaveAsStudy()
-{
- return onSaveAsStudy( myActiveStudy );
-}
-
-/*!
- Saves the given study under a new name
-*/
-bool QAD_Desktop::onSaveAsStudy( QAD_Study* study )
-{
- if ( !study ) return true;
-
- /* Save study in a format supported by its application
- */
- QAD_Application* app = study->getApp();
- QAD_ASSERT_DEBUG_ONLY ( app );
-
- /* Select a file where to save
- */
- QString name = selectFileName ( false );
- if ( name.isNull() || name.isEmpty() )
- {
- putInfo( tr("INF_CANCELLED") );
- return false;
- }
-
- /* Saving study
- */
- putInfo ( tr("INF_DOC_SAVING") + name );
- if ( !app->saveAsStudy( study, name ) ) {
- /* can't save the file */
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_DOC_CANTWRITE") + "\n" + name,
- tr("BUT_OK") );
- putInfo("");
- return false; /* cannot save */
- }
- putInfo ( tr("INF_DOC_SAVED").arg( name ) );
- return true; /* saved ok */
-}
-
-/*!
- Closes the active study
-*/
-bool QAD_Desktop::onCloseStudy()
-{
- bool close = this->onCloseStudy ( getActiveStudy(), true );
- return close;
-}
-
-/*!
- Closes the given study and ask user to remove study
- from the study manager permanently
-*/
-bool QAD_Desktop::onCloseStudy( QAD_Study* study )
-{
- return onCloseStudy( study, true );
-}
-
-/*!
- Closes the given study and ask user to remove study
- from the study manager permanently if ask is equal true
-*/
-bool QAD_Desktop::onCloseStudy( QAD_Study* study, bool ask )
-{
- bool removePerm = false;
-
- if ( ask )
- {
- SALOMEGUI_CloseDlg aDlg( this );
- int res = aDlg.exec();
-
- switch ( res )
- {
- case 1:
- //if ( study->isModified() )
- if ( !onSaveStudy( study ) ) {
- putInfo( tr("INF_CANCELLED") );
- return false;
- }
- removePerm = true;
- break;
- case 2:
- removePerm = true;
- break;
- case 3:
- removePerm = false;
- break;
- case 0:
- default:
- putInfo( tr("INF_CANCELLED") );
- return false;
- }
- }
- /* close active component */
- if (!myXmlHandler->myIdList.IsEmpty())
- {
- deactivateComponent();
- clearMenus();
- myActiveComp="";
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() )
- aButton->setOn(false);
- qApp->processEvents();
- }
- /* close the study */
- return study->getApp()->closeStudy( study, removePerm );
-}
-
-// Displays study properties dialog box
-void QAD_Desktop::onStudyProperties()
-{
- if (myActiveStudy) {
- // open transaction
- QAD_Operation* op = new QAD_Operation( myActiveStudy );
- op->start();
-
- SALOMEGUI_StudyPropertiesDlg aDlg(this);
- int res = aDlg.exec();
-
- if ( res == QDialog::Accepted && aDlg.isChanged() )
- op->finish();
- else
- op->abort();
-
- // T2.12 - add the word "locked" to study frame captions if <myActiveStudy> study is locked
- myActiveStudy->updateCaptions();
- }
-}
-
-
-/*!
- locate all windows in cascade mode
- and resize them
-*/
-void QAD_Desktop::onCascade()
-{
- myWorkspace->cascade();
- int w = myWorkspace->width();
- int h = myWorkspace->height();
- QWidgetList wList = myWorkspace->windowList();
- QWidgetListIt it(wList);
-
- for(;it.current(); ++it)
- it.current()->resize((int)(0.8*w), (int)(0.8*h));
-}
-
-// /*!
-// called when help window closed
-// */
-// void QAD_Desktop::onHelpWindowClosed()
-// {
-// myHelpWindow = 0;
-// }
-
-/*!
- Called when 'view status bar' option
- is switched on/off.
-*/
-void QAD_Desktop::onViewStatusBar()
-{
- bool show = myStdActions.at( ViewStatusBarId )->isOn();
- if ( show == myStatusBar->isVisible() )
- return;
- if ( show )
- myStatusBar->show();
- else
- myStatusBar->hide();
-}
-
-/*!
- Called when View/Toolbars popup menu is about to show
-*/
-void QAD_Desktop::onToolBarPopupAboutToShow()
-{
- myToolBarAction.clear();
- myToolBarsPopup.clear();
- QPtrList<QDockWindow> wlist = dockWindows();
- for ( QDockWindow* w = wlist.first(); w; w = wlist.next() ) {
- if ( w->inherits( "QToolBar" ) ) {
- QToolBar* tb = ( QToolBar* )w;
- if ( appropriate( tb ) ) {
- ToggleAction* a = new ToggleAction( tb->label(), tb->label(), 0, this, 0, true );
- a->setStatusTip ( tr("PRP_DESK_VIEW_TOOLBAR") );
- a->setOn( tb->isVisible() );
- QAD_ASSERT( connect( a, SIGNAL( toggledOn() ), tb, SLOT( show() ) ) );
- QAD_ASSERT( connect( a, SIGNAL( toggledOff() ), tb, SLOT( hide() ) ) );
- a->addTo( &myToolBarsPopup );
- myToolBarAction.append( a );
- }
- }
- }
-}
-
-/*!
- Called on 'View\Selection Mode'
-*/
-void QAD_Desktop::onSelectionMode()
-{
- const QActionP* obj = (QActionP*) sender();
-
- Selection_Mode SelectionMode = ActorSelection;
-
- if ( obj == myStdActions.at(SelectionActorId) ) {
- SelectionMode = ActorSelection;
- if ( obj->isOn() ) {
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- } else
- myStdActions.at(SelectionActorId)->setOn(true);
-
- } else if ( obj == myStdActions.at(SelectionCellId) ) {
- SelectionMode = CellSelection;
- if ( obj->isOn() ) {
- myStdActions.at(SelectionActorId)->setOn(false);
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- } else
- myStdActions.at(SelectionActorId)->setOn(true);
-
- } else if ( obj == myStdActions.at(SelectionEdgeId) ) {
- SelectionMode = EdgeOfCellSelection;
- if ( obj->isOn() ) {
- myStdActions.at(SelectionActorId)->setOn(false);
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- } else
- myStdActions.at(SelectionActorId)->setOn(true);
-
- } else if ( obj == myStdActions.at(SelectionPointId) ) {
- SelectionMode = NodeSelection;
- if ( obj->isOn() ) {
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionActorId)->setOn(false);
- } else
- myStdActions.at(SelectionActorId)->setOn(true);
- }
-
- QAD_StudyFrame* sf = myActiveApp->getActiveStudy()->getActiveStudyFrame();
- sf->getRightFrame()->getViewFrame()->SetSelectionMode( SelectionMode );
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveApp->getActiveStudy()->getSelection() );
- Sel->SetSelectionMode( SelectionMode );
-}
-
-/*!
- Called on 'View\Selection Mode'
-*/
-void QAD_Desktop::SetSelectionMode(Selection_Mode mode, bool activeCompOnly)
-{
- switch (mode) {
- case NodeSelection:
- {
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionActorId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(true);
- break;
- }
- case EdgeOfCellSelection:
- {
- myStdActions.at(SelectionActorId)->setOn(false);
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- myStdActions.at(SelectionEdgeId)->setOn(true);
- break;
- }
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- {
- myStdActions.at(SelectionActorId)->setOn(false);
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- myStdActions.at(SelectionCellId)->setOn(true);
- break;
- }
- case ActorSelection:
- {
- myStdActions.at(SelectionCellId)->setOn(false);
- myStdActions.at(SelectionEdgeId)->setOn(false);
- myStdActions.at(SelectionPointId)->setOn(false);
- myStdActions.at(SelectionActorId)->setOn(true);
- break;
- }
- }
-
- QAD_StudyFrame* sf = myActiveApp->getActiveStudy()->getActiveStudyFrame();
- if ( sf->getTypeView() == VIEW_VTK ) {
- sf->getRightFrame()->getViewFrame()->SetSelectionMode( mode );
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveApp->getActiveStudy()->getSelection() );
- Sel->SetSelectionMode( mode, activeCompOnly );
- } else {
- }
-}
-
-/*!
- Called on 'Window\NewWindow3d'
-*/
-void QAD_Desktop::onNewWindow3d()
-{
- //NRI : SAL2214
- /*
- //VRV: T2.5 - add default viewer
- QApplication::restoreOverrideCursor();
- SALOMEGUI_ViewChoiceDlg *choice = new SALOMEGUI_ViewChoiceDlg(this, "", TRUE);
- int r = choice->exec();
- if (r)
- {
- myActiveApp->getActiveStudy()->newWindow3d(QString(""),(ViewType)(choice->getSelectedViewer()));
- }
- //VRV: T2.5 - add default viewer
- */
- const QActionP* obj = (QActionP*) sender();
- if ( obj == myStdActions.at(ViewOCCId) ) {
- myActiveApp->getActiveStudy()->newWindow3d(QString(""),(ViewType)(0));
- } else if ( obj == myStdActions.at(ViewVTKId) ) {
- myActiveApp->getActiveStudy()->newWindow3d(QString(""),(ViewType)(1));
- } else if ( obj == myStdActions.at(ViewPlot2dId) ) {
- myActiveApp->getActiveStudy()->newWindow3d(QString(""),(ViewType)(3));
- }
- //NRI : SAL2214
-}
-
-// Helps to execute command
-class RunBrowser: public QThread {
-public:
-
- RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
- myApp(theApp), myParams(theParams), myHelpFile("file:" + theHelpFile + theContext), myStatus(0) {};
-
- virtual void run()
- {
- QString aCommand;
-
- if ( !myApp.isEmpty())
- {
- aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1());
- myStatus = system(aCommand);
- if(myStatus != 0)
- {
- QCustomEvent* ce2000 = new QCustomEvent (2000);
- postEvent (qApp, ce2000);
- }
- }
-
- if( myStatus != 0 || myApp.isEmpty())
- {
- myParams = "";
- aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1());
- myStatus = system(aCommand);
- if(myStatus != 0)
- {
- QCustomEvent* ce2001 = new QCustomEvent (2001);
- postEvent (qApp, ce2001);
- }
- }
- }
-
-private:
- QString myApp;
- QString myParams;
- QString myHelpFile;
- int myStatus;
-
-};
-
-// Provide status tip for GUI help menu item
-
-void QAD_Desktop::onHelpModulePopupStatusText(int id)
-{
- int Id = myHelpPopup.idAt( 0 ); // HelpContentsModuleId
- // MESSAGE ( "myHelpContentsModulePopup : " << id << "-" << Id)
- if (id == Id)
- putInfo("Shows the help contents of each module");
-}
-
-/*!
- Called on 'help\contents'
-*/
-void QAD_Desktop::onHelpContents()
-{ if (myActiveComp == "")
- myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
-
- QCString dir;
- QString root;
- QString homeDir;
- if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + QAD_Tools::addSlash("doc") + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- homeDir = root;
- } else {
- QMessageBox::warning( this, tr("WRN_WARNING"),
- QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") );
- return;
- }
- }
-
- QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();
- QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
- QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
-
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
- rs->start();
-}
-
-/*!
- Called on 'Module Help Reference'
-*/
-void QAD_Desktop::onHelpContentsModule()
-{
- const QActionP* obj = (QActionP*) sender();
-
- QString aComponentName = obj->name();
- QString aFileName = aComponentName + "_index.html";
-
- QCString dir;
- QString root;
- QString homeDir;
- if (dir = getenv( aComponentName + "_ROOT_DIR")) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("doc") + QAD_Tools::addSlash("salome") );
- if ( QFileInfo( root + aFileName ).exists() ) {
- homeDir = root;
- } else {
- QMessageBox::warning( this, tr("WRN_WARNING"),
- QString( "%1"+ aFileName + " doesn't exist." ).arg(root), tr ("BUT_OK") );
- return;
- }
- }
-
- QString helpFile = QFileInfo( homeDir + aFileName ).absFilePath();
- QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
- QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
-
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
- rs->start();
-}
-
-/*!
- Called on 'help\TUI Reference'
-*/
-
-/* Commented
-void QAD_Desktop::onHelpContentsTUI()
-{
- if (myActiveComp == "")
- myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
-
- QCString dir;
- QString root;
- QString homeDir;
- if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("doc") + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- homeDir = root;
- } else if (QFileInfo( root + "html/index.html" ).exists())
- homeDir = root + QAD_Tools::addSlash("html");
- else {
- QMessageBox::warning( this, tr("WRN_WARNING"),
- QString( "%1index.html doesn't exist." ).arg(root), tr ("BUT_OK") );
- return;
- }
- }
-
- QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath();
-
- QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
- QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
-
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
- rs->start();
-}
-*/
-
-
-// /*!
-// Called on 'help\search'
-// */
-// void QAD_Desktop::onHelpSearch()
-// {
-// if (myActiveApp)
-// myActiveApp->helpSearch();
-// else
-// helpSearch();
-// }
-
-/*!
- Called on 'help\about'
-*/
-void QAD_Desktop::onHelpAbout()
-{
- if (myActiveApp)
- myActiveApp->helpAbout();
- else
- helpAbout();
-}
-
-
-/*!
- Activates the application and its active study
-*/
-void QAD_Desktop::onActivateApp( QAD_Application* activeApp )
-{
- bool appChanged = ( activeApp != myActiveApp );
- if ( appChanged )
- {
- updateDesktop( DeactivateApp );
- }
- if ( activeApp )
- {
- myActiveApp = activeApp;
- myActiveStudy = myActiveApp->getActiveStudy();
- }
- else
- {
- myActiveApp = 0;
- myActiveStudy = 0;
- }
-
- if ( appChanged )
- {
- updateDesktop( ActivateApp );
- updateCaption( (activeApp != NULL) ? ActivateApp : DeactivateApp );
- }
- updateActions();
-}
-
-/*!
- Called when the last study is removed from
- the application 'app'.
-*/
-void QAD_Desktop::onDeactivateApp(QAD_Application* app)
-{
- if ( app && app == myActiveApp )
- onActivateApp( 0 );
-}
-
-/*!
- Enables/disables standard actions
-*/
-void QAD_Desktop::updateActions()
-{
- myStdActions.at( FileCloseId )->setEnabled ( myActiveStudy != NULL );
- myStdActions.at( FileSaveId )->setEnabled ( myActiveStudy != NULL );
- myStdActions.at( FileSaveAsId )->setEnabled ( myActiveStudy != NULL );
- myStdActions.at( FilePropsId )->setEnabled( myActiveStudy != NULL );
-// myStdActions.at( HelpContentsId )->setEnabled ( myActiveApp != NULL );
-// myStdActions.at( HelpSearchId )->setEnabled ( myActiveApp != NULL );
-// myStdActions.at( HelpWhatsThisId )->setEnabled ( myActiveApp != NULL );
-// myStdActions.at( HelpAboutId )->setEnabled ( myActiveApp != NULL );
-
-// myToolsPopup.setEnabled ( myActiveStudy != NULL );
-// myPrefPopup.setEnabled ( myActiveStudy != NULL );
-
- mySelectionModePopup.setEnabled ( myActiveStudy != NULL );
-
- // VSR ==> SAL2982
- myStdActions.at( ViewOCCId )->setEnabled( myActiveStudy != NULL );
- myStdActions.at( ViewVTKId )->setEnabled( myActiveStudy != NULL );
- myStdActions.at( ViewPlot2dId )->setEnabled( myActiveStudy != NULL );
- // VSR <== SAL2982
-}
-
-/*!
- Called when 'Window' popup is about to show
-*/
-void QAD_Desktop::onWindowPopupAboutToShow()
-{
- /* add cascade/tile items */
- myWindowPopup.clear();
-
- //NRI : SAL2214
- //myStdActions.at( WindowNew3dId )->addTo( &myWindowPopup );
- myWindowPopup.insertItem( tr("MEN_DESK_WINDOW_NEW3D"), &myNewViewPopup, WindowNew3dId );
- //myStdActions.at( WindowNew3dId )->setEnabled( true );
- myWindowPopup.setItemEnabled( WindowNew3dId, true );
- //NRI : SAL2214
- myStdActions.at( WindowCascadeId )->addTo( &myWindowPopup );
- myStdActions.at( WindowCascadeId )->setEnabled( true );
- myStdActions.at( WindowTileId )->addTo( &myWindowPopup );
- myStdActions.at( WindowTileId )->setEnabled( true );
-
- /* add names of opened studies */
- QWidgetList windows = myWorkspace->windowList();
- if ( windows.isEmpty() )
- {
- //NRI : SAL2214 myStdActions.at( WindowNew3dId )->setEnabled( false );
- myWindowPopup.setItemEnabled( WindowNew3dId, false );
- //NRI : SAL2214
- myStdActions.at( WindowCascadeId )->setEnabled( false );
- myStdActions.at( WindowTileId )->setEnabled( false );
- }
- else
- {
- myWindowPopup.insertSeparator();
- for ( int i = 0; i < int(windows.count()); ++i )
- {
- int id = myWindowPopup.insertItem( windows.at(i)->caption(),
- this, SLOT( onWindowsPopupActivated( int ) ) );
- myWindowPopup.setItemParameter( id, i );
- myWindowPopup.setItemChecked( id, myWorkspace->activeWindow() == windows.at(i) );
- }
- QAD_ASSERT( connect( &myWindowPopup, SIGNAL(highlighted( int )), this,
- SLOT(onWindowsPopupStatusText( int )) ));
- }
-}
-
-/*!
- Called when the item with 'id' of 'Windows' popup
- is highlighted
-*/
-void QAD_Desktop::onWindowsPopupStatusText( int id )
-{
- int cascadeId = myWindowPopup.idAt( 1 );
- int tileId = myWindowPopup.idAt( 2 );
- if ( id == cascadeId || id == tileId )
- return;
- putInfo( tr("PRP_DESK_WINDOW_ACTIVATE") );
-}
-
-/*!
- Called when user wants to activate a child window with 'wid'
- in the main frame
-*/
-void QAD_Desktop::onWindowsPopupActivated( int wid )
-{
- QWidget* w = myWorkspace->windowList().at( wid );
- if ( w ) w->setFocus();
-}
-
-/*!
- Selects a file name when opening or saving files.
- The basic implementation just uses the standard
- Open/Save dialogs.
- Please redefine if another behaviour is required.
-*/
-QString QAD_Desktop::selectFileName ( bool open )
-{
- QAD_FileDlg* fd = new QAD_FileDlg( this, open, true, true );
-
- QString name = "";
- QString dir = "";
- QStringList filters;
-
- if (open) {
- // All the file types of the supported applications
- // can be opened
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next() )
- {
- filters += app->getStudyDescription() + " " + tr("DESK_FILES") + " " +
- "(*." + app->getStudyExtension() + ")";
- }
- }
- else {
- QAD_ASSERT_DEBUG_ONLY ( myActiveStudy );
- if (myActiveStudy) {
- // get file name of active study
- name = QAD_Tools::getFileNameFromPath ( myActiveStudy->getTitle() );
- // get path to the active study file
- dir = QAD_Tools::getDirFromPath ( myActiveStudy->getPath(), false );
- }
- QAD_ASSERT_DEBUG_ONLY ( !name.isNull() );
- // the file types supported by the active application
- filters += myActiveApp->getStudyDescription() + " " + tr("DESK_FILES") + " " +
- "(*." + myActiveApp->getStudyExtension() + ")" ;
- }
- if (!dir.isEmpty()) {
- // when saving document ("Save As" command) - to get dir from active study filename
- // for new documents - to use last opened directory
- fd->setDir( dir );
- }
- fd->setSelection( name );
- fd->setFilters( filters );
-
- fd->exec();
- QString filename = fd->selectedFile();
- delete fd;
- qApp->processEvents();
- return filename;
-}
-
-/*!
- Closes all the studies of 'app'. Returns
- 'true' if thay are closed OK, 'false' at least
- one can't be closed or user cancel the closure.
-*/
-bool QAD_Desktop::closeAllStudies( QAD_Application* app )
-{
- QList<QAD_Study>& studies = app->getStudies();
- while ( !studies.isEmpty() )
- {
- //don't ask user to remove study permanently
- if ( !onCloseStudy( studies.at(0), false ) )
- return false; /* user cancelled closing */
- }
- return true;
-}
-
-/*!
- Called on Popup item when SComponent representation in Object Browser is selected.
-*/
-void QAD_Desktop::onOpenWith()
-{
- Engines::Component_var comp;
- QString ComponentSelected;
-
- SALOMEDS::SObject_var SO;
- SALOMEDS::SComponent_var SCO;
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( Sel->IObjectCount() == 1 ) {
- Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
- SO = aStudy->FindObjectID( IO->getEntry() );
- SCO = SO->GetFatherComponent();
- char* name;
- if (SCO->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- name = aName->Value();
- if ( getComponentName( name ).isEmpty() )
- return;
- SALOME_ModuleCatalog::Acomponent_var Comp = myCatalogue->GetComponent( getComponentName(name) );
- if ( !Comp->_is_nil() ) {
-
- SALOME_ModuleCatalog::ListOfComponents_var list_type_composants =
- myCatalogue->GetTypedComponentList( Comp->component_type() );
-
- if ( list_type_composants->length() == 1 ) {
- ComponentSelected = name;
- } else if ( list_type_composants->length() > 1 ) {
- SALOMEGUI_OpenWith* aDlg = new SALOMEGUI_OpenWith( this );
- for (unsigned int ind = 0; ind < list_type_composants->length();ind++) {
- QString compusername = getComponentUserName( (char*)list_type_composants[ind] );
- if ( !compusername.isEmpty() )
- aDlg->addComponent( compusername );
- }
-
- int retVal = aDlg->exec();
- ComponentSelected = aDlg->getComponent();
- delete aDlg;
- if ( retVal == QDialog::Rejected || ComponentSelected.isEmpty()) {
- return;
- }
- } else {
- MESSAGE( "No component with type : " << Comp->component_type() << " exists" );
- return;
- }
-
- } else {
- MESSAGE( "This component not exists in the catalog" );
- return;
- }
-
- QApplication::setOverrideCursor( Qt::waitCursor );
- Sel->ClearIObjects();
-
-// if (loadComponentData(ComponentSelected)) {
- onComboActiveComponent(ComponentSelected);
-// int nbItem = myCombo->count();
-// int Index = 0;
-// for (int i = 0; i < nbItem; i++) {
-// if (myCombo->text(i).compare(ComponentSelected)==0) {
-// Index = i;
-// break;
-// }
-// }
-// myCombo->setCurrentItem(Index);
-// myActiveStudy->updateObjBrowser(true);
-// }
- }
- }
- QApplication::restoreOverrideCursor();
-}
-
-
-/*!
- Called to define settings of component.
-*/
-void QAD_Desktop::setSettings()
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI ) {
- QString Component = mapComponentName[myActiveComp];
- anActiveGUI->SetSettings( this, (char*)Component.latin1() );
- }
-}
-
-/*!
- Called to load Component : xml resources and GUI librairy.
-*/
-bool QAD_Desktop::loadComponent(QString Component)
-{
- if ( Component.isEmpty() ) {
- MESSAGE("loadComponent(): empty component name passed!")
- return false;
- }
-
- QAD_WaitCursor wc;
- QString resDir("/"); //NRI : Pb under Windows
-
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
- if ( resMgr ) {
- QString msg;
- if (!resMgr->loadResources( Component, msg ))
- {
- //NRI QCString errMsg;
- // errMsg.sprintf( "Do not load all resources for module %sGUI.\n" ,
- // Component.latin1() );
- wc.stop();
- QMessageBox::warning( this, tr("WRN_WARNING"), msg, tr ("BUT_OK") );
- return false;
- }
- }
-
- /* Parse xml file */
- myXmlHandler = new QAD_XmlHandler();
- myXmlHandler->setMainWindow(this);
- if (!myXmlHandler->setComponent(resMgr->resources( Component ))) return false;
-
- QString language = resMgr->language( Component );
-
- QString ComponentXml = Component + "_" + language + ".xml";
- //ComponentXml = resMgr->resources(Component + "GUI") ;
- //ComponentXml = QAD_Tools::addSlash(ComponentXml) ;
- ComponentXml = QAD_Tools::addSlash( resMgr->findFile( ComponentXml, Component ) ) + ComponentXml;
- QFile file( ComponentXml );
-
- if ( !file.exists() || !file.open( IO_ReadOnly ) ) {
- QString errMsg;
- errMsg.sprintf( "Cannot open xml file: %s\n.",
- (file.name()).latin1() );
- wc.stop();
- QMessageBox::critical( this, tr("ERR_ERROR"), errMsg, tr ("BUT_OK") );
- return false;
- }
- file.close();
-
- QXmlInputSource source( file );
- QXmlSimpleReader reader;
- reader.setContentHandler( myXmlHandler );
- reader.setErrorHandler( myXmlHandler );
-
- bool IsMaxActStudy = myActiveStudy->getActiveStudyFrame()->isMaximized();
- if (IsMaxActStudy) {
- QString aSourceData = source.data();
- aSourceData = changeXmlInputSourceData( aSourceData, Component );
- source.setData(aSourceData);
- }
-
- bool ok = reader.parse( source );
- file.close();
- if ( !ok ) {
- wc.stop();
- QMessageBox::critical( this,
- tr( "INF_PARSE_ERROR" ),
- tr( myXmlHandler->errorProtocol() ) );
- return false;
- }
-
- myMenusList=myXmlHandler->myMenusList;
- myActiveMenus=myMenusList.at(0);
- myOperatorMenus->showMenuBar(0);
- myActiveMenus->showAllToolBars();
-
- /* Components toolbars */
- int nbToolbars = 0;
- if (myActiveMenus)
- nbToolbars = myActiveMenus->getToolBarList().count();
-
- /* COMPONENT INTERFACE */
- SALOME_ModuleCatalog::Acomponent_ptr aComponent =
- myCatalogue->GetComponent(Component.latin1());
-
- if (CORBA::is_nil (aComponent)) {
- MESSAGE( "Catalog Error : Component not found in the catalog" )
- return false;
- }
-
- myActiveStudy->setMessage(QString("Component : ") +
- aComponent->componentusername() + " created " );
- myActiveStudy->setMessage(QString("Type : ") +
- QString::number(aComponent->component_type()));
- myActiveStudy->setMessage(QString("Constraint : ") +
- aComponent->constraint() );
-
- /* obtain interfaces list of the component */
- SALOME_ModuleCatalog::ListOfInterfaces_var _list =
- new SALOME_ModuleCatalog::ListOfInterfaces;
- _list = aComponent->GetInterfaceList();
-
- if (_list->length() != 0 ) {
-
- for (unsigned int ind = 0; ind < _list->length();ind++)
- myActiveStudy->setMessage( QString("Interface name : ") +
- _list[ind] );
-
-
- /* obtain services list of the component */
- SALOME_ModuleCatalog::ListOfServices_var list_services_component =
- new SALOME_ModuleCatalog::ListOfServices;
- list_services_component = aComponent->GetServiceList(_list[0]);
-
- if (list_services_component->length() != 0 ) {
-
- for (unsigned int ind = 0; ind < list_services_component->length();ind++)
- myActiveStudy->setMessage( QString("Service name : ") +
- list_services_component[ind] );
-
- // Get a service of the component
- SALOME_ModuleCatalog::Service_var service = new SALOME_ModuleCatalog::Service;
- service = aComponent->GetService(_list[0],list_services_component[0]) ;
- myActiveStudy->setMessage( QString("Service name: ") + service->ServiceName);
- for (unsigned int ind1 = 0; ind1 <service->ServiceinParameter.length();ind1++) {
- myActiveStudy->setMessage( QString("Type of the in Parameter of this service : ") +
- (const char *) service->ServiceinParameter[ind1].Parametertype);
- myActiveStudy->setMessage( QString("Name of the in Parameter of this service : ") +
- (const char *) service->ServiceinParameter[ind1].Parametername);
- }
- for (unsigned int ind1 = 0; ind1 <service->ServiceoutParameter.length();ind1++) {
- myActiveStudy->setMessage( QString("Type of the out Parameter of this service : ") +
- (const char *) service->ServiceoutParameter[ind1].Parametertype);
- myActiveStudy->setMessage( QString("Name of the out Parameter of this service : ") +
- (const char *) service->ServiceoutParameter[ind1].Parametername);
- }
- }
- }
- return true;
-}
-
-QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theComponent)
-{
- // MESSAGE ( " changeXmlInputSourceData : " << theComponent.latin1() )
- if ( theComponent=="SUPERV" ) {
- //Supervision main menu item
- int aItemId = 300;
- int aPosId = 3;
- QString aStrOld = createString( aItemId, aPosId );
- QString aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
- }
-
- if ( theComponent == "VISU" ) {
- //Visualization main menu item
- int aItemId = 401;
- int aPosId = 3;
- QString aStrOld = createString( aItemId, aPosId );
- QString aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Selection main menu item
- aItemId = 41;
- aPosId = 4;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Representation main menu item
- aItemId = 42;
- aPosId = 5;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
- }
-
- if ( theComponent == "SMESH" ) {
- //Hypotheses main menu item
- int aItemId = 50;
- int aPosId = 3;
- QString aStrOld = createString( aItemId, aPosId );
- QString aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Mesh main menu item
- aItemId = 70;
- aPosId = 4;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Controls main menu item
- aItemId = 60;
- aPosId = 5;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Modification main menu item
- aItemId = 40;
- aPosId = 6;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Numbering main menu item
-// aItemId = 80;
-// aPosId = 7;
-// aStrOld = createString( aItemId, aPosId );
-// aStrNew = createString( aItemId, aPosId+1 );
-// theData = theData.replace( QRegExp(aStrOld), aStrNew );
- }
-
- if ( theComponent == "GEOM" ) {
- //New Entity main menu item
- int aItemId = 40;
- int aPosId = 3;
- QString aStrOld = createString( aItemId, aPosId );
- QString aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Operations main menu item
- aItemId = 50;
- aPosId = 4;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Repair main menu item
- aItemId = 60;
- aPosId = 5;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
-
- //Measures main menu item
- aItemId = 70;
- aPosId = 6;
- aStrOld = createString( aItemId, aPosId );
- aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
- }
-
- if ( theComponent == "MED" ) {
- //MED main menu item
- int aItemId = 90;
- int aPosId = 3;
- QString aStrOld = createString( aItemId, aPosId );
- QString aStrNew = createString( aItemId, aPosId+1 );
- theData = theData.replace( QRegExp(aStrOld), aStrNew );
- }
-
- return theData;
-}
-
-typedef bool OneDim(int, QAD_Desktop*);
-typedef void (*PTR_FACTORY_FUNCTION)( CORBA::ORB_var &orb, QWidget *parent, const char *name ) ;
-
-/*!
- */
-void QAD_Desktop::onDispatch()
-{
- const QObject* obj = sender();
-
- QList<QAD_ListMenuIdAction> MenuList = myActiveMenus->getMenuList();
- QAD_ListMenuIdAction* aMenu;
- int id = -1;
- for(aMenu=MenuList.first();aMenu!=NULL;aMenu=MenuList.next()) {
- if (aMenu->getAction()==obj) {
- id = aMenu->getId();
- break;
- }
- }
- onDispatch(id);
-}
-
-/*!
- */
-void QAD_Desktop::onDispatchTools(int id)
-{
- /* Open Shared Library */
- OSD_SharedLibrary ToolsLibrary = OSD_SharedLibrary();
-
- QString ToolsLib;
- QCString dir;
- QFileInfo fileInfo ;
- bool found = false;
-
- bool libToolsGUI = true;
- if( QAD_XmlHandler::_bibmap[ id ].isEmpty() )
- {
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libToolsGUI.dll" ;
-#else
- dir = dir + "libToolsGUI.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
- }
- else {
- libToolsGUI = false;
- SCRUTE( QAD_XmlHandler::_bibmap[ id ] ) ;
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + QAD_XmlHandler::_bibmap[ id ].latin1() ;
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ToolsLib = fileInfo.fileName() ;
- found = true;
- }
- }
- }
-
- ToolsLibrary.SetName(TCollection_AsciiString((char*)ToolsLib.latin1()).ToCString());
- bool ok = ToolsLibrary.DlOpen(OSD_RTLD_LAZY);
- if (ok) {
- if ( libToolsGUI ) {
- OSD_Function osdF = ToolsLibrary.DlSymb("OnGUIEvent");
- OneDim (*f1) = NULL;
- f1 = (bool (*) (int, QAD_Desktop*)) osdF;
- (*f1)(id,this);
- } else {
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0 , 0 ) ;
- OSD_Function osdF = ToolsLibrary.DlSymb("OnGUIEvent");
- PTR_FACTORY_FUNCTION f1 = NULL;
- f1 = (PTR_FACTORY_FUNCTION) osdF;
- f1(orb,0,"Registry");
- }
- } else {
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr( ToolsLibrary.DlError() ) );
- }
-}
-
-/*!
- */
-void QAD_Desktop::onDispatch(int id)
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->OnGUIEvent(id,this);
-}
-
-/*!
- Returns the component's catalogue
-*/
-SALOME_ModuleCatalog::ModuleCatalog_var QAD_Desktop::getCatalogue()
-{
- return myCatalogue;
-}
-
-/*!
- */
-void QAD_Desktop::onComboActiveComponent( const QString & component ){
- onComboActiveComponent(component,true);
-}
-void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoadData)
-{
- if (myActiveStudy != 0) {
- if (myActiveComp.compare(component)!=0) {
- // deactivate previous component
- deactivateComponent();
-
- if (!myXmlHandler->myIdList.IsEmpty()) clearMenus();
- if ( myCombo->currentText() != component )
- myCombo->setCurrentText( component );
- //NRI if (component.compare(QString("Salome"))!= 0) {
- if (component.compare( getComponentUserName( "KERNEL" ) )!= 0) {
-// QApplication::setOverrideCursor( Qt::waitCursor );
- bool isOk = ( !isLoadData || loadComponentData( getComponentName(component) ) );
- if ( !isOk ) {
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_COMP_DATA_NOT_LOADED").arg( component ),
- tr("BUT_OK") );
- }
-
- if ( !isOk || !loadComponent( getComponentName(component) ) ) {
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- }
- myActiveComp = "";
- return;
- }
-
- myActiveComp = component;
-
- SALOME_Selection* oldSel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- if ( aButton->textLabel().compare(component)==0)
- aButton->setOn(true);
- else
- aButton->setOn(false);
- }
-
- myActiveStudy->Selection( component );
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( oldSel->StoredIObjects() );
- for(;It.More();It.Next()) {
- int res = Sel->AddIObject( It.Value() );
-
- if ( res == -1 )
- myActiveStudy->highlight( It.Value(), false );
- if ( res == 0 )
- myActiveStudy->highlight( It.Value(), true );
-
- }
-
- oldSel->Clear();
-
- /* SETTINGS */
- // IMPORTANT: SetSettings() should be called AFTER SALOME_Selection
- // has been created for a newly activated component
- getComponentGUI(component)->SetSettings( this, (char*)getComponentName(component).latin1() );
-
- myActiveStudy->updateObjBrowser(true);
-
-// QApplication::restoreOverrideCursor();
-
- } else { // component == "Salome"
- myActiveComp = "";
- //NRI myActiveStudy->Selection( "Salome" );
- myActiveStudy->Selection( getComponentUserName( "KERNEL" ) );
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- Sel->ClearIObjects();
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- }
- }
- } else {
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- if ( aButton->textLabel().compare(component)==0)
- aButton->setOn(true);
- }
- }
- } else if (component.compare(QString("Salome"))!= 0) {
-
- QPixmap pm;
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- if ( aButton->textLabel().compare( component ) == 0 )
- pm = aButton->iconSet().pixmap();
- }
- SALOMEGUI_ActivateComponentDlg aDlg( this, component, pm );
- int res = aDlg.exec();
-
- switch ( res )
- {
- case 1:
- onNewStudy();
- onComboActiveComponent(component,true);
- break;
- case 2:
- onOpenStudy();
- onComboActiveComponent(component,true);
- break;
- case 3:
- onLoadStudy();
- onComboActiveComponent(component,true);;
- break;
- case 0:
- default:
- putInfo( tr("INF_CANCELLED") );
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- // return;
- }
- }
- }
-}
-
-/*!
- */
-void QAD_Desktop::activateComponent(const QString& theName, bool isLoadData){
-
- int nbItem = myCombo->count();
- int Index = 0;
-
- for (int i = 0; i < nbItem; i++) {
- if (myCombo->text(i).compare(theName)==0) {
- Index = i;
- break;
- }
- }
- myCombo->setCurrentItem (Index);
- onComboActiveComponent(theName,isLoadData);
-};
-
-void QAD_Desktop::onButtonActiveComponent( )
-{
- QToolButton* obj = (QToolButton*)sender();
- activateComponent(obj->textLabel());
-}
-
-/*!
- Clears All Resources of current component
- */
-void QAD_Desktop::clearMenus()
-{
- // san - commented as presumably obsolete
- // onActiveStudyChanged();
-
- /* menus */
- myMenusList.clear();
- if (myXmlHandler) {
- int length = myXmlHandler->myIdList.Length();
- for (int k=length; k>0; k--) {
- QMenuData* parent;
- if ( menuBar()->findItem(myXmlHandler->myIdList.Value(k), &parent) )
- parent->removeItem( myXmlHandler->myIdList.Value(k) );
- }
- }
-
- /* toolbars */
- if (myActiveMenus) {
- int nbtoolbars = myActiveMenus->getToolBarList().count();
- for (int k=0; k<nbtoolbars; k++) {
- myActiveMenus->getToolBarList().at(k)->hide();
- myActiveMenus->getToolBarList().at(k)->clear();
- }
- myActiveMenus->clearToolBar();
-
- /* popups */
- QList<QAD_ListPopupMenu> PopupList = myActiveMenus->getPopupMenuList();
- QAD_ListPopupMenu* aPopup;
- for(aPopup=PopupList.first();aPopup!=NULL;aPopup=PopupList.next()){
- aPopup->getPopup()->clear();
-
- }
- myActiveMenus->clearPopupMenu();
-
- }
- myActiveComp = "";
-}
-
-typedef bool TwoDim1(QKeyEvent* pe, QAD_Desktop*, QAD_StudyFrame*);
-/*!
- Exports Key Events in active component ( GUI Librairy )
- */
-void QAD_Desktop::onKeyPress( QKeyEvent* pe )
-{
- // MESSAGE ( "QAD_Desktop::onKeyPress" )
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->OnKeyPress(pe,this,myActiveStudy->getActiveStudyFrame());
-}
-
-typedef bool TwoDim(QMouseEvent* pe, QAD_Desktop*, QAD_StudyFrame*);
-/*!
- Exports Mouse Press Events in active component ( GUI Librairy )
- */
-bool QAD_Desktop::onMousePress( QMouseEvent* pe )
-{
- // MESSAGE ( "QAD_Desktop::onMousePress" )
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- return anActiveGUI->OnMousePress(pe,this,myActiveStudy->getActiveStudyFrame());
- return false;
-}
-
-/*!
- Exports Mouse Move Events in active component ( GUI Librairy )
- */
-void QAD_Desktop::onMouseMove( QMouseEvent* pe )
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->OnMouseMove(pe,this,myActiveStudy->getActiveStudyFrame());
-}
-
-/*!
- Returns name of active component
-*/
-const QString& QAD_Desktop::getActiveComponent() const
-{
- return myActiveComp;
-}
-
-SALOMEGUI* QAD_Desktop::getActiveGUI()
-{
- SALOMEGUI* anActiveGUI = 0;
- if ( myComponents.find( myActiveComp ) != myComponents.end() )
- anActiveGUI = myComponents[myActiveComp];
- return anActiveGUI;
-}
-
-typedef SALOMEGUI* (*ComponentGUI)();
-
-SALOMEGUI* QAD_Desktop::getComponentGUI( const QString& component )
-{
- SALOMEGUI* aCompGUI = 0;
- if ( component.isEmpty() || getComponentName( component ).isEmpty() )
- return aCompGUI;
-
- // Load component GUI if requested for the first time
- if ( myComponents.find( component ) == myComponents.end() ) {
- OSD_SharedLibrary aSharedLibrary;
- QString ComponentLib;
- QCString libs;
- QFileInfo fileInfo ;
- QString fileString ;
- QString dir;
-
- QAD_WaitCursor wc;
-
- _islibso= false;
-
- if ( libs = getenv("LD_LIBRARY_PATH")) {
- // MESSAGE ( " LD_LIBRARY_PATH : " << libs );
- QStringList dirList = QStringList::split( SEPARATOR, libs, false ); // skip empty entries
- for ( int i = dirList.count()-1; i >= 0; i-- ) {
- dir = dirList[ i ];
-#ifdef WNT
- fileString = QAD_Tools::addSlash( dir ) + "lib" + getComponentName( component ) + "GUI.dll" ;
-#else
- fileString = QAD_Tools::addSlash( dir ) + "lib" + getComponentName( component ) + "GUI.so" ;
-#endif
-
- fileInfo.setFile(fileString) ;
- if (fileInfo.exists()) {
- // MESSAGE( " GUI library = " << fileString.latin1() );
- ComponentLib = fileInfo.fileName() ;
- _islibso = true;
- break;
- }
- }
- }
-
- if (!_islibso) // component GUI could be in PyQt, use generic library
- {
- MESSAGE("GUI library not found, trying generic library for PyQt GUI");
- bool found = false;
- if (dir = getenv("KERNEL_ROOT_DIR"))
- {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libSalomePyQtcmodule.dll" ;
-#else
- dir = dir + "libSalomePyQtcmodule.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists())
- {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- }
- }
- if ( !found )
- {
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr("ERR_LIBGUI" ).arg(component) );
- return aCompGUI;
- }
- }
-
- aSharedLibrary.SetName(TCollection_AsciiString((char*)ComponentLib.latin1()).ToCString());
- bool ok = aSharedLibrary.DlOpen(OSD_RTLD_LAZY);
- if (!ok) {
- wc.stop();
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr( aSharedLibrary.DlError() ) );
- return aCompGUI;
- }
-
- OSD_Function osdF = aSharedLibrary.DlSymb("GetComponentGUI");
- if ( osdF != NULL ) {
- ComponentGUI f1 = (SALOMEGUI* (*) ()) osdF;
- SALOMEGUI* aCompGUI = (*f1)();
- if ( aCompGUI )
- myComponents.insert( component, aCompGUI );
- else {
- wc.stop();
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr("ERR_GET_GUI_FAILED" ).arg(component) );
- return aCompGUI;
- }
- }
- else {
- wc.stop();
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr("ERR_GET_GUI_NOT_FOUND" ).arg(ComponentLib) );
- return aCompGUI;
- }
- }
- aCompGUI = myComponents[component];
- return aCompGUI;
-}
-
-
-/*!
- Returns name of active component
-*/
-QString QAD_Desktop::getComponentDataType() const
-{
- using namespace SALOMEDS;
- Study_var aStudy = getActiveStudy()->getStudyDocument();
- SObject_var aSObject = aStudy->FindObject(myActiveComp.latin1());
- SComponent_var aComponent = SComponent::_narrow(aSObject);
- if(!aComponent->_is_nil()){
- CORBA::String_var aString = aComponent->ComponentDataType();
- return aString.in();
- }
- return "";
-}
-
-void QAD_Desktop::definePopup(QString & theContext,
- QString & theParent,
- QString & theObject )
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->DefinePopup(theContext, theParent, theObject);
-}
-
-
-/*!
- Copy popup menu [ static ]
-*/
-static void makePopup( QPopupMenu* popup, QPopupMenu* fromPopup, QAD_Desktop* receiver )
-{
- // safe check
- if ( !popup || !fromPopup )
- return;
- // iterator through all popup items
- for ( int i = fromPopup->count()-1; i >= 0; i-- ) {
- int cmdId = fromPopup->idAt( i );
- QMenuItem* item = fromPopup->findItem( cmdId );
- if ( item ) {
- // if item is a separator
- if ( item->isSeparator() ) {
- popup->insertSeparator( 0 );
- }
- else {
- QIconSet* iconSet = item->iconSet();
- QKeySequence accel = fromPopup->accel( cmdId );
-
- QPopupMenu* popupChild = item->popup();
- // if item is a popup
- if ( popupChild && popupChild != fromPopup ) {
- QPopupMenu* newPopup = new QPopupMenu( popup );
- if ( iconSet )
- popup->insertItem( *iconSet, item->text(), newPopup, cmdId, 0 );
- else
- popup->insertItem( item->text(), newPopup, cmdId, 0 );
- makePopup( newPopup, popupChild, receiver );
- }
- // if item is a command
- else {
- if ( iconSet )
- popup->insertItem( *iconSet, item->text(), cmdId, 0 );
- else
- popup->insertItem( item->text(), cmdId, 0 );
- popup->connectItem( cmdId, receiver, SLOT( onDispatch( int ) ) );
- }
- popup->setAccel( accel, cmdId );
- }
- }
- }
-}
-
-/*!
- Create popup
-*/
-void QAD_Desktop::createPopup(QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject )
-{
- if ( !myActiveComp.isEmpty() &&
- getOperatorMenus()->createPopupMenu(theContext,theParent,theObject) != NULL ) {
- makePopup( popup, getOperatorMenus()->createPopupMenu(theContext,theParent,theObject)->getPopup(), this );
- }
- // IAPP Popup
- // Should be moved to SALOMEGUI_Application::onCreatePopup()...
- if ( myActiveComp.isEmpty() ) {
- popup->removeItem(QAD_Display_Popup_ID);
- popup->removeItem(QAD_DisplayOnly_Popup_ID);
- popup->removeItem(QAD_Erase_Popup_ID);
- int id = popup->idAt(popup->count()-1); // last item
- if (id < 0 && id != -1) popup->removeItem(id); // separator
-
- if ( popup && theParent.compare("ObjectBrowser")==0 ) {
- if ( popup->count()>0 ) {
- popup->insertItem (tr ("MEN_OPENWITH"), this, SLOT(onOpenWith()), 0, -1, 2);
- popup->insertSeparator (3);
- }
- else {
- popup->insertItem (tr ("MEN_OPENWITH"), this, SLOT(onOpenWith()) );
- }
- }
- }
-
-}
-
-void QAD_Desktop::onActiveStudyChanged()
-{
- // Avoid recursive calls caused by QAD_MessageBox
- static bool isRecursion = false;
- if ( isRecursion || myAboutToClose )
- return;
-
- if (myActiveComp != "") {
- // Try to load active component's data in the activated study
- if ( !loadComponentData(mapComponentName[myActiveComp]) ) {
- isRecursion = true;
- QAD_MessageBox::error1( this,
- tr("ERR_ERROR"),
- tr("ERR_COMP_DATA_NOT_LOADED").arg( myActiveComp ),
- tr("BUT_OK") );
- // Error while loading component's data -> deactivate it
- deactivateComponent();
- if (!myXmlHandler->myIdList.IsEmpty()) clearMenus();
- myCombo->setCurrentItem (0);
- for ( QToolButton* aButton=myComponentButton.first(); aButton; aButton=myComponentButton.next() ) {
- aButton->setOn(false);
- }
- myActiveComp = "";
- isRecursion = false;
- return;
- }
- else
- myActiveStudy->updateObjBrowser(true);
- }
-
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->ActiveStudyChanged(this);
-}
-
-void QAD_Desktop::deactivateComponent()
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->Deactivate();
-}
-
-/*!
- Custom popup ( GUI Library )
-*/
-void QAD_Desktop::customPopup(QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject)
-{
- SALOMEGUI* anActiveGUI = getActiveGUI();
- if ( anActiveGUI )
- anActiveGUI->CustomPopup(this, popup, theContext, theParent, theObject);
-}
-
-void QAD_Desktop::onObjectBrowser()
-{
- bool checkDiff = false;
-
- bool state = QAD_CONFIG->getSetting("ObjectBrowser:AddColumn").compare("true") == 0;
-
- if ( myStdActions.at( PrefObjectBrowserEntryId )->isOn() != state )
- checkDiff = true;
-
- bool showEntry;
- if ( myStdActions.at( PrefObjectBrowserEntryId )->isOn() ) {
- showEntry = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:AddColumn", "true");
- } else {
- showEntry = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:AddColumn", "false");
- }
-
- bool showValue;
- if ( myStdActions.at( PrefObjectBrowserValueId )->isOn() ) {
- showValue = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:ValueColumn", "true");
- } else {
- showValue = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:ValueColumn", "false");
- }
-
- bool showIAPP;
- if ( myStdActions.at( PrefObjectBrowserIAPPId )->isOn() ) {
- showIAPP = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:IAPP", "true");
- } else {
- showIAPP = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:IAPP", "false");
- }
-
- /* To sort created object in chrono order or reverse chrono order */
- bool showCHRONO_SORT ;
- if ( myStdActions.at( PrefObjectBrowserCHRONO_SORTId )->isOn() ) {
- showCHRONO_SORT = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "true");
- } else {
- showCHRONO_SORT = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "false");
- }
-
- /* To show or not to show UseCase browser */
- bool showUseCase;
- if ( myStdActions.at( PrefObjectBrowserShowUseCaseId )->isOn() ) {
- showUseCase = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "true");
- } else {
- showUseCase = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "false");
- }
-
- /* Resize or don't resize columns automatically */
- bool autoSize;
- if ( myStdActions.at( PrefObjectBrowserNoAutoSizeColumnsId )->isOn() ) {
- autoSize = false;
- QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "true");
- } else {
- autoSize = true;
- QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "false");
- }
-
- if ( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = study->getStudyFrame(i);
- sf->getLeftFrame()->getObjectBrowser()->setShowInfoColumns( showEntry );
- sf->getLeftFrame()->getObjectBrowser()->setShowValueColumn( showValue );
- sf->getLeftFrame()->getObjectBrowser()->setEnableChronoSort( showCHRONO_SORT );
-// sf->getLeftFrame()->getObjectBrowser()->setShowIAPP( showIAPP ); // this is done by below updateObjBrowser() call
- sf->getLeftFrame()->getObjectBrowser()->showUseCaseBrowser( showUseCase );
- sf->getLeftFrame()->getObjectBrowser()->autoSizeColumns( autoSize );
- }
- study->updateObjBrowser(true);
- }
- }
-}
-
-void QAD_Desktop::onViewerTrihedron()
-{
- QString Size = QAD_CONFIG->getSetting("Viewer:TrihedronSize");
- float dim;
-
- SALOMEGUI_TrihedronSizeDlg *Dlg = new SALOMEGUI_TrihedronSizeDlg(this);
- if (!Size.isEmpty())
- Dlg->setTrihedronSize(Size.toInt());
- int r = Dlg->exec();
- dim = Dlg->getTrihedronSize();
- delete Dlg;
-
- if (r == QDialog::Accepted) {
- QAD_CONFIG->addSetting("Viewer:TrihedronSize", dim);
-
- if( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- study->getStudyFrame(i)->getRightFrame()->getViewFrame()->onAdjustTrihedron();
- }
- }
- }
- }
-}
-
-void QAD_Desktop::onExternalBrowser()
-{
-
- QString theApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
- QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
-
- SALOMEGUI_ExternalBrowserDlg *Dlg = new SALOMEGUI_ExternalBrowserDlg(this);
-
- if (!theApp.isEmpty())
- {
- QString theParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
- Dlg->setSettings(theApp, theParams);
- }
- int r = Dlg->exec();
- QString theAppFromDialog = Dlg->getApp();
- QString theParamsFromDialog = Dlg->getParams();
- delete Dlg;
-
- if (r == QDialog::Accepted)
- {
- QAD_CONFIG->addSetting("ExternalBrowser:Application", theAppFromDialog );
- QAD_CONFIG->addSetting("ExternalBrowser:Parameters", theParamsFromDialog );
- }
-
-}
-
-
-void QAD_Desktop::onDirList()
-{
- // getting dir list from settings
- QStringList dirList = QStringList::split(';', QAD_CONFIG->getSetting("FileDlg:QuickDirList"), false);
- QAD_DirListDlg* dlg = new QAD_DirListDlg(this);
- dlg->setPathList(dirList);
- if ( dlg->exec() == QDialog::Accepted) {
- dlg->getPathList(dirList);
- QAD_CONFIG->addSetting("FileDlg:QuickDirList", dirList.join(";"));
- }
- delete dlg;
-}
-
-void QAD_Desktop::onConsoleFontAction()
-{
- // getting font from settings
- QString fntSet = QAD_CONFIG->getSetting("Viewer:ConsoleFont");
- QFont font = QAD_Tools::stringToFont( fntSet );
- bool bOk;
- font = QFontDialog::getFont( &bOk, font, this );
- if ( bOk ) {
- fntSet = QAD_Tools::fontToString( font );
- QAD_CONFIG->addSetting("Viewer:ConsoleFont", fntSet );
-
- if( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- study->getStudyFrame(i)->getRightFrame()->getPyEditor()->setFont( font );
- study->getStudyFrame(i)->getRightFrame()->getMessage()->setFont( font );
- }
- }
- }
- }
-}
-
-void QAD_Desktop::onSavePref()
-{
- QAD_CONFIG->createConfigFile(true);
-}
-
-//VRV: T2.5 - add default viewer
-void QAD_Desktop::onDefaultViewer(QActionP * theAction)
-{
- int type = VIEW_TYPE_MAX;
-
- QString myValue;
- if (myStdActions.at(DefaultViewerOCCId) == theAction)
- type = VIEW_OCC;
- else if (myStdActions.at(DefaultViewerVTKId) == theAction)
- type = VIEW_VTK;
- else if (myStdActions.at(DefaultGraphSupervisorId) == theAction)
- type = VIEW_GRAPHSUPERV;
- else if (myStdActions.at(DefaultPlot2dId) == theAction)
- type = VIEW_PLOT2D;
- if ( type != VIEW_TYPE_MAX )
- QAD_CONFIG->addSetting( "Viewer:DefaultViewer", QString::number( type ) );
-}
-//VRV: T2.5 - add default viewer
-
-void QAD_Desktop::onViewerOCC()
-{
- QString BackgroundColorRed = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorRed");
- QString BackgroundColorGreen = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorGreen");
- QString BackgroundColorBlue = QAD_CONFIG->getSetting("OCCViewer:BackgroundColorBlue");
- QColor color;
-
- if( !BackgroundColorRed.isEmpty() && !BackgroundColorGreen.isEmpty() && !BackgroundColorBlue.isEmpty() )
- color = QColor(BackgroundColorRed.toInt(),
- BackgroundColorGreen.toInt(),
- BackgroundColorBlue.toInt());
- else
- color = QColor(35, 136, 145);
-
- QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
-
- if (c.isValid()) {
- /* VSR : PAL5420 ---------------------------------------------------
- if ( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = study->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_OCC ) {
- sf->getRightFrame()->getViewFrame()->setBackgroundColor( c );
- }
- }
- }
- }
- VSR : PAL5420 --------------------------------------------------- */
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorRed", c.red() );
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorGreen", c.green() );
- QAD_CONFIG->addSetting( "OCCViewer:BackgroundColorBlue", c.blue() );
- }
-}
-
-void QAD_Desktop::onGraphSupervisor()
-{
- QString BackgroundColorRed = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed");
- QString BackgroundColorGreen = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen");
- QString BackgroundColorBlue = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue");
- QColor color;
-
- if( !BackgroundColorRed.isEmpty() && !BackgroundColorGreen.isEmpty() && !BackgroundColorBlue.isEmpty() )
- color = QColor(BackgroundColorRed.toInt(),
- BackgroundColorGreen.toInt(),
- BackgroundColorBlue.toInt());
- else
- color = QColor(35, 136, 145);
-
- QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
-
- if (c.isValid()) {
- /* VSR : PAL5420 ---------------------------------------------------
- if ( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = study->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_GRAPHSUPERV ) {
- sf->getRightFrame()->getViewFrame()->setBackgroundColor( c );
- }
- }
- }
- }
- VSR : PAL5420 --------------------------------------------------- */
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorRed", c.red() );
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorGreen", c.green() );
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorBlue", c.blue() );
- }
-}
-
-void QAD_Desktop::onViewerVTK()
-{
- QString BackgroundColorRed = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
- QString BackgroundColorGreen = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorGreen");
- QString BackgroundColorBlue = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorBlue");
- QColor color;
-
- if( !BackgroundColorRed.isEmpty() && !BackgroundColorGreen.isEmpty() && !BackgroundColorBlue.isEmpty() )
- color = QColor(BackgroundColorRed.toInt(),
- BackgroundColorGreen.toInt(),
- BackgroundColorBlue.toInt());
- else
- color = QColor(0, 0, 0);
-
- QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() );
-
- if (c.isValid()) {
- /* VSR : PAL5420 ---------------------------------------------------
- if ( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = study->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_VTK ) {
- sf->getRightFrame()->getViewFrame()->setBackgroundColor( c );
- }
- }
- }
- }
- VSR : PAL5420 --------------------------------------------------- */
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorRed", c.red() );
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", c.green() );
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue", c.blue() );
- }
-}
-
-void QAD_Desktop::onPlot2d()
-{
- QColor color;
- if ( QAD_CONFIG->hasSetting( "Plot2d:Background" ) ) {
- QString bgString = QAD_CONFIG->getSetting( "Plot2d:Background" );
- QStringList bgData = QStringList::split( ":", bgString, true );
- int bgRed = 0, bgGreen = 0, bgBlue = 0;
- if ( bgData.count() > 0 ) bgRed = bgData[ 0 ].toInt();
- if ( bgData.count() > 1 ) bgGreen = bgData[ 1 ].toInt();
- if ( bgData.count() > 2 ) bgBlue = bgData[ 2 ].toInt();
- color = QColor( bgRed, bgGreen, bgBlue );
- }
- else {
- color = QColor(255, 255, 255);
- }
-
- color = QColorDialog::getColor( color, QAD_Application::getDesktop() );
-
- if ( color.isValid() ) {
- /* VSR : PAL5420 ---------------------------------------------------
- if ( myActiveApp ) {
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- int nbSf = study->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = study->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_PLOT2D ) {
- sf->getRightFrame()->getViewFrame()->setBackgroundColor( color );
- }
- }
- }
- }
- VSR : PAL5420 --------------------------------------------------- */
- QStringList bgData;
- bgData.append( QString::number( color.red() ) );
- bgData.append( QString::number( color.green() ) );
- bgData.append( QString::number( color.blue() ) );
- QAD_CONFIG->addSetting( "Plot2d:Background", bgData.join( ":" ) );
- }
-}
-
-/* Help About */
-void QAD_Desktop::helpAbout()
-{
- SALOMEGUI_AboutDlg* About = new SALOMEGUI_AboutDlg( QAD_Application::getDesktop(), tr("MEN_ABOUT"));
- About->exec();
- delete About;
-}
-
-// /* Help Search */
-// void QAD_Desktop::helpSearch()
-// {
-// }
-
-// /* Help Contents */
-// void QAD_Desktop::helpContents()
-// {
-// if (myActiveComp == "")
-// myActiveComp = getComponentUserName( "KERNEL" ); //NRI "Salome";
-
-// QCString dir;
-// QString root;
-// if (dir = getenv( getComponentName( myActiveComp ) + "_ROOT_DIR")) {
-// root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// else {
-// root = QAD_Tools::addSlash( root + "html" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// else {
-// root = QAD_Tools::addSlash( root + "html" );
-// if ( QFileInfo( root + "index.html" ).exists() ) {
-// helpContext( root + "index.html", "" );
-// }
-// }
-// }
-// }
-
-// // //NRI getHelpWindow()->contents();
-// // getHelpWindow()->show();
-// // getHelpWindow()->raise();
-// // getHelpWindow()->setActiveWindow();
-// }
-
-/* Help Context */
-//void QAD_Desktop::helpContext(const QString& source, const QString& context)
-//{
-// //getHelpWindow()->context(source, context); //implemented in QAD_HelpWindow::context( const QString& _source, const QString& _context)
-// //getHelpWindow()->show(); //from QMainWindow class
-// //getHelpWindow()->raise(); //from QMainWindow class
-// //getHelpWindow()->setActiveWindow(); //from QMainWindow class
-
-// QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application");
-// QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters");
-
-// RunBrowser* rs = new RunBrowser(anApp, aParams, source, context);
-// rs->start();
-//}
-
-/* Preferences/MultiFile Save */
-void QAD_Desktop::onMultiFileSave()
-{
- if ( myStdActions.at( PrefMultiFileSave )->isOn() )
- QAD_CONFIG->addSetting( "Desktop:MultiFileSave", "true");
- else
- QAD_CONFIG->addSetting( "Desktop:MultiFileSave", "false");
-}
-
-/* Preferences/ASCII Save */
-void QAD_Desktop::onASCIISave()
-{
- if ( myStdActions.at( PrefASCIISave )->isOn() )
- QAD_CONFIG->addSetting( "Desktop:ASCIISave", "true");
- else
- QAD_CONFIG->addSetting( "Desktop:ASCIISave", "false");
-}
-
-/* Preferences / Undo Level */
-void QAD_Desktop::onUndoLevel()
-{
- static int MAX_UNDO_LEVEL = 1000;
- bool isAccepted = false;
- static QString aLabel = QString("Level value (%1 ... %2) : ").
- arg(1).arg(MAX_UNDO_LEVEL);
- int anUndoLevel =
- SALOMEGUI_SetValueDlg::getInteger("Undo Level",aLabel,
- 1,MAX_UNDO_LEVEL,getUndoLevel(),
- &isAccepted);
- if(!isAccepted) return;
- QAD_CONFIG->addSetting("Desktop:UndoLevel", anUndoLevel);
- if(!myActiveApp) return;
- QList<QAD_Study>& studies = myActiveApp->getStudies();
- int aWasWarning = 0;
- for(QAD_Study* study = studies.first(); study; study = studies.next()){
- SALOMEDS::Study_var aStudyDoc = study->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDoc->NewBuilder();
- if (!aStudyDoc->GetProperties()->IsLocked()) {
- aStudyBuilder->UndoLimit(anUndoLevel);
- } else {
- if (!aWasWarning) {
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- aWasWarning = 1;
- }
- }
- }
-}
-
-/* Update status bar for File menu items */
-void QAD_Desktop::onFilePopupStatusText( int id )
-{
- QString component = getActiveComponent();
-
- if (component != "") {
- //one of the modules is active now
- int importId = myFilePopup.idAt(8);
- int exportId = myFilePopup.idAt(9);
- int importTableId = myFilePopup.idAt(10);
-
- if (component == getComponentUserName("SMESH") || component == getComponentUserName("GEOM")) {
- if (id == importId)
- putInfo( tr("PRP_DESK_FILE_IMPORT") );
- if (id == exportId)
- putInfo( tr("PRP_DESK_FILE_EXPORT") );
- }
- if (component == getComponentUserName("VISU")) {
- if (id == importId)
- putInfo( tr("PRP_DESK_FILE_IMPORTMED") );
- if (id == importTableId)
- putInfo( tr("PRP_DESK_FILE_IMPORTTABLE") );
- if (id == exportId)
- putInfo( tr("PRP_DESK_FILE_EXPLOREMEDFILE") );
- }
- if (component == getComponentUserName("SUPERV")) {
- if (id == importId)
- putInfo( tr("PRP_DESK_FILE_IMPORTDF") );
- if (id == exportId)
- putInfo( tr("PRP_DESK_FILE_EXPORTDF") );
- }
- }
-}
-
-/* Update status bar for Edit menu items */
-void QAD_Desktop::onEditPopupStatusText( int id )
-{
- QString component = getActiveComponent();
-
- if (component != "") {
- //one of the modules is active now
-
- if (component == getComponentUserName("SMESH") || component == getComponentUserName("GEOM") ) {
- int deleteId = myEditPopup.idAt(5);
- if (id == deleteId)
- putInfo( tr("PRP_DESK_EDIT_DELETE") );
- }
- if (component == getComponentUserName("SUPERV") ) {
- int newDFId = myEditPopup.idAt(5);
- int modifyDFId = myEditPopup.idAt(6);
- if (id == newDFId)
- putInfo( tr("PRP_DESK_EDIT_NEWDF") );
- if (id == modifyDFId)
- putInfo( tr("PRP_DESK_EDIT_MODIFYDF") );
- }
- }
-}
-
-/* Update status bar for View menu items */
-void QAD_Desktop::onViewPopupStatusText( int id )
-{
- QString component = getActiveComponent();
-
- if (component != "") {
- //one of the modules is active now
- int DispModeId = myViewPopup.idAt(2);
-
- if (component == getComponentUserName("GEOM")) {
- if (id == DispModeId)
- putInfo( tr("PRP_DESK_VIEW_DISPLAYMODE") );
- }
- if (component == getComponentUserName("SMESH")) {
- int updateId = myViewPopup.idAt(3);
-
- if (id == DispModeId)
- putInfo( tr("PRP_DESK_VIEW_DISPLAYMODE") );
- if (id == updateId)
- putInfo( tr("PRP_DESK_VIEW_UPDATE") );
- }
- }
-}
-
-/* Processes additinal key accelerators, e.g. viewer incremental transfomrations */
-void QAD_Desktop::onKeyAccel( int id )
-{
- if ( myAccelMap.find( id ) != myAccelMap.end() ) {
- int cmd = myAccelMap[ id ];
- if ( myActiveApp != 0 && myActiveApp->getActiveStudy() != 0 && myActiveApp->getActiveStudy()->getActiveStudyFrame() != 0 ) {
- QAD_ViewFrame* vf = myActiveApp->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- switch ( cmd ) {
- case voPanLeft:
- vf->onPanLeft();
- break;
- case voPanRight:
- vf->onPanRight();
- break;
- case voPanUp:
- vf->onPanUp();
- break;
- case voPanDown:
- vf->onPanDown();
- break;
- case voZoomIn:
- vf->onZoomIn();
- break;
- case voZoomOut:
- vf->onZoomOut();
- break;
- case voZoomFit:
- vf->onViewFitAll();
- break;
- case voRotateLeft:
- vf->onRotateLeft();
- break;
- case voRotateRight:
- vf->onRotateRight();
- break;
- case voRotateUp:
- vf->onRotateUp();
- break;
- case voRotateDown:
- vf->onRotateDown();
- break;
- }
- }
- }
-}
-
-/*********************************************************************
-** Class: AppSelectionDlg
-** Descr: Dialog for the selection of the application when several
-** applications exist in the desktop and new study creation
-** is activated by user.
-** Level: Internal
-**********************************************************************/
-/*!
- \class Desktop_AppSelectionDlg QAD_Desktop.h
- \brief Dialog for the selection of the application when several
- applications exist in the desktop and new study creation
- is activated by user.
-
- Level: Internal.
-*/
-
-Desktop_AppSelectionDlg::Desktop_AppSelectionDlg( QAD_Desktop* desktop,
- QList<QAD_Application>& apps ) :
-QDialog( desktop, 0, true ),
-myAppId( 0 ),
-myApps( apps )
-{
- QAD_ASSERT_DEBUG_ONLY ( desktop );
- setCaption( tr("INF_DESK_DOC_CREATE") );
- if ( desktop->icon() )
- setIcon( *desktop->icon() );
-
- QBoxLayout* mainLayout = new QVBoxLayout( this, 5 );
-
- /* Create selection buttons */
- QVButtonGroup* buttonGrp = new QVButtonGroup ( this );
- buttonGrp->setExclusive ( true );
- QBoxLayout* vLayout = new QVBoxLayout( mainLayout, 5 );
- vLayout->addWidget ( buttonGrp );
-
- /* Create selection button for available app */
- unsigned id = 0;
- for ( QAD_Application* app = myApps.first(); app; app = myApps.next(), id++ )
- {
- /* add radio button for application */
- buttonGrp->insert( new QRadioButton( app->getStudyDescription() +
- " (*." + app->getStudyExtension() + ")", buttonGrp ), id );
- }
-
- /* make the first application selected */
- buttonGrp->setButton( 0 );
-
- /* listen to the selection */
- QAD_ASSERT ( connect ( buttonGrp, SIGNAL(clicked(int)), this, SLOT(onAppSelected(int)) ));
-
- /* Create OK/Cancel buttons
- */
- QBoxLayout* hLayout = new QHBoxLayout( mainLayout, 5 );
- QPushButton* buttonOK = new QPushButton( tr("BUT_OK"), this );
- QPushButton* buttonCancel = new QPushButton( tr("BUT_CANCEL"), this );
- QPushButton* buttonHelp = new QPushButton( tr("BUT_HELP"), this );
- buttonOK->setDefault( true );
-
- hLayout->addStretch();
- hLayout->addWidget( buttonOK );
- hLayout->addWidget( buttonCancel );
- hLayout->addWidget( buttonHelp );
-
- /* connect buttons */
- QAD_ASSERT ( connect( buttonOK, SIGNAL(clicked()), this, SLOT(accept())) );
- QAD_ASSERT ( connect( buttonCancel, SIGNAL(clicked()), this, SLOT(reject())) );
- QAD_ASSERT ( connect( buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())) );
-
- /* disable resizing */
- setFixedSize( 0, 0 );
- setSizePolicy( QSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
-}
-
-Desktop_AppSelectionDlg::~Desktop_AppSelectionDlg()
-{
-}
-
-QAD_Application* Desktop_AppSelectionDlg::selectedApp() const
-{
- return myApps.at( myAppId );
-}
-
-void Desktop_AppSelectionDlg::resizeEvent( QResizeEvent* e )
-{
- QAD_Tools::centerWidget( this, parentWidget() );
-}
-
-/*
- * Slots
-*/
-void Desktop_AppSelectionDlg::onAppSelected( int id )
-{
- myAppId = id;
-}
-
-void Desktop_AppSelectionDlg::onHelp()
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Desktop.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_DESKTOP_H
-#define QAD_DESKTOP_H
-
-#include "QAD.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_Application.h"
-#include "QAD_OperatorMenus.h"
-#include "QAD_Menus.h"
-//NRI#include "QAD_HelpWindow.h"
-#include "QAD_Action.h"
-
-#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "SALOME_Selection.h"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-#include CORBA_CLIENT_HEADER(SALOME_Component)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-// QT Includes
-#include <qlist.h>
-#include <qmap.h>
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qcombobox.h>
-#include <qstatusbar.h>
-#include <qpopupmenu.h>
-#include "qworkspaceP.h"
-#include <qmainwindow.h>
-#include <qfiledialog.h>
-#include <qtoolbutton.h>
-
-class QAD_XmlHandler;
-class SALOMEGUI;
-class SALOME_Event;
-
-class QAD_EXPORT QAD_Desktop : public QMainWindow
-{
- Q_OBJECT
-
-protected:
- //NRI - unused - : enum ComponentType {GEOM, MESH, SOLVER, DATA, VISU, OTHER} ;
-
- enum { FileNewId = -1000, FileOpenId, FileLoadId, FileCloseId, FileSaveId, FileSaveAsId, FilePropsId, FileExitId,
- ViewStatusBarId,
- SelectionPointId, SelectionEdgeId, SelectionCellId, SelectionActorId,
- PrefViewerOCCId, PrefViewerVTKId, PrefGraphSupervisorId, PrefViewerPlot2dId,
- //VRV: T2.5 - add default viewer
- DefaultViewerOCCId, DefaultViewerVTKId, DefaultGraphSupervisorId, DefaultPlot2dId,
- //VRV: T2.5 - add default viewer
- PrefViewerTrihedronId, PrefConsoleFontId, PrefObjectBrowserEntryId,
- PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId,PrefObjectBrowserShowUseCaseId,
- PrefObjectBrowserNoAutoSizeColumnsId,
- PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefUndoLevelId, PrefExternalBrowserId, PrefSaveId,
- //NRI : SAL2214
- WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId,
- //NRI : SAL2214
- WindowCascadeId, WindowTileId,
- HelpContentsId, HelpContentsModuleId,
- HelpSearchId, HelpWhatsThisId, HelpAboutId };
- enum UpdateCommand { ActivateApp, DeactivateApp };
-
- /* Desktop can be created only by application */
- friend bool QAD_Application::createDesktop( SALOME_NamingService* name_service );
- QAD_Desktop( SALOME_NamingService* name_service );
-
-public:
- ~QAD_Desktop();
-
- /* global event filter for qapplication */
- bool eventFilter( QObject* o, QEvent* e );
-
- /* resources */
- static QAD_ResourceMgr* getResourceManager();
- static QAD_ResourceMgr* createResourceManager();
-
- /* palette */
- static QPalette* getPalette();
- static QPalette* createPalette();
-
- /* activeStudyChanged */
- void onActiveStudyChanged();
-
- /* popup */
- void definePopup(QString & theContext,
- QString & theParent,
- QString & theObject );
- void createPopup(QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject );
- void customPopup(QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject);
-
- /* selection mode */
- void SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
-
- /* desktop */
- void showDesktop();
- void closeDesktop( bool forceClose = false );
- void putInfo ( const QString& );
- void putInfo ( const QString&, int );
- QToolBar* getStdToolBar() const;
- QMenuBar* getMainMenuBar() const;
-
- /* application */
- void addApplication(QAD_Application* app);
-
- /* studies */
- const QString& getDefaultTitle() const;
- const QPixmap& getDefaultIcon() const;
- const QString& getDefaultStudyName() const;
- QAD_Application* getActiveApp() const;
- QAD_Study* getActiveStudy() const;
- QWorkspaceP* getMainFrame() const;
- QString getNewStudyName();
- QAD_Study* findStudy( SALOMEDS::Study_ptr theStudy );
- static int getUndoLevel();
- /* help actions */
- virtual void helpAbout();
-/* virtual void helpSearch();
- virtual void helpContents();
- virtual void helpContext(const QString& path, const QString& dir = QString::null);
-*/
- bool loadComponent(QString);
- bool loadComponentData( const QString& );
- QString changeXmlInputSourceData(QString theData, QString theComponent);
- void activateComponent(const QString& theName, bool isLoadData = true);
- void deactivateComponent();
- void createStudy();
-
- void setSettings();
-
- SALOME_ModuleCatalog::ModuleCatalog_var getCatalogue();
-
- QAD_Menus* getActiveMenus() {return myActiveMenus;}
- QAD_OperatorMenus* getOperatorMenus() {return myOperatorMenus;}
- const QString& getActiveComponent() const;
- SALOMEGUI* getActiveGUI();
- SALOMEGUI* getComponentGUI( const QString& ); // accepts component`s user name
- QString getComponentDataType() const;
- SALOME_NamingService* getNameService() {return myNameService;}
-
- Engines::Component_var getEngine(const char *containerName,
- const char *componentName);
-
- QString getComponentName(const char *componentUserName);
- QString getComponentUserName(const char *componentName);
-
- //NRI QAD_HelpWindow* getHelpWindow();
-
- void onMouseMove(QMouseEvent*);
- bool onMousePress(QMouseEvent*);
- void onKeyPress(QKeyEvent*);
-
- virtual QAD_Study* loadStudy(QString theStudyName);
-
-protected:
- bool closeAllStudies( QAD_Application* );
- void closeEvent( QCloseEvent* );
- void resizeEvent( QResizeEvent* );
-
- virtual QString selectFileName ( bool open );
-
- virtual void updateDesktop( UpdateCommand );
- virtual void updateStatusBar( UpdateCommand );
- virtual void updateToolBars( UpdateCommand );
- virtual void updateCaption( UpdateCommand );
- virtual void updateMenu( UpdateCommand );
-
-protected slots:
- virtual void onNewStudy();
- virtual void onNewStudy(QAD_Application* app);
- virtual void onLoadStudy();
- virtual void onOpenStudy();
- virtual bool onSaveStudy();
- virtual bool onSaveStudy(QAD_Study* doc);
- virtual bool onSaveAsStudy();
- virtual bool onSaveAsStudy(QAD_Study* doc);
- virtual bool onCloseStudy();
- virtual bool onCloseStudy(QAD_Study* doc);
- //ask user to remove study from study manager permanently
- virtual bool onCloseStudy(QAD_Study* doc, bool ask);
-
- virtual void onStudyProperties();
-
- virtual void onViewStatusBar();
- virtual void onToolBarPopupAboutToShow();
-
- virtual void onExit();
-
- virtual void onWindowPopupAboutToShow();
- void onWindowsPopupActivated( int id );
- void onWindowsPopupStatusText( int id );
- void onHelpModulePopupStatusText(int id);
-
- void onFilePopupStatusText( int id );
- void onEditPopupStatusText( int id );
- void onViewPopupStatusText( int id );
-
- void onSelectionMode();
-
- void onDirList();
- void onSavePref();
- void onViewerOCC();
- void onViewerVTK();
- void onGraphSupervisor();
- void onPlot2d();
- void onConsoleFontAction();
- //VRV: T2.5 - add default viewer
- void onDefaultViewer( QActionP * theAction);
- //VRV: T2.5 - add default viewer
-
- void onViewerTrihedron();
- void onObjectBrowser();
- void onMultiFileSave();
- void onASCIISave();
- void onUndoLevel();
- void onExternalBrowser();
-
- void onActivateApp(QAD_Application* app);
- void onDeactivateApp(QAD_Application* app);
-
- void onHelpContents();
- void onHelpContentsModule();
- /* void onHelpContentsTUI(); */
-/* void onHelpSearch(); */
- void onHelpAbout();
-
- void onNewWindow3d();
-
- void onOpenWith();
-
- void onDispatchTools(int id);
- void onDispatch(int id);
- void onDispatch();
- void clearMenus();
- void onButtonActiveComponent();
- void onComboActiveComponent( const QString & );
- void onComboActiveComponent( const QString & , bool isLoadData);
- void onCascade();
-
- void onKeyAccel( int id );
-/* NRI void onHelpWindowClosed(); */
-
-protected:
- QMenuBar* myMainMenu; /* the main menu bar */
- int myMainMenuPos; /* index after which application inserts its items */
- QPopupMenu myFilePopup;
- int myFilePos;
- QPopupMenu myEditPopup;
- int myEditPos;
- QPopupMenu myViewPopup;
- int myViewPos;
- QPopupMenu myHelpPopup;
- int myHelpPos;
-
- //VRV: T2.5 - add default viewer
- QPopupMenu myDefaultViewer;
- //VRV: T2.5 - add default viewer
- QPopupMenu myObjBrowserPopup;
- QPopupMenu myViewerPopup;
- //NRI : SAL2214
- QPopupMenu myNewViewPopup;
- //NRI : SAL2214
- QPopupMenu myHelpContentsModulePopup;
-
- QPopupMenu myToolsPopup;
- QPopupMenu myPrefPopup;
- QPopupMenu mySelectionModePopup;
- QPopupMenu myWindowPopup; /* not customized by an application */
-
- ActionMap myStdActions; /* default actions */
- QToolBar* myStdToolBar; /* standard toolbar */
- QStatusBar* myStatusBar; /* the only status bar */
-
- QList<ToggleAction> myToolBarAction;
- QPopupMenu myToolBarsPopup;
-
- QList<QAD_Application> myApps; /* running applications */
- QAD_Application* myActiveApp; /* the active application */
- QAD_Study* myActiveStudy; /* the active document */
-
- int myCntUntitled; /* number of untitled docs */
- QWorkspaceP* myWorkspace; /* workspace */
-
- QPixmap myDefaultIcon; /* if no application is active */
- QString myDefaultTitle; /* desktop will use them */
-
- QAD_OperatorMenus* myOperatorMenus;
- QList<QAD_Menus> myMenusList;
- QAD_Menus* myActiveMenus;
-
- //NRI QAD_HelpWindow* myHelpWindow;
-
- QList<QToolButton> myComponentButton;
-
- QMap<QString,QString> mapComponentName;
-
-private:
- void processEvent( SALOME_Event* );
-
-private:
- typedef QMap<QString, SALOMEGUI*> ComponentMap;
-
-private:
- static QAD_ResourceMgr* resourceMgr;
- static QPalette* palette;
- void createActions();
- void updateActions();
- QAD_XmlHandler* myXmlHandler;
- QString myActiveComp;
- SALOME_NamingService* myNameService;
- SALOME_ModuleCatalog::ModuleCatalog_var myCatalogue;
- SALOME_LifeCycleCORBA * myEnginesLifeCycle;
- QComboBox * myCombo;
- bool myQueryClose;
- bool myAboutToClose;
- bool _islibso;
-
- ComponentMap myComponents;
- QMap<int, int> myAccelMap;
-};
-
-/********************************************************************
-** Class: AppSelectionDlg
-** Descr: Dialog for the selection of the application when several
-** applications exist in the desktop and new document creation
-** is activated by user.
-** Level: Internal
-*********************************************************************/
-class Desktop_AppSelectionDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- Desktop_AppSelectionDlg( QAD_Desktop*, QList<QAD_Application>& );
- ~Desktop_AppSelectionDlg();
-
-public:
- QAD_Application* selectedApp() const;
-
-protected:
- void resizeEvent( QResizeEvent* );
-
-protected slots:
- void onAppSelected(int);
- void onHelp();
-
-protected:
- int myAppId;
- QList<QAD_Application>& myApps;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_DirListDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "QAD_DirListDlg.h"
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Tools.h"
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qapplication.h>
-using namespace std;
-
-#define MIN_WIDTH 400
-#define MIN_HEIGHT 200
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define SPACER_SIZE 5
-
-/*!
- Constructor
-*/
-QAD_DirListDlg::QAD_DirListDlg(QWidget* parent, const char* name)
- : QDialog (parent, name, true, WStyle_NormalBorder | WStyle_Customize | WStyle_Title | WStyle_SysMenu )
-{
- myEdited = false;
- myLastSelected = 0;
- myEdit = 0;
- myBtn = 0;
-
- setCaption(tr("QUICK_DIR_LIST_TLT"));
- setSizeGripEnabled( true );
-
- QGridLayout* topLayout = new QGridLayout(this);
- topLayout->setMargin(MARGIN_SIZE);
- topLayout->setSpacing(SPACING_SIZE);
-
- myDirList = new QListBox(this);
- myDirList->setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
-// myDirList->setMaximumSize(MIN_WIDTH, MIN_HEIGHT);
- myDirList->setSelectionMode(QListBox::Single);
- myDirList->setHScrollBarMode(QListBox::AlwaysOff);
- myDirList->horizontalScrollBar()->installEventFilter(this);
- myDirList->verticalScrollBar()->installEventFilter(this);
- myDirList->insertItem(tr("EMPTY_DIR"));
- myDirList->installEventFilter(this);
-
- QHBoxLayout* ctrlLayout = new QHBoxLayout;
- ctrlLayout->setMargin(0);
- ctrlLayout->setSpacing(0);
-
- QLabel* lab = new QLabel(myDirList, tr("DIRECTORIES_LBL"), this);
-
- QToolButton* insertBtn = new QToolButton(this);
- insertBtn->setIconSet(QAD_Desktop::getResourceManager()->loadPixmap("QAD", tr("ICON_DIRLIST_INSERT")));
- insertBtn->setAutoRaise(true);
-
- QToolButton* deleteBtn = new QToolButton(this);
- deleteBtn->setIconSet(QAD_Desktop::getResourceManager()->loadPixmap("QAD", tr("ICON_DIRLIST_DELETE")));
- deleteBtn->setAutoRaise(true);
-
- QToolButton* upBtn = new QToolButton(this);
- upBtn->setIconSet(QAD_Desktop::getResourceManager()->loadPixmap("QAD", tr("ICON_DIRLIST_MOVEUP")));
- upBtn->setAutoRaise(true);
-
- QToolButton* downBtn = new QToolButton(this);
- downBtn->setIconSet(QAD_Desktop::getResourceManager()->loadPixmap("QAD", tr("ICON_DIRLIST_MOVEDOWN")));
- downBtn->setAutoRaise(true);
-
- ctrlLayout->addWidget(lab);
- ctrlLayout->addItem(new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum));
- ctrlLayout->addWidget(insertBtn);
- ctrlLayout->addWidget(deleteBtn);
- ctrlLayout->addWidget(upBtn);
- ctrlLayout->addWidget(downBtn);
-
- QHBoxLayout* btnLayout = new QHBoxLayout;
- btnLayout->setMargin(0);
- btnLayout->setSpacing(6);
-
- QPushButton * okBtn = new QPushButton(tr("BUT_OK"), this);
- QPushButton * cancelBtn = new QPushButton(tr("BUT_CANCEL"), this);
- okBtn->setDefault(true);
- okBtn->setAutoDefault(true);
- cancelBtn->setAutoDefault(true);
-
- btnLayout->addWidget(okBtn);
- btnLayout->addItem(new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum));
- btnLayout->addWidget(cancelBtn);
-
- topLayout->addLayout(ctrlLayout, 0, 0);
- topLayout->addWidget(myDirList, 1, 0);
- topLayout->addLayout(btnLayout, 2, 0);
-
- connect(myDirList, SIGNAL(mouseButtonClicked(int, QListBoxItem*, const QPoint&)),
- this, SLOT(onMouseButtonClicked(int, QListBoxItem*, const QPoint&)));
- connect(myDirList, SIGNAL(doubleClicked(QListBoxItem*)),
- this, SLOT(onDblClicked(QListBoxItem*)));
-
- connect(insertBtn, SIGNAL(clicked()), this, SLOT(onInsert()));
- connect(deleteBtn, SIGNAL(clicked()), this, SLOT(onDelete()));
- connect(upBtn, SIGNAL(clicked()), this, SLOT(onUp()));
- connect(downBtn, SIGNAL(clicked()), this, SLOT(onDown()));
- connect(okBtn, SIGNAL(clicked()), this, SLOT(onOk()));
- connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
-
- QAD_Tools::centerWidget(this, parent);
-}
-
-/*!
- Destructor
-*/
-QAD_DirListDlg::~QAD_DirListDlg() {
-}
-
-/*!
- Gets list of paths
-*/
-void QAD_DirListDlg::getPathList(QStringList& list) {
- list.clear();
- for (unsigned i = 0; i < myDirList->count()-1; i++)
- list.append(myDirList->text(i));
-}
-
-/*!
- Sets list of paths
-*/
-void QAD_DirListDlg::setPathList(const QStringList& list) {
- for (unsigned i = 0; i < list.count(); i++)
- myDirList->insertItem(list[i], myDirList->count()-1);
-}
-
-/*!
- Validates entered path, returns true if OK
-*/
-#ifndef WNT
-#include <pwd.h>
-#endif
-bool QAD_DirListDlg::validate() {
- if (myEdited) {
- QString dirPath = myEdit->text().stripWhiteSpace();
-#ifndef WNT
- if ( dirPath.startsWith( "~") ) {
- dirPath = dirPath.remove(0,1);
- QString user;
- int slashPos = dirPath.find("/");
- if ( slashPos >= 0 ) {
- user = dirPath.left(slashPos);
- dirPath = dirPath.mid(slashPos);
- }
- else {
- user = dirPath;
- dirPath = "";
- }
- if ( user.isEmpty() )
- user = getenv( "USER" );
-
- struct passwd* user_data = getpwnam( user.latin1() );
- if ( user_data == NULL ) {
- // unknown user or something another error
- QAD_MessageBox::error1(this,
- tr("ERR_ERROR"),
- tr("Unknown user %1").arg(user),
- tr("BUT_OK"));
- myEdit->setFocus();
- return false;
- }
- dirPath = user_data->pw_dir + dirPath;
- }
-#endif
- QDir dir(dirPath);
- QListBoxItem* found = 0;
- for (unsigned i = 0; i < myDirList->count()-1; i++) {
- QDir aDir(myDirList->text(i));
- if ( aDir.canonicalPath().isNull() && myDirList->text(i) == dir.absPath() ||
- !aDir.canonicalPath().isNull() && aDir.exists() && aDir.canonicalPath() == dir.canonicalPath()) {
- found = myDirList->item(i);
- break;
- }
- }
- if (dirPath.isEmpty()) {
- if (found) {
- // it should be last (empty) item in the list - nothing to do
- return true;
- }
- else {
- // delete directory from the list
- removeDir(myLastSelected);
- return true;
- }
- }
- else {
- if (found) {
- if (found != myLastSelected) {
- // it is forbidden to add directory more then once
- QAD_MessageBox::error1(this,
- tr("ERR_ERROR"),
- tr("ERR_DIRECTORY_SPECIFIED"),
- tr("BUT_OK"));
- myEdit->setFocus();
- return false;
- }
- }
- else {
- if (!dir.exists()) {
- if ( QAD_MessageBox::info2(this,
- tr("WRN_WARNING"),
- tr("WRN_DIRECTORY_N0T_EXIST").arg(dir.absPath()),
- tr ("BUT_YES"), tr ("BUT_NO"),
- QAD_YES, QAD_NO, QAD_NO ) == QAD_NO ) {
- myEdit->setFocus();
- return false;
- }
- }
- // append
- appendDir(myLastSelected, dir.absPath());
- }
- }
- }
- return true;
-}
-
-/*!
- Appends/changes directory
-*/
-void QAD_DirListDlg::appendDir(QListBoxItem* item, const QString& dir) {
- int index = myDirList->index(item);
- if (index >= 0 && index < (int)myDirList->count()) {
- if (index == (int)myDirList->count()-1) {
- // it is the last item (new), well, insert it before the last (empty)
- myDirList->insertItem(dir, myDirList->count()-1);
- }
- else {
- // change item
- myDirList->changeItem(dir, index);
- }
- }
-}
-
-/*!
- Removes directory from list
-*/
-void QAD_DirListDlg::removeDir(QListBoxItem* item) {
- // do not remove last item (empty)
- int index = myDirList->index(item);
- if (index >= 0 && index < (int)myDirList->count()-1) {
- delete item;
- myLastSelected = myDirList->item(index);
- myDirList->setSelected(myLastSelected, true);
- }
-}
-
-/*!
- KeyPress event handler, processes <Enter> and <Escape> keys
-*/
-void QAD_DirListDlg::keyPressEvent(QKeyEvent* event) {
- if ( myEdited ) {
- if ( event->key() == Key_Escape ) {
- delete myEdit;
- delete myBtn;
- myEdit = 0;
- myBtn = 0;
- myEdited = false;
- myDirList->setFocus();
- }
- return;
- }
- if (event->key() == Key_Return || event->key() == Key_Enter) {
- accept();
- }
- QDialog::keyPressEvent(event);
-}
-
-/*!
- Resize event
-*/
-void QAD_DirListDlg::resizeEvent(QResizeEvent* event) {
- QDialog::resizeEvent(event);
- if ( myEdited ) {
- myEdit->resize(myDirList->viewport()->width()-myBtn->sizeHint().width(), myEdit->height());
- myBtn->move(myEdit->width(), myEdit->y());
- }
-}
-
-/*!
- Called when user clicks inside directories list box
-*/
-void QAD_DirListDlg::onMouseButtonClicked(int button,
- QListBoxItem* item,
- const QPoint& point) {
- if (myEdited) {
- if (!validate()) {
- myDirList->setCurrentItem(myLastSelected);
- myDirList->setSelected(myLastSelected, true);
- return;
- }
- delete myEdit;
- delete myBtn;
- myEdit = 0;
- myBtn = 0;
- myEdited = false;
- myDirList->setFocus();
- }
- if (item) {
- myDirList->setCurrentItem(item);
- myDirList->setSelected(item, true);
- myDirList->ensureCurrentVisible();
- qApp->processEvents();
- if (button == LeftButton && myLastSelected == item) {
- QRect ir = myDirList->itemRect(myLastSelected);
-
- myEdit = new QLineEdit(myDirList->viewport());
- myBtn = new QToolButton(myDirList->viewport());
- myBtn->setText(" ... ");
- connect(myBtn, SIGNAL(clicked()), this, SLOT(onBtnClicked()));
- myEdit->setGeometry(0,
- ir.top()-(myEdit->sizeHint().height()-ir.height())/2,
- myDirList->viewport()->width()-myBtn->sizeHint().width(),
- myEdit->sizeHint().height());
- myBtn->setGeometry (myEdit->width(),
- ir.top()-(myEdit->sizeHint().height()-ir.height())/2,
- myBtn->sizeHint().width(),
- myEdit->sizeHint().height());
- connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditFinished()));
- myEdited = true;
- myEdit->show();
- myBtn->show();
- if (myDirList->index(myLastSelected) != (int)myDirList->count()-1)
- myEdit->setText(myLastSelected->text());
- myEdit->selectAll();
- myEdit->setCursorPosition(myEdit->text().length());
- myEdit->installEventFilter(this);
- myEdit->setFocus();
- }
- }
- else {
- myDirList->clearSelection();
- }
- myLastSelected = item;
-}
-
-/*!
- Called when user double-clicks on any item
-*/
-void QAD_DirListDlg::onDblClicked(QListBoxItem* item) {
- onMouseButtonClicked(LeftButton, item, QPoint(0,0));
-}
-
-/*!
- <...> (Browse dir) button slot
-*/
-void QAD_DirListDlg::onBtnClicked() {
- QString dir = myEdit->text().stripWhiteSpace().isEmpty() ?
- QString::null :
- myEdit->text().stripWhiteSpace();
- dir = QAD_FileDlg::getExistingDirectory(this, dir, tr("SELECT_DIRECTORY"), true);
- if (!dir.isEmpty()) {
- myEdit->setText(dir);
- myEdit->selectAll();
- myEdit->setCursorPosition(myEdit->text().length());
- }
-}
-
-/*!
- Called when user finises editing of path by pressing <Enter>
-*/
-void QAD_DirListDlg::onEditFinished() {
- if (myEdit) {
- if (!validate()) {
- myDirList->setCurrentItem(myLastSelected);
- myDirList->setSelected(myLastSelected, true);
- return;
- }
- delete myEdit;
- delete myBtn;
- myEdit = 0;
- myBtn = 0;
- myEdited = false;
- myDirList->setFocus();
- }
-}
-
-/*!
- Event filter
-*/
-bool QAD_DirListDlg::eventFilter(QObject* object, QEvent* event) {
- if ( myEdited ) {
- if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) {
- if (object == myDirList->horizontalScrollBar() || object == myDirList->verticalScrollBar()) {
- if (!validate()) {
- myDirList->setCurrentItem(myLastSelected);
- myDirList->setSelected(myLastSelected, true);
- return true;
- }
- delete myEdit;
- delete myBtn;
- myEdit = 0;
- myBtn = 0;
- myEdited = false;
- myDirList->setFocus();
- }
- }
- else if (event->type() == QEvent::KeyPress) {
- QKeyEvent* ke = (QKeyEvent*)event;
- if (ke->key() == Key_Tab)
- return true;
- if (object == myDirList) {
- return true;
- }
- else if (object == myEdit) {
- if ( ke->key() == Key_Up || ke->key() == Key_Down || ke->key() == Key_PageUp || ke->key() == Key_PageDown ||
- ( ke->key() == Key_Home || ke->key() == Key_End || ke->key() == Key_Prior || ke->key() == Key_Next ) &&
- (ke->state() & ControlButton) ) {
- return true;
- }
- else if ( ke->key() == Key_Escape ) {
- delete myEdit;
- delete myBtn;
- myEdit = 0;
- myBtn = 0;
- myEdited = false;
- myDirList->setFocus();
- return true;
- }
- }
- }
- }
- else {
- if (event->type() == QEvent::KeyPress) {
- if (object == myDirList) {
- QKeyEvent* ke = (QKeyEvent*)event;
- if (ke->key() == Key_Return || ke->key() == Key_Enter) {
- accept();
- }
- else {
- QChar c(ke->ascii());
- if (c.isPrint()) {
- QListBoxItem* item = myDirList->item(myDirList->currentItem());
- if (item) {
- myDirList->setCurrentItem(item);
- myDirList->setSelected(item, true);
- myDirList->ensureCurrentVisible();
- myLastSelected = item;
- qApp->processEvents();
- QRect ir = myDirList->itemRect(myLastSelected);
-
- myEdit = new QLineEdit(myDirList->viewport());
- myBtn = new QToolButton(myDirList->viewport());
- myBtn->setText(" ... ");
- connect(myBtn, SIGNAL(clicked()), this, SLOT(onBtnClicked()));
- myEdit->setGeometry(0,
- ir.top()-(myEdit->sizeHint().height()-ir.height())/2,
- myDirList->viewport()->width()-myBtn->sizeHint().width(),
- myEdit->sizeHint().height());
- myBtn->setGeometry (myEdit->width(),
- ir.top()-(myEdit->sizeHint().height()-ir.height())/2,
- myBtn->sizeHint().width(),
- myEdit->sizeHint().height());
- connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditFinished()));
- myEdited = true;
- myEdit->show();
- myBtn->show();
- myEdit->setText(c);
- myEdit->setCursorPosition(myEdit->text().length());
- myEdit->installEventFilter(this);
- myEdit->setFocus();
- }
- }
- }
- }
- }
- }
- return QDialog::eventFilter(object, event);
-}
-
-/*!
- <Insert> button slot
-*/
-void QAD_DirListDlg::onInsert() {
- if (!myEdited) {
- myLastSelected = 0;
- onMouseButtonClicked(LeftButton, myDirList->item(myDirList->count()-1), QPoint(0,0));
- onMouseButtonClicked(LeftButton, myDirList->item(myDirList->count()-1), QPoint(0,0));
- }
-}
-
-/*!
- <Delete> button slot
-*/
-void QAD_DirListDlg::onDelete() {
- if (!myEdited && myDirList->currentItem() >=0) {
- removeDir(myDirList->item(myDirList->currentItem()));
- myDirList->setFocus();
- }
-}
-
-/*!
- <Move up> button slot
-*/
-void QAD_DirListDlg::onUp() {
- if (!myEdited && myLastSelected) {
- int index = myDirList->currentItem();
- if (index > 0 && index < (int)myDirList->count()-1 && myDirList->isSelected(index)) {
- QString t = myDirList->text(index-1);
- myDirList->changeItem(myDirList->text(index), index-1);
- myDirList->changeItem(t, index);
- myDirList->setCurrentItem(index-1);
- myLastSelected = myDirList->item(index-1);
- myDirList->setSelected(myLastSelected, true);
- myDirList->setFocus();
- }
- }
-}
-
-/*!
- <Move down> button slot
-*/
-void QAD_DirListDlg::onDown() {
- if (!myEdited && myLastSelected) {
- int index = myDirList->currentItem();
- if (index >= 0 && index < (int)myDirList->count()-2 && myDirList->isSelected(index)) {
- QString t = myDirList->text(index+1);
- myDirList->changeItem(myDirList->text(index), index+1);
- myDirList->changeItem(t, index);
- myDirList->setCurrentItem(index+1);
- myLastSelected = myDirList->item(index+1);
- myDirList->setSelected(myLastSelected, true);
- myDirList->setFocus();
- }
- }
-}
-
-/*!
- Purpose : <OK> button slot
-*/
-void QAD_DirListDlg::onOk() {
- if (validate())
- accept();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_DirListDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#if !defined(QAD_DirListDlg_h)
-#define QAD_DirListDlg_h
-
-#include <qdialog.h>
-#include <qtoolbutton.h>
-#include <qlineedit.h>
-#include <qlistbox.h>
-#include <qcombobox.h>
-
-class QAD_DirListDlg : public QDialog {
-
- Q_OBJECT
-
-public:
-// constructor
- QAD_DirListDlg(QWidget* parent, const char* name = 0);
-// destructor
- ~QAD_DirListDlg();
-
-// gets list of paths
- void getPathList(QStringList& list);
-// sets list of paths
- void setPathList(const QStringList& list);
-// event filter
- bool eventFilter(QObject* object, QEvent* event);
-
-protected:
-// validates entered path, returns true if OK
- bool validate();
-// appends/changes path
- void appendDir(QListBoxItem* item, const QString& dir);
-// removes directory from list
- void removeDir(QListBoxItem* item);
-// KeyPress event handler, processes <Enter> and <Escape> keys
- void keyPressEvent(QKeyEvent* event);
-// Resize event
- void resizeEvent(QResizeEvent* event);
-
-protected slots:
-// called when user clicks inside directories list box
- void onMouseButtonClicked(int, QListBoxItem*, const QPoint&);
-// called when user double-clicks on any item
- void onDblClicked(QListBoxItem*);
-// <...> (Browse dir) button slot
- void onBtnClicked();
-// called when user finises editing of path by pressing <Enter>
- void onEditFinished();
-// <Insert> button slot
- void onInsert();
-// <Delete> button slot
- void onDelete();
-// <Move up> button slot
- void onUp();
-// <Move down> button slot
- void onDown();
-// <OK> button slot
- void onOk();
-
-private:
- QListBox* myDirList; // directory list
- QLineEdit* myEdit; // path edit box
- QToolButton* myBtn; // browse pah button
- bool myEdited; // edit mode flag
- QListBoxItem* myLastSelected; // last selected row
-
-};
-
-#endif // !defined(QAD_DirListDlg_h)
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_FileDlg.cxx
-// Author :
-// Module : SALOME
-// $Header$
-
-#include <qapplication.h>
-#include <qdir.h>
-#include <qlabel.h>
-#include <qobjectlist.h>
-#include <qpalette.h>
-#include <qregexp.h>
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Tools.h"
-using namespace std;
-
-#define MIN_COMBO_SIZE 100
-
-QString QAD_FileDlg::myLastVisitedPath;
-
-/*!
-Constructor
-*/
-QAD_FileDlg::QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) :
-QFileDialogP( parent, 0, modal ),
-myValidator( 0 ),
-myQuickCombo( 0 ),
-myOpen( open )
-{
- if ( parent->icon() )
- setIcon( *parent->icon() );
- setSizeGripEnabled( true );
-
- if (showQuickDir) {
- // inserting quick dir combo box
- QLabel* lab = new QLabel(tr("QUICK_PATH_LAB"), this);
- myQuickCombo = new QComboBox(false, this);
- myQuickCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- myQuickCombo->setMinimumSize(MIN_COMBO_SIZE, 0);
-
- myQuickButton = new QPushButton(tr("ADD_PATH_BTN"), this);
-
- connect(myQuickCombo, SIGNAL(activated(const QString&)), this, SLOT(quickDir(const QString&)));
- connect(myQuickButton, SIGNAL(clicked()), this, SLOT(addQuickDir()));
- addWidgets(lab, myQuickCombo, myQuickButton);
-
- // getting dir list from settings
- QString dirs = QAD_CONFIG->getSetting("FileDlg:QuickDirList");
- QStringList dirList = QStringList::split(';', dirs, false);
- if (dirList.count() > 0) {
- for (unsigned i = 0; i < dirList.count(); i++)
- myQuickCombo->insertItem(dirList[i]);
- }
- else {
- myQuickCombo->insertItem(QDir::homeDirPath());
- }
-
- // the following is a workaround for proper layouting of custom widgets ===========
- QValueList<QPushButton*> buttonList;
- QValueList<QLabel*> labelList;
- const QObjectList *list = children();
- QObjectListIt it(*list);
- int maxButWidth = lab->sizeHint().width();
- int maxLabWidth = myQuickButton->sizeHint().width();
-
- for (; it.current() ; ++it) {
- if ( it.current()->isA( "QLabel" ) ) {
- int tempW = ((QLabel*)it.current())->minimumWidth();
- if ( maxLabWidth < tempW ) maxLabWidth = tempW;
- labelList.append( (QLabel*)it.current() );
- }
- else if( it.current()->isA("QPushButton") ) {
- int tempW = ((QPushButton*)it.current())->minimumWidth();
- if ( maxButWidth < tempW ) maxButWidth = tempW;
- buttonList.append( (QPushButton*)it.current() );
- }
- }
- if (maxButWidth > 0) {
- QValueList<QPushButton*>::Iterator bListIt;
- for ( bListIt = buttonList.begin(); bListIt != buttonList.end(); ++bListIt )
- (*bListIt)->setFixedWidth( maxButWidth );
- }
- if (maxLabWidth > 0) {
- QValueList<QLabel*>::Iterator lListIt;
- for ( lListIt = labelList.begin(); lListIt != labelList.end(); ++lListIt )
- (*lListIt)->setFixedWidth( maxLabWidth );
- }
- // ================================================================================
- }
- setMode( myOpen ? ExistingFile : AnyFile );
- setCaption( myOpen ? tr( "INF_DESK_DOC_OPEN" ) : tr( "INF_DESK_DOC_SAVE" ) );
- if (myLastVisitedPath.isNull() || myLastVisitedPath.isEmpty()) {
- // If no last visited path exists -> switch to the first preferred path
- processPath(myQuickCombo->text(0));
- }
- else if ( !processPath(myLastVisitedPath) ) {
- // If last visited path doesn't exist -> switch to the first preferred path
- processPath(myQuickCombo->text(0));
- }
- myValidator = new QAD_FileValidator(this);
-
-}
-
-/*!
-Destructor
-*/
-QAD_FileDlg::~QAD_FileDlg()
-{
-}
-
-/*!
-Sets validator for file names to open/save
-Deletes previous validator
-*/
-void QAD_FileDlg::setValidator( QAD_FileValidator* v )
-{
- if (myValidator)
- delete myValidator;
- myValidator = v;
-}
-
-/*!
-Returns the selected file
-*/
-QString QAD_FileDlg::selectedFile() const
-{
- return mySelectedFile;
-}
-
-/*!
-Returns 'true' if this is 'Open File' dialog
-and 'false' if 'Save File' dialog
-*/
-bool QAD_FileDlg::isOpenDlg() const
-{
- return myOpen;
-}
-
-/*!
-Closes this dialog and sets the return code to 'Accepted'
-if the selected name is valid ( see 'acceptData()' )
-*/
-void QAD_FileDlg::accept()
-{
-// mySelectedFile = QFileDialog::selectedFile().simplifyWhiteSpace(); //VSR- 06/12/02
- if ( mode() != ExistingFiles ) {
- mySelectedFile = QFileDialogP::selectedFile(); //VSR+ 06/12/02
- addExtension();
- }
-// mySelectedFile = mySelectedFile.simplifyWhiteSpace(); //VSR- 06/12/02
-
- /* Qt 2.2.2 BUG: accept() is called twice if you validate
- the selected file name by pressing 'Return' key in file
- name editor but this name is not acceptable for acceptData()
- */
- if ( acceptData() ) {
- myLastVisitedPath = dirPath();
- QFileDialogP::accept();
- }
-}
-
-/*!
-Closes this dialog and sets the return code to 'Rejected'
-*/
-void QAD_FileDlg::reject()
-{
- mySelectedFile = QString::null;
- QFileDialogP::reject();
-}
-
-/*!
-Returns 'true' if selected file is valid.
-The validity is checked by a file validator,
-if there is no validator the file is always
-considered as valid
-*/
-bool QAD_FileDlg::acceptData()
-{
- if ( myValidator )
- {
- if ( isOpenDlg() )
- if ( mode() == ExistingFiles ) {
- QStringList fileNames = selectedFiles();
- for ( int i = 0; i < fileNames.count(); i++ ) {
- if ( !myValidator->canOpen( fileNames[i] ) )
- return false;
- }
- return true;
- }
- else {
- return myValidator->canOpen( selectedFile() );
- }
- else
- return myValidator->canSave( selectedFile() );
- }
- return true;
-}
-
-/*!
-Adds an extension to the selected file name
-if the file has not it.
-The extension is extracted from the active filter.
-*/
-void QAD_FileDlg::addExtension()
-{
-// mySelectedFile.stripWhiteSpace();//VSR- 06/12/02
-// if ( mySelectedFile.isEmpty() )//VSR- 06/12/02
- if ( mySelectedFile.stripWhiteSpace().isEmpty() )//VSR+ 06/12/02
- return;
-
-// if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR- 06/12/02
-//ota : 16/12/03 if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR+ 06/12/02
-// {
-
-#if QT_VERSION < 0x030000
- QRegExp r( QString::fromLatin1("([a-zA-Z0-9.*? +;#]*)$") );
- int len, index = r.match( selectedFilter(), 0, &len );
-#else
- QRegExp r( QString::fromLatin1("\\([a-zA-Z0-9.*? +;#]*\\)$") );
- int index = r.search(selectedFilter());
-#endif
- if ( index >= 0 )
- {
-#if QT_VERSION < 0x030000
-// QString wildcard = selectedFilter().mid( index + 1, len-2 ); //VSR- 06/12/02
- QString wildcard = selectedFilter().mid( index + 1, len-2 ).stripWhiteSpace(); //VSR+ 06/12/02
-#else
-// QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ); //VSR- 06/12/02
- QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ).stripWhiteSpace(); //VSR+ 06/12/02
-#endif
- if ( mySelectedFile[mySelectedFile.length() - 1] == '.')
- //if the file name ends with the point remove it
- mySelectedFile.truncate(mySelectedFile.length() - 1);
- QString anExt = "." + QAD_Tools::getFileExtensionFromPath( mySelectedFile ).stripWhiteSpace();
- // From the filters list make a pattern to validate a file extension
- // Due to transformations from the filter list (*.txt *.*xx *.c++ QAD*.* ) we
- // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only we remove
- // stay extension mask only in the pattern
- QString aPattern(wildcard);
- QRegExp anExtRExp("("+aPattern.replace(QRegExp("(^| )[0-9a-zA-Z*_?]*\\."), " \\.").
- stripWhiteSpace().replace(QRegExp("\\s+"), "|").
- replace(QRegExp("[*]"),".*").replace(QRegExp("[+]"),"\\+") + ")");
-
- if ( anExtRExp.match(anExt) == -1 ) //if a selected file extension does not match to filter's list
- { //remove a point if it is at the word end
- if (anExt[ anExt.length() - 1 ] == '.') anExt.truncate( anExt.length() - 1 );
- index = wildcard.findRev( '.' );
- if ( index >= 0 )
- mySelectedFile += wildcard.mid( index ); //add the extension
- }
- }
- // }
-}
-
-/*!
- Processes selection : tries to set given path or filename as selection
-*/
-bool QAD_FileDlg::processPath( const QString& path )
-{
- if ( !path.isNull() ) {
- QFileInfo fi( path );
- if ( fi.exists() ) {
- if ( fi.isFile() )
- setSelection( path );
- else if ( fi.isDir() )
- setDir( path );
- return true;
- }
- else {
- if ( QFileInfo( fi.dirPath() ).exists() ) {
- setDir( fi.dirPath() );
- setSelection( path );
- return true;
- }
- }
- }
- return false;
-}
-/*!
- Called when user selects item from "Quick Dir" combo box
-*/
-void QAD_FileDlg::quickDir(const QString& dirPath)
-{
- if ( !QDir(dirPath).exists() ) {
- QAD_MessageBox::error1(this,
- tr("ERR_ERROR"),
- tr("ERR_DIR_NOT_EXIST").arg(dirPath),
- tr("BUT_OK"));
-
- }
- else {
- processPath(dirPath);
- }
-}
-/*!
- Called when user presses "Add" button - adds current directory to quick directory
- list and to the preferences
-*/
-void QAD_FileDlg::addQuickDir()
-{
- QString dp = dirPath();
- if ( !dp.isEmpty() ) {
- QDir dir( dp );
- // getting dir list from settings
- QString dirs = QAD_CONFIG->getSetting("FileDlg:QuickDirList");
- QStringList dirList = QStringList::split(';', dirs, false);
- bool found = false;
- bool emptyAndHome = false;
- if ( dirList.count() > 0 ) {
- for ( unsigned i = 0; i < dirList.count(); i++ ) {
- QDir aDir( dirList[i] );
- if ( aDir.canonicalPath().isNull() && dirList[i] == dir.absPath() ||
- !aDir.canonicalPath().isNull() && aDir.exists() && aDir.canonicalPath() == dir.canonicalPath() ) {
- found = true;
- break;
- }
- }
- }
- else {
- emptyAndHome = dir.canonicalPath() == QDir(QDir::homeDirPath()).canonicalPath();
- }
- if ( !found ) {
- dirList.append( dp );
- QAD_CONFIG->addSetting("FileDlg:QuickDirList", dirList.join(";"));
- if ( !emptyAndHome )
- myQuickCombo->insertItem( dp );
- }
- }
-}
-/*!
- Returns the file name for Open/Save [ static ]
-*/
-QString QAD_FileDlg::getFileName( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open,
- bool showQuickDir,
- QAD_FileValidator* validator )
-{
- QAD_FileDlg* fd = new QAD_FileDlg( parent, open, showQuickDir, true );
- if ( !caption.isEmpty() )
- fd->setCaption( caption );
- if ( !initial.isEmpty() ) {
- fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
- }
-
- fd->setFilters( filters );
-
- if ( validator )
- fd->setValidator( validator );
- fd->exec();
- QString filename = fd->selectedFile();
- delete fd;
- qApp->processEvents();
- return filename;
-}
-
-
-/*!
- Returns the list of files to be opened [ static ]
-*/
-QStringList QAD_FileDlg::getOpenFileNames( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool showQuickDir,
- QAD_FileValidator* validator )
-{
- QAD_FileDlg* fd = new QAD_FileDlg( parent, true, showQuickDir, true );
- fd->setMode( ExistingFiles );
- if ( !caption.isEmpty() )
- fd->setCaption( caption );
- if ( !initial.isEmpty() ) {
- fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
- }
- fd->setFilters( filters );
- if ( validator )
- fd->setValidator( validator );
- fd->exec();
- QStringList filenames = fd->selectedFiles();
- delete fd;
- qApp->processEvents();
- return filenames;
-}
-
-/*!
- Existing directory selection dialog [ static ]
-*/
-QString QAD_FileDlg::getExistingDirectory ( QWidget* parent,
- const QString& initial,
- const QString& caption,
- bool showQuickDir )
-{
- QAD_FileDlg* fd = new QAD_FileDlg( parent, true, showQuickDir, true);
- if ( !caption.isEmpty() )
- fd->setCaption( caption );
- if ( !initial.isEmpty() ) {
- fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
- }
- fd->setMode( DirectoryOnly );
- fd->setFilters(tr("DIRECTORIES_FILTER"));
-
- fd->exec();
- QString dirname = fd->selectedFile();
- delete fd;
- qApp->processEvents();
- return dirname;
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_FileDlg.h
-// Author :
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_FILEDIALOG_H
-#define QAD_FILEDIALOG_H
-
-#include <qcombobox.h>
-#include <qpushbutton.h>
-
-// VSR (18/01/2005): use patched QFileDialog only for the official 3.0.5 version of Qt
-#if QT_VERSION == 0x030005
-#include <qfiledialogP.h>
-#else
-#include <qfiledialog.h>
-#define QFileDialogP QFileDialog
-#endif
-
-#include "QAD.h"
-#include "QAD_FileValidator.h"
-
-class QAD_EXPORT QAD_FileDlg : public QFileDialogP
-{
- Q_OBJECT
-
-public:
- QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
- virtual ~QAD_FileDlg();
-
-public:
- bool isOpenDlg() const;
- QString selectedFile() const;
-
- void setValidator( QAD_FileValidator* );
-
- static QString getFileName( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open,
- bool showQuickDir = true,
- QAD_FileValidator* validator = 0);
- static QStringList getOpenFileNames( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool showQuickDir = true,
- QAD_FileValidator* validator = 0);
- static QString getExistingDirectory ( QWidget* parent,
- const QString& initial,
- const QString& caption,
- bool showQuickDir = true);
-
-protected:
- virtual bool acceptData();
-
-private:
- void addExtension();
- bool processPath( const QString& path );
-
-protected slots:
- void accept();
- void reject();
- void quickDir(const QString&);
- void addQuickDir();
-
-protected:
- bool myOpen; /* open/save selector */
- QString mySelectedFile; /* selected filename */
- QAD_FileValidator* myValidator; /* file validator */
- static QString myLastVisitedPath; /* last visited path */
- QComboBox* myQuickCombo; /* quick dir combo box */
- QPushButton* myQuickButton; /* quick dir add button */
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_FileValidator.cxx
-// Author :
-// Module : SALOME
-// $Header$
-
-#include "QAD_FileValidator.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-
-#include "utilities.h"
-
-#include <qfile.h>
-#include <qfileinfo.h>
-
-using namespace std;
-
-/* constructor */
-QAD_FileValidator::QAD_FileValidator(QWidget* parent) :
-myParent(parent)
-{
- if (!myParent) {
- myParent = QAD_Application::getDesktop();
- }
-}
-
-/* returns false if can't open file */
-bool QAD_FileValidator::canOpen( const QString& file )
-{
-MESSAGE ( "QAD_FileValidator::canOpen" )
- if ( !QFile::exists( file ) ) {
- QAD_MessageBox::error1( myParent,
- QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_DOC_FILENOTEXIST" ).arg( file ),
- QObject::tr( "BUT_OK" ) );
- return false;
- }
- if ( !QFileInfo( file ).isReadable() ) {
- QAD_MessageBox::error1( myParent,
- QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ),
- QObject::tr( "BUT_OK" ) );
- return false;
- }
- return true;
-}
-
-/* returns false if can't save file */
-bool QAD_FileValidator::canSave( const QString& file )
-{
-MESSAGE ( "QAD_FileValidator::canSave" )
- if ( QFile::exists( file ) ) {
- // if file exists - raise warning...
- if ( QAD_MessageBox::warn2( myParent,
- QObject::tr( "WRN_WARNING" ),
- QObject::tr( "QUE_DOC_FILEEXISTS" ).arg( file ),
- QObject::tr( "BUT_YES" ),
- QObject::tr( "BUT_NO" ),
- QAD_YES,
- QAD_NO,
- QAD_NO ) == QAD_NO ) {
- return false;
- }
- // ... and if user wants to overwrite file, check it for writeability
- if ( !QFileInfo( file ).isWritable() ) {
- QAD_MessageBox::error1( myParent,
- QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ),
- QObject::tr( "BUT_OK" ) );
- return false;
- }
- }
- else {
- // if file doesn't exist - try to create it
- QFile qf( file );
- if ( !qf.open( IO_WriteOnly ) ) {
- QAD_MessageBox::error1( myParent,
- QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ),
- QObject::tr( "BUT_OK" ) );
- return false;
- }
- else {
- // remove just created file
- qf.close();
- qf.remove();
- }
- }
- return true;
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_FileValidator.h
-// Author :
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_FILEVALIDATOR_H
-#define QAD_FILEVALIDATOR_H
-
-#include <qwidget.h>
-#include "QAD.h"
-
-class QAD_EXPORT QAD_FileValidator
-{
-public:
- QAD_FileValidator(QWidget* parent = 0);
-
- virtual bool canOpen( const QString& file );
- virtual bool canSave( const QString& file );
-
- private:
- QWidget* myParent;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Help.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_Help.h"
-using namespace std;
-
-/*!
- \class QAD_Help QAD_HelpL.h
- \brief Shows help in QAD-based applications.
-*/
-
-/*!
- Constructor
-*/
-QAD_Help::QAD_Help()
-{
-}
-
-/*!
- Destructor
-*/
-QAD_Help::~QAD_Help()
-{
-}
-
-/*!
- Shows help index
-*/
-void QAD_Help::index()
-{
-}
-
-/*!
- Help search
-*/
-void QAD_Help::search()
-{
-}
-
-/*!
- Shows help contents
-*/
-void QAD_Help::contents()
-{
-}
-
-/*!
- Shows context help for 'section' and 'topic'
-*/
-void QAD_Help::context( const QCString& section, const QCString& topic )
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Help.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_HELP_H
-#define QAD_HELP_H
-
-#include <qcstring.h>
-
-class QAD_Help
-{
-public:
- QAD_Help();
- ~QAD_Help();
-
- static void index();
- static void search();
- static void contents ();
- static void context( const QCString& context, const QCString& topic );
-};
-
-#endif
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_HelpWindow.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_HelpWindow QAD_HelpWindow.h
- \brief Html browser for help.
-*/
-
-#include "QAD_HelpWindow.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_Desktop.h"
-#include "QAD_Application.h"
-#include "QAD_Tools.h"
-
-// QT Includes
-#include <qapplication.h>
-#include <qtoolbar.h>
-#include <qmenubar.h>
-#include <qiconset.h>
-#include <qtoolbutton.h>
-#include <qcombobox.h>
-#include <qfileinfo.h>
-using namespace std;
-
-/*!
- Constructor
-*/
-QAD_HelpWindow::QAD_HelpWindow()
- : QMainWindow( 0, "SALOME Professional Help", WStyle_Customize | WType_TopLevel | WDestructiveClose ),
- pathCombo( 0 ), selectedURL()
-{
- QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
-
- // alternative palette
- setPalette( QAD_Application::getPalette(true) );
- // caption
- setCaption( tr("SALOMEGUI_HELP_TITLE") );
- // icon
- QPixmap icon ( rmgr->loadPixmap( "CLIENT", tr("ICON_DESK_DEFAULTICON") ) );
- if ( !icon.isNull() ) setIcon( icon );
-
- // create browser
- browser = new QTextBrowser( this );
- browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
- connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );
- setCentralWidget( browser );
-
- // menu/toolbar actions
- menuBar()->setItemEnabled( forwardId, FALSE);
- menuBar()->setItemEnabled( backwardId, FALSE);
- connect( browser, SIGNAL( backwardAvailable( bool ) ),
- this, SLOT( setBackwardAvailable( bool ) ) );
- connect( browser, SIGNAL( forwardAvailable( bool ) ),
- this, SLOT( setForwardAvailable( bool ) ) );
-
- QIconSet icon_back( QPixmap(rmgr->loadPixmap("QAD", tr("ICON_APP_HELP_BACK")) ));
- QIconSet icon_forward( QPixmap(rmgr->loadPixmap("QAD", tr("ICON_APP_HELP_FORWARD")) ));
- QIconSet icon_home( QPixmap(rmgr->loadPixmap("QAD", tr("ICON_APP_HELP_HOME")) ));
-
- QToolBar* toolbar = new QToolBar( this );
- addToolBar( toolbar, "Toolbar");
- QToolButton* button;
-
- button = new QToolButton( icon_back, tr("TOT_HELPWINDOW_BACKWARD"), "", browser, SLOT(backward()), toolbar );
- connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
- button->setEnabled( FALSE );
- button = new QToolButton( icon_forward, tr("TOT_HELPWINDOW_FORWARD"), "", browser, SLOT(forward()), toolbar );
- connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
- button->setEnabled( FALSE );
- button = new QToolButton( icon_home, tr("TOT_HELPWINDOW_HOME"), "", browser, SLOT(home()), toolbar );
-
- toolbar->addSeparator();
-
- pathCombo = new QComboBox( TRUE, toolbar );
- pathCombo->setInsertionPolicy(QComboBox::NoInsertion);
- pathCombo->setDuplicatesEnabled(false);
- connect( pathCombo, SIGNAL( activated( const QString & ) ),
- this, SLOT( pathSelected( const QString & ) ) );
- toolbar->setStretchableWidget( pathCombo );
- setRightJustification( TRUE );
- setDockEnabled( Left, FALSE );
- setDockEnabled( Right, FALSE );
- setDockEnabled( Bottom, FALSE );
- setDockEnabled( TornOff, FALSE );
- setDockMenuEnabled( false );
-
- /*
- // look for index.html and set homeDir
- // 1. $(KERNEL_ROOT_DIR)/doc/index.html
- // 2. $(KERNEL_ROOT_DIR)/doc/html/index.html
- // 3. $(KERNEL_ROOT_DIR)/doc/html/html/index.html
- // 4. /usr/local/doc/html/index.html
-
- QCString dir;
- QString root;
- if ( (dir = getenv("KERNEL_ROOT_DIR")) ) {
- root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- homeDir = root;
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- homeDir = root;
- }
- else {
- root = QAD_Tools::addSlash( root + "html" );
- if ( QFileInfo( root + "index.html" ).exists() ) {
- homeDir = root;
- }
- }
- }
- }
- if ( root.isEmpty() ) {
- if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) {
- homeDir = "/usr/local/doc/html/";
- }
- }
- if ( root.isEmpty() )
- root = "./doc/";
-
- browser->setSource( QFileInfo( homeDir + "index.html" ).absFilePath() );
- */
- browser->setFocus();
-
- QSize dSize = QApplication::desktop()->size();
- int x = ( dSize.width() - 750 ) / 2;
- int y = ( dSize.height() - 680 ) / 2;
- setGeometry( x, y, 750, 680 );
-}
-
-/*!
- Destructor
-*/
-QAD_HelpWindow::~QAD_HelpWindow()
-{
- emit(helpWindowClosed());
-}
-
-/*!
- enables/disables <Backward> button
-*/
-void QAD_HelpWindow::setBackwardAvailable( bool b)
-{
- menuBar()->setItemEnabled( backwardId, b);
-}
-
-/*!
- enables/disables <Forward> button
- */
-void QAD_HelpWindow::setForwardAvailable( bool b)
-{
- menuBar()->setItemEnabled( forwardId, b);
-}
-
-/*!
- called when new document is loaded into browser
-*/
-void QAD_HelpWindow::textChanged()
-{
- if ( browser->documentTitle().isNull() && browser->context().isNull() && browser->source().isNull() )
- browser->clear();
- selectedURL = browser->source(); //caption();
- if ( !selectedURL.isEmpty() && pathCombo ) {
- bool exists = FALSE;
- int i;
- for ( i = 0; i < pathCombo->count(); ++i ) {
- if ( pathCombo->text( i ) == selectedURL ) {
- exists = TRUE;
- break;
- }
- }
- if ( !exists ) {
- pathCombo->insertItem( selectedURL, 0 );
- pathCombo->setCurrentItem( 0 );
- } else {
- pathCombo->setCurrentItem( i );
- }
- selectedURL = QString::null;
- }
-}
-
-/*!
- called when users selectes dosument from the combo box
-*/
-void QAD_HelpWindow::pathSelected( const QString& _path )
-{
- browser->setSource( _path );
-}
-
-/*!
- goes back to the contents
-*/
-void QAD_HelpWindow::contents()
-{
- browser->home();
-}
-
-/*!
- opens new document in browser window and makes context search
- <_source> is a filename, can be relative, if empty, index.html name is used
- <_context> is a context, e.g. link in the file
-*/
-void QAD_HelpWindow::context( const QString& _source, const QString& _context)
-{
- QString src;
- if ( _source.isEmpty() ) {
- src = homeDir + "index.html";
- }
- else {
- QFileInfo fi( _source );
- if ( fi.isRelative() )
- src = homeDir + _source;
- else
- src = _source;
- }
- if ( !_context.isEmpty() )
- src += "#" + _context;
- browser->setSource( src );
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_HelpWindow.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_HELPWINDOW_H
-#define QAD_HELPWINDOW_H
-
-#include <qmainwindow.h>
-#include <qtextbrowser.h>
-
-class QComboBox;
-class QPopupMenu;
-
-class QAD_HelpWindow : public QMainWindow
-{
- Q_OBJECT
-public:
- QAD_HelpWindow();
- ~QAD_HelpWindow();
-
- void contents();
- void context( const QString& _source, const QString& _context = QString::null );
-
-private slots:
- void setBackwardAvailable( bool );
- void setForwardAvailable( bool );
- void textChanged();
- void pathSelected( const QString & );
-
-signals:
- void helpWindowClosed();
-
-private:
- QTextBrowser* browser;
- QComboBox* pathCombo;
- int backwardId, forwardId;
- QString selectedURL;
- QString homeDir;
-
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_LeftFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_LeftFrame.h"
-#include "QAD_ObjectBrowser.h"
-#include <qlayout.h>
-using namespace std;
-
-/*!
- \class QAD_LeftFrame QAD_LeftFrame.h
- \brief Frame window which contains QAD_ObjectBrowser.
-*/
-
-/*!
- Constructor
-*/
-QAD_LeftFrame::QAD_LeftFrame( SALOMEDS::Study_var study, QWidget *parent, const char *name)
- : QWidget( parent, name )
-{
- QVBoxLayout* layout = new QVBoxLayout( this );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- myObjectBrowser = new QAD_ObjectBrowser( study, this );
- layout->addWidget( myObjectBrowser );
-}
-
-/*!
- Destructor
-*/
-QAD_LeftFrame::~QAD_LeftFrame()
-{
-}
-
-/*!
- Returns reference to Object Browser [ static ]
-*/
-QAD_ObjectBrowser* QAD_LeftFrame::getObjectBrowser() const
-{
- return myObjectBrowser;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_LeftFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_LeftFrame_H
-#define QAD_LeftFrame_H
-
-#include "QAD.h"
-#include <qwidget.h>
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-class QAD_ObjectBrowser;
-
-class QAD_EXPORT QAD_LeftFrame : public QWidget
-{
-public:
- QAD_LeftFrame( SALOMEDS::Study_var study, QWidget *parent, const char *name );
- ~QAD_LeftFrame();
-
- QAD_ObjectBrowser* getObjectBrowser() const;
-
-protected:
- QAD_ObjectBrowser* myObjectBrowser;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ListMenuIdAction.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_ListMenuIdAction.h"
-using namespace std;
-
-QAD_ListMenuIdAction::QAD_ListMenuIdAction(QPopupMenu* theMenu,
- int id,
- QActionP* theAction)
-{
- myMenu = theMenu;
- myId = id;
- myAction = theAction;
-}
-
-QAD_ListMenuIdAction::~QAD_ListMenuIdAction()
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ListMenuIdAction.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_LISTMENUIDACTION_H
-#define QAD_LISTMENUIDACTION_H
-
-#include <qpopupmenu.h>
-#include "qactionP.h"
-
-class QAD_ListMenuIdAction
-{
-
-public:
- QAD_ListMenuIdAction(QPopupMenu*,int,QActionP*);
- virtual ~QAD_ListMenuIdAction();
-
- int getId() {return myId;}
- QPopupMenu* getMenu() {return myMenu;}
- QActionP* getAction() {return myAction;}
-
-private:
- QPopupMenu* myMenu;
- int myId;
- QActionP* myAction;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ListPopupMenu.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_ListPopupMenu.h"
-using namespace std;
-
-/*!
- Constructor.
-*/
-QAD_ListPopupMenu::QAD_ListPopupMenu(QPopupMenu* thePopup,
- const QString & theContext,
- const QString & theParent,
- const QString & theObject)
-{
- myPopup = thePopup;
- myContext = theContext;
- myParent = theParent;
- myObject = theObject;
-}
-
-/*!
- Destructor.
-*/
-QAD_ListPopupMenu::~QAD_ListPopupMenu()
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ListPopupMenu.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_LISTPOPUPMENU_H
-#define QAD_LISTPOPUPMENU_H
-
-#include <qpopupmenu.h>
-
-class QAD_ListPopupMenu
-{
-
-public:
- QAD_ListPopupMenu(QPopupMenu*,
- const QString & theContext,
- const QString & theParent,
- const QString & theObject);
- virtual ~QAD_ListPopupMenu();
-
- QPopupMenu* getPopup() {return myPopup;}
- QString & getContext() {return myContext;}
- QString & getParent() {return myParent;}
- QString & getObject() {return myObject;}
-
-private:
- QPopupMenu* myPopup;
- QString myContext;
- QString myParent;
- QString myObject;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_ListView.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "QAD_ListView.h"
-
-#include <qheader.h>
-#include <qvalidator.h>
-#include <qapplication.h>
-#include <qtoolbutton.h>
-
-#include "QAD_Desktop.h"
-
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-
-#include "utilities.h"
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////
-// QAD_ListView class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : computeEditGeometry
-// Purpose : static function - used for resizing editing widget
-//================================================================
-void computeEditGeometry(QAD_ListViewItem* theItem,
- QAD_EntityEdit* theWidget)
-{
- if (!theItem)
- return;
- QListView* aListView = theItem->listView();
- int anEditColumn = theItem->getEditedColumn();
- if (anEditColumn < 0)
- return;
-
- int aX = 0, aY = 0, aW = 0, aH = 0;
-
- QRect aRect = aListView->itemRect(theItem);
- aListView->contentsToViewport(aListView->header()->sectionPos(anEditColumn), 0, aX, aY);
- if (aX < 0)
- aX = 0; // THIS CAN BE REMOVED
- QSize aSize = theWidget->getControl()->sizeHint();
- aH = QMAX(aSize.height() , aRect.height() );
- aY = aRect.y() - ((aH - aRect.height()) / 2);
- //aW = aListView->columnWidth(anEditColumn); // CAN SUBSTITUTE NEXT 3 ROWS
- aW = aListView->viewport()->width() - aX;
- if (aW < 0)
- aW = 0;
- theWidget->setGeometry(aX, aY, aW, aH);
-}
-
-//================================================================
-// Function : QAD_ListView::QAD_ListView
-// Purpose : constructor
-//================================================================
-QAD_ListView::QAD_ListView(QWidget *parent) :
-QListView(parent)
-{
- myPopup = 0;
- myMouseEnabled = true;
- myEditingEnabled = false;
- enablePopup( true );
- setSelectionMode(Single);
- setSorting(-1);
- setRootIsDecorated(false);
- setAllColumnsShowFocus(false);
-// header()->setClickEnabled(false);
- header()->setMovingEnabled(false);
-
- myEditedItem = 0;
- myEdit = 0;
-
- viewport()->installEventFilter(this);
-
- connect(this, SIGNAL(selectionChanged()),
- this, SLOT(onSelectionChanged()));
- connect(header(), SIGNAL(sizeChange(int, int, int)),
- this, SLOT(onHeaderSizeChange(int, int, int)));
-}
-
-//================================================================
-// Function : QAD_ListView::~QAD_ListView
-// Purpose : destructor
-//================================================================
-QAD_ListView::~QAD_ListView()
-{
-// destroy popup menu
- deletePopupMenu();
- if (myEdit) {
- delete myEdit;
- }
- myEdit = 0;
- myEditedItem = 0;
-}
-
-//================================================================
-// Function : QAD_ListView::updateViewer
-// Purpose : updates all data viewer
-//================================================================
-void QAD_ListView::updateViewer()
-{
- // temporary disconnecting selection changed SIGNAL
- blockSignals(true);
- QAD_ListViewItem* aRoot = (QAD_ListViewItem*)firstChild();
- if (aRoot)
- aRoot->updateAllLevels();
- updateContents();
- // connecting again selection changed SIGNAL
- blockSignals(false);
- emit selectionChanged();
-}
-
-//================================================================
-// Function : QAD_ListView::updateSelected
-// Purpose : updates currently selected item(s)
-//================================================================
-void QAD_ListView::updateSelected()
-{
- // temporary disconnecting selection changed SIGNAL
- blockSignals(true);
- QAD_ListViewItem* aChild = (QAD_ListViewItem*)selectedItem();
- if (aChild)
- aChild->updateAllLevels();
- updateContents();
- // connecting again selection changed SIGNAL
- blockSignals(false);
- emit selectionChanged();
-}
-
-//================================================================
-// Function : QAD_ListView::onCreatePopup
-// Purpose : fills popup menu with items
-//================================================================
-void QAD_ListView::onCreatePopup()
-{
- if (myPopup) {
- // add items here...
- }
-}
-
-//================================================================
-// Function : QAD_ListView::deletePopupMenu
-// Purpose : delete popup menu
-//================================================================
-void QAD_ListView::deletePopupMenu()
-{
- if (myPopup) {
- destroyPopup();
- delete myPopup;
- myPopup = 0;
- }
-}
-
-//================================================================
-// Function : QAD_ListView::clear
-// Purpose : clears view
-//================================================================
-void QAD_ListView::clear()
-{
- if (myEdit) {
- delete myEdit;
- myEdit = 0;
- myEditedItem = 0;
- }
- QListView::clear();
-}
-
-//================================================================
-// Function : QAD_ListView::isMouseEnabled
-// Purpose : returms true if mouse events are enabled
-//================================================================
-bool QAD_ListView::isMouseEnabled()
-{
- return myMouseEnabled;
-}
-
-//================================================================
-// Function : QAD_ListView::enableMouse
-// Purpose : enabled/disables mouse events (excluding MouseMove)
-//================================================================
-void QAD_ListView::enableMouse(bool enable)
-{
- myMouseEnabled = enable;
-}
-
-//================================================================
-// Function : QAD_ListView::eventFilter
-// Purpose : event filter
-//================================================================
-bool QAD_ListView::eventFilter(QObject* object, QEvent* event)
-{
- if (object == viewport() &&
- (event->type() == QEvent::MouseButtonPress ||
- event->type() == QEvent::MouseButtonRelease ||
- event->type() == QEvent::MouseButtonDblClick) &&
- !isMouseEnabled())
- return true;
- else
- return QListView::eventFilter(object, event);
-}
-
-//================================================================
-// Function : QAD_ListView::enableEditing
-// Purpose : setting editing of items availbale/not available
-//================================================================
-void QAD_ListView::enableEditing(bool theFlag)
-{
- myEditingEnabled = theFlag;
- if (!myEditingEnabled) {
- if (myEdit) {
- delete myEdit;
- myEdit = 0;
- myEditedItem = 0;
- }
- }
-}
-
-//================================================================
-// Function : QAD_ListView::isEnableEditing
-// Purpose : says if editing is enabled
-//================================================================
-bool QAD_ListView::isEnableEditing()
-{
- return myEditingEnabled;
-}
-
-//================================================================
-// Function : QAD_ListView::accept
-// Purpose : calls finishEditing(true)...
-//================================================================
-void QAD_ListView::accept()
-{
- finishEditing(true);
-}
-
-//================================================================
-// Function : QAD_ListView::contentsMouseReleaseEvent
-// Purpose : mouse release button event
-//================================================================
-void QAD_ListView::contentsMouseReleaseEvent(QMouseEvent* e)
-{
- QListView::contentsMouseReleaseEvent(e);
- // destroy popup menu if exist
- qApp->processEvents();
- // create popup menu on right button click
- if(e->button() == RightButton) {
-
- deletePopupMenu();
- QPopupMenu* aPopup = createPopup();
- if (aPopup) {
- myPopup = aPopup;
- if (myPopup->count() > 0)
- //myPopup->exec(QCursor::pos());
- myPopup->popup(e->globalPos());
- }
- }
-}
-
-//================================================================
-// Function : QAD_ListView::onSelectionChanged
-// Purpose : slot, called when selection changed in List Viewer
-//================================================================
-void QAD_ListView::onSelectionChanged()
-{
- if (myEdit) {
- finishEditing(true);
- delete myEdit;
- myEdit = 0;
- if (myEditedItem && !myEditedItem->isAccepted()) {
- delete myEditedItem;
- updateContents();
- }
- myEditedItem = 0;
- }
- // editing is allowed in Single Selection Mode only
- if (selectionMode() != Single || !isEnableEditing())
- return;
- QAD_ListViewItem* anItem = (QAD_ListViewItem*)selectedItem();
- if (anItem) {
- if (!anItem->isEditable())
- return;
- myEdit = anItem->startEditing();
- if (myEdit) {
- connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk()));
- connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel()));
- myEditedItem = anItem;
- myEdit->show();
- myEdit->setFocus();
- }
- }
-}
-
-//================================================================
-// Function : QAD_ListView::resizeEvent
-// Purpose : called when Data Viewer is resized
-//================================================================
-void QAD_ListView::resizeEvent( QResizeEvent * e)
-{
- QListView::resizeEvent(e);
- int aW = columnWidth(columns()-1);
- int aX = header()->sectionPos(columns()-1);
- if (aW < width() - frameWidth() * 2 - aX - 1)
- setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
- updateContents();
-}
-
-//================================================================
-// Function : QAD_ListView::onHeaderSizeChange
-// Purpose : slot, called when columns sizes are changed
-//================================================================
-void QAD_ListView::onHeaderSizeChange(int, int, int)
-{
- int aW = columnWidth(columns()-1);
- int aX = header()->sectionPos(columns()-1);
- if (aW < width() - frameWidth() * 2 - aX - 1)
- setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
-}
-
-//================================================================
-// Function : QAD_ListView::viewportPaintEvent
-// Purpose : handler for paint event
-//================================================================
-void QAD_ListView::viewportPaintEvent(QPaintEvent* e)
-{
- QListView::viewportPaintEvent(e);
- if (myEditedItem && myEdit) {
- computeEditGeometry(myEditedItem, myEdit);
- }
-}
-
-//================================================================
-// Function : QAD_ListView::onEditOk
-// Purpose : called when user finishes in editing of item
-//================================================================
-void QAD_ListView::onEditOk()
-{
- finishEditing(true);
-}
-
-//================================================================
-// Function : QAD_ListView::onEditCancel
-// Purpose : called when user cancels item editing
-//================================================================
-void QAD_ListView::onEditCancel()
-{
- finishEditing(false);
-}
-
-//================================================================
-// Function : QAD_ListView::finishEditing
-// Purpose : finishes editing of entity
-//================================================================
-UpdateType QAD_ListView::finishEditing(bool ok)
-{
- UpdateType aNeedsUpdate = utCancel;
- if (myEditedItem && myEdit)
- {
- disconnect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk()));
- disconnect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel()));
- myEditedItem->setAccepted(true);
- if (ok) {
- aNeedsUpdate = myEditedItem->finishEditing(myEdit);
- if (aNeedsUpdate == utCancel) {
- // something to do here on Cancel...
- }
- else {
- // something to do here on OK...
- }
- // updating contents
- switch (aNeedsUpdate) {
- case utUpdateItem:
- {
- if (myEditedItem)
- myEditedItem->updateAllLevels();
- break;
- }
- case utUpdateParent:
- {
- if (myEditedItem) {
- QAD_ListViewItem* aParent = (QAD_ListViewItem*)(myEditedItem->parent());
- if (aParent)
- aParent->updateAllLevels();
- else
- myEditedItem->updateAllLevels();
- }
- break;
- }
- case utUpdateViewer:
- {
- updateViewer();
- break;
- }
- case utUpdateAll:
- {
- // doing the same as for utUpdateViewer here
- // descendants can add extra processing
- updateViewer();
- break;
- }
- default:
- break;
- }
- }
- }
-
- // hide <myEdit> widget
- if (myEdit) {
- myEdit->hide();
- }
-
- return aNeedsUpdate;
-}
-
-//================================================================
-// Function : QAD_ListView::tip
-// Purpose : gets current tooltip for list view
-// returns valid rect in success
-//================================================================
-QRect QAD_ListView::tip(QPoint aPos,
- QString& aText,
- QRect& dspRect,
- QFont& dspFnt) const
-{
- QRect result( -1, -1, -1, -1 );
- QAD_ListViewItem* aItem = (QAD_ListViewItem*)itemAt( aPos );
- if ( aItem ) {
- for (int i = 0; i < columns(); i++) {
- QRect aItemRect = aItem->itemRect(i);
- QRect aTextRect = aItem->textRect(i);
- if ( !aItem->text(i).isEmpty() &&
- ( aItemRect.width() > header()->sectionSize(i) ||
- aTextRect.left() < 0 ||
- aTextRect.top() < 0 ||
- aTextRect.right() > viewport()->width() ||
- aTextRect.bottom() > viewport()->height() ) ) {
- // calculating tip data
- aText = aItem->tipText();
- dspRect = aItem->tipRect();
- dspFnt = font();
- if (dspRect.isValid()) {
- result = QRect(QPoint(0, aItemRect.top()),
- QSize(viewport()->width(), aItemRect.height()));
- }
- }
- }
- }
- return result;
-}
-
-//////////////////////////////////////////////////////////////////////
-// QAD_ListViewItem Class Implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent) :
-QListViewItem( parent )
-{
- init();
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after) :
-QListViewItem( parent, after )
-{
- init();
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent,
- const QString theName,
- const bool theEditable) :
-QListViewItem(parent, theName)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent,
- const QString theName,
- const QString theValue,
- const bool theEditable) :
-QListViewItem(parent, theName, theValue)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListViewItem* parent,
- const QString theName,
- const bool theEditable) :
-QListViewItem(parent, theName)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListViewItem* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const bool theEditable) :
-QListViewItem(parent, after, theName)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const bool theEditable) :
-QListViewItem(parent, after, theName)
-{
- init();
- setEditable(theEditable);
-}
-
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListViewItem* parent,
- const QString theName,
- const QString theValue,
- const bool theEditable) :
-QListViewItem(parent, theName, theValue)
-{
- init();
- setEditable(theEditable);
-}
-
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListViewItem* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const QString theValue,
- const bool theEditable) :
-QListViewItem(parent, after, theName, theValue)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::QAD_ListViewItem
-// Purpose : constructor
-//================================================================
-QAD_ListViewItem::QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const QString theValue,
- const bool theEditable) :
-QListViewItem(parent, after, theName, theValue)
-{
- init();
- setEditable(theEditable);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::~QAD_ListViewItem
-// Purpose : destructor
-//================================================================
-QAD_ListViewItem::~QAD_ListViewItem()
-{
-}
-
-//================================================================
-// Function : QAD_ListViewItem::init
-// Purpose : initialization
-//================================================================
-void QAD_ListViewItem::init()
-{
- myEditable = false;
- myAccepted = true;
- myEditingType = (int)QAD_EntityEdit::etLineEdit;
- myValueType = (int)QAD_EntityEdit::vtString;
- myButtons = 0;
- myUserType = -1;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getName
-// Purpose : as default returns text in the first column
-//================================================================
-QString QAD_ListViewItem::getName() const
-{
- return ( listView()->columns() > 0 ) ? text(0) : QString("");
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setName
-// Purpose : as default sets text in the first column
-//================================================================
-UpdateType QAD_ListViewItem::setName(const QString theName)
-{
- UpdateType aNeedsUpdate = utCancel;
- if (listView()->columns() > 0) {
- setText(0, theName);
- aNeedsUpdate = utNone;
- }
- return aNeedsUpdate;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getValue
-// Purpose : as default returns text in the second column
-//================================================================
-QString QAD_ListViewItem::getValue() const
-{
- return ( listView()->columns() > 1 ) ? text(1) : QString("");
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setValue
-// Purpose : as default sets text in the second column
-//================================================================
-UpdateType QAD_ListViewItem::setValue(const QString theValue)
-{
- UpdateType aNeedsUpdate = utCancel;
- if (listView()->columns() > 1) {
- setText(1, theValue);
- aNeedsUpdate = utNone;
- }
- return aNeedsUpdate;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::fullName
-// Purpose : returns full path to the entity from the root
-//================================================================
-QString QAD_ListViewItem::fullName()
-{
- QString aFullName = getName();
- QAD_ListViewItem* aParent = (QAD_ListViewItem*)parent();
- while(aParent != NULL) {
- aFullName = aParent->getName() + QString(".") + aFullName;
- aParent = (QAD_ListViewItem*)(aParent->parent());
- }
- return aFullName;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::openAllLevels
-// Purpose : expands all entities beginning from this level
-//================================================================
-void QAD_ListViewItem::openAllLevels()
-{
- setOpen(true);
- QAD_ListViewItem* aChild = (QAD_ListViewItem*)firstChild();
- while( aChild ) {
- aChild->openAllLevels();
- aChild = (QAD_ListViewItem*)(aChild->nextSibling());
- }
-}
-
-//================================================================
-// Function : QAD_ListViewItem::updateAllLevels
-// Purpose : update all entites beginning from this level
-//================================================================
-void QAD_ListViewItem::updateAllLevels()
-{
- QAD_ListViewItem* aChild = (QAD_ListViewItem*)firstChild();
- while( aChild ) {
- aChild->updateAllLevels();
- aChild = (QAD_ListViewItem*)(aChild->nextSibling());
- }
-}
-
-//================================================================
-// Function : QAD_EditBox::isEditable
-// Purpose : return true if entity is editable
-//================================================================
-bool QAD_ListViewItem::isEditable() const
-{
- return myEditable;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setEditable
-// Purpose : sets editable flag fo the entity
-//================================================================
-void QAD_ListViewItem::setEditable(bool theEditable)
-{
- myEditable = theEditable;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::isAccepted
-// Purpose : returns true if entitiy is accepted after editing
-//================================================================
-bool QAD_ListViewItem::isAccepted() const
-{
- return myAccepted;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setAccepted
-// Purpose : set entitiy accepted or not after editing
-//================================================================
-void QAD_ListViewItem::setAccepted(bool theAccepted)
-{
- myAccepted = theAccepted;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getEditingType
-// Purpose : returns type of edit control (0 - edit box, 1 - combo box,
-// 2 - editable combo box), default is edit box
-//================================================================
-int QAD_ListViewItem::getEditingType()
-{
- return myEditingType;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setEditingType
-// Purpose : sets type of edit control (0 - edit box, 1 - combo box,
-// 2 - editable combo box), negative value means none
-//================================================================
-void QAD_ListViewItem::setEditingType(const int type)
-{
- myEditingType = type;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getEditedColumn
-// Purpose : returns edited column, default is last column
-// negative value means there are no editable columns
-//================================================================
-int QAD_ListViewItem::getEditedColumn()
-{
- return listView()->columns()-1;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getValueType
-// Purpose : returns type of edited value (string, int, double)
-// default is string
-//================================================================
-int QAD_ListViewItem::getValueType()
-{
- return myValueType;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setValueType
-// Purpose : sets type of edited value
-//================================================================
-void QAD_ListViewItem::setValueType(const int valueType)
-{
- myValueType = valueType;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getUserType
-// Purpose : sets type of edited value
-//================================================================
-int QAD_ListViewItem::getUserType()
-{
- return myUserType;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::setUserType
-// Purpose : sets type of edited value
-//================================================================
-void QAD_ListViewItem::setUserType(const int userType)
-{
- myUserType = userType;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getButtons
-// Purpose : returns buttons for editing widget (Apply (V), Cancel (X))
-// default is both buttons
-//================================================================
-int QAD_ListViewItem::getButtons()
-{
- return myButtons;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::getButtons
-// Purpose : sets buttons for editing widget (Apply (V), Cancel (X))
-//================================================================
-void QAD_ListViewItem::setButtons(const int buttons)
-{
- myButtons = buttons;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::startEditing
-// Purpose : creates control for editing and fills it with values
-//================================================================
-QAD_EntityEdit* QAD_ListViewItem::startEditing()
-{
- QAD_EntityEdit* aWidget = 0;
- QListView* aListView = listView();
- if (aListView) {
- if (!isEditable())
- return 0;
- int anEditType = getEditingType();
- int aValueType = getValueType();
- int aButtons = getButtons();
- int anEditColumn = getEditedColumn();
- if (anEditColumn < 0 || anEditType < 0)
- return 0;
- aWidget = new QAD_EntityEdit(aListView->viewport(),
- anEditType,
- aValueType,
- aButtons & QAD_EntityEdit::btApply,
- aButtons & QAD_EntityEdit::btCancel);
- computeEditGeometry(this, aWidget);
-
- fillWidgetWithValues(aWidget);
- }
- return aWidget;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::fillWidgetWithValues
-// Purpose : fills widget with initial values (list or single value)
-//================================================================
-void QAD_ListViewItem::fillWidgetWithValues(QAD_EntityEdit* theWidget)
-{
- int anEditColumn = getEditedColumn();
- if (theWidget && anEditColumn >= 0 && !text(anEditColumn).isEmpty())
- theWidget->insertItem(text(anEditColumn), true);
-}
-
-//================================================================
-// Function : QAD_ListViewItem::finishEditing
-// Purpose : finishes editing of entity
-//================================================================
-UpdateType QAD_ListViewItem::finishEditing(QAD_EntityEdit* theWidget)
-{
- UpdateType aNeedsUpdate = utCancel;
- try {
- if (theWidget) {
- int anEditColumn = getEditedColumn();
- switch (anEditColumn) {
- case 0:
- aNeedsUpdate = setName(theWidget->getText());
- break;
- case 1:
- aNeedsUpdate = setValue(theWidget->getText());
- break;
- default:
- break;
- }
- }
- }
- catch (...) {
- MESSAGE( "System error has been caught - QAD_ListViewItem::finishEditing" )
- }
- return aNeedsUpdate;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::tipRect
-// Purpose : calculates rectangle which should contain item's tip
-//================================================================
-QRect QAD_ListViewItem::tipRect()
-{
- QRect aRect = QRect(-1, -1, -1, -1);
- QRect aItemRect = listView()->itemRect(this);
- if ( !aItemRect.isValid() )
- return aItemRect;
-
- QString aTip = tipText();
- if (!aTip.isEmpty()) {
- QRect aRect0 = textRect(0);
- QFont aFont(listView()->font());
- QFontMetrics fm(aFont);
- int iw = fm.width(aTip);
- aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(),
- aRect0.y()),
- QSize (iw,
- aRect0.height()));
- }
- return aRect;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::tipText
-// Purpose : returns text for tooltip
-//================================================================
-QString QAD_ListViewItem::tipText()
-{
- QString aText = getName();
- if (!getValue().isEmpty())
- aText += QString(" : ") + getValue();
- return aText;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::textRect
-// Purpose : calculates rect of item text in viewport coordinates
-//================================================================
-QRect QAD_ListViewItem::textRect(const int column) const
-{
- QRect aItemRect = listView()->itemRect( this );
- if ( !aItemRect.isValid() )
- return aItemRect;
-
- QFont aFont(listView()->font());
- QFontMetrics fm(aFont);
-
- int decorWidth = ( listView()->rootIsDecorated() ) ?
- ( listView()->treeStepSize() * (depth() + 1) ) :
- ( listView()->treeStepSize() * depth() );
- int pixmapWidth = ( pixmap(column) ) ?
- pixmap(column)->width() + listView()->itemMargin() * 2 :
- listView()->itemMargin();
- int prevWidth = 0;
- for (int i = 0; i < column; i++)
- prevWidth += listView()->header()->sectionSize(i);
- int ix = prevWidth +
- pixmapWidth +
- ((column == 0) ? decorWidth : 0);
- int iy = aItemRect.y();
- int iw = fm.width(text(column));
- int ih = aItemRect.height();
- if (pixmap(column)) {
- iy += listView()->itemMargin();
- ih -= listView()->itemMargin() * 2;
- }
- ix -= listView()->contentsX();
-
- QRect theResult(QPoint(ix, iy), QSize(iw, ih));
- return theResult;
-}
-
-//================================================================
-// Function : QAD_ListViewItem::itemRect
-// Purpose : calculates rect of item data in viewport coordinates
-//================================================================
-QRect QAD_ListViewItem::itemRect(const int column) const
-{
- QRect aItemRect = listView()->itemRect( this );
- if ( !aItemRect.isValid() )
- return aItemRect;
-
- QFont aFont(listView()->font());
- QFontMetrics fm(aFont);
-
- int decorWidth = ( listView()->rootIsDecorated() ) ?
- ( listView()->treeStepSize() * (depth() + 1) ) :
- ( listView()->treeStepSize() * depth() );
- int pixmapWidth = ( pixmap(column) ) ?
- pixmap(column)->width() + listView()->itemMargin() * 2 :
- 0;
- int prevWidth = 0;
- for (int i = 0; i < column; i++)
- prevWidth += listView()->header()->sectionSize(i);
- int ix = prevWidth;
- int iy = aItemRect.y();
- int iw = pixmapWidth +
- listView()->itemMargin() * 2 +
- ((column == 0) ? decorWidth : 0) +
- fm.width(text(column));
- int ih = aItemRect.height();
- ix -= listView()->contentsX();
-
- QRect theResult(QPoint(ix, iy), QSize(iw, ih));
- return theResult;
-}
-
-//////////////////////////////////////////////////////////////////////
-// QAD_EditBox class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : QAD_EditBox::QAD_EditBox
-// Purpose : constructor
-//================================================================
-QAD_EditBox::QAD_EditBox(QWidget* parent) :
-QLineEdit(parent)
-{
-}
-
-//================================================================
-// Function : QAD_EditBox::keyPressEvent
-// Purpose : event filter for key pressing
-//================================================================
-void QAD_EditBox::keyPressEvent( QKeyEvent *e )
-{
- if ( e->key() == Key_Escape )
- emit escapePressed();
- else
- QLineEdit::keyPressEvent( e );
- e->accept();
-}
-
-//////////////////////////////////////////////////////////////////////
-// QAD_ComboBox class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : QAD_ComboBox::QAD_ComboBox
-// Purpose : constructor
-//================================================================
-QAD_ComboBox::QAD_ComboBox(bool rw, QWidget* parent, const char* name) :
-QComboBox(rw, parent, name)
-{
-}
-
-//================================================================
-// Function : QAD_ComboBox::findItem
-// Purpose : searches item in list and returns its index
-//================================================================
-int QAD_ComboBox::findItem(const QString theText)
-{
- for (int i = 0; i < count(); i++)
- if (text(i) == theText)
- return i;
- return -1;
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertItem
-// Purpose : adds item in combo box
-//================================================================
-void QAD_ComboBox::insertItem(const QString& theValue,
- int theIndex)
-{
- if (duplicatesEnabled() || findItem(theValue) < 0)
- QComboBox::insertItem(theValue, theIndex);
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertList
-// Purpose : adds list of items in combo box
-//================================================================
-void QAD_ComboBox::insertList(const QStringList& theList)
-{
- for (unsigned i = 0; i < theList.count(); i++)
- insertItem(theList[i]);
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertItem
-// Purpose : adds item in combo box
-//================================================================
-void QAD_ComboBox::insertItem(const int theValue)
-{
- int aNum;
- bool bOk;
- for (int i = 0; i < count(); i++) {
- aNum = text(i).toInt(&bOk);
- if (bOk) {
- if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
- insertItem(QString::number(theValue), i);
- return;
- }
- }
- }
- insertItem(QString::number(theValue));
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertList
-// Purpose : adds list of items in combo box
-//================================================================
-void QAD_ComboBox::insertList(const TColStd_ListOfInteger& theList)
-{
- for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next())
- insertItem(aIter.Value());
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertItem
-// Purpose : adds item in combo box
-//================================================================
-void QAD_ComboBox::insertItem(const double theValue)
-{
- double aNum;
- bool bOk;
- for (int i = 0; i < count(); i++) {
- aNum = text(i).toDouble(&bOk);
- if (bOk) {
- if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
- insertItem(QString::number(theValue), i);
- return;
- }
- }
- }
- insertItem(QString::number(theValue));
-}
-
-//================================================================
-// Function : QAD_ComboBox::insertList
-// Purpose : adds list of items in combo box
-//================================================================
-void QAD_ComboBox::insertList(const TColStd_ListOfReal& theList)
-{
- for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next())
- insertItem(aIter.Value());
-}
-
-//////////////////////////////////////////////////////////////////////
-// QAD_EntityEdit class implementation
-//////////////////////////////////////////////////////////////////////
-
-#include <qlayout.h>
-
-#define MIN_COMBO_WIDTH 1
-#define MIN_EDIT_WIDTH 1
-
-//================================================================
-// Function : QAD_EntityEdit::QAD_EntityEdit
-// Purpose : constructor
-//================================================================
-QAD_EntityEdit::QAD_EntityEdit(QWidget* parent,
- int controlType,
- int valueType,
- bool butApply,
- bool butCancel) :
-QWidget(parent),
-myEdit(0),
-myCombo(0),
-myApplyBtn(0),
-myCancelBtn(0)
-{
- QHBoxLayout* aTopLayout = new QHBoxLayout(this);
- aTopLayout->setAlignment( Qt::AlignTop );
- aTopLayout->setSpacing( 0 );
- aTopLayout->setMargin( 1 );
- if (controlType != etLineEdit &&
- controlType != etComboBox &&
- controlType != etComboEdit)
- controlType = etLineEdit;
- if (controlType == etComboBox || controlType == etComboEdit) {
- // this is an editable combo box
- myCombo = new QAD_ComboBox(controlType == etComboEdit, this);
- myCombo->setMinimumSize(MIN_COMBO_WIDTH, 0);
- myCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
- QSizePolicy::Fixed));
- // no insertions
- myCombo->setInsertionPolicy(QComboBox::NoInsertion);
- // no duplicates enabled by default
- myCombo->setDuplicatesEnabled(false);
- aTopLayout->addWidget(myCombo);
- // connect signals
- connect(myCombo, SIGNAL(activated(const QString&)), this, SLOT(onComboActivated(const QString&)));
- connect(myCombo, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
- }
- else {
- // and this is an edit box
- myEdit = new QAD_EditBox(this);
- myEdit->setMinimumSize(MIN_EDIT_WIDTH, 0);
- myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
- QSizePolicy::Fixed));
- aTopLayout->addWidget(myEdit);
- connect(myEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
- connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onApply()));
- connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onCancel()));
- }
- if (valueType != vtString &&
- valueType != vtInteger &&
- valueType != vtDouble)
- valueType = vtString;
- if (valueType == vtInteger)
- setValidator(new QIntValidator(this));
- else if (valueType == vtDouble)
- setValidator(new QDoubleValidator(this));
- if (butApply) {
- // Apply button (V)
- myApplyBtn = new QToolButton(this);
- QPixmap anIcon = QAD_Desktop::getResourceManager()->loadPixmap(
- "QAD",tr("ICON_APPLY_BTN"));
- myApplyBtn->setPixmap(anIcon);
- myApplyBtn->setEnabled(false);
- myApplyBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- myApplyBtn->setMinimumSize(16, 16);
- myApplyBtn->setMaximumSize(16, 20);
- aTopLayout->addWidget(myApplyBtn);
- connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
- }
- if (butCancel) {
- // Cancel button (X)
- myCancelBtn = new QToolButton(this);
- QPixmap anIcon = QAD_Desktop::getResourceManager()->loadPixmap(
- "QAD",tr("ICON_CANCEL_BTN"));
- myCancelBtn->setPixmap(anIcon);
- myCancelBtn->setEnabled(false);
- myCancelBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
- myCancelBtn->setMinimumSize(16, 16);
- myCancelBtn->setMaximumSize(16, 20);
- aTopLayout->addWidget(myCancelBtn);
- connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(onCancel()));
- }
-}
-
-//================================================================
-// Function : QAD_EntityEdit::~QAD_EntityEdit
-// Purpose : destructor
-//================================================================
-QAD_EntityEdit::~QAD_EntityEdit()
-{
-}
-
-//================================================================
-// Function : QAD_EntityEdit::clear
-// Purpose : clears edit/combo box
-//================================================================
-void QAD_EntityEdit::clear()
-{
- if (myEdit)
- myEdit->clear();
- if (myCombo)
- myCombo->clear();
-}
-
-//================================================================
-// Function : QAD_EntityEdit::getText
-// Purpose : returns current text in edit box or combo box
-//================================================================
-QString QAD_EntityEdit::getText()
-{
- if (myEdit)
- return myEdit->text();
- else if (myCombo)
- return myCombo->currentText();
- else
- return "";
-}
-
-//================================================================
-// Function : QAD_EntityEdit::setText
-// Purpose : sets text
-//================================================================
-void QAD_EntityEdit::setText(const QString& theText)
-{
- myString = theText;
- if (myEdit)
- myEdit->setText(theText);
- if (myCombo) {
- int aFound = myCombo->findItem(theText);
- if (aFound >= 0) {
- myCombo->setCurrentItem(aFound);
- onTextChanged(theText);
- }
- }
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertItem
-// Purpose : adds item in combo box,
-// sets it current if theSetCurrent is true
-//================================================================
-void QAD_EntityEdit::insertItem(const QString& theValue,
- bool theSetCurrent,
- int theOrder)
-{
- if (myCombo) {
- int aIndexAt = -1;
- if (theOrder == atTop)
- aIndexAt = 0;
- else if (theOrder == atBeforeCurrent && myCombo->count() > 0)
- aIndexAt = myCombo->currentItem();
- else if (theOrder == atAfterCurrent &&
- myCombo->count() > 0 &&
- myCombo->currentItem() < myCombo->count()-1)
- aIndexAt = myCombo->currentItem() + 1;
- myCombo->insertItem(theValue, aIndexAt);
- }
- if (theSetCurrent)
- setText(theValue);
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertList
-// Purpose : adds items in combo box,
-// sets item theCurrent as current
-//================================================================
-void QAD_EntityEdit::insertList(const QStringList& theList,
- const int theCurrent)
-{
- if (myCombo)
- myCombo->insertList(theList);
- if (theCurrent >= 0 && theCurrent < (int)theList.count())
- setText(theList[theCurrent]);
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertItem
-// Purpose : adds item in combo box,
-// sets it current if theSetCurrent is true
-//================================================================
-void QAD_EntityEdit::insertItem(const int theValue,
- bool theSetCurrent)
-{
- if (myCombo) {
- myCombo->insertItem(theValue);
- }
- if (theSetCurrent)
- setText(QString::number(theValue));
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertList
-// Purpose : adds items in combo box,
-// sets item theCurrent as current
-//================================================================
-void QAD_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
- const int theCurrent)
-{
- if (myCombo)
- myCombo->insertList(theList);
-
- TColStd_ListIteratorOfListOfInteger aIter(theList);
- for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
- if (theCurrent == i) {
- setText(QString::number(aIter.Value()));
- break;
- }
- }
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertItem
-// Purpose : adds item in combo box,
-// sets it current if theSetCurrent is true
-//================================================================
-void QAD_EntityEdit::insertItem(const double theValue,
- bool theSetCurrent)
-{
- if (myCombo) {
- myCombo->insertItem(theValue);
- }
- if (theSetCurrent)
- setText(QString::number(theValue));
-}
-
-//================================================================
-// Function : QAD_EntityEdit::insertList
-// Purpose : adds items in combo box,
-// sets item theCurrent as current
-//================================================================
-void QAD_EntityEdit::insertList(const TColStd_ListOfReal& theList,
- const int theCurrent)
-{
- if (myCombo)
- myCombo->insertList(theList);
-
- TColStd_ListIteratorOfListOfReal aIter(theList);
- for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
- if (theCurrent == i) {
- setText(QString::number(aIter.Value()));
- break;
- }
- }
-}
-
-//================================================================
-// Function : QAD_EntityEdit::getControl
-// Purpose : gets actual widget
-//================================================================
-QWidget* QAD_EntityEdit::getControl()
-{
- if (myEdit)
- return myEdit;
- else if (myCombo)
- return myCombo;
- else
- return 0;
-}
-
-//================================================================
-// Function : QAD_EntityEdit::setFocus
-// Purpose : redirect focus to corresponding widget
-//================================================================
-void QAD_EntityEdit::setFocus()
-{
- if (myEdit) {
- myEdit->setFocus();
- //myEdit->selectAll();
- }
- else if (myCombo && myCombo->editable()) {
- myCombo->setFocus();
- //myCombo->lineEdit()->selectAll();
- }
-}
-
-//================================================================
-// Function : QAD_EntityEdit::setValidator
-// Purpose : sets validator for the control
-//================================================================
-void QAD_EntityEdit::setValidator(const QValidator* theValidator)
-{
- if (myEdit)
- myEdit->setValidator(theValidator);
- if (myCombo)
- myCombo->setValidator(theValidator);
-}
-
-//================================================================
-// Function : QAD_EntityEdit::keyPressEvent
-// Purpose : event filter for KeyPress event
-//================================================================
-void QAD_EntityEdit::keyPressEvent( QKeyEvent * e)
-{
- if ( (e->key() == Key_Enter ||
- e->key() == Key_Return ) )
- onApply();
- else if (e->key() == Key_Escape)
- onCancel();
-}
-
-//================================================================
-// Function : QAD_EntityEdit::onComboActivated
-// Purpose : called when item activated in combo box
-//================================================================
-void QAD_EntityEdit::onComboActivated(const QString& theText)
-{
- onTextChanged(theText);
-}
-
-//================================================================
-// Function : QAD_EntityEdit::onTextChanged
-// Purpose : slot, called when text changed in line edit
-//================================================================
-void QAD_EntityEdit::onTextChanged(const QString& theText)
-{
- if (myApplyBtn)
- myApplyBtn->setEnabled(!(theText == myString));
- if (myCancelBtn)
- myCancelBtn->setEnabled(!(theText == myString));
-}
-
-//================================================================
-// Function : QAD_EntityEdit::onCancel
-// Purpose : slot, called when user presses Cancel button
-//================================================================
-void QAD_EntityEdit::onCancel()
-{
- setText(myString);
- if (myApplyBtn)
- myApplyBtn->setEnabled(false);
- if (myCancelBtn)
- myCancelBtn->setEnabled(false);
- emit escapePressed();
-}
-
-//================================================================
-// Function : QAD_EntityEdit::onApply
-// Purpose : slot, called when user presses Apply button
-//================================================================
-void QAD_EntityEdit::onApply()
-{
- myString = getText();
- if (myApplyBtn)
- myApplyBtn->setEnabled(false);
- if (myCancelBtn)
- myCancelBtn->setEnabled(false);
- emit returnPressed();
-}
-
-//================================================================
-// Function : QAD_EntityEdit::showButtons
-// Purpose : shows/hides buttons
-//================================================================
-void QAD_EntityEdit::showButtons(bool show)
-{
- if (myApplyBtn)
- show ? myApplyBtn->show() : myApplyBtn->hide();
- if (myCancelBtn)
- show ? myCancelBtn->show() : myCancelBtn->hide();
-}
-
-//================================================================
-// Function : QAD_EntityEdit::setDuplicatesEnabled
-// Purpose : enables/disables data duplication (for combo box)
-//================================================================
-void QAD_EntityEdit::setDuplicatesEnabled(bool enabled)
-{
- if (myCombo)
- myCombo->setDuplicatesEnabled(enabled);
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_ListView.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#if !defined(_QAD_ListView_HeaderFile)
-#define _QAD_ListView_HeaderFile
-
-#include <qlistview.h>
-#include <qlist.h>
-#include <qstring.h>
-#include <qpixmap.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qtoolbutton.h>
-#endif
-//VRV: porting on Qt 3.0.5
-
-#include "QAD_Popup.h"
-
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListOfReal.hxx>
-
-// enumeration for ListView updating mode
-enum UpdateType {
- utCancel = -1, // cancel updating
- utNone = 0, // needs no any update
- utUpdateItem, // update one item
- utUpdateParent, // update parent item too
- utUpdateViewer, // update all viewer
- utUpdateAll // strong update
-};
-
-class QAD_ListViewItem;
-class QAD_EntityEdit;
-
-//================================================================
-// Class : QAD_ListView
-// Description : parent class for Data Viewer and Properties Viewer
-//================================================================
-class QAD_ListView : public QListView , public QAD_PopupServer {
-
- Q_OBJECT
-
-public:
-// constructor
- QAD_ListView(QWidget *parent);
-// destructor
- virtual ~QAD_ListView();
-
-// updates list viewer
- virtual void updateViewer();
-// updtes currently selected item(s)
- virtual void updateSelected();
-
-// fills popup with items
- void onCreatePopup();
-// delete popup
- void deletePopupMenu();
-
-// setting editing of items availbale/not available
- void enableEditing(bool theFlag);
-// says if editing is enabled
- bool isEnableEditing();
-// accepts user input by calling finishEditing(true)
- void accept();
-
-// clears view
- void clear();
-
-// event filter
- bool eventFilter(QObject* object, QEvent* event) ;
-
-// gets current tooltip for list view
-// returns valid rect in success
- QRect tip(QPoint aPos, QString& aText, QRect& dspRect, QFont& dspFnt) const;
-
-protected:
-// handler for mouse button release event (execute popup menu)
- void contentsMouseReleaseEvent(QMouseEvent* e);
-// handler for resize event
- void resizeEvent(QResizeEvent* e);
-// handler for paint event
- void viewportPaintEvent(QPaintEvent* e);
-// finishes editing of entity
- virtual UpdateType finishEditing(bool ok);
-
-// returns true if mouse events are enabled
- bool isMouseEnabled();
-// enables/disables mouse events (excluding MouseMove)
- void enableMouse(bool enable);
-
-protected slots:
-// called when selection changed in list
- virtual void onSelectionChanged();
-// called when user finishes in editing of item
- void onEditOk();
-// called when user cancels item editing
- void onEditCancel();
-// called when columns sizes are changed
- void onHeaderSizeChange(int, int, int);
-
-protected:
- QAD_EntityEdit* myEdit;
- QAD_ListViewItem* myEditedItem;
- bool myEditingEnabled;
- bool myMouseEnabled;
-};
-
-
-//================================================================
-// Class : QAD_ListViewItem
-// Purpose : List Viewer entity
-//================================================================
-class QAD_ListViewItem : public QListViewItem {
-
-public:
-// constructor
- QAD_ListViewItem(QAD_ListView* parent);
-// constructor
- QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after);
-// constructor
- QAD_ListViewItem(QAD_ListView* parent,
- const QString theName,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListView* parent,
- const QString theName,
- const QString theValue,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListViewItem* parent,
- const QString theName,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListViewItem* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListViewItem* parent,
- const QString theName,
- const QString theValue,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListView* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const QString theValue,
- const bool theEditable = false);
-// constructor
- QAD_ListViewItem(QAD_ListViewItem* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const QString theValue,
- const bool theEditable = false);
-// destructor
- ~QAD_ListViewItem();
-
-// returns full path to the entity (full name)
- QString fullName();
-
-// expands all entities beginning from this level
- void openAllLevels();
-// updates all entites beginning from this level
- virtual void updateAllLevels();
-
-// returns true if entity can be edited
- bool isEditable() const;
-// set entity as editable/uneditable
- void setEditable(bool theEditable);
-
-// returns true if entitiy is accepted after editing
- bool isAccepted() const;
-// set entity accepted or not after editing
- void setAccepted(bool theAccepted);
-
-// returns name of entity (as default it is text in first column)
- virtual QString getName() const;
-// sets name of entity (as default it is text in first column)
- virtual UpdateType setName(const QString theName);
-
-// returns value of entity (as default it is text in second column)
- virtual QString getValue() const;
-// sets value of entity (as default it is text in second column)
- virtual UpdateType setValue(const QString theValue);
-
-// creates control for editing and fills it with values
- QAD_EntityEdit* startEditing();
-// fills widget with initial values (list or single value)
- virtual void fillWidgetWithValues(QAD_EntityEdit* theWidget);
-// finishes editing of entity
- virtual UpdateType finishEditing(QAD_EntityEdit* theWidget);
-
-// returns type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box)
- virtual int getEditingType();
-// sets type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box)
- virtual void setEditingType(const int);
-// returns edited column
- virtual int getEditedColumn();
-// returns type of edited value (string, int, double)
- virtual int getValueType();
-// sets type of edited value (string, int, double)
- virtual void setValueType(const int);
-
-// gets user type
- virtual int getUserType();
-// sets user type
- virtual void setUserType(const int);
-
-// returns buttons for editing widget
- virtual int getButtons();
-// sets buttons for editing widget
- virtual void setButtons(const int);
-// returns text for tooltip
- QString tipText();
-// calculates rectangle which should contain items tip
- QRect tipRect();
-// calculates rect of item text in viewport coordinates
- QRect textRect(const int column) const;
-// calculates full rect of item data in viewport coordinates
- QRect itemRect(const int column) const;
-
-protected:
-// initialization
- void init();
-
-private:
- bool myEditable;
- bool myAccepted;
- int myEditingType;
- int myValueType;
- int myButtons;
- int myUserType; // user are welcome to put additional data here and use it in fillWidgetWithValues()
-};
-
-
-//================================================================
-// Class : QAD_EditBox
-// Description : edit box for list entity editing
-//================================================================
-class QAD_EditBox: public QLineEdit {
-
- Q_OBJECT
-
-public:
-// constructor
- QAD_EditBox(QWidget* parent);
-
-protected:
-// event filter (for KeyPress event)
- void keyPressEvent(QKeyEvent* e);
-
-signals:
- void escapePressed();
-
-};
-
-
-//================================================================
-// Class : QAD_ComboBox
-// Description : combo box for list entity editing
-//================================================================
-class QAD_ComboBox: public QComboBox {
-
- Q_OBJECT
-
-public:
-// constructor
- QAD_ComboBox(bool rw, QWidget* parent = 0, const char* name = 0);
-
-// searches item in list and returns its index
- int findItem(const QString theText);
-// adds item in combo box
- void insertItem(const QString& theValue, int theIndex = -1);
-// adds list of items in combo box
- void insertList(const QStringList& theList);
-// adds item in combo box
- void insertItem(const int theValue);
-// adds list of items in combo box
- void insertList(const TColStd_ListOfInteger& theList);
-// adds item in combo box
- void insertItem(const double theValue);
-// adds list of items in combo box
- void insertList(const TColStd_ListOfReal& theList);
-
-};
-
-
-//================================================================
-// Class : QAD_EntityEdit
-// Description : edit control for QAD List View
-//================================================================
-class QAD_EntityEdit : public QWidget {
-
- Q_OBJECT
-
-public:
-// enum for edit control type
- enum {
- etLineEdit, // simple edit box
- etComboBox, // non-editable combo box
- etComboEdit // editable combo box
- };
-// enum for value type
- enum {
- vtString, // string
- vtInteger, // integer value
- vtDouble // double value
- };
-// enum for insertion order
- enum {
- atBottom,
- atTop,
- atBeforeCurrent,
- atAfterCurrent
- };
-// enum for edit box buttons (Apply = Cancel)
- enum {
- btApply = 0x0001,
- btCancel = 0x0002
- };
-
-// constructor
- QAD_EntityEdit(QWidget* parent,
- int controlType = etLineEdit,
- int valueType = vtString,
- bool butApply = false,
- bool butCancel = false);
-// destructor
- ~QAD_EntityEdit();
-
-// finishes editing
- void finishEditing();
-// clears edit/combo box
- void clear();
-// returns current text in edit box or combo box
- QString getText();
-// sets text
- void setText(const QString& theText);
-// adds item in combo box
- void insertItem(const QString& theValue,
- bool theSetCurrent = false,
- int theOrder = atBottom);
-// adds list of items in combo box
- void insertList(const QStringList& theList,
- const int theCurrent = -1);
-// adds item in combo box
- void insertItem(const int theValue,
- bool theSetCurrent = false);
-// adds list of items in combo box
- void insertList(const TColStd_ListOfInteger& theList,
- const int theCurrent = -1);
-// adds item in combo box
- void insertItem(const double theValue,
- bool theSetCurrent = false);
-// adds list of items in combo box
- void insertList(const TColStd_ListOfReal& theList,
- const int theCurrent = -1);
-// gets actual widget
- QWidget* getControl();
-// redirect focus to corresponding widget
- void setFocus();
-// sets validator for the control
- void setValidator(const QValidator*);
-// shows/hides buttons
- void showButtons(bool show);
-// enables/disables data duplication (for combo box)
- void setDuplicatesEnabled(bool enabled);
-
-protected:
-// event filter for KeyPress event
- void keyPressEvent ( QKeyEvent * e);
-
-private slots:
-// called when item activated in combo box
- void onComboActivated(const QString&);
-// called when text changed in control
- void onTextChanged(const QString&);
-// called when user presses Apply button
- void onApply();
-// called when user presses Cancel button
- void onCancel();
-
-signals:
- void returnPressed();
- void escapePressed();
-
-private:
-// Widgets
- QAD_EditBox* myEdit;
- QAD_ComboBox* myCombo;
- QToolButton* myApplyBtn;
- QToolButton* myCancelBtn;
-
- QString myString;
-
-};
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Menus.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_Menus.h"
-using namespace std;
-
-/*!
- Constructor.
-*/
-QAD_Menus::QAD_Menus(QMainWindow* theParent)
-{
- myMainWindow=theParent;
- myToolBarList.setAutoDelete(TRUE);
-}
-
-/*!
- Desctructor.
-*/
-QAD_Menus::~QAD_Menus()
-{
- myToolBarList.clear();
- myPopupMenuList.clear();
- myMenuBarList.clear();
- myMenuList.clear();
-}
-
-/*!
- Appends a MenuBar
-*/
-void QAD_Menus::append(QMenuBar* theMenuBar)
-{
- myMenuBarList.append(theMenuBar);
-}
-
-/*!
- Appends a ToolBar
-*/
-void QAD_Menus::append(QToolBar* theToolBar)
-{
- myToolBarList.append(theToolBar);
-}
-
-/*!
- Appends a PopupMenu
-*/
-void QAD_Menus::append(QAD_ListPopupMenu* thePopupMenu)
-{
- myPopupMenuList.append(thePopupMenu);
-}
-
-/*!
- Appends a MenuId
-*/
-void QAD_Menus::append(QAD_ListMenuIdAction* theMenu)
-{
- myMenuList.append(theMenu);
-}
-
-/*!
- Shows a ToolBar
-*/
-void QAD_Menus::showToolBar(QToolBar* theToolBar)
-{
- if(theToolBar!=NULL && theToolBar->isHidden()) {
- theToolBar->show();
- }
-}
-
-/*!
- Shows all ToolBars
-*/
-void QAD_Menus::showAllToolBars()
-{
- QToolBar* aToolBar;
-
- for(aToolBar=myToolBarList.first();aToolBar!=NULL;aToolBar=myToolBarList.next()) {
- if(aToolBar->isHidden()) {
- aToolBar->show();
- }
- }
-}
-
-/*!
- Hides a ToolBar
-*/
-void QAD_Menus::hideToolBar(QToolBar* theToolBar)
-{
- if(theToolBar!=NULL && theToolBar->isVisible()) {
- theToolBar->hide();
- }
-}
-
-/*!
- Hides all ToolBars
-*/
-void QAD_Menus::hideAllToolBars()
-{
- QToolBar* aToolBar;
-
- for(aToolBar=myToolBarList.first();aToolBar!=NULL;aToolBar=myToolBarList.next()) {
- if(aToolBar->isVisible()) {
- aToolBar->hide();
- }
- }
-}
-
-/*!
- Sets current MenuBar
-*/
-void QAD_Menus::setActiveMenuBar(QMenuBar* theMenuBar)
-{
- myActiveMenuBar=theMenuBar;
-}
-
-/*!
- Sets current setActivePopupMenu with index \a thePopupMenuIndex
-*/
-void QAD_Menus::setActivePopupMenu(int thePopupMenuIndex)
-{
- myActivePopupMenu=myPopupMenuList.at(thePopupMenuIndex)->getPopup();
-}
-
-/*!
- Sets current PopupMenu
-*/
-void QAD_Menus::setActivePopupMenu(QPopupMenu* thePopupMenu)
-{
- myActivePopupMenu=thePopupMenu;
-}
-
-/*!
- Sets current ToolBar with index \a theToolBarIndex
-*/
-void QAD_Menus::setActiveToolBar(int theToolBarIndex)
-{
- myActiveToolBar=myToolBarList.at(theToolBarIndex);
-}
-
-/*!
- Sets current ToolBar
-*/
-void QAD_Menus::setActiveToolBar(QToolBar* theToolBar)
-{
- myActiveToolBar=theToolBar;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Menus.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_MENUS_H
-#define QAD_MENUS_H
-
-#include "QAD_ListMenuIdAction.h"
-#include "QAD_ListPopupMenu.h"
-
-#include <qlist.h>
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
-
-class QAD_MainWindow;
-
-class QAD_Menus
-{
-
-public:
- QAD_Menus(QMainWindow*);
- virtual ~QAD_Menus();
-
- QMenuBar* myActiveMenuBar;
- QToolBar* myActiveToolBar;
- QStatusBar* myActiveStatusBar;
- QPopupMenu* myActivePopupMenu;
-
- QMainWindow* getMainWindow() {return myMainWindow;}
- QList<QMenuBar> getMenuBarList() {return myMenuBarList;}
- QList<QToolBar> getToolBarList() {return myToolBarList;}
- QPopupMenu* getActivePopupMenu() {return myActivePopupMenu;}
- QList<QAD_ListMenuIdAction> getMenuList() {return myMenuList;}
- QList<QAD_ListPopupMenu> getPopupMenuList() {return myPopupMenuList;}
-
- void setActiveMenuBar(QMenuBar*);
- void setActivePopupMenu(int);
- void setActivePopupMenu(QPopupMenu*);
- void setActiveToolBar(int);
- void setActiveToolBar(QToolBar*);
-
- void append(QMenuBar*);
- void append(QToolBar*);
- void append(QAD_ListPopupMenu*);
- void append(QAD_ListMenuIdAction*);
- void clearToolBar() {myToolBarList.clear();}
- void clearPopupMenu() {myPopupMenuList.clear();}
- void showToolBar(QToolBar*);
- void showAllToolBars();
- void hideToolBar(QToolBar*);
- void hideAllToolBars();
-
-protected:
- QMainWindow* myMainWindow;
- QList<QMenuBar> myMenuBarList;
- QList<QToolBar> myToolBarList;
- QList<QAD_ListMenuIdAction> myMenuList;
- QList<QAD_ListPopupMenu> myPopupMenuList;
-
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Message.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_Message.h"
-#include "QAD_Application.h"
-#include "QAD_Config.h"
-#include "QAD_Tools.h"
-#include <stdio.h>
-#include <qstring.h>
-#include <qpopupmenu.h>
-#include <qmap.h>
-using namespace std;
-
-enum { IdCopy, IdClear, IdSelectAll };
-
-/*!
- \class QAD_Message QAD_Message.h
- \brief Messages window for Study.
-*/
-
-/*!
- Constructor - creates Message Log window
-*/
-QAD_Message::QAD_Message(QWidget *parent, const char* name)
- : QMultiLineEdit(parent, name)
-{
- // setting default title
- myTitle = tr("MESSAGE_LOG_NAME");
- // setting default prompt
- myPrompt = ">>> ";
- // setting font ( from preferences )
- QString fntSet = QAD_CONFIG->getSetting("Viewer:ConsoleFont");
- QFont myFont = QAD_Tools::stringToFont( fntSet );
-// QFont myFont("Courier", 11);
- setFont(myFont);
- setReadOnly(TRUE);
- // appending title
- setMessage(myTitle);
- // setting palette (special)
- setPalette( QAD_Application::getPalette(true) );
- setFocusPolicy( NoFocus );
- // currently no text wrap
- setWordWrap(NoWrap);
-}
-
-/*!
- Destructor
-*/
-QAD_Message::~QAD_Message()
-{
-}
-
-/*!
- Adds message
-*/
-void QAD_Message::setMessage(const QString& s)
-{
- int line = numLines() > 0 ? numLines()-1 : 0;
- int col = lineLength(line);
- if (!s.isNull() && s.length() > 0) {
- QString ss = s;
- insertAt(ss, line, col, false);
- }
- append(myPrompt);
-}
-
-/*
- Processes own popup manu
-*/
-void QAD_Message::mousePressEvent(QMouseEvent* event)
-{
- if ( event->button() == RightButton ) {
- QPopupMenu *popup = new QPopupMenu( this );
- QMap<int, int> idMap;
-
- int line1, col1, line2, col2;
- getMarkedRegion(&line1, &col1, &line2, &col2);
- bool allSelected = getMarkedRegion(&line1, &col1, &line2, &col2) &&
- line1 == 0 && line2 == numLines()-1 && col1 == 0 && col2 == lineLength(line2);
- int id;
- id = popup->insertItem( tr( "EDIT_COPY_CMD" ) );
- idMap.insert(IdCopy, id);
- id = popup->insertItem( tr( "EDIT_CLEAR_CMD" ) );
- idMap.insert(IdClear, id);
- popup->insertSeparator();
- id = popup->insertItem( tr( "EDIT_SELECTALL_CMD" ) );
- idMap.insert(IdSelectAll, id);
- popup->setItemEnabled( idMap[ IdCopy ], hasMarkedText() );
- popup->setItemEnabled( idMap[ IdSelectAll ], !allSelected );
- popup->setItemEnabled( idMap[ IdClear ], textLine(1)!=myPrompt );
-
- int r = popup->exec( event->globalPos() );
- delete popup;
-
- if ( r == idMap[ IdCopy ] ) {
- copy();
- }
- else if ( r == idMap [ IdClear ] ) {
- clear();
- setMessage(myTitle);
- }
- else if ( r == idMap[ IdSelectAll ] ) {
- selectAll();
- }
- return;
- }
- else {
- QMultiLineEdit::mousePressEvent(event);
- }
-}
-
-/*
- Sets prompt ( default is '>>> ' )
-*/
-void QAD_Message::setPrompt(const QString& prompt)
-{
- myPrompt = prompt;
- clear();
- setMessage(myTitle);
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Message.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_Message_H
-#define QAD_Message_H
-
-#include "QAD.h"
-#include <qmultilineedit.h>
-
-class QAD_EXPORT QAD_Message : public QMultiLineEdit
-{
-public:
-// constructor
- QAD_Message(QWidget *parent = 0, const char* name = 0 );
-// destructor
- ~QAD_Message();
-
-// adds message
- void setMessage(const QString& s);
-// sets prompt
- void setPrompt(const QString& prompt);
-
-protected:
-// MousePress event handler
- void mousePressEvent(QMouseEvent* event);
-
-private:
-// Title
- QString myTitle;
-// Prompt
- QString myPrompt;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_MessageBox.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_MessageBox QAD_MessageBox.h
- \brief Message dialog box for QAD-based application.
-*/
-
-#include "QAD_MessageBox.h"
-
-// QT Includes
-#include <qmessagebox.h>
-#include <qapplication.h>
-using namespace std;
-
-/*!
- Shows info message box with one button [ static ]
-*/
-int QAD_MessageBox::info1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 )
-{
- int ret = QMessageBox::information ( parent, caption, text, textButton0,
- QString::null, QString::null, 0, 0);
- qApp->processEvents(); /* update desktop */
- return ret;
-}
-
-/*!
- Shows warning message box with one button [ static ]
-*/
-int QAD_MessageBox::warn1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 )
-{
- int ret = QMessageBox::warning ( parent, caption, text, textButton0,
- QString::null, QString::null, 0, 0);
- qApp->processEvents(); /* update desktop */
- return ret;
-}
-
-/*!
- Shows error message box with one button [ static ]
-*/
-int QAD_MessageBox::error1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 )
-{
- int ret = QMessageBox::critical ( parent, caption, text, textButton0,
- QString::null, QString::null, 0, 0);
- qApp->processEvents(); /* update desktop */
- return ret;
-}
-
-/*!
- Shows info message box with two buttons.
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::info2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else idDefault = 0;
-
- int ret = QMessageBox::information ( parent, caption, text, textButton0,
- textButton1, QString::null, idDefault );
- qApp->processEvents(); /* update desktop */
- return ( ret == 0 ? idButton0 : idButton1 );
-}
-
-/*!
- Shows warning message box with two buttons.
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::warn2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else idDefault = 0;
-
- int ret = QMessageBox::warning ( parent, caption, text, textButton0,
- textButton1, QString::null, idDefault );
- qApp->processEvents(); /* update desktop */
- return ( ret == 0 ? idButton0 : idButton1 );
-}
-
-/*!
- Shows error message box with two buttons
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::error2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else idDefault = 0;
-
- int ret = QMessageBox::critical ( parent, caption, text, textButton0,
- textButton1, QString::null, idDefault );
- qApp->processEvents(); /* update desktop */
- return ( ret == 0 ? idButton0 : idButton1 );
-}
-
-/*!
- Shows info message box with three buttons.
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::info3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else if ( idDefault == idButton2 ) idDefault = 2;
- else idDefault = 0;
-
- int ret = QMessageBox::information ( parent, caption, text, textButton0,
- textButton1, textButton2, idDefault );
- qApp->processEvents(); /* update desktop */
- switch ( ret )
- {
- case 0: return idButton0;
- case 1: return idButton1;
- case 2: return idButton2;
- }
- return -1;
-}
-
-/*!
- Shows warning message box with three buttons.
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::warn3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else if ( idDefault == idButton2 ) idDefault = 2;
- else idDefault = 0;
-
- int ret = QMessageBox::warning ( parent, caption, text, textButton0,
- textButton1, textButton2, idDefault );
- qApp->processEvents(); /* update desktop */
- switch ( ret )
- {
- case 0: return idButton0;
- case 1: return idButton1;
- case 2: return idButton2;
- }
- return -1;
-}
-
-/*!
- Shows error message box with three buttons.
- Returns id of the pressed button or -1 if escaped [ static ]
-*/
-int QAD_MessageBox::error3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault )
-{
- if ( idDefault == idButton0 ) idDefault = 0;
- else if ( idDefault == idButton1 ) idDefault = 1;
- else if ( idDefault == idButton2 ) idDefault = 2;
- else idDefault = 0;
-
- int ret = QMessageBox::critical ( parent, caption, text, textButton0,
- textButton1, textButton2, idDefault );
- qApp->processEvents(); /* update desktop */
- switch ( ret )
- {
- case 0: return idButton0;
- case 1: return idButton1;
- case 2: return idButton2;
- }
- return -1;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_MessageBox.h
-// Module : SALOME
-
-/********************************************************************
-** Class: QAD_MessageBox
-** Descr: Message dialog box for QAD-based application
-** Module: QAD
-** Created: UI team, 02.10.00
-*********************************************************************/
-#ifndef QAD_MESSAGEBOX_H
-#define QAD_MESSAGEBOX_H
-
-#include <qstring.h>
-#include <qwidget.h>
-
-#include "QAD.h"
-
-class QAD_EXPORT QAD_MessageBox
-{
-public:
- /* show a box with one button */
- static int info1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 );
- static int warn1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 );
- static int error1 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0 );
-
- /* show a box with two buttons */
- static int info2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault );
- static int warn2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault );
- static int error2 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- int idButton0, int idButton1, int idDefault );
-
- /* show a box with three buttons */
- static int info3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault );
- static int warn3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault );
- static int error3 ( QWidget* parent, const QString& caption, const QString& text,
- const QString& textButton0, const QString& textButton1,
- const QString& textButton2, int idButton0, int idButton1,
- int idButton2, int idDefault );
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_NameBrowser.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_NameBrowser.h"
-
-#include "QAD_Study.h"
-#include "QAD_Desktop.h"
-#include "QAD_Application.h"
-#include "QAD_Selection.h"
-#include "QAD_InteractiveObject.h"
-
-#include "utilities.h"
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-#include <qcombobox.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlistview.h>
-#include <qpushbutton.h>
-#include <qtoolbutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-using namespace std;
-
-/*!
- Constructs a QAD_NameBrowser which is a child of 'parent', with the
- name 'name'
-*/
-QAD_NameBrowser::QAD_NameBrowser( QWidget* parent, const char* name)
- : QMainWindow( parent, name, WStyle_NormalBorder |
- WStyle_MinMax | WStyle_SysMenu | WDestructiveClose )
-{
- if ( !name )
- setName( "QAD_NameBrowser" );
-
- resize( 321, 280 );
- setCaption( name );
-
- GroupBox1 = new QGroupBox( this, "GroupBox1" );
- GroupBox1->setGeometry( QRect( 10, 10, 300, 50 ) );
- GroupBox1->setTitle( tr( "Filters" ) );
-
- ComboBox1 = new QComboBox( TRUE, GroupBox1 );
- ComboBox1->setGeometry( QRect( 10, 20, 120, 21 ) );
- ComboBox1->insertItem( tr( "Type" ) );
-
- connect( ComboBox1, SIGNAL( textChanged(const QString &) ), this, SLOT( updateFilters() ) );
-
-
- PushButton5 = new QPushButton( tr( " = " ), GroupBox1);
- PushButton5->setGeometry( QRect( 140, 20, 30, 21 ) );
-
- ComboBox2 = new QComboBox( TRUE, GroupBox1);
- ComboBox2->setGeometry( QRect( 180, 20, 111, 21 ) );
- ComboBox2->insertItem( tr( "All" ) );
- connect( ComboBox2, SIGNAL( textChanged(const QString &) ), this, SLOT( updateFilters() ) );
-
- GroupBox2 = new QGroupBox( this, "GroupBox2" );
- GroupBox2->setGeometry( QRect( 10, 60, 300, 200 ) );
- GroupBox2->setTitle( tr( "Objects" ) );
-
- PushButton1 = new QPushButton( tr( "All" ), GroupBox2 );
- PushButton1->setGeometry( QRect( 10, 170, 71, 21 ) );
- connect( PushButton1, SIGNAL( clicked() ), this, SLOT( selectAllFilteredObjects() ) );
-
- ListView1 = new QListView( GroupBox2 );
- ListView1->setGeometry( QRect( 10, 20, 280, 140 ) );
- ListView1->addColumn("");
- ListView1->addColumn("");
- ListView1->addColumn("");
- ListView1->setColumnText( 0, tr( "Filtered" ) );
- ListView1->setColumnWidth(0, 130);
- ListView1->setRootIsDecorated(TRUE);
- ListView1->setMultiSelection (TRUE);
- ListView1->setSelectionMode ( QListView::Extended );
-
- connect (ListView1,
- SIGNAL( selectionChanged() ),
- this, SLOT(onFilteredObjects()) );
-
- initFilters();
-}
-
-/*!
- Returns reference to QListView
-*/
-QListView* QAD_NameBrowser::getListView() const
-{
- return ListView1;
-}
-
-/*!
- Destroys the object and frees any allocated resources
-*/
-QAD_NameBrowser::~QAD_NameBrowser()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-void QAD_NameBrowser::selectAllFilteredObjects()
-{
- ListView1->selectAll( true );
-}
-
-void QAD_NameBrowser::updateFilters()
-{
- initFilters();
-}
-
-void QAD_NameBrowser::initFilters()
-{
- QAD_Desktop* myDesktop = QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
-
- Update( aStudy );
-
-
-// QAD_Selection* Sel = QAD_Selection::Selection( myActiveStudy->getSelection() );
-// const QList<QAD_InteractiveObject>& ListIO = Sel->getInteractiveObjects();
-// int NbSelected = ListIO.count();
-// if ( NbSelected == 0 ) {
-// // setFilter "All"
-// Update( aStudy );
-
-// } else if ( NbSelected == 1 ) {
-// // setFilter "type of selected object"
-// QAD_InteractiveObject* IObject = Sel->getFisrtInteractiveObject();
-// SALOMEDS::SComponent_var SC = SALOMEDS::SComponent::_narrow ( myActiveStudy->FindObjectIOR( IObject->getFatherIOR() ));
-// if ( !SC->_is_nil() ) {
-// char* ObjectComp = "";
-// if ( SC->GetAttribute(SALOMEDS::Name, ObjectComp)) {
-// Update( aStudy, SC );
-// }
-// }
-
-// } else {
-// // const QList<QAD_InteractiveObject>& ListIO = Sel->getInteractiveObjects();
-// // QListIterator<QAD_InteractiveObject> it( Sel->getInteractiveObjects() );
-// // for ( ; it.current(); ++it ) {
-// // QAD_InteractiveObject* IObject = it.current();
-// // QString IOR = IObject->getFatherIOR() ));
-
-// // }
-
-// // heterogeneous selection -> setFilter "All"
-// Update( aStudy );
-
-// // homogeneous selection -> setFilter "type of selected objects"
-// }
-}
-
-void QAD_NameBrowser::onFilteredObjects()
-{
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- QAD_Selection* Sel = QAD_Selection::Selection( myActiveStudy->getSelection() );
- QAD_StudyFrame* myActiveSFrame = myActiveStudy->getActiveStudyFrame();
-
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
-
- MESSAGE ( "QAD_NAMEBROWSER - NB SELECTED INTERACTIVE OBJECT : " << Sel->getInteractiveObjectCount() )
-
- QList<QAD_InteractiveObject> DeltaPos;
- DeltaPos.clear();
- QList<QAD_InteractiveObject> DeltaNeg;
- DeltaNeg.clear();
-
- QListViewItemIterator it( ListView1 );
- for ( ; it.current(); ++it ) {
- QListViewItem* item = it.current();
- QString theIOR = item->text(2);
- QString theEntry = item->text(1);
-
- if ( ActiveComp.isEmpty() ) {/* Neutral point = no component loaded */
- if ( !theEntry.isEmpty() && theIOR.isEmpty() ) { /* A component may be selected */
- if ( item->isSelected() ) {
- bool itemAlreadySelected = false;
-
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getIOR().compare(item->text(1)) == 0 ) {
- itemAlreadySelected = true;
- break;
- }
- }
- if (!itemAlreadySelected) {
- QAD_InteractiveObject* SO = new QAD_InteractiveObject( item->text(1), "" );
- DeltaPos.append( SO );
- }
- } else {
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getIOR().compare(item->text(1)) == 0 ) {
- DeltaNeg.append( SO );
- break;
- }
- }
- }
-
- } else { /* An object is selected */
- if ( item->isSelected() ) {
- item->setSelected( false );
- item->repaint();
- }
- }
-
- } else {
- if ( !theIOR.isEmpty() ) {
- if ( item->isSelected() ) {
- bool itemAllreadySelected = false;
-
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getIOR().compare(theIOR) == 0 ) {
- itemAllreadySelected = true;
- break;
- }
- }
-
- if (!itemAllreadySelected) {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID(theEntry.latin1());
- SALOMEDS::SComponent_var theComponent = obj->GetFatherComponent();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- Standard_CString ior =" ";
- Standard_CString iorFather =" ";
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = anIOR->Value();
- }
- theComponent->ComponentIOR(iorFather);
- QAD_InteractiveObject* SO = new QAD_InteractiveObject( QString(ior),
- QString(iorFather),
- QString(theEntry) );
- DeltaPos.append( SO );
- }
- } else {
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getIOR().compare(theIOR) == 0 ) {
- DeltaNeg.append( SO );
- break;
- }
- }
-
- }
- } else if ( !theEntry.isEmpty() && theIOR.isEmpty() ) {
- if ( item->isSelected() ) {
- bool itemAllreadySelected = false;
-
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getEntry().compare(theEntry) == 0 ) {
- itemAllreadySelected = true;
- break;
- }
- }
- if (!itemAllreadySelected) {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID(theEntry.latin1());
- SALOMEDS::SComponent_var theComponent = obj->GetFatherComponent();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- Standard_CString ior =" ";
- Standard_CString iorFather =" ";
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = anIOR->Value();
- }
- theComponent->ComponentIOR(iorFather);
- QAD_InteractiveObject* SO = new QAD_InteractiveObject( QString(ior),
- QString(iorFather),
- QString(theEntry) );
- DeltaPos.append( SO );
- }
- } else {
- int nbSel = Sel->getInteractiveObjectCount();
- for ( int i = 0; i < nbSel; i++ ) {
- QAD_InteractiveObject* SO = Sel->getInteractiveObject(i);
- if ( SO->getEntry().compare(theEntry) == 0 ) {
- DeltaNeg.append( SO );
- break;
- }
- }
-
- }
- } else {
- item->setSelected( false );
- item->repaint();
- }
- }
- }
-
- MESSAGE ( "NAMEBROWSER DeltaNeg.count() == " << DeltaNeg.count() )
- for ( QAD_InteractiveObject* SO = DeltaNeg.first(); SO; SO = DeltaNeg.next() ) {
- MESSAGE ( "------" << SO->getIOR() )
- Sel->RemoveInteractiveObject(SO);
- }
- MESSAGE ( "NAMEBROWSER DeltaPos.count() == " << DeltaPos.count() )
- for ( QAD_InteractiveObject* SO = DeltaPos.first(); SO; SO = DeltaPos.next() ) {
- MESSAGE ( "++++++" << SO->getIOR() )
- Sel->AddInteractiveObject(SO);
- }
-}
-
-/*!
- Update
-*/
-void QAD_NameBrowser::Update(SALOMEDS::Study_ptr Study,
- SALOMEDS::SObject_ptr SO)
-{
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO);
-
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var CSO= it->Value();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
- QListViewItem* Item;
-
- if (CSO->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- if (CSO->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- Item = AddItem ( aName->Value(), CSO->GetID(), anIOR->Value());
- }
- }
-
- Update(Study,CSO);
- }
-}
-
-/*!
- Update
-*/
-void QAD_NameBrowser::Update(SALOMEDS::Study_ptr Study,
- SALOMEDS::SComponent_ptr SC)
-{
- ListView1->clear();
-
- if (Study->_is_nil()) {
- return;
- }
-
-// Standard_CString name;
- Standard_CString dataType;
- Standard_CString ior="";
-
- QListViewItem* Item;
-
- SALOMEDS::SComponentIterator_var itcomp;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- if ( !SC->_is_nil() ) {
- if (SC->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- Item = AddItem (aName->Value(),SC->GetID(),ior);
- } else {
- Item = AddItem (dataType,SC->GetID(),ior);
- }
- Update ( Study, SALOMEDS::SObject::_narrow(SC) );
-
- } else {
- itcomp = Study->NewComponentIterator();
- for (; itcomp->More(); itcomp->Next()) {
- SALOMEDS::SComponent_var SC1 = itcomp->Value();
- dataType = SC1->ComponentDataType();
-
- if (SC1->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- ior = anIOR->Value();
- }
-
- if ( QString(dataType).compare("Interface Applicative") != 0 ) {
- if (SC1->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- Item = AddItem (aName->Value(), SC1->GetID(), ior);
- } else {
- Item = AddItem (dataType, SC1->GetID(), ior);
- }
-
- Update ( Study, SALOMEDS::SObject::_narrow(SC1) );
- }
- }
- }
-}
-
-QListViewItem* QAD_NameBrowser::AddItem(const QString& theText,
- const QString& theEntry,
- const QString& theIOR)
-
-{
- QListViewItem* anItem = new QListViewItem( ListView1 );
- anItem->setText(0, theText);
- anItem->setText(1, theEntry);
- anItem->setText(2, theIOR);
-
- return anItem;
-}
-
-/*!
- Called when NameBrowser is about to close
-*/
-void QAD_NameBrowser::closeEvent(QCloseEvent* e)
-{
- QAD_Application::getDesktop()->closeNameBrowser();
- e->accept();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_NameBrowser.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_NAMEBROWSER_H
-#define QAD_NAMEBROWSER_H
-
-#include <qvariant.h>
-#include <qmainwindow.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QComboBox;
-class QGroupBox;
-class QLabel;
-class QListView;
-class QListViewItem;
-class QPushButton;
-class QToolButton;
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-class QAD_NameBrowser : public QMainWindow
-{
- Q_OBJECT
-
-public:
- QAD_NameBrowser( QWidget* parent = 0, const char* name = 0);
- ~QAD_NameBrowser();
-
- QListView* getListView() const;
-
- void initFilters();
-
- QListViewItem* AddItem(const QString&,
- const QString&,
- const QString&);
- void Update(SALOMEDS::Study_ptr Study,
- SALOMEDS::SObject_ptr SO);
- void Update(SALOMEDS::Study_ptr Study,
- SALOMEDS::SComponent_ptr SC = SALOMEDS::SComponent::_narrow( CORBA::Object::_nil() ));
-
-
- void closeEvent(QCloseEvent* e);
-
-protected slots:
- void selectAllFilteredObjects();
- void updateFilters();
-
- void onFilteredObjects();
-
-private:
- QGroupBox* GroupBox1;
- QComboBox* ComboBox1;
- QPushButton* PushButton5;
- QComboBox* ComboBox2;
- QGroupBox* GroupBox2;
- QPushButton* PushButton1;
- QListView* ListView1;
-
-};
-
-#endif // QAD_NAMEBROWSER_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ObjectBrowser.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_ObjectBrowserItem.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_Application.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
-#include "QAD_Settings.h"
-#include "QAD_Tools.h"
-#include "QAD_RightFrame.h"
-#include "QAD_LeftFrame.h"
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOMEGUI_SetValueDlg.h"
-#include "SALOMEGUI_TableDlg.h"
-#include "SALOMEGUI_NameDlg.h"
-
-// QT Includes
-#include <qlistview.h>
-#include <qheader.h>
-#include <qpopupmenu.h>
-#include <qtabwidget.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvbox.h>
-#include <qhbox.h>
-#include <qtooltip.h>
-#include <qdragobject.h>
-#include <qstringlist.h>
-#include <qmap.h>
-
-using namespace std;
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qcursor.h>
-#endif
-//VRV: porting on Qt 3.0.5
-
-#define UC_NEW_EMPTY_ID 1000000
-#define UC_NEW_COMP_ID 1000002
-#define UC_NEW_FULL_ID 1000004
-#define UC_NEW_COPY_ID 1000006
-#define UC_APPEND_ID 1000008
-#define UC_REMOVE_ID 1000010
-#define UC_RENAME_ID 1000012
-#define UC_CLEAR_ID 1000014
-#define UC_SET_CURRENT_ID 1000016
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-/*!
- Small button which updates Object Browser's contents
-*/
-Btn::Btn ( QWidget * parent, const char * name ) : QToolButton( parent, name )
-{
- connect( this, SIGNAL(clicked()), this, SLOT(onClicked()) );
-}
-void Btn::onClicked()
-{
- QAD_ObjectBrowser* OB = QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getActiveStudyFrame()->getLeftFrame()->getObjectBrowser();
- OB->Update();
-}
-
-/*!
- Gets selected top-level items (i.e. not including sub-items) [ static ]
-*/
-static void getSelectedParents( QListViewItem* listViewItem, QList<QListViewItem>& itemList )
-{
- QListViewItem* item = listViewItem->firstChild();
- while ( item ) {
- if ( item->isSelected() ) {
- itemList.append( item );
- }
- else {
- getSelectedParents( item, itemList );
- }
- item = item->nextSibling();
- }
-}
-/*!
- Gets selected top-level items (i.e. not including sub-items) [ static ]
-*/
-static void getSelectedParents( QListView* listView, QList<QListViewItem>& itemList, bool ignoreRoot = false )
-{
- itemList.clear();
- QListViewItem* item = listView->firstChild();
- while ( item ) {
- if ( item->isSelected() && !ignoreRoot ) {
- itemList.append( item );
- }
- else {
- getSelectedParents( item, itemList );
- }
- item = item->nextSibling();
- }
-}
-/*!
- Gets top-most parent item [ static ]
-*/
-static QListViewItem* getTopParent( QListViewItem* item )
-{
- if ( !item )
- return 0;
- QListViewItem* p = item->parent();
- if ( !p )
- return item;
- while ( p->parent() ) {
- p = p->parent();
- }
- return p;
-}
-/*!
- Returns true if the item is top-level (root)
-*/
-static bool isRootItem( QListViewItem* item )
-{
- return ( item->listView() && !item->parent() );
-}
-/*!
- Constructor
-*/
-QAD_ObjectBrowser::QAD_ObjectBrowser( SALOMEDS::Study_var study, QWidget* parent, const char* name, WFlags fl )
- : QTabWidget( parent, name, fl )
-{
- myStudy = SALOMEDS::Study::_duplicate( study );
- myListViewMap.clear();
- myUseCaseMap.clear();
- myListView=0; // must be done before setupListView(): setCornerWidget() provoque call to eventFilter
- myUseCaseView=0; // and test myUseCaseView->viewport() before initialisation
- setupListView();
-}
-
-/*!
- Destructor
-*/
-QAD_ObjectBrowser::~QAD_ObjectBrowser()
-{
- if (!myStudy->_is_nil())
- CORBA::release(myStudy);
-}
-
-/*!
- Configures Object Browser and UseCase Browser.
- Columns, Selection Mode and Palette.
-*/
-void QAD_ObjectBrowser::setupListView()
-{
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
-
- this->setTabPosition( QTabWidget::Bottom );
-
- /* Reading setting : Columns for Value, OCAF Doc entry, object IOR, OCAF Doc ref entry and Chrono sorting */
- QString AddColumn = QAD_CONFIG->getSetting( "ObjectBrowser:AddColumn" );
- QString ValueColumn = QAD_CONFIG->getSetting( "ObjectBrowser:ValueColumn" );
- QString ShowCHRONO_SORT = QAD_CONFIG->getSetting( "ObjectBrowser:ChronologicalSort" );
- QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser");
- QString noAutoSizeColumns = QAD_CONFIG->getSetting( "ObjectBrowser:NoAutoSizeColumns" );
-
- /* create and setup Object Browser ================================= */
- myListView = new QListView( this, "Object Browser");
- myListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myListView->setMinimumSize( 1, 1 );
- myListView->setPalette( QAD_Application::getPalette( true ) );
-
- /* First two columns = object name and value - always visible */
- myListView->addColumn( tr( "OBJECT_BROWSER_OBJECT" ) ); /* Adding Object column */
- myListView->addColumn( tr( "OBJECT_BROWSER_VALUE" ) ); /* Adding Value column */
- myListView->addColumn( tr( "OBJECT_BROWSER_ENTRY" ) ); /* Adding Doc entry column */
- myListView->addColumn( tr( "OBJECT_BROWSER_IOR" ) ); /* Adding Object IOR column */
- myListView->addColumn( tr( "OBJECT_BROWSER_REFENTRY" ) ); /* Adding OCAF Doc ref entry column */
- myListView->header()->setMovingEnabled( false );
-
- /* Properties */
- myListView->header()->setClickEnabled( TRUE ); /* Enable clicking on the header */
- myListView->setShowSortIndicator( TRUE ) ; /* Add user arrows to indicate the sort order : LPN */
- myListView->setRootIsDecorated( TRUE ); /* Enable expand/collapse control for the root item */
- myListView->setSelectionMode ( QListView::Extended ); /* Enable multiple selection */
- myListView->setVScrollBarMode( QScrollView::AlwaysOn ); /* Set scrollbars always visible */
- myListView->setHScrollBarMode( QScrollView::AlwaysOn ); /* ... */
-
- myListView->setCornerWidget( new Btn( this ) );
- /* Connect section */
- //VRV: porting on Qt 3.0.5
-#if QT_VERSION < 0x030005
- connect( myListView, SIGNAL( rightButtonClicked( QListViewItem*, const QPoint&, int ) ),
- this, SLOT( showPopupMenu( QListViewItem* ) ) );
-#else
- connect( myListView, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
- this, SLOT( showPopupMenu( QListViewItem* ) ) );
-#endif
- //VRV: porting on Qt 3.0.5
-
- connect( myListView, SIGNAL( selectionChanged() ),
- this, SLOT( onSelectedItem() ) );
- connect( myListView, SIGNAL( expanded( QListViewItem* ) ),
- this, SLOT( onExpanded( QListViewItem* ) ) );
- connect( myListView, SIGNAL( collapsed( QListViewItem* ) ),
- this, SLOT( onCollapsed( QListViewItem* ) ) );
-
- /* create and setup UseCase Browser ================================ */
- myVBox = new QWidget( this );
- QVBoxLayout* vBoxLayout = new QVBoxLayout( myVBox );
-
- myUseCaseView = new QListView( myVBox, "UseCase Browser");
- myUseCaseView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myUseCaseView->setMinimumSize( 1, 1 );
- myUseCaseView->setPalette( QAD_Application::getPalette( true ) );
-
- /* First column = object name */
- myUseCaseView->addColumn( tr( "OBJECT_BROWSER_OBJECT" ) );
- /* Properties */
- myUseCaseView->header()->setClickEnabled( TRUE ); /* Enable clicking on the header */
- myUseCaseView->setShowSortIndicator( TRUE ) ; /* Add user arrows to indicate the sort order : LPN */
- myUseCaseView->setRootIsDecorated( TRUE ); /* Enable expand/collapse control for the root item */
- myUseCaseView->setSelectionMode ( QListView::Extended ); /* Enable multiple selection */
- myUseCaseView->setVScrollBarMode( QScrollView::AlwaysOn ); /* Set scrollbars always visible */
- myUseCaseView->setHScrollBarMode( QScrollView::AlwaysOn ); /* ... */
- myUseCaseView->header()->setMovingEnabled( false );
- myUseCaseView->viewport()->setAcceptDrops( true );
- myUseCaseView->installEventFilter( this );
- myUseCaseView->viewport()->installEventFilter( this );
- myUseCaseView->setSorting( -1 ) ;
- vBoxLayout->addWidget( myUseCaseView );
-
- myUseCaseView->setCornerWidget( new Btn( this ) );
-
- myNewBtn = new QToolButton( myVBox );
- myNewBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_NEW") ) );
- myNewBtn->setAutoRaise( true );
- QToolTip::add( myNewBtn, tr( "UC_NEW_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_NEW_TIP" ) );
- myAddBtn = new QToolButton( myVBox );
- myAddBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_ADD") ) );
- myAddBtn->setAutoRaise( true );
- QToolTip::add( myAddBtn, tr( "UC_APPEND_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_APPEND_TIP" ) );
- myDelBtn = new QToolButton( myVBox );
- myDelBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_REMOVE") ) );
- myDelBtn->setAutoRaise( true );
- QToolTip::add( myDelBtn, tr( "UC_REMOVE_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_REMOVE_TIP" ) );
- myClearBtn = new QToolButton( myVBox );
- myClearBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_CLEAR") ) );
- myClearBtn->setAutoRaise( true );
- QToolTip::add( myClearBtn, tr( "UC_CLEAR_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_CLEAR_TIP" ) );
- myCurrentBtn = new QToolButton( myVBox );
- myCurrentBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_SET_CURRENT") ) );
- myCurrentBtn->setAutoRaise( true );
- QToolTip::add( myCurrentBtn, tr( "UC_SET_CURRENT_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_SET_CURRENT_TIP" ) );
-
- QHBoxLayout* btnLayout = new QHBoxLayout;
- btnLayout->setMargin( 3 ); btnLayout->setSpacing( 3 );
- btnLayout->addWidget( myNewBtn );
- btnLayout->addStretch();
- btnLayout->addSpacing( 5 );
- btnLayout->addStretch();
- btnLayout->addWidget( myAddBtn );
- btnLayout->addWidget( myDelBtn );
- btnLayout->addStretch();
- btnLayout->addSpacing( 5 );
- btnLayout->addStretch();
- btnLayout->addWidget( myClearBtn );
- btnLayout->addStretch();
- btnLayout->addSpacing( 5 );
- btnLayout->addStretch();
- btnLayout->addWidget( myCurrentBtn );
- btnLayout->addStretch();
-
- vBoxLayout->addLayout( btnLayout );
-
- connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onUseCaseBtn() ) );
- connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onUseCaseBtn() ) );
- connect( myDelBtn, SIGNAL( clicked() ), this, SLOT( onUseCaseBtn() ) );
- connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( onUseCaseBtn() ) );
- connect( myCurrentBtn, SIGNAL( clicked() ), this, SLOT( onUseCaseBtn() ) );
-
- /* Connect section */
-#if QT_VERSION < 0x030005
- connect( myUseCaseView, SIGNAL( rightButtonClicked( QListViewItem*, const QPoint&, int ) ),
- this, SLOT( showPopupMenu( QListViewItem* ) ) );
-#else
- connect( myUseCaseView, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
- this, SLOT( showPopupMenu( QListViewItem* ) ) );
-#endif
-
- connect( myUseCaseView, SIGNAL( selectionChanged() ),
- this, SLOT( onSelectedItem() ) );
-
- /* add Object Browser and UseCase Browser as pages ================= */
- this->addTab( myListView, tr( "TLT_OBJECT_BROWSER" ) );
- this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) );
-
- if ( showUseCase != "true")
- this->removePage(myVBox);
-
- setShowInfoColumns( AddColumn == "true" );
- setShowValueColumn( ValueColumn == "true" );
- setEnableChronoSort( ShowCHRONO_SORT == "true" );
-
- if ( noAutoSizeColumns == "true" )
- {
- for (int i = 0; i < myListView->header()->count(); i++ )
- myListView->setColumnWidthMode(i, QListView::Manual);
- }
-
- resize( QSize( 100, 400 ) );
-}
-
-/*!
- Event filter
-*/
-
-bool QAD_ObjectBrowser::eventFilter( QObject* o, QEvent* e )
-{
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
-
- if ( myStudy->_is_nil() )
- return QTabWidget::eventFilter( o, e );
-
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
- if (! myUseCaseView) return QTabWidget::eventFilter( o, e );
- if (o == myUseCaseView->viewport()) {
- if ( e->type() == QEvent::MouseButtonPress ) {
- // Test if clicked on selection and start drag if necessary
- QMouseEvent* me = ( QMouseEvent* )e;
- QAD_ObjectBrowserItem* item = ( QAD_ObjectBrowserItem* )( myUseCaseView->itemAt( me->pos() ) );
- if ( item && item->isSelected() && me->button() == LeftButton) {
- if ( me->pos().x() > myUseCaseView->header()->sectionPos( myUseCaseView->header()->mapToIndex( 0 ) ) +
- myUseCaseView->treeStepSize() * ( item->depth() + ( myUseCaseView->rootIsDecorated() ? 1 : 0 ) ) +
- myUseCaseView->itemMargin() ||
- me->pos().x() < myUseCaseView->header()->sectionPos( myUseCaseView->header()->mapToIndex( 0 ) ) ) {
- QStringList entryList;
- QListViewItemIterator it( myUseCaseView );
- bool done = true;
- for ( ; it.current(); ++it ) {
- QAD_ObjectBrowserItem* selItem = ( QAD_ObjectBrowserItem* )( it.current() );
- if ( selItem->isSelected() ) {
- if ( isRootItem( selItem ) ) {
- done = false;
- break;
- }
- else {
- entryList.append( selItem->getEntry() );
- }
- }
- }
- if ( done && !entryList.isEmpty() ) {
- QTextDrag *d = new QTextDrag( entryList.join("*"), myUseCaseView->viewport() );
- d->dragMove();
- return true;
- }
- }
- }
- }
- else if ( e->type() == QEvent::DragMove ) {
- QDragMoveEvent* dme = ( QDragMoveEvent* )e;
- if ( dme->source() == myUseCaseView->viewport() ) {
- dme->accept();
- }
- else {
- dme->ignore();
- }
- return true;
- }
- else if ( e->type() == QEvent::Drop ) {
- QDropEvent* de = ( QDropEvent* )e;
- QString text;
- QAD_ObjectBrowserItem* dropItem = ( QAD_ObjectBrowserItem* )( myUseCaseView->itemAt( de->pos() ) );
- if ( de->source() == myUseCaseView->viewport() ) {
- if ( QTextDrag::decode( de, text ) && dropItem && !dropItem->isSelected() ) {
- QAD_ObjectBrowserItem* useCaseItem = ( QAD_ObjectBrowserItem* )getTopParent( dropItem );
- if ( useCaseItem ) {
- if ( !UCBuilder->_is_nil() ) {
- UCBuilder->SetRootCurrent();
- if ( useCaseItem != dropItem ) {
- SALOMEDS::SObject_var dropObject = myStudy->FindObjectID( dropItem->getEntry() );
- if ( !dropObject->_is_nil() )
- UCBuilder->SetCurrentObject( dropObject );
- }
- QStringList entryList = QStringList::split( "*", text, false );
- // if Move action then first remove all selected items
- if ( de->action() == QDropEvent::Move ) {
- QList<QListViewItem> ucSelected;
- ucSelected.setAutoDelete( false );
- getSelectedParents( myUseCaseView, ucSelected );
- for ( int j = 0; j < entryList.count(); j++ ) {
- QAD_ObjectBrowserItem* delItem = ( QAD_ObjectBrowserItem* )( ucSelected.at( j ) );
- QAD_ObjectBrowserItem* ucDelItem = ( QAD_ObjectBrowserItem* )getTopParent( delItem );
- SALOMEDS::SObject_var delSO = myStudy->FindObjectID( delItem->getEntry() );
- if ( !delSO->_is_nil() && ucDelItem ) {
- UCBuilder->Remove( delSO );
- }
- }
- }
- // then try to append items to destination
- for ( int i = 0; i < entryList.count(); i++ ) {
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( entryList[i] );
- if ( !SO->_is_nil() ) {
- UCBuilder->Remove( SO );
- UCBuilder->Append( SO );
- }
- }
- myActiveStudy->updateUseCaseBrowser();
- }
- }
- }
- de->acceptAction();
- }
- else {
- de->ignore();
- }
- return true;
- }
- }
- else if ( o == myUseCaseView ) {
- if ( e->type() == QEvent::KeyPress ) {
- QKeyEvent* ke = ( QKeyEvent* )e;
- if ( ke->key() == Key_Delete ) {
- onUseCasePopupMenu( UC_REMOVE_ID );
- return true;
- }
- }
- }
- return QTabWidget::eventFilter( o, e );
-}
-
-
-/*!
- Returns true if item is collapsed has collapsed children
-*/
-static bool hasCollapsed( QListViewItem* item )
-{
- if ( !item )
- return false;
-
- bool res = ( item->childCount() && !item->isOpen() );
- for ( QListViewItem* child = item->firstChild(); !res && child; child = child->nextSibling() )
- res = hasCollapsed( child );
-
- return res;
-}
-
-/*!
- Expands item and all its children
-*/
-static void expand(QListViewItem* item)
-{
- if ( !item )
- return;
-
- item->setOpen( true );
-
- for ( QListViewItem* child = item->firstChild(); child; child = child->nextSibling() )
- expand( child );
-}
-
-/*!
- Builds popup menu
-*/
-void QAD_ObjectBrowser::onCreatePopup()
-{
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- bool canExpand = false;
- /* VSR : Creation of common POPUP menu for Object Browser/Use Case Browser */
- if ( Sel->IObjectCount() > 0 ) {
- QString theContext;
- QString theParent;
- QString theObject;
-
- Desktop->definePopup( theContext, theParent, theObject );
- if ( myPopup ) {
- Desktop->createPopup( myPopup, theContext, "ObjectBrowser", theObject);
- if ( !Desktop->getActiveComponent().isEmpty() ) {
- Desktop->customPopup( myPopup, theContext, "ObjectBrowser", theObject );
- }
- // VSR:22/01/03 - Command for edit attributes value
- bool EditValues = QAD_CONFIG->getSetting( "ObjectBrowser:EditValues" ) == "true";
- if ( EditValues && Sel->IObjectCount() == 1 && hasEditableAttribute(Sel->firstIObject()) ) {
- if ( myPopup->count() > 0 )
- myPopup->insertSeparator();
- myPopup->insertItem( tr( "EDIT_VALUE_CMD" ),
- this,
- SLOT( onEditAttribute() ) );
- }
-
- for ( QListViewItemIterator it( currentPage() == myListView ? myListView : myUseCaseView ); it.current() && !canExpand; ++it )
- canExpand = canExpand || ( it.current()->isSelected() && hasCollapsed( it.current() ) );
-
- if ( canExpand ) {
- if ( myPopup->count() > 0 )
- myPopup->insertSeparator();
- myPopup->insertItem( tr( "EXPAND_ALL_CMD" ),
- this,
- SLOT( onExpandAll() ) );
- }
- }
- } else {
- // NRI 02/12/2002
- // No selected item => it's not necessary to create popup
- //NRI- : Desktop->createPopup( myPopup, "", "ObjectBrowser", "");
- }
- if ( currentPage() != myListView ) {
- /* VSR : Creation of POPUP menu for UseCase Browser */
- QList<QListViewItem> ucSelected;
- ucSelected.setAutoDelete( false );
- getSelectedParents( myUseCaseView, ucSelected );
-
- if ( myPopup && !myStudy->_is_nil() ) {
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
-// myPopup->clear();
- bool isOne = ucSelected.count() == 1;
- bool isRoot = isOne && isRootItem( ucSelected.at( 0 ) );
- bool manyChildren = myUseCaseView->childCount() > 0 && myUseCaseView->firstChild()->childCount() > 0;
- bool isUseCase = isOne &&
- ( isRoot || UCBuilder->IsUseCase( myStudy->FindObjectID( (( QAD_ObjectBrowserItem* )( ucSelected.at(0) ))->getEntry() ) ) );
-
- if ( isRoot ) {
- myPopup->clear();
- if ( canExpand ) {
- myPopup->insertItem( tr( "EXPAND_ALL_CMD" ),
- this,
- SLOT( onExpandAll() ) );
- }
- }
- QPopupMenu *UseCasePopup = new QPopupMenu( myPopup );
- if ( isOne )
- UseCasePopup->insertItem( tr( "UC_NEW_ID" ), this, SLOT( onUseCasePopupMenu( int ) ), 0, UC_NEW_EMPTY_ID );
- if ( isOne )
- UseCasePopup->insertItem( tr( "UC_SET_CURRENT_ID" ), this, SLOT( onUseCasePopupMenu( int ) ), 0, UC_SET_CURRENT_ID );
- if ( isUseCase )
- UseCasePopup->insertItem( tr( "UC_RENAME_ID" ), this, SLOT( onUseCasePopupMenu( int ) ), 0, UC_RENAME_ID );
- if ( isRoot && manyChildren )
- UseCasePopup->insertItem( tr( "UC_CLEAR_ID" ), this, SLOT( onUseCasePopupMenu( int ) ), 0, UC_CLEAR_ID );
-
- if ( UseCasePopup->count() > 0 ) {
- if ( myPopup->count() > 0 )
- myPopup->insertSeparator();
- myPopup->insertItem( tr( "UC_POPUP" ), UseCasePopup );
- }
- else {
- delete UseCasePopup;
- }
- }
- }
-}
-
-/*!
- Called on "Expand all" popup menu command
-*/
-void QAD_ObjectBrowser::onExpandAll()
-{
- for ( QListViewItemIterator it( currentPage() == myListView ? myListView : myUseCaseView ); it.current(); ++it )
- if ( it.current()->isSelected() )
- expand( it.current() );
-}
-
-/*!
- Returns Object Browser list view
-*/
-QListView* QAD_ObjectBrowser::getListView() const
-{
- return myListView;
-}
-
-/*!
- Returns UseCase Browser list view
-*/
-QListView* QAD_ObjectBrowser::getUseCaseView() const
-{
- return myUseCaseView;
-}
-
-/*!
- Adds anItem ( probably a SComponent )
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::AddItem(QListView* theView,
- const QString& theName,
- const QString& theEntry,
- const QString& theIOR,
- int theType,
- const QString& theValue,
- QAD_ObjectBrowserItem* theAfter)
-
-{
- QAD_ObjectBrowserItem* last = (QAD_ObjectBrowserItem*)(theView->firstChild());
- if ( theAfter )
- last = theAfter;
- else if ( last ) {
- for ( ; last->nextSibling(); last = (QAD_ObjectBrowserItem*)(last->nextSibling()) );
- }
- QAD_ObjectBrowserItem* anItem = new QAD_ObjectBrowserItem( theView, last );
-
- anItem->setType( theType );
- anItem->setOpen( FALSE );
- anItem->setName( theName );
- anItem->setValue( theValue );
- anItem->setEntry( theEntry );
- anItem->setIOR( theIOR );
- anItem->setReference( "" );
-
- return anItem;
-}
-
-/*!
- Adds anItem ( probably a StudyObject )
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::AddItem(QAD_ObjectBrowserItem* theParentItem,
- const QString& theName,
- const QString& theEntry,
- const QString& theIOR,
- int theType,
- const QString& theRef,
- const QString& theValue,
- QAD_ObjectBrowserItem* theAfter)
-
-{
- QAD_ObjectBrowserItem* last = (QAD_ObjectBrowserItem*)(theParentItem->firstChild());
- if ( theAfter )
- last = theAfter;
- else if ( last ) {
- for ( ; last->nextSibling(); last = (QAD_ObjectBrowserItem*)(last->nextSibling()) );
- }
- QAD_ObjectBrowserItem* anItem = new QAD_ObjectBrowserItem(theParentItem, last);
- anItem->setType( theType );
- anItem->setOpen( FALSE );
- anItem->setName( theName );
- anItem->setValue( theValue );
- anItem->setEntry( theEntry );
- anItem->setIOR( theIOR );
- anItem->setReference( theRef );
-
- return anItem;
-}
-
-/*!
- Updates Object Browsers' item [ protected ]
-*/
-void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO,
- QAD_ObjectBrowserItem* theParentItem )
-{
- if ( myStudy->_is_nil() || SO->_is_nil() || !theParentItem ) {
- return;
- }
- SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(SO);
-
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var CSO = it->Value();
- SALOMEDS::SObject_var RefSO;
- QString ior = "";
- CORBA::String_var aString(CSO->GetID());
- QString CSOEntry(aString.in());
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeComment_var aCmnt;
- SALOMEDS::AttributeIOR_var anIOR;
- SALOMEDS::AttributeReal_var aReal;
- SALOMEDS::AttributeInteger_var anInt;
- SALOMEDS::AttributeSelectable_var aSelectable;
- SALOMEDS::AttributeExpandable_var anExpandable;
- SALOMEDS::AttributeOpened_var anOpened;
- SALOMEDS::AttributePixMap_var aPixmap;
- SALOMEDS::AttributeTextColor_var aTextColor;
- SALOMEDS::AttributeTextHighlightColor_var aTextHighlightColor;
-
- QAD_ObjectBrowserItem* Item = 0;
- QString valueString;
-
- if ( CSO->ReferencedObject(RefSO) && !RefSO->_is_nil() ) {
-
- aString = RefSO->GetID();
- QString RefSOEntry(aString.in());
- if (CSO->FindAttribute(anAttr, "AttributeName") || RefSO->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- if (RefSO->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aString = anIOR->Value();
- ior = aString.in();
- }
- valueString = getValueFromObject( RefSO );
- aString = aName->Value();
- Item = AddItem(theParentItem,
- QString(" * ") + aString.in(),
- RefSOEntry,
- ior,
- 2,
- CSOEntry,
- valueString);
- myListViewMap[ RefSOEntry ].append( Item );
- }
- else {
- if(MYDEBUG) MESSAGE("QAD_ObjectBrowser::Update : noname item: "<<CSO->GetID());
- }
- } else {
- // getting Value
- valueString = getValueFromObject( CSO );
- // getting IOR
- if (CSO->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aString = anIOR->Value();
- ior = aString.in();
- }
- // getting Name and adding new Item
- if (CSO->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aString = aName->Value();
- Item = AddItem(theParentItem, aString.in(), CSOEntry, ior, 0, "", valueString);
- myListViewMap[ CSOEntry ].append( Item );
- }
- else {
- if(MYDEBUG) MESSAGE("QAD_ObjectBrowser::Update : noname item: "<<CSO->GetID());
- }
- // adding other attributes
- if (Item) {
- // Selectable
- if ( CSO->FindAttribute(anAttr, "AttributeSelectable") ) {
- aSelectable = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- Item->setSelectable(aSelectable->IsSelectable());
- }
- // Expandable
- if ( CSO->FindAttribute(anAttr, "AttributeExpandable") ) {
- anExpandable = SALOMEDS::AttributeExpandable::_narrow(anAttr);
- Item->setExpandable(anExpandable->IsExpandable());
- }
- // Opened
- if ( CSO->FindAttribute(anAttr, "AttributeOpened") ) {
- anOpened = SALOMEDS::AttributeOpened::_narrow(anAttr);
- Item->setOpen(anOpened->IsOpened());
- }
- // TextColor
- if ( CSO->FindAttribute(anAttr, "AttributeTextColor") ) {
- aTextColor = SALOMEDS::AttributeTextColor::_narrow(anAttr);
- QColor aColor((int)(aTextColor->TextColor().R), (int)(aTextColor->TextColor().G), (int)(aTextColor->TextColor().B)) ;
- Item->setTextColor(aColor);
- }
- // TextHighlightColor
- if ( CSO->FindAttribute(anAttr, "AttributeTextHighlightColor") ) {
- aTextHighlightColor = SALOMEDS::AttributeTextHighlightColor::_narrow(anAttr);
- QColor aColor((int)(aTextHighlightColor->TextHighlightColor().R),
- (int)(aTextHighlightColor->TextHighlightColor().G),
- (int)(aTextHighlightColor->TextHighlightColor().B)) ;
- Item->setTextHighlightColor(aColor);
- }
- // Pixmap
- if ( CSO->FindAttribute(anAttr, "AttributePixMap") ) {
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if ( aPixmap->HasPixMap() ) {
- SALOMEDS::SComponent_var father = CSO->GetFatherComponent();
- if (father->FindAttribute(anAttr, "AttributeName") ) {
- SALOMEDS::AttributeName_var aFatherName;
- aFatherName = SALOMEDS::AttributeName::_narrow(anAttr);
-
- QString msg;
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
- if ( resMgr ) {
- //if(resMgr->loadResources( QString(aFatherName->Value()) + "GUI", msg )) {
- if( resMgr->loadResources( QAD_Application::getDesktop()->getComponentName( QString( aFatherName->Value() ) ), msg ) ) {
- QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName( QString( aFatherName->Value() ) ),
- tr( aPixmap->GetPixMap() ) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ) );
- //QPixmap icon ( resMgr->loadPixmap( QString(aFatherName->Value()) + "GUI",
- //tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ));
- Item->setPixmap( 0, icon );
- }
- }
- }
- }
- }
- }
- }
-// if ( theParentItem->isOpen() )
-// Item->setOpen(TRUE);
-
- if ( Item )
- Update(CSO, Item);
- }
-}
-
-/*!
- Updates Object Browser tree and UseCase Browser tree
-*/
-void QAD_ObjectBrowser::Update()
-{
- int xc = myListView->contentsX();
- int yc = myListView->contentsY();
- myListView->viewport()->setUpdatesEnabled( false );
-
- myListView->clear();
- myListViewMap.clear();
-
- if ( myStudy->_is_nil() ) {
- return;
- }
-
- QString ShowIAPP = QAD_CONFIG->getSetting("ObjectBrowser:IAPP");
-
- /* Updating Object Browser ============================================== */
- SALOMEDS::SComponentIterator_var itcomp = myStudy->NewComponentIterator();
- for (; itcomp->More(); itcomp->Next()) {
- QAD_ObjectBrowserItem* Item = 0;
- SALOMEDS::SComponent_var SC = itcomp->Value();
- CORBA::String_var aString = SC->ComponentDataType();
- QString dataType = aString.in();
- QString ior = "";
- aString = SC->GetID();
- QString SCEntry = aString.in();
-
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeComment_var aCmnt;
- SALOMEDS::AttributeIOR_var anIOR;
- SALOMEDS::AttributeReal_var aReal;
- SALOMEDS::AttributeInteger_var anInt;
- SALOMEDS::AttributeSelectable_var aSelectable;
- SALOMEDS::AttributeExpandable_var anExpandable;
- SALOMEDS::AttributeOpened_var anOpened;
- SALOMEDS::AttributePixMap_var aPixmap;
- SALOMEDS::AttributeTextColor_var aTextColor;
- SALOMEDS::AttributeTextHighlightColor_var aTextHighlightColor;
-
- if (SC->FindAttribute(anAttr, "AttributeIOR")) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aString = anIOR->Value();
- ior = aString.in();
- }
-
- bool caseIAPP = false;
-
- // create data-tree item, corresponding to component (and set name if component has it)
- if ( dataType.compare("Interface Applicative") == 0 ) {
- caseIAPP = true;
- if ( ShowIAPP.compare("true") == 0 ) {
- if (SC->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aString = aName->Value();
- Item = AddItem (myListView, aString.in(), SCEntry.latin1(), ior, 1, "");
- myListViewMap[ SCEntry ].append( Item );
- }
- else {
- Item = AddItem (myListView, dataType, SCEntry, ior, 1, "");
- myListViewMap[ SCEntry ].append( Item );
- }
-
- }
- }
- else {
- caseIAPP = false;
- if (SC->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aString = aName->Value();
- Item = AddItem (myListView, aString.in(), SCEntry, ior, 1, "");
- myListViewMap[ SCEntry ].append( Item );
- }
- else {
- /*In according to CAF - any label (even if it is empty) exist during to whole session.
- So, if label haven't an "AttributeName" it is means that the label is empty.
- Therefore follow action couses bug -
- Item = AddItem (myListView, dataType, SC->GetID(), ior, 1, "");
- */
- }
- }
- // add other attributes
- if (Item) {
- // Selectable
- if ( SC->FindAttribute(anAttr, "AttributeSelectable") ) {
- aSelectable = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- Item->setSelectable(aSelectable->IsSelectable());
- }
- // Expandable
- if ( SC->FindAttribute(anAttr, "AttributeExpandable") ) {
- anExpandable = SALOMEDS::AttributeExpandable::_narrow(anAttr);
- Item->setExpandable(anExpandable->IsExpandable());
- }
- // Opened
- if ( SC->FindAttribute(anAttr, "AttributeOpened") ) {
- anOpened = SALOMEDS::AttributeOpened::_narrow(anAttr);
- Item->setOpen(anOpened->IsOpened());
- }
- // TextColor
- if ( SC->FindAttribute(anAttr, "AttributeTextColor") ) {
- aTextColor = SALOMEDS::AttributeTextColor::_narrow(anAttr);
- QColor aColor((int)(aTextColor->TextColor().R), (int)(aTextColor->TextColor().G), (int)(aTextColor->TextColor().B)) ;
- Item->setTextColor(aColor);
- }
- // TextHighlightColor
- if ( SC->FindAttribute(anAttr, "AttributeTextHighlightColor") ) {
- aTextHighlightColor = SALOMEDS::AttributeTextHighlightColor::_narrow(anAttr);
- QColor aColor((int)(aTextHighlightColor->TextHighlightColor().R),
- (int)(aTextHighlightColor->TextHighlightColor().G),
- (int)(aTextHighlightColor->TextHighlightColor().B)) ;
- Item->setTextHighlightColor(aColor);
- }
-
- // Pixmap
- if ( SC->FindAttribute(anAttr, "AttributePixMap") ) {
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if ( aPixmap->HasPixMap() ) {
- QString msg;
- QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
- if ( resMgr ) {
- if(MYDEBUG) MESSAGE ( " Component " << aName->Value() );
- if(MYDEBUG) MESSAGE ( " Icon " << aPixmap->GetPixMap() );
- if(resMgr->loadResources( QAD_Application::getDesktop()->getComponentName(QString(aName->Value())), msg )) {
- QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName(QString(aName->Value())),
- tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ));
- Item->setPixmap( 0, icon );
- }
- }
- }
- }
- /*
- if ( strcmp(dataType, TypeComponent) == 0 )
- Item->setOpen(TRUE);
- */
- if ( caseIAPP && ShowIAPP.compare("true") == 0 )
- Update (SC, Item);
-
- if ( !caseIAPP )
- Update (SC, Item);
- }
- }
- myListView->setContentsPos(xc,yc);
-
- myListView->viewport()->setUpdatesEnabled( true );
- myListView->viewport()->repaint( false );
- /* Updating UseCase Browser ============================================= */
- if ( this->count() > 1 )
- UpdateUseCaseBrowser();
-}
-
-/*!
- Removes item with all childs from the map - used to optimize UseCase browser update
-*/
-void removeFromMap( ItemMap& theMap, QAD_ObjectBrowserItem* item )
-{
- if ( item ) {
- QAD_ObjectBrowserItem* subItem = ( QAD_ObjectBrowserItem* )( item->firstChild() );
- while ( subItem ) {
- removeFromMap( theMap, subItem );
- subItem = ( QAD_ObjectBrowserItem* )( subItem->nextSibling() );
- }
- if ( theMap.contains( item->getEntry() ) ) {
- theMap[ item->getEntry() ].removeRef( item );
- if ( theMap[ item->getEntry() ].isEmpty() ) {
- theMap.remove( item->getEntry() );
- }
- }
- }
-}
-
-/*!
- Updates only UseCase Browser
-*/
-void QAD_ObjectBrowser::UpdateUseCaseBrowser() {
-// myUseCaseView->clear(); myUseCaseMap.clear();
- if ( myStudy->_is_nil() || this->count()<2 ) {
- return;
- }
- myUseCaseView->blockSignals( true );
-// myUseCaseView->setUpdatesEnabled( false );
-
- QAD_ObjectBrowserItem* root = ( QAD_ObjectBrowserItem* )myUseCaseView->firstChild();
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
- SALOMEDS::SObject_var SOCurrent = UCBuilder->GetCurrentObject();
- CORBA::String_var aString = UCBuilder->GetName();
- QString UCName = aString.in();
- if ( UCName.isEmpty() )
- UCName = QString( tr( "Root" ) );
- // creating root item if is not yet created
- if ( !root ) {
- root = AddItem( myUseCaseView, UCName, "0:2", "", 1, "" );
- myUseCaseMap[ "0:2" ].append( root );
- }
- else
- root->setName( UCName );
- // setting it current if necessary
- root->setCurrent( SOCurrent->_is_nil() || !strcmp( SOCurrent->GetID(), "0:2" ) );
- // updating list view...
- QMap<QString,SALOMEDS::SObject_var> ucList;
- SALOMEDS::UseCaseIterator_var UCIter = UCBuilder->GetUseCaseIterator( SALOMEDS::SObject::_nil() );
- if ( !UCIter->_is_nil() ) {
- for ( ; UCIter->More(); UCIter->Next() ) {
- SALOMEDS::SObject_var UCObject = UCIter->Value();
- aString = UCObject->GetID();
- QString UCEntry = aString.in();
- ucList[ UCEntry ] = UCObject;
- }
- }
- // ... 1) delete removed items
- QAD_ObjectBrowserItem* childItem = ( QAD_ObjectBrowserItem* )root->firstChild();
- while ( childItem ) {
- QAD_ObjectBrowserItem* prevItem = childItem;
- childItem = ( QAD_ObjectBrowserItem* )childItem->nextSibling();
- if ( !ucList.contains( prevItem->getEntry() ) ) {
-// myUseCaseMap[ prevItem->getEntry() ].removeRef( prevItem );
-// if ( myUseCaseMap[ prevItem->getEntry() ].isEmpty() )
-// myUseCaseMap.remove( prevItem->getEntry() );
- removeFromMap( myUseCaseMap, prevItem );
- delete prevItem;
- }
- }
- // ... 2) create/update existing
- QMap<QString,SALOMEDS::SObject_var>::Iterator it;
- for ( it = ucList.begin(); it != ucList.end(); ++it ) {
- UpdateUCItem( it.data(), root );
- }
- myUseCaseView->blockSignals( false );
-// myUseCaseView->setUpdatesEnabled( true );
-// myUseCaseView->update();
-// UCItem->setOpen( true );
-}
-
-/*!
- Updates UseCase Browser's item
-*/
-void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_ObjectBrowserItem* UCItem )
-{
- if ( myStudy->_is_nil() || !UCItem )
- return;
-
- // --- VSR: 01/02/05 --- start
- // skip all 'Interface Applicative' objects
- SALOMEDS::SComponent_var SCO = UCObject->GetFatherComponent();
- CORBA::String_var aCorbaString = SCO->ComponentDataType();
- QString dataType = aCorbaString.in();
- if ( dataType.compare("Interface Applicative") == 0 )
- return;
- // --- VSR: 01/02/05 --- finish
-
- /* Creating SObjects item */
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
- SALOMEDS::AttributeSelectable_var aSelectable;
- SALOMEDS::AttributeExpandable_var anExpandable;
- SALOMEDS::AttributePixMap_var aPixmap;
- SALOMEDS::AttributeTextColor_var aTextColor;
- SALOMEDS::AttributeTextHighlightColor_var aTextHighlightColor;
- QString valueString;
- QString ior = "";
- CORBA::String_var aString = UCObject->GetID();
- QString UCEntry = aString.in();
-
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
- SALOMEDS::SObject_var SOCurrent = UCBuilder->GetCurrentObject();
- bool isUseCase = UCBuilder->IsUseCase( UCObject );
-
- QAD_ObjectBrowserItem* UCSubItem = 0;
- if ( myUseCaseMap.contains( UCEntry ) && myUseCaseMap[ UCEntry ].count() > 0 )
- UCSubItem = myUseCaseMap[ UCEntry ].first();
-
- if ( UCObject->ReferencedObject( RefSO ) && !RefSO->_is_nil() ) {
- aString = RefSO->GetID();
- QString RefSOEntry = aString.in();
- if ( UCObject->FindAttribute( anAttr, "AttributeName" ) || RefSO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- if ( RefSO->FindAttribute( anAttr, "AttributeIOR" ) ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- aString = anIOR->Value();
- ior = aString.in();
- }
- valueString = getValueFromObject( RefSO );
- aString = aName->Value();
- if ( !UCSubItem ) {
- UCSubItem = AddItem( UCItem,
- QString( " * " ) + aString.in(),
- RefSOEntry,
- ior,
- 2,
- UCEntry,
- valueString );
- myUseCaseMap[ RefSOEntry ].append( UCSubItem );
- }
- else {
- UCSubItem->setName( QString( " * " ) + aString.in() );
- UCSubItem->setEntry( RefSOEntry );
- UCSubItem->setIOR( ior );
- UCSubItem->setReference( UCEntry );
- UCSubItem->setValue( valueString );
- }
- UCSubItem->setCurrent( !SOCurrent->_is_nil() && QString( SOCurrent->GetID() ) == QString( UCEntry ) );
- }
- }
- else {
- // getting Value
- valueString = getValueFromObject( UCObject );
- // getting IOR
- if ( UCObject->FindAttribute( anAttr, "AttributeIOR" ) ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- aString = anIOR->Value();
- ior = aString.in();
- }
- // getting Name and adding new Item
- if ( UCObject->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- aString = aName->Value();
- if ( !UCSubItem ) {
- UCSubItem = AddItem( UCItem, aString.in(), UCEntry, ior, isUseCase ? 1 : 0, "", valueString );
- myUseCaseMap[ UCEntry ].append( UCSubItem );
- }
- else {
- UCSubItem->setName( aString.in() );
- UCSubItem->setEntry( UCEntry );
- UCSubItem->setIOR( ior );
- UCSubItem->setReference( "" );
- UCSubItem->setValue( valueString );
- }
- }
- // adding other attributes
- if ( UCSubItem ) {
- UCSubItem->setCurrent( !SOCurrent->_is_nil() && QString( SOCurrent->GetID() ) == QString( UCEntry ) );
-// Selectable
-// if ( UCObject->FindAttribute( anAttr, "AttributeSelectable" ) ) {
-// aSelectable = SALOMEDS::AttributeSelectable::_narrow( anAttr );
-// UCSubItem->setSelectable( aSelectable->IsSelectable() );
-// }
-// Expandable
-// if ( UCObject->FindAttribute( anAttr, "AttributeExpandable" ) ) {
-// anExpandable = SALOMEDS::AttributeExpandable::_narrow( anAttr );
-// UCSubItem->setExpandable( anExpandable->IsExpandable() );
-// }
-// TextColor
- if ( UCObject->FindAttribute(anAttr, "AttributeTextColor" ) ) {
- aTextColor = SALOMEDS::AttributeTextColor::_narrow( anAttr );
- QColor aColor( (int)(aTextColor->TextColor().R),
- (int)(aTextColor->TextColor().G),
- (int)(aTextColor->TextColor().B) );
- UCSubItem->setTextColor( aColor );
- }
- // TextHighlightColor
- if ( UCObject->FindAttribute( anAttr, "AttributeTextHighlightColor" ) ) {
- aTextHighlightColor = SALOMEDS::AttributeTextHighlightColor::_narrow( anAttr );
- QColor aColor( (int)(aTextHighlightColor->TextHighlightColor().R),
- (int)(aTextHighlightColor->TextHighlightColor().G),
- (int)(aTextHighlightColor->TextHighlightColor().B) );
- UCSubItem->setTextHighlightColor( aColor );
- }
- // Pixmap
- if ( UCObject->FindAttribute( anAttr, "AttributePixMap" ) ) {
- aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- if ( aPixmap->HasPixMap() ) {
- SALOMEDS::SComponent_var father = UCObject->GetFatherComponent();
- if ( father->FindAttribute( anAttr, "AttributeName" ) ) {
- SALOMEDS::AttributeName_var aFatherName;
- aFatherName = SALOMEDS::AttributeName::_narrow( anAttr );
- QAD_ResourceMgr* resMgr = QAD_Desktop::getResourceManager();
- if ( resMgr ) {
- QString msg;
- if( resMgr->loadResources( QAD_Application::getDesktop()->getComponentName(QString( aFatherName->Value() )), msg ) ) {
- QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName(QString( aFatherName->Value() )),
- tr( aPixmap->GetPixMap() ) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ ) );
- UCSubItem->setPixmap( 0, icon );
- }
- }
- }
- }
- }
- }
- }
- if ( UCSubItem ) {
- // updating children ...
- QMap<QString,SALOMEDS::SObject_var> ucList;
- SALOMEDS::UseCaseIterator_var UCIter = UCBuilder->GetUseCaseIterator( UCObject );
- if ( !UCIter->_is_nil() ) {
- for ( ; UCIter->More(); UCIter->Next() ) {
- SALOMEDS::SObject_var UCSubObject = UCIter->Value();
- aString = UCSubObject->GetID();
- QString UCSubEntry = aString.in();
- ucList[ UCSubEntry ] = UCSubObject;
- }
- }
- // ... 1) delete removed items
- QAD_ObjectBrowserItem* childItem = ( QAD_ObjectBrowserItem* )UCSubItem->firstChild();
- while ( childItem ) {
- QAD_ObjectBrowserItem* prevItem = childItem;
- childItem = ( QAD_ObjectBrowserItem* )childItem->nextSibling();
- if ( !ucList.contains( prevItem->getEntry() ) ) {
- // myUseCaseMap[ prevItem->getEntry() ].removeRef( prevItem );
- // if ( myUseCaseMap[ prevItem->getEntry() ].isEmpty() )
- // myUseCaseMap.remove( prevItem->getEntry() );
- removeFromMap( myUseCaseMap, prevItem );
- delete prevItem;
- }
- }
- // ... 2) create/update existing
- QMap<QString,SALOMEDS::SObject_var>::Iterator it;
- for ( it = ucList.begin(); it != ucList.end(); ++it ) {
- UpdateUCItem( it.data(), UCSubItem );
- }
- }
-}
-
-/*!
- Unhighlights all items
-*/
-void QAD_ObjectBrowser::unHighlightAll()
-{
- myListView->clearSelection();
- myUseCaseView->clearSelection();
-}
-
-/*!
- Highlights items which refer to object
-*/
-void QAD_ObjectBrowser::highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight )
-{
- QList<QAD_ObjectBrowserItem> List;
- if (getItems(IObject, List)) {
- for (int i = 0; i < List.count(); i++) {
- List.at(i)->setSelected( highlight );
- List.at(i)->repaint();
- }
- }
-}
-
-/*!
- Gets items from Object Browser which refer to object
-*/
-bool QAD_ObjectBrowser::getItems( const Handle(SALOME_InteractiveObject)& IObject,
- QList<QAD_ObjectBrowserItem>& List)
-{
- List.clear();
- if ( myListViewMap.contains( IObject->getEntry() ) ) {
- ItemList ilist = myListViewMap[ IObject->getEntry() ];
- for ( int i = 0; i < ilist.count(); i++ )
- List.append( ilist.at(i) );
- }
- if ( myUseCaseMap.contains( IObject->getEntry() ) ) {
- ItemList ilist = myUseCaseMap[ IObject->getEntry() ];
- for ( int i = 0; i < ilist.count(); i++ )
- List.append( ilist.at(i) );
- }
- return (List.count() > 0);
-}
-
-/*!
- Gets items from Object Browser which refer to object
-*/
-bool QAD_ObjectBrowser::getItems( SALOMEDS::SObject_ptr SO,
- QList<QAD_ObjectBrowserItem>& List)
-{
- List.clear();
- if ( myListViewMap.contains( SO->GetID() ) ) {
- ItemList ilist = myListViewMap[ SO->GetID() ];
- for ( int i = 0; i < ilist.count(); i++ )
- List.append( ilist.at(i) );
- }
- if ( myUseCaseMap.contains( SO->GetID() ) ) {
- ItemList ilist = myUseCaseMap[ SO->GetID() ];
- for ( int i = 0; i < ilist.count(); i++ )
- List.append( ilist.at(i) );
- }
- return (List.count() > 0);
-}
-
-/*!
- Gets first item from Object Browser which refers to object (not reference)
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::getItem( const Handle(SALOME_InteractiveObject)& IObject )
-{
- if ( myListViewMap.contains( IObject->getEntry() ) ) {
- ItemList ilist = myListViewMap[ IObject->getEntry() ];
- for ( int i = 0; i < ilist.count(); i++ ) {
- QString aRef = ilist.at(i)->getReference();
- if ( ilist.at(i)->getReference().isEmpty() )
- return ilist.at(i);
- }
- }
- return 0;
-}
-
-/*!
- Finds item from Object Browser corresponding to Object, returns 0 if fails
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::getItem( SALOMEDS::SObject_ptr SO )
-{
- if ( myListViewMap.contains( SO->GetID() ) ) {
- ItemList ilist = myListViewMap[ SO->GetID() ];
- for ( int i = 0; i < ilist.count(); i++ ) {
- QString aRef = ilist.at(i)->getReference();
- if ( ilist.at(i)->getReference().isEmpty() )
- return ilist.at(i);
- }
- }
- return 0;
-}
-
-
-/*!
- Gets first item from UseCase Browser which refers to object (not reference)
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::getUCItem( const Handle(SALOME_InteractiveObject)& IObject )
-{
- if ( myUseCaseMap.contains( IObject->getEntry() ) ) {
- ItemList ilist = myUseCaseMap[ IObject->getEntry() ];
- for ( int i = 0; i < ilist.count(); i++ ) {
- QString aRef = ilist.at(i)->getReference();
- if ( ilist.at(i)->getReference().isEmpty() )
- return ilist.at(i);
- }
- }
- return 0;
-}
-
-/*!
- Finds item from UseCase Browser corresponding to Object, returns 0 if fails
-*/
-QAD_ObjectBrowserItem* QAD_ObjectBrowser::getUCItem( SALOMEDS::SObject_ptr SO )
-{
- if ( myUseCaseMap.contains( SO->GetID() ) ) {
- ItemList ilist = myUseCaseMap[ SO->GetID() ];
- for ( int i = 0; i < ilist.count(); i++ ) {
- QString aRef = ilist.at(i)->getReference();
- if ( ilist.at(i)->getReference().isEmpty() )
- return ilist.at(i);
- }
- }
- return 0;
-}
-/*!
- Finds item corresponding to interactive object, returns 0 if fails
-*/
-void QAD_ObjectBrowser::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
-{
- QAD_ObjectBrowserItem* item = getItem( IObject );
- if ( item ) {
- item->setName( newName );
- item->repaint();
- }
- item = getUCItem( IObject );
- if ( item ) {
- item->setName( newName );
- item->repaint();
- }
-}
-
-/*!
- Creates and show specific Popup to this according to current selection (Object Browser)
-*/
-void QAD_ObjectBrowser::showPopupMenu(QListViewItem* theItem)
-{
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
-
- if (theItem != NULL && ( Sel->IObjectCount()>0 || ActiveComp.isEmpty() ) ) {
-
- // PAL5618: if IO is presented by several items, assure that the selected IO
- // is presented exactly by theItem: difference is in reference
- QAD_ObjectBrowserItem *item = (QAD_ObjectBrowserItem *) theItem;
- QString theEntry = item->getEntry();
- const SALOME_ListIO& SelIO = Sel->StoredIObjects();
- for ( SALOME_ListIteratorOfListIO SelIt( SelIO ); SelIt.More(); SelIt.Next() ) {
- const Handle(SALOME_InteractiveObject)& IO = SelIt.Value();
- if ( strcmp ( IO->getEntry(), theEntry ) == 0 )
- IO->setReference( item->getReference() );
- }
-
- createPopup();
-
- if ( myPopup ) {
- QAD_Tools::checkPopup( myPopup );
- if ( myPopup->count()>0 ) {
- myPopup->exec( QCursor::pos() );
- }
- destroyPopup();
- }
- }
-}
-
-/*!
- Creates and show specific Popup to this according to current selection (UseCase Browser)
-*/
-void QAD_ObjectBrowser::showUseCasePopupMenu(QListViewItem* theItem)
-{
- createPopup();
- if ( myPopup ) {
- QAD_Tools::checkPopup( myPopup );
- if ( myPopup->count() > 0 ) {
- myPopup->exec( QCursor::pos() );
- }
- destroyPopup();
- }
-}
-
-/*!
- Called when current selection was changed (Object Browser)
-*/
-void QAD_ObjectBrowser::onSelectedItem()
-{
- if (currentPage()==myListView)
- myUseCaseView->clearSelection();
-
- QListView* whoIs;
- if ( sender()->inherits("QListView") )
- whoIs = (QListView*)sender();
- else
- whoIs = myListView;
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- QAD_Application* myApp = QAD_Application::getDesktop()->getActiveApp();
-
- SALOME_ListIO DeltaPos;
- DeltaPos.Clear();
- SALOME_ListIO DeltaNeg;
- DeltaNeg.Clear();
-
- typedef QMap<QString, SALOME_InteractiveObject*> SelMap;
-
- SelMap currMap, allMap;
- for( SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); It.More(); It.Next() )
- currMap.insert( It.Value()->getEntry(), It.Value().operator->() );
-
- QListViewItemIterator it( whoIs );
- for ( ; it.current(); ++it ) {
- QAD_ObjectBrowserItem* item = (QAD_ObjectBrowserItem*)it.current();
- QString theEntry = item->getEntry();
- QString theName = item->getName();
- QString theRef = item->getReference();
-
- if ( !theEntry.isEmpty() ) {
- if ( item->isSelected() ) {
- allMap.insert( theEntry, 0 );
-
- if ( !currMap.contains( theEntry ) ) {
- Handle(SALOME_InteractiveObject) newIO;
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( theEntry.latin1() );
- if ( !obj->_is_nil() ) {
- SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
- if ( !comp->_is_nil() ) {
- CORBA::String_var datatype(comp->ComponentDataType());
- newIO = new SALOME_InteractiveObject( theEntry.latin1(),
- datatype.in(),
- theName.latin1() );
- newIO->setReference( theRef.latin1() );
- }
- } else {
- newIO = new SALOME_InteractiveObject( theEntry.latin1(),
- "",
- theName.latin1() );
- newIO->setReference( theRef.latin1() );
- }
- if (!newIO.IsNull()) {
- DeltaPos.Append( newIO );
- }
- }
- } else if ( currMap.contains( theEntry ) )
- DeltaNeg.Append( currMap[theEntry] );
- }
- }
-
- SALOME_ListIteratorOfListIO ItNeg( DeltaNeg );
- for(;ItNeg.More();ItNeg.Next()) {
- Sel->RemoveIObject( ItNeg.Value() );
- }
-
- SALOME_ListIteratorOfListIO ItPos( DeltaPos );
- for(;ItPos.More();ItPos.Next()) {
- Sel->AddIObject( ItPos.Value() );
- }
-
- for ( SelMap::iterator it = currMap.begin(); it != currMap.end(); ++it )
- if ( !allMap.contains( it.key() ) )
- Sel->RemoveIObject( it.data() );
-
- if ( myApp )
- myApp->updateActions();
-}
-
-/*!
- Called when selection is changed (UseCase Browser)
-*/
-void QAD_ObjectBrowser::onUseCaseSelectedItem()
-{
-}
-
-/*!
- Called when item is expanded
-*/
-void QAD_ObjectBrowser::onExpanded (QListViewItem* item)
-{
- QAD_ObjectBrowserItem* aItem = (QAD_ObjectBrowserItem*)item;
- if (!myStudy->_is_nil() && aItem)
- {
- SALOMEDS::SObject_var Object = myStudy->FindObjectID(aItem->getEntry());
- if (!Object->_is_nil())
- {
- SALOMEDS::StudyBuilder_var StudyBuilder = myStudy->NewBuilder();
- SALOMEDS::AttributeOpened_var anAttr = SALOMEDS::AttributeOpened::_narrow(
- StudyBuilder->FindOrCreateAttribute(Object, "AttributeOpened") );
- anAttr->SetOpened(true);
- }
- }
-}
-
-/*!
- Called when item is collapsed
-*/
-void QAD_ObjectBrowser::onCollapsed(QListViewItem* item)
-{
- QAD_ObjectBrowserItem* aItem = (QAD_ObjectBrowserItem*)item;
- if (!myStudy->_is_nil() && aItem)
- {
- SALOMEDS::SObject_var Object = myStudy->FindObjectID(aItem->getEntry());
- if (!Object->_is_nil())
- {
- SALOMEDS::StudyBuilder_var StudyBuilder = myStudy->NewBuilder();
- SALOMEDS::AttributeOpened_var anAttr = SALOMEDS::AttributeOpened::_narrow(
- StudyBuilder->FindOrCreateAttribute(Object, "AttributeOpened") );
- anAttr->SetOpened(false);
- }
- }
-}
-
-/*!
- Find and returns value for the object
- Warning: object can have several values attributes, search is done in the following order:
- [integer], [real], [table of integer], [table of real], [comment]
-*/
-QString QAD_ObjectBrowser::getValueFromObject( SALOMEDS::SObject_ptr SO )
-{
- if ( SO->_is_nil() )
- return QString::null;
- SALOMEDS::SComponent_var isComponent = SALOMEDS::SComponent::_narrow( SO );
- if ( !isComponent->_is_nil() )
- return QString::null; // no values to show for components
-
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeInteger_var anInt;
- SALOMEDS::AttributeReal_var aReal;
- SALOMEDS::AttributeTableOfInteger_var aTableInt;
- SALOMEDS::AttributeTableOfReal_var aTableReal;
- SALOMEDS::AttributeComment_var aComment;
- CORBA::String_var aString;
-
- // Integer
- if ( SO->FindAttribute( anAttr, "AttributeInteger" ) ) {
- anInt = SALOMEDS::AttributeInteger::_narrow( anAttr );
- QString val = QString::number( anInt->Value() );
- return val;
- }
- // Real
- if ( SO->FindAttribute( anAttr, "AttributeReal" ) ) {
- aReal = SALOMEDS::AttributeReal::_narrow( anAttr );
- QString val = QString::number( aReal->Value() );
- return val;
- }
- // Table of integer
- if ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
- aTableInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- aString = aTableInt->GetTitle();
- QString tlt( aString.in() );
- if ( !tlt.isEmpty() )
- tlt += " ";
- int nbRows = aTableInt->GetNbRows() ;
- int nbCols = aTableInt->GetNbColumns();
- QString val = tlt + QString( "[" ) + QString::number( nbRows ) + QString( "," ) + QString::number( nbCols ) + QString( "]" );
- return val;
- }
- // Table of real
- if ( SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
- aTableReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- aString = aTableReal->GetTitle();
- QString tlt( aString.in() );
- if ( !tlt.isEmpty() )
- tlt += " ";
- int nbRows = aTableReal->GetNbRows() ;
- int nbCols = aTableReal->GetNbColumns();
- QString val = tlt + QString( "[" ) + QString::number( nbRows ) + QString( "," ) + QString::number( nbCols ) + QString( "]" );
- return val;
- }
- // Comment
- if ( SO->FindAttribute(anAttr, "AttributeComment") ) {
- aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- aString = aComment->Value();
- QString val = QString( aString.in() );
- return val;
- }
- return QString::null;
-}
-
-/*!
- Shows/hides IAPP sub-tree in ObjectBrowser
- Current implementation just udpates browser
-*/
-void QAD_ObjectBrowser::setShowIAPP( bool show )
-{
- Update();
-}
-
-/*!
- Shows/hides info columns: Entry, IOR, Reference
-*/
-void QAD_ObjectBrowser::setShowInfoColumns( bool show )
-{
- bool shown = myListView->header()->isResizeEnabled( 2 );
-
- if ( show != shown ) {
- if ( show ) {
- myListView->header()->setResizeEnabled( true, 2 );
- myListView->header()->setResizeEnabled( true, 3 );
- myListView->header()->setResizeEnabled( true, 4 );
- myListView->setColumnWidthMode( 2, QListView::Maximum );
- myListView->setColumnWidthMode( 3, QListView::Maximum );
- myListView->setColumnWidthMode( 4, QListView::Maximum );
- if ( myListView->columnWidth( 2 ) <= 0 )
- myListView->header()->resizeSection( 2, 50 );
- if ( myListView->columnWidth( 3 ) <= 0 )
- myListView->header()->resizeSection( 3, 50 );
- if ( myListView->columnWidth( 4 ) <= 0 )
- myListView->header()->resizeSection( 4, 50 );
- }
- else {
- myListView->setColumnWidthMode( 2, QListView::Manual );
- myListView->setColumnWidthMode( 3, QListView::Manual );
- myListView->setColumnWidthMode( 4, QListView::Manual );
- myListView->header()->resizeSection( 2, 0 );
- myListView->header()->resizeSection( 3, 0 );
- myListView->header()->resizeSection( 4, 0 );
- myListView->header()->setResizeEnabled( false, 2 );
- myListView->header()->setResizeEnabled( false, 3 );
- myListView->header()->setResizeEnabled( false, 4 );
- }
- }
-}
-
-/*!
- Shows/hides Value column
-*/
-void QAD_ObjectBrowser::setShowValueColumn( bool show )
-{
- bool shown = myListView->header()->isResizeEnabled( 1 );
-
- if ( show != shown ) {
- if ( show ) {
- myListView->header()->setResizeEnabled( true, 1 );
- myListView->setColumnWidthMode( 1, QListView::Maximum );
- if ( myListView->columnWidth( 1 ) <= 0 )
- myListView->header()->resizeSection( 1, 50 );
- }
- else {
- myListView->setColumnWidthMode( 1, QListView::Manual );
- myListView->header()->resizeSection( 1, 0 );
- myListView->header()->setResizeEnabled( false, 1 );
- }
- }
-}
-
-/*!
- Sets CHRONO sorting enabled/disabled
- Note: when CHRONO sorting is enabled items are sorted by Entry value and column headers
- become unclickable to prohibit another sort type;
- when CHRONO sorting is disabled column headers become clickable - this allows
- to sort data by any column
-*/
-void QAD_ObjectBrowser::setEnableChronoSort( bool enable )
-{
- if ( enable ) {
- // if CHRONO sorting is enabled set clickable header disabled ...
- myListView->header()->setClickEnabled( false );
- // ... and then sort by column 2 - OCAF doc entry
- myListView->setSorting( 2, TRUE ) ;
- }
- else {
- // if CHRONO sorting is enabled set clickable header enabled ...
- myListView->header()->setClickEnabled( true );
- // and clear sorting by column 2
- myListView->setSorting( 10, TRUE );
- }
-// myListView->sort( ) ;
-}
-
-/*!
- Slot, called to edit value
-*/
-void QAD_ObjectBrowser::onEditAttribute()
-{
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
- if ( myStudy->_is_nil() )
- return;
-
- if ( Sel->IObjectCount() == 1 ) {
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( Sel->firstIObject()->getEntry() );
- SALOMEDS::SComponent_var isComponent = SALOMEDS::SComponent::_narrow( SO );
- if ( !SO->_is_nil() && isComponent->_is_nil() ) { // no values to show for components
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeInteger_var anInt;
- SALOMEDS::AttributeReal_var aReal;
- SALOMEDS::AttributeTableOfInteger_var aTableInt;
- SALOMEDS::AttributeTableOfReal_var aTableReal;
- SALOMEDS::AttributeComment_var aComment;
- bool bOk = false;
-
- // if Integer
- if ( SO->FindAttribute( anAttr, "AttributeInteger" ) ) {
- anInt = SALOMEDS::AttributeInteger::_narrow( anAttr );
- int val = SALOMEGUI_SetValueDlg::getInteger( tr( "SET_VALUE_INT_TLT" ),
- tr( "SET_VALUE_INT_LBL" ),
- anInt->Value(),
- &bOk,
- QAD_Application::getDesktop() );
- if ( bOk ) {
- anInt->SetValue( val );
- }
- }
- // if Real
- else
- if ( SO->FindAttribute( anAttr, "AttributeReal" ) ) {
- aReal = SALOMEDS::AttributeReal::_narrow( anAttr );
- double val = SALOMEGUI_SetValueDlg::getDouble( tr( "SET_VALUE_REAL_TLT" ),
- tr( "SET_VALUE_REAL_LBL" ),
- aReal->Value(),
- &bOk,
- QAD_Application::getDesktop() );
- if ( bOk ) {
- aReal->SetValue( val );
- }
- }
- // if Table of integer
- else
- if ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
- SALOMEGUI_TableDlg* dlg = new SALOMEGUI_TableDlg( QAD_Application::getDesktop(),
- SO,
- true,
- SALOMEGUI_TableDlg::ttInt );
- bOk = ( dlg->exec() == QDialog::Accepted );
- }
- // if Table of real
- else
- if ( SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
- SALOMEGUI_TableDlg* dlg = new SALOMEGUI_TableDlg( QAD_Application::getDesktop(),
- SO,
- true,
- SALOMEGUI_TableDlg::ttReal );
- bOk = ( dlg->exec() == QDialog::Accepted );
- }
- // if Comment
- else
- if ( SO->FindAttribute(anAttr, "AttributeComment") ) {
- aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- QString val = SALOMEGUI_SetValueDlg::getString( tr( "SET_VALUE_COMMENT_TLT" ),
- tr( "SET_VALUE_COMMENT_LBL" ),
- aComment->Value(),
- &bOk,
- QAD_Application::getDesktop() );
- if ( bOk ) {
- aComment->SetValue( val );
- }
- }
- if ( bOk ) {
- Update();
- }
- }
- }
-}
-
-/*!
- Returns true if object has editable attrubute :
- integer, real, table or comment
-*/
-bool QAD_ObjectBrowser::hasEditableAttribute( const Handle(SALOME_InteractiveObject)& object )
-{
- if ( !myStudy->_is_nil() ) {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID( object->getEntry() );
- SALOMEDS::SComponent_var comp = myStudy->FindComponentID( object->getEntry() );
- if ( !comp->_is_nil() || obj->_is_nil() )
- return false;
- QString val = getValueFromObject( obj );
- return ( !val.isNull() );
- }
- return false;
-}
-
-/*!
- Returns true if object has table attrubute ( integer and/or real )
-*/
-bool QAD_ObjectBrowser::hasTable( const Handle(SALOME_InteractiveObject)& object )
-{
- SALOMEDS::GenericAttribute_var anAttr;
- if ( !myStudy->_is_nil() ) {
- SALOMEDS::SObject_var obj = myStudy->FindObjectID( object->getEntry() );
- SALOMEDS::SComponent_var comp = myStudy->FindComponentID( object->getEntry() );
- if ( !comp->_is_nil() || obj->_is_nil() )
- return false;
- if ( obj->FindAttribute( anAttr, "AttributeTableOfInteger" ) )
- return true;
- if ( obj->FindAttribute( anAttr, "AttributeTableOfReal" ) )
- return true;
- }
- return false;
-}
-
-/*!
- Slot, called when one of the UseCase Browser menu command is called
-*/
-void QAD_ObjectBrowser::onUseCasePopupMenu( int action )
-{
- if ( myStudy->_is_nil() )
- return;
-
- // Check if the study is locked
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- if ( aStudy->GetProperties()->IsLocked() )
- {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return;
- }
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
- SALOMEDS::SObject_var Current = UCBuilder->GetCurrentObject();
- CORBA::String_var aString;
-
- QList<QListViewItem> ucSelected;
- ucSelected.setAutoDelete( false );
- getSelectedParents( myUseCaseView, ucSelected );
-
- if ( action == UC_NEW_EMPTY_ID ) {
- if ( ucSelected.count() == 1 ) {
- if ( isRootItem( ucSelected.at(0) ) )
- UCBuilder->SetRootCurrent();
- else
- UCBuilder->SetCurrentObject( myStudy->FindObjectID( (( QAD_ObjectBrowserItem* )( ucSelected.at(0) ))->getEntry() ) );
- UCBuilder->AddUseCase( tr( "NEW_OBJECT" ) );
- myActiveStudy->updateUseCaseBrowser();
- }
- }
- else
- if ( action == UC_SET_CURRENT_ID ) {
- if ( ucSelected.count() > 0 ) {
- if ( isRootItem( ucSelected.at(0) ) )
- UCBuilder->SetRootCurrent();
- else
- UCBuilder->SetCurrentObject( myStudy->FindObjectID( (( QAD_ObjectBrowserItem* )( ucSelected.at(0) ))->getEntry() ) );
- }
- myActiveStudy->updateUseCaseBrowser( );
- }
- else
- if ( action == UC_RENAME_ID ) {
- if ( ucSelected.count() == 1 ) {
- QAD_ObjectBrowserItem* useCaseItem = ( QAD_ObjectBrowserItem* )( ucSelected.at( 0 ) );
- aString = UCBuilder->GetName();
- if ( isRootItem( useCaseItem ) ) {
- QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aString.in() );
- if ( !name.isEmpty() ) {
- UCBuilder->SetName( name.latin1() );
- myActiveStudy->updateUseCaseBrowser( );
- }
- }
- else/* if ( UCBuilder->IsUseCase( myStudy->FindObjectID( (( QAD_ObjectBrowserItem* )( ucSelected.at(0) ))->getEntry() ) ) )*/ {
- QString name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aString.in() );
- if ( !name.isEmpty() ) {
- myActiveStudy->renameIObject( Sel->firstIObject(), name );
- }
- }
- }
- }
- else
- if ( action == UC_APPEND_ID ) {
- if ( Sel->IObjectCount() > 0 ) {
- SALOME_ListIO SelIO; SelIO = Sel->StoredIObjects();
- SALOME_ListIteratorOfListIO SelIt( SelIO );
- for( ; SelIt.More(); SelIt.Next() ) {
- SALOMEDS::SObject_var selSO = myStudy->FindObjectID( SelIt.Value()->getEntry() );
- if ( !selSO->_is_nil() && strcmp( SelIt.Value()->getEntry(), ( "0:2" ) ) != 0 ) {
- UCBuilder->Remove( selSO ); // first remove object for sure ...
- UCBuilder->Append( selSO ); // ... and now re-append it
- }
- }
- myActiveStudy->updateUseCaseBrowser( true );
- }
- }
- else
- if ( action == UC_REMOVE_ID ) {
- ucSelected.clear();
- getSelectedParents( myUseCaseView, ucSelected, true );
- for ( int i = 0; i < ucSelected.count(); i++ ) {
- QAD_ObjectBrowserItem* item = ( QAD_ObjectBrowserItem* )ucSelected.at( i );
- if ( !isRootItem( item ) ) {
- // SObject selected
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( item->getEntry() );
- if ( !SO->_is_nil() ) {
- UCBuilder->Remove( SO );
- }
- }
- else {
- }
- }
- Sel->ClearIObjects();
- myActiveStudy->updateUseCaseBrowser( true );
- }
- else
- if ( action == UC_CLEAR_ID ) {
- if ( myUseCaseView->childCount() > 0 && myUseCaseView->firstChild()->childCount() > 0) {
- QAD_ObjectBrowserItem* child = ( QAD_ObjectBrowserItem* )myUseCaseView->firstChild()->firstChild();
- while ( child ) {
- UCBuilder->Remove( myStudy->FindObjectID( child->getEntry().latin1() ) );
- child = ( QAD_ObjectBrowserItem* )( child->nextSibling() );
- }
- Sel->ClearIObjects();
- myActiveStudy->updateUseCaseBrowser();
- }
- }
-}
-/*!
- Use Case browser buttons slot
-*/
-void QAD_ObjectBrowser::onUseCaseBtn()
-{
- // Check if the study is locked
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- if ( aStudy->GetProperties()->IsLocked() )
- {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return;
- }
-
- if ( sender() == myNewBtn ) {
- SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
- UCBuilder->AddUseCase( tr( "NEW_OBJECT" ) );
- myActiveStudy->updateUseCaseBrowser();
- }
- if ( sender() == myAddBtn )
- onUseCasePopupMenu( UC_APPEND_ID );
- if ( sender() == myDelBtn )
- onUseCasePopupMenu( UC_REMOVE_ID );
- if ( sender() == myClearBtn )
- onUseCasePopupMenu( UC_CLEAR_ID );
- if ( sender() == myCurrentBtn )
- onUseCasePopupMenu( UC_SET_CURRENT_ID );
-}
-
-/*
- Show/remove UseCase Browser
-*/
-
-void QAD_ObjectBrowser::showUseCaseBrowser ( bool show )
-{
- bool shown = (this->count() > 1);
-
- if (show != shown)
- {
- if (show)
- {
- this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) );
- UpdateUseCaseBrowser();
- unHighlightAll();
- }
- else
- this->removePage(myVBox);
- }
-}
-
-/*!
- Switch between auto resizing of columns and manual mode
-*/
-void QAD_ObjectBrowser::autoSizeColumns( bool autosize )
-{
- if (autosize)
- {
- for (int i = 0; i < myListView->header()->count(); i++ )
- if (myListView->header()->isResizeEnabled(i))
- myListView->setColumnWidthMode(i, QListView::Maximum);
-
- }
- else
- {
- for (int i = 0; i < myListView->header()->count(); i++ )
- myListView->setColumnWidthMode(i, QListView::Manual);
- }
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ObjectBrowser.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_OBJECTBROWSER_H
-#define QAD_OBJECTBROWSER_H
-
-#include "QAD.h"
-#include "QAD_Popup.h"
-
-#include "SALOME_InteractiveObject.hxx"
-
-// QT Includes
-#include <qlist.h>
-#include <qvariant.h>
-#include <qwidget.h>
-#include <qtabwidget.h>
-#include <qtoolbutton.h>
-#include <qmap.h>
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-class QListViewItem;
-class QListView;
-class QAD_ObjectBrowserItem;
-typedef QList<QAD_ObjectBrowserItem> ItemList;
-typedef QMap<QString, ItemList> ItemMap;
-
-class QAD_EXPORT QAD_ObjectBrowser : public QTabWidget, public QAD_PopupClientServer
-{
- Q_OBJECT
-
-public:
- QAD_ObjectBrowser( SALOMEDS::Study_var study, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
- virtual ~QAD_ObjectBrowser();
-
- bool eventFilter( QObject* o, QEvent* e );
-
- void setupListView();
- /* popup management */
- void onCreatePopup();
-
- QListView* getListView() const;
- QListView* getUseCaseView() const;
-
- void Update();
- void UpdateUseCaseBrowser();
-
- void unHighlightAll();
- void highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight );
- bool getItems( const Handle(SALOME_InteractiveObject)& IObject,
- QList<QAD_ObjectBrowserItem>& List);
- bool getItems( SALOMEDS::SObject_ptr SO,
- QList<QAD_ObjectBrowserItem>& List);
- QAD_ObjectBrowserItem* getItem( const Handle(SALOME_InteractiveObject)& IObject );
- QAD_ObjectBrowserItem* getItem( SALOMEDS::SObject_ptr SO );
- QAD_ObjectBrowserItem* getUCItem( const Handle(SALOME_InteractiveObject)& IObject );
- QAD_ObjectBrowserItem* getUCItem( SALOMEDS::SObject_ptr SO );
- void rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName );
-
- void setShowIAPP( bool show );
- void setShowInfoColumns( bool show );
- void setShowValueColumn( bool show );
- void setEnableChronoSort( bool enable );
- void showUseCaseBrowser ( bool show );
- void autoSizeColumns ( bool autosize );
-
-protected:
- void Update( SALOMEDS::SObject_ptr SO,
- QAD_ObjectBrowserItem* theParentItem );
- void UpdateUCItem( SALOMEDS::SObject_var UCObject,
- QAD_ObjectBrowserItem* UCItem );
- QAD_ObjectBrowserItem* AddItem( QListView* theView,
- const QString& theName,
- const QString& theEntry,
- const QString& theIOR,
- int theType,
- const QString& theValue,
- QAD_ObjectBrowserItem* theAfter = 0 );
- QAD_ObjectBrowserItem* AddItem( QAD_ObjectBrowserItem* theParentItem,
- const QString& theName,
- const QString& theEntry,
- const QString& theIOR,
- int theType,
- const QString& theRef,
- const QString& theValue,
- QAD_ObjectBrowserItem* theAfter = 0 );
- QString getValueFromObject( SALOMEDS::SObject_ptr SO );
- bool hasEditableAttribute( const Handle(SALOME_InteractiveObject)& object );
- bool hasTable( const Handle(SALOME_InteractiveObject)& object );
-
-protected slots:
- void onSelectedItem();
- void onUseCaseSelectedItem();
- void onEditAttribute();
-
- void showPopupMenu(QListViewItem*);
- void showUseCasePopupMenu(QListViewItem*);
-
- void onExpandAll();
- void onExpanded (QListViewItem*);
- void onCollapsed(QListViewItem*);
- void onUseCasePopupMenu( int );
-
- void onUseCaseBtn();
-
-private:
- ItemMap myListViewMap;
- ItemMap myUseCaseMap;
- QListView* myListView;
- QWidget* myVBox;
- QListView* myUseCaseView;
- QPopupMenu* myPopupMenu;
- SALOMEDS::Study_ptr myStudy;
- QToolButton* myNewBtn;
- QToolButton* myAddBtn;
- QToolButton* myDelBtn;
- QToolButton* myCurrentBtn;
- QToolButton* myRenameBtn;
- QToolButton* myClearBtn;
-};
-
-
-class Btn : public QToolButton
-{
- Q_OBJECT
-public:
- Btn ( QWidget * parent, const char * name = 0 );
-public slots:
- void onClicked();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ObjectBrowserItem.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_ObjectBrowserItem.h"
-
-#include <qcolor.h>
-#include <qlistview.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
-#include <qpainter.h>
-using namespace std;
-
-/*!
- Constructors
-*/
-QAD_ObjectBrowserItem::QAD_ObjectBrowserItem( QListView *theParent )
- : QListViewItem(theParent)
-{
- myType = BlackItem;
- myCurrent = false;
-}
-QAD_ObjectBrowserItem::QAD_ObjectBrowserItem( QListView* theParent, QAD_ObjectBrowserItem* after )
- : QListViewItem(theParent, after)
-{
- myType = BlackItem;
- myCurrent = false;
-}
-QAD_ObjectBrowserItem::QAD_ObjectBrowserItem( QAD_ObjectBrowserItem *theParent )
- : QListViewItem(theParent)
-{
- myType = BlackItem;
- myCurrent = false;
-}
-QAD_ObjectBrowserItem::QAD_ObjectBrowserItem( QAD_ObjectBrowserItem *theParent, QAD_ObjectBrowserItem* after )
- : QListViewItem(theParent, after)
-{
- myType = BlackItem;
- myCurrent = false;
-}
-
-/*!
- Destructor
-*/
-QAD_ObjectBrowserItem::~QAD_ObjectBrowserItem()
-{
-}
-
-/*!
- Sets type
-*/
-void QAD_ObjectBrowserItem::setType( int type )
-{
- myType = type;
- repaint();
-}
-
-/*!
- Sets text color
-*/
-void QAD_ObjectBrowserItem::setTextColor( const QColor& color )
-{
- myTextColor = color;
- repaint();
-}
-
-/*!
- Sets text highlight color
-*/
-void QAD_ObjectBrowserItem::setTextHighlightColor(const QColor& color)
-{
- myTextHighlightColor = color;
-}
-
-/*!
- Gets item name
-*/
-QString QAD_ObjectBrowserItem::getName() const
-{
- return QListViewItem::text( 0 );
-}
-
-/*!
- Sets name
-*/
-void QAD_ObjectBrowserItem::setName( const QString& name )
-{
- setText( 0, name );
-}
-
-/*!
- Gets value
-*/
-QString QAD_ObjectBrowserItem::getValue() const
-{
- return QListViewItem::text( 1 );
-}
-
-/*!
- Sets value
-*/
-void QAD_ObjectBrowserItem::setValue( const QString& value )
-{
- setText( 1, value );
-}
-
-/*!
- Gets entry
-*/
-QString QAD_ObjectBrowserItem::getEntry() const
-{
- return QListViewItem::text( 2 );
-}
-
-/*!
- Sets entry
-*/
-void QAD_ObjectBrowserItem::setEntry( const QString& entry )
-{
- setText( 2, entry );
-}
-
-/*!
- Gets IOR
-*/
-QString QAD_ObjectBrowserItem::getIOR() const
-{
- return QListViewItem::text( 3 );
-}
-
-/*!
- Sets IOR
-*/
- void QAD_ObjectBrowserItem::setIOR( const QString& IOR )
-{
- setText( 3, IOR );
-}
-
-/*!
- Gets reference
-*/
-QString QAD_ObjectBrowserItem::getReference() const
-{
- return QListViewItem::text( 4 );
-}
-
-/*!
- Sets reference
-*/
-void QAD_ObjectBrowserItem::setReference( const QString& ref )
-{
- setText( 4, ref );
-}
-/*!
- Returns true if this item is current (for UseCase browser - it is bold)
-*/
-bool QAD_ObjectBrowserItem::isCurrent() const
-{
- return myCurrent;
-}
-/*!
- Sets this item to be current (for UseCase browser - it is bold)
-*/
-void QAD_ObjectBrowserItem::setCurrent( bool on )
-{
- myCurrent = on;
- repaint();
-}
-
-/*!
- Paints cell [ redefined ]
-*/
-void QAD_ObjectBrowserItem::paintCell( QPainter* thePainter,
- const QColorGroup& theColorGroup,
- int theColumn,
- int theWidth,
- int theAlignment )
-{
- QColorGroup aColorGroup(theColorGroup);
- QColor aColor = aColorGroup.text();
- QColor aColorHighlight = aColorGroup.highlight();
-
- switch (myType)
- {
- case 1 :
- {
- aColorGroup.setColor(QColorGroup::Text, Qt::blue);
- aColorGroup.setColor(QColorGroup::Highlight, Qt::blue);
- break;
- }
- case 2 :
- {
- aColorGroup.setColor(QColorGroup::Text, Qt::red);
- aColorGroup.setColor(QColorGroup::Highlight, Qt::red);
- break;
- }
- default :
- {
- aColorGroup.setColor(QColorGroup::Text, Qt::black);
- aColorGroup.setColor(QColorGroup::Highlight, Qt::black);
- break;
- }
- }
-
- if (myTextColor.isValid()) {
- aColorGroup.setColor(QColorGroup::Text, myTextColor);
- aColorGroup.setColor(QColorGroup::HighlightedText, myTextColor);
- }
- if (myTextHighlightColor.isValid())
- aColorGroup.setColor(QColorGroup::Highlight, myTextHighlightColor);
- if (myCurrent) { // UseCase's current entry
- QFont font = thePainter->font();
- font.setBold(true);
- thePainter->setFont(font);
- }
-
- QListViewItem::paintCell(thePainter,
- aColorGroup,
- theColumn,
- theWidth,
- theAlignment);
- aColorGroup.setColor(QColorGroup::Text, aColor);
- aColorGroup.setColor(QColorGroup::Highlight, aColorHighlight);
-}
-
-/*!
- Returns item's column text
- Overrided to protect access outside
-*/
-QString QAD_ObjectBrowserItem::text( int column ) const
-{
- return QListViewItem::text( column );
-}
-
-/*!
- Compares two item to sort list view data by column
-*/
-int QAD_ObjectBrowserItem::compare( QListViewItem* i, int col, bool ascending ) const
-{
- // Additional check is necessary for Entry or Reference entry (2 and 4) columns
- if ( ( col == 2 || col == 4 ) && !key( col, ascending ).isEmpty() && !i->key( col, ascending ).isEmpty() ) {
- QStringList mylist = QStringList::split( ":", key( col, ascending ), false );
- QStringList ilist = QStringList::split( ":", i->key( col, ascending ), false );
- if ( mylist.count() != ilist.count() || mylist.count() == 0 )
- return ( mylist.count() < ilist.count() ) ? -1 : 1;
- for ( int i = 0; i < mylist.count(); i++ ) {
- if ( mylist[i].toInt() < ilist[i].toInt() )
- return -1;
- else if ( mylist[i].toInt() > ilist[i].toInt() )
- return 1;
- }
- return 0;
- }
- return QListViewItem::compare( i, col, ascending );
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ObjectBrowserItem.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_OBJECTBROWSERITEM_H
-#define QAD_OBJECTBROWSERITEM_H
-
-#include <qobject.h>
-#include <qlistview.h>
-
-class QPainter;
-class QColorGroup;
-
-class QAD_ObjectBrowserItem : public QListViewItem
-{
- friend class QListView;
-
-public:
- QAD_ObjectBrowserItem( QListView* theParent );
- QAD_ObjectBrowserItem( QListView* theParent, QAD_ObjectBrowserItem* after );
- QAD_ObjectBrowserItem( QAD_ObjectBrowserItem* theParent );
- QAD_ObjectBrowserItem( QAD_ObjectBrowserItem* theParent, QAD_ObjectBrowserItem* after );
- virtual ~QAD_ObjectBrowserItem();
-
- void setType( int type );
- void setTextColor( const QColor& color );
- void setTextHighlightColor( const QColor& color );
-
- QString getName() const;
- void setName( const QString& name );
- QString getValue() const;
- void setValue( const QString& value );
- QString getEntry() const;
- void setEntry( const QString& entry );
- QString getIOR() const;
- void setIOR( const QString& IOR );
- QString getReference() const;
- void setReference( const QString& ref );
-
- bool isCurrent() const;
- void setCurrent( bool on );
-
- int compare( QListViewItem* i, int col, bool ascending ) const;
-
-protected:
- enum { BlackItem = 0, BlueItem, RedItem };
- int myType;
- QColor myTextColor;
- QColor myTextHighlightColor;
- bool myCurrent;
-
- void paintCell( QPainter*, const QColorGroup &, int, int, int );
- QString text( int column ) const;
-};
-
-#endif
-
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Operation.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Operation QAD_Operation.h
- \brief Base class for OCAF operations in QAD-based application.
-*/
-
-#include "QAD.h"
-#include "QAD_Operation.h"
-#include "QAD_Study.h"
-#include "QAD_Application.h"
-
-// QT Include
-#include <qapplication.h>
-using namespace std;
-
-/*!
- Constructor
-*/
-QAD_Operation::QAD_Operation (QAD_Study* doc) :
-myDoc ( doc )
-{
- /* this class is useless without valid doc */
- QAD_ASSERT_DEBUG_ONLY( myDoc );
-}
-
-/*!
- Destructor
-*/
-QAD_Operation::~QAD_Operation ()
-{
-}
-
-/*!
- Returns reference to the document
-*/
-QAD_Study* QAD_Operation::getDoc() const
-{
- return myDoc;
-}
-
-/*!
- Returns reference to the application
-*/
-QAD_Application* QAD_Operation::getApp() const
-{
- return myDoc->getApp();
-}
-
-/*!
- Checks compatibility with the other launched operations.
- Returns \true if appointed operation can be performed.
- By default returns \false for all operations.
-*/
-bool QAD_Operation::compatibleWith( QAD_Operation* op ) const
-{
- return false;
-}
-
-/*!
- Returns true if operation can be aborted by pressing "Escape" key
- (default behaviour).
-*/
-bool QAD_Operation::supportCancelByEscape() const
-{
- return true;
-}
-
-/*!
- Returns true if operation changes document data. In this case it won't be
- launched if document is opened as "read only". Value by default is true.
-*/
-bool QAD_Operation::changesData() const
-{
- return true;
-}
-
-/*!
- Starts this operation.
-*/
-bool QAD_Operation::start()
-{
- /* open transaction */
- if ( !myDoc->onOperationStarted( this ) )
- return false;
-
- /* started OK */
- onStartOperation();
- return true;
-}
-
-/*!
- Called after operation started. Does nothing by default.
- Override to set a desired behaviour.
-*/
-void QAD_Operation::onStartOperation()
-{
-}
-
-/*!
- Ends the operation.
-*/
-void QAD_Operation::finish()
-{
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- onFinishOperation(); /* customization */
- myDoc->onOperationFinished( this ); /* close transaction */
-
- QApplication::restoreOverrideCursor();
-}
-
-/*!
- Called after operation finished. Does nothing by default.
- Override to set a desired behaviour.
-*/
-void QAD_Operation::onFinishOperation()
-{
-}
-
-/*!
- Suspends operation process when the document is deactivated.
-*/
-void QAD_Operation::suspend()
-{
- onSuspendOperation(); /* customization */
- myDoc->onOperationSuspended( this ); /* notification */
-}
-
-/*!
- Called after operation suspended. Does nothing by default.
- Override to set a desired behaviour.
-*/
-void QAD_Operation::onSuspendOperation()
-{
-}
-
-/*!
- Resumes operation performing process when the document became active
- (if the operation wasn't aborted earlier).
-*/
-void QAD_Operation::resume()
-{
- onResumeOperation(); /* customization */
- myDoc->onOperationResumed( this ); /* notification */
-}
-
-/*!
- Called after operation resumed. Does nothing by default.
- Override to set a desired behaviour.
-*/
-void QAD_Operation::onResumeOperation()
-{
-}
-
-/*!
- Cancels operation performing process without ending.
-*/
-void QAD_Operation::abort()
-{
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- onAbortOperation(); /* customization */
- myDoc->onOperationAborted( this ); /* abort transaction */
-
- QApplication::restoreOverrideCursor();
-}
-
-/*!
- Called after operation aborted. Does nothing by default.
- Override to set a desired behaviour.
-*/
-void QAD_Operation::onAbortOperation()
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Operation.h
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_Operation_H
-#define QAD_Operation_H
-
-#include "QAD.h"
-#include <qobject.h>
-
-class QAD_Study;
-class QAD_Application;
-
-enum OperationState {
- Undef, Started, Finished, Suspended, Resumed,
- Aborted
-};
-
-class QAD_EXPORT QAD_Operation : public QObject
-{
- Q_OBJECT
-
-public:
- QAD_Operation( QAD_Study* aDoc );
- ~QAD_Operation();
-
-public:
- QAD_Study* getDoc() const;
- QAD_Application* getApp() const;
-
- bool start();
- void finish();
- void suspend();
- void resume();
- void abort();
-
- virtual bool changesData() const;
- virtual bool supportCancelByEscape() const;
- virtual bool compatibleWith( QAD_Operation* ) const;
-
-protected:
- /* customization */
- virtual void onStartOperation();
- virtual void onFinishOperation();
- virtual void onSuspendOperation();
- virtual void onResumeOperation();
- virtual void onAbortOperation();
-
-protected:
- QAD_Study* myDoc;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_OperatorMenus.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_OperatorMenus.h"
-#include "QAD_Desktop.h"
-using namespace std;
-
-/*!
- Constructor.
-*/
-QAD_OperatorMenus::QAD_OperatorMenus(QAD_Desktop* theDesktop)
-{
- myDesktop=theDesktop;
-}
-
-/*!
- Destructor.
-*/
-QAD_OperatorMenus::~QAD_OperatorMenus()
-{
-}
-
-/*!
- Builds popup menu with a 'Context', a 'Parent' and an 'Object'.
- Parent is equal to 'Objectbrowser' or 'Viewer'.
-*/
-QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(const QString & theContext,
- const QString & theParent,
- const QString & theObject)
-{
- QAD_Menus* aMenus = myDesktop->getActiveMenus();
- QAD_ListPopupMenu* aPopup;
-
- QList<QAD_ListPopupMenu> PopupList = aMenus->getPopupMenuList();
-
- for(aPopup=PopupList.first();aPopup!=NULL;aPopup=PopupList.next()){
- if ((aPopup->getContext().compare(theContext)==0) &&
- (aPopup->getParent().compare(theParent)==0) &&
- (aPopup->getObject().compare(theObject)==0)) {
- return aPopup;
- }
- }
- return NULL;
-}
-
-QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(int thePopupMenuId)
-{
- QAD_Menus* aMenus = myDesktop->getActiveMenus();
-
- if(!aMenus->getPopupMenuList().isEmpty() &&
- aMenus->getPopupMenuList().at(thePopupMenuId)!=NULL) {
- return aMenus->getPopupMenuList().at(thePopupMenuId);
- } else
- return NULL;
-}
-
-void QAD_OperatorMenus::showMenuBar(int theMenuBarId)
-
-{
- QAD_Menus* aMenus = myDesktop->getActiveMenus();
- if(!aMenus->getMenuBarList().isEmpty() &&
- aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
- aMenus->getMenuBarList().at(theMenuBarId)->show();
- }
-}
-
-void QAD_OperatorMenus::hideMenuBar(int theMenuBarId)
-
-{
- QAD_Menus* aMenus;
- aMenus=myDesktop->getActiveMenus();
- if(!aMenus->getMenuBarList().isEmpty() &&
- aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
- aMenus->getMenuBarList().at(theMenuBarId)->hide();
- }
-}
-
-void QAD_OperatorMenus::showToolBar(int theToolBarId)
-
-{
- QAD_Menus* aMenus;
-
- aMenus=myDesktop->getActiveMenus();
- if(!aMenus->getToolBarList().isEmpty() &&
- aMenus->getToolBarList().at(theToolBarId)!=NULL) {
- aMenus->getToolBarList().at(theToolBarId)->show();
- }
-}
-
-void QAD_OperatorMenus::hideToolBar(int theToolBarId)
-
-{
- QAD_Menus* aMenus;
-
- aMenus=myDesktop->getActiveMenus();
- if(!aMenus->getToolBarList().isEmpty() &&
- aMenus->getToolBarList().at(theToolBarId)!=NULL) {
- aMenus->getToolBarList().at(theToolBarId)->hide();
- }
-}
-
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_OperatorMenus.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_OPERATOR_MENUS_H
-#define QAD_OPERATOR_MENUS_H
-
-#include "QAD_ListPopupMenu.h"
-
-class QAD_Desktop;
-
-class QAD_OperatorMenus
-{
-public:
- QAD_OperatorMenus(QAD_Desktop *);
- virtual ~QAD_OperatorMenus();
-
- QAD_Desktop* myDesktop;
- QAD_ListPopupMenu* createPopupMenu(int);
- QAD_ListPopupMenu* createPopupMenu(const QString & theContext,
- const QString & theParent,
- const QString & theObject);
-
- void showMenuBar(int);
- void hideMenuBar(int);
- void showToolBar(int);
- void hideToolBar(int);
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ParserSettings.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_ParserSettings.h"
-
-#include <stdio.h>
-
-// QT Includes
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qtextstream.h>
-using namespace std;
-
-
-/*!
- Constructor.
-*/
-QAD_ParserSettings::QAD_ParserSettings()
-{
-}
-
-
-/*!
- Destructor.
-*/
-QAD_ParserSettings::~QAD_ParserSettings()
-{
-}
-
-
-/*!
- Gets the contents of a file.
-*/
-QString QAD_ParserSettings::getContents(QString fileName, bool comments,
- bool sections, bool whiteSpace,
- bool htmlComments)
-{
- QFileInfo fi(fileName);
- QFile f(fi.absFilePath());
- QString s=""; // Buffer for the whole file
-
- if(f.open(IO_ReadOnly)) { // file opened successfully
- QTextStream t(&f); // use a text stream
-
- s = t.read(); // The whole file in a string
- f.close();
-
- if(!comments) s = QAD_ParserSettings::removeComments(s);
- if(!sections) s = QAD_ParserSettings::removeSections(s);
- if(!whiteSpace) s = s.simplifyWhiteSpace();
- if(!htmlComments) s = QAD_ParserSettings::removeHtmlComments(s);
- }
- else {
- // Can't open file
- }
-
- return s;
-}
-
-
-/*!
- Gets the body of a section from a string.
-*/
-QString QAD_ParserSettings::getSection(QString s, QString sectionName)
-{
- QString result="";
-
- QChar ch; // A single byte of the file
- int bracketCounter=1; // Bracket counter (increase on '{' and decrese on '}'.
- int i; // Current index
- int l=0; // Length of current part we must have
-
- if((i=s.find(sectionName, 0, false)) >= 0 && // Jump to section [styles]
- (i=s.find('{', i)) >= 0 ) {
-
- ++i;
-
- while(i+l<(int)s.length()) {
- ch = s.at(i+l); // Single byte
-
- ++l;
-
- if(ch=='{') ++bracketCounter;
- if(ch=='}') --bracketCounter;
-
- if(bracketCounter==0) break;
- }
-
- result = s.mid(i, l-1);
- }
-
- return result;
-}
-
-
-
-/*!
- Gets the HTML comments out of a file.
-*/
-QString QAD_ParserSettings::getHtmlComment(QString s)
-{
- QString result="";
- int length; // length of the sub string
- int ind=0;
-
- if((ind =s.find("<!--", ind))>=0 &&
- (ind+=4) &&
- (length=s.find("-->", ind)-ind)!=0) {
-
- result=s.mid(ind, length-3);
- }
-
- return result;
-}
-
-
-
-/*!
- Gets the next String between two given characters. The index-parameter gets moved to the character after
- the stopper or to -1 if the starter / stopper were not found.
-*/
-QString QAD_ParserSettings::getNextStringBetween(QString s, int& startIndex,
- QChar starter, QChar stopper)
-{
- QString result="";
- int length=0; // length of the sub string
-
- if((startIndex =s.find(starter, startIndex))>=0 &&
- (length=s.find(stopper, startIndex+1)-startIndex)!=0) {
-
- result=s.mid(startIndex+1, length-1);
- startIndex+=2;
- }
-
- return result;
-}
-
-
-/*!
- Gets the next String between the given index and a given stopper character. The index-parameter gets moved to
- the character after the stopper or to -1 if the stopper was not found.
-*/
-QString QAD_ParserSettings::getNextStringUntil(QString s, int& startIndex, QChar stopper)
-{
- QString result="";
- int length; // length of the sub string
-
- if((length=s.find(stopper, startIndex)-startIndex)!=0) {
- result=s.mid(startIndex, length);
- startIndex++;
- }
-
- return result;
-}
-
-
-/*!
- Removes all comments (between '/ *' and '* /').
-*/
-QString QAD_ParserSettings::removeComments(QString s)
-{
- QString result="";
- int i1=0, i2;
-
- while((i2=s.find("/*", i1))>=0) {
- result += s.mid(i1, i2-i1);
-
- i1+=2;
- i1=s.find("*/", i1);
- i1+=2;
- }
-
- result += s.mid(i1, s.length()-i1);
-
- return result;
-}
-
-
-
-/*!
- Removes all HTML comments (between '<!--' and '-->').
-*/
-QString QAD_ParserSettings::removeHtmlComments(QString s)
-{
- QString result="";
- int i1=0, i2;
-
- while((i2=s.find("<!--", i1))>=0) {
- result += s.mid(i1, i2-i1);
-
- i1+=4;
- i1=s.find("-->", i1);
- i1+=3;
- }
-
- result += s.mid(i1, s.length()-i1);
-
- return result;
-}
-
-
-
-/*!
- Removes all sections ('[section] { }').
-*/
-QString QAD_ParserSettings::removeSections(QString s)
-{
- QString result="";
-
- QChar ch; // A single byte of the file
- int bracketCounter; // Bracket counter (increase on '{' and decrese on '}'.
- int i=0; // Current index
-
- while(i<(int)s.length()) {
- ch = s.at(i); // Single byte
-
- if(ch=='[') {
- bracketCounter=1;
- while(i<(int)s.length() && ch!=']') { ch = s.at(i); ++i; }
- ++i;
- while(i<(int)s.length() && ch!='{') { ch = s.at(i); ++i; }
- ++i;
-
- while(i<(int)s.length() && bracketCounter!=0) {
- ch = s.at(i);
- if(ch=='{') ++bracketCounter;
- if(ch=='}') --bracketCounter;
- ++i;
- }
- ++i;
- }
- else {
- result+=ch;
- }
-
- ++i;
- }
-
- return result;
-}
-
-
-/*!
- Format plain text into HTML-code with a given maximal width.
- Spaces get replaced with non breaking spaces. Tabulators get filled up
- with non breaking spaces.
-*/
-QString QAD_ParserSettings::plainTextToHtml(QString s, int autoBreak)
-{
- QString result="\n";
-
- if(!s.isEmpty()) {
- int col=1, i;
-
- for(i=0; i<(int)s.length(); ++i) {
- // Line feed:
- //
- if(s[i]=='\n') {
- result+="<BR>\n";
- col=1;
- }
-
- // Auto break:
- //
- else if(col==autoBreak && autoBreak!=0) {
- result+="<BR>\n";
- result+=s[i];
- col=1;
- }
-
- // Tab:
- //
- else if(s[i]=='\t') {
- while(col%8!=0) { result+=" "; ++col; }
- result+=" ";
- ++col;
- }
-
- // Space:
- //
- else if(s[i]==' ') {
- result+=" ";
- ++col;
- }
-
- // Normal char / special code:
- //
- else {
- if(s[i].isLetter() || s[i].isNumber()) {
- result+=s[i];
- }
- else {
- result+=charToHtml(s[i]);
- }
- ++col;
- }
- }
-
- result+="\n";
- }
-
- return result;
-}
-
-
-/*!
- Converts a special character to html code (e.g.: '»' to "»")
-*/
-QString QAD_ParserSettings::charToHtml(QChar c)
-{
- QString s;
- QString uc;
- uc.setNum(c.unicode());
- s = "&#" + uc + ";";
- return s;
-}
-
-
-// EOF
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ParserSettings.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_PARSERSETTINGS_H
-#define QAD_PARSERSETTINGS_H
-
-#include <qstring.h>
-
-class QAD_ParserSettings
-{
-public:
- QAD_ParserSettings();
- ~QAD_ParserSettings();
-
- static QString getContents(QString fileName, bool comments=true,
- bool sections=true, bool whitespace=true,
- bool htmlComments=true);
- static QString getSection(QString s, QString sectionName);
- static QString getHtmlComment(QString s);
- static QString getNextStringBetween(QString s, int& startIndex, QChar starter, QChar stopper);
- static QString getNextStringUntil(QString s, int& startIndex, QChar stopper);
- static QString removeComments(QString s);
- static QString removeHtmlComments(QString s);
- static QString removeSections(QString s);
- static QString plainTextToHtml(QString s, int autoBreak);
- static QString charToHtml(QChar c);
-
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Popup.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-#include "QAD.h"
-#include "QAD_Popup.h"
-#include "utilities.h"
-using namespace std;
-
-/*****************************************************************************
-** Class QAD_PopupClientServer
-*****************************************************************************/
-
-/*!
- Constructor
-*/
-QAD_PopupServer::QAD_PopupServer() :
-myPopup( NULL ),
-myEnablePopup( true )
-{
-}
-
-/*!
- Enables/disables creation of popup.
- Useful when user doesn't want to create popup
- provided by server by default and does not
- want to inherit from the server
-*/
-void QAD_PopupServer::enablePopup( bool enable )
-{
- myEnablePopup = enable;
-}
-
-/*!
- Called by popup client when it wants
- to activate popup
-*/
-QPopupMenu* QAD_PopupServer::createPopup()
-{
- if ( !myEnablePopup )
- return 0;
-
- if ( !myPopup )
- myPopup = new QPopupMenu;
- onCreatePopup(); /* add specific menu items */
- return myPopup;
-}
-
-/*!
- Called by popup client when popup
- is deactivated.
-*/
-void QAD_PopupServer::destroyPopup()
-{
- if ( myPopup ) myPopup->clear();
-}
-
-/*!
- Destructor
-*/
-QAD_PopupServer::~QAD_PopupServer()
-{
- delete (QPopupMenu*) myPopup;
-}
-
-/*****************************************************************************
-** Class QAD_PopupClient
-*****************************************************************************/
-
-/*!
- Constructor
-*/
-QAD_PopupClient::QAD_PopupClient() :
-myPopupServer( 0 )
-{
-}
-
-/*!
- Destructor
-*/
-QAD_PopupClient::~QAD_PopupClient()
-{
-}
-
-/*!
- Sets a popup server for this client
-*/
-void QAD_PopupClient::setPopupServer ( QAD_PopupServer* server)
-{
- myPopupServer = server;
-}
-
-/*!
- Returns the popup server for this client
-*/
-QAD_PopupServer* QAD_PopupClient::getPopupServer () const
-{
- return myPopupServer;
-}
-
-/*****************************************************************************
-** Class QAD_PopupClientServer
-*****************************************************************************/
-
-/*!
- Constructor
-*/
-QAD_PopupClientServer::QAD_PopupClientServer( bool separateItems, bool smartSeparator ) :
- myOnlyServer( false ),
- mySeparateItems( separateItems ),
- mySmartSeparator( smartSeparator )
-{
-}
-
-/*!
- Destructor
-*/
-QAD_PopupClientServer::~QAD_PopupClientServer()
-{
-}
-
-/*!
- Called by popup client when it wants
- to activate popup. The result is the
- popup returned by this object's server
- ( client role ) + the appended popup
- provided by itself ( server role ).
-*/
-QPopupMenu* QAD_PopupClientServer::createPopup()
-{
- if ( !myEnablePopup )
- return 0;
-
- QPopupMenu* popupMenu = 0;
- if ( myPopupServer )
- { /* get the popup provided by my server */
- popupMenu = myPopupServer->createPopup();
- }
-
- if ( !popupMenu )
- { /* there is no popup from my server */
- if ( !myPopup ) myPopup = new QPopupMenu;
- popupMenu = myPopup;
- myOnlyServer = true;
- }
- else
- {
- if ( myPopup ) myPopup->clear();
- myPopup = popupMenu;
- myOnlyServer = false;
- }
-
- /* Attach my popup to the popup of my server */
- if ( popupMenu->count() && mySeparateItems )
- {
- /* Separate my items only if I will really
- add some items
- */
- int sepId, numBefore, numAfter;
- sepId = mySmartSeparator ? popupMenu->insertSeparator(0) : popupMenu->insertSeparator();
- numBefore = popupMenu->count();
- int sepPosBefore = mySmartSeparator ? 0 : numBefore - 1;
-
- /* add items */
- onCreatePopup();
-
- numAfter = popupMenu->count();
- int sepPosAfter = popupMenu->indexOf(sepId);
- if ( numAfter > numBefore || ( sepPosAfter != -1 && sepPosAfter && sepPosAfter != numAfter - 1 ) ) {
- myIDs.append( sepId );
- }
- else if ( sepPosAfter != -1 )
- popupMenu->removeItem( sepId );
- }
- else
- onCreatePopup(); /* add items */
-
- return popupMenu;
-}
-
-/*!
- Deactivates the popup
-*/
-void QAD_PopupClientServer::destroyPopup()
-{
- if ( myPopup )
- {
- /* remove all my items */
- QValueList<int>::ConstIterator it;
- for( it = myIDs.begin(); it != myIDs.end(); ++it )
- myPopup->removeItem ( *it );
-
- /* clear list of IDs */
- myIDs.clear();
-
- if ( myOnlyServer )
- { /* popup must be empty now */
- QAD_ASSERT_DEBUG_ONLY ( !myPopup->count() );
- return;
- }
- myPopup = 0;
- }
-
- /* dispatch to my server */
- if ( myPopupServer )
- myPopupServer->destroyPopup();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Popup.h
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_POPUP_H
-#define QAD_POPUP_H
-
-#include "QAD.h"
-#include <qvaluelist.h>
-#include <qpopupmenu.h>
-
-/****************************************************************************
-**
-** Interface QAD_PopupServer: must be implemented by a class which is going
-** to be a popup server for clients i.e. be able to create a popup menu
-**
-*****************************************************************************/
-class QAD_EXPORT QAD_PopupServer
-{
-public:
- QAD_PopupServer();
- virtual ~QAD_PopupServer();
-
-public:
- virtual QPopupMenu* createPopup();
- virtual void destroyPopup();
- void enablePopup( bool );
-
-protected:
- virtual void onCreatePopup () = 0; /* addition of menu items goes here */
-
-protected:
- QPopupMenu* myPopup; /* resulting popup menu */
- bool myEnablePopup; /* enable/disable popup creation */
-};
-
-/****************************************************************************
-**
-** Class QAD_PopupClient: must be inherited by a class which is going
-** to be a popup client i.e. be able to show its server's popup menu
-**
-*****************************************************************************/
-class QAD_EXPORT QAD_PopupClient
-{
-public:
- QAD_PopupClient();
- virtual ~QAD_PopupClient();
-
-public:
- void setPopupServer ( QAD_PopupServer* );
- QAD_PopupServer* getPopupServer () const;
-
-protected:
- QAD_PopupServer* myPopupServer;
-};
-
-/****************************************************************************
-**
-** Class QAD_PopupClientServer: both client and server. Can be used as
-** a server only or as a client only ( if server is not set ).
-**
-*****************************************************************************/
-class QAD_EXPORT QAD_PopupClientServer : public QAD_PopupClient,
- public QAD_PopupServer
-{
-public:
- QAD_PopupClientServer( bool separateItems = true, bool smartSeparator = true );
- ~QAD_PopupClientServer();
-
-public:
- QPopupMenu* createPopup();
- void destroyPopup();
-
-protected:
- QValueList<int> myIDs; // ids of the items added by myself as a server
- bool myOnlyServer; // true if I`m fully responsible for the menu
- bool mySeparateItems; // to insert separator before my items
- bool mySmartSeparator; // if true then separator is inserted after own items,
- // not at the end of menu
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_PyEditor.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_PyEditor.h"
-#include "QAD_PyInterp.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
-#include "QAD_Tools.h"
-#include "QAD_MessageBox.h"
-
-#include <qapplication.h>
-#include <qmap.h>
-#include <qclipboard.h>
-#include <qthread.h>
-#include <qdragobject.h>
-
-// NRI : Temporary added
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-//NRI
-
-#include "utilities.h"
-using namespace std;
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-enum { IdCopy, IdPaste, IdClear, IdSelectAll };
-
-
-static QString READY_PROMPT = ">>> ";
-static QString DOTS_PROMPT = "... ";
-#define PROMPT_SIZE _currentPrompt.length()
-
-class TInitEditorThread : public QThread
-{
-public:
- TInitEditorThread(QAD_PyInterp*& theInterp,
- QMutex* theStudyMutex, QMutex* theMutex,
- QAD_PyEditor* theListener):
- myInterp(theInterp),
- myMutex(theMutex),
- myStudyMutex(theStudyMutex),
- myListener(theListener)
- {
- // san - commented as inefficient: sometimes event is processed significant period of time after this moment
- //QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::SET_WAIT_CURSOR));
- }
-
- virtual ~TInitEditorThread(){}
-
-protected:
- virtual void run(){
- ThreadLock anEditorLock(myMutex,"TInitEditorThread::anEditorLock");
- ThreadLock aStudyLock(myStudyMutex,"TInitEditorThread::aStudyLock");
- ThreadLock aPyLock = GetPyThreadLock("TInitEditorThread::aPyLock");
- if(MYDEBUG) MESSAGE("TInitEditorThread::run() - myInterp = "<<myInterp<<"; myMutex = "<<myMutex);
- myListener->myBanner = myInterp->getbanner().c_str();
- QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::INITIALIZE));
- QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::PYTHON_OK));
- QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::UNSET_CURSOR));
- }
-
-private:
- QMutex* myMutex;
- QMutex* myStudyMutex;
- QAD_PyInterp*& myInterp;
- QAD_PyEditor* myListener;
-};
-
-
-class TExecCommandThread : public QThread
-{
-public:
- TExecCommandThread(QAD_PyInterp*& theInterp,
- QMutex* theStudyMutex, QMutex* theMutex,
- QAD_PyEditor* theListener):
- myInterp(theInterp),
- myMutex(theMutex),
- myStudyMutex(theStudyMutex),
- myListener(theListener),
- myCommand("")
- {
- //QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::SET_WAIT_CURSOR));
- }
-
- virtual ~TExecCommandThread() {}
-
- void exec(const char* theCommand){
- myCommand = theCommand;
- start();
- }
-
-protected:
- virtual void run(){
- //QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::SET_WAIT_CURSOR));
- int anId = QAD_PyEditor::PYTHON_OK;
- if(myCommand != ""){
- ThreadLock anEditorLock(myMutex,"TExecCommandThread::anEditorLock");
- //ThreadLock aStudyLock(myStudyMutex,"TExecCommandThread::aStudyLock");
- ThreadLock aPyLock = GetPyThreadLock("TExecCommandThread::aPyLock");
- int ret = myInterp->run( myCommand.latin1() );
- if(MYDEBUG) MESSAGE("TExecCommand::run() - myInterp = "<<myInterp<<"; myCommand = '"<<myCommand.latin1()<<"' - "<<ret);
- if(ret < 0)
- anId = QAD_PyEditor::PYTHON_ERROR;
- else if(ret > 0)
- anId = QAD_PyEditor::PYTHON_INCOMPLETE;
- myListener->myError = myInterp->getverr().c_str();
- myListener->myOutput = myInterp->getvout().c_str();
- }else{
- myListener->myError = "";
- myListener->myOutput = "";
- }
- QThread::postEvent(myListener, new QCustomEvent(anId));
- QThread::postEvent(myListener, new QCustomEvent(QAD_PyEditor::UNSET_CURSOR));
- }
-
-private:
- QMutex* myMutex;
- QMutex* myStudyMutex;
- QAD_PyInterp*& myInterp;
- QAD_PyEditor* myListener;
- QString myCommand;
-};
-
-
-/*!
- Constructor
-*/
-QAD_PyEditor::QAD_PyEditor(QAD_PyInterp*& theInterp, QMutex* theMutex,
- QWidget *theParent, const char* theName):
- QTextEdit(theParent,theName),
- myStudyMutex(theMutex),
- myInitEditorMutex(new QMutex),
- myExecCommandMutex(new QMutex),
- myInterp(theInterp),
- myInitEditorThread(0),
- myExecCommandThread(0)
-{
- QString fntSet = QAD_CONFIG->getSetting("Viewer:ConsoleFont");
- QFont myFont = QAD_Tools::stringToFont( fntSet );
-// QFont myFont("Courier",11);
- setFont(myFont);
- setTextFormat(QTextEdit::PlainText);
-
- // san - This is necessary for troubleless initialization
- setReadOnly( true );
- viewport()->setCursor( waitCursor );
-
- myInitEditorThread = new TInitEditorThread(myInterp,myStudyMutex,myInitEditorMutex,this);
- myExecCommandThread = new TExecCommandThread(myInterp,myStudyMutex,myExecCommandMutex,this);
-
- _currentPrompt = READY_PROMPT;
- setPalette( QAD_Application::getPalette(true) );
- setWordWrap(NoWrap);
-
- connect(this,SIGNAL(returnPressed()),this,SLOT(handleReturn()) );
-}
-
-
-void QAD_PyEditor::Init()
-{
- myInitEditorThread->start();
-}
-
-
-/*!
- Destructor
-*/
-QAD_PyEditor::~QAD_PyEditor()
-{
- if(MYDEBUG) MESSAGE("QAD_PyEditor::~QAD_PyEditor()");
- {
- {
- ThreadLock aLock(myInitEditorMutex,"myInitEditorMutex");
- delete myInitEditorThread;
- }
- delete myInitEditorMutex;
- }
- {
- {
- ThreadLock aLock(myExecCommandMutex,"myExecCommandMutex");
- delete myExecCommandThread;
- }
- delete myExecCommandMutex;
- }
-}
-
-/*!
- Called to insert a string s
-*/
-void QAD_PyEditor::setText(QString s)
-{
- int para=paragraphs()-1;
- int col=paragraphLength(para);
- insertAt(s,para,col);
- int n = paragraphs()-1;
- setCursorPosition( n, paragraphLength(n));
-}
-
-/*!
- Called when an handleReturn
-*/
-void QAD_PyEditor::handleReturn()
-{
- int para=paragraphs()-2;
-
- // NRI : Temporary added
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-
- if ( aStudy->GetProperties()->IsLocked() ) {
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
-
- _currentPrompt = READY_PROMPT;
- setText(_currentPrompt);
-
- return;
- }
- // NRI
-
- _buf.append(text(para).remove(0,PROMPT_SIZE));
- _buf.truncate( _buf.length() - 1 );
- setReadOnly( true );
- viewport()->setCursor( waitCursor );
- myExecCommandThread->exec(_buf.latin1());
-}
-
-/*
- Processes drop event: paste dragged text
-*/
-void QAD_PyEditor::contentsDropEvent( QDropEvent* event )
-{
- event->acceptAction();
- QString text;
- if ( QTextDrag::decode( event, text ) ) {
- int par, col;
- int endLine = paragraphs() -1;
- col = charAt( event->pos(), &par );
-
- if ( col >= 0 && par >= 0 ) {
- if ( par != endLine || col < PROMPT_SIZE ) {
- par = endLine;
- col = paragraphLength( endLine );
- }
- setCursorPosition( par, col );
- insertAt( text, par, col );
- removeSelection();
- }
- }
-}
-
-/*
- Processes middle button release event - paste clipboard's contents
-*/
-void QAD_PyEditor::contentsMouseReleaseEvent( QMouseEvent* event )
-{
- if ( event->button() == LeftButton ) {
- QTextEdit::contentsMouseReleaseEvent(event);
- copy();
- }
- if ( event->button() == MidButton ) {
- if (QApplication::clipboard()->supportsSelection()) {
- int par, col;
- int endLine = paragraphs() -1;
- col = charAt( event->pos(), &par );
- if ( col >= 0 && par >= 0 ) {
- if ( par != endLine || col < PROMPT_SIZE )
- setCursorPosition( endLine, paragraphLength( endLine ) );
- else
- setCursorPosition( par, col );
- QApplication::clipboard()->setSelectionMode(TRUE);
- paste();
- QApplication::clipboard()->setSelectionMode(FALSE);
- }
- }
- }
- else {
- QTextEdit::contentsMouseReleaseEvent(event);
- }
-}
-
-/*
- Processes own popup menu
-*/
-void QAD_PyEditor::mousePressEvent (QMouseEvent* event)
-{
- if ( event->button() == RightButton ) {
- QPopupMenu *popup = new QPopupMenu( this );
- QMap<int, int> idMap;
-
- int para1, col1, para2, col2;
- getSelection(¶1, &col1, ¶2, &col2);
- bool allSelected = hasSelectedText() &&
- para1 == 0 && para2 == paragraphs()-1 && col1 == 0 && para2 == paragraphLength(para2);
- int id;
- id = popup->insertItem( tr( "EDIT_COPY_CMD" ) );
- idMap.insert(IdCopy, id);
- id = popup->insertItem( tr( "EDIT_PASTE_CMD" ) );
- idMap.insert(IdPaste, id);
- id = popup->insertItem( tr( "EDIT_CLEAR_CMD" ) );
- idMap.insert(IdClear, id);
- popup->insertSeparator();
- id = popup->insertItem( tr( "EDIT_SELECTALL_CMD" ) );
- idMap.insert(IdSelectAll, id);
- popup->setItemEnabled( idMap[ IdCopy ], hasSelectedText() );
- popup->setItemEnabled( idMap[ IdPaste ],
- !isReadOnly() && (bool)QApplication::clipboard()->text().length() );
- popup->setItemEnabled( idMap[ IdSelectAll ],
- (bool)text().length() && !allSelected );
-
- int r = popup->exec( event->globalPos() );
- delete popup;
-
- if ( r == idMap[ IdCopy ] ) {
- copy();
- }
- else if ( r == idMap[ IdPaste ] ) {
- paste();
- }
- else if ( r == idMap[ IdClear ] ) {
- clear();
- setText(myBanner);
- _currentPrompt = READY_PROMPT;
- setText(_currentPrompt);
- }
- else if ( r == idMap[ IdSelectAll ] ) {
- selectAll();
- }
- }
- else {
- QTextEdit::mousePressEvent(event);
- }
-}
-
-/*!
- Checks, is the string a command line or not.
-*/
-
-bool QAD_PyEditor::isCommand( const QString& str) const
-{
- // prompt may be '>>> ' or for '... '
- return ( str.find( READY_PROMPT ) == 0 || str.find( DOTS_PROMPT ) == 0 );
-}
-
-
-/*!
- Called when a keyPress event
-*/
-void QAD_PyEditor::keyPressEvent( QKeyEvent* e )
-{
- // get cursor position
- int curLine, curCol;
- getCursorPosition(&curLine, &curCol);
-
- // get last edited line
- int endLine = paragraphs() -1;
-
- // get pressed key code
- int aKey = e->key();
-
- // check if <Ctrl> is pressed
- bool ctrlPressed = e->state() & ControlButton;
- // check if <Shift> is pressed
- bool shftPressed = e->state() & ShiftButton;
- // check if <Alt> is pressed
- bool altPressed = e->state() & AltButton;
-
- // process <Ctrl>+<C> key-bindings
- if ( aKey == Key_C && ctrlPressed ) {
- _buf.truncate(0);
- setText("\n");
- _currentPrompt = READY_PROMPT;
- setText(_currentPrompt);
- return;
- }
-
- // check for printed key
- aKey = ( aKey < Key_Space || aKey > Key_ydiaeresis ) ? aKey : 0;
-
- switch ( aKey ) {
- case 0 :
- // any printed key
- {
- if ( curLine < endLine || curCol < PROMPT_SIZE )
- moveCursor( QTextEdit::MoveEnd, false );
- QTextEdit::keyPressEvent( e );
- break;
- }
- case Key_Return:
- case Key_Enter:
- // <Enter> key
- {
- moveCursor( QTextEdit::MoveEnd, false );
- QTextEdit::keyPressEvent( e );
- break;
- }
- case Key_Up:
- // <Up> arrow key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: previous command in history
- // - with <Ctrl> modifier key pressed: move cursor one row up without selection
- // - with <Shift> modifier key pressed: move cursor one row up with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: scroll one row up
- {
- if ( ctrlPressed && shftPressed ) {
- scrollBy( 0, -QFontMetrics( font() ).lineSpacing() );
- }
- else if ( shftPressed ) {
- if ( curLine > 0 )
- moveCursor( QTextEdit::MoveUp, true );
- }
- else if ( ctrlPressed ) {
- moveCursor( QTextEdit::MoveUp, false );
- }
- else {
- QString histLine = _currentPrompt;
- if ( ! _isInHistory ) {
- _isInHistory = true;
- _currentCommand = text( endLine ).remove( 0, PROMPT_SIZE );
- _currentCommand.truncate( _currentCommand.length() - 1 );
- }
- QString previousCommand = myInterp->getPrevious();
- if ( previousCommand.compare( BEGIN_HISTORY_PY ) != 0 ) {
- removeParagraph( endLine );
- histLine.append( previousCommand );
- insertParagraph( histLine, -1 );
- }
- moveCursor( QTextEdit::MoveEnd, false );
- }
- break;
- }
- case Key_Down:
- // <Down> arrow key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: next command in history
- // - with <Ctrl> modifier key pressed: move cursor one row down without selection
- // - with <Shift> modifier key pressed: move cursor one row down with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: scroll one row down
- {
- if ( ctrlPressed && shftPressed ) {
- scrollBy( 0, QFontMetrics( font() ).lineSpacing() );
- }
- else if ( shftPressed ) {
- if ( curLine < endLine )
- moveCursor( QTextEdit::MoveDown, true );
- }
- else if ( ctrlPressed ) {
- moveCursor( QTextEdit::MoveDown, false );
- }
- else {
- QString histLine = _currentPrompt;
- QString nextCommand = myInterp->getNext();
- if ( nextCommand.compare( TOP_HISTORY_PY ) != 0 ) {
- removeParagraph( endLine );
- histLine.append( nextCommand );
- insertParagraph( histLine, -1 );
- }
- else {
- if (_isInHistory) {
- _isInHistory = false;
- removeParagraph( endLine );
- histLine.append( _currentCommand );
- insertParagraph( histLine, -1 );
- }
- }
- moveCursor( QTextEdit::MoveEnd, false );
- }
- break;
- }
- case Key_Left:
- // <Left> arrow key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: move one symbol left (taking into account prompt)
- // - with <Ctrl> modifier key pressed: move one word left (taking into account prompt)
- // - with <Shift> modifier key pressed: move one symbol left with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: move one word left with selection
- {
- if ( !shftPressed && isCommand( text( curLine ) ) && curCol <= PROMPT_SIZE ) {
- setCursorPosition( curLine-1, 0 );
- moveCursor( QTextEdit::MoveLineEnd, false );
- }
- else {
- QTextEdit::keyPressEvent( e );
- }
- break;
- }
- case Key_Right:
- // <Right> arrow key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: move one symbol right (taking into account prompt)
- // - with <Ctrl> modifier key pressed: move one word right (taking into account prompt)
- // - with <Shift> modifier key pressed: move one symbol right with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: move one word right with selection
- {
- if ( !shftPressed ) {
- if ( curCol < paragraphLength( curLine ) ) {
- if ( isCommand( text( curLine ) ) && curCol < PROMPT_SIZE ) {
- setCursorPosition( curLine, PROMPT_SIZE );
- break;
- }
- }
- else {
- if ( curLine < endLine && isCommand( text( curLine+1 ) ) ) {
- setCursorPosition( curLine+1, PROMPT_SIZE );
- break;
- }
- }
- }
- QTextEdit::keyPressEvent( e );
- break;
- }
- case Key_PageUp:
- // <PageUp> key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: first command in history
- // - with <Ctrl> modifier key pressed: move cursor one page up without selection
- // - with <Shift> modifier key pressed: move cursor one page up with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: scroll one page up
- {
- if ( ctrlPressed && shftPressed ) {
- scrollBy( 0, -visibleHeight() );
- }
- else if ( shftPressed ) {
- if ( curLine > 0 )
- moveCursor( QTextEdit::MovePgUp, true );
- }
- else if ( ctrlPressed ) {
- moveCursor( QTextEdit::MovePgUp, false );
- }
- else {
- QString histLine = _currentPrompt;
- if ( ! _isInHistory ) {
- _isInHistory = true;
- _currentCommand = text( endLine ).remove( 0, PROMPT_SIZE );
- _currentCommand.truncate( _currentCommand.length() - 1 );
- }
- QString firstCommand = myInterp->getPrevious();
- QString pcmd;
- while ( ( pcmd = QString( myInterp->getPrevious() ) ).compare( BEGIN_HISTORY_PY ) != 0 )
- firstCommand = pcmd;
- if ( firstCommand.compare( BEGIN_HISTORY_PY ) != 0 ) {
- removeParagraph( endLine );
- histLine.append( firstCommand );
- insertParagraph( histLine, -1 );
- }
- moveCursor( QTextEdit::MoveEnd, false );
- }
- break;
- }
- case Key_PageDown:
- // <PageDown> key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: last command in history
- // - with <Ctrl> modifier key pressed: move cursor one page down without selection
- // - with <Shift> modifier key pressed: move cursor one page down with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: scroll one page down
- {
- if ( ctrlPressed && shftPressed ) {
- scrollBy( 0, visibleHeight() );
- }
- else if ( shftPressed ) {
- if ( curLine < endLine )
- moveCursor( QTextEdit::MovePgDown, true );
- }
- else if ( ctrlPressed ) {
- moveCursor( QTextEdit::MovePgDown, false );
- }
- else {
- if ( _isInHistory ) {
- QString histLine = _currentPrompt;
- while ( QString( myInterp->getNext() ).compare( TOP_HISTORY_PY ) != 0 );
- _isInHistory = false;
- removeParagraph( endLine );
- histLine.append( _currentCommand );
- insertParagraph( histLine, -1 );
- }
- moveCursor( QTextEdit::MoveEnd, false );
- }
- break;
- }
- case Key_Home:
- // <Home> key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: move cursor to the beginning of the current line without selection
- // - with <Ctrl> modifier key pressed: move cursor to the very first symbol without selection
- // - with <Shift> modifier key pressed: move cursor to the beginning of the current line with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very first symbol with selection
- {
- if ( ctrlPressed ) {
- moveCursor( QTextEdit::MoveHome, shftPressed );
- }
- else {
- if ( isCommand( text( curLine ) ) ) {
- int ps1, ps2, cs1, cs2;
- bool hasSelection = hasSelectedText();
- if ( hasSelection )
- getSelection( &ps1, &cs1, &ps2, &cs2 );
- removeSelection();
- horizontalScrollBar()->setValue( horizontalScrollBar()->minValue() );
- if ( curCol > PROMPT_SIZE && shftPressed )
- setSelection( curLine, PROMPT_SIZE, curLine, ( hasSelection && ps1 == ps2 && ps1 == curLine && cs2 > PROMPT_SIZE ) ? cs2 : curCol );
- setCursorPosition( curLine, PROMPT_SIZE );
- }
- else {
- moveCursor( QTextEdit::MoveLineStart, shftPressed );
- }
- }
- break;
- }
- case Key_End:
- // <End> key: process as follows:
- // - without <Ctrl>, <Shift> modifiers: move cursor to the end of the current line without selection
- // - with <Ctrl> modifier key pressed: move cursor to the very last symbol without selection
- // - with <Shift> modifier key pressed: move cursor to the end of the current line with selection
- // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very last symbol with selection
- {
- if ( ctrlPressed ) {
- moveCursor( QTextEdit::MoveEnd, shftPressed );
- }
- else {
- moveCursor( QTextEdit::MoveLineEnd, shftPressed );
- }
- break;
- }
- case Key_Backspace :
- // <Backspace> key: process as follows
- // - without any modifiers : delete symbol before the cursor / selection (taking into account prompt)
- // - with <Ctrl> modifier key pressed: delete previous word
- // works only for last (command) line
- {
- if ( curLine == endLine && ( curCol > PROMPT_SIZE || curCol >= PROMPT_SIZE && hasSelectedText() ) ) {
- if ( ctrlPressed && !hasSelectedText() ) {
- QString txt = text( curLine );
- int ind = curCol-1;
- while ( ind > 0 && txt[ ind ] == ' ' ) ind--;
- ind = txt.findRev( ' ', ind ) + 1;
- if ( ind > PROMPT_SIZE-1 ) {
- setSelection( curLine, ind, curLine, curCol );
- removeSelectedText();
- }
- else {
- QTextEdit::keyPressEvent( e );
- }
- }
- else {
- QTextEdit::keyPressEvent( e );
- }
- }
- break;
- }
- case Key_Delete :
- // <Delete> key: process as follows
- // - without any modifiers : delete symbol after the cursor / selection (taking into account prompt)
- // - with <Ctrl> modifier key pressed: delete next word
- // works only for last (command) line
- {
- if ( curLine == endLine && curCol > PROMPT_SIZE-1 ) {
- if ( ctrlPressed && !hasSelectedText() ) {
- QString txt = text( curLine );
- int ind = curCol;
- while ( ind < txt.length()-1 && txt[ ind ] == ' ' ) ind++;
- ind = txt.find( ' ', ind );
- while ( ind < txt.length()-1 && txt[ ind ] == ' ' ) ind++;
- if ( ind > PROMPT_SIZE-1 ) {
- setSelection( curLine, curCol, curLine, ind );
- removeSelectedText();
- }
- else {
- QTextEdit::keyPressEvent( e );
- }
- }
- else {
- QTextEdit::keyPressEvent( e );
- }
- }
- break;
- }
- case Key_Insert :
- // <Insert> key: process as follows
- // - with <Ctrl> modifier key pressed: copy()
- // - with <Shift> modifier key pressed: paste() to the command line
- {
- if ( ctrlPressed ) {
- copy();
- }
- else if ( shftPressed ) {
- if ( curLine != endLine || curCol < PROMPT_SIZE )
- moveCursor( QTextEdit::MoveEnd, false );
- paste();
- }
- else
- QTextEdit::keyPressEvent( e );
- break;
- }
- }
- // NRI : DEBUG PAS TERRIBLE //
- if (( e->key() == Key_F3) ||
- ( e->key() == Key_F4) ||
- ( e->key() == Key_Return) ||
- ( e->key() == Key_Escape))
- QAD_Application::getDesktop()->onKeyPress( e );
- // NRI //
-}
-
-void QAD_PyEditor::customEvent(QCustomEvent* e)
-{
- switch( e->type() ) {
- case PYTHON_OK:
- case PYTHON_ERROR:
- {
- _buf.truncate(0);
- setText(myOutput);
- setText(myError);
- _currentPrompt = READY_PROMPT;
- setText(_currentPrompt);
- break;
- }
- case PYTHON_INCOMPLETE:
- {
- _buf.append("\n");
- _currentPrompt = DOTS_PROMPT;
- setText(_currentPrompt);
- break;
- }
- case INITIALIZE:
- {
- setText(myInterp->getbanner().c_str());
- _buf.truncate(0);
- QApplication::restoreOverrideCursor();
- break;
- }
- case SET_WAIT_CURSOR:
- {
- viewport()->setCursor( waitCursor );
- break;
- }
- case UNSET_CURSOR:
- {
- viewport()->unsetCursor();
- break;
- }
- default:
- QTextEdit::customEvent( e );
- }
-
- setReadOnly( false );
- _isInHistory = false;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_PyEditor.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_PyEditor_H
-#define QAD_PyEditor_H
-
-#include <qtextedit.h>
-#include <qevent.h>
-
-class QMutex;
-
-class QAD_PyInterp;
-class TInitEditorThread;
-class TExecCommandThread;
-
-class QAD_PyEditor : public QTextEdit
-{
- Q_OBJECT;
-
- friend class TInitEditorThread;
- friend class TExecCommandThread;
-
-public:
- enum { PYTHON_OK = QEvent::User + 5000, PYTHON_ERROR, PYTHON_INCOMPLETE,
- INITIALIZE, SET_WAIT_CURSOR, UNSET_CURSOR };
-
-public:
- QAD_PyEditor(QAD_PyInterp*& theInterp, QMutex* theMutex,
- QWidget *theParent = 0, const char* theName = "");
- virtual void Init();
- ~QAD_PyEditor();
-
- virtual void setText(QString s);
- bool isCommand(const QString& str) const;
-
-protected:
- virtual void contentsDropEvent( QDropEvent* event );
- virtual void contentsMouseReleaseEvent( QMouseEvent* event );
- virtual void keyPressEvent (QKeyEvent* event);
- virtual void mousePressEvent (QMouseEvent* event);
- virtual void customEvent (QCustomEvent* event);
-
-public slots:
- void handleReturn();
-
-private:
- QString _buf;
- QString _currentCommand;
- QString _currentPrompt;
- bool _isInHistory;
-
- QAD_PyInterp*& myInterp;
- QMutex* myStudyMutex;
- QMutex* myInitEditorMutex;
- QMutex* myExecCommandMutex;
- TInitEditorThread* myInitEditorThread;
- TExecCommandThread* myExecCommandThread;
-
- QString myBanner;
- QString myOutput;
- QString myError;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_PyInterp.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_PyInterp.h"
-#include "utilities.h"
-
-using namespace std;
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-/*!
- * constructor : multi Python interpreter, one per SALOME study.
- * calls initialize method defined in base class, which calls virtual methods
- * initstate & initcontext redefined here.
- */
-QAD_PyInterp::QAD_PyInterp(): PyInterp_base()
-{
-}
-
-QAD_PyInterp::~QAD_PyInterp()
-{
-}
-
-/*!
- * EDF-CCAR
- * When SALOME uses multi Python interpreter feature,
- * Every study has its own interpreter and thread state (_tstate = Py_NewInterpreter())
- * This is fine because every study has its own modules (sys.modules) stdout and stderr
- * BUT some Python modules must be imported only once. In multi interpreter context Python
- * modules (*.py) are imported several times.
- * The pyqt module must be imported only once because it registers classes in a C module.
- * It's quite the same with omniorb modules (internals and generated with omniidl)
- * This problem is handled with "shared modules" defined in salome_shared_modules.py
- * These "shared modules" are imported only once and only copied in all the other interpreters
- * BUT it's not the only problem. Every interpreter has its own __builtin__ module. That's fine
- * but if we have copied some modules and imported others problems may arise with operations that
- * are not allowed in restricted execution environment. So we must impose that all interpreters
- * have identical __builtin__ module.
- * That's all, for the moment ...
- */
-
-void QAD_PyInterp::initState()
-{
- _tstate = Py_NewInterpreter(); // create an interpreter and save current state
- PySys_SetArgv(PyInterp_base::_argc,PyInterp_base::_argv); // initialize sys.argv
- if(MYDEBUG) MESSAGE("QAD_PyInterp::initState - this = "<<this<<"; _tstate = "<<_tstate);
-
- /*
- * If builtinmodule has been initialized all the sub interpreters
- * will have the same __builtin__ module
- */
- if(builtinmodule){
- PyObject *m = PyImport_GetModuleDict();
- PyDict_SetItemString(m, "__builtin__", builtinmodule);
- SCRUTE(builtinmodule->ob_refcnt); // builtinmodule reference counter
- _tstate->interp->builtins = PyModule_GetDict(builtinmodule);
- Py_INCREF(_tstate->interp->builtins);
- }
-}
-
-
-void QAD_PyInterp::initContext()
-{
- PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context)
- if(!m){
- if(MYDEBUG) MESSAGE("problem...");
- PyErr_Print();
- ASSERT(0);
- return;
- }
- _g = PyModule_GetDict(m); // get interpreter dictionnary context
- if(MYDEBUG) MESSAGE("QAD_PyInterp::initContext - this = "<<this<<"; _g = "<<_g);
-
- if(builtinmodule){
- PyDict_SetItemString(_g, "__builtins__", builtinmodule); // assign singleton __builtin__ module
- }
-
- // Debut modif CCAR
- // Import special module to change the import mechanism
- PyObjWrapper m1(PyImport_ImportModule("import_hook"));
- if(!m1){
- MESSAGE("initContext: problem with import_hook import");
- PyErr_Print();
- PyErr_Clear();
- ASSERT(0);
- }else{
- // Call init_shared_modules to initialize the shared import mechanism for modules
- //that must not be imported twice
- PyObjWrapper m2(PyObject_CallMethod(m1,"init_shared_modules","O",salome_shared_modules_module));
- if(!m2){
- MESSAGE("initContext: problem with init_shared_modules call");
- PyErr_Print();
- PyErr_Clear();
- ASSERT(0);
- }
- }
- // Fin modif CCAR
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_PyInterp.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef _QAD_PYINTERP_H_
-#define _QAD_PYINTERP_H_
-
-#include "PyInterp_base.h"
-
-class QAD_PyInterp : public PyInterp_base
-{
- public:
- QAD_PyInterp();
- ~QAD_PyInterp();
-
- protected:
- void initState();
- void initContext();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_PyInterp_mono.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-
-
-
-#include "QAD_PyInterp_mono.h"
-#include "utilities.h"
-
-using namespace std;
-
-/*!
- * constructor : only one Python interpreter, shared within SALOME studies.
- * calls initialize method defined in base class, which calls virtual methods
- * initstate & initcontext redefined here.
- */
-QAD_PyInterp_mono::QAD_PyInterp_mono(): PyInterp_base()
-{
-}
-
-QAD_PyInterp_mono::~QAD_PyInterp_mono()
-{
-}
-
-/*!
- * EDF-CCAR
- * When SALOME uses mono Python interpreter feature,
- * every study has its own context (dictionnary) but shares builtins
- * and all the modules (sys, ...) with other studies.
- * A module imported in a study is seen in another study (pros ans cons !).
- */
-
-void QAD_PyInterp_mono::initState()
-{
- _tstate = PyThreadState_Get();
- PySys_SetArgv(PyInterp_base::_argc,PyInterp_base::_argv); // initialize sys.argv
-}
-
-void QAD_PyInterp_mono::initContext()
-{
- _g = PyDict_New(); // create interpreter dictionnary context
- PyObject *bimod = PyImport_ImportModule("__builtin__");
- PyDict_SetItemString(_g, "__builtins__", bimod);
- Py_DECREF(bimod);
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_PyInterp_mono.h
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _QAD_PYINTERP_MONO_H_
-#define _QAD_PYINTERP_MONO_H_
-
-#include "PyInterp_base.h"
-
-class QAD_PyInterp_mono: public PyInterp_base
-{
- public:
- QAD_PyInterp_mono();
- ~QAD_PyInterp_mono();
-
- protected:
- void initState();
- void initContext();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Resource.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_RESOURCE_H
-#define QAD_RESOURCE_H
-
-// Here go definition of common popup menu item IDs.
-// These values should be used by all component GUI modules when customizing popup menus
-
-// Special popup item used to display a name of the selected object
-#define QAD_TopLabel_Popup_ID 99000
-
-#define QAD_Display_Popup_ID 99001
-
-#define QAD_DisplayOnly_Popup_ID 99002
-
-#define QAD_Erase_Popup_ID 99003
-
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ResourceMgr.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_ResourceMgr QAD_ResourceMgr.h
- \brief ResourceMgr QAD-based application.
-*/
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_MessageBox.h"
-#include "QAD_ResourceMgr.h"
-
-#include "utilities.h"
-
-#include <qfile.h>
-#include <stdlib.h>
-#include <qtranslator.h>
-#include <qapplication.h>
-#include <qfileinfo.h>
-
-#include <Standard.hxx>
-using namespace std;
-
-/* configuration file */
-static const char* CONFIG_FILE = "config";
-
-/* config keys */
-static const char* RES_DIR = "res";
-static const char* RES_DOCS = "docs";
-static const char* RES_PIXMAPS = "icons";
-static const char* RES_STRINGS = "strings";
-static const char* RES_LANGUAGE = "language";
-static const char* RES_FILES = "resources";
-
-static const char* SEPARATOR = ":";
-
-/*!
- Constructor
-*/
-QAD_ResourceMgr::QAD_ResourceMgr() :
-myRes( 5, false )
-{
- myRes.setAutoDelete( true );
-}
-
-/*!
- Destructor
-*/
-QAD_ResourceMgr::~QAD_ResourceMgr()
-{
- myRes.clear();
-}
-
-/*!
- Removes icons and messages from 'prefix'_msg_'lang'
- and 'prefix'_icons' files. Returns 'true' if OK.
- Each application which has its own resources must
- have a unique 'prefix' ( prefix "QAD" is reserved )
-*/
-bool QAD_ResourceMgr::removeResources( const char* prefix )
-{
- return myRes.remove(prefix);
-}
-
-/*!
- Loads icons and messages from 'prefix'_msg_'lang'
- and 'prefix'_icons' files. Returns 'true' if OK.
- Each application which has its own resources must
- have a unique 'prefix' ( prefix "QAD" is reserved )
-*/
-bool QAD_ResourceMgr::loadResources( const char* prefix, QString &msg )
-{
- bool allLoaded = true;
- if ( !myRes[ prefix ] ) {
- QCString dir ;
-
- /* We read the settings once and keep them.
- The resources are loaded consequently from the end of directory list
- which ( see collectDirs() method description ). This allows to override
- resources when it is necessary.
- */
-
- ResourceSettings* settings = new ResourceSettings();
- StringDict& conf = settings->config();
- myRes.insert( prefix, settings );
-
- // settings->config().insert( RES_DIR, new QString( resDir ) );
-
- /* we search language definition : we read it in config file
- If not found, we use default : English
- */
- conf.insert( RES_LANGUAGE, new QString( "en" ) );
-
- /* Read configuration file */
-
- /* WE MUST HAVE ONE CONFIGURATION FILE FOR ALL SALOME !!!
- I DON'T KNOW WHERE READ IT AND SAVE ITS CONTENTS FOR ALL GUI
- ALL GUI HAS SAME LANGUAGE AND HAVE DEFAULT (en) IF SPECIFIED
- IS NOT FOUND !!
- */
- QString resDirs = collectDirs( prefix );
- conf.insert( RES_DIR, new QString( resDirs ) );
- QString fileConfig = QString( prefix ) + QString( "." ) + QString( CONFIG_FILE );
- fileConfig = path( fileConfig, prefix, 0 ) ;
- //MESSAGE("QAD_ResourceMgr::loadresources : config : "<<fileConfig);
- if ( fileConfig.isEmpty() )
- fileConfig = path( CONFIG_FILE, prefix, 0 ) ;
- if ( !fileConfig.isEmpty() ) {
- QFile configFile( fileConfig );
- if ( !configFile.exists() || !configFile.open( IO_ReadOnly ) ) {
- QString warnMsg;
- warnMsg.sprintf( "Cannot open configuration file: %s\nDefault settings will be used.",
- configFile.name().latin1() );
- msg = warnMsg;
-// removeResources( prefix );
-// return false;
- }
- else {
- /* read 'config' file */
- const int MAX_LINE = 512;
- while ( !configFile.atEnd() ) {
- QString line;
- if ( configFile.readLine( line, MAX_LINE ) > 0 ) {
- int index;
- if ( ( index = line.find( "=" ) ) > 0 ) {
- QString key = line.left(index).stripWhiteSpace();
- QString value = line.mid( index+1 ).stripWhiteSpace();
- conf.replace( key, new QString( value ) );
- }
- }
- }
- configFile.close();
- }
- }
-
- /* Load the resources */
- QString stFile( prefix );
- stFile = stFile + "_msg_" + *( conf[ RES_LANGUAGE ] ) + ".qm" ;
- QString imagesFile( prefix );
- imagesFile = imagesFile + "_" + RES_PIXMAPS + ".qm";
- if ( conf[ RES_STRINGS ] && !conf[ RES_STRINGS ]->isEmpty() )
- stFile = QAD_Tools::addSlash( *conf[ RES_STRINGS ] ) + stFile;
- if ( conf[ RES_PIXMAPS ] && !conf[ RES_PIXMAPS ]->isEmpty() )
- imagesFile = QAD_Tools::addSlash( *conf[ RES_PIXMAPS ] ) + imagesFile;
-
- bool bLoadString = false;
- bool bLoadImages = false;
-
- QStringList resFiles = conf[ RES_FILES ] ? QStringList::split( SEPARATOR, *( conf[ RES_FILES ] ), false ) : QStringList();
-
- // first load main module's resources
- QString fileString = path( stFile, prefix, 0 );
- QString fileImage = path( imagesFile, prefix, 0 );
-
- if ( !fileString.isEmpty() && settings->load( fileString ) ) {
- bLoadString = true;
- }
- if ( !fileImage.isEmpty() && settings->load( fileImage ) ) {
- bLoadImages = true;
- }
-
- // then load additional module's resources if any are given
- for ( int j = 0; j < resFiles.count(); j++ ) {
- QString stFileAdd = resFiles[j] + "_msg_" + *( conf[ RES_LANGUAGE ] ) + ".qm" ;
- QString imagesFileAdd = resFiles[j] + "_" + RES_PIXMAPS + ".qm";
- if ( conf[ RES_STRINGS ] && !conf[ RES_STRINGS ]->isEmpty() )
- stFileAdd = QAD_Tools::addSlash( *conf[ RES_STRINGS ] ) + stFileAdd;
- if ( conf[ RES_PIXMAPS ] && !conf[ RES_PIXMAPS ]->isEmpty() )
- imagesFileAdd = QAD_Tools::addSlash( *conf[ RES_PIXMAPS ] ) + imagesFileAdd;
-
- QString fileStringAdd = path( stFileAdd, prefix, 0 );
- QString fileImageAdd = path( imagesFileAdd, prefix, 0 );
-
- if ( !fileStringAdd.isEmpty() )
- settings->load( fileStringAdd );
- if ( !fileImageAdd.isEmpty() )
- settings->load( fileImageAdd );
- }
-
- if ( !bLoadString ) {
- QString warnMsg;
- warnMsg.sprintf( "String resources for module %s not found.\n"
- "Please, check your settings.",
- prefix );
- msg = warnMsg;
-// removeResources( prefix );
- return false;
- }
- if ( !bLoadImages ) {
- QString warnMsg;
- warnMsg.sprintf( "Icons resources for module %s not found.\n"
- "Please, check your settings.",
- prefix );
- msg = warnMsg;
-// removeResources( prefix );
- return false;
- }
- allLoaded = bLoadString && bLoadImages;
- }
- return allLoaded;
-}
-
-/*!
- Returns language setting for the module 'prefix' ( e.g. "en" )
-*/
-QString QAD_ResourceMgr::language( const char* prefix ) const
-{
- QString ret;
- ResourceSettings* rs = myRes[ prefix ];
- if ( rs )
- {
- StringDict& conf = rs->config();
- ret = *(conf[RES_LANGUAGE]);
- }
- return ret;
-}
-
-/*!
- Returns list of directories where resources can be located
- See collectDirs() method description for more detail
-*/
-QString QAD_ResourceMgr::resources( const char* prefix ) const
-{
- QString ret;
- ResourceSettings* rs = myRes[ prefix ];
- if ( rs )
- {
- StringDict& conf = rs->config();
- ret = *(conf[RES_DIR]);
- }
- return ret;
-}
-
-/*!
- Collects list of directories, separated by ';' where resources for module 'prefix'
- can be situated
- The order is following :
- - <prefix>_ROOT_DIR/share/salome/resources directory
- - SALOME_<prefix>Resources env.var directory ( or directory list )
- - ${HOME}/.salome/resources directory
- - ${SALOME_SITE_DIR}/share/${SALOME_SITE_NAME}/resources directory (for SALOME-based applications)
- - ${KERNEL_ROOT_DIR}/share/salome/resources directory
-*/
-QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
-{
- QString dirList;
- QCString envVar;
- QString dir;
- char* cenv;
-
- if ( !prefix.isEmpty() ) {
- envVar = prefix.latin1() + QCString( "_ROOT_DIR" );
- cenv = getenv( ( const char* ) envVar );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "share" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- }
-
- // Try SALOME_<prefix>Resources env.var directory ( or directory list )
- if ( !prefix.isEmpty() ) {
- envVar = QCString( "SALOME_" ) + prefix.latin1() + QCString( "Resources" );
- cenv = getenv( ( const char* ) envVar );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() )
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- // Try ${HOME}/.salome/resources directory
- cenv = getenv( "HOME" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + ".salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- // Try ${SALOME_SITE_DIR}/share/${SALOME_SITE_NAME}/resources directory
- cenv = getenv( "SALOME_SITE_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "share" ;
- dir = QAD_Tools::addSlash(dir) ;
- cenv = getenv( "SALOME_SITE_NAME" );
- if ( cenv )
- dir = dir + cenv ;
- else
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
- cenv = getenv( "KERNEL_ROOT_DIR" );
- if ( cenv ) {
- dir.sprintf( "%s", cenv );
- if ( !dir.isEmpty() ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "share" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "resources" ;
- dir = QAD_Tools::addSlash(dir) ;
- dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
- }
- }
- //MESSAGE("QAD_ResourceMgr::collectDirs : "<<dirList.latin1()) ;
- return dirList;
-}
-
-/*!
- Returns a directory where 'filename' is located (filename is relative
- of the application identified by 'prefix' or empty string if file not found
- Search is processed in different location : see collectDirs() method description
-*/
-QString QAD_ResourceMgr::getFile( const QString& filename, const char* prefix ) const
-{
- QFileInfo fi( path( filename, prefix, 0 ) );
- if ( fi.isFile() && fi.exists() )
- return fi.dirPath();
- return QString();
-}
-
-/*!
- Returns a directory where 'filename' is located (filename is relative
- of the application identified by 'prefix' or empty string if file not found
- Search is processed in different location : see collectDirs() method description
- The difference from above method that this function is used when resources
- is not yet actually loaded by application.
-*/
-QString QAD_ResourceMgr::findFile( const QString& filename, const char* prefix ) const
-{
- QString resDirs = collectDirs( prefix );
- QStringList dirList = QStringList::split( SEPARATOR, resDirs, false ); // skip empty entries
- for ( int i = 0; i < dirList.count(); i++ ) {
- QString dir = dirList[ i ];
- QFileInfo fi( QAD_Tools::addSlash( dir ) + filename );
- if ( fi.isFile() && fi.exists() )
- return fi.dirPath();
- }
- return QString();
-}
-
-/*!
- Returns a path to file 'filename' (filename is relative
- of the application identified by 'prefix' and subdirectory identified by 'key'
- or empty string if file not found.
- Search is processed in different location : see collectDirs() method description
-
- Returns a directory 'key' resource of the application
- identified by 'prefix'
-*/
-QString QAD_ResourceMgr::path( const QString& filename, const char* prefix, const char* key ) const
-{
- ResourceSettings* rs = myRes[ prefix ];
- if ( rs ) {
- StringDict& conf = rs->config();
- QString resDirs = QString( *( conf[ RES_DIR ] ) );
- if ( !resDirs.isEmpty() ) {
- //MESSAGE("QAD_ResourceMgr::resDirs : <"<<resDirs<<">") ;
- QStringList dirList = QStringList::split( SEPARATOR, resDirs, false ); // skip empty entries
- for ( int i = 0; i < dirList.count(); i++ ) {
- QString dir = dirList[ i ];
- dir = QAD_Tools::addSlash( dir );
- if ( key && conf[ key ] ) {
- dir = dir + QString( *( conf[ key ] ) );
- dir = QAD_Tools::addSlash( dir );
- }
- dir = dir + filename;
- QFileInfo fileInfo( dir );
- if ( fileInfo.isFile() && fileInfo.exists() ) {
- return fileInfo.filePath();
- }
- }
- }
- }
- //MESSAGE("QAD_ResourceMgr::path : <"<<filename.latin1()<<"> : "<<filePath.latin1()) ;
- return QString::null;
-}
-
-/*!
- Loads a pixmap from 'resname' resources
- and indetified by 'id'
-*/
-QPixmap QAD_ResourceMgr::loadPixmap( const char* resname,
- const QString& id ) const
-{
- return QPixmap( path( id, resname, RES_PIXMAPS ) );
-}
-
-/*!
- Loads a doc page from 'resname' resources
- and indetified by 'id'
-*/
-bool QAD_ResourceMgr::loadDoc( const char* resname,
- const QString& id ) const
-{
- QString docPath = path( id, resname, RES_DOCS );
- return true;
-}
-
-/************************************************************************
-**
-** Class QAD_ResourceMgr::ResourceSettings ( internal )
-**
-*************************************************************************/
-
-/*!
- Loads a resource 'file'.
- Returns 'false' if 'file' can't be loaded( not found etc. ),
- 'true' if loaded or reloaded OK.
-*/
-bool QAD_ResourceMgr::ResourceSettings::load( const QString& file )
-{
-#if QT_VERSION >= 0x030000 // VSR: workaround - crash on qt3.0.5 ==========
- static const int magic_length = 16; // length of *.qm file header (qtranslator.cpp)
- static const uchar magic[magic_length] = { // magic number for the file
- 0x3c, 0xb8, 0x64, 0x18, 0xca, 0xef, 0x9c, 0x95,
- 0xcd, 0x21, 0x1c, 0xbf, 0x60, 0xa1, 0xbd, 0xdd };
- QFile f(file);
- if ( !f.exists() || f.size() < magic_length)
- return false;
- char buf[magic_length];
- if ( !f.open(IO_ReadOnly) )
- return false;
- bool bOk = ( f.readBlock(buf, magic_length) == magic_length );
- f.close();
- if (!bOk)
- return false;
- if ( memcmp( (const void *)buf, magic, magic_length ) )
- return false;
- if ( f.size() == magic_length)
- return true;
-#endif // VSR =============================================================
- QTranslator* strTbl = new QTranslator( 0 );
- try {
- if ( !strTbl->load( file, "" ) ) {
- delete strTbl;
- return false;
- }
- }
- catch (...) {
- return false;
- }
- QAD_ASSERT_DEBUG_ONLY( qApp );
- qApp->installTranslator( strTbl );
- return true;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ResourceMgr.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_RESOURCEMGR_H
-#define QAD_RESOURCEMGR_H
-
-#include <qdict.h>
-#include <qpixmap.h>
-#include <qcstring.h>
-#include <qasciidict.h>
-#include <qtranslator.h>
-
-#include "QAD.h"
-class QAD_EXPORT QAD_ResourceMgr : public QObject
-{
- Q_OBJECT
-
- typedef QDict<QString> StringDict;
- class ResourceSettings
- {
- StringDict myConfig;
- public:
- ResourceSettings() : myConfig( 10, false )
- { myConfig.setAutoDelete( true ); }
- ~ResourceSettings()
- { myConfig.clear(); }
-
- StringDict& config() { return myConfig; }
- bool load( const QString& filename );
- };
-
-public:
- QAD_ResourceMgr();
- ~QAD_ResourceMgr();
-
-public:
- bool loadResources( const char* resname, QString& msg );
- QPixmap loadPixmap( const char* resname,
- const QString& id ) const;
- bool loadDoc( const char* resname,
- const QString& id ) const;
- QString language( const char* prefix ) const;
- QString resources( const char* prefix ) const;
-
- QString findFile(const QString& filename, const char* prefix ) const;
- QString getFile( const QString& filename, const char* prefix ) const;
-
- bool removeResources( const char* resname );
-
-private:
- QString path( const QString& filename,
- const char* resname,
- const char* key ) const;
- QString collectDirs( const QString& prefix ) const;
-
-private:
- QAsciiDict<ResourceSettings> myRes; /* prefix <-> resources */
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_RightFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_RightFrame.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_StudyFrame.h"
-#include "QAD_Tools.h"
-#include "QAD_PyEditor.h"
-#include "QAD_PyInterp.h"
-
-#include <qvaluelist.h>
-
-// QT Include
-#include <qmessagebox.h>
-
-// Open CASCADE Include
-#include <OSD_SharedLibrary.hxx>
-
-using namespace std;
-
-/*!
- \class QAD_RightFrame QAD_RightFrame.h
- \brief Frame window which contains QAD_ViewFrame, QAD_PyInterp and QAD_Message.
-*/
-
-typedef QAD_ViewFrame* View(QAD_RightFrame*);
-
-
-/*!
- Constructor
-*/
-QAD_RightFrame::QAD_RightFrame(QWidget *theParent,
- const char *theTitle, ViewType theTypeView,
- QAD_PyInterp*& theInterp, QMutex* theMutex):
- QAD_Splitter( Qt::Vertical, theParent, theTitle ),
- myViewType(theTypeView),
- myInterp(theInterp)
-{
- this->setCompressEnabled( true );
-
- QAD_Desktop* Desktop = QAD_Application::getDesktop();
- int DesktopHeight = Desktop->getMainFrame()->width();
- int DesktopWidth = Desktop->getMainFrame()->height();
-
- OSD_SharedLibrary SharedLib = OSD_SharedLibrary();
- QString ComponentLib;
- QCString dir;
- QFileInfo fileInfo ;
- bool found = false;
- if (myViewType == VIEW_OCC) {
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libOCCViewer.dll" ;
-#else
- dir = dir + "libOCCViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
- } else if (myViewType == VIEW_VTK) {
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libVTKViewer.dll" ;
-#else
- dir = dir + "libVTKViewer.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir );
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName();
- found = true;
- MESSAGE (" Found ");
- } else
- MESSAGE (" Not found ");
- }
- } else if (myViewType == VIEW_GRAPHSUPERV) {
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libSUPERVGraph.dll" ;
-#else
- dir = dir + "libSUPERVGraph.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
- } else if (myViewType == VIEW_PLOT2D) {
- if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "lib" ;
- dir = QAD_Tools::addSlash(dir) ;
- dir = dir + "salome" ;
- dir = QAD_Tools::addSlash(dir) ;
-#ifdef WNT
- dir = dir + "libPlot2d.dll" ;
-#else
- dir = dir + "libPlot2d.so" ;
-#endif
- MESSAGE ( " GUI library = " << dir )
- fileInfo.setFile(dir) ;
- if (fileInfo.exists()) {
- ComponentLib = fileInfo.fileName() ;
- found = true;
- MESSAGE (" Found ")
- } else
- MESSAGE (" Not found ")
- }
- } else {
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr("undefined view type") );
- return;
- }
-
- const Standard_CString aCopyCL = CORBA::string_dup(ComponentLib);
- SharedLib.SetName( aCopyCL);
- delete(aCopyCL);
-
-
- bool ok = SharedLib.DlOpen(OSD_RTLD_LAZY);
- if (!ok) {
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr( SharedLib.DlError() ) );
- return;
- } else {
- OSD_Function osdF = SharedLib.DlSymb("createView");
- if ( osdF != NULL ) {
- View (*f1) = (QAD_ViewFrame* (*) (QAD_RightFrame*)) osdF;
- myViewFrame = (*f1)(this);
- } else {
- QMessageBox::critical( this,
- tr("ERR_ERROR"),
- tr("createView undefined") );
- return;
- }
- }
-
- QValueList<int> sizes;
-
- myViewFrame->setMinimumSize( 1, 1 );
- mySplitter = new QAD_Splitter( Qt::Horizontal, this );
- mySplitter->setMinimumSize( 1, 1 );
- mySplitter->setCompressEnabled( true );
-
- myPyEditor = new QAD_PyEditor(myInterp, theMutex, mySplitter ,"Python Interpreter");
- myPyEditor->setMinimumSize( 1, 1 );
- myPyEditor->Init();
-
- myMessage = new QAD_Message( mySplitter ,"Message");
- myMessage->setMinimumSize( 1, 1 );
-
- sizes.append( (int)(0.48 * DesktopHeight) );
- sizes.append( (int)(0.16 * DesktopHeight) );
- setSizes( sizes );
- sizes.clear();
- sizes.append( (int)(0.25 * DesktopWidth) );
- sizes.append( (int)(0.25 * DesktopWidth) );
- mySplitter->setSizes( sizes );
-}
-
-/*!
- Destructor
-*/
-QAD_RightFrame::~QAD_RightFrame()
-{
-}
-
-QAD_ViewFrame* QAD_RightFrame::getViewFrame() const
-{
- return myViewFrame;
-}
-
-/*!
- Returns reference to the message window [ static ]
-*/
-QAD_Message* QAD_RightFrame::getMessage() const
-{
- return myMessage;
-}
-
-/*!
- Returns the Python interpreter that belongs to this study
-*/
-QAD_PyInterp* QAD_RightFrame::get_PyInterp(void)
-{
- return myInterp;
-}
-
-/*!
- Returns reference to the Python window [ static ]
-*/
-QAD_PyEditor* QAD_RightFrame::getPyEditor() const
-{
- return myPyEditor;
-}
-
-/*!
- Compress views
-*/
-void QAD_RightFrame::compressUp()
-{
- QSplitterPHandle* h = getHandleAfter(myViewFrame);
- if (h)
- h->compressBefore();
-}
-
-/*!
- Uncompress views
-*/
-void QAD_RightFrame::unCompressUp()
-{
- QSplitterPHandle* h = getHandleAfter(myViewFrame);
- if (h)
- h->unCompressBefore();
-}
-
-/*!
- Compress Python Interpreter and Messages windows
-*/
-void QAD_RightFrame::compressBottom()
-{
- QSplitterPHandle* h = getHandleAfter(myViewFrame);
- if (h)
- h->compressAfter();
-}
-
-/*!
- Uncompress Python Interpreter and Messages windows
-*/
-void QAD_RightFrame::unCompressBottom()
-{
- QSplitterPHandle* h = getHandleAfter(myViewFrame);
- if (h)
- h->unCompressAfter();
-}
-
-void QAD_RightFrame::compressLeft()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
- if( h )
- h->compressBefore();
-}
-
-void QAD_RightFrame::compressRight()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
- if( h )
- h->compressAfter();
-}
-
-void QAD_RightFrame::unCompressLeft()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
- if( h )
- h->unCompressBefore();
-}
-
-void QAD_RightFrame::unCompressRight()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter( getPyEditor() );
- if( h )
- h->unCompressAfter();
-}
-
-bool QAD_RightFrame::isCompressedViewFrame() const
-{
- return isCompressed( myViewFrame );
-}
-
-bool QAD_RightFrame::isCompressedPython() const
-{
- return mySplitter->isCompressed( getPyEditor() );
-}
-
-bool QAD_RightFrame::isCompressedMessage() const
-{
- return mySplitter->isCompressed( getMessage() );
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_RightFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_RightFrame_H
-#define QAD_RightFrame_H
-
-#include "QAD_ViewFrame.h"
-#include "QAD_Message.h"
-#include "QAD_Splitter.h"
-
-class QMutex;
-
-class QAD_PyEditor;
-class QAD_PyInterp;
-
-class QAD_EXPORT QAD_RightFrame : public QAD_Splitter
-{
- public:
- QAD_RightFrame(QWidget *theParent,
- const char *theTitle, ViewType theTypeView,
- QAD_PyInterp*& theInterp, QMutex* theMutex);
- ~QAD_RightFrame();
-
- QAD_ViewFrame* getViewFrame() const;
- QAD_PyInterp* get_PyInterp(void);
- QAD_Message* getMessage() const;
- QAD_PyEditor* getPyEditor() const;
-
- void compressBottom();
- void compressUp();
- void unCompressBottom();
- void unCompressUp();
-
- void compressLeft();
- void compressRight();
- void unCompressLeft();
- void unCompressRight();
-
- bool isCompressedViewFrame() const;
- bool isCompressedPython() const;
- bool isCompressedMessage() const;
-
-protected:
- ViewType myViewType;
-
- QAD_ViewFrame* myViewFrame;
- QAD_PyEditor* myPyEditor;
- QAD_Message* myMessage;
- QAD_Splitter* mySplitter;
- QAD_PyInterp*& myInterp;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Settings.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_Settings.h"
-
-#include <stdio.h>
-
-// QT Includes
-#include <qfile.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qtextstream.h>
-using namespace std;
-
-/*!
- Class QAD_Settings is a base class for different kind of settings
- (identifying strings and values).
-*/
-QAD_Settings::QAD_Settings(QString _sectionName,
- QChar _nameStarter, QChar _nameStopper,
- QChar _valueStarter, QChar _valueStopper)
-{
- sectionName = _sectionName;
- nameStarter = _nameStarter;
- nameStopper = _nameStopper;
- valueStarter = _valueStarter;
- valueStopper = _valueStopper;
- settingList.setAutoDelete(true);
-}
-
-/*!
- Constructor.
-*/
-QAD_Settings::QAD_Settings(QString _sectionName,
- QChar _nameStarter,
- QChar _separator,
- QChar _valueStopper)
-{
- sectionName = _sectionName;
- nameStarter = _nameStarter;
- nameStopper = _separator;
- valueStopper = _valueStopper;
- valueStarter=0;
- settingList.setAutoDelete(true);
-}
-/*!
- Constructor.
-*/
-QAD_Settings::QAD_Settings(QChar _nameStopper, QChar _valueStarter,
- QChar _valueStopper)
-{
- sectionName = "";
- nameStarter = 0;
- nameStopper = _nameStopper;
- valueStarter = _valueStarter;
- valueStopper = _valueStopper;
- settingList.setAutoDelete(true);
-}
-
-
-/*!
- Destructor.
-*/
-QAD_Settings::~QAD_Settings()
-{
-}
-
-
-/*!
- Clears all settings.
-*/
-void QAD_Settings::clear()
-{
- settingList.clear();
-}
-
-
-/*!
- Adds a setting. If a setting with the given name is already defined it
- gets overwritten.
-*/
-void QAD_Settings::addSetting(QString _name, QString _value, bool _autoValue)
-{
- // Remove all settings with the same name:
- removeSettings(_name.simplifyWhiteSpace());
-
- // Add new setting:
- QAD_Setting* newSetting = new QAD_Setting(_name.simplifyWhiteSpace(),
- _value.simplifyWhiteSpace(),
- _autoValue);
- settingList.append(newSetting);
-}
-
-
-/*!
- Adds an int setting. If a setting with the given name is already defined it
- gets overwritten.
-*/
-void QAD_Settings::addSetting(QString _name, int _value, bool _autoValue)
-{
- QString strVal;
- strVal.setNum(_value);
-
- addSetting(_name, strVal, _autoValue);
-}
-
-/*!
- Adds a double setting. If a setting with the given name is already defined it
- gets overwritten.
-*/
-void QAD_Settings::addSetting(QString _name, double _value, bool _autoValue)
-{
- QString strVal;
- strVal.setNum(_value);
-
- addSetting(_name, strVal, _autoValue);
-}
-
-
-/*!
- Removes all setting with the given name (should be unique anyway).
-*/
-bool QAD_Settings::removeSettings(QString name)
-{
- QAD_Setting* s;
- bool ret=false;
-
- for(s=settingList.first(); s!=0;) {
- if(s->getName()==name) {
- settingList.remove(s);
- s=settingList.current();
- ret=true;
- }
- else {
- s=settingList.next();
- }
- }
-
- return ret;
-}
-
-
-/*!
- Removes all setting which are not automatically generated.
-*/
-void QAD_Settings::removeNonAutoSettings()
-{
- QAD_Setting* s;
-
- for(s=settingList.first(); s!=0;) {
- if(!s->isAutoValue()) {
- settingList.remove(s);
- s=settingList.current();
- }
- else {
- s=settingList.next();
- }
- }
-}
-
-
-/*!
- Gets the setting value of the given setting.
-*/
-QString QAD_Settings::getSetting(QString name)
-{
- QAD_Setting* s;
-
- for(s=settingList.first(); s!=0; s=settingList.next()) {
- if(s->getName()==name) return s->getValue();
- }
-
- return "";
-}
-
-/*!
- Replaces variables in the given string by their values.
-*/
-QString QAD_Settings::replace(QString str)
-{
- if(!str.contains('$')) return str;
-
- QAD_Setting* t;
- QString result=str.copy();
- int i;
- bool found;
-
- // Replace until we have no occurences of variables or recursive counter>16:
- do {
- found=false;
- for(t=settingList.first(); t!=0; t=settingList.next()) {
- if(result.contains('$')) {
- i=0;
- do {
- i = result.find(QRegExp("\\$" + t->getName() + "[^a-zA-z0-9_]"), i);
- if(i!=-1) {
- result.replace(i, (int)t->getName().length()+1, t->getValue());
- found=true;
- }
- }while(i!=-1);
- }
- else goto end;
- }
- } while(found);
-
- end:
-
- return result;
-}
-
-/*!
- Returns true if list contains given setting
-*/
-bool QAD_Settings::hasSetting(QString name)
-{
- QAD_Setting* s;
-
- for(s=settingList.first(); s!=0; s=settingList.next()) {
- if(s->getName()==name) return true;
- }
- return false;
-}
-
-// EOF
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Settings.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_SETTINGS_H
-#define QAD_SETTINGS_H
-
-#include <qlist.h>
-#include <qstring.h>
-#include <qobject.h>
-
-/*!
- Class Setting wraps a single setting with a name and a value.
-*/
-class QAD_Setting
-{
-
-public:
- /** Constructor. */
- QAD_Setting() { autoValue=true; }
- QAD_Setting( QString _name, QString _value, bool _autoValue=true )
- { name=_name; value=_value; autoValue=_autoValue; }
-
- ~QAD_Setting() {}
-
- /** Sets the name of this setting. */
- void setName(QString _name)
- { name=_name; }
-
- /** Gets the name of this setting. */
- QString getName()
- { return name; }
-
- /** Sets the value of this setting. */
- void setValue(QString _value)
- { value=_value; }
-
- /** Gets the value of the setting. */
- QString getValue()
- { return value; }
-
- /** Sets the auto value flag. */
- void setAutoValue(bool _av)
- { autoValue=_av; }
-
- /** Gets the auto value flag. */
- bool isAutoValue()
- { return autoValue; }
-
-private:
- QString name;
- QString value;
- bool autoValue;
-};
-
-
-
-class QAD_Settings : public QObject
-{
- Q_OBJECT
-
-public:
- /** Constructor. */
- QAD_Settings() { settingList.setAutoDelete(true); }
- QAD_Settings(QString _sectionName,
- QChar _nameStarter, QChar _nameStopper,
- QChar _valueStarter, QChar _valueStopper);
- QAD_Settings(QString _sectionName,
- QChar _nameStarter, QChar _separator,
- QChar _valueStopper);
- QAD_Settings(QChar _nameStopper, QChar _valueStarter,
- QChar _valueStopper);
- virtual ~QAD_Settings();
-
- /** Returns the list of settings as a QList. */
- QList<QAD_Setting>* getSettingList() { return &settingList; }
-
- /** Sets the name of the section where this settings are saved. */
- virtual void setSectionName(QString name) { sectionName=name; }
-
- virtual void clear();
- virtual void addSetting(QString _name, QString _value, bool _autoValue=true);
- virtual void addSetting(QString _name, int _value, bool _autoValue=true);
- virtual void addSetting(QString _name, double _value, bool _autoValue=true);
- virtual bool removeSettings(QString name);
- virtual void removeNonAutoSettings();
- virtual QString getSetting(QString name);
- virtual QString replace(QString str);
- virtual bool hasSetting(QString name);
-
-protected:
- /** The list which contains all stored settings. */
- QList<QAD_Setting> settingList;
-
-private:
- QString sectionName;
- QChar nameStarter;
- QChar nameStopper;
- QChar valueStarter;
- QChar valueStopper;
-
-};
-
-#endif
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_SpinBoxDbl.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "QAD_SpinBoxDbl.h"
-#include <qpushbutton.h>
-#include <qpainter.h>
-#include <qbitmap.h>
-#include <qlineedit.h>
-#include <qvalidator.h>
-#include <qpixmapcache.h>
-#include <qapplication.h>
-#include <limits.h>
-using namespace std;
-
-//******************************************************************************
-// QDblRangeControl class
-//******************************************************************************
-
-/*!
- Constructs a range control with min value 0.00, max value 99.99,
- line step 0.1, page step 1.00, precision 6, double precision 10e-6,
- convertion flag 'g' and initial value 0.00.
-*/
-QDblRangeControl::QDblRangeControl()
-{
- prec = 6;
- dblPrec = 10e-6;
- convFlag = 'g';
- minVal = roundPrecision( 0.00 );
- maxVal = roundPrecision( 99.99 );
- line = roundPrecision( 0.10 );
- page = roundPrecision( 1.00 );
- prevVal = roundPrecision( -0.10 );
- val = bound( 0.00 );
-}
-
-/*!
- Constructs a range control whose value can never be smaller than
- <minValue> or greater than <maxValue>, whose line step size is
- <lineStep> and page step size is <pageStep> and whose value is
- initially <value> (which is guaranteed to be in range using bound()),
- precision is <precision>, double precision is <dblPrecision> and
- convertion flag is <cFlag>
-*/
-QDblRangeControl::QDblRangeControl( double minValue, double maxValue,
- double lineStep, double pageStep,
- double value,
- int precision,
- double dblPrecision,
- char cFlag )
-{
- prec = precision;
- dblPrec = dblPrecision;
- convFlag = cFlag;
- minVal = roundPrecision( minValue );
- maxVal = roundPrecision( maxValue );
- line = roundPrecision( QABS( lineStep ) );
- page = roundPrecision( QABS( pageStep ) );
- prevVal = roundPrecision( minVal - 0.1 );
- val = bound( value );
-}
-
-/*!
- Destroys the range control
-*/
-QDblRangeControl::~QDblRangeControl()
-{
-}
-
-/*!
- Returns the current range control value. This is guaranteed to be
- within the range [minValue(), maxValue()].
-*/
-inline double QDblRangeControl::value() const
-{ return val; }
-
-/*!
- Sets the range control's value to <value> and forces it to be within
- the legal range.
- Calls the virtual valueChange() function if the new value is
- different from the previous value. The old value can still be
- retrieved using prevValue().
-*/
-void QDblRangeControl::setValue( double value )
-{
- directSetValue( value );
- if ( !equal(prevVal, val ) )
- valueChange();
-}
-
-/*!
- Equivalent to {setValue( value() + pageStep() )}.
- If the value is changed, then valueChange() is called.
-*/
-void QDblRangeControl::addPage()
-{
- setValue( value() + pageStep() );
-}
-
-/*!
- Equivalent to {setValue( value() - pageStep() )}.
- If the value is changed, then valueChange() is called.
-*/
-void QDblRangeControl::subtractPage()
-{
- setValue( value() - pageStep() );
-}
-
-/*!
- Equivalent to {setValue( value() + lineStep() )}.
- If the value is changed, then valueChange() is called.
-*/
-void QDblRangeControl::addLine()
-{
- setValue( value() + lineStep() );
-}
-
-/*!
- Equivalent to {setValue( value() - lineStep() )}.
- If the value is changed, then valueChange() is called.
-*/
-void QDblRangeControl::subtractLine()
-{
- setValue( value() - lineStep() );
-}
-
-/*!
- Returns the current minimum value of the range.
-*/
-inline double QDblRangeControl::minValue() const
-{ return minVal; }
-
-/*!
- Returns the current maximum value of the range.
-*/
-inline double QDblRangeControl::maxValue() const
-{ return maxVal; }
-
-/*!
- Sets the range control's min value to <minValue> and its max value
- to <maxValue>.
-
- Calls the virtual rangeChange() function if one or both of the new
- min and max values are different from the previous setting. Calls
- the virtual valueChange() function if the current value is adjusted
- because it was outside the new range.
-
- If <maxValue> is smaller than <minValue>, <minValue> becomes the
- only legal value.
-*/
-void QDblRangeControl::setRange( double minValue, double maxValue )
-{
- minValue = roundPrecision( minValue );
- maxValue = roundPrecision( maxValue );
- if ( minValue > maxValue ) {
- maxValue = minValue;
- }
- if ( equal( minValue, minVal ) && equal( maxValue, maxVal ) )
- return;
- minVal = minValue;
- maxVal = maxValue;
- double tmp = bound( val );
- rangeChange();
- if ( !equal( tmp, val ) ) {
- prevVal = val;
- val = tmp;
- valueChange();
- }
-}
-
-/*!
- Sets the current minimum value of the range to <minVal>.
- If necessary, the maxValue() is adjusted so that the range remains
- valid.
-*/
-void QDblRangeControl::setMinValue( double minVal )
-{
- double maxVal = maxValue();
- if ( maxVal < minVal )
- maxVal = minVal;
- setRange( minVal, maxVal );
-}
-
-/*!
- Sets the current maximum value of the range to <maxVal>.
- If necessary, the minValue() is adjusted so that the range remains
- valid.
-*/
-void QDblRangeControl::setMaxValue( double maxVal )
-{
- double minVal = minValue();
- if ( minVal > maxVal )
- minVal = maxVal;
- setRange( minVal, maxVal );
-}
-
-/*!
- Returns the current line step.
-*/
-inline double QDblRangeControl::lineStep() const
-{ return line; }
-
-/*!
- Returns the current page step.
-*/
-inline double QDblRangeControl::pageStep() const
-{ return page; }
-
-/*!
- Sets the range line step to <lineStep> and page step to <pageStep>.
- Calls the virtual stepChange() function if the new line step and/or
- page step are different from the previous settings.
-*/
-void QDblRangeControl::setSteps( double lineStep, double pageStep )
-{
- lineStep = roundPrecision( QABS( lineStep ) );
- pageStep = roundPrecision( QABS( pageStep ) );
- if ( !equal( lineStep, line ) || !equal( pageStep, page ) ) {
- line = lineStep;
- page = pageStep;
- stepChange();
- }
-}
-
-/*!
- Returs precision ( see QString::setNum() for details )
-*/
-int QDblRangeControl::precision() const
-{ return prec; }
-
-/*!
- Sets precision ( see QString::setNum() for details )
-*/
-void QDblRangeControl::setPrecision( int precision )
-{
- if ( precision > 0 && prec != precision ) {
- prec = precision;
- setRange( minValue(), maxValue() );
- setSteps( lineStep(), pageStep() );
- }
-}
-
-/*!
- Returns double precision which is used for rounding amd comparing
- of double numbers
-*/
-double QDblRangeControl::dblPrecision() const
-{ return dblPrec; }
-
-/*!
- Sets double precision which is used for rounding amd comparing
- of double numbers
-*/
-void QDblRangeControl::setDblPrecision( double dblPrecision )
-{
- dblPrecision = QABS( dblPrecision );
- if ( dblPrecision > 0 && dblPrecision != dblPrec ) {
- dblPrec = dblPrecision;
- setRange( minValue(), maxValue() );
- setSteps( lineStep(), pageStep() );
- }
-}
-
-/*!
- Returns convertion flag ( see QString::setNum() for details )
-*/
-char QDblRangeControl::convertFlag() const
-{ return convFlag; }
-
-/*!
- Sets convertion flag ( see QString::setNum() for details )
-*/
-void QDblRangeControl::setConvertFlag( char cFlag )
-{
- if ( ( cFlag == 'f' || cFlag == 'F' || cFlag == 'e' ||
- cFlag == 'E' || cFlag == 'g' || cFlag == 'G' ) &&
- ( cFlag != convFlag ) ) {
- convFlag = cFlag;
- setRange( minValue(), maxValue() );
- setSteps( lineStep(), pageStep() );
- }
-}
-
-/*!
- Forces the value <v> to be within the range from minValue() to
- maxValue() inclusive, and returns the result.
-
- This function is provided so that you can easily force other numbers
- than value() into the allowed range. You do not need to call it in
- order to use QDblRangeControl itself.
-*/
-double QDblRangeControl::bound( double v ) const
-{
- if ( v < minVal )
- return minVal;
- if ( v > maxVal )
- return maxVal;
- return roundPrecision( v );
-}
-
-/*!
- Sets the range control value directly without calling valueChange().
- Forces the new value to be within the legal range.
-
- You will rarely have to call this function. However, if you want to
- change the range control's value inside the overloaded method
- valueChange(), setValue() would call the function valueChange()
- again. To avoid this recursion you must use directSetValue()
- instead.
-*/
-void QDblRangeControl::directSetValue( double value )
-{
- prevVal = val;
- val = bound( value );
-}
-
-/*!
- Returns the previous value of the range control. "Previous value"
- means the value before the last change occurred. Setting a new range
- may affect the value, too, because the value is forced to be inside
- the specified range. When the range control is initially created,
- this is the same as value().
-
- prevValue() can be outside the current legal range if a call to
- setRange() causes the current value to change. For example, if the
- range was [0, 1000] and the current value is 500, setRange(0, 400)
- makes value() return 400 and prevValue() return 500.
-*/
-inline double QDblRangeControl::prevValue() const
-{ return prevVal; }
-
-/*!
- This virtual function is called whenever the range control value
- changes. You can reimplement it if you want to be notified when the
- value changes. The default implementation does nothing.
-
- Note that this method is called after the value changed. The previous
- value can be retrieved using prevValue().
-*/
-void QDblRangeControl::valueChange()
-{
-}
-
-/*!
- This virtual function is called whenever the range control's range
- changes. You can reimplement it if you want to be notified when the range
- changes. The default implementation does nothing.
-
- Note that this method is called after the range changed.
-*/
-void QDblRangeControl::rangeChange()
-{
-}
-
-/*!
- This virtual function is called whenever the range control's
- line/page step settings change. You can reimplement it if you want
- to be notified when the step changes. The default implementation
- does nothing.
-
- Note that this method is called after the step settings change.
-*/
-void QDblRangeControl::stepChange()
-{
-}
-
-/*!
- returns true if values qre equal ( with tolerance = dblPrecision() )
-*/
-bool QDblRangeControl::equal( double first, double second ) const
-{
- return QABS( first - second ) < dblPrecision();
-}
-
-/*!
- Retuns rounded value
-*/
-double QDblRangeControl::roundPrecision( double value) const
-{
- bool bOk;
- QString convertor;
- convertor.setNum( value, convertFlag(), precision() );
- double newValue = convertor.toDouble(&bOk);
- if ( bOk ) {
- if ( QABS( newValue ) < dblPrecision() )
- newValue = 0.0;
- }
- else {
- newValue = value;
- }
- return newValue;
-}
-
-//******************************************************************************
-// QAD_SpinBox class
-//******************************************************************************
-
-/*!
- Returns true if <str> ends by <substr> [ static ]
-*/
-static bool endsWith(const QString& str, const QString& substr)
-{
-#if QT_VERSION < 0x030000
- if ( str.length() < substr.length() )
- return false;
- return ( str.right( substr.length() ) == substr );
-#else
- return str.endsWith(substr);
-#endif
-}
-
-/*!
- Validator class for double value spin box
-*/
-class QAD_SpinBoxDblValidator: public QDoubleValidator
-{
-public:
- QAD_SpinBoxDblValidator( QAD_SpinBoxDbl* sb, const char* name )
- : QDoubleValidator( sb, name ),
- spinBox( sb ) {}
-
- State validate( QString& str, int& pos ) const;
-
-private:
- QAD_SpinBoxDbl* spinBox;
-};
-
-/*!
- Validates data entered
-*/
-QValidator::State QAD_SpinBoxDblValidator::validate( QString& str, int& pos ) const
-{
- QString pref = spinBox->prefix();
- QString suff = spinBox->suffix();
- uint overhead = pref.length() + suff.length();
- State state = Invalid;
-
- ((QDoubleValidator *) this)->setRange( spinBox->minValue(),
- spinBox->maxValue() );
- if ( overhead == 0 ) {
- state = QDoubleValidator::validate( str, pos );
- } else {
- if ( str.length() >= overhead &&
- str.startsWith(pref) &&
- endsWith(str, suff) ) {
- QString core = str.mid( pref.length(), str.length() - overhead );
- int corePos = pos - pref.length();
- state = QDoubleValidator::validate( core, corePos );
- pos = corePos + pref.length();
- str.replace( pref.length(), str.length() - overhead, core );
- } else {
- state = QDoubleValidator::validate( str, pos );
- if ( state == Invalid ) {
- // stripWhiteSpace(), cf. QAD_SpinBoxDbl::interpretText()
- QString special = spinBox->specialValueText().stripWhiteSpace();
- QString candidate = str.stripWhiteSpace();
-
- if ( special.startsWith(candidate) ) {
- if ( candidate.length() == special.length() ) {
- state = Acceptable;
- } else {
- state = Intermediate;
- }
- }
- }
- }
- }
- return state;
-}
-
-/*!
- Creates a spin box with min value 0.00, max value 99.99,
- line step 0.1, precision 6, double precision 10e-6,
- convertion flag 'g' and initial value 0.00.
-*/
-QAD_SpinBoxDbl::QAD_SpinBoxDbl( QWidget* parent, const char* name )
-: QFrame(parent, name),
- QDblRangeControl()
-{
- initSpinBox();
-}
-
-/*!
- Constructor
- Creates a spin box with min value <minValue>, max value <maxValue>,
- line step <step>, precision <precision>, double precision <dblPrecision>,
- convertion flag <cFlag> and initial value <minValue>
-*/
-QAD_SpinBoxDbl::QAD_SpinBoxDbl( QWidget* parent,
- double minValue,
- double maxValue,
- double step,
- int precision,
- double dblPrecision,
- char cFlag,
- const char* name )
-: QFrame( parent, name ),
- QDblRangeControl( minValue, maxValue, step, step, minValue, precision, dblPrecision, cFlag )
-{
- initSpinBox();
-}
-
-/*!
- Destructor
-*/
-QAD_SpinBoxDbl::~QAD_SpinBoxDbl()
-{}
-
-/*!
- Internal initialization.
-*/
-void QAD_SpinBoxDbl::initSpinBox()
-{
- wrap = FALSE;
- edited = FALSE;
- butSymbols = UpDownArrows;
- selreq = FALSE;
-
- up = new QPushButton( this, "up" );
- up->setFocusPolicy( QWidget::NoFocus );
- up->setAutoDefault( FALSE );
- up->setAutoRepeat( TRUE );
-
- down = new QPushButton( this, "down" );
- down->setFocusPolicy( QWidget::NoFocus );
- down->setAutoDefault( FALSE );
- down->setAutoRepeat( TRUE );
-
- validate = new QAD_SpinBoxDblValidator( this, "validator" );
- vi = new QLineEdit( this, "line editor" );
- vi->setFrame( FALSE );
- setFocusProxy( vi );
- setFocusPolicy( StrongFocus );
- vi->setValidator( validate );
- vi->installEventFilter( this );
-
- setFrameStyle( Panel | Sunken );
- setLineWidth( 2 );
-
-// setPalettePropagation( AllChildren );
-// setFontPropagation( AllChildren );
-
- setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
- updateDisplay();
-
- connect( up, SIGNAL(pressed()), SLOT(stepUp()) );
- connect( down, SIGNAL(pressed()), SLOT(stepDown()) );
- connect( vi, SIGNAL(textChanged(const QString&)), SLOT(textChanged()) );
-}
-
-/*!
- Returns the current text of the spin box, including any prefix() and suffix().
-*/
-QString QAD_SpinBoxDbl::text() const
-{
- return vi->text();
-}
-
-/*!
- Returns a copy of the current text of the spin box with any prefix
- and/or suffix and white space at the start and end removed.
-*/
-QString QAD_SpinBoxDbl::cleanText() const
-{
- QString s = QString(text()).stripWhiteSpace();
- if ( !prefix().isEmpty() ) {
- QString px = QString(prefix()).stripWhiteSpace();
- int len = px.length();
- if ( len && s.left(len) == px ) // Remove _only_ if it is the prefix
- s.remove( 0, len );
- }
- if ( !suffix().isEmpty() ) {
- QString sx = QString(suffix()).stripWhiteSpace();
- int len = sx.length();
- if ( len && s.right(len) == sx ) // Remove _only_ if it is the suffix
- s.truncate( s.length() - len );
- }
- return s.stripWhiteSpace();
-}
-
-/*!
- Sets the special-value text to text. If set, the spin box will
- display this text instead of a numeric value whenever the current
- value is equal to minVal(). Typically used for indicating that this
- choice has a special (default) meaning.
-*/
-void QAD_SpinBoxDbl::setSpecialValueText( const QString &text )
-{
- specText = text;
- updateDisplay();
-}
-
-/*!
- Returns the currently special-value text, or a null string if no
- special-value text is currently set.
-*/
-QString QAD_SpinBoxDbl::specialValueText() const
-{
- if ( specText.isEmpty() )
- return QString::null;
- else
- return specText;
-}
-
-/*!
- Sets the prefix to <text>. The prefix is prepended to the start of
- the displayed value. Typical use is to indicate the unit of
- measurement to the user.
-*/
-void QAD_SpinBoxDbl::setPrefix( const QString &text )
-{
- pfix = text;
- updateDisplay();
-}
-
-/*!
- Sets the suffix to <text>. The suffix is appended to the end of the
- displayed value. Typical use is to indicate the unit of measurement
- to the user.
-*/
-void QAD_SpinBoxDbl::setSuffix( const QString &text )
-{
- sfix = text;
- updateDisplay();
-}
-
-/*!
- Returns the currently set prefix, or a null string if no prefix is set.
-*/
-QString QAD_SpinBoxDbl::prefix() const
-{
- if ( pfix.isEmpty() )
- return QString::null;
- else
- return pfix;
-}
-
-/*!
- Returns the currently set suffix, or a null string if no suffix is set.
-*/
-QString QAD_SpinBoxDbl::suffix() const
-{
- if ( sfix.isEmpty() )
- return QString::null;
- else
- return sfix;
-}
-
-/*!
- Setting wrapping to TRUE will allow the value to be stepped from the
- highest value to the lowest, and vice versa. By default, wrapping is
- turned off.
-*/
-void QAD_SpinBoxDbl::setWrapping( bool on )
-{
- wrap = on;
- updateDisplay();
-}
-
-/*!
- Returns the current setWrapping() value.
-*/
-bool QAD_SpinBoxDbl::wrapping() const
-{
- return wrap;
-}
-
-/*!
- Reimplementation
-*/
-QSize QAD_SpinBoxDbl::sizeHint() const
-{
- constPolish();
- QFontMetrics fm = fontMetrics();
- int h = vi->sizeHint().height();
- if ( h < 12 ) // ensure enough space for the button pixmaps
- h = 12;
- int w = 35; // minimum width for the value
- int wx = fm.width( ' ' )*2;
- QString s;
-
- QAD_SpinBoxDbl* that = (QAD_SpinBoxDbl*)this;
- s = prefix() + that->mapValueToText( that->minValue() ) + suffix();
- w = QMAX( w, fm.width( s ) + wx);
- s = prefix() + that->mapValueToText( that->maxValue() ) + suffix();
- w = QMAX(w, fm.width( s ) + wx );
- if ( !specialValueText().isEmpty() ) {
- s = specialValueText();
- w = QMAX( w, fm.width( s ) + wx );
- }
- QSize r( h * 8/5 // ~ buttons width
- + w // widest value
- + frameWidth() * 2, // left/right frame
- frameWidth() * 2 // top/bottom frame
- + h // font height
- );
- return r.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
- Does the layout of the lineedit and the buttons
-*/
-void QAD_SpinBoxDbl::arrangeWidgets()
-{
- if ( !up || !down ) // may happen if the application has a pointer error
- return;
-
- QSize bs; // no, it's short for 'button size'
- bs.setHeight( height()/2 - frameWidth() );
- if ( bs.height() < 8 )
- bs.setHeight( 8 );
- bs.setWidth( bs.height() * 8 / 5 ); // 1.6 - approximate golden mean
- setFrameRect( QRect( 0, 0, 0, 0 ) );
-
- if ( up->size() != bs || down->size() != bs ) {
- up->resize( bs );
- down->resize( bs );
- updateButtonSymbols();
- }
-
- int y = frameWidth();
- int x = width() - y - bs.width();
- up->move( x, y );
- down->move( x, height() - y - up->height() );
- vi->setGeometry( frameWidth(), frameWidth(),
- x - frameWidth(), height() - 2*frameWidth() );
-}
-
-/*!
- Sets the current value of the spin box to <value>. This is
- QRangeControl::setValue() made available as a slot.
-*/
-void QAD_SpinBoxDbl::setValue( double value )
-{
- QDblRangeControl::setValue( value );
-}
-
-/*!
- Increases the current value one step, wrapping as necessary. This is
- the same as clicking on the pointing-up button, and can be used for
- e.g. keyboard accelerators.
-*/
-void QAD_SpinBoxDbl::stepUp()
-{
- if ( edited )
- interpretText();
- if ( wrapping() && ( value()+lineStep() > maxValue() ) )
- setValue( minValue() );
- else
- addLine();
-}
-
-/*!
- Decreases the current value one step, wrapping as necessary. This is
- the same as clicking on the pointing-down button, and can be used
- for e.g. keyboard accelerators.
-*/
-void QAD_SpinBoxDbl::stepDown()
-{
- if ( edited )
- interpretText();
- if ( wrapping() && ( value()-lineStep() < minValue() ) )
- setValue( maxValue() );
- else
- subtractLine();
-}
-
-/*!
- Intercepts and handles those events coming to the embedded QLineEdit
- which have special meaning for the QAD_SpinBoxDbl.
-*/
-bool QAD_SpinBoxDbl::eventFilter( QObject* obj, QEvent* ev )
-{
- if ( obj != vi )
- return FALSE;
-
- if ( ev->type() == QEvent::KeyPress ) {
- QKeyEvent* k = (QKeyEvent*)ev;
-
- bool retval = FALSE; // workaround for MSVC++ optimization bug
- if( (k->key() == Key_Tab) || (k->key() == Key_BackTab) ){
- if ( edited )
- interpretText();
- qApp->sendEvent( this, ev );
- retval = TRUE;
- } if ( k->key() == Key_Up ) {
- stepUp();
- retval = TRUE;
- } else if ( k->key() == Key_Down ) {
- stepDown();
- retval = TRUE;
- } else if ( k->key() == Key_Return ) {
- interpretText();
- return FALSE;
- }
- if ( retval )
- return retval;
- } else if ( ev->type() == QEvent::FocusOut || ev->type() == QEvent::Leave || ev->type() == QEvent::Hide ) {
- if ( edited ) {
- interpretText();
- }
- return FALSE;
- }
- return FALSE;
-}
-
-/*!
- Reimplementation
-*/
-void QAD_SpinBoxDbl::leaveEvent( QEvent* )
-{
- if ( edited )
- interpretText();
-}
-
-/*!
- Reimplementation
-*/
-void QAD_SpinBoxDbl::resizeEvent( QResizeEvent* )
-{
- arrangeWidgets();
-}
-
-/*!
- Reimplementation
-*/
-void QAD_SpinBoxDbl::wheelEvent( QWheelEvent * e )
-{
- e->accept();
- static float offset = 0;
- static QAD_SpinBoxDbl* offset_owner = 0;
- if (offset_owner != this) {
- offset_owner = this;
- offset = 0;
- }
- offset += -e->delta()/120;
- if (QABS(offset) < 1)
- return;
- int ioff = int(offset);
- int i;
- for (i=0; i<QABS(ioff); i++)
- offset > 0 ? stepDown() : stepUp();
- offset -= ioff;
-}
-
-/*!
- This method gets called by QRangeControl whenever the value has changed.
- Updates the display and emits the valueChanged() signals.
-*/
-void QAD_SpinBoxDbl::valueChange()
-{
- selreq = hasFocus();
- updateDisplay();
- selreq = FALSE;
- emit valueChanged( value() );
- emit valueChanged( currentValueText() );
-}
-
-/*!
- This method gets called by QRangeControl whenever the range has
- changed. It adjusts the default validator and updates the display.
-*/
-void QAD_SpinBoxDbl::rangeChange()
-{
- updateDisplay();
-}
-
-/*!
- Sets the validator to <v>. The validator controls what keyboard
- input is accepted when the user is editing in the value field. The
- default is to use a suitable QIntValidator.
-*/
-void QAD_SpinBoxDbl::setValidator( const QValidator* v )
-{
- if ( vi )
- vi->setValidator( v );
-}
-/*!
- Returns the validator which constrains editing for this spin box if
- there is any, or else 0.
-*/
-const QValidator* QAD_SpinBoxDbl::validator() const
-{
- return vi ? vi->validator() : 0;
-}
-
-/*!
- Updates the contents of the embedded QLineEdit to reflect current
- value, using mapValueToText(). Also enables/disables the push
- buttons accordingly.
-*/
-void QAD_SpinBoxDbl::updateDisplay()
-{
- vi->setUpdatesEnabled( FALSE );
- vi->setText( currentValueText() );
- if ( selreq && isVisible() && ( hasFocus() || vi->hasFocus() ) ) {
- selectAll();
- } else {
- if ( !suffix().isEmpty() &&
- endsWith(vi->text(), suffix()) )
- vi->setCursorPosition( vi->text().length() - suffix().length() );
- }
- vi->setUpdatesEnabled( TRUE );
- vi->repaint( FALSE ); // immediate repaint needed for some reason
- edited = FALSE;
-
- up->setEnabled( isEnabled() && (wrapping() || value() < maxValue()) );
- down->setEnabled( isEnabled() && (wrapping() || value() > minValue()) );
- vi->setEnabled( isEnabled() );
-}
-
-/*!
- QAD_SpinBoxDbl calls this after the user has manually edited the contents
- of the spin box (not using the up/down buttons/keys).
- The default implementation of this function interprets the new text
- using mapTextToValue(). If mapTextToValue() is successful, it
- changes the spin box' value. If not the value if left unchanged.
-*/
-void QAD_SpinBoxDbl::interpretText()
-{
- bool ok = TRUE;
- bool done = FALSE;
- double newVal = 0;
- if ( !specialValueText().isEmpty() ) {
- QString s = QString(text()).stripWhiteSpace();
- QString t = QString(specialValueText()).stripWhiteSpace();
- if ( s == t ) {
- newVal = minValue();
- done = TRUE;
- }
- }
- if ( !done )
- newVal = mapTextToValue( &ok );
- if ( ok )
- setValue( newVal );
- updateDisplay(); // Sometimes redundant
-}
-
-/*!
- Returns a pointer to the embedded 'up' button.
-*/
-
-QPushButton* QAD_SpinBoxDbl::upButton() const
-{
- return up;
-}
-
-/*!
- Returns a pointer to the embedded 'down' button.
-*/
-QPushButton* QAD_SpinBoxDbl::downButton() const
-{
- return down;
-}
-
-/*!
- Returns a pointer to the embedded QLineEdit.
-*/
-QLineEdit* QAD_SpinBoxDbl::editor() const
-{
- return vi;
-}
-
-/*!
- This slot gets called whenever the user edits the text of the spin box.
-*/
-void QAD_SpinBoxDbl::textChanged()
-{
- edited = TRUE; // This flag is cleared in updateDisplay()
-};
-
-/*!
- This virtual function is used by the spin box whenever it needs to
- display value <v>. The default implementation returns a string
- containing <v> printed in the standard way.
-*/
-
-QString QAD_SpinBoxDbl::mapValueToText( double v )
-{
- QString s;
- s.setNum( v, convertFlag(), precision() );
- return s;
-}
-
-/*!
- This virtual function is used by the spin box whenever it needs to
- interpret the text entered by the user as a value. The default
- implementation tries to interpret it as an integer in the standard
- way, and returns the double value.
-*/
-double QAD_SpinBoxDbl::mapTextToValue( bool* ok )
-{
- QString s = text();
- double newVal = s.toDouble( ok );
- if ( !(*ok) && !( !prefix() && !suffix() ) ) {// Try removing any pre/suffix
- s = cleanText();
- newVal = s.toDouble( ok );
- }
- return newVal;
-}
-
-/*!
- Returns the full text calculated from the current value, including any
- prefix, suffix or special-value text.
-*/
-QString QAD_SpinBoxDbl::currentValueText()
-{
- QString s;
- if ( (value() <= minValue()) && !specialValueText().isEmpty() ) {
- s = specialValueText();
- } else {
- s = prefix();
- s.append( mapValueToText( value() ) );
- s.append( suffix() );
- }
- return s;
-}
-
-/*!
- Reimplementation
-*/
-void QAD_SpinBoxDbl::setEnabled( bool on )
-{
- bool b = isEnabled();
- QFrame::setEnabled( on );
- if ( isEnabled() != b ) {
- // ## enabledChange() might have been a better choice
- updateDisplay();
- }
-}
-
-/*!
- Reimplementation
-*/
-void QAD_SpinBoxDbl::styleChange( QStyle& old )
-{
- setFrameStyle( Panel | Sunken );
- arrangeWidgets();
- QWidget::styleChange( old );
-}
-
-/*!
- Sets the spin box to display <newSymbols> on its buttons.
- <newSymbols> can be either <UpDownArrows> (the default) or <PlusMinus>.
-*/
-void QAD_SpinBoxDbl::setButtonSymbols( ButtonSymbols newSymbols )
-{
- if ( buttonSymbols() == newSymbols )
- return;
- butSymbols = newSymbols;
- updateButtonSymbols();
-}
-
-/*!
- Returns the current button symbol mode. The default is <UpDownArrows>
-*/
-QAD_SpinBoxDbl::ButtonSymbols QAD_SpinBoxDbl::buttonSymbols() const
-{
- return butSymbols;
-}
-
-/*!
- This function uses the pixmap cache for a Different Reason: the
- pixmap cache also preserves QPixmap::serialNumber(). by doing
- this, QButton::setPixmap() is able to avoid flicker e.g. when the
- spin box is resized in such a way that the height of the buttons
- does not change (common the default size policy).
-*/
-void QAD_SpinBoxDbl::updateButtonSymbols()
-{
- QString key( QString::fromLatin1( "$qt$QAD_SpinBoxDbl$" ) );
- bool pmSym = buttonSymbols() == PlusMinus;
- key += QString::fromLatin1( pmSym ? "+-" : "^v" );
- key += QString::number( down->height() );
- QString upKey = key + QString::fromLatin1( "$up" );
- QString dnKey = key + QString::fromLatin1( "$down" );
- QBitmap upBm;
- QBitmap dnBm;
-
- bool found = QPixmapCache::find( dnKey, dnBm )
- && QPixmapCache::find( upKey, upBm );
-
- if ( !found ) {
- QPainter p;
- if ( pmSym ) {
- int h = down->height()-4;
- if ( h < 3 )
- return;
- else if ( h == 4 )
- h = 3;
- else if ( (h > 6) && (h & 1) )
- h--;
- h -= ( h / 8 ) * 2; // Empty border
- dnBm.resize( h, h );
- p.begin( &dnBm );
- p.eraseRect( 0, 0, h, h );
- p.setBrush( color1 );
- int c = h/2;
- p.drawLine( 0, c, h, c );
- if ( !(h & 1) )
- p.drawLine( 0, c-1, h, c-1 );
- p.end();
- upBm = dnBm;
- p.begin( &upBm );
- p.drawLine( c, 0, c, h );
- if ( !(h & 1) )
- p.drawLine( c-1, 0, c-1, h );
- p.end();
- }
- else {
- int w = down->width()-4;
- if ( w < 3 )
- return;
- else if ( !(w & 1) )
- w--;
- w -= ( w / 7 ) * 2; // Empty border
- int h = w/2 + 2; // Must have empty row at foot of arrow
- dnBm.resize( w, h );
- p.begin( &dnBm );
- p.eraseRect( 0, 0, w, h );
- QPointArray a;
- a.setPoints( 3, 0, 1, w-1, 1, h-2, h-1 );
- p.setBrush( color1 );
- p.drawPolygon( a );
- p.end();
-#ifndef QT_NO_TRANSFORMATIONS
- QWMatrix wm;
- wm.scale( 1, -1 );
- upBm = dnBm.xForm( wm );
-#else
- upBm.resize( w, h );
- p.begin( &upBm );
- p.eraseRect( 0, 0, w, h );
- a.setPoints( 3, 0, h-2, w-1, h-2, h-2, 0 );
- p.setBrush( color1 );
- p.drawPolygon( a );
- p.end();
-#endif
- }
- QPixmapCache::insert( dnKey, dnBm );
- QPixmapCache::insert( upKey, upBm );
- }
- down->setPixmap( dnBm );
- up->setPixmap( upBm );
-}
-
-/*!
- Returns minimum value, reimplementaion
-*/
-double QAD_SpinBoxDbl::minValue()
-{
- return QDblRangeControl::minValue();
-}
-
-/*!
- Returns maximum value, reimplementaion
-*/
-double QAD_SpinBoxDbl::maxValue()
-{
- return QDblRangeControl::maxValue();
-}
-
-/*!
- Sets minimum value, reimplementaion
-*/
-void QAD_SpinBoxDbl::setMinValue( double minValue )
-{
- QDblRangeControl::setMinValue( minValue );
-}
-
-/*!
- Sets maximum value, reimplementaion
-*/
-void QAD_SpinBoxDbl::setMaxValue( double maxValue )
-{
- QDblRangeControl::setMaxValue( maxValue );
-}
-
-/*!
- Returns step size, reimplementaion
-*/
-double QAD_SpinBoxDbl::lineStep()
-{
- return QDblRangeControl::lineStep();
-}
-
-/*!
- Sets step size
-*/
-void QAD_SpinBoxDbl::setLineStep( double step )
-{
- setSteps( step, pageStep() );
-}
-
-/*!
- Returns value of the spin box, reimplementaion
-*/
-double QAD_SpinBoxDbl::value()
-{
- QAD_SpinBoxDbl* that = ( QAD_SpinBoxDbl* ) this;
- if ( edited ) {
- that->edited = FALSE; // avoid recursion
- that->interpretText();
- }
- return QDblRangeControl::value();
-}
-
-/*!
- Selects all the text in the editor of the spinbox.
-*/
-void QAD_SpinBoxDbl::selectAll()
-{
- int overhead = prefix().length() + suffix().length();
- if ( !overhead || currentValueText() == specialValueText() ) {
- vi->selectAll();
- } else {
- vi->setSelection( prefix().length(), vi->text().length() - overhead );
- }
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_SpinBoxDbl.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_SPINBOXDBL_H
-#define QAD_SPINBOXDBL_H
-
-#include "QAD.h"
-#include <qframe.h>
-
-class QAD_EXPORT QDblRangeControl
-{
-public:
- QDblRangeControl();
- QDblRangeControl( double minValue, double maxValue,
- double lineStep, double pageStep,
- double value,
- int precision = 6,
- double dblPrecision = 1e-6,
- char cFlag = 'g');
- virtual ~QDblRangeControl();
- double value() const;
- void setValue( double );
- void addPage();
- void subtractPage();
- void addLine();
- void subtractLine();
-
- double minValue() const;
- double maxValue() const;
- void setRange( double minValue, double maxValue );
- void setMinValue( double minVal );
- void setMaxValue( double minVal );
-
- double lineStep() const;
- double pageStep() const;
- void setSteps( double line, double page );
-
- int precision() const;
- void setPrecision( int precision );
- double dblPrecision() const;
- void setDblPrecision( double dblPrecision );
- char convertFlag() const;
- void setConvertFlag( char cFlag );
-
- double bound( double ) const;
-
-protected:
- void directSetValue( double val );
- double prevValue() const;
-
- virtual void valueChange();
- virtual void rangeChange();
- virtual void stepChange();
- bool equal( double first, double second ) const;
- double roundPrecision( double value) const;
-
-private:
- double minVal, maxVal;
- double line, page;
- double val, prevVal;
- int prec;
- double dblPrec;
- char convFlag;
-
-private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QDblRangeControl( const QDblRangeControl & );
- QDblRangeControl &operator=( const QDblRangeControl & );
-#endif
-};
-
-class QPushButton;
-class QLineEdit;
-class QValidator;
-
-class QAD_EXPORT QAD_SpinBoxDbl: public QFrame, public QDblRangeControl
-{
- Q_OBJECT
-
-public:
- QAD_SpinBoxDbl( QWidget* parent, const char* name = 0 );
- QAD_SpinBoxDbl( QWidget* parent,
- double minValue,
- double maxValue,
- double step,
- int precision = 6,
- double dblPrecision = 1e-6,
- char cFlag = 'g',
- const char* name = 0 );
- ~QAD_SpinBoxDbl();
-
- QString text() const;
-
- virtual QString prefix() const;
- virtual QString suffix() const;
- virtual QString cleanText() const;
-
- virtual void setSpecialValueText( const QString &text );
- QString specialValueText() const;
-
- virtual void setWrapping( bool on );
- bool wrapping() const;
-
- enum ButtonSymbols { UpDownArrows, PlusMinus };
- void setButtonSymbols( ButtonSymbols );
- ButtonSymbols buttonSymbols() const;
-
- virtual void setValidator( const QValidator* v );
- const QValidator* validator() const;
-
- QSize sizeHint() const;
-
- double minValue();
- double maxValue();
- void setMinValue( double );
- void setMaxValue( double );
- double lineStep();
- void setLineStep( double );
- double value();
-
-public slots:
- virtual void setValue( double );
- virtual void setPrefix( const QString &text );
- virtual void setSuffix( const QString &text );
- virtual void stepUp();
- virtual void stepDown();
- virtual void setEnabled( bool );
- virtual void selectAll();
-
-signals:
- void valueChanged( double value );
- void valueChanged( const QString &valueText );
-
-protected:
- virtual QString mapValueToText( double value );
- virtual double mapTextToValue( bool* ok );
- QString currentValueText();
-
- virtual void updateDisplay();
- virtual void interpretText();
-
- QPushButton* upButton() const;
- QPushButton* downButton() const;
- QLineEdit* editor() const;
-
- virtual void valueChange();
- virtual void rangeChange();
-
- bool eventFilter( QObject* obj, QEvent* ev );
- void resizeEvent( QResizeEvent* ev );
- void wheelEvent( QWheelEvent * );
- void leaveEvent( QEvent* );
-
- void styleChange( QStyle& );
-
-protected slots:
- void textChanged();
-
-private:
- void initSpinBox();
-
- ButtonSymbols butSymbols;
- QPushButton* up;
- QPushButton* down;
- QLineEdit* vi;
- QValidator* validate;
- QString pfix;
- QString sfix;
- QString specText;
- bool wrap;
- bool edited;
- bool selreq;
-
- void arrangeWidgets();
- void updateButtonSymbols();
-
- private: // Disabled copy constructor and operator=
-#if defined(Q_DISABLE_COPY)
- QAD_SpinBoxDbl( const QAD_SpinBoxDbl& );
- QAD_SpinBoxDbl& operator=( const QAD_SpinBoxDbl& );
-#endif
-
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Splitter.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD_Splitter.h"
-using namespace std;
-
-/*!
- Constructs an horizontal splitter.
-*/
-
-QAD_Splitter::QAD_Splitter( QWidget *parent, const char *name )
- :QSplitterP(parent,name)
-{
-}
-
-/*!
- Constructs splitter with orientation \a o.
-*/
-QAD_Splitter::QAD_Splitter( Orientation o, QWidget *parent, const char *name )
- :QSplitterP(o, parent, name)
-{
-}
-
-/*!
- Destructs the splitter.
-*/
-QAD_Splitter::~QAD_Splitter()
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Splitter.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_SPLITTER_H
-#define QAD_SPLITTER_H
-
-#include <qsplitterP.h>
-
-class QSplitterP;
-class QAD_Splitter : public QSplitterP
-{
-public:
- QAD_Splitter( QWidget *parent=0, const char *name=0 );
- QAD_Splitter( Orientation, QWidget *parent=0, const char *name=0 );
- ~QAD_Splitter();
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Study.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Study QAD_Study.h
- \brief Study for QAD-based application.
-*/
-
-#include "QAD.h"
-#include "QAD_Tools.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_RightFrame.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_PyInterp.h"
-#include "QAD_Config.h"
-#include "QAD_PyInterp.h"
-
-#include "utilities.h"
-
-#include "SALOME_Selection.h"
-#include "SALOME_TypeFilter.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-// OPEN CASCADE Include
-#include <Standard_Failure.hxx>
-
-// QT Include
-#include <qapplication.h>
-#include <qthread.h>
-#include <qmutex.h>
-
-using namespace std;
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-class TInitStudyThread : public QThread{
- TInitStudyThread();
- TInitStudyThread(const TInitStudyThread&);
-
-public:
- TInitStudyThread(QAD_PyInterp*& theInterp, QMutex* theMutex):
- myInterp(theInterp),
- myStudyLock(new ThreadLock(theMutex,"TInitStudyThread::TInitStudyThread"))
- {}
- virtual ~TInitStudyThread() {
- if(myStudyLock)
- delete myStudyLock;
- }
-
-protected:
- virtual void run(){
- {
- ThreadLock aPyLock = GetPyThreadLock("TInitStudyThread::aPyLock");
- if(MYDEBUG) MESSAGE("TInitStudyThread::run()");
- myInterp = new QAD_PyInterp();
- myInterp->initialize();
- }
- delete myStudyLock;
- myStudyLock = NULL;
- }
-
-private:
- QAD_PyInterp*& myInterp;
- ThreadLock* myStudyLock;
-};
-
-
-/*!
- Constructor
-*/
-QAD_Study::QAD_Study(QAD_Application* theApp,
- SALOMEDS::Study_var theStudy,
- const QString& thePath):
- myStudy(theStudy),
- myOperationState(Undef),
- myApp(theApp),
- myActiveStudyFrame(0),
- myStudyFrameCount(0),
- myPath(thePath),
- myTitle(QAD_Tools::getFileNameFromPath(thePath,true)),
- myIsActive(false),
- myIsSaved(false),
- myIsModified(false),
- myIsReadOnly(false),
- myResult(true),
- myInterp(0),
- myInitStudyThread(0),
- myMutex(new QMutex())
-{
- myStudyFrames.setAutoDelete( true );
- myOperations.setAutoDelete( true );
- myChildWidgets.setAutoDelete( true );
-
- /* create default selection */
- //NRI Selection( "Salome" );
- Selection( QAD_Application::getDesktop()->getComponentUserName( "KERNEL" ) );
-
- /* create python interpreter */
- myInitStudyThread = new TInitStudyThread(myInterp,myMutex);
- myInitStudyThread->start();
-
- /* create study frame */
- createStudyFrame( getNextStudyFrameName() );
-
- /* set default Undo/Redo limit */
- QAD_ASSERT_DEBUG_ONLY( !myStudy->_is_nil() );
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
-
- int aLocked = myStudy->GetProperties()->IsLocked();
- if (aLocked) myStudy->GetProperties()->SetLocked(false);
- SB->UndoLimit(QAD_Desktop::getUndoLevel());
- if (aLocked) myStudy->GetProperties()->SetLocked(true);
-}
-
-
-void QAD_Study::Init()
-{
-}
-
-
-/*!
- Destructor
-*/
-QAD_Study::~QAD_Study ()
-{
- close();
- //SRN: added - clear selection in case the study will be loaded again so the title will coincide
- SALOME_Selection::RemoveSelection( QString(myTitle + "_" + mySelection) );
- {
- {
- ThreadLock aLock(myMutex,"QAD_Study::~QAD_Study()");
- delete myInitStudyThread;
- }
- delete myMutex;
- delete myInterp;
- }
-}
-
-/*!
- Returns TRUE if Study is created correctly. Returns FALSE otherwise.
-*/
-bool QAD_Study::getResult()
-{
- return myResult;
-}
-
-
-//=======================================================================//
-// StudyFrames management //
-//=======================================================================//
-/*!
- Adds study frame
-*/
-void QAD_Study::addStudyFrame(QAD_StudyFrame* sf )
-{
- myStudyFrames.append( sf );
-
- sf->getRightFrame()->getViewFrame()->setPopupServer( myApp );
- // Provide the same common popup menu commands for both the Object Browser and 3D viewer
- sf->getLeftFrame()->getObjectBrowser()->setPopupServer( myApp );
-
- /* icon of Study Frame */
- const QPixmap& icon = myApp->getApplicationIcon();
- if ( !icon.isNull() )
- sf->setIcon ( icon );
-
- /* activation */
- QAD_ASSERT ( connect( sf, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*) ),
- SLOT(onStudyFrameActivated(QAD_StudyFrame*))) );
-
- /* closing */
- QAD_ASSERT ( connect( sf,
- SIGNAL(sfStudyFrameClosing(QAD_StudyFrame*) ),
- this,
- SLOT(onLastStudyFrameClosing(QAD_StudyFrame*))) );
-
- /* set active sf */
- myActiveStudyFrame = sf;
-}
-
-/*!
- Removes studyframe from the list
-*/
-void QAD_Study::removeStudyFrame( QAD_StudyFrame* sf )
-{
- if (sf) {
- if (!myStudy->IsEmpty()) {
- SALOMEDS::SObject_var fatherSF = myStudy->FindObjectID(sf->entry());
- if (!fatherSF->_is_nil()) {
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- int aLocked = myStudy->GetProperties()->IsLocked();
- if (aLocked) myStudy->GetProperties()->SetLocked(false);
- aStudyBuilder->RemoveObject(fatherSF);
- if (aLocked) myStudy->GetProperties()->SetLocked(true);
- }
-
- updateObjBrowser( true );
- }
-
- QAD_RightFrame* rightFrame = sf->getRightFrame();
- if ( rightFrame ) {
- QAD_ViewFrame* viewFrame = rightFrame->getViewFrame();
- if ( viewFrame )
- emit supervStudyFrameClosing( viewFrame );
- }
-
- myStudyFrames.removeRef( sf );
- }
-}
-
-/*!
- Returns number of study frames
-*/
-int QAD_Study::getStudyFramesCount() const
-{
- return myStudyFrames.count();
-}
-
-/*!
- Returns study frame by its index in list
-*/
-QAD_StudyFrame* QAD_Study::getStudyFrame( unsigned i )
-{
- return myStudyFrames.at(i);
-}
-
-/*!
- Returns study frame by its name or null if not found
-*/
-QAD_StudyFrame* QAD_Study::getStudyFrameByName ( const QString& name )
-{
- for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.next() )
- {
- if ( sf->title().compare(name) == 0 ) {
- return sf;
- }
- }
- return NULL;
-}
-
-/*!
- Returns first study frame in the list
-*/
-QAD_StudyFrame* QAD_Study::getFirstStudyFrame()
-{
- return myStudyFrames.first();
-}
-
-/*!
- Returns last study frame in the list
-*/
-QAD_StudyFrame* QAD_Study::getLastStudyFrame()
-{
- return myStudyFrames.last();
-}
-
-/*!
- Returns the vector of studyframes
-*/
-const QList<QAD_StudyFrame>& QAD_Study::getStudyFrames() const
-{
- return myStudyFrames;
-}
-
-/*!
- Returns the active study frame
-*/
-QAD_StudyFrame* QAD_Study::getActiveStudyFrame() const
-{
- return myActiveStudyFrame;
-}
-
-//=======================================================================//
-// Study properties //
-//=======================================================================//
-/*!
- Returns reference to supporting application
-*/
-QAD_Application* QAD_Study::getApp() const
-{
- return myApp;
-}
-
-/*!
- Returns the name of document ( filename without path and extension )
-*/
-const QString& QAD_Study::getTitle() const
-{
- return myTitle;
-}
-
-/*!
- Returns the absolute file path of this document
-*/
-const QString& QAD_Study::getPath() const
-{
- return myPath;
-}
-
-/*!
- Changes the name of document
-*/
-void QAD_Study::setTitle( const QString& path )
-{
- myPath = path;
-
- QString title = QAD_Tools::getFileNameFromPath( path, true );
- QAD_ASSERT_DEBUG_ONLY ( !title.isNull() );
-
- for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf ; sf = myStudyFrames.next() )
- {
- QString oldName = sf->title();
- int k = oldName.find( myTitle, 0, false );
- QString restName = ( oldName.length() > myTitle.length() + k) ?
- oldName.right(oldName.length() - (myTitle.length() + k) + 1) :
- QString( "" );
-
- if ( k != -1 )
- {
- QString newName;
- if ( k == 0 ) {
- int l = restName.find( "#", 0, false );
- int ll = restName.length();
- newName = title + restName.mid( l, ll-l );
- } else {
- newName = oldName.mid(0, k);
- newName = newName + title + restName;
- }
- sf->setTitle( newName );
- }
- }
- myTitle = title;
-
- Selection( QAD_Application::getDesktop()->getActiveComponent() );
-}
-
-/*!
- Returns whether the document is active
-*/
-bool QAD_Study::isActive() const
-{
- return myIsActive;
-}
-
-/*!
- Returns whether the document is read only
-*/
-bool QAD_Study::isReadOnly() const
-{
- return myIsReadOnly;
-}
-
-/*!
- Sets read-only property
-*/
-void QAD_Study::setReadOnly(bool state)
-{
- myIsReadOnly = state;
-}
-
-bool QAD_Study::isLocked()
-{
- bool state = false;
- if ( !CORBA::is_nil( myStudy ) )
- state = myStudy->GetProperties()->IsLocked();
- return state;
-}
-
-//=======================================================================//
-// Study operations //
-//=======================================================================//
-/*!
- Performs specific study frame related actions when it is activated.
- By default resumes all suspended operations.
-*/
-void QAD_Study::onStudyFrameActivated( QAD_StudyFrame* activeStudyFrame )
-{
-// static int IS_FIRST_STUDY = 1;
-// if(IS_FIRST_STUDY){ //for normally initialize "salome.py and ..."
-// _interp->run(""); IS_FIRST_STUDY = 0;
-// }
-// bool found = false;
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- if ( it.current() == activeStudyFrame) { /* one of my study frames */
-// found = true;
-// if ( !myActiveStudyFrame || myActiveStudyFrame != activeStudyFrame ) {
- myActiveStudyFrame = activeStudyFrame;
- //NRI if ( !myIsActive ) {
- myIsActive = true;
- resumeAllOperations();
- /* activate application */
- myApp->onStudyActivated( this );
- //NRI }
-// }
-// return;
- }
- }
-// if (!found)
-// myActiveStudyFrame = 0;
-}
-
-
-/*!
- Performs specific study related actions when it is deactivated.
- By default suspends all performing operations.
-*/
-void QAD_Study::onStudyDeactivated()
-{
- // MESSAGE ("QAD_Study::onStudyDeactivated init. ");
- myIsActive = false;
- suspendAllOperations();
- // MESSAGE ("QAD_Study::onStudyDeactivated done. ");
-}
-
-/*!
- Closes all study frames of the study and performs other specific study
- related actions needed for proper closing of the study
-*/
-void QAD_Study::close()
-{
- emit closed();
- if ( !myStudy->_is_nil() )
- abortAllOperations();
- /* clear each study frame */
- for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf; sf = myStudyFrames.first() ) {
- sf->disconnect();
- sf->close();
- // SAL2200
- QApplication::sendPostedEvents();
- removeStudyFrame(sf);
- }
-
- /* delete all studyframes */
- myStudyFrames.clear();
- myOperations.clear();
- myChildWidgets.clear();
-
-// QWorkspace* ws = QAD_Application::getDesktop()->getMainFrame();
-// if (/* !ws->activeWindow() && */ws->windowList().count() > 0 )
-// ws->activateWindow(ws->windowList().last());
-}
-
-//=======================================================================//
-// Operations management //
-//=======================================================================//
-/*!
- Returns number of completed operations
-*/
-int QAD_Study::getOperationsCount() const
-{
- return myOperations.count();
-}
-
-/*!
- Returns the state of the last operation
-*/
-OperationState QAD_Study::getOperationState() const
-{
- return myOperationState;
-}
-
-/*!
- Returns operation by its index in list
-*/
-QAD_Operation* QAD_Study::getOperation( unsigned i)
-{
- return ( myOperations.isEmpty() ? 0 : myOperations.at(i) );
-}
-
-/*!
- Returns performing operation launched first
-*/
-QAD_Operation* QAD_Study::getFirstOperation()
-{
- return ( myOperations.isEmpty() ? 0 : myOperations.first() );
-}
-
-/*!
- Returns performing operation launched last
-*/
-QAD_Operation* QAD_Study::getLastOperation()
-{
- return ( myOperations.isEmpty() ? 0 : myOperations.last() );
-}
-
-/*!
- Aborts all performing operations
-*/
-void QAD_Study::abortAllOperations()
-{
- for ( QAD_Operation* op = myOperations.last(); op;
- op = myOperations.prev() )
- op->abort();
-}
-
-/*!
- Resumes all performing operations
-*/
-void QAD_Study::resumeAllOperations()
-{
- for ( QAD_Operation* op = myOperations.first(); op;
- op = myOperations.next() )
- op->resume();
-}
-
-/*!
- Suspendes all performing operations
-*/
-void QAD_Study::suspendAllOperations()
-{
- // MESSAGE ( " QAD_Study::suspendAllOperations init. " )
- for ( QAD_Operation* op = myOperations.last(); op;
- op = myOperations.prev() )
- op->suspend();
-}
-
-/*!
- Initializes the operation and checks its compatibility
- with another operation in process if any.
- Returns 'true' if init'ed OK, 'false' otherwise.
-*/
-bool QAD_Study::initOperation( QAD_Operation* op )
-{
- if ( myIsReadOnly )
- { /* can't start a non-const operation */
- if ( op->changesData() )
- {
- QAD_MessageBox::error1( QAD_Application::getDesktop(), tr("ERR_ERROR"),
- tr("ERR_DOC_READONLY"), tr("BUT_OK") );
- return false;
- }
- }
-
- /* Add the new operation
- */
- if ( myOperations.isEmpty() )
- myOperations.append( op );
- else
- {
- /* Check compatibility of new operation with the existing operations.
- Since each operations is checked in that way, it's enough to check
- the last operation only */
- if ( !getLastOperation()->compatibleWith( op ) )
- {
- if ( QAD_MessageBox::warn2( QAD_Application::getDesktop(), tr("WRN_WARNING"),
- tr("QUE_ABORTCURRENTOPERATION"), tr("BUT_YES"),
- tr("BUT_NO"), QAD_YES, QAD_NO, QAD_NO )
- == QAD_NO )
- return false;
- getLastOperation()->abort();
- }
- myOperations.append( op );
- }
- return true;
-}
-
-/*!
- Called when operation was finished.
- Removes appointed operation from the list and aborted all operations
- launched after it.
-*/
-void QAD_Study::clearOperation( QAD_Operation* op)
-{
- if ( myOperations.contains( op ) )
- {
- /* abort all the operations launched after 'op' */
- for ( QAD_Operation* cur = myOperations.last(); cur;
- cur = myOperations.prev() )
- {
- if ( cur == op ) break;
- cur->abort();
- }
- myOperations.remove( op );
- }
-}
-
-/*!
- Creates study frame
-*/
-QAD_StudyFrame* QAD_Study::createStudyFrame( const QString& title, ViewType theViewType)
-{
- QAD_Desktop* parent = QAD_Application::getDesktop();
-//srn: Forbid appending Interface Applicative and its children to UseCase
- myStudy->EnableUseCaseAutoFilling(false);
-
- SALOMEDS::SComponent_var father = myStudy->FindComponent("Interface Applicative");
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeComment_var aComment;
- SALOMEDS::AttributeSelectable_var aSelAttr;
-
-// mpv : where is "NewCommand" call?
-// aStudyBuilder->CommitCommand();
-
-// mpv : is study is locked, then next code will raise exception. So, temporary unlock study
- int aLocked = myStudy->GetProperties()->IsLocked();
- if (aLocked) myStudy->GetProperties()->SetLocked(false);
-
- if ( father->_is_nil() ) {
- father = aStudyBuilder->NewComponent("Interface Applicative");
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("Interface Applicative");
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
-
- //VRV: T2.5 - add default viewer
- if(theViewType == VIEW_TYPE_MAX) {
- QString viewerValue = QAD_CONFIG->getSetting( "Viewer:DefaultViewer" );
- bool ok;
- theViewType = (ViewType)viewerValue.toInt( &ok, 10 );
- if (!ok || theViewType < VIEW_OCC || theViewType >= VIEW_TYPE_MAX)
- theViewType = VIEW_VTK;
- }
- //QApplication::restoreOverrideCursor();
- QAD_StudyFrame* sf = NULL;
- SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father);
- if ( theViewType == VIEW_OCC) {
- // MESSAGE ("Create Study Frame for OCC viewer");
- sf = new QAD_StudyFrame ( this, parent->getMainFrame(),
- title, VIEW_OCC,
- myInterp, myMutex );
-
- Standard_CString name = CORBA::string_dup(sf->title().latin1());
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(name);
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("OCC");
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
- else if ( theViewType == VIEW_VTK) {
- // MESSAGE ("Create Study Frame for VTK viewer");
- sf = new QAD_StudyFrame ( this, parent->getMainFrame(),
- title, VIEW_VTK,
- myInterp, myMutex );
- Standard_CString name = strdup(sf->title().latin1());
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(name);
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("VTK");
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
- else if ( theViewType == VIEW_GRAPHSUPERV) {
- //MESSAGE ("Create Study Frame for SUPER`VISOR Graph");
- sf = new QAD_StudyFrame ( this, parent->getMainFrame(),
- title, VIEW_GRAPHSUPERV,
- myInterp, myMutex );
- Standard_CString name = strdup(sf->title().latin1());
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(name);
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("GRAPH");
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
- else if ( theViewType == VIEW_PLOT2D ) {
- sf = new QAD_StudyFrame ( this, parent->getMainFrame(),
- title, VIEW_PLOT2D,
- myInterp, myMutex );
- Standard_CString name = strdup(sf->title().latin1());
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(name);
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("PLOT2D");
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
- }
- //VRV: T2.5 - add default viewer
-
- sf->resize( int (0.8*parent->getMainFrame()->width()),
- int (0.8*parent->getMainFrame()->height() ));
-
- sf->setEntry(newObj->GetID());
-
- addStudyFrame( sf );
-
- updateObjBrowser( true );
-
- parent->setSettings();
-
- myResult = true;
-
- if (aLocked) myStudy->GetProperties()->SetLocked(true);
-
- // T2.12 - add the word "locked" to study frame captions if this study is locked
- updateCaptions();
-
- myStudy->EnableUseCaseAutoFilling(true);
-
- return sf;
-}
-
-/*!
- Updates study frame captions according to IsLocked study flag
-*/
-void QAD_Study::updateCaptions()
-{
- QString appendix("");
-
- if (!myStudy->_is_nil()) {
- SALOMEDS::AttributeStudyProperties_var propAttr = myStudy->GetProperties();
-/*
- if (!propAttr->_is_nil() ) {
- if ( propAttr->IsModified() )
- appendix += " (" + tr("PRP_STUDY_MODIFIED") + ")";
- else
- appendix += " (" + tr("PRP_STUDY_SAVED") + ")";
- }
-
-*/
- if (!propAttr->_is_nil() && propAttr->IsLocked()) {
- appendix += " (" + tr("PRP_STUDY_LOCKED") + ")";
- }
- }
-
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->setCaption(it.current()->title() + appendix);
- }
-
-}
-
-/*!
- Shows the active study frame.
- Called by Desktop after 'new' and 'open' commands.
-*/
-void QAD_Study::show()
-{
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->show();
- }
-}
-
-//=======================================================================//
-// Study properties (CAF related) //
-//=======================================================================//
-
-/*!
- Returns connected SALOMEDS_Study object
-*/
-SALOMEDS::Study_var QAD_Study::getStudyDocument()
-{
- return myStudy;
-}
-
-/*!
- Returns whether the document was saved in file
-*/
-bool QAD_Study::isSaved() const
-{
- return myStudy->IsSaved();
-}
-
-/*!
- Returns whether the document is modified
-*/
-bool QAD_Study::isModified() const
-{
-// return myStudy->IsModified(); // VSR:05/12/02 - USE PROPERTY : MODIFIED FLAG
- if ( !myStudy->_is_nil() ) {
- SALOMEDS::AttributeStudyProperties_var propAttr = myStudy->GetProperties();
- if ( !propAttr->_is_nil() )
- return propAttr->IsModified();
- }
- return false;
-}
-
-bool QAD_Study::undo()
-{
- try {
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- SB->Undo();
-
- /* Update Object Browser */
- updateObjBrowser( true );
-
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- /* Update Viewer */
- it.current()->getRightFrame()->getViewFrame()->undo( this, it.current()->entry() );
- }
- updateCaptions();
-
- // mpv 07.03.2003 SAL1805: clear selection must be called after study structure changed
- SALOME_Selection* Sel = SALOME_Selection::Selection( getSelection() );
- Sel->ClearIObjects();
- }
- // mpv : undo command can raise exception, if study is locked
- catch ( SALOMEDS::StudyBuilder::LockProtection& ) {
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- return false;
- }
- catch ( Standard_Failure ) {
- return false; }
- return true;
-}
-
-/*!
- Redo last undo
-*/
-bool QAD_Study::redo()
-{
- try {
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- SB->Redo();
-
- /* Update Object Browser */
- updateObjBrowser( true );
-
- /* Update Viewer */
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->getRightFrame()->getViewFrame()->redo( this, it.current()->entry() );
- }
- updateCaptions();
-
- // mpv 07.03.2003 SAL1805: clear selection must be called after study structure changed
- SALOME_Selection* Sel = SALOME_Selection::Selection( getSelection() );
- Sel->ClearIObjects();
- }
- // mpv : redo command can raise exception, if study is locked
- catch ( SALOMEDS::StudyBuilder::LockProtection& ) {
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- return false;
- }
- catch ( Standard_Failure ) {
- return false; }
- return true;
-}
-
-/*!
- Check if possible to perform 'undo' command
-*/
-bool QAD_Study::canUndo() const
-{
- if ( myStudy->_is_nil() )
- return false;
-
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- return (SB->GetAvailableUndos() > 0 );
-}
-
-/*!
- Check if possible to perform 'redo' command
-*/
-bool QAD_Study::canRedo() const
-{
- if ( myStudy->_is_nil() )
- return false;
-
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- return (SB->GetAvailableRedos() > 0 );
-}
-
-/*!
- Called when operation is started
- Returns 'true' if started OK, 'false' otherwise.
-*/
-bool QAD_Study::onOperationStarted( QAD_Operation* op )
-{
- if ( !initOperation( op ) )
- return false;
-
- try
- { /* start a new transaction */
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- SB->NewCommand();
- }
- catch ( Standard_Failure )
- {
- /* May be, a transaction is already open,
- it's not a problem */
- }
- myOperationState = Started;
- return true;
-}
-
-/*!
- Called when operation is finished
-*/
-void QAD_Study::onOperationFinished( QAD_Operation* op )
-{
- try {
- /* transaction is completed OK */
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- SB->CommitCommand();
- }
- catch ( SALOMEDS::StudyBuilder::LockProtection& ) {
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- onOperationAborted(op);
- updateObjBrowser( true );
- return;
- }
- catch ( Standard_Failure ) {
- }
- myOperationState = Finished;
- emit docOperationTerminated( true ); /* terminated successfully */
-
- updateCaptions();
- // mpv: any operation must call this method, otherwise study may not be saved
- updateObjBrowser( true );
-
- clearOperation( op ); /* we don't need the operation anymore */
- QAD_Application::getDesktop()->putInfo ( tr("INF_DOC_OPERATIONFINISHED") );
-}
-
-/*!
- Called when operation is suspended
-*/
-void QAD_Study::onOperationSuspended( QAD_Operation* op )
-{
- myOperationState = Suspended;
-}
-
-/*!
- Called when operation is resumed
-*/
-void QAD_Study::onOperationResumed( QAD_Operation* op )
-{
- myOperationState = Resumed;
-}
-
-/*!
- Called when operation is aborted
-*/
-void QAD_Study::onOperationAborted(QAD_Operation* op)
-{
- try {
- /* abort transaction */
- SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder();
- SB->AbortCommand();
- }
- catch ( Standard_Failure )
- {
- }
- myOperationState = Aborted;
- emit docOperationTerminated( false ); /* aborted */
-
- updateCaptions();
-
- clearOperation(op);
- QAD_Application::getDesktop()->putInfo ( tr("INF_DOC_OPERATIONABORTED") );
-}
-
-/*!
- Call when the last study frame is closing
-*/
-void QAD_Study::onLastStudyFrameClosing( QAD_StudyFrame* sf )
-{
- if ( myStudyFrames.count() == 1 ) {
- emit docClosing( this );
- } else
- removeStudyFrame( sf );
-
-// QWorkspace* ws = QAD_Application::getDesktop()->getMainFrame();
-// if ( !ws->activeWindow() && ws->windowList().count() > 0 )
-// ws->activatePreviousWindow();
-}
-
-/*!
- Call when created a new window3d
-*/
-QAD_StudyFrame* QAD_Study::newWindow3d(QString name, ViewType theViewType, bool toShow)
-{
- if(name == "") name = getNextStudyFrameName();
- QAD_StudyFrame* sf = createStudyFrame( name, theViewType );
- if ( myResult ) {
- if (toShow) showFrame(sf);
- // sf->compressLeft(); /* compress LeftFrame */
- sf->getRightFrame()->compressBottom(); /* compress BottomFrame */
- return sf;
- }
- return 0;
-}
-
-void QAD_Study::showFrame(QAD_StudyFrame* theFrame){
- theFrame->resize( (int)(0.64*QAD_Application::getDesktop()->getMainFrame()->width()),
- (int)(0.64*QAD_Application::getDesktop()->getMainFrame()->height()));
- theFrame->show();
-
-}
-
-
-
-/*!
- Call when setted a message
-*/
-void QAD_Study::setMessage(const char* message)
-{
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->getRightFrame()->getMessage()->setMessage(message);
- }
-}
-
-/*!
- Call when updated object browser
-*/
-void QAD_Study::updateObjBrowser( bool updateSelection )
-{
- QAD_Desktop* parent = QAD_Application::getDesktop();
- SALOME_ModuleCatalog::ModuleCatalog_var Catalog = parent->getCatalogue();
-
- QString ActiveComp = parent->getActiveComponent();
-
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->getLeftFrame()->getObjectBrowser()->Update();
- }
-
- /* update selection */
- if ( updateSelection && (myStudyFrames.count() > 0) ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- if ( Sel->AddIObject( It.Value() ) == 0 ) {
- highlight( It.Value(), true, false );
- }
- }
- }
- /* update viewers */
- update3dViewers();
-}
-
-/*!
- Updates only Use Case Browser
-*/
-void QAD_Study::updateUseCaseBrowser( bool updateSelection )
-{
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->getLeftFrame()->getObjectBrowser()->UpdateUseCaseBrowser();
- }
- /* update selection */
- if ( updateSelection && (myStudyFrames.count() > 0) ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for(;It.More();It.Next()) {
- if ( Sel->AddIObject( It.Value() ) == 0 ) {
- highlight( It.Value(), true, false );
- }
- }
- /* update viewers */
- update3dViewers();
- }
-}
-
-/*!
- unHighlight All Interactive Objects in All Devices
-*/
-void QAD_Study::unHighlightAll()
-{
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- /* Device = Viewers */
- it.current()->getRightFrame()->getViewFrame()->unHighlightAll();
-
- /* Device = ObjectBrowser */
- it.current()->getLeftFrame()->getObjectBrowser()->unHighlightAll();
- }
-}
-
-/*!
- Returns type of Interactive Object
-*/
-int QAD_Study::typeIObject( const Handle(SALOME_InteractiveObject)& IObject )
-{
- bool IsStudyObject = isInStudy( IObject );
- bool IsGraphicalObject = isInViewer( IObject );
-
- // MESSAGE ( "IsStudyObject : " << IsStudyObject )
- // MESSAGE ( "IsGraphicalObject : " << IsGraphicalObject )
-
- if ( IsStudyObject ) {
- if ( IsGraphicalObject )
- return 1; /* StudyObject and GraphicalObject */
- else
- return 2; /* only StudyObject */
- } else {
- if ( IsGraphicalObject )
- return 3; /* only GraphicalObject */
- else
- return 4; /* may be a component */
- }
- return 0;
-}
-
-
-/*!
- Renames the Interactive Object in All Devices
-*/
-void QAD_Study::renameIObject( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
-{
- if (myStudy->GetProperties()->IsLocked()) {
- QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK"));
- return;
- }
-
- highlight( IObject, false );
-
- int nbFrames = myStudyFrames.count();
- for ( int i = 0; i < nbFrames; i++ ) {
- QAD_StudyFrame* sf = myStudyFrames.at( i );
- switch ( typeIObject(IObject) ) {
- case 1:
- {
- /* Device = Viewers */
- sf->getRightFrame()->getViewFrame()->rename(IObject, newName);
- /* Device = ObjectBrowser */
- sf->getLeftFrame()->getObjectBrowser()->rename(IObject, newName);
- break;
- }
- case 2:
- {
- /* Device = ObjectBrowser */
- sf->getLeftFrame()->getObjectBrowser()->rename(IObject, newName);
- break;
- }
- case 3:
- {
- /* Device = Viewers */
- sf->getRightFrame()->getViewFrame()->rename(IObject, newName);
- break;
- }
- case 4:
- {
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
- if ( !ActiveComp.isEmpty() ) {
- sf->getLeftFrame()->getObjectBrowser()->rename(IObject,newName);
- }
- break;
- }
- }
- }
-
- /* SALOMEDS */
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- SALOMEDS::SObject_var obj = myStudy->FindObjectID( IObject->getEntry() );
- if ( !obj->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- anAttr = aStudyBuilder->FindOrCreateAttribute(obj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(newName.latin1());
- }
-
- // VSR 13/03/03 - rename Interactive object
- IObject->setName( ( char* )newName.latin1() );
-
- updateObjBrowser( true );
-}
-
-/*!
- Selects the Interactive Object in All Devices
-*/
-void QAD_Study::highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight,bool immediatly )
-{
- // MESSAGE ( " QAD_Study::highlight : " << highlight )
- int typeIO = typeIObject( IObject );
-
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- switch ( typeIO ) {
- case 1:
- {
- /* Device = Viewer */
- if (it.current()->getTypeView() >= 0 ) { /* Device = Viewers */
- it.current()->getRightFrame()->getViewFrame()->highlight(IObject, highlight, immediatly);
- }
- /* Device = ObjectBrowser */
- it.current()->getLeftFrame()->getObjectBrowser()->highlight(IObject, highlight);
- break;
- }
- case 2:
- {
- /* Device = ObjectBrowser */
- it.current()->getLeftFrame()->getObjectBrowser()->highlight(IObject, highlight);
- break;
- }
- case 3:
- {
- /* Device = Viewer */
- if (it.current()->getTypeView() >= 0) { /* Device = Viewers */
- it.current()->getRightFrame()->getViewFrame()->highlight(IObject, highlight, immediatly);
- }
- break;
- }
- case 4:
- {
- QString ActiveComp = QAD_Application::getDesktop()->getActiveComponent();
- if ( !ActiveComp.isEmpty() ) {
- it.current()->getLeftFrame()->getObjectBrowser()->highlight(IObject,highlight);
- }
- break;
- }
- }
- }
-}
-
-/*!
- Returns TRUE if the IObject is a Study Object. Returns FALSE otherwise.
-*/
-bool QAD_Study::isInStudy( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return IObject->hasEntry();
-}
-
-/*!
- Returns true if the IObject has a Graphical Object. Returns FALSE otherwise.
-*/
-bool QAD_Study::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
-{
- bool found = false;
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- found = it.current()->getRightFrame()->getViewFrame()->isInViewer(IObject);
- if ( found )
- return true;
- }
- return found;
-}
-
-/*!
- Returns true if the IObject has a Graphical Object into studyframe. Returns FALSE otherwise.
-*/
-bool QAD_Study::isInViewer(const char* anEntry, const char* StudyFrameEntry)
-{
- SALOMEDS::SObject_var RefSO;
- SALOMEDS::SObject_var SO = myStudy->FindObjectID(StudyFrameEntry);
- SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(SO);
- for (; it->More();it->Next()){
- SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->ReferencedObject(RefSO))
- if ( strcmp( anEntry, RefSO->GetID() ) == 0 )
- return 1;
- }
- return 0;
-}
-
-
-/*!
- Returns title for the new studyframe window
-*/
-QString QAD_Study::getNextStudyFrameName()
-{
- QString numStudyFrame;
- numStudyFrame.sprintf("%s%d", "#", ++myStudyFrameCount );
- return myTitle + numStudyFrame; /* return unique name ( title + unique number) */
-}
-
-
-/*!
- Returns the Python interpreter that belongs to this study
-*/
-QAD_PyInterp* QAD_Study::get_PyInterp(void)
-{
- return myInterp;
-}
-
-/*!
- Sets current selection.
-*/
-void QAD_Study::Selection( QString aSelection )
-{
- if ( !SALOME_Selection::FindSelection( QString(myTitle + "_" + aSelection) ) )
- SALOME_Selection::CreateSelection( QString(myTitle + "_" + aSelection) );
-
- SALOME_Selection* Sel = SALOME_Selection::Selection( QString(myTitle + "_" + aSelection) );
-
- mySelection = aSelection;
-}
-
-/*!
- Returns the name of current selection
-*/
-QString QAD_Study::getSelection() const
-{
- return QString (myTitle + "_" + mySelection);
-}
-
-/*!
- Returns the study Id.
-*/
-int QAD_Study::getStudyId()
-{
- return myStudy->StudyId();
-}
-
-void QAD_Study::update3dViewers()
-{
- for ( QPtrListIterator<QAD_StudyFrame> it( myStudyFrames ); it.current(); ++it ) {
- it.current()->getRightFrame()->getViewFrame()->Repaint();
- }
-}
-
-/* Adds new child window */
-void QAD_Study::addChildWidget( QWidget* child )
-{
- if ( myChildWidgets.findRef( child ) < 0 ) {
- myChildWidgets.append( child );
- child->installEventFilter( this );
- }
-}
-
-/*!
- Removes child window from the list ( and deletes it )
-*/
-void QAD_Study::removeChildWidget( QWidget* child )
-{
- myChildWidgets.removeRef( child );
-}
-
-/* Event filter */
-bool QAD_Study::eventFilter( QObject* o, QEvent* e)
-{
- int index = myChildWidgets.findRef( ( QWidget* )o );
- if ( index >= 0 && e->type() == QEvent::Close ) {
- myChildWidgets.at( index )->removeEventFilter( this );
- myChildWidgets.remove( ( QWidget* )o );
- return TRUE;
- }
- return QObject::eventFilter( o, e );
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Study.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_STUDY_H
-#define QAD_STUDY_H
-
-#include "QAD_Operation.h"
-#include "QAD_StudyFrame.h"
-
-#include "SALOME_InteractiveObject.hxx"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-// QT Includes
-#include <qdict.h>
-#include <qobject.h>
-#include <qstring.h>
-
-class QAD_Application;
-
-class QMutex;
-class QAD_PyInterp;
-class TInitStudyThread;
-class QAD_ViewFrame;
-
-class QAD_EXPORT QAD_Study : public QObject
-{
- Q_OBJECT
-
-public:
- QAD_Study(QAD_Application* app,
- SALOMEDS::Study_var aStudy,
- const QString& title);
- virtual void Init();
- ~QAD_Study();
-
- /* Event filter */
- bool eventFilter( QObject* o, QEvent* e);
-
-public:
- /* studyframes management */
- QAD_StudyFrame* createStudyFrame(const QString& name, ViewType theViewType = VIEW_TYPE_MAX);
- void removeStudyFrame( QAD_StudyFrame* );
- int getStudyFramesCount() const;
- const QList<QAD_StudyFrame>& getStudyFrames() const;
- QAD_StudyFrame* getStudyFrameByName( const QString& name );
- QAD_StudyFrame* getFirstStudyFrame();
- QAD_StudyFrame* getLastStudyFrame();
- QAD_StudyFrame* getStudyFrame( unsigned i );
- QAD_StudyFrame* getActiveStudyFrame() const;
-
- bool getResult();
-
- /* document state management */
- bool isActive() const;
- bool isSaved() const;
- bool isModified() const;
- bool isReadOnly() const;
- void setReadOnly(bool state);
- bool isLocked();
- const QString& getTitle() const;
- int getStudyId();
- const QString& getPath() const;
- void setTitle( const QString& title);
- void updateCaptions();
- void close();
- QAD_Application* getApp() const;
-
- /* visualization */
- void show();
-
- /* operation management */
- OperationState getOperationState() const;
- int getOperationsCount() const;
- QAD_Operation* getOperation( unsigned i );
- QAD_Operation* getFirstOperation();
- QAD_Operation* getLastOperation();
-
- void abortAllOperations();
- void resumeAllOperations();
- void suspendAllOperations();
-
- bool onOperationStarted( QAD_Operation* );
- void onOperationFinished( QAD_Operation* );
- void onOperationSuspended( QAD_Operation* );
- void onOperationResumed( QAD_Operation* );
- void onOperationAborted( QAD_Operation* );
-
- /* standard CAF document */
- SALOMEDS::Study_var getStudyDocument();
-
- bool undo();
- bool redo();
- bool canUndo() const;
- bool canRedo() const;
-
- QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
- void showFrame(QAD_StudyFrame* theFrame);
-
- void setMessage(const char* message);
-
- void updateObjBrowser( bool updateSelection = true );
- void updateUseCaseBrowser( bool updateSelection = true );
- void update3dViewers();
-
- /* interactive object management */
- void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly=true );
- void unHighlightAll();
-
- void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
- int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
-
- bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
- bool isInViewer(const char* anEntry,
- const char* StudyFrameEntry);
-
- /* selection */
- void Selection( QString aSelection );
- QString getSelection() const;
-
- /* python interpreter */
- QAD_PyInterp* get_PyInterp(void);
-
- QString getNextStudyFrameName();
-
- /* Child widgets handling (not QAD_StudyFrame) */
- void addChildWidget( QWidget* child );
- void removeChildWidget( QWidget* child );
-
-signals:
- void docClosing( QAD_Study* );
- void docOperationTerminated( bool );
- void closed();
- void supervStudyFrameClosing( QAD_ViewFrame* );
-
-public slots:
- void onStudyFrameActivated( QAD_StudyFrame* );
- void onStudyDeactivated();
- void onLastStudyFrameClosing( QAD_StudyFrame* );
-
-private:
- void addStudyFrame( QAD_StudyFrame* );
- bool initOperation( QAD_Operation* );
- void clearOperation( QAD_Operation* );
-
-private:
- SALOMEDS::Study_var myStudy;
-
- QList<QAD_Operation> myOperations;
- OperationState myOperationState;
-
- QAD_Application* myApp;
- QList<QAD_StudyFrame> myStudyFrames;
- QAD_StudyFrame* myActiveStudyFrame;
- int myStudyFrameCount;
-
- QList<QWidget> myChildWidgets;
-
- QString myPath;
- QString myTitle;
-
- QString mySelection;
-
- bool myIsActive;
- bool myIsSaved;
- bool myIsModified;
- bool myIsReadOnly;
- bool myResult;
-
- QMutex* myMutex;
- QAD_PyInterp* myInterp;
- TInitStudyThread* myInitStudyThread;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_StudyFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_StudyFrame QAD_StudyFrame.h
- \brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
-*/
-
-#include "QAD_StudyFrame.h"
-#include "QAD_StudyFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_Splitter.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_PyInterp.h"
-
-#include <qvaluelist.h>
-
-using namespace std;
-
-/*!
- Constructor
-*/
-QAD_StudyFrame::QAD_StudyFrame(QAD_Study* theStudy, QWidget* theParent,
- const QString& theTitle, ViewType theTypeView,
- QAD_PyInterp*& theInterp, QMutex* theMutex):
- QMainWindow( theParent , theTitle, WStyle_NormalBorder |
- WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
- myTitle(theTitle),
- myEntry(""),
- myTypeView(theTypeView),
- myStudy(theStudy),
- myInterp(theInterp)
-{
- setCaption( myTitle );
- setPalette(QAD_Application::getPalette());
-
- mySplitter = new QAD_Splitter( Qt::Horizontal, this);
- mySplitter->setCompressEnabled( true );
-
- setCentralWidget(mySplitter);
- myLeftFrm = new QAD_LeftFrame(myStudy->getStudyDocument(), mySplitter, theTitle );
- myRightFrm = new QAD_RightFrame( mySplitter, theTitle, myTypeView, myInterp, theMutex);
-
- QValueList<int> sizes;
- sizes.append( (int)(0.30*QAD_Application::getDesktop()->getMainFrame()->width()) );
- sizes.append( (int)(0.50*QAD_Application::getDesktop()->getMainFrame()->width()) );
- mySplitter->setSizes( sizes );
-
- QAD_ASSERT_DEBUG_ONLY ( theParent->inherits("QWorkspaceP") );
- QAD_ASSERT ( QObject::connect( (QWorkspaceP*)theParent, SIGNAL(windowActivated(QWidget*)),
- this, SLOT(onStudyFrameActivated(QWidget*))) );
-}
-
-
-/*!
- Destructor
-*/
-QAD_StudyFrame::~QAD_StudyFrame()
-{
-}
-
-/*!
- Returns the rightframe of this frame
-*/
-QAD_RightFrame* QAD_StudyFrame::getRightFrame() const
-{
- return myRightFrm;
-}
-
-/*!
- Returns the leftframe of this frame
-*/
-QAD_LeftFrame* QAD_StudyFrame::getLeftFrame() const
-{
- return myLeftFrm;
-}
-
-/*!
- Returns 'true' if studyframe is visible
-*/
-void QAD_StudyFrame::setVisible( bool visible )
-{
- if ( visible == isVisible() )
- return;
-
- if ( visible ) show();
- else hide();
-}
-
-/*!
- Called when StudyFrame is about to close
-*/
-void QAD_StudyFrame::closeEvent(QCloseEvent* e)
-{
- if ( IsPyLocked() ) {
- e->ignore();
- return;
- }
-
- emit sfStudyFrameClosing(this);
-}
-
-/*!
- Call when
- */
-void QAD_StudyFrame::compressLeft()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
- if( h )
- h->compressBefore();
-}
-
-void QAD_StudyFrame::compressRight()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
- if( h )
- h->compressAfter();
-}
-
-void QAD_StudyFrame::unCompressLeft()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
- if( h )
- h->unCompressBefore();
-}
-
-void QAD_StudyFrame::unCompressRight()
-{
- QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
- if( h )
- h->unCompressAfter();
-}
-
-bool QAD_StudyFrame::isCompressedLeft() const
-{
- return mySplitter->isCompressed(myLeftFrm);
-}
-
-bool QAD_StudyFrame::isCompressedRight() const
-{
- return mySplitter->isCompressed(myRightFrm);
-}
-
-/*!
- Returns the title of studyframe
-*/
-const QString& QAD_StudyFrame::title() const
-{
- return myTitle;
-}
-
-/*!
- Sets the new title of studyframe
-*/
-void QAD_StudyFrame::setTitle( const QString& title )
-{
- myTitle = title;
- setCaption( myTitle );
-}
-
-/*!
- Returns the entry of studyframe
-*/
-const QString& QAD_StudyFrame::entry() const
-{
- return myEntry;
-}
-
-/*!
- Sets the new entru of studyframe
-*/
-void QAD_StudyFrame::setEntry( const QString& entry )
-{
- myEntry = entry;
-}
-
-ViewType QAD_StudyFrame::getTypeView() const
-{
- return myTypeView;
-}
-
-/*!
- The slot is called when a studyframe is activated
-*/
-void QAD_StudyFrame::onStudyFrameActivated ( QWidget* activeWindow )
-{
- emit sfStudyFrameActivated( (QAD_StudyFrame*) activeWindow );
- getRightFrame()->getViewFrame()->Activate( getStudy() );
-}
-
-/*!
- Returns the Python interpreter that belongs to this study
-*/
-QAD_PyInterp* QAD_StudyFrame::get_PyInterp(void)
-{
- return myInterp;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_StudyFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_StudyFrame_H
-#define QAD_StudyFrame_H
-
-#include "QAD.h"
-
-// QT Includes
-#include <qwidget.h>
-#include <qmainwindow.h>
-
-class QMutex;
-
-class QAD_RightFrame;
-class QAD_LeftFrame;
-class QAD_Splitter;
-class QAD_Study;
-class QAD_PyInterp;
-
-enum ViewType {
- VIEW_OCC,
- VIEW_VTK,
- VIEW_GRAPHSUPERV,
- VIEW_PLOT2D,
- VIEW_TYPE_MAX // must always be the last one; insert new values before it
-};
-
-class QAD_EXPORT QAD_StudyFrame: public QMainWindow
-{
- Q_OBJECT
-
- public:
- QAD_StudyFrame(QAD_Study* theStudy, QWidget* theParent,
- const QString& theTitle, ViewType theTypeView,
- QAD_PyInterp*& theInterp, QMutex* theMutex);
- virtual ~QAD_StudyFrame();
-
- QAD_Study* getStudy() { return myStudy; }
- QAD_RightFrame* getRightFrame() const;
- QAD_LeftFrame* getLeftFrame() const;
-
- ViewType getTypeView() const;
-
- QAD_PyInterp* get_PyInterp(void);
-
- void setTitle( const QString& aTitle);
- const QString& title() const;
-
- void setEntry( const QString& aTitle);
- const QString& entry() const;
-
- void setVisible( bool isVisible = true );
-
- void compressLeft();
- void compressRight();
- void unCompressLeft();
- void unCompressRight();
-
- bool isCompressedLeft() const;
- bool isCompressedRight() const;
-
- signals:
- void sfStudyFrameActivated( QAD_StudyFrame* );
- void sfStudyFrameClosing( QAD_StudyFrame*);
-
- public slots:
- void onStudyFrameActivated ( QWidget* );
-
- protected:
- virtual void closeEvent ( QCloseEvent* );
-
-
- private:
- QString myTitle; /* title */
- QString myEntry; /* entry */
-
- ViewType myTypeView;
- QAD_LeftFrame* myLeftFrm;
- QAD_RightFrame* myRightFrm;
- QAD_Splitter* mySplitter;
- QAD_Study* myStudy;
- QAD_PyInterp*& myInterp;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Tools.cxx
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-/*!
- \class QAD_Tools QAD_Tools.h
- \brief Helpful functions for QAD.
-*/
-
-#include "QAD_Tools.h"
-#include "utilities.h"
-
-// QT Inlcude
-#include <qwidget.h>
-#include <qfileinfo.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <qstringlist.h>
-using namespace std;
-
-static char* tempName()
-{
- static char tempDir[512];
- strcpy ( tempDir, getenv ("tmp") );
-
-#if defined WNT
- if ( tempDir[ strlen(tempDir)-1 ] != '\\' )
- strcat ( tempDir,"\\");
-#else
- if ( tempDir[ strlen(tempDir)-1 ] != '/' )
- strcat ( tempDir,"/");
-#endif
- strcat ( tempDir,"Salome_trace");
- return tempDir;
-}
-
-/*!
- Returns max 'int' value [ static ]
-*/
-inline int QAD_Tools::getMax(int v1, int v2)
-{
- return v1 >= v2 ? v1 : v2;
-}
-
-/*!
- Returns min 'int' value [ static ]
-*/
-inline int QAD_Tools::getMin(int v1, int v2)
-{
- return v1 <= v2 ? v1 : v2;
-}
-
-/*!
- [ static ]
- Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
- and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )
-*/
-QRect QAD_Tools::makeRect(int x1, int y1, int x2, int y2)
-{
- QRect aRect;
- aRect.setRect( getMin(x1, x2), getMin(y1, y2), abs(x2-x1), abs(y2-y1));
- return aRect;
-}
-
-/*!
- Traces output to log-file. [ static ]
- If log is NULL, 'Salome_trace' file is created in temp directory.
- Log file is written in 'append' mode.
-*/
-void QAD_Tools::trace (const char* lpszLog, const char* lpszFormat, ... )
-{
- static char* lpszTmp = tempName();
-
- FILE* pStream;
- pStream = fopen ( lpszLog ? lpszLog : lpszTmp, "a" );
- if ( pStream )
- {
- va_list argptr;
- va_start(argptr, lpszFormat);
- //NRI vfprintf ( pStream, lpszFormat, argptr);
- fprintf ( pStream, "- Trace %s [%d] : %s", __FILE__, __LINE__, lpszFormat);
- va_end(argptr);
- fclose ( pStream );
- }
-}
-
-/*!
- Parses the path to select the dir name only [ static ].
- Returns NULL if the path is empty (null).
- NB: Unix-style slashes are assumed in 'path'
-*/
-QString QAD_Tools::getDirFromPath ( const QString& path, bool absPath )
-{
- return QFileInfo( path ).dirPath( absPath );
-}
-
-
-/*!
- Parses the path to select the file name with or without extension [ static ].
-*/
-QString QAD_Tools::getFileNameFromPath( const QString& path,
- bool withExtension )
-{
- if ( withExtension )
- return QFileInfo( path ).fileName();
- else
- return QFileInfo( path ).baseName();
-}
-
-/*!
- Parses the path to select the file extension [ static ].
-*/
-QString QAD_Tools::getFileExtensionFromPath( const QString& path )
-{
- return QFileInfo( path ).extension(false);
-}
-
-/*!
- Adds a slash to the end of 'path' if it is not already there [ static ]
-*/
-QString QAD_Tools::addSlash( const QString& path )
-{
- if (!path.isNull()) {
-#ifdef WNT
- QChar slash ('\\');
-#else
- QChar slash ('/');
-#endif
- if ( path.at(path.length()-1) != slash )
- return path + slash;
- }
- return path;
-}
-
-/*!
- Converts slashes from unix-like to win-like [ static ]
- Returns null string if 'path' is empty or null.
-*/
-QString QAD_Tools::unix2win( const QString& path )
-{
- QString ret = path;
-#ifdef WNT
- int pos;
- QChar winSlash ('\\'), unixSlash('/');
- for ( int start = 0;
- (pos = path.find( unixSlash, start, false )) >= 0;
- start = pos + 1 )
- {
- ret.replace( pos, 1, &winSlash, 1 );
- }
-#endif
- return ret;
-}
-/*!
- Centers widget 'w' as refered to widget 'ref' [ static ]
-*/
-void QAD_Tools::centerWidget( QWidget* src, const QWidget* ref )
-{
- QAD_Tools::alignWidget(src, ref, Qt::AlignCenter);
-}
-
-/*!
- Aligns widget 'w' as refered to widget 'ref' [ static ]
-*/
-void QAD_Tools::alignWidget ( QWidget* src, const QWidget* ref, int alignFlags )
-{
- if ( !src || !ref || !alignFlags ) return;
-
- QPoint srcOri = src->mapToGlobal( QPoint( 1, 1 ) );
- QPoint refOri = ref->mapToGlobal( QPoint( 1, 1 ) );
-
- int x = srcOri.x(), y = srcOri.y();
- int refWidth = ref->width(), refHei = ref->height();
- int srcWidth = src->width(), srcHei = src->height();
- if ( srcWidth <= 1 )
- srcWidth = src->sizeHint().width();
- if ( srcHei <= 1 )
- srcHei = src->sizeHint().height();
-
- if ( alignFlags & AlignLeft )
- x = refOri.x();
- if ( alignFlags & AlignRight )
- x = refOri.x() + refWidth - srcWidth;
- if ( alignFlags & AlignTop )
- y = refOri.y();
- if ( alignFlags & AlignBottom )
- y = refOri.y() + refHei - srcHei;
- if ( alignFlags & AlignHCenter )
- x = refOri.x() + ( refWidth - srcWidth ) / 2;
- if ( alignFlags & AlignVCenter )
- y = refOri.y() + ( refHei - srcHei ) / 2;
-
- if ( src->parentWidget() && /* we move a widget inside its parent */
- !src->inherits( "QDialog" )) /* dialogs use global coordinates */
- {
- QPoint pos = src->parentWidget()->mapFromGlobal( QPoint(x,y) );
- x = pos.x(); y = pos.y();
- }
-#ifdef WNT
- x -= 4; /* - frame border width ( approx. ) */
- y -= 30; /* - caption height ( approx. ) */
-#endif
-
- src->move( x, y );
-}
-
-/*!
- Converts TCollection_ExtendedString to QString
-*/
-QString QAD_Tools::toQString( const TCollection_ExtendedString& extString)
-{
- QString result = QString ( (const QChar*) extString.ToExtString(),
- extString.Length() );
- return result;
-}
-
-/*!
- Converts QString to TCollection_ExtendedString
-*/
-TCollection_ExtendedString QAD_Tools::toExtString( const QString& qString)
-{
- TCollection_ExtendedString result;
- for ( int i = 0; i < (int)qString.length(); i++ )
- result.Insert( i + 1, qString[ i ].unicode() );
- return result;
-}
-
-/*!
- Converts TCollection_AsciiString to QString
-*/
-QString QAD_Tools::toQString( const TCollection_AsciiString& asciiString)
-{
- QString result = QString ( asciiString.ToCString() );
- return result;
-}
-
-/*!
- Converts QString to TCollection_AsciiString
-*/
-TCollection_AsciiString QAD_Tools::toAsciiString( const QString& qString)
-{
- TCollection_AsciiString result = TCollection_AsciiString((char*)(qString.latin1()));
- return result;
-}
-
-/*!
- Creates font from string description
-*/
-QFont QAD_Tools::stringToFont( const QString& fontDescription )
-{
- QFont font;
- if ( fontDescription.stripWhiteSpace().isEmpty() || !font.fromString( fontDescription ) )
- font = QFont( "Courier", 11 );
- return font;
-}
-
-/*!
- Creates font's string description
-*/
-QString QAD_Tools::fontToString( const QFont& font )
-{
- return font.toString();
-}
-
-/*!
- Checks popup menu recursively for unnecessary separators and removes them
-*/
-void QAD_Tools::checkPopup( QPopupMenu* popup )
-{
- if ( popup->count() > 0 ) {
- QValueList<int> idRemove;
- for ( int i = 1; i < popup->count(); i++ ) {
- if ( popup->findItem( popup->idAt( i ) )->isSeparator() ) {
- if ( popup->findItem( popup->idAt( i-1 ) )->isSeparator() )
- idRemove.append( popup->idAt( i ) );
- }
- else {
- QPopupMenu* child = popup->findItem( popup->idAt( i ) )->popup();
- if ( child ) {
- checkPopup( child );
- }
- }
- }
- for ( int i = 0; i < idRemove.count(); i++ )
- popup->removeItem( idRemove[i] );
- if ( popup->count() > 0 && popup->findItem( popup->idAt( 0 ) )->isSeparator() )
- popup->removeItem( popup->idAt( 0 ) );
- if ( popup->count() > 0 && popup->findItem( popup->idAt( popup->count()-1 ) )->isSeparator() )
- popup->removeItem( popup->idAt( popup->count()-1 ) );
- }
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_Tools.h
-// Author : UI team
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_TOOLS_H
-#define QAD_TOOLS_H
-
-#include "QAD.h"
-#include <qrect.h>
-#include <qstring.h>
-#include <qfont.h>
-#include <qpopupmenu.h>
-#include <TCollection_ExtendedString.hxx>
-#include <TCollection_AsciiString.hxx>
-
-class QAD_EXPORT QAD_Tools : public Qt
-{
-public:
- /* min/max functions */
- static int getMax(int v1, int v2);
- static int getMin(int v1, int v2);
-
- /* makes rectangle */
- static QRect makeRect(int x1, int y1, int x2, int y2);
-
- /* trace function */
- static void trace (const char* pLog, const char* szFormat, ... );
-
- /* path functions */
- static QString getDirFromPath( const QString& path, bool absPath = true );
- static QString getFileNameFromPath( const QString& path, bool withExtension = true );
- static QString getFileExtensionFromPath( const QString& path );
- static QString addSlash( const QString& path );
- static QString unix2win( const QString& path );
-
- /* aligning widget in 'ref' widget */
- static void centerWidget( QWidget* src, const QWidget* ref );
- static void alignWidget ( QWidget* src, const QWidget* ref, int alignFlags = AlignCenter );
-
- /* converting strings */
- static QString toQString ( const TCollection_ExtendedString& extString);
- static TCollection_ExtendedString toExtString ( const QString& qString);
- static QString toQString ( const TCollection_AsciiString& asciiString);
- static TCollection_AsciiString toAsciiString( const QString& qString);
-
- static QFont stringToFont( const QString& fontDescription );
- static QString fontToString( const QFont& font );
-
- /* popup menu optimization */
- static void checkPopup( QPopupMenu* popup );
-};
-
-#endif
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ViewFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "QAD.h"
-#include "QAD_ViewFrame.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Tools.h"
-#include <qapplication.h>
-#include <qimage.h>
-#include "utilities.h"
-
-using namespace std;
-
-/*!
- Constructor
-*/
-QAD_ViewFrame::QAD_ViewFrame(QWidget* parent, const QString& title)
- : QMainWindow (parent, title, 0)
-{
-}
-
-/*!
- Constructor
-*/
-QAD_ViewFrame::QAD_ViewFrame( QWidget* parent )
- : QMainWindow (parent, "",0)
-{
-}
-
-/*!
- Destructor
-*/
-QAD_ViewFrame::~QAD_ViewFrame()
-{
- cleanup();
-}
-
-/*!
- Cleanup viewframe
-*/
-void QAD_ViewFrame::cleanup()
-{
-}
-
-/*
- Dumps 3d-Viewer contents into image file
- File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
-*/
-void QAD_ViewFrame::onViewDump()
-{
- if (!getViewWidget())
- return;
-
- QApplication::setOverrideCursor( Qt::waitCursor );
- QPixmap px = QPixmap::grabWindow(getViewWidget()->winId());
- QApplication::restoreOverrideCursor();
-
- QString fileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- QString::null,
- tr("OCC_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if (!fileName.isNull()) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = QAD_Tools::getFileExtensionFromPath(fileName).upper();
- if (fmt.isEmpty())
- fmt = QString("BMP"); // default format
- if (fmt == "JPG")
- fmt = "JPEG";
- bool bOk = px.save(fileName, fmt.latin1());
- QApplication::restoreOverrideCursor();
- if (!bOk) {
- QAD_MessageBox::error1(QAD_Application::getDesktop(),
- tr("ERR_ERROR"),
- tr("ERR_DOC_CANT_SAVE_FILE"),
- tr("BUT_OK"));
- }
- }
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_ViewFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_ViewFrame_H
-#define QAD_ViewFrame_H
-
-#include "QAD.h"
-#include "QAD_Application.h"
-#include "QAD_StudyFrame.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Selection.h"
-#include "SALOME_Prs.h"
-
-class QAD_Study;
-
-// QT Include
-#include <qmainwindow.h>
-
-
-class QAD_EXPORT QAD_ViewFrame : public QMainWindow, public SALOME_View
-{
- Q_OBJECT
-
-public:
- QAD_ViewFrame(QWidget* parent, const QString& title);
- QAD_ViewFrame(QWidget* parent = 0);
- virtual ~QAD_ViewFrame();
-
- void cleanup();
-
- virtual ViewType getTypeView() const = 0;
- virtual QWidget* getViewWidget() = 0;
-
- virtual void setBackgroundColor( const QColor& ) = 0;
- virtual QColor backgroundColor() const = 0;
-
- virtual void SetSelectionMode( Selection_Mode mode ) = 0;
-
- virtual void onAdjustTrihedron() = 0;
-
- /* popup management */
- virtual void setPopupServer( QAD_Application* ) = 0;
-
- /* interactive object management */
- virtual void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly = true ) = 0;
- virtual void unHighlightAll() = 0;
- virtual void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName ) = 0;
- virtual bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
- virtual bool isVisible( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
-
- /* undo/redo management */
- virtual void undo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
- virtual void redo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
-
- /* selection */
- virtual Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) = 0;
-
- /* display */
- virtual void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true) = 0;
- virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject) = 0;
- virtual void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true) = 0;
- virtual void DisplayAll() = 0;
- virtual void EraseAll() = 0;
- virtual void Repaint() = 0;
-
- /* activation */
- virtual void Activate( QAD_Study* ) {}
- // this method is called when parent window of view frame is activated
-
-public slots:
- /* basic view operations,
- most of them are pure virtual
- and should be redefined in derived classes
- */
- virtual void onViewPan() = 0;
- virtual void onViewZoom() = 0;
- virtual void onViewFitAll() = 0;
- virtual void onViewFitArea() = 0;
- virtual void onViewGlobalPan() = 0;
- virtual void onViewRotate() = 0;
- virtual void onViewReset() = 0;
- virtual void onViewFront() = 0;
- virtual void onViewBack() = 0;
- virtual void onViewRight() = 0;
- virtual void onViewLeft() = 0;
- virtual void onViewBottom() = 0;
- virtual void onViewTop() = 0;
- virtual void onViewTrihedron() = 0;
- virtual void onViewDump();
-
- /* view incremental transformation operations.
- virtual, can be redefined in derived classes
- */
- virtual void onPanLeft() {}
- virtual void onPanRight() {}
- virtual void onPanUp() {}
- virtual void onPanDown() {}
- virtual void onZoomIn() {}
- virtual void onZoomOut() {}
- virtual void onRotateLeft() {}
- virtual void onRotateRight() {}
- virtual void onRotateUp() {}
- virtual void onRotateDown() {}
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QAD_WaitCursor.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef QAD_WAITCURSOR_H
-#define QAD_WAITCURSOR_H
-
-#include <qapplication.h>
-#include "QAD.h"
-
-class QAD_EXPORT QAD_WaitCursor {
- public:
-// constructor
- QAD_WaitCursor() : myStarted( false ), myDepth( 1 ) { start(); }
-// destructor
- ~QAD_WaitCursor() { if ( !myStarted ) { myDepth--; start(); } else { QApplication::restoreOverrideCursor(); } }
-
-// sets WAIT cursor if not set yet
- void start() { if ( !myStarted ) { while( myDepth-- ) QApplication::setOverrideCursor( Qt::waitCursor ); myStarted = true; } myDepth = 0; }
-// clears WAIT cursor if set
- void stop() { if ( myStarted ) { while( QApplication::overrideCursor() ) { QApplication::restoreOverrideCursor(); myDepth++; } myStarted = false; } }
-// returns true if WAIT cursor is active
- bool isStarted() { return myStarted; }
-
- private:
- bool myStarted;
- int myDepth;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_XmlHandler.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#define INCLUDE_MENUITEM_DEF
-
-#include "QAD_Desktop.h"
-#include "QAD_XmlHandler.h"
-#include "QAD_ListMenuIdAction.h"
-#include "QAD_Menus.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Tools.h"
-#include "QAD_Resource.h"
-
-// QT Include
-#include <qaccel.h>
-#include <qstringlist.h>
-#include <qfileinfo.h>
-using namespace std;
-
-map<int,QString> QAD_XmlHandler::_bibmap;
-
-static const char* SEPARATOR = ":";
-
-static QString findFile( QString resDirs, QString fileName )
-{
- QStringList dirList = QStringList::split( SEPARATOR, resDirs, false ); // skip empty entries
- for ( int i = 0; i < dirList.count(); i++ ) {
- QString dir = dirList[ i ];
- QFileInfo fi( QAD_Tools::addSlash( dir ) + fileName );
- if ( fi.isFile() && fi.exists() )
- return fi.filePath();
- }
- return QString();
-}
-
-/*!
- Constructor
-*/
-QAD_XmlHandler::QAD_XmlHandler()
-{
-}
-
-/*!
- Destructor
-*/
-QAD_XmlHandler::~QAD_XmlHandler()
-{
-}
-
-/*!
- Sets \a desktop widget which contains menubar.
-*/
-void QAD_XmlHandler::setMainWindow(QAD_Desktop* desktop)
-{
- myDesktop = desktop;
- myIdList = TColStd_SequenceOfInteger();
- myBackMenu = true;
- myBackPopupMenus.setAutoDelete(false);
-}
-
-/*!
- Returns TRUE if environment variable CSF_"Component"Resources is undefined.
- Returns FALSE otherwise.
-*/
-bool QAD_XmlHandler::setComponent (const QString& dirs )
-{
- myPathResources = dirs;
-
- return true ;
-}
-
-/*!
- Starts parsing of document. Does some initialization
-
- Reimplemented from QXmlDefaultHandler.
-*/
-bool QAD_XmlHandler::startDocument()
-{
- myErrorProt = "";
- return TRUE;
-}
-
-/*!
- Does different actions depending on the name of the tag and the
- state you are in document.
-
- Reimplemented from QXmlDefaultHandler.
-*/
-bool QAD_XmlHandler::startElement( const QString&, const QString&,
- const QString& qName,
- const QXmlAttributes& atts )
-{
- char Slot_Name[200];
-
- if ( qName == "application") {
- myMenus=new QAD_Menus(myDesktop);
- myMenusList.append(myMenus);
- } else if ( qName == "desktop" ) { //DESKTOP
- } else if ( qName == "menubar" ) { //MENUBAR
- QMenuBar* aMenuBar = myDesktop->menuBar(); /*new QMenuBar(myMainWindow);*/
- myMenus->myActiveMenuBar=aMenuBar;
- myMenus->append(aMenuBar);
- myMenus->myActiveMenuBar->hide();
-
- } else if ( qName == "menu-item" ) { //MENU-ITEM
- myBackMenu = true;
- QMenuItem* item = myMenus->myActiveMenuBar->findItem(atts.value( "item-id" ).toInt());
- if ( item ) {
- QPopupMenu* aMenuItem = item->popup();
- myMenus->myActivePopupMenu=aMenuItem;
- } else {
- QPopupMenu* aMenuItem=new QPopupMenu(myMenus->myActiveMenuBar);
- myMenus->myActivePopupMenu=aMenuItem;
- int id;
- int pos;
- if (atts.value( "pos-id" ).compare(QString(""))==0) {
- pos = -1;
- }
- else {
- pos = atts.value( "pos-id" ).toInt();
- if ( pos < 0 )
- pos = myMenus->myActiveMenuBar->count() + pos;
- }
- id = myMenus->myActiveMenuBar->insertItem( atts.value( "label-id" ),
- aMenuItem,
- atts.value( "item-id" ).toInt(),
- pos );
- myIdList.Append( id );
- }
- } else if ( qName == "popup-item" ) { //POPUP-ITEM
- QString aCommandID(atts.value( "item-id" ));
- int id;
- int pos;
- if (atts.value( "pos-id" ).compare(QString(""))==0) {
- pos = -1;
- }
- else {
- pos = atts.value( "pos-id" ).toInt();
- if ( pos < 0 )
- pos = myMenus->myActivePopupMenu->count() + pos;
- }
- if (atts.value( "icon-id").compare(QString(""))==0)
- if (atts.value( "execute-action" ).compare(QString(""))==0)
- id = myMenus->myActivePopupMenu->insertItem( atts.value( "label-id" ),
- myDesktop, SLOT (onDispatch( int )),
- QAccel::stringToKey(atts.value( "accel-id" )),
- aCommandID.toInt(),
- pos);
- else
- id = myMenus->myActivePopupMenu->insertItem( atts.value( "label-id" ),
- myDesktop, SLOT (onDispatchTools( int )),
- QAccel::stringToKey(atts.value( "accel-id" )),
- aCommandID.toInt(),
- pos);
-
- else
- if (atts.value( "execute-action" ).compare(QString(""))==0)
- id = myMenus->myActivePopupMenu->insertItem( QPixmap( findFile( myPathResources, atts.value( "icon-id" ) ) ),
- atts.value( "label-id" ),
- myDesktop, SLOT (onDispatch( int )),
- QAccel::stringToKey(atts.value( "accel-id" )),
- aCommandID.toInt(),
- pos );
- else
- id = myMenus->myActivePopupMenu->insertItem( QPixmap( findFile( myPathResources, atts.value( "icon-id") ) ),
- atts.value( "label-id" ),
- myDesktop, SLOT (onDispatchTools( int )),
- QAccel::stringToKey(atts.value( "accel-id" )),
- aCommandID.toInt(),
- pos);
- if (atts.value( "chaine")!=NULL) {
- QAD_XmlHandler::_bibmap[atts.value( "item-id").toInt()]=QString(atts.value( "chaine"));
-// SCRUTE(atts.value( "item-id").toInt() ) ;
-// SCRUTE(QAD_XmlHandler::_bibmap[atts.value( "item-id").toInt()] ) ;
- }
- if (atts.value( "toggle-id" ).compare(QString(""))!=0) {
- if (atts.value( "toggle-id" ).compare(QString("false"))==0) {
- myMenus->myActivePopupMenu->setItemChecked(id,false);
- }
- if (atts.value( "toggle-id" ).compare(QString("true"))==0) {
- myMenus->myActivePopupMenu->setItemChecked(id,true);
- }
- }
- myIdList.Append( id );
- myMenus->myActivePopupMenu->setItemParameter( id, aCommandID.toInt());
- } else if ( qName == "submenu" ) { //SUBMENU
- myBackPopupMenus.push(myMenus->myActivePopupMenu);
- QMenuItem* item = 0;
- if ( myBackMenu )
- item = myMenus->myActivePopupMenu->findItem(atts.value( "item-id" ).toInt());
-
- QPopupMenu* aSubmenu = new QPopupMenu();
- if ( item ) {
- if (item->popup()) {
- aSubmenu=item->popup();
- //Enable submenu only if disable
- if (!myMenus->myActivePopupMenu->isItemEnabled( atts.value( "item-id" ).toInt()))
- myMenus->myActivePopupMenu->setItemEnabled( atts.value( "item-id" ).toInt(), true);
- }
- } else {
- aSubmenu=new QPopupMenu(myMenus->myActivePopupMenu);
- int id;
- int pos;
- if (atts.value( "pos-id" ).compare(QString(""))==0) {
- pos = -1;
- }
- else {
- pos = atts.value( "pos-id" ).toInt();
- if ( pos < 0 )
- pos = myMenus->myActivePopupMenu->count() + pos;
- }
- id = myMenus->myActivePopupMenu->insertItem(atts.value( "label-id" ),
- aSubmenu,atts.value( "item-id" ).toInt(),
- pos);
- myIdList.Append(id);
- }
- myMenus->myActivePopupMenu=aSubmenu;
- } else if ( qName == "endsubmenu" ) { //SUBMENU
- myMenus->myActivePopupMenu = myBackPopupMenus.pop();
- } else if ( qName == "popupmenu" ) { //POPUP MENU
- myBackMenu = false;
- QPopupMenu* aPopupMenu=new QPopupMenu;
- myMenus->myActivePopupMenu=aPopupMenu;
- aPopupMenu->insertItem( atts.value( "label-id" ), aPopupMenu, QAD_TopLabel_Popup_ID);
- QAD_ListPopupMenu* pmenu = new QAD_ListPopupMenu(myMenus->myActivePopupMenu,
- atts.value( "context-id" ),
- atts.value( "parent-id" ),
- atts.value( "object-id" ));
- myMenus->append(pmenu);
- } else if ( qName == "toolbar" ) { //TOOLBAR
- QToolBar* aToolBar=new QToolBar(atts.value( "label-id" ),myDesktop);
- aToolBar->setCloseMode( QDockWindow::Undocked );
- myMenus->append(aToolBar);
- myMenus->myActiveToolBar=aToolBar;
- myMenus->myActiveToolBar->hide();
- } else if ( qName == "toolbutton-item" ) { //TOOL BUTTON
- QString aQStringToolButtonItemId(atts.value( "item-id" ));
- QActionP* anAction=
- new QActionP
- (QObject::tr(atts.value( "label-id" )),
- QPixmap( findFile( myPathResources, atts.value( "icon-id") ) ),
- QObject::tr(atts.value( "label-id" )),
- QAccel::stringToKey(QObject::tr(atts.value( "accel-id" ))),
- myDesktop);
-
- anAction->setStatusTip(QObject::tr(atts.value( "tooltip-id" )));
- anAction->setToolTip(QObject::tr(atts.value( "tooltip-id" )));
- anAction->addTo(myMenus->myActiveToolBar);
- QAD_ListMenuIdAction* menu = new QAD_ListMenuIdAction(myMenus->myActivePopupMenu,
- aQStringToolButtonItemId.toInt(),
- anAction);
- myMenus->append(menu);
- QObject::connect(anAction,SIGNAL(activated()), myDesktop,SLOT(onDispatch( )));
- } else if (qName == "separatorTB") {
- myMenus->myActiveToolBar->addSeparator();
- } else if (qName == "separator") {
- int id;
- int pos;
- if (atts.value( "pos-id" ).compare(QString(""))==0) {
- pos = -1;
- }
- else {
- pos = atts.value( "pos-id" ).toInt();
- if ( pos < 0 )
- pos = myMenus->myActivePopupMenu->count() + pos;
- }
- id = myMenus->myActivePopupMenu->insertSeparator( pos );
- myIdList.Append(id);
- }else {
- // error
- return FALSE;
- }
- return TRUE;
-}
-
-
-/*!
- Reimplemented from QXmlDefaultHandler.
-*/
-bool QAD_XmlHandler::endElement( const QString&, const QString&, const QString& )
-{
- return TRUE;
-}
-
-
-/*!
- Reimplemented from QXmlDefaultHandler.
-*/
-bool QAD_XmlHandler::characters( const QString& ch )
-{
- // we are not interested in whitespaces
- QString ch_simplified = ch.simplifyWhiteSpace();
- if ( ch_simplified.isEmpty() )
- return TRUE;
- return TRUE;
-}
-
-
-/*!
- Returns the default error string.
-
- Reimplemented from QXmlDefaultHandler.
-*/
-QString QAD_XmlHandler::errorString()
-{
- return "the document is not in the quote file format";
-}
-
-/*!
- Returns exception
-
- Reimplemented from QXmlDefaultHandler.
-*/
-bool QAD_XmlHandler::fatalError( const QXmlParseException& exception )
-{
- myErrorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
- .arg( exception.message() )
- .arg( exception.lineNumber() )
- .arg( exception.columnNumber() );
-
- return QXmlDefaultHandler::fatalError( exception );
-}
-
-/*!
- Returns the error protocol if parsing failed
-
- Reimplemented from QXmlDefaultHandler.
-*/
-QString QAD_XmlHandler::errorProtocol()
-{
- return myErrorProt;
-}
-
-QString QAD_XmlHandler::givebib(const int mykey)
-{
- return QAD_XmlHandler::_bibmap[mykey];
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : QAD_XmlHandler.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include <qxml.h>
-#include <qstringlist.h>
-#include <qlist.h>
-#include <qstack.h>
-#include <map>
-
-#include <TColStd_SequenceOfInteger.hxx>
-
-class QAD_Desktop;
-class QAD_Menus;
-
-class QAD_XmlHandler : public QXmlDefaultHandler
-{
-public:
- QAD_XmlHandler();
- virtual ~QAD_XmlHandler();
-
- bool startDocument();
- bool startElement( const QString& namespaceURI, const QString& localName,
- const QString& qName, const QXmlAttributes& atts );
- bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName );
- bool characters( const QString& ch );
-
- QString errorString();
- QString errorProtocol();
- bool fatalError (const QXmlParseException& exception);
- QString givebib (const int mykey);
-
- void setMainWindow(QAD_Desktop*);
- bool setComponent (const QString& aComponent);
-
- QList<QAD_Menus> myMenusList;
- TColStd_SequenceOfInteger myIdList;
- QAD_Menus* myMenus;
-
- static map<int,QString> _bibmap;
-
-private:
- QString myErrorProt;
- QString myPathResources;
-
- bool myBackMenu;
- QStack<QPopupMenu> myBackPopupMenus;
-
- QAD_Desktop* myDesktop;
-};
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : QAD_icons.po
-# Module : SALOME
-
-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"
-
-#--------------
-# DESKTOP
-#--------------
-
-msgid "ICON_DESK_WINDOW_CASCADE"
-msgstr "cascade.png"
-
-msgid "ICON_DESK_WINDOW_TILE"
-msgstr "tile.png"
-
-#--------------
-# FILE
-#--------------
-
-msgid "ICON_FILE_NEW"
-msgstr "new.png"
-
-msgid "ICON_FILE_OPEN"
-msgstr "open.png"
-
-msgid "ICON_FILE_LOAD"
-msgstr "open.png"
-
-msgid "ICON_FILE_SAVE"
-msgstr "save.png"
-
-msgid "ICON_FILE_CLOSE"
-msgstr "close.png"
-
-#--------------
-# HELP
-#--------------
-
-msgid "ICON_HELP"
-msgstr "help.png"
-
-msgid "QAD_HelpWindow::ICON_APP_HELP_BACK"
-msgstr "back.xpm"
-
-msgid "QAD_HelpWindow::ICON_APP_HELP_FORWARD"
-msgstr "forward.xpm"
-
-msgid "QAD_HelpWindow::ICON_APP_HELP_HOME"
-msgstr "home.xpm"
-
-#--------------
-# VIEW
-#--------------
-
-msgid "ICON_PRINT"
-msgstr "print.png"
-
-msgid "ICON_RESET"
-msgstr "reset.png"
-
-#--------------
-# APPLICATION
-#--------------
-
-msgid "ICON_APP_EDIT_UNDO"
-msgstr "undo.png"
-
-msgid "ICON_APP_EDIT_REDO"
-msgstr "redo.png"
-
-msgid "ICON_APP_EDIT_COPY"
-msgstr "copy.png"
-
-msgid "ICON_APP_EDIT_PASTE"
-msgstr "paste.png"
-
-#--------------
-# DIALOGS
-#--------------
-
-msgid "ICON_DIRLIST_INSERT"
-msgstr "dl_insert.png"
-
-msgid "ICON_DIRLIST_DELETE"
-msgstr "dl_delete.png"
-
-msgid "ICON_DIRLIST_MOVEUP"
-msgstr "dl_moveup.png"
-
-msgid "ICON_DIRLIST_MOVEDOWN"
-msgstr "dl_movedown.png"
-
-#-----------------
-# USE CASE BROWSER
-#-----------------
-
-msgid "ICON_UC_ADD"
-msgstr "uc_add.png"
-
-msgid "ICON_UC_REMOVE"
-msgstr "uc_del.png"
-
-msgid "ICON_UC_SET_CURRENT"
-msgstr "uc_current.png"
-
-msgid "ICON_UC_NEW"
-msgstr "uc_new.png"
-
-msgid "ICON_UC_CLEAR"
-msgstr "uc_clear.png"
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : QAD_msg_en.po
-# Module : SALOME
-
-msgid ""
-msgstr ""
-"Project-Id-Version: example-Qt-message-extraction\n"
-"POT-Creation-Date: 1999-02-23 15:38+0200\n"
-"PO-Revision-Date: 2004-04-26 16:29+0400\n"
-"Last-Translator: \n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#---------------
-# BUTTONS
-#---------------
-
-msgid "BUT_CANCEL"
-msgstr "Cancel"
-
-msgid "BUT_HELP"
-msgstr "Help"
-
-msgid "BUT_OK"
-msgstr "Ok"
-
-msgid "BUT_NO"
-msgstr "No"
-
-msgid "BUT_YES"
-msgstr "Yes"
-
-#---------------
-# INFORMATIONS
-#---------------
-
-#: QAD_Desktop.cxx:1152
-msgid "Desktop_AppSelectionDlg::INF_DESK_DOC_CREATE"
-msgstr "Create a new study"
-
-#: QAD_Desktop.cxx:722
-msgid "INF_CANCELLED"
-msgstr "Cancelled"
-
-#: QAD_Desktop.cxx:605
-msgid "INF_READY"
-msgstr "Ready"
-
-#: QAD_Desktop.cxx:605
-msgid "INF_RESOURCES"
-msgstr "Check your resources installation."
-
-#: QAD_Desktop.cxx:605
-msgid "INF_ICON_RESOURCES"
-msgstr "Could not find icon file %1 for module %2.\n"
-
-#: QAD_Desktop.cxx:551
-msgid "INF_DESK_DOC_OPEN"
-msgstr "Open study"
-
-#: QAD_Desktop.cxx:654
-msgid "INF_DESK_DOC_SAVE"
-msgstr "Save study"
-
-#: QAD_Desktop.cxx:465
-msgid "QAD_Desktop::INF_DESK_EXIT"
-msgstr "Exit"
-
-#: QAD_Desktop.cxx:530
-msgid "QAD_Desktop::INF_DOC_CREATING"
-msgstr "Creating study "
-
-#: QAD_Desktop.cxx:558
-msgid "QAD_Desktop::INF_DOC_OPENING"
-msgstr "Opening study "
-
-#: QAD_Desktop.cxx:691
-msgid "QAD_Desktop::INF_DOC_SAVED"
-msgstr "Study %1 saved"
-
-#: QAD_Desktop.cxx:679
-msgid "QAD_Desktop::INF_DOC_SAVING"
-msgstr "Saving study "
-
-#: QAD_Desktop.cxx:993
-msgid "QAD_Desktop::INF_PARSE_ERROR"
-msgstr "Parse error"
-
-#: QAD_Study.cxx:570
-msgid "QAD_Study::INF_DOC_OPERATIONABORTED"
-msgstr "Operation aborted"
-
-#: QAD_Study.cxx:539
-msgid "QAD_Study::INF_DOC_OPERATIONFINISHED"
-msgstr "Operation finished"
-
-#: *.cxx:855
-msgid "INF_APP_EXPORT"
-msgstr "Image Files"
-
-#---------------
-# MENUS
-#---------------
-
-#: QAD_Desktop.cxx:19
-msgid "QAD_Desktop::MEN_OPENWITH"
-msgstr "Open With..."
-
-#: QAD_Desktop.cxx:407
-msgid "QAD_Desktop::MEN_DESK_EDIT"
-msgstr "&Edit"
-
-#: QAD_Desktop.cxx:138
-msgid "QAD_Desktop::MEN_DESK_FILE"
-msgstr "&File"
-
-#: QAD_Desktop.cxx:176
-msgid "QAD_Desktop::MEN_DESK_FILE_CLOSE"
-msgstr "&Close"
-
-#: QAD_Desktop.cxx:206
-msgid "QAD_Desktop::MEN_DESK_FILE_EXIT"
-msgstr "E&xit"
-
-#: QAD_Desktop.cxx:155
-msgid "QAD_Desktop::MEN_DESK_FILE_NEW"
-msgstr "&New"
-
-#: QAD_Desktop.cxx:166
-msgid "QAD_Desktop::MEN_DESK_FILE_OPEN"
-msgstr "&Open ..."
-
-#: QAD_Desktop.cxx:166
-msgid "QAD_Desktop::MEN_DESK_FILE_LOAD"
-msgstr "&Load ..."
-
-#: QAD_Desktop.cxx:187
-msgid "QAD_Desktop::MEN_DESK_FILE_SAVE"
-msgstr "&Save"
-
-#: QAD_Desktop.cxx:195
-msgid "QAD_Desktop::MEN_DESK_FILE_SAVEAS"
-msgstr "Save As ..."
-
-#: QAD_Desktop.cxx:141
-msgid "QAD_Desktop::MEN_DESK_HELP"
-msgstr "&Help"
-
-#: QAD_Desktop.cxx:291
-msgid "QAD_Desktop::MEN_DESK_HELP_ABOUT"
-msgstr "&About ..."
-
-#: QAD_Desktop.cxx:265
-msgid "QAD_Desktop::MEN_DESK_HELP_CONTENTS"
-msgstr "&Contents"
-
-#: QAD_Desktop.cxx:265
-msgid "QAD_Desktop::MEN_DESK_HELP_MODULECONTENTS"
-msgstr "&Module Help"
-
-#: QAD_Desktop.cxx:265
-msgid "QAD_Desktop::MEN_DESK_HELP_TUICONTENTS"
-msgstr "&TUI Reference"
-
-#: QAD_Desktop.cxx:273
-msgid "QAD_Desktop::MEN_DESK_HELP_SEARCH"
-msgstr "&Search ..."
-
-#: QAD_Desktop.cxx:280
-msgid "QAD_Desktop::MEN_DESK_HELP_WHATSTHIS"
-msgstr "What's this?"
-
-#: QAD_Desktop.cxx:139
-msgid "QAD_Desktop::MEN_DESK_VIEW"
-msgstr "&View"
-
-#: QAD_Config.cxx:265
-msgid "MEN_DESK_PREF"
-msgstr "Preferences"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_SAVE"
-msgstr "Save"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_VIEWER"
-msgstr "Viewer background"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_VIEWER_TRIHEDRON"
-msgstr "Trihedron size"
-
-#: QAD_Desktop.cxx:747
-msgid "MEN_DESK_PREF_EXTERNAL_BROWSER"
-msgstr "External browser"
-
-msgid "MEN_DESK_PREF_DEFAULT_VIEWER"
-msgstr "Default viewer"
-
-#: QAD_Config.cxx:378
-msgid "MEN_DESK_PREF_VIEWER_OCC"
-msgstr "OCC Viewer"
-
-#: QAD_Config.cxx:383
-msgid "MEN_DESK_PREF_VIEWER_VTK"
-msgstr "VTK Viewer"
-
-#: QAD_Config.cxx:383
-msgid "MEN_DESK_PREF_GRAPH_SUPERVISOR"
-msgstr "Graph Supervisor"
-
-msgid "MEN_DESK_PREF_VIEWER_PLOT2D"
-msgstr "Plot2d Viewer"
-
-#: QAD_Config.cxx:378
-msgid "MEN_DESK_VIEW_OCC"
-msgstr "OCC View"
-
-#: QAD_Config.cxx:383
-msgid "MEN_DESK_VIEW_VTK"
-msgstr "VTK View"
-
-msgid "MEN_DESK_VIEW_PLOT2D"
-msgstr "Plot2d View"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER"
-msgstr "ObjectBrowser"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER_ENTRY"
-msgstr "Entry, IOR columns"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER_IAPP"
-msgstr "Interface Applicative"
-
-msgid "MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"
-msgstr "Chronological sort of objects"
-
-msgid "MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE"
-msgstr "Show UseCase Browser"
-
-msgid "MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE"
-msgstr "No autosize columns"
-
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_MODE"
-msgstr "Selection Mode"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_POINT"
-msgstr "Point"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_EDGE"
-msgstr "Link"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_CELL"
-msgstr "Cell"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_ACTOR"
-msgstr "Actor"
-
-#: QAD_Config.cxx:265
-msgid "MEN_DESK_TOOLS"
-msgstr "Tools"
-
-#: QAD_Desktop.cxx:228
-msgid "QAD_Desktop::MEN_DESK_VIEW_STATUSBAR"
-msgstr "&Status Bar"
-
-#: QAD_Desktop.cxx:217
-msgid "QAD_Desktop::MEN_DESK_VIEW_STDTOOLBAR"
-msgstr "Standard"
-
-#: SALOMEGUI_Application.cxx:82
-msgid "SALOMEGUI_Application::MEN_DESK_VIEWERTOOLBAR"
-msgstr "Viewer"
-
-#: QAD_Desktop.cxx:226
-msgid "QAD_Desktop::MEN_DESK_COMPONENTTOOLBAR"
-msgstr "Components"
-
-#: QAD_Desktop.cxx:140
-msgid "QAD_Desktop::MEN_DESK_WINDOW"
-msgstr "&Window"
-
-#: QAD_Desktop.cxx:248
-msgid "QAD_Desktop::MEN_DESK_WINDOW_CASCADE"
-msgstr "&Cascade"
-
-#: QAD_Desktop.cxx:240
-msgid "QAD_Desktop::MEN_DESK_WINDOW_NEW3D"
-msgstr "&New Window"
-
-#: QAD_Desktop.cxx:256
-msgid "QAD_Desktop::MEN_DESK_WINDOW_TILE"
-msgstr "&Tile"
-
-#: QAD_Application.cxx:175
-msgid "QAD_Application::MEN_APP_EDIT_REDO"
-msgstr "&Redo"
-
-#: QAD_Application.cxx:165
-msgid "QAD_Application::MEN_APP_EDIT_UNDO"
-msgstr "&Undo"
-
-#: QAD_Study.cxx:482
-msgid "QAD_Study::MEN_VIEWER"
-msgstr "Viewer"
-
-#: *.cxx:45
-msgid "MEN_VP3D_CHANGEBGR"
-msgstr "Change background..."
-
-msgid "MEN_APP_DISPLAY"
-msgstr "Display"
-
-msgid "MEN_APP_DISPLAY_ONLY"
-msgstr "Display only"
-
-msgid "MEN_APP_ERASE"
-msgstr "Erase"
-
-#---------------
-# PRP
-#---------------
-
-#: QAD_Desktop.cxx:177
-msgid "QAD_Desktop::PRP_DESK_FILE_CLOSE"
-msgstr "Closes the active study"
-
-#: QAD_Desktop.cxx:207
-msgid "QAD_Desktop::PRP_DESK_FILE_EXIT"
-msgstr "Exits the application"
-
-#: QAD_Desktop.cxx:156
-msgid "QAD_Desktop::PRP_DESK_FILE_NEW"
-msgstr "Creates a new study"
-
-#: QAD_Desktop.cxx:167
-msgid "QAD_Desktop::PRP_DESK_FILE_OPEN"
-msgstr "Opens an existing study"
-
-#: QAD_Desktop.cxx:167
-msgid "QAD_Desktop::PRP_DESK_FILE_LOAD"
-msgstr "Loads an existing study"
-
-#: QAD_Desktop.cxx:188
-msgid "QAD_Desktop::PRP_DESK_FILE_SAVE"
-msgstr "Saves the active study"
-
-#: QAD_Desktop.cxx:196
-msgid "QAD_Desktop::PRP_DESK_FILE_SAVEAS"
-msgstr "Saves the active study with a new name"
-
-#: QAD_Desktop.cxx:3759
-msgid "QAD_Desktop::PRP_DESK_FILE_IMPORT"
-msgstr "Import file"
-
-#: QAD_Desktop.cxx:3765
-msgid "QAD_Desktop::PRP_DESK_FILE_IMPORTMESH"
-msgstr "Import Mesh from file"
-
-#: QAD_Desktop.cxx:3765
-msgid "QAD_Desktop::PRP_DESK_FILE_IMPORTMED"
-msgstr "Import MED file"
-
-#: QAD_Desktop.cxx:3765
-msgid "QAD_Desktop::PRP_DESK_FILE_IMPORTTABLE"
-msgstr "Import TABLE from file"
-
-#: QAD_Desktop.cxx:3765
-msgid "QAD_Desktop::PRP_DESK_FILE_EXPLOREMEDFILE"
-msgstr "Explore MED file"
-
-#: QAD_Desktop.cxx:3771
-msgid "QAD_Desktop::PRP_DESK_FILE_IMPORTDF"
-msgstr "Import Dataflow from file"
-
-#: QAD_Desktop.cxx:3761
-msgid "QAD_Desktop::PRP_DESK_FILE_EXPORT"
-msgstr "Export file"
-
-#: QAD_Desktop.cxx:3761
-msgid "QAD_Desktop::PRP_DESK_FILE_EXPORTRESULT"
-msgstr "Export Result"
-
-#: QAD_Desktop.cxx:3773
-msgid "QAD_Desktop::PRP_DESK_FILE_EXPORTDF"
-msgstr "Export Dataflow"
-
-#: QAD_Desktop.cxx:3793
-msgid "QAD_Desktop::PRP_DESK_EDIT_DELETE"
-msgstr "Delete object"
-
-#: QAD_Desktop.cxx:3799
-msgid "QAD_Desktop::PRP_DESK_EDIT_NEWDF"
-msgstr "Creates new Dataflow"
-
-#: QAD_Desktop.cxx:3801
-msgid "QAD_Desktop::PRP_DESK_EDIT_MODIFYDF"
-msgstr "Modifies already existent Dataflow"
-
-#: QAD_Desktop.cxx:292
-msgid "QAD_Desktop::PRP_DESK_HELP_ABOUT"
-msgstr "Shows \'About\' dialog"
-
-#: QAD_Desktop.cxx:266
-msgid "QAD_Desktop::PRP_DESK_HELP_CONTENTS"
-msgstr "Shows the whole help contents"
-
-#: QAD_Desktop.cxx:266
-msgid "QAD_Desktop::PRP_DESK_HELP_GUICONTENTS"
-msgstr "Shows the GUI help contents"
-
-#: QAD_Desktop.cxx:266
-msgid "QAD_Desktop::PRP_DESK_HELP_TUICONTENTS"
-msgstr "Shows the TUI help contents"
-
-#: QAD_Desktop.cxx:274
-msgid "QAD_Desktop::PRP_DESK_HELP_SEARCH"
-msgstr "Searches help for a topic"
-
-#: QAD_Desktop.cxx:281
-msgid "QAD_Desktop::PRP_DESK_HELP_WHATSTHIS"
-msgstr "What's this?"
-
-msgid "QAD_Desktop::MEN_DESK_VIEW_TOOLBARS"
-msgstr "Toolbars"
-
-#: QAD_Desktop.cxx:230
-msgid "QAD_Desktop::PRP_DESK_VIEW_STATUSBAR"
-msgstr "Toggles status bar view on/off"
-
-#: QAD_Desktop.cxx:220
-msgid "QAD_Desktop::PRP_DESK_VIEW_TOOLBAR"
-msgstr "Toggles toolbar on/off"
-
-#: QAD_Desktop.cxx:220
-msgid "QAD_Desktop::PRP_DESK_VIEW_DISPLAYMODE"
-msgstr "Choose the display mode"
-
-#: QAD_Desktop.cxx:220
-msgid "QAD_Desktop::PRP_DESK_VIEW_UPDATE"
-msgstr "Update view"
-
-#: QAD_Desktop.cxx:871
-msgid "QAD_Desktop::PRP_DESK_WINDOW_ACTIVATE"
-msgstr "Activates this window"
-
-#: QAD_Desktop.cxx:249
-msgid "QAD_Desktop::PRP_DESK_WINDOW_CASCADE"
-msgstr "Arranges the windows as overlapping tiles"
-
-#: QAD_Desktop.cxx:257
-msgid "QAD_Desktop::PRP_DESK_WINDOW_TILE"
-msgstr "Arranges the windows as nonoverlapping tiles"
-
-#: QAD_Application.cxx:176
-msgid "QAD_Application::PRP_APP_EDIT_REDO"
-msgstr "Redoes the last operation"
-
-#: QAD_Application.cxx:166
-msgid "QAD_Application::PRP_APP_EDIT_UNDO"
-msgstr "Undoes the last operation"
-
-#: *.cxx:405
-msgid "PRP_VW3D_POINTCENTER"
-msgstr "Set a new center of the view with MB1"
-
-#: *.cxx:374
-msgid "PRP_VW3D_SKETCHAREA"
-msgstr "Sketch a rectangular area to fit the view"
-
-#---------------
-# TOOL TIP
-#---------------
-
-#: QAD_HelpWindow.cxx:57
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD"
-msgstr "Backward"
-
-#: QAD_HelpWindow.cxx:60
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD"
-msgstr "Forward"
-
-#: QAD_HelpWindow.cxx:63
-msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME"
-msgstr "Home"
-
-msgid "QAD_HelpWindow::QAD_HELP_CONTENTS"
-msgstr "Contents"
-
-#: QAD_Application.cxx:173
-msgid "QAD_Application::TOT_APP_EDIT_REDO"
-msgstr "Redo last operation"
-
-#: QAD_Application.cxx:163
-msgid "QAD_Application::TOT_APP_EDIT_UNDO"
-msgstr "Undo last operation"
-
-#: QAD_Desktop.cxx:153
-msgid "QAD_Desktop::TOT_DESK_FILE_NEW"
-msgstr "New study"
-
-#: QAD_Desktop.cxx:165
-msgid "QAD_Desktop::TOT_DESK_FILE_OPEN"
-msgstr "Open study"
-
-#: QAD_Desktop.cxx:165
-msgid "QAD_Desktop::TOT_DESK_FILE_LOAD"
-msgstr "Load study"
-
-#: QAD_Desktop.cxx:186
-msgid "QAD_Desktop::TOT_DESK_FILE_SAVE"
-msgstr "Save study"
-
-#---------------
-# ERROR
-#---------------
-
-#: *.cxx:233
-msgid "QObject::ERR_VP_NOVIEW"
-msgstr "No View"
-
-#: QAD_Desktop.cxx:516
-msgid "QAD_Desktop::ERR_APP_NOAPP"
-msgstr "No application"
-
-#: QAD_Desktop.cxx:535
-msgid "QAD_Desktop::ERR_DOC_CANTCREATE"
-msgstr "Cannot create study"
-
-#: QAD_Desktop.cxx:586
-msgid "QAD_Desktop::ERR_DOC_CANTOPEN"
-msgstr "Cannot open study"
-
-#: QAD_Desktop.cxx:683
-msgid "QAD_Desktop::ERR_DOC_CANTWRITE"
-msgstr "Cannot save study"
-
-#: QAD_Desktop.cxx:599
-msgid "QAD_Desktop::ERR_DOC_UNKNOWNTYPE"
-msgstr "Unknown study type"
-
-#: QAD_Study.cxx:321
-msgid "QAD_Study::ERR_DOC_READONLY"
-msgstr "The study is read-only"
-
-#: QAD_Desktop.cxx:683
-msgid "ERR_ERROR"
-msgstr "Error"
-
-msgid "ERR_APP_EXCEPTION"
-msgstr "An exception has been caught. Click <OK> to continue."
-
-msgid "ERR_ONLY_PLOT2D_VIEWER"
-msgstr "This function is available only in Plot2d viewer"
-
-#: QAD_Desktop.cxx:2339
-msgid "ERR_LIBGUI"
-msgstr "lib%1GUI.so has not been found. Check LD_LIBRARY_PATH environment variable"
-
-msgid "ERR_GET_GUI_FAILED"
-msgstr "%1GUI instance creation failed!"
-
-msgid "ERR_GET_GUI_NOT_FOUND"
-msgstr "GetComponentGUI() function not found in %1 library!"
-
-msgid "ERR_EMPTY_COMP_NAME"
-msgstr "Component name not found for %1"
-
-msgid "ERR_COMP_DATA_NOT_LOADED"
-msgstr "Persistent data for %1 component has not been loaded!\nProbably, persistent data file is missing or corrupted.\nThe component will be deactivated."
-
-#---------------
-# QUESTION
-#---------------
-
-#: QAD_Study.cxx:335
-msgid "QAD_Study::QUE_ABORTCURRENTOPERATION"
-msgstr "The current operation is not terminated yet.\nDo you want to abort it ?"
-
-#: QAD_Desktop.cxx:465
-msgid "QAD_Desktop::QUE_DESK_EXIT"
-msgstr "Do you really want to quit ?"
-
-#: QAD_Desktop.cxx:569
-msgid "QAD_Desktop::QUE_DOC_ALREADYOPEN"
-msgstr "The study %1 is already open.\nDo you want to reload it ?"
-
-#: QAD_Desktop.cxx:569
-msgid "QAD_Desktop::QUE_DOC_ALREADYEXIST"
-msgstr "The study %1 already exists in study manager.\nDo you want to reload it ?"
-
-#: QAD_Desktop.cxx:668
-msgid "QUE_DOC_FILEEXISTS"
-msgstr "The file %1 already exists.\nDo you want to overwrite it ?"
-
-#: *.cxx:502
-#msgid "INF_READY"
-#msgstr "Ready"
-
-#: QAD_Desktop.cxx:710
-msgid "QAD_Desktop::QUE_DOC_NOTSAVED"
-msgstr "The study %1 is not saved.\nDo you want to save it ?"
-
-#---------------
-# WARNING
-#---------------
-
-#: *.cxx:374
-#msgid "PRP_VW3D_SKETCHAREA"
-#msgstr "Sketch a rectangular area to fit the view"
-
-#: *.cxx:709
-msgid "WRN_WARNING"
-msgstr "Warning"
-
-msgid "WRN_STUDY_LOCKED"
-msgstr "This study is locked and therefore cannot be modified"
-
-------
-
-#: QAD_Desktop.cxx:431
-msgid "QAD_Desktop::DESK_DEFAULTDOC"
-msgstr "Study"
-
-
-#: QAD_Desktop.cxx:920
-msgid "QAD_Desktop::DESK_FILES"
-msgstr "Files"
-
-msgid "OCC_IMAGE_FILES"
-msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"
-
-msgid "VTK_IMAGE_FILES"
-msgstr "Images Files (*.tif)"
-
-msgid "INF_APP_DUMP_VIEW"
-msgstr "Dump view"
-
-msgid "ERR_DOC_CANT_SAVE_FILE"
-msgstr "Cannot save file"
-
-msgid "EDIT_CUT_CMD"
-msgstr "Cu&t"
-
-msgid "EDIT_COPY_CMD"
-msgstr "&Copy"
-
-msgid "EDIT_PASTE_CMD"
-msgstr "&Paste"
-
-msgid "EDIT_CLEAR_CMD"
-msgstr "Clear"
-
-msgid "EDIT_SELECTALL_CMD"
-msgstr "Select All"
-
-msgid "MESSAGE_LOG_NAME"
-msgstr "Message Log"
-
-msgid "QAD_DirListDlg::QUICK_DIR_LIST_TLT"
-msgstr "Quick directory list"
-
-msgid "QAD_DirListDlg::EMPTY_DIR"
-msgstr "<empty>"
-
-msgid "QAD_DirListDlg::DIRECTORIES_LBL"
-msgstr "&Directories:"
-
-msgid "QAD_DirListDlg::ERR_DIRECTORY_SPECIFIED"
-msgstr "Directory already specified."
-
-msgid "QAD_DirListDlg::WRN_DIRECTORY_N0T_EXIST"
-msgstr "%1\n\nThe directory doesn't exist.\nAdd directory anyway?"
-
-msgid "QAD_DirListDlg::SELECT_DIRECTORY"
-msgstr "Select directory"
-
-msgid "ERR_DOC_FILENOTEXIST"
-msgstr "The file %1 doesn't exist"
-
-msgid "ERR_PERMISSION_DENIED"
-msgstr "Can't save file %1.\nPermission denied."
-
-msgid "ERR_DIR_NOT_EXIST"
-msgstr "%1\n\nThe directory doesn't exist."
-
-msgid "MEN_DESK_PREF_DIRICTORIES"
-msgstr "&Directories..."
-
-msgid "QAD_FileDlg::DIRECTORIES_FILTER"
-msgstr "Directories"
-
-msgid "MEN_DESK_FILE_PROPERTIES"
-msgstr "&Properties..."
-
-msgid "PRP_DESK_FILE_PROPERTIES"
-msgstr "View/modify study properties"
-
-msgid "PRP_YES"
-msgstr "Yes"
-
-msgid "PRP_NO"
-msgstr "No"
-
-msgid "PRP_STUDY_LOCKED"
-msgstr "LOCKED"
-
-msgid "PRP_STUDY_MODIFIED"
-msgstr "MODIFIED"
-
-msgid "PRP_STUDY_SAVED"
-msgstr "SAVED"
-
-msgid "PRP_MODIFICATIONS"
-msgstr "Modifications"
-
-msgid "PRP_MODE_FROM_SCRATCH"
-msgstr "from scratch"
-
-msgid "PRP_MODE_FROM_COPYFROM"
-msgstr "copy from"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::TLT_STUDY_PROPERTIES"
-msgstr "Study Properties"
-
-msgid "MEN_DESK_PREF_CONSOLE_FONT"
-msgstr "Console Font"
-
-msgid "TLT_OBJECT_BROWSER"
-msgstr "Object Browser"
-
-msgid "TLT_USECASE_BROWSER"
-msgstr "UseCase Browser"
-
-msgid "OBJECT_BROWSER_VALUE"
-msgstr "Value"
-
-msgid "OBJECT_BROWSER_ENTRY"
-msgstr "Entry"
-
-msgid "OBJECT_BROWSER_IOR"
-msgstr "IOR"
-
-msgid "OBJECT_BROWSER_REFENTRY"
-msgstr "Reference entry"
-
-msgid "OBJECT_BROWSER_OBJECT"
-msgstr "Object"
-
-msgid "MEN_DESK_PREF_OBJECTBROWSER_VALUE"
-msgstr "Value column"
-
-msgid "SET_VALUE_INT_TLT"
-msgstr "Set Integer"
-
-msgid "SET_VALUE_INT_LBL"
-msgstr "Value:"
-
-msgid "SET_VALUE_REAL_TLT"
-msgstr "Set Real"
-
-msgid "SET_VALUE_REAL_LBL"
-msgstr "Value:"
-
-msgid "SET_VALUE_COMMENT_TLT"
-msgstr "Set Comment"
-
-msgid "SET_VALUE_COMMENT_LBL"
-msgstr "Comment:"
-
-msgid "QAD_Desktop::TLT_CLOSESTUDY"
-msgstr "Close Study"
-
-msgid "QAD_Desktop::QUESTION_CLOSESTUDY"
-msgstr "Do you want to delete study permanently?"
-
-msgid "UC_POPUP"
-msgstr "Use case"
-
-msgid "UC_NEW_ID"
-msgstr "New object"
-msgid "UC_NEW_TIP"
-msgstr "Creates new object under current context"
-
-msgid "UC_SET_CURRENT_ID"
-msgstr "Set current"
-msgid "UC_SET_CURRENT_TIP"
-msgstr "Sets current context"
-
-msgid "UC_APPEND_ID"
-msgstr "Add objects"
-msgid "UC_APPEND_TIP"
-msgstr "Add selected object(s) under current context"
-
-msgid "UC_REMOVE_ID"
-msgstr "Remove objects"
-msgid "UC_REMOVE_TIP"
-msgstr "Remove selected object(s) from use case"
-
-msgid "UC_RENAME_ID"
-msgstr "Rename"
-msgid "UC_RENAME_TIP"
-msgstr "Renames object"
-
-msgid "UC_CLEAR_ID"
-msgstr "Clear"
-msgid "UC_CLEAR_TIP"
-msgstr "Clears use case"
-
-msgid "MEN_DESK_PREF_MULTI_FILE_SAVE"
-msgstr "MultiFile Save"
-
-msgid "MEN_DESK_PREF_ASCII_SAVE"
-msgstr "ASCII Save"
-
-msgid "TOT_APP_EDIT_COPY"
-msgstr "Copy"
-
-msgid "MEN_DESK_PREF_UNDO_LEVEL"
-msgstr "Undo Level"
-
-msgid "MEN_APP_EDIT_COPY"
-msgstr "&Copy"
-
-msgid "PRP_APP_EDIT_COPY"
-msgstr "Copies selected object into the clipboard"
-
-msgid "TOT_APP_EDIT_PASTE"
-msgstr "Paste"
-
-msgid "MEN_APP_EDIT_PASTE"
-msgstr "&Paste"
-
-msgid "PRP_APP_EDIT_PASTE"
-msgstr "Pastes object from the clipboard"
-
-msgid "EDIT_VALUE_CMD"
-msgstr "Edit value"
-
-msgid "EXPAND_ALL_CMD"
-msgstr "Expand all"
-
-msgid "PLOT_TABLE_CMD"
-msgstr "Plot table"
-
-msgid "NEW_OBJECT"
-msgstr "New object"
-
-msgid "QUICK_PATH_LAB"
-msgstr "Quick path:"
-
-msgid "ADD_PATH_BTN"
-msgstr "Add"
-
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : QAD_msg_fr.po
-# Module : SALOME
-
-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"
-
-#---------------
-# BUTTONS
-#---------------
-
-msgid "BUT_CANCEL"
-msgstr "Annule"
-
-msgid "BUT_HELP"
-msgstr "Aide"
-
-msgid "BUT_OK"
-msgstr "Ok"
-
-msgid "BUT_NO"
-msgstr "Non"
-
-msgid "BUT_YES"
-msgstr "Oui"
-
-#---------------
-# INFORMATIONS
-#---------------
-
-#: QAD_Desktop.cxx:1152
-msgid "Desktop_AppSelectionDlg::INF_DESK_DOC_CREATE"
-msgstr "Créer une nouvelle étude"
-
-#: QAD_Desktop.cxx:722
-msgid "INF_CANCELLED"
-msgstr "Annulé"
-
-#: QAD_Desktop.cxx:605
-msgid "INF_READY"
-msgstr "Ready"
-
-#: QAD_Desktop.cxx:605
-msgid "INF_RESOURCES"
-msgstr "Check your resources installation."
-
-#: QAD_Desktop.cxx:605
-msgid "INF_ICON_RESOURCES"
-msgstr "Could not find icon file %1 for module %2.\n"
-
-#: QAD_Desktop.cxx:551
-msgid "INF_DESK_DOC_OPEN"
-msgstr "Ouvrir l'étude"
-
-#: QAD_Desktop.cxx:654
-msgid "INF_DESK_DOC_SAVE"
-msgstr "Enregistrer l'étude"
-
-#: QAD_Desktop.cxx:465
-msgid "QAD_Desktop::INF_DESK_EXIT"
-msgstr "Quitter"
-
-#: QAD_Desktop.cxx:530
-msgid "QAD_Desktop::INF_DOC_CREATING"
-msgstr "Création de l'étude"
-
-#: QAD_Desktop.cxx:558
-msgid "QAD_Desktop::INF_DOC_OPENING"
-msgstr "Ouverture de l'étude"
-
-#: QAD_Desktop.cxx:691
-msgid "QAD_Desktop::INF_DOC_SAVED"
-msgstr "Étude %1 sauvée"
-
-#: QAD_Desktop.cxx:679
-msgid "QAD_Desktop::INF_DOC_SAVING"
-msgstr "Enregistrement de l'étude"
-
-#: QAD_Desktop.cxx:993
-msgid "QAD_Desktop::INF_PARSE_ERROR"
-msgstr "Parse error"
-
-#: QAD_Study.cxx:570
-msgid "QAD_Study::INF_DOC_OPERATIONABORTED"
-msgstr "Opération interrompue"
-
-#: QAD_Study.cxx:539
-msgid "QAD_Study::INF_DOC_OPERATIONFINISHED"
-msgstr "Opération terminée"
-
-#: *.cxx:855
-msgid "INF_APP_EXPORT"
-msgstr "Fichiers Images"
-
-#---------------
-# MENUS
-#---------------
-
-#: QAD_Desktop.cxx:19
-msgid "QAD_Desktop::MEN_OPENWITH"
-msgstr "Open With..."
-
-#: QAD_Application.cxx:331
-msgid "QAD_Application::MEN_ABOUT"
-msgstr "A propos de SALOME "
-
-#: QAD_Desktop.cxx:407
-msgid "QAD_Desktop::MEN_DESK_EDIT"
-msgstr "&Édition"
-
-#: QAD_Desktop.cxx:138
-msgid "QAD_Desktop::MEN_DESK_FILE"
-msgstr "&Fichier"
-
-#: QAD_Desktop.cxx:176
-msgid "QAD_Desktop::MEN_DESK_FILE_CLOSE"
-msgstr "&Fermer"
-
-#: QAD_Desktop.cxx:206
-msgid "QAD_Desktop::MEN_DESK_FILE_EXIT"
-msgstr "&Quitter"
-
-#: QAD_Desktop.cxx:155
-msgid "QAD_Desktop::MEN_DESK_FILE_NEW"
-msgstr "&Nouveau"
-
-#: QAD_Desktop.cxx:166
-msgid "QAD_Desktop::MEN_DESK_FILE_OPEN"
-msgstr "&Ouvrir ..."
-
-#: QAD_Desktop.cxx:166
-msgid "QAD_Desktop::MEN_DESK_FILE_LOAD"
-msgstr "&Charger ..."
-
-#: QAD_Desktop.cxx:187
-msgid "QAD_Desktop::MEN_DESK_FILE_SAVE"
-msgstr "&Enregistrer"
-
-#: QAD_Desktop.cxx:195
-msgid "QAD_Desktop::MEN_DESK_FILE_SAVEAS"
-msgstr "Enregistrer sous ..."
-
-#: QAD_Desktop.cxx:141
-msgid "QAD_Desktop::MEN_DESK_HELP"
-msgstr "&Aide"
-
-#: QAD_Desktop.cxx:291
-msgid "QAD_Desktop::MEN_DESK_HELP_ABOUT"
-msgstr "&A propos de ..."
-
-#: QAD_Desktop.cxx:265
-msgid "QAD_Desktop::MEN_DESK_HELP_CONTENTS"
-msgstr "&Sommaire"
-
-#: QAD_Desktop.cxx:273
-msgid "QAD_Desktop::MEN_DESK_HELP_SEARCH"
-msgstr "&Recherche ..."
-
-#: QAD_Desktop.cxx:280
-msgid "QAD_Desktop::MEN_DESK_HELP_WHATSTHIS"
-msgstr "Qu'est-ce-que c'est?"
-
-#: QAD_Desktop.cxx:139
-msgid "QAD_Desktop::MEN_DESK_VIEW"
-msgstr "&Affichage"
-
-#: QAD_Config.cxx:265
-msgid "MEN_DESK_PREF"
-msgstr "Préférences"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_SAVE"
-msgstr "Enregistrer"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_VIEWER"
-msgstr "Fond vues 3D"
-
-#: QAD_Config.cxx:376
-msgid "MEN_DESK_PREF_VIEWER_TRIHEDRON"
-msgstr "Dimension du repère"
-
-msgid "MEN_DESK_PREF_DEFAULT_VIEWER"
-msgstr "Default viewer"
-
-#: QAD_Config.cxx:378
-msgid "MEN_DESK_PREF_VIEWER_OCC"
-msgstr "Viewer OCC"
-
-#: QAD_Config.cxx:383
-msgid "MEN_DESK_PREF_VIEWER_VTK"
-msgstr "Viewer VTK"
-
-#: QAD_Config.cxx:383
-msgid "MEN_DESK_PREF_GRAPH_SUPERVISOR"
-msgstr "Graphe Supervision"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER"
-msgstr "ObjectBrowser"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER_ENTRY"
-msgstr "Entry, IOR colonnes"
-
-#: QAD_Desktop.cxx:473
-msgid "MEN_DESK_PREF_OBJECTBROWSER_IAPP"
-msgstr "Interface Applicative"
-
-msgid "MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"
-msgstr "Objets par ordre chrono"
-
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_MODE"
-msgstr "Mode de Selection"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_POINT"
-msgstr "Point"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_EDGE"
-msgstr "Arête"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_CELL"
-msgstr "Cellule"
-
-msgid "QAD_Desktop::MEN_DESK_SELECTION_ACTOR"
-msgstr "Acteur"
-
-#: QAD_Config.cxx:265
-msgid "MEN_DESK_TOOLS"
-msgstr "Outils"
-
-#: QAD_Desktop.cxx:228
-msgid "QAD_Desktop::MEN_DESK_VIEW_STATUSBAR"
-msgstr "&Barre d'état"
-
-#: QAD_Desktop.cxx:217
-msgid "QAD_Desktop::MEN_DESK_VIEW_STDTOOLBAR"
-msgstr "Barre d'outils standard"
-
-#: QAD_Desktop.cxx:140
-msgid "QAD_Desktop::MEN_DESK_WINDOW"
-msgstr "&Fenêtre"
-
-#: QAD_Desktop.cxx:248
-msgid "QAD_Desktop::MEN_DESK_WINDOW_CASCADE"
-msgstr "&Cascade"
-
-#: QAD_Desktop.cxx:240
-msgid "QAD_Desktop::MEN_DESK_WINDOW_NEW3D"
-msgstr "&Nouvelle fenêtre 3D"
-
-#: QAD_Desktop.cxx:256
-msgid "QAD_Desktop::MEN_DESK_WINDOW_TILE"
-msgstr "&Mozaïque"
-
-#: QAD_Application.cxx:175
-msgid "QAD_Application::MEN_APP_EDIT_REDO"
-msgstr "Répeter"
-
-#: QAD_Application.cxx:165
-msgid "QAD_Application::MEN_APP_EDIT_UNDO"
-msgstr "Annuler"
-
-#: QAD_Config.cxx:84
-msgid "MEN_APPNAME"
-msgstr "salome"
-
-#: QAD_Study.cxx:482
-msgid "QAD_Study::MEN_VIEWER"
-msgstr "Viewer"
-
-#: *.cxx:45
-msgid "MEN_VP3D_CHANGEBGR"
-msgstr "Changer l'arrière-plan..."
-
-msgid "MEN_APP_DISPLAY"
-msgstr "Afficher"
-
-msgid "MEN_APP_DISPLAY_ONLY"
-msgstr "Afficher seulement"
-
-msgid "MEN_APP_ERASE"
-msgstr "Effacer"
-
-#---------------
-# PRP
-#---------------
-
-#: QAD_Desktop.cxx:177
-msgid "QAD_Desktop::PRP_DESK_FILE_CLOSE"
-msgstr "Fermer l'étude"
-
-#: QAD_Desktop.cxx:207
-msgid "QAD_Desktop::PRP_DESK_FILE_EXIT"
-msgstr "Quitter l'application"
-
-#: QAD_Desktop.cxx:156
-msgid "QAD_Desktop::PRP_DESK_FILE_NEW"
-msgstr "Créer une nouvelle étude"
-
-#: QAD_Desktop.cxx:167
-msgid "QAD_Desktop::PRP_DESK_FILE_OPEN"
-msgstr "Ouvrir une étude existante"
-
-#: QAD_Desktop.cxx:167
-msgid "QAD_Desktop::PRP_DESK_FILE_LOAD"
-msgstr "Charger une étude existante"
-
-#: QAD_Desktop.cxx:188
-msgid "QAD_Desktop::PRP_DESK_FILE_SAVE"
-msgstr "Enregistrer l'étude"
-
-#: QAD_Desktop.cxx:196
-msgid "QAD_Desktop::PRP_DESK_FILE_SAVEAS"
-msgstr "Enregistrer l'étude sous ..."
-
-#: QAD_Desktop.cxx:292
-msgid "QAD_Desktop::PRP_DESK_HELP_ABOUT"
-msgstr "Shows \'About\' dialog"
-
-#: QAD_Desktop.cxx:266
-msgid "QAD_Desktop::PRP_DESK_HELP_CONTENTS"
-msgstr "Sommaire"
-
-#: QAD_Desktop.cxx:274
-msgid "QAD_Desktop::PRP_DESK_HELP_SEARCH"
-msgstr "Recherche"
-
-#: QAD_Desktop.cxx:281
-msgid "QAD_Desktop::PRP_DESK_HELP_WHATSTHIS"
-msgstr "Qu'est-ce-que c'est?"
-
-#: QAD_Desktop.cxx:230
-msgid "QAD_Desktop::PRP_DESK_VIEW_STATUSBAR"
-msgstr "Toggles status bar view on/off"
-
-#: QAD_Desktop.cxx:220
-msgid "QAD_Desktop::PRP_DESK_VIEW_STDTOOLBAR"
-msgstr "Toggles standard toolbar on/off"
-
-#: QAD_Desktop.cxx:871
-msgid "QAD_Desktop::PRP_DESK_WINDOW_ACTIVATE"
-msgstr "Activer cette fenêtre"
-
-#: QAD_Desktop.cxx:249
-msgid "QAD_Desktop::PRP_DESK_WINDOW_CASCADE"
-msgstr "Fenêtres en cascade"
-
-#: QAD_Desktop.cxx:257
-msgid "QAD_Desktop::PRP_DESK_WINDOW_TILE"
-msgstr "Fenêtres en mozaïque"
-
-#: QAD_Application.cxx:176
-msgid "QAD_Application::PRP_APP_EDIT_REDO"
-msgstr "Répéter la dernière opération"
-
-#: QAD_Application.cxx:166
-msgid "QAD_Application::PRP_APP_EDIT_UNDO"
-msgstr "Annuler la dernière opération"
-
-#: *.cxx:405
-msgid "PRP_VW3D_POINTCENTER"
-msgstr "Choisir un centre pour la vue avec MB1"
-
-#: *.cxx:374
-msgid "PRP_VW3D_SKETCHAREA"
-msgstr "Sélectionner une zone d'affichage"
-
-#---------------
-# TOOL TIP
-#---------------
-
-#: QAD_Application.cxx:173
-msgid "QAD_Application::TOT_APP_EDIT_REDO"
-msgstr "Répéter l'opération"
-
-#: QAD_Application.cxx:163
-msgid "QAD_Application::TOT_APP_EDIT_UNDO"
-msgstr "Annuler l'opération"
-
-#: QAD_Desktop.cxx:153
-msgid "QAD_Desktop::TOT_DESK_FILE_NEW"
-msgstr "Nouvelle étude"
-
-#: QAD_Desktop.cxx:165
-msgid "QAD_Desktop::TOT_DESK_FILE_OPEN"
-msgstr "Ouvrir étude"
-
-#: QAD_Desktop.cxx:165
-msgid "QAD_Desktop::TOT_DESK_FILE_LOAD"
-msgstr "Charger étude"
-
-#: QAD_Desktop.cxx:186
-msgid "QAD_Desktop::TOT_DESK_FILE_SAVE"
-msgstr "Enregistrer étude"
-
-#---------------
-# ERROR
-#---------------
-
-#: *.cxx:233
-msgid "QObject::ERR_VP_NOVIEW"
-msgstr "Pas de Vue"
-
-#: QAD_Desktop.cxx:516
-msgid "QAD_Desktop::ERR_APP_NOAPP"
-msgstr "Pas d'application"
-
-#: QAD_Desktop.cxx:535
-msgid "QAD_Desktop::ERR_DOC_CANTCREATE"
-msgstr "Impossible de créer l'étude"
-
-#: QAD_Desktop.cxx:586
-msgid "QAD_Desktop::ERR_DOC_CANTOPEN"
-msgstr "Impossible d'ouvrir l'étude"
-
-#: QAD_Desktop.cxx:683
-msgid "QAD_Desktop::ERR_DOC_CANTWRITE"
-msgstr "Impossible d'enregistrer l'étude"
-
-#: QAD_Desktop.cxx:599
-msgid "QAD_Desktop::ERR_DOC_UNKNOWNTYPE"
-msgstr "Type d'étude inconnu"
-
-#: QAD_Study.cxx:321
-msgid "QAD_Study::ERR_DOC_READONLY"
-msgstr "L'étude est en lecture seule"
-
-#: QAD_Desktop.cxx:683
-msgid "ERR_ERROR"
-msgstr "Erreur"
-
-
-#: QAD_Desktop.cxx:2339
-msgid "ERR_LIBGUI"
-msgstr "La lib%1.so n'a pas été trouvée. Verifier la variable d'environnement LD_LIBRARY_PATH"
-
-#---------------
-# QUESTION
-#---------------
-
-#: QAD_Study.cxx:335
-msgid "QAD_Study::QUE_ABORTCURRENTOPERATION"
-msgstr "L'opération n'est pas encore terminée.\nVoulez-vous l'interrompre ?"
-
-#: QAD_Desktop.cxx:465
-msgid "QAD_Desktop::QUE_DESK_EXIT"
-msgstr "Voulez-vous vraiment quitter ? "
-
-#: QAD_Desktop.cxx:569
-msgid "QAD_Desktop::QUE_DOC_ALREADYOPEN"
-msgstr "L'étude %1 est déja ouverte.\nVoulez-vous la recharger ?"
-
-#: QAD_Desktop.cxx:569
-msgid "QAD_Desktop::QUE_DOC_ALREADYEXIST"
-msgstr "L'étude %1 est déja présente dans le gestionnaire d'études.\nVoulez-vous la recharger ?"
-
-#: *.cxx:502
-#msgid "INF_READY"
-#msgstr "Ready"
-
-#: QAD_Desktop.cxx:668
-msgid "QAD_Desktop::QUE_DOC_FILEEXISTS"
-msgstr "Le fichier %1 existe déja.\nVoulez-vous l'écraser ?"
-
-#: *.cxx:405
-#msgid "PRP_VW3D_POINTCENTER"
-#msgstr "Choisir un centre pour la vue avec MB1"
-
-#: QAD_Desktop.cxx:710
-msgid "QAD_Desktop::QUE_DOC_NOTSAVED"
-msgstr "L'étude %1 n'est pas enregistrée.\nVoulez-vous l'enregistrer ?"
-
-#---------------
-# WARNING
-#---------------
-
-#: QAD_Desktop.cxx:709
-msgid "WRN_WARNING"
-msgstr "Attention"
-
-#: QAD_Desktop.cxx:1072
-msgid "QAD_Desktop::WRN_LOAD_COMPONENT"
-msgstr "Créer ou ouvrir une étude"
-
-------
-
-#: QAD_Application.cxx:133
-msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME"
-
-
-#: QAD_Desktop.cxx:431
-msgid "QAD_Desktop::DESK_DEFAULTDOC"
-msgstr "Étude"
-
-#: QAD_Desktop.cxx:424
-msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME"
-
-#: QAD_Desktop.cxx:920
-msgid "QAD_Desktop::DESK_FILES"
-msgstr "Fichiers"
-
-msgid "OCC_IMAGE_FILES"
-msgstr "Fichiers Images (*.bmp *.png *.jpg *.jpeg)"
-
-msgid "VTK_IMAGE_FILES"
-msgstr "Fichiers Images (*.tif)"
-
-msgid "INF_APP_DUMP_VIEW"
-msgstr "Dump vue"
-
-msgid "ERR_DOC_CANT_SAVE_FILE"
-msgstr "Impossible d'enregistrer le fichier"
-
-msgid "EDIT_COPY_CMD"
-msgstr "Copier"
-
-msgid "EDIT_PASTE_CMD"
-msgstr "Coller"
-
-msgid "EDIT_CLEAR_CMD"
-msgstr "Vider"
-
-msgid "EDIT_SELECTALL_CMD"
-msgstr "Sélectionner Tout"
-
-msgid "MESSAGE_LOG_NAME"
-msgstr "Message Log"
-
-msgid "QAD_DirListDlg::QUICK_DIR_LIST_TLT"
-msgstr "Quick directory list"
-
-msgid "QAD_DirListDlg::EMPTY_DIR"
-msgstr "<empty>"
-
-msgid "QAD_DirListDlg::DIRECTORIES_LBL"
-msgstr "&Directories:"
-
-msgid "QAD_DirListDlg::ERR_DIRECTORY_SPECIFIED"
-msgstr "Directory already specified."
-
-msgid "QAD_DirListDlg::WRN_DIRECTORY_N0T_EXIST"
-msgstr "%1\n\nThe directory doesn't exist.\nAdd directory anyway?"
-
-msgid "QAD_DirListDlg::SELECT_DIRECTORY"
-msgstr "Select directory"
-
-msgid "ERR_DOC_FILENOTEXIST"
-msgstr "The file %1 doesn't exist"
-
-msgid "ERR_PERMISSION_DENIED"
-msgstr "Can't save file %1.\nPermission denied."
-
-msgid "ERR_DIR_NOT_EXIST"
-msgstr "%1\n\nThe directory doesn't exist."
-
-msgid "MEN_DESK_PREF_DIRICTORIES"
-msgstr "&Directories..."
-
-msgid "QAD_FileDlg::DIRECTORIES_FILTER"
-msgstr "Directories"
-
-msgid "MEN_DESK_FILE_PROPERTIES"
-msgstr "&Properties..."
-
-msgid "PRP_DESK_FILE_PROPERTIES"
-msgstr "View/modify study properties"
-
-msgid "PRP_YES"
-msgstr "Yes"
-
-msgid "PRP_NO"
-msgstr "No"
-
-msgid "PRP_STUDY_LOCKED"
-msgstr "LOCKED"
-
-msgid "PRP_STUDY_MODIFIED"
-msgstr "MODIFIED"
-
-msgid "PRP_STUDY_SAVED"
-msgstr "SAVED"
-
-msgid "PRP_MODIFICATIONS"
-msgstr "Modifications"
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI.h"
-#include "QAD_Desktop.h"
-
-using namespace std;
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SALOMEGUI::SALOMEGUI( const QString& name, QObject* parent )
-: QObject( parent ),
- myName( name )
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-SALOMEGUI::~SALOMEGUI()
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::SetSettings( QAD_Desktop* parent )
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::SetSettings( QAD_Desktop* parent, char* compName )
-{
- return SetSettings( parent);
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject )
-{
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SALOMEGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject )
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::ActiveStudyChanged( QAD_Desktop* parent )
-{
- //static QAD_Study* aPrevStudy = NULL;
- //QAD_Study* aStudy = parent->getActiveStudy();
- //if(!aPrevStudy)
- // aPrevStudy = aStudy;
- //if(aStudy != aPrevStudy){
- // emit SignalCloseAllDialogs();
- // aPrevStudy = aStudy;
- //}
- emit SignalCloseAllDialogs();
- return true;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SALOMEGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)&,
- QAD_ViewFrame* )
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SALOMEGUI::SupportedViewType(int* /*buffer*/, int /*bufferSize*/ )
-{
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SALOMEGUI::Deactivate()
-{
- emit SignalCloseAllDialogs();
-}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI.hxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_HeaderFile
-#define SALOMEGUI_HeaderFile
-
-#include <Standard_Macro.hxx>
-
-#include <qobject.h>
-#include <qstring.h>
-
-class QAD_Desktop;
-class QAD_ViewFrame;
-class QAD_StudyFrame;
-class SALOME_Event;
-
-class Handle_SALOME_InteractiveObject;
-
-class QKeyEvent;
-class QMouseEvent;
-class QPopupMenu;
-class QString;
-
-
-class Standard_EXPORT SALOMEGUI : public QObject
-{
- Q_OBJECT
-
-public:
- SALOMEGUI( const QString& name = "", QObject* parent = 0 );
- virtual ~SALOMEGUI();
-
- virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent);
- virtual bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool SetSettings ( QAD_Desktop* parent );
- virtual bool SetSettings ( QAD_Desktop* parent, char* compName );
- virtual bool CustomPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject );
- virtual void DefinePopup ( QString & theContext, QString & theParent, QString & theObject );
- virtual bool ActiveStudyChanged( QAD_Desktop* parent );
- virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO,
- QAD_ViewFrame* = 0 );
- virtual void SupportedViewType (int* buffer, int bufferSize);
- virtual void Deactivate ();
-
-signals:
- void SignalDeactivateActiveDialog();
- void SignalCloseAllDialogs ();
-
-private:
- QString myName;
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_AboutDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_AboutDlg.h"
-#include "QAD_Desktop.h"
-#include "QAD_Tools.h"
-#include <qlayout.h>
-#include <qpixmap.h>
-#include <qmessagebox.h>
-using namespace std;
-
-/*
- * Constructor
- */
-SALOMEGUI_AboutDlg::SALOMEGUI_AboutDlg(QWidget* parent, const char* name )
- : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPalette pal = palette();
- QColorGroup cg;
- cg.setColor( QColorGroup::Foreground, Qt::black );
- cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
- cg.setColor( QColorGroup::Light, Qt::white );
- cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) );
- cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
- cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
- cg.setColor( QColorGroup::Text, Qt::black );
- cg.setColor( QColorGroup::BrightText, Qt::white );
- cg.setColor( QColorGroup::ButtonText, Qt::black );
- cg.setColor( QColorGroup::Base, Qt::white );
- cg.setColor( QColorGroup::Background, Qt::white );
- cg.setColor( QColorGroup::Shadow, Qt::black );
- cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
- cg.setColor( QColorGroup::HighlightedText, Qt::white );
- pal.setActive( cg );
- pal.setInactive( cg );
- pal.setDisabled( cg );
- setPalette(pal);
-
- setCaption( tr("ABOUT_TLT") );
- setSizeGripEnabled( false );
- QVBoxLayout* SALOMEGUI_AboutDlgLayout = new QVBoxLayout( this );
- SALOMEGUI_AboutDlgLayout->setSpacing( 6 );
- SALOMEGUI_AboutDlgLayout->setMargin( 11 );
-
- AboutPicLab = new QLabel( this, "AboutPicLab" );
- AboutPicLab->setFrameStyle( QLabel::Plain | QLabel::Box );
- QPixmap icon1 ( QAD_Desktop::getResourceManager()->loadPixmap( "CLIENT",
- tr("ICON_ABOUT") ));
-
- QString msg;
- if(!QAD_Desktop::getResourceManager()->loadResources( "CLIENT", msg ))
- {
- QMessageBox::warning( this, tr("WRN_WARNING"), msg, tr ("BUT_OK") );
- }
-
- AboutPicLab->setPixmap( icon1 );
- AboutPicLab->setScaledContents( false );
- AboutPicLab->setAlignment( AlignCenter );
- AboutPicLab->installEventFilter(this);
- SALOMEGUI_AboutDlgLayout->addWidget( AboutPicLab );
-
- VersionLab = new QLabel( this, "VersionLab" );
- VersionLab->setText( tr( "INF_VERSION" ) );
- VersionLab->setAlignment( AlignCenter );
- VersionLab->installEventFilter(this);
- SALOMEGUI_AboutDlgLayout->addWidget( VersionLab );
-
- CopyrightLab = new QLabel( this, "CopyrightLab" );
- CopyrightLab->setText( tr( "INF_COPYRIGHT" ) );
- CopyrightLab->setAlignment( AlignCenter );
- CopyrightLab->installEventFilter(this);
- SALOMEGUI_AboutDlgLayout->addWidget( CopyrightLab );
-
- LicenseLab = new QLabel( this, "LicenseLab" );
- LicenseLab->setText( tr( "INF_LICENSE" ) );
- LicenseLab->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
- QFont LicenseLabFont( LicenseLab->font() );
- LicenseLabFont.setPointSize( 10 );
- LicenseLab->setFont( LicenseLabFont );
- LicenseLab->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
- LicenseLab->installEventFilter(this);
- SALOMEGUI_AboutDlgLayout->addWidget( LicenseLab );
- LicenseLab->polish();
-
- setMaximumSize(minimumSize());
-
- QAD_Tools::alignWidget(this, parent, AlignCenter);
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_AboutDlg::~SALOMEGUI_AboutDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- * Main event handler. Reimplemented to handle application
- * font changes
- */
-bool SALOMEGUI_AboutDlg::event( QEvent* ev )
-{
- bool ret = QDialog::event( ev );
- if ( ev->type() == QEvent::ApplicationFontChange ) {
- QFont LicenseLabFont( LicenseLab->font() );
- LicenseLabFont.setPointSize( 10 );
- LicenseLab->setFont( LicenseLabFont );
- }
- else if ( ev->type() == QEvent::MouseButtonRelease ) {
- accept();
- }
- return ret;
-}
-
-bool SALOMEGUI_AboutDlg::eventFilter( QObject* o, QEvent* e)
-{
- if (e->type() == QEvent::MouseButtonRelease) {
- accept();
- }
- return QDialog::eventFilter(o, e);
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_AboutDlg.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_ABOUTDLG_H
-#define SALOMEGUI_ABOUTDLG_H
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qlabel.h>
-
-class SALOMEGUI_AboutDlg : public QDialog
-{
-public:
- SALOMEGUI_AboutDlg( QWidget* parent = 0, const char* name = 0 );
- ~SALOMEGUI_AboutDlg();
-
-protected:
- bool event( QEvent* );
- bool eventFilter( QObject*, QEvent* );
-
-protected:
- QLabel* AboutPicLab;
- QLabel* VersionLab;
- QLabel* CopyrightLab;
- QLabel* PartnerPicLab;
- QLabel* LicenseLab;
-};
-
-#endif // SALOMEGUI_ABOUTDIALOG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_ActivateComponentDlg.cxx
-// Author : Michael Zorin (mzn)
-// Module : SALOME
-
-#include "SALOMEGUI_ActivateComponentDlg.h"
-
-#include <qframe.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-using namespace std;
-
-static const char* const default_icon[] = {
-"48 48 17 1",
-". c None",
-"# c #161e4c",
-"b c #1d3638",
-"e c #2f585b",
-"i c #345b5e",
-"c c #386266",
-"g c #3f7477",
-"d c #4d8589",
-"m c #519099",
-"o c #6abbc1",
-"a c #70c9d3",
-"f c #79ddea",
-"n c #7adff2",
-"k c #7ce2f4",
-"j c #993550",
-"h c #d84b71",
-"l c #ef537d",
-"................................................",
-"................................................",
-"................................................",
-"................................................",
-"................................................",
-"................########.########.########......",
-"...............#aaaaaa###aaaaaa###aaaaaa##......",
-"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",
-".............########b########b########cc#......",
-".............#dddddd#b#dddddd#b#dddddd#cc#......",
-"...........########d########d########d#cc#......",
-"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",
-".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",
-"........########b########e########cc#d#c#.......",
-"........#dddddd#b#dddddd#e#ffffff#cc#d####......",
-"......########d########d########f#cc###g##......",
-".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",
-"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",
-"...########b########i########jj#f#c#gg#cc#......",
-"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",
-"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",
-"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",
-"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",
-"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",
-"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",
-"...########g########g########o##d#cc#gg#c#......",
-"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",
-"...########b########b########cc#d#c#gg#cc#......",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",
-"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",
-"...########g########g########g##g#cc#...........",
-"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",
-"...########b########b########cc#g#c#............",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",
-"...#kkkkkk###kkkkkk###kkkkkk##..................",
-"...########.########.########...................",
-"................................................",
-"................................................",
-"................................................",
-"................................................"};
-
-//==============================================================================================================================
-/*!
- * SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg
- *
- * Constructor
- */
-//==============================================================================================================================
-SALOMEGUI_ActivateComponentDlg::SALOMEGUI_ActivateComponentDlg ( QWidget * parent, const QString& component, const QPixmap icon )
- : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- QPixmap defaultIcon( ( const char** ) default_icon );
- setCaption( tr( "CAPTION" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this );
- ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );
-
- // Module's name and icon
- myComponentFrame = new QFrame( this, "myComponentFrame" );
- myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
- myComponentFrame->setMinimumHeight( 100 );
- myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
-
- QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame );
- myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );
-
- // --> icon
- myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );
- myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );
- myComponentIcon->setScaledContents( false );
- myComponentIcon->setAlignment( AlignCenter );
- // --> name
- myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );
- QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt );
- myComponentLab->setAlignment( AlignCenter );
-
- myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );
- myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );
-
- // Info
- QVBoxLayout* infoLayout = new QVBoxLayout();
- infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );
-
- // --> top line
- QFrame* myLine1 = new QFrame( this, "myLine1" );
- myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );
- // --> info label
- myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );
- myInfoLabel->setAlignment( AlignCenter );
- // --> bottom line
- QFrame* myLine2 = new QFrame( this, "myLine2" );
- myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );
-
- infoLayout->addStretch();
- infoLayout->addWidget( myLine1 );
- infoLayout->addWidget( myInfoLabel );
- infoLayout->addWidget( myLine2 );
- infoLayout->addStretch();
-
- // Buttons
- QHBoxLayout* btnLayout = new QHBoxLayout();
- btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
-
- // --> New
- myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );
- myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );
- // --> Open
- myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );
- myOpenBtn->setAutoDefault( true );
- // --> Load
- myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );
- myLoadBtn->setAutoDefault( true );
- // --> Cancel
- myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );
- myCancelBtn->setAutoDefault( true );
-
- btnLayout->addWidget( myNewBtn );
- btnLayout->addWidget( myOpenBtn );
- btnLayout->addWidget( myLoadBtn );
- btnLayout->addStretch();
- btnLayout->addSpacing( 70 );
- btnLayout->addStretch();
- btnLayout->addWidget( myCancelBtn );
-
- ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );
- ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );
- ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 );
-
- // signals and slots connections
- connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-//==============================================================================================================================
-/*!
- * SALOMEGUI_ActivateComponentDlg::onButtonClicked
- *
- * Buttons slot
- */
-//==============================================================================================================================
-void SALOMEGUI_ActivateComponentDlg::onButtonClicked()
-{
- QPushButton* btn = ( QPushButton* )sender();
- if ( btn == myNewBtn )
- done( 1 );
- if ( btn == myOpenBtn )
- done( 2 );
- if ( btn == myLoadBtn )
- done( 3 );
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_ActivateComponentDlg.h
-// Author : Michael ZORIN (mzn)
-// Module : SALOME
-
-#ifndef SALOMEGUI_ActivateComponentDlg_H
-#define SALOMEGUI_ActivateComponentDlg_H
-
-#include <qdialog.h>
-#include <qpixmap.h>
-
-class QFrame;
-class QLabel;
-class QPushButton;
-
-class SALOMEGUI_ActivateComponentDlg: public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_ActivateComponentDlg ( QWidget* parent, const QString& component, const QPixmap icon = QPixmap() ) ;
- ~SALOMEGUI_ActivateComponentDlg ( ) { };
-
-private slots:
- void onButtonClicked();
-
-private:
- QFrame* myComponentFrame;
- QLabel* myComponentLab;
- QLabel* myComponentIcon;
- QLabel* myInfoLabel;
- QPushButton* myNewBtn;
- QPushButton* myOpenBtn;
- QPushButton* myLoadBtn;
- QPushButton* myCancelBtn;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Application.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_Application.h"
-#include "SALOMEGUI_Desktop.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI.h"
-#include "SALOME_Selection.h"
-#include "SALOME_ListIO.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "QAD.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_Resource.h"
-#include "QAD_Tools.h"
-#include "QAD_WaitCursor.h"
-#include "QAD_MessageBox.h"
-
-// QT Includes
-#include <qapplication.h>
-#include <qpopupmenu.h>
-#include <qmessagebox.h>
-
-// Open CASCADE Include
-#include <Standard_Failure.hxx>
-#include <TCollection_AsciiString.hxx>
-using namespace std;
-
-/*!
- Constructor
-*/
-SALOMEGUI_Application::SALOMEGUI_Application( const QString& format,
- const QString& description,
- const QString& filters) :
-QAD_Application( format, description, filters )
-{
- /* load resources */
- QString message;
- QAD_ResourceMgr* resMgr = QAD_Desktop::getResourceManager();
- if ( !resMgr ) resMgr = QAD_Desktop::createResourceManager();
- if ( resMgr ) resMgr->loadResources( "SALOMEGUI", message );
-
- QPalette* palette = QAD_Desktop::getPalette();
- if ( !palette) palette = QAD_Desktop::createPalette();
- // if ( !palette) palette->loadPalette();
-
- //myViewActions.setAutoDelete( true );
-
- /* We need to know that the desktop is created to have
- some additional internal initialization */
- QAD_ASSERT( connect( this, SIGNAL(desktopCreated()), SLOT(onDesktopCreated()) ));
-}
-
-/*!
- Destructor
-*/
-SALOMEGUI_Application::~SALOMEGUI_Application()
-{
-}
-
-/*!
- Creates the actions provided by this application( internal )
-*/
-void SALOMEGUI_Application::createActions()
-{
-#ifdef DEBUG
- /* this function must be called only once */
- static bool created = false;
- QAD_ASSERT_DEBUG_ONLY( !created );
- created = true;
-#endif
-
- /* Create 'View' actions
- */
- QToolBar* tbView = createToolBar( ViewToolBarId, tr("MEN_DESK_VIEWERTOOLBAR") );
-
- QAD_ResourceMgr* rmgr = QAD_Desktop::getResourceManager();
-#define CREATE_ACTION(ID,NAME) \
- if(!myViewActions.at(ID)){ \
- QActionP* action = new QActionP(tr("TOT_APP_VIEW_" #NAME), \
- rmgr->loadPixmap("SALOMEGUI", tr("ICON_APP_VIEW_" #NAME)), \
- tr("MEN_APP_VIEW_" #NAME), 0, QAD_Application::getDesktop()); \
- action->setStatusTip(tr("PRP_APP_VIEW_" #NAME)); \
- myViewActions.insert(ID,action); \
- }
-
- CREATE_ACTION(ViewDumpId,DUMP);
- CREATE_ACTION(ViewTrihedronId,TRIHEDRON);
- CREATE_ACTION(ViewFitAllId,FITALL);
- CREATE_ACTION(ViewFitAreaId,FITAREA);
- CREATE_ACTION(ViewZoomId,ZOOM);
- CREATE_ACTION(ViewPanId,PAN);
- CREATE_ACTION(ViewRotateId,ROTATE);
- CREATE_ACTION(ViewGlobalPanId,GLOBALPAN);
- CREATE_ACTION(ViewFrontId,FRONT);
- CREATE_ACTION(ViewBackId,BACK);
- CREATE_ACTION(ViewTopId,TOP);
- CREATE_ACTION(ViewBottomId,BOTTOM);
- CREATE_ACTION(ViewLeftId,LEFT);
- CREATE_ACTION(ViewRightId,RIGHT);
- CREATE_ACTION(ViewResetId,RESET);
-
-#undef CREATE_ACTION
-}
-
-/*!
- Enables/disables the actions provided by this
- application( internal )
-*/
-void SALOMEGUI_Application::updateActions()
-{
-}
-
-/*!
- Creates CAF application
-*/
-bool SALOMEGUI_Application::initApp(SALOME_NamingService* name_service)
-{
- if ( myStudyMgr->_is_nil() ) {
- try {
- CORBA::Object_ptr obj = name_service->Resolve("/myStudyManager");
- myStudyMgr = SALOMEDS::StudyManager::_narrow(obj);
- }
- catch ( Standard_Failure ) {
- return false;
- }
- }
-
- return true;
-}
-
-/*!
- Creates the main desktop
-*/
-bool SALOMEGUI_Application::createDesktop( SALOME_NamingService* name_service )
-{
- QAD_ASSERT_DEBUG_ONLY( !desktop );
- desktop = new SALOMEGUI_Desktop(name_service);
- return ( desktop != NULL );
-}
-
-/*!
- Called when the main desktop is created ( internal )
-*/
-void SALOMEGUI_Application::onDesktopCreated()
-{
- createActions();
-}
-
-/*!
- Called for customization when study is created
-*/
-void SALOMEGUI_Application::onStudyCreated( QAD_Study* study )
-{
-}
-
-/*!
- Called for customization when study is opened
-*/
-void SALOMEGUI_Application::onStudyOpened( QAD_Study* study )
-{
-}
-
-/*!
- Called for customization when study is activated (shown)
-*/
-void SALOMEGUI_Application::onStudyShown( QAD_Study* study )
-{
- SALOMEDS::Study_var aStudy = study->getStudyDocument();
-
-//srn: Forbid appending Interface Applicative and its children to UseCase
- aStudy->EnableUseCaseAutoFilling(false);
-
- /* mpv: study may be locked */
- int aLocked = aStudy->GetProperties()->IsLocked();
- if (aLocked) aStudy->GetProperties()->SetLocked(false);
-
- /* update Object Browser */
- SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder();
- SALOMEDS::SComponentIterator_var itcomp = aStudy->NewComponentIterator();
- for (; itcomp->More(); itcomp->Next()) {
- SALOMEDS::SComponent_var SC = itcomp->Value();
- Standard_CString dataType = SC->ComponentDataType();
- if ( QString(dataType).compare("Interface Applicative") == 0 ) {
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC);
- for (; it->More();it->Next()) {
- SALOMEDS::SObject_var CSO = it->Value();
- B->RemoveObject(CSO);
- }
- }
- }
-
- QAD_StudyFrame* sf = myActiveStudy->getActiveStudyFrame();
- Standard_CString name = CORBA::string_dup(sf->title().latin1());
-
- SALOMEDS::SComponent_var father = aStudy->FindComponent("Interface Applicative");
- SALOMEDS::SObject_var newObj = B->NewObject(father);
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeComment_var aComment;
- SALOMEDS::AttributeSelectable_var aSelAttr;
-
- anAttr = B->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(name);
-
- anAttr = B->FindOrCreateAttribute(newObj, "AttributeSelectable");
- aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
- aSelAttr->SetSelectable(false);
-
- if (sf->getTypeView() == VIEW_OCC) {
- anAttr = B->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("OCC");
- }
- else if (sf->getTypeView() == VIEW_VTK) {
- anAttr = B->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("VTK");
- } else {
- anAttr = B->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue("GRAPH");
- }
- sf->setEntry(newObj->GetID());
-
- if (aLocked) aStudy->GetProperties()->SetLocked(true);
-
- study->updateObjBrowser( false );
-
- aStudy->EnableUseCaseAutoFilling(true);
-}
-
-/*!
- Called for customization when the active study is changed
-*/
-void SALOMEGUI_Application::onActiveStudyChanged( QAD_Study* oldActiveStudy,
- QAD_Study* newActiveStudy )
-{
- // MESSAGE ("SALOMEGUI_Application::onActiveStudyChanged init.");
- /* superclass MUST be called */
- QAD_Application::onActiveStudyChanged( oldActiveStudy, newActiveStudy );
-
- if ( oldActiveStudy ) {
- int count = oldActiveStudy->getStudyFramesCount();
- for ( int i = 0; i < count; i++ ) {
- disconnectFromViewer( oldActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame() );
- }
- }
-
- if ( newActiveStudy && newActiveStudy->getActiveStudyFrame() ) {
- connectToViewer( newActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame() );
- }
-}
-
-void SALOMEGUI_Application::connectToViewer( QAD_ViewFrame* vf )
-{
-#define CONNECT_ACTION(NAME) \
- QAD_ASSERT(connect(myViewActions.at(View ##NAME ##Id), SIGNAL(activated()), vf, SLOT(onView ##NAME())))
-
- if ( vf ) {
- QToolBar* tbView = getToolBar( ViewToolBarId );
- for ( int cmd = ViewDumpId; cmd <= ViewResetId; cmd++ )
- if ( myViewActions.at( cmd ) )
- myViewActions.at( cmd )->removeFrom(tbView);
- if( vf->getTypeView() == VIEW_GRAPHSUPERV ) {
- //myViewActions.at(ViewDumpId)->addTo(tbView);
- //myViewActions.at(ViewFitAllId)->addTo(tbView);
- //myViewActions.at(ViewFitAreaId)->addTo(tbView);
- //myViewActions.at(ViewZoomId)->addTo(tbView);
- myViewActions.at(ViewPanId)->addTo(tbView);
- //myViewActions.at(ViewGlobalPanId)->addTo(tbView);
- myViewActions.at(ViewResetId)->addTo(tbView);
- }
- else if( vf->getTypeView() == VIEW_PLOT2D ) {
- myViewActions.at(ViewDumpId)->addTo(tbView);
- myViewActions.at(ViewFitAllId)->addTo(tbView);
- myViewActions.at(ViewFitAreaId)->addTo(tbView);
- myViewActions.at(ViewZoomId)->addTo(tbView);
- myViewActions.at(ViewPanId)->addTo(tbView);
- //myViewActions.at(ViewGlobalPanId)->addTo(tbView);
- //myViewActions.at(ViewResetId)->addTo(tbView);
- }
- else {
- for ( int cmd = ViewDumpId; cmd <= ViewResetId; cmd++ )
- if ( myViewActions.at( cmd ) )
- myViewActions.at( cmd )->addTo(tbView);
- }
- //CONNECT_ACTION(Mu4Id)
- CONNECT_ACTION(Dump);
- CONNECT_ACTION(Trihedron);
- CONNECT_ACTION(FitAll);
- CONNECT_ACTION(FitArea);
- CONNECT_ACTION(Zoom);
- CONNECT_ACTION(Pan);
- CONNECT_ACTION(Rotate);
- CONNECT_ACTION(GlobalPan);
- CONNECT_ACTION(Front);
- CONNECT_ACTION(Back);
- CONNECT_ACTION(Top);
- CONNECT_ACTION(Bottom);
- CONNECT_ACTION(Left);
- CONNECT_ACTION(Right);
- CONNECT_ACTION(Reset);
- }
-
-#undef CONNECT_ACTION
-}
-
-void SALOMEGUI_Application::disconnectFromViewer( QAD_ViewFrame* vf )
-{
-#define DISCONNECT_ACTION(NAME) \
- QAD_ASSERT(disconnect(myViewActions.at(View ##NAME ##Id), SIGNAL(activated()), vf, SLOT(onView ##NAME())));
-
- if ( !vf || myViewActions.isEmpty() )
- return;
- //DISCONNECT_ACTION(Mu4Id)
- DISCONNECT_ACTION(Dump);
- DISCONNECT_ACTION(Trihedron);
- DISCONNECT_ACTION(FitAll);
- DISCONNECT_ACTION(FitArea);
- DISCONNECT_ACTION(Zoom);
- DISCONNECT_ACTION(Pan);
- DISCONNECT_ACTION(Rotate);
- DISCONNECT_ACTION(GlobalPan);
- DISCONNECT_ACTION(Front);
- DISCONNECT_ACTION(Back);
- DISCONNECT_ACTION(Top);
- DISCONNECT_ACTION(Bottom);
- DISCONNECT_ACTION(Left);
- DISCONNECT_ACTION(Right);
- DISCONNECT_ACTION(Reset);
-
-#undef DISCONNECT_ACTION
-}
-
-/*!
- Customizes 'View' menu of the desktop
-*/
-int SALOMEGUI_Application::onUpdateViewActions ( QPopupMenu* popup, bool add, int index )
-{
- int nItemsAdded = QAD_Application::onUpdateViewActions( popup, add, index );
- // NRI
- // if ( add ) {
- // index += nItemsAdded;
- // QAD_ASSERT_DEBUG_ONLY( !myViewActions.isEmpty() );
- // popup->insertSeparator( index++ );
- // myViewActions.at( ViewTrihedronId )->addTo( popup );
- // index++;
- // popup->insertSeparator( index++ );
- // for ( int i = (int)ViewMu4Id; i <= (int)ViewRightId; i++ ) {
- // myViewActions.at( i )->addTo( popup );
- // index++;
- // }
- // popup->insertSeparator( index++ );
- // myViewActions.at( ViewResetId )->addTo( popup );
- // index++;
- // } else {
- // for ( int i = (int)ViewTrihedronId; i <= (int)ViewResetId; i++ ) {
- // popup->removeItemAt(index);
- // }
-
- // /* remove separators */
- // popup->removeItemAt( index );
- // popup->removeItemAt( index );
- // popup->removeItemAt( index );
- // }
-
- return index;
-}
-
-/*!
- Adds the context popup items
-*/
-void SALOMEGUI_Application::onCreatePopup()
-{
- // Here common menu items should be added (Display, Erase, etc.).
- // They should be obtained through the standard XML-based mechanism,
- // i.e. corresponding XML file should be loaded somewhere in advance
- // and desktop->getOperatorsMenu() should return the default popup menu.
- // These items are always added; if necessary any of them can be hidden
- // during popup customization by means of the corresponding unique ID defined in QAD_Resource.h.
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- if ( Sel->IObjectCount() > 0 ) {
- myPopup->insertItem (tr ("MEN_APP_DISPLAY"), this, SLOT(onDisplay(int)), 0, QAD_Display_Popup_ID);
- myPopup->insertItem (tr ("MEN_APP_DISPLAY_ONLY"), this, SLOT(onDisplay(int)), 0, QAD_DisplayOnly_Popup_ID);
- myPopup->insertItem (tr ("MEN_APP_ERASE"), this, SLOT(onErase()), 0, QAD_Erase_Popup_ID);
- }
-
-}
-
-
-void SALOMEGUI_Application::onDisplay(int id)
-{
- QAD_WaitCursor waitCursor;
-
- // Obtain the component to deal with (according to selected object's parent component)
- SALOME_Selection* Sel = SALOME_Selection::Selection(myActiveStudy->getSelection() );
-
- QString parentComp = ((SALOMEGUI_Desktop*)desktop)->getComponentFromSelection();
- if (parentComp.isNull()) { // objects from several components are selected -> do nothing
- return;
- }
-
- bool isViewTypeOK = true;
- int viewTypes[VIEW_TYPE_MAX];
-
- for (int i = 0; i < VIEW_TYPE_MAX; i++)
- viewTypes[i] = -1;
-
- // Obtain the component's GUI
- SALOMEGUI* aGUI = desktop->getComponentGUI( parentComp );
- if ( !aGUI )
- return;
-
- // Check if another view type is required (if viewToActivate < 0 then any type of view is acceptable)
- aGUI->SupportedViewType(viewTypes, VIEW_TYPE_MAX);
- if (viewTypes[0] >= 0) { // not all the view types are supported
- for (int i = 0; i < VIEW_TYPE_MAX; i++) {
- if (viewTypes[i] < 0) // no more types supported
- break;
- isViewTypeOK = ((int)myActiveStudy->getActiveStudyFrame()->getTypeView() == viewTypes[i]);
- if (isViewTypeOK) // one of supported views is already active
- break;
- }
- }
-
- // Try to activate a view of one of supported types
- if (!isViewTypeOK) {
- MESSAGE("onDisplay(): view type is not acceptable")
- unsigned frameCount = myActiveStudy->getStudyFramesCount();
- for (unsigned i = 0; i < frameCount; i++) {
- QAD_StudyFrame* frame = myActiveStudy->getStudyFrame(i);
- for (int j = 0; j < VIEW_TYPE_MAX; j++) {
- if (frame->getTypeView() == viewTypes[j]) {
- MESSAGE("onDisplay(): activating other frame")
- isViewTypeOK = true;
- frame->setFocus();
- break;
- }
- }
- }
- if (!isViewTypeOK) {
- waitCursor.stop();
- QMessageBox::warning( desktop,
- tr("ERR_ERROR"),
- tr("ERR_APP_WRONG_VIEW_TYPE"));
- return;
- }
- }
-
- QAD_ViewFrame* viewFrame = myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
-
- // Ensure that parent component's data are loaded
- QString compName = desktop->getComponentName( parentComp );
- if ( compName.isEmpty() ) {
- waitCursor.stop();
- QAD_MessageBox::error1( desktop,
- tr("ERR_ERROR"),
- tr("ERR_EMPTY_COMP_NAME").arg( parentComp ),
- tr("BUT_OK"));
- return;
- }
-
- desktop->loadComponentData( compName );
-
- // Build the graphic presentation (it is stored in the corresponding viewer)
-
- bool isComponent = false;
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- bool needRepaint = false;
-
- // Copy the selection
- SALOME_ListIteratorOfListIO itInit( Sel->StoredIObjects() );
- SALOME_ListIO selList;
- for (; itInit.More(); itInit.Next()) {
- Handle(SALOME_InteractiveObject) IObject = itInit.Value();
- if ( IObject->hasEntry() ) {
- // check whether the component is selected
- SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry() );
- if ( !obj->_is_nil() && strcmp( obj->GetFatherComponent()->GetID(), obj->GetID() ) == 0 ) {
- selList.Clear();
- isComponent = true;
- selList.Append( IObject );
- break;
- }
- }
- selList.Append( IObject );
- }
-
- if (id == QAD_DisplayOnly_Popup_ID)
- viewFrame->EraseAll();
-
- // For component -> display all children
- if ( isComponent ) {
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( selList.First()->getEntry() );
- SALOMEDS::ChildIterator_ptr It = aStudy->NewChildIterator( obj );
- It->InitEx( true );
- for ( ; It->More(); It->Next() ) {
- SALOMEDS::SObject_ptr child = It->Value();
- SALOMEDS::SObject_ptr ref;
- if ( !child->ReferencedObject( ref ) ) {
- Handle(SALOME_InteractiveObject) childIObject = new SALOME_InteractiveObject();
- childIObject->setEntry( child->GetID() );
- // Ensure that proper 3D presentation exists for IObject
- aGUI->BuildPresentation(childIObject);
- viewFrame->Display(childIObject, false);
- needRepaint = true;
- }
- }
- }
- else { // for child object -> simply display it (no children are displayed)
- SALOME_ListIteratorOfListIO It( selList );
- for( ;It.More();It.Next() ) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- // Ensure that proper 3D presentation exists for IObject
- aGUI->BuildPresentation(IObject);
- viewFrame->Display(IObject, false);
- needRepaint = true;
- }
- }
-
- if ( needRepaint )
- viewFrame->Repaint();
-
- myActiveStudy->updateObjBrowser(true);
-}
-
-
-
-void SALOMEGUI_Application::onErase()
-{
- QAD_WaitCursor waitCursor;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection(myActiveStudy->getSelection() );
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
- QAD_ViewFrame* viewFrame = myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- bool needRepaint = false;
-
- // Copy the selection
- SALOME_ListIteratorOfListIO itInit( Sel->StoredIObjects() );
- SALOME_ListIO selList;
- for (; itInit.More(); itInit.Next()) {
- selList.Append(itInit.Value());
- }
-
- SALOME_ListIteratorOfListIO It( selList );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
-
- // First check whether the object is a component or a child object
- bool isComponent = false;
- SALOMEDS::SObject_var obj;
-
- if (IObject->hasEntry()) {
- obj = aStudy->FindObjectID(IObject->getEntry());
- if (!obj->_is_nil()) {
- SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
- isComponent = (strcmp(comp->GetID(), obj->GetID()) == 0);
- }
- }
-
- // For component -> erase all children
- if (isComponent) {
- SALOMEDS::ChildIterator_ptr it = aStudy->NewChildIterator(obj);
- it->InitEx(true);
- for ( ; it->More(); it->Next()) {
- SALOMEDS::SObject_ptr child = it->Value();
- Handle(SALOME_InteractiveObject) childIObject = new SALOME_InteractiveObject();
- childIObject->setEntry(child->GetID());
- viewFrame->Erase(childIObject, false);
- }
- } else { // for child object -> simply erase it (no children are erased)
- viewFrame->Erase(IObject, false);
- }
- needRepaint = true;
- }
-
- if (needRepaint)
- viewFrame->Repaint();
-
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Application.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_APPLICATION_H
-#define SALOMEGUI_APPLICATION_H
-
-#include "QAD_Application.h"
-#include "QAD_ViewFrame.h"
-#include "QAD_Action.h"
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-// QT Includes
-#include <qlist.h>
-#include <qstring.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
-
-class SALOMEGUI_Application : public QAD_Application
-{
- Q_OBJECT
- enum { ViewToolBarId = 100 };
-
- enum { ViewDumpId, ViewTrihedronId, ViewFitAllId, ViewFitAreaId,
- ViewZoomId, ViewPanId, ViewRotateId, ViewGlobalPanId,
- ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId,
- ViewRightId, ViewResetId };
-public:
- SALOMEGUI_Application ( const QString& format,
- const QString& description,
- const QString& filters);
- ~SALOMEGUI_Application();
-public slots:
- // Common display services
- void onDisplay(int);
- void onErase();
-
-protected:
- /* application management */
- bool initApp( SALOME_NamingService* name_service );
- bool createDesktop( SALOME_NamingService* name_service );
-
- /* popup */
- void onCreatePopup();
-
- /* document management */
- void onStudyCreated( QAD_Study* );
- void onStudyOpened( QAD_Study* );
- void onActiveStudyChanged( QAD_Study* oldActiveStudy,
- QAD_Study* newActiveStudy );
- void onStudyShown( QAD_Study* );
-
- /* menu management */
- int onUpdateViewActions ( QPopupMenu*, bool add, int index );
-
-private slots:
- void onDesktopCreated();
-
-private:
- void connectToViewer( QAD_ViewFrame* );
- void disconnectFromViewer( QAD_ViewFrame* );
- void createActions();
- void updateActions();
-
-private:
- ActionMap myViewActions;
- QAD_Operation* myCurOperation;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_CloseDlg.cxx
-// Author : Vasily RUSYAEV (vrv)
-// Module : SALOME
-
-#include "SALOMEGUI_CloseDlg.h"
-
-#include <qpushbutton.h>
-#include <qhbuttongroup.h>
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qmessagebox.h>
-using namespace std;
-
-
-SALOMEGUI_CloseDlg::SALOMEGUI_CloseDlg ( QWidget * parent, const char * name, bool modal, WFlags f )
- : QDialog ( parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setSizeGripEnabled ( TRUE ) ;
- setCaption( tr( "CAPTION" ) );
-
- QVBoxLayout* m_vbL = new QVBoxLayout( this );
- m_vbL->setMargin( 11 ); m_vbL->setSpacing( 6 );
-
- QLabel* m_lIcon = new QLabel (this, "m_lDescr");
- QPixmap pm = QMessageBox::standardIcon( QMessageBox::Warning );
- m_lIcon->setPixmap( pm );
- m_lIcon->setScaledContents( false );
- m_lIcon->setAlignment( Qt::AlignCenter );
-
- QLabel* m_lDescr = new QLabel (this, "m_lDescr");
- m_lDescr->setText ( tr ("CLOSE_DESCRIPTION") );
- m_lDescr->setAlignment( Qt::AlignCenter );
- m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 );
- m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
-
- QHBoxLayout* m_hl1 = new QHBoxLayout();
- m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
- m_hl1->addWidget( m_lIcon );
- m_hl1->addWidget( m_lDescr );
-
- m_pb1 = new QPushButton( tr ("SAVE_CLOSE"), this );
- m_pb2 = new QPushButton( tr ("CLOSE"), this );
- m_pb3 = new QPushButton( tr ("UNLOAD"), this );
- m_pb4 = new QPushButton( tr ("CANCEL"), this );
-
- QGridLayout* m_hl2 = new QGridLayout();
- m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
- m_hl2->addWidget( m_pb1, 0, 0 );
- m_hl2->addWidget( m_pb2, 0, 1 );
- m_hl2->addWidget( m_pb3, 0, 2 );
- m_hl2->addColSpacing( 3, 10 );
- m_hl2->setColStretch( 3, 5 );
- m_hl2->addWidget( m_pb4, 0, 4 );
-
- m_vbL->addLayout( m_hl1 );
- m_vbL->addLayout( m_hl2 );
-
- connect( m_pb1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( m_pb2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( m_pb3, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-void SALOMEGUI_CloseDlg::onButtonClicked()
-{
- QPushButton* btn = ( QPushButton* )sender();
- if ( btn == m_pb1 )
- done( 1 );
- if ( btn == m_pb2 )
- done( 2 );
- if ( btn == m_pb3 )
- done( 3 );
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_CloseDlg.h
-// Author : Vasily RUSYAEV (vrv)
-// Module : SALOME
-
-#ifndef SALOMEGUI_CloseDlg_H
-#define SALOMEGUI_CloseDlg_H
-
-#include <qdialog.h>
-
-class SALOMEGUI_CloseDlg: public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_CloseDlg ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 ) ;
- ~SALOMEGUI_CloseDlg ( ) { };
-
-private slots:
- void onButtonClicked();
-
-private:
- QPushButton* m_pb1;
- QPushButton *m_pb2;
- QPushButton *m_pb3;
- QPushButton *m_pb4;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Desktop.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_Desktop.h"
-#include "SALOME_Selection.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-using namespace std;
-
-/*!
- Constructor
-*/
-SALOMEGUI_Desktop::SALOMEGUI_Desktop(SALOME_NamingService* name_service) :
- QAD_Desktop( name_service )
-{
- QAD_ASSERT_DEBUG_ONLY( !myStdActions.isEmpty() );
- //myStdActions.at( FileOpenId )->setEnabled( true );
- //myStdActions.at( FileSaveId )->setEnabled( true );
- //myStdActions.at( FileSaveAsId )->setEnabled( true );
-}
-
-/*!
- Disable file actions for DEMO
-*/
-void SALOMEGUI_Desktop::updateDesktop( UpdateCommand cmd )
-{
- QAD_Desktop::updateDesktop( cmd );
-
- QAD_ASSERT_DEBUG_ONLY( !myStdActions.isEmpty() );
- //myStdActions.at( FileOpenId )->setEnabled( true );
- //myStdActions.at( FileSaveId )->setEnabled( true );
- //myStdActions.at( FileSaveAsId )->setEnabled( true );
-}
-
-QString SALOMEGUI_Desktop::getComponentFromSelection()
-{
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- /* copy the list */
- SALOME_ListIO List;
- SALOME_ListIteratorOfListIO Itinit( Sel->StoredIObjects() );
- for (; Itinit.More(); Itinit.Next()) {
- List.Append(Itinit.Value());
- }
-
- SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
-
- SALOME_ListIteratorOfListIO It( List );
- QString parentComp;
-
- for (; It.More(); It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
-
- if (!IObject->hasEntry()) continue;
-
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
-
- if ( !obj->_is_nil() ) {
- SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
- if ( !comp->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if (comp->FindAttribute(anAttr, "AttributeName")) {
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- QString compName(aName->Value());
- if (parentComp.isNull())
- parentComp = compName;
- else if (parentComp.compare(compName) != 0) { // objects belonging to different components are selected
- parentComp = QString::null;
- break;
- }
- }
- }
- }
- }
-
- return parentComp;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Desktop.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_DESKTOP_H
-#define SALOMEGUI_DESKTOP_H
-
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-class SALOMEGUI_Desktop : public QAD_Desktop
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_Desktop( SALOME_NamingService* name_service );
-
- // returns the name of the component selected objects belong to (null if two or more components)
- QString getComponentFromSelection();
-
-protected:
- void updateDesktop( UpdateCommand );
-
-};
-
-#endif
-
+++ /dev/null
-// File : SALOMEGUI_ExternalBrowserDlg.cxx
-// Author : Nichael ZORIN
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_ExternalBrowserDlg.h"
-
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qmessagebox.h>
-#include <qlayout.h>
-
-#include "QAD_FileDlg.h"
-#include "QAD_Tools.h"
-using namespace std;
-
-/*
- * Constructs a modal SALOMEGUI_ExternalBowserDlg which is a child of 'parent'
- *
- */
-
-SALOMEGUI_ExternalBrowserDlg::SALOMEGUI_ExternalBrowserDlg( QWidget* parent )
- : QDialog( parent, "SALOMEGUI_ExternalBrowserDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr( "MEN_EXTERNAL_BROWSER" ) );
- setSizeGripEnabled( true );
-
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- QLabel* LabelApp = new QLabel( tr( "MEN_EXTERNAL_BROWSER_APP" ), TopGroup, "LabelApp" );
- TopGroupLayout->addWidget( LabelApp, 0, 0 );
- ApplicationLine = new QLineEdit( TopGroup );
- ApplicationLine->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- ApplicationLine->setMinimumSize( 250, 0 );
- LabelApp->setBuddy(ApplicationLine);
- TopGroupLayout->addWidget( ApplicationLine, 0, 1 );
-
- QLabel* LabelParams = new QLabel( tr( "MEN_EXTERNAL_BROWSER_PARAMS" ), TopGroup, "LabelParams" );
- TopGroupLayout->addWidget( LabelParams, 1, 0 );
- ParametersLine = new QLineEdit( TopGroup );
- ParametersLine->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- ParametersLine->setMinimumSize( 250, 0 );
- LabelParams->setBuddy(ParametersLine);
- TopGroupLayout->addWidget( ParametersLine, 1, 1 );
-
- browseButton = new QPushButton( tr( "MEN_EXTERNAL_BROWSER_BROWSE" ) , TopGroup, "browseButton" );
- TopGroupLayout->addWidget( browseButton, 0, 2 );
-
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 381, 48 ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- QPushButton* buttonOk = new QPushButton( tr( "BUT_OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- QPushButton* buttonCancel = new QPushButton( tr( "BUT_CANCEL" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
-
- // signals and slots connections
- connect( browseButton, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
-}
-
-void SALOMEGUI_ExternalBrowserDlg::onButtonClicked()
-{
- QStringList flt;
- flt.append( "ALL Files(*)" );
- QString aDir = QAD_Tools::getDirFromPath ( ApplicationLine->text() );
- QFileInfo aFileInfo = QAD_FileDlg::getFileName (this, aDir, flt, tr( "MEN_EXTERNAL_BROWSER_CHOOSEAPP" ), true);
- if(aFileInfo.exists())
- ApplicationLine->setText(aFileInfo.filePath());
-}
-
-void SALOMEGUI_ExternalBrowserDlg::setSettings(const QString& AppString, const QString& ParamsString)
-{
- ApplicationLine->setText(AppString);
- ParametersLine->setText(ParamsString);
-}
-
-QString SALOMEGUI_ExternalBrowserDlg::getApp()
-{
- return ApplicationLine->text();
-}
-
-QString SALOMEGUI_ExternalBrowserDlg::getParams()
-{
- return ParametersLine->text();
-}
-
-void SALOMEGUI_ExternalBrowserDlg::accept() {
-
- QFileInfo aFile = QFileInfo(ApplicationLine->text());
-
- if (aFile.isFile() && !aFile.isExecutable())
- QMessageBox::warning ( this, tr( "Error" ) , tr ( "MEN_EXTERNAL_BROWSER_NOTEXECUTABLE" ));
- else
- QDialog::accept();
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_ExternalBrowserDlg::~SALOMEGUI_ExternalBrowserDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-
+++ /dev/null
-// File : SALOMEGUI_ExternalBrowserDlg.h
-// Author : Michael Zorin
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_EXTERNAL_BROWSER_DLG_H
-#define SALOMEGUI_EXTERNAL_BROWSER_DLG_H
-
-#include <qdialog.h>
-#include <qlineedit.h>
-
-class SALOMEGUI_ExternalBrowserDlg : public QDialog
-{
- Q_OBJECT
-
- public:
-
- SALOMEGUI_ExternalBrowserDlg( QWidget* parent = 0 );
- ~SALOMEGUI_ExternalBrowserDlg();
- void setSettings(const QString& AppString, const QString& ParamsString);
- QString getApp();
- QString getParams();
-
- private slots:
-
- void onButtonClicked();
- void accept();
-
- private:
-
- QPushButton* browseButton;
- QLineEdit* ApplicationLine;
- QLineEdit* ParametersLine;
-};
-
-#endif // SALOMEGUI_EXTERNAL_BROWSER_DLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_ImportOperation.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_ImportOperation.h"
-using namespace std;
-
-SALOMEGUI_ImportOperation::SALOMEGUI_ImportOperation( QAD_Study* study ) :
-QAD_Operation( study )
-{
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_ImportOperation.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#if !defined SALOMEGUI_IMPORTOPERATION
-#define SALOMEGUI_IMPORTOPERATION
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "QAD_Operation.h"
-class SALOMEGUI_ImportOperation : public QAD_Operation
-{
-public:
- SALOMEGUI_ImportOperation( QAD_Study* );
-};
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_LoadStudiesDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_LoadStudiesDlg.h"
-
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlistbox.h>
-#include <qpushbutton.h>
-using namespace std;
-
-#define SPACING_SIZE 6
-#define MARGIN_SIZE 11
-#define MIN_LISTBOX_WIDTH 150
-#define MIN_LISTBOX_HEIGHT 100
-
-SALOMEGUI_LoadStudiesDlg::SALOMEGUI_LoadStudiesDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "SALOMEGUI_LoadStudiesDlg" );
- resize( 321, 181 );
- setCaption( name );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* aTopLayout = new QGridLayout(this);
- aTopLayout->setMargin(MARGIN_SIZE);
- aTopLayout->setSpacing(SPACING_SIZE);
-
- TextLabel1 = new QLabel( this, "TextLabel1" );
- TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) );
- TextLabel1->setText( tr( "MEN_STUDIES_CHOICE" ) );
-
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- buttonOk = new QPushButton( this, "buttonOk" );
- buttonOk->setText( tr( "BUT_OK" ) );
- buttonOk->setAutoDefault( true );
- buttonOk->setDefault( true );
-
- buttonCancel = new QPushButton( this, "buttonCancel" );
- buttonCancel->setText( tr( "BUT_CANCEL" ) );
- buttonCancel->setAutoDefault( true );
-
- aBtnLayout->addWidget( buttonOk );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( buttonCancel );
-
- ListComponent = new QListBox( this, "ListComponent" );
- ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
- ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
- ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- ListComponent->setSelectionMode(QListBox::Single);
-
- aTopLayout->addWidget(TextLabel1, 0, 0);
- aTopLayout->addWidget(ListComponent, 1, 0);
- aTopLayout->addLayout(aBtnLayout, 2, 0);
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_LoadStudiesDlg::~SALOMEGUI_LoadStudiesDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_LoadStudiesDlg.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_LOADSTUDIESDLG_H
-#define SALOMEGUI_LOADSTUDIESDLG_H
-
-#include <qvariant.h>
-#include <qdialog.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QLabel;
-class QListBox;
-class QListBoxItem;
-class QPushButton;
-
-class SALOMEGUI_LoadStudiesDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_LoadStudiesDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SALOMEGUI_LoadStudiesDlg();
-
- QLabel* TextLabel1;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QListBox* ListComponent;
-
-};
-
-#endif // SALOMEGUI_LOADSTUDIESDLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_NameDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_NameDlg.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Tools.h"
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-using namespace std;
-
-/*!
- Constructor
-*/
-SALOMEGUI_NameDlg::SALOMEGUI_NameDlg( QWidget* parent )
- : QDialog( parent ? parent : QAD_Application::getDesktop(),
- "SALOMEGUI_NameDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_RENAME") );
- setSizeGripEnabled( TRUE );
-
- QVBoxLayout* topLayout = new QVBoxLayout( this );
- topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
-
- /***************************************************************/
- QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
- QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
-
- QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
- TextLabel->setText( tr( "NAME_LBL" ) );
- GroupC1Layout->addWidget( TextLabel );
-
- myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
- myLineEdit->setMinimumSize( 250, 0 );
- GroupC1Layout->addWidget( myLineEdit );
-
- /***************************************************************/
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
-
- myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
- myButtonOk->setText( tr( "BUT_OK" ) );
- myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( myButtonOk );
-
- GroupButtonsLayout->addStretch();
-
- myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- myButtonCancel->setText( tr( "BUT_CANCEL" ) );
- myButtonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( myButtonCancel );
- /***************************************************************/
-
- topLayout->addWidget( GroupC1 );
- topLayout->addWidget( GroupButtons );
-
- // signals and slots connections
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- /* Move widget on the botton right corner of main widget */
- QAD_Tools::centerWidget( this, parent );
-}
-
-/*!
- Destructor
-*/
-SALOMEGUI_NameDlg::~SALOMEGUI_NameDlg()
-{
-}
-
-/*!
- Sets name
-*/
-void SALOMEGUI_NameDlg::setName( const QString& name )
-{
- myLineEdit->setText( name );
- myLineEdit->end(false);
- myLineEdit->home(true);
-}
-
-/*!
- Returns name entered by user
-*/
-QString SALOMEGUI_NameDlg::name()
-{
- return myLineEdit->text();
-}
-
-void SALOMEGUI_NameDlg::accept()
-{
- if ( name().stripWhiteSpace().isEmpty() )
- return;
- QDialog::accept();
-}
-
-/*!
- Creates modal <Rename> dialog and returns name entered [ static ]
-*/
-QString SALOMEGUI_NameDlg::getName( QWidget* parent, const QString& oldName )
-{
- QString n;
- SALOMEGUI_NameDlg* dlg = new SALOMEGUI_NameDlg( parent );
- if ( !oldName.isNull() )
- dlg->setName( oldName );
- if ( dlg->exec() == QDialog::Accepted )
- n = dlg->name();
- delete dlg;
- return n;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_NameDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_NAMEDLG_H
-#define SALOMEGUI_NAMEDLG_H
-
-#include <qdialog.h>
-
-class QLineEdit;
-class QPushButton;
-
-//=================================================================================
-// class : SALOMEGUI_NameDlg
-// purpose : Common <Rename> dialog box class
-//=================================================================================
-class SALOMEGUI_NameDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_NameDlg( QWidget* parent = 0 );
- ~SALOMEGUI_NameDlg();
-
- void setName( const QString& name );
- QString name();
-
- static QString getName( QWidget* parent = 0, const QString& oldName = QString::null );
-
-protected slots:
- void accept();
-
-private:
- QPushButton* myButtonOk;
- QPushButton* myButtonCancel;
- QLineEdit* myLineEdit;
-};
-
-#endif // SALOMEGUI_NAMEDLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_OpenWith.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_OpenWith.h"
-
-#include <qlabel.h>
-#include <qcheckbox.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qlistbox.h>
-using namespace std;
-
-#define SPACING_SIZE 6
-#define MARGIN_SIZE 11
-#define MIN_LISTBOX_WIDTH 150
-#define MIN_LISTBOX_HEIGHT 100
-
-/*
- * Constructs modal SALOMEGUI_OpenWith which is a child of 'parent', with the
- * name 'name'
- */
-SALOMEGUI_OpenWith::SALOMEGUI_OpenWith(QWidget* parent, const char* name)
- : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "SALOMEGUI_OpenWith" );
- setCaption( tr("OPEN_WITH_TLT") );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* aTopLayout = new QGridLayout(this);
- aTopLayout->setMargin(MARGIN_SIZE);
- aTopLayout->setSpacing(SPACING_SIZE);
-
- AllwaysCheckBox = 0;
-/*
- AllwaysCheckBox = new QCheckBox( this, "AllwaysCheckBox" );
- AllwaysCheckBox->setText( tr( "MEN_COMPONENT_CHOICE1" ) );
-*/
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- buttonOk = new QPushButton( this, "buttonOk" );
- buttonOk->setText( tr( "BUT_OK" ) );
- buttonOk->setAutoDefault( true );
- buttonOk->setDefault( true );
-
- buttonCancel = new QPushButton( this, "buttonCancel" );
- buttonCancel->setText( tr( "BUT_CANCEL" ) );
- buttonCancel->setAutoDefault( true );
-
- aBtnLayout->addWidget( buttonOk );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( buttonCancel );
-
- ListComponent = new QListBox( this, "ListComponent" );
- ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
- ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
- ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- ListComponent->setSelectionMode(QListBox::Single);
-
- aTopLayout->addWidget(ListComponent, 0, 0);
-// aTopLayout->addWidget(AllwaysCheckBox, 1, 0);
- aTopLayout->addLayout(aBtnLayout, 1, 0);
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( ListComponent, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ));
- connect( ListComponent, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onDoubleClickEvent( QListBoxItem* ) ));
-
- updateButtonState();
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_OpenWith::~SALOMEGUI_OpenWith()
-{
-}
-
-/*
- Inserts new component into component list
-*/
-void SALOMEGUI_OpenWith::addComponent(const QString& aComp)
-{
- ListComponent->insertItem(aComp);
-}
-
-/*
- Returns choosen component
-*/
-QString SALOMEGUI_OpenWith::getComponent()
-{
- return ListComponent->currentText();
-}
-
-bool SALOMEGUI_OpenWith::getAlwaysFlag()
-{
- if ( AllwaysCheckBox )
- return AllwaysCheckBox->isChecked();
- return false;
-}
-void SALOMEGUI_OpenWith::onSelectionChanged()
-{
- updateButtonState();
-}
-
-void SALOMEGUI_OpenWith:: updateButtonState()
-{
- buttonOk->setEnabled( ListComponent->currentItem() >=0 &&
- ListComponent->currentItem() < ListComponent->count() ) ;
-}
-
-void SALOMEGUI_OpenWith::onDoubleClickEvent( QListBoxItem* item )
-{
- if ( item )
- accept();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_OpenWith.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_OPENWITH_H
-#define SALOMEGUI_OPENWITH_H
-
-#include <qdialog.h>
-
-class QListBox;
-class QListBoxItem;
-class QCheckBox;
-class QPushButton;
-
-class SALOMEGUI_OpenWith : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_OpenWith(QWidget* parent = 0, const char* name = 0);
- ~SALOMEGUI_OpenWith();
-
- void addComponent(const QString& aComp);
- QString getComponent();
- bool getAlwaysFlag();
-
-protected slots:
- void onSelectionChanged();
- void onDoubleClickEvent( QListBoxItem* item );
-
-protected:
- void updateButtonState();
-
-protected:
- QListBox* ListComponent;
- QCheckBox* AllwaysCheckBox;
- QPushButton* buttonHelp;
- QPushButton* buttonCancel;
- QPushButton* buttonOk;
-};
-
-#endif // SALOMEGUI_OPENWITH_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_QtCatchCorbaException.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
-
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
-using namespace std;
-
-void QtCatchCorbaException(const SALOME::SALOME_Exception & S_ex)
-{
- switch (S_ex.details.type)
- {
- case SALOME::COMM:
- case SALOME::INTERNAL_ERROR:
- {
- QString str(S_ex.details.text);
- QString source(S_ex.details.sourceFile);
- QString line;
- line.setNum(S_ex.details.lineNumber);
- QString message = str + " \n" + source + " : " + line;
- QAD_MessageBox::error1
- ( QAD_Application::getDesktop(),
- QObject::tr ("Engine Error"),
- message,
- QObject::tr ("OK") );
- break;
- }
-
- case SALOME::BAD_PARAM:
- {
- QString message(S_ex.details.text);
-#ifdef _DEBUG_
- QString source(S_ex.details.sourceFile);
- QString line;
- line.setNum(S_ex.details.lineNumber);
- message = message + " \n" + source + " : " + line;
-#endif
- QAD_MessageBox::warn1
- ( QAD_Application::getDesktop(),
- QObject::tr ("Engine Warning"),
- message,
- QObject::tr ("OK") );
- break;
- }
- default:
- {
- QString str("SALOME CORBA Exception Type invalid");
- QString source(S_ex.details.sourceFile);
- QString line;
- line.setNum(S_ex.details.lineNumber);
- QString message = str + " \n" + source + " : " + line;
- QAD_MessageBox::error1
- ( QAD_Application::getDesktop(),
- QObject::tr ("Internal SALOME Error"),
- message,
- QObject::tr ("OK") );
- break;
- }
- }
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_QtCatchCorbaException.hxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEGUI__QTCATCHCORBAEXCEPTION_HXX_
-#define _SALOMEGUI__QTCATCHCORBAEXCEPTION_HXX_
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Exception)
-
-void QtCatchCorbaException(const SALOME::SALOME_Exception & S_ex);
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_SetValueDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_SetValueDlg.h"
-#include "QAD_Tools.h"
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvalidator.h>
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-/*!
- Constructor
-*/
-SALOMEGUI_SetValueDlg::SALOMEGUI_SetValueDlg( QWidget* parent )
- : QDialog( parent, "SALOMEGUI_SetValueDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_SETVALUE") );
- setSizeGripEnabled( TRUE );
-
- QVBoxLayout* topLayout = new QVBoxLayout( this );
- topLayout->setMargin( MARGIN_SIZE ); topLayout->setSpacing( SPACING_SIZE );
-
- /***************************************************************/
- QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setMargin( 0 ); TopGroup->layout()->setSpacing( 0 );
- QHBoxLayout* TopGroupLayout = new QHBoxLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setMargin( MARGIN_SIZE ); TopGroupLayout->setSpacing( SPACING_SIZE );
-
- myLabel = new QLabel( tr( "VALUE_LBL" ), TopGroup, "myLabel" );
- myLineEdit = new QLineEdit( TopGroup, "myLineEdit" );
- myLineEdit->setMinimumSize( 250, 0 );
-
- TopGroupLayout->addWidget( myLabel );
- TopGroupLayout->addWidget( myLineEdit );
-
- /***************************************************************/
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setMargin( MARGIN_SIZE ); GroupButtonsLayout->setSpacing( SPACING_SIZE );
-
- myButtonOk = new QPushButton( tr( "BUT_OK" ), GroupButtons, "myButtonOk" );
- myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
- myButtonCancel = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons, "myButtonCancel" );
- myButtonCancel->setAutoDefault( TRUE );
-
- GroupButtonsLayout->addWidget( myButtonOk );
- GroupButtonsLayout->addStretch();
- GroupButtonsLayout->addWidget( myButtonCancel );
- /***************************************************************/
-
- topLayout->addWidget( TopGroup );
- topLayout->addWidget( GroupButtons );
-
- // signals and slots connections
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- /* Move widget on the botton right corner of main widget */
- QAD_Tools::centerWidget( this, parent );
-}
-
-/*!
- Destructor
-*/
-SALOMEGUI_SetValueDlg::~SALOMEGUI_SetValueDlg()
-{
-}
-
-/*!
- Sets value
-*/
-void SALOMEGUI_SetValueDlg::setValue( const QString& value )
-{
- myLineEdit->setText( value );
- myLineEdit->selectAll();
-}
-
-/*!
- Returns value entered by user
-*/
-QString SALOMEGUI_SetValueDlg::value()
-{
- return myLineEdit->text();
-}
-
-/*!
- Sets validator
-*/
-void SALOMEGUI_SetValueDlg::setValidator( QValidator* v )
-{
- myLineEdit->setValidator( v );
-}
-
-/*!
- Sets label text
-*/
-void SALOMEGUI_SetValueDlg::setLabel( const QString& label )
-{
- myLabel->setText( label );
-}
-
-void SALOMEGUI_SetValueDlg::accept()
-{
- const QValidator* v = myLineEdit->validator();
- if ( v ) {
- if ( v->inherits( "QIntValidator" ) ) {
- bool b;
- int val = myLineEdit->text().toInt( &b );
- const QIntValidator* iv = dynamic_cast<const QIntValidator*>(v);
- if ( !b || val < iv->bottom() || val > iv->top())
- return;
- }
- }
- QDialog::accept();
-}
-
-/*!
- Gets string value
-*/
-QString SALOMEGUI_SetValueDlg::getString ( const QString& caption,
- const QString& label,
- const QString& oldValue,
- bool* ok,
- QWidget* parent )
-{
- QString v = QString::null;
- SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent );
- dlg->setCaption( caption );
- dlg->setLabel( label );
- if ( !oldValue.isNull() )
- dlg->setValue( oldValue );
- int result = dlg->exec();
- if ( result == QDialog::Accepted )
- v = dlg->value();
- if ( ok )
- *ok = result == QDialog::Accepted;
- delete dlg;
- return v;
-}
-
-/*!
- Gets integer value
-*/
-int SALOMEGUI_SetValueDlg::getInteger( const QString& caption,
- const QString& label,
- const int oldValue,
- bool* ok,
- QWidget* parent )
-{
- int v = 0;
- SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent );
- dlg->setCaption( caption );
- dlg->setLabel( label );
- dlg->setValidator( new QIntValidator( dlg ) );
- dlg->setValue( QString::number( oldValue ) );
- int result = dlg->exec();
- if ( result == QDialog::Accepted )
- v = dlg->value().toInt();
- if ( ok )
- *ok = result == QDialog::Accepted;
- delete dlg;
- return v;
-}
-
-/*!
- Gets integer value
-*/
-int SALOMEGUI_SetValueDlg::getInteger( const QString& caption,
- const QString& label,
- int bottom,
- int top,
- const int oldValue,
- bool* ok,
- QWidget* parent )
-{
- int v = 0;
- SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent );
- dlg->setCaption( caption );
- dlg->setLabel( label );
- dlg->setValidator( new QIntValidator( bottom, top, dlg ) );
- dlg->setValue( QString::number( oldValue ) );
- int result = dlg->exec();
- if ( result == QDialog::Accepted )
- v = dlg->value().toInt();
- if ( ok )
- *ok = result == QDialog::Accepted;
- delete dlg;
- return v;
-}
-
-/*!
- Gets double value
-*/
-double SALOMEGUI_SetValueDlg::getDouble ( const QString& caption,
- const QString& label,
- const double oldValue,
- bool* ok,
- QWidget* parent )
-{
- double v = 0;
- SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent );
- dlg->setCaption( caption );
- dlg->setLabel( label );
- dlg->setValidator( new QDoubleValidator( dlg ) );
- dlg->setValue( QString::number( oldValue ) );
- int result = dlg->exec();
- if ( result == QDialog::Accepted )
- v = dlg->value().toDouble();
- if ( ok )
- *ok = result == QDialog::Accepted;
- delete dlg;
- return v;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_SetValueDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_SETVALUEDLG_H
-#define SALOMEGUI_SETVALUEDLG_H
-
-#include <qdialog.h>
-
-class QLineEdit;
-class QPushButton;
-class QValidator;
-class QLabel;
-
-//=================================================================================
-// class : SALOMEGUI_SetValueDlg
-// purpose : Common dialog box for setting integer, double and string values
-//=================================================================================
-class SALOMEGUI_SetValueDlg : public QDialog
-{
-public:
- static QString getString ( const QString& caption,
- const QString& label,
- const QString& oldValue = QString::null,
- bool* ok = 0,
- QWidget* parent = 0 );
- static int getInteger( const QString& caption,
- const QString& label,
- const int oldValue = 0,
- bool* ok = 0,
- QWidget* parent = 0 );
- static int getInteger( const QString& caption,
- const QString& label,
- int bottom,
- int top,
- const int oldValue = 0,
- bool* ok = 0,
- QWidget* parent = 0 );
- static double getDouble ( const QString& caption,
- const QString& label,
- const double oldValue = 0.0,
- bool* ok = 0,
- QWidget* parent = 0 );
-public slots:
- void accept();
-
-private:
- SALOMEGUI_SetValueDlg( QWidget* parent = 0 );
- ~SALOMEGUI_SetValueDlg();
-
- void setValue( const QString& value );
- QString value();
- void setValidator( QValidator* v );
- void setLabel( const QString& label );
-
-private:
- QLabel* myLabel;
- QLineEdit* myLineEdit;
- QPushButton* myButtonOk;
- QPushButton* myButtonCancel;
-};
-
-#endif // SALOMEGUI_SETVALUEDLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_SetupCurveDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_SetupCurveDlg.h"
-#include "QAD_Tools.h"
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-#include <qtoolbutton.h>
-#include <qgroupbox.h>
-#include <qcolordialog.h>
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_COMBO_WIDTH 100
-#define MIN_SPIN_WIDTH 50
-#define MAX_LINE_WIDTH 100
-
-/*!
- Constructor
-*/
-SALOMEGUI_SetupCurveDlg::SALOMEGUI_SetupCurveDlg( QWidget* parent )
- : QDialog( parent, "SALOMEGUI_SetupCurveDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_SETUP_CURVE") );
- setSizeGripEnabled( TRUE );
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- QGroupBox* TopGroup = new QGroupBox( this );
- TopGroup->setColumnLayout( 0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 ); TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( SPACING_SIZE ); TopGroupLayout->setMargin( MARGIN_SIZE );
-
- QLabel* aLineTypeLab = new QLabel( tr( "CURVE_LINE_TYPE_LAB" ), TopGroup );
- myLineCombo = new QComboBox( false, TopGroup );
- myLineCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myLineCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLineCombo->insertItem( tr( "NONE_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "SOLID_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASH_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
- myLineCombo->setCurrentItem( 1 ); // SOLID by default
-
- QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), TopGroup );
- myLineSpin = new QSpinBox( 0, MAX_LINE_WIDTH, 1, TopGroup );
- myLineSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myLineSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- myLineSpin->setValue( 0 ); // default width is 0
-
- QLabel* aMarkerLab = new QLabel( tr( "CURVE_MARKER_TYPE_LAB" ), TopGroup );
- myMarkerCombo = new QComboBox( false, TopGroup );
- myMarkerCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myMarkerCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myMarkerCombo->insertItem( tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "XCROSS_MARKER_LBL" ) );
- myMarkerCombo->setCurrentItem( 1 ); // CIRCLE by default
-
- QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), TopGroup );
- myColorBtn = new QToolButton( TopGroup );
-
- TopGroupLayout->addWidget( aLineTypeLab, 0, 0 );
- TopGroupLayout->addMultiCellWidget( myLineCombo, 0, 0, 1, 2 );
- TopGroupLayout->addWidget( aLineWidthLab, 1, 0 );
- TopGroupLayout->addMultiCellWidget( myLineSpin, 1, 1, 1, 2 );
- TopGroupLayout->addWidget( aMarkerLab, 2, 0 );
- TopGroupLayout->addMultiCellWidget( myMarkerCombo, 2, 2, 1, 2 );
- TopGroupLayout->addWidget( aColorLab, 3, 0 );
- TopGroupLayout->addWidget( myColorBtn, 3, 1 );
- TopGroupLayout->setColStretch( 2, 5 );
-
- QGroupBox* GroupButtons = new QGroupBox( this );
- GroupButtons->setColumnLayout( 0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 ); GroupButtons->layout()->setMargin( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( SPACING_SIZE ); GroupButtonsLayout->setMargin( MARGIN_SIZE );
-
- myOkBtn = new QPushButton( tr( "BUT_OK" ), GroupButtons );
- myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ) , GroupButtons );
- myCancelBtn->setAutoDefault( true );
-
- GroupButtonsLayout->addWidget( myOkBtn );
- GroupButtonsLayout->addStretch();
- GroupButtonsLayout->addWidget( myCancelBtn );
-
- connect( myColorBtn, SIGNAL( clicked() ), this, SLOT( onColorChanged() ) );
- connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- setColor( QColor( 0, 0, 0 ) );
-
- topLayout->addWidget( TopGroup, 0, 0 );
- topLayout->addWidget( GroupButtons, 1, 0 );
-
- QAD_Tools::centerWidget( this, parent );
-}
-/*!
- Destructor
-*/
-SALOMEGUI_SetupCurveDlg::~SALOMEGUI_SetupCurveDlg()
-{
-}
-/*!
- Sets line style and width
-*/
-void SALOMEGUI_SetupCurveDlg::setLine( const int line, const int width )
-{
- myLineCombo->setCurrentItem( line );
- myLineSpin->setValue( width );
-}
-/*!
- Gets line style
-*/
-int SALOMEGUI_SetupCurveDlg::getLine() const
-{
- return myLineCombo->currentItem();
-}
-/*!
- Gets line width
-*/
-int SALOMEGUI_SetupCurveDlg::getLineWidth() const
-{
- return myLineSpin->value();
-}
-/*!
- Sets marker style
-*/
-void SALOMEGUI_SetupCurveDlg::setMarker( const int marker )
-{
- myMarkerCombo->setCurrentItem( marker );
-}
-/*!
- Gets marker style
-*/
-int SALOMEGUI_SetupCurveDlg::getMarker() const
-{
- return myMarkerCombo->currentItem();
-}
-/*!
- Sets color
-*/
-void SALOMEGUI_SetupCurveDlg::setColor( const QColor& color )
-{
- QPalette pal = myColorBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
- myColorBtn->setPalette( pal );
-}
-/*!
- Gets color
-*/
-QColor SALOMEGUI_SetupCurveDlg::getColor() const
-{
- return myColorBtn->palette().active().button();
-}
-/*!
- <Color> button slot, invokes color selection dialog box
-*/
-void SALOMEGUI_SetupCurveDlg::onColorChanged()
-{
- QColor color = QColorDialog::getColor( getColor() );
- if ( color.isValid() ) {
- setColor( color );
- }
-}
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_SetupCurveDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_SetupCurveDlg_H
-#define SALOMEGUI_SetupCurveDlg_H
-
-#include <qdialog.h>
-
-//=================================================================================
-// class : SALOMEGUI_SetupCurveDlg
-// purpose : Dialog box for setup Plot2d curve
-//=================================================================================
-
-class QPushButton;
-class QComboBox;
-class QSpinBox;
-class QToolButton;
-
-class SALOMEGUI_SetupCurveDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_SetupCurveDlg( QWidget* parent = 0 );
- ~SALOMEGUI_SetupCurveDlg();
-
-public:
- void setLine( const int line, const int width );
- int getLine() const;
- int getLineWidth() const;
- void setMarker( const int marker );
- int getMarker() const ;
- void setColor( const QColor& color );
- QColor getColor() const;
-
-protected slots:
- void onColorChanged();
-
-private:
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
- QComboBox* myLineCombo;
- QSpinBox* myLineSpin;
- QComboBox* myMarkerCombo;
- QToolButton* myColorBtn;
-};
-
-#endif // SALOMEGUI_SetupCurveDlg_H
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_StudyPropertiesDlg.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_StudyPropertiesDlg.h"
-
-#include "QAD_Desktop.h"
-#include "QAD_ListView.h"
-
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-#include <qpushbutton.h>
-#include <qlayout.h>
-using namespace std;
-
-#define DEFAULT_MARGIN 11
-#define DEFAULT_SPACING 6
-#define SPACER_SIZE 5
-#define MIN_LIST_WIDTH 300
-#define MIN_LIST_HEIGHT 150
-
-class SALOMEGUI_PropItem : public QAD_ListViewItem
-{
-public:
-// constructor
- SALOMEGUI_PropItem(QAD_ListView* parent,
- const QString theName,
- const bool theEditable,
- const int theUserType) :
- QAD_ListViewItem(parent, theName, theEditable)
- {
- setUserType(theUserType);
- }
-// constructor
- SALOMEGUI_PropItem(QAD_ListView* parent,
- QAD_ListViewItem* after,
- const QString theName,
- const bool theEditable,
- const int theUserType) :
- QAD_ListViewItem(parent, after, theName, theEditable)
- {
- setUserType(theUserType);
- }
-// fills widget with initial values (list or single value)
- void fillWidgetWithValues(QAD_EntityEdit* theWidget)
- {
- QStringList list;
- switch(getUserType()) {
- case SALOMEGUI_StudyPropertiesDlg::prpModeId:
- {
- list << QObject::tr("PRP_MODE_FROM_SCRATCH")<< QObject::tr("PRP_MODE_FROM_COPYFROM");
- theWidget->insertList(list);
- break;
- }
- case SALOMEGUI_StudyPropertiesDlg::prpLockedId:
- {
- list << QObject::tr("PRP_NO") << QObject::tr("PRP_YES");
- theWidget->insertList(list, getValue() == QObject::tr("PRP_NO") ? 0 : 1);
- break;
- }
- case SALOMEGUI_StudyPropertiesDlg::prpModificationsId:
- {
- QAD_Study* study = QAD_Application::getDesktop()->getActiveStudy();
- if (study) {
- SALOMEDS::Study_var studyDoc = study->getStudyDocument();
- SALOMEDS::AttributeStudyProperties_var propAttr;
- if (!studyDoc->_is_nil()) {
- propAttr = studyDoc->GetProperties();
- if (!propAttr->_is_nil()) {
- SALOMEDS::StringSeq_var aUsers;
- SALOMEDS::LongSeq_var aMins, aHours, aDays, aMonths, aYears;
- propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
- int aCnt = aUsers->length();
- for ( int i = 0; i < aCnt; i++ ) {
- QString val;
- val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [i],
- aMonths[i],
- aYears [i],
- aHours [i],
- aMins [i]);
- val = val + " : " + QString(aUsers[i]);
- list.prepend(val);
- }
- theWidget->setDuplicatesEnabled(true);
- theWidget->insertList(list);
- }
- }
- }
- break;
- }
- default:
- {
- QAD_ListViewItem::fillWidgetWithValues(theWidget);
- break;
- }
- }
- }
-// finishes editing of entity
- virtual UpdateType finishEditing(QAD_EntityEdit* theWidget) {
- if ( getUserType() == SALOMEGUI_StudyPropertiesDlg::prpModificationsId )
- return utCancel;
- else
- return QAD_ListViewItem::finishEditing(theWidget);
- }
-};
-
-SALOMEGUI_StudyPropertiesDlg::SALOMEGUI_StudyPropertiesDlg(QWidget* parent)
- : QDialog(parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- myChanged( false )
-{
- setCaption(tr("TLT_STUDY_PROPERTIES"));
- setSizeGripEnabled( true );
-
- clearWFlags(Qt::WStyle_ContextHelp);
-
- QGridLayout* mainLayout = new QGridLayout(this);
- mainLayout->setMargin(DEFAULT_MARGIN);
- mainLayout->setSpacing(DEFAULT_SPACING);
-
- myPropList = new QAD_ListView(this);
- myPropList->addColumn("");
- myPropList->addColumn("");
- myPropList->enableEditing(TRUE);
- myPropList->setMinimumSize(MIN_LIST_WIDTH, MIN_LIST_HEIGHT);
- mainLayout->addMultiCellWidget(myPropList, 0, 0, 0, 2);
-
- myOKBtn = new QPushButton(tr("BUT_OK"), this);
- mainLayout->addWidget(myOKBtn, 1, 0);
-
- myCancelBtn = new QPushButton(tr("BUT_CANCEL"), this);
- mainLayout->addWidget(myCancelBtn, 1, 2);
-
- QSpacerItem* spacer1 = new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum);
- mainLayout->addItem(spacer1, 1, 1);
-
- // Display study properties
- QAD_Study* study = ((QAD_Desktop*)parent)->getActiveStudy();
- if (study) myStudyDoc = study->getStudyDocument();
-
- initData();
-
- connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
- connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
-}
-
-SALOMEGUI_StudyPropertiesDlg::~SALOMEGUI_StudyPropertiesDlg()
-{
-}
-
-void SALOMEGUI_StudyPropertiesDlg::initData()
-{
- bool hasData = !myStudyDoc->_is_nil();
- SALOMEDS::AttributeStudyProperties_var propAttr;
- if (hasData) propAttr = myStudyDoc->GetProperties();
- hasData = hasData && !propAttr->_is_nil();
-
- // Study author's name
- SALOMEGUI_PropItem* item = new SALOMEGUI_PropItem(myPropList, tr("PRP_AUTHOR")+":", true, prpAuthorId);
- if (hasData) item->setValue(propAttr->GetUserName());
-
- // Date of creation
- item = new SALOMEGUI_PropItem(myPropList, item, tr("PRP_DATE")+":", false, prpDateId);
- if (hasData) {
- CORBA::Long minutes, hours, day, month, year;
- if (propAttr->GetCreationDate(minutes, hours, day, month, year)) {
- QString strDate;
- strDate.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", day, month, year, hours, minutes);
- item->setValue(strDate);
- }
- }
-
- // Creation mode
-// item = new SALOMEGUI_PropItem(myPropList, item, tr("PRP_MODE")+":", true, prpModeId);
-// item->setEditingType(QAD_EntityEdit::etComboBox);
-// if (hasData) item->setValue(propAttr->GetCreationMode());
-
- // Locked or not
- item = new SALOMEGUI_PropItem(myPropList, item, tr("PRP_LOCKED")+":", true, prpLockedId);
- item->setEditingType(QAD_EntityEdit::etComboBox);
- if (hasData) (propAttr->IsLocked()) ? item->setValue(tr("PRP_YES")) : item->setValue(tr("PRP_NO"));
-
- // Saved or not
- item = new SALOMEGUI_PropItem(myPropList, item, tr("PRP_MODIFIED")+":", false, prpSavedId);
- if (hasData) {
- if (propAttr->IsModified())
- item->setValue(tr("PRP_YES"));
- else
- item->setValue(tr("PRP_NO"));
- }
-
- // Modifications list
- item = new SALOMEGUI_PropItem(myPropList, item, tr("PRP_MODIFICATIONS")+":", true, prpModificationsId);
- item->setEditingType(QAD_EntityEdit::etComboBox);
- if (hasData) {
- SALOMEDS::StringSeq_var aUsers;
- SALOMEDS::LongSeq_var aMins, aHours, aDays, aMonths, aYears;
- propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
- int aLast = aUsers->length()-1;
- if (aLast >= 0) {
- QString val;
- val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [aLast],
- aMonths[aLast],
- aYears [aLast],
- aHours [aLast],
- aMins [aLast]);
- val = val + " : " + QString(aUsers[aUsers->length()-1]);
- item->setValue(val);
- }
- }
-
- myOKBtn->setEnabled(hasData);
-}
-
-bool SALOMEGUI_StudyPropertiesDlg::acceptData()
-{
- return TRUE;
-}
-
-void SALOMEGUI_StudyPropertiesDlg::onOK()
-{
- myPropList->accept();
-
- if (acceptData()) {
- SALOMEDS::AttributeStudyProperties_var propAttr = myStudyDoc->GetProperties();
- myChanged = propChanged();
- if ( !propAttr->_is_nil() && myChanged ) {
- QListViewItemIterator it( myPropList );
- // iterate through all items of the listview
- for ( ; it.current(); ++it ) {
- SALOMEGUI_PropItem* item = (SALOMEGUI_PropItem*)(it.current());
- switch (item->getUserType()) {
- case prpAuthorId:
- propAttr->SetUserName(item->getValue().stripWhiteSpace().latin1());
- break;
- case prpModeId:
- propAttr->SetCreationMode(item->getValue().stripWhiteSpace().latin1());
- break;
- case prpLockedId:
- propAttr->SetLocked(item->getValue().compare(tr("PRP_YES")) == 0);
- break;
- default:
- break;
- }
- }
- }
- accept();
- }
-}
-
-bool SALOMEGUI_StudyPropertiesDlg::propChanged() {
- SALOMEDS::AttributeStudyProperties_var propAttr = myStudyDoc->GetProperties();
- if ( !propAttr->_is_nil() ) {
- QListViewItemIterator it( myPropList );
- // iterate through all items of the listview
- for ( ; it.current(); ++it ) {
- SALOMEGUI_PropItem* item = (SALOMEGUI_PropItem*)(it.current());
- switch (item->getUserType()) {
- case prpAuthorId:
- if ( QString( propAttr->GetUserName() ) != item->getValue().stripWhiteSpace() ) {
- return true;
- }
- break;
- case prpModeId:
- if ( QString( propAttr->GetCreationMode() ) != item->getValue().stripWhiteSpace() ) {
- return true;
- }
- break;
- case prpLockedId:
- {
- bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0;
- if ( propAttr->IsLocked() != bLocked ) {
- return true;
- }
- break;
- }
- default:
- break;
- }
- }
- }
- return false;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_StudyPropertiesDlg.h
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_STUDY_PROPERTIES_DLG_H
-#define SALOMEGUI_STUDY_PROPERTIES_DLG_H
-
-#include <qdialog.h>
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-class QAD_ListView;
-class QAD_ListViewItem;
-class QPushButton;
-
-class SALOMEGUI_StudyPropertiesDlg : public QDialog
-{
- Q_OBJECT
-
-public:
-
- enum {
- prpAuthorId,
- prpModeId,
- prpDateId,
- prpSavedId,
- prpLockedId,
- prpModificationsId,
- prpLastId
- };
-
- SALOMEGUI_StudyPropertiesDlg( QWidget* parent = 0 );
- ~SALOMEGUI_StudyPropertiesDlg();
-
- bool isChanged() { return myChanged; }
-
-public slots:
- void onOK();
-
-private:
- void initData();
- bool acceptData();
- bool propChanged();
-
-private:
- QAD_ListView* myPropList;
- QPushButton* myOKBtn;
- QPushButton* myCancelBtn;
- bool myChanged;
-
- SALOMEDS::Study_var myStudyDoc;
-};
-
-#endif // SALOMEGUI_STUDY_PROPERTIES_DLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Swig.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_Swig.hxx"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_RightFrame.h"
-#include "QAD_StudyFrame.h"
-
-#include "SALOME_Event.hxx"
-
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "utilities.h"
-
-using namespace std;
-
-// asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
-// In the scope of fixing bug PAL6869.
-// (PR : modify comments)
-// Instance of this class is created every time "import salome" line is typed
-// - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
-// - in inline Python nodes in Supervisor (in SALOME_Container executable),
-// - in stand-alone Python console outside any executable.
-// SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
-
-namespace SALOME{
- QAD_ViewFrame* GetViewFrame( QAD_Study* theStudy ) {
- if ( theStudy )
- if ( QAD_StudyFrame* aSF = theStudy->getActiveStudyFrame() )
- if ( QAD_RightFrame* aRF = aSF->getRightFrame() )
- return aRF->getViewFrame();
- return 0;
- }
-
- Handle(SALOME_InteractiveObject) FindIObject( QAD_Study* theStudy, const char *theEntry )
- {
- if ( QAD_ViewFrame* aVF = GetViewFrame( theStudy ) )
- return aVF->FindIObject( theEntry );
- return Handle(SALOME_InteractiveObject)(); // NULL Handle
- }
-}
-
-
-/*!
- Constructor
-*/
-SALOMEGUI_Swig::SALOMEGUI_Swig()
-{
- // MESSAGE("Constructeur");
-}
-
-/*!
- Destructor
-*/
-SALOMEGUI_Swig::~SALOMEGUI_Swig()
-{
- // MESSAGE("Destructeur");
-}
-
-/*!
- Check if GUI is available (if we are linked to IAPP)
-*/
-bool SALOMEGUI_Swig::hasDesktop()
-{
- if ( QAD_Desktop* aDT = QAD_Application::getDesktop() )
- return true;
- else
- return false;
-}
-
-/*!
- Gets active study or 0 if no study opened
-*/
-QAD_Study* SALOMEGUI_Swig::getActiveStudy()
-{
- if ( QAD_Desktop* aDT = QAD_Application::getDesktop() )
- if ( QAD_Application* anApp = aDT->getActiveApp() )
- return anApp->getActiveStudy();
- return 0;
-}
-
-/*!
- Call when updated object browser.
-*/
-void SALOMEGUI_Swig::updateObjBrowser( bool updateSelection )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() )
- ProcessVoidEvent( new TVoidMemFun1ArgEvent<QAD_Study,bool>
- ( myActiveStudy, &QAD_Study::updateObjBrowser,updateSelection) );
-}
-
-/*!
- Returns active Study Id.
-*/
-int SALOMEGUI_Swig::getActiveStudyId()
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() )
- return myActiveStudy->getStudyId();
- return 0;
-}
-
-/*!
- Returns active Study Name.
-*/
-const char *SALOMEGUI_Swig::getActiveStudyName()
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() )
- return myActiveStudy->getTitle().latin1();
- return NULL;
-}
-
-/*!
- Returns the name of component.
-*/
-const char* SALOMEGUI_Swig::getComponentName( const char* ComponentUserName )
-{
- if ( QAD_Desktop* aDT = QAD_Application::getDesktop() )
- return aDT->getComponentName( ComponentUserName );
- return NULL;
-}
-/*!
- Returns the user name of component.
-*/
-const char* SALOMEGUI_Swig::getComponentUserName( const char* ComponentName )
-{
- if ( QAD_Desktop* aDT = QAD_Application::getDesktop() )
- return aDT->getComponentUserName( ComponentName );
- return NULL;
-}
-
-/*!
- Returns the number of selected objects.
-*/
-int SALOMEGUI_Swig::SelectedCount()
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- return Sel->IObjectCount();
- }
- return 0;
-}
-
-/*!
- Returns the selected object at index i.
-*/
-const char* SALOMEGUI_Swig::getSelected( int i )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- int index = 0;
- for( ;It.More();It.Next() ) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if( i == index++ ){
- if ( IObject->hasEntry() )
- return IObject->getEntry();
- }
- }
- }
- return "";
-}
-
-/*!
- Add object with Entry into selection.
-*/
-void SALOMEGUI_Swig::AddIObject( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- SALOME_Selection* aSel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( IsInCurrentView( theEntry ) ) {
- Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject( myActiveStudy,theEntry );
- if ( anIO.IsNull() ) return;
- ProcessEvent( new TMemFun2ArgEvent<SALOME_Selection,int,
- const Handle(SALOME_InteractiveObject)&,bool,
- Handle(SALOME_InteractiveObject)>
- ( aSel, &SALOME_Selection::AddIObject, anIO, true ) );
- }
- }
-}
-
-
-/*!
- Removes object with Entry into selection.
-*/
-void SALOMEGUI_Swig::RemoveIObject( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- SALOME_Selection* aSel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- if ( IsInCurrentView( theEntry ) ) {
- Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject( myActiveStudy,theEntry );
- if ( anIO.IsNull() ) return;
- ProcessEvent( new TMemFun2ArgEvent<SALOME_Selection,int,
- const Handle(SALOME_InteractiveObject)&, bool,
- Handle(SALOME_InteractiveObject)>
- ( aSel, &SALOME_Selection::RemoveIObject, anIO, true ) );
- }
- }
-}
-
-
-/*!
- Removes all objects into selection.
-*/
-void SALOMEGUI_Swig::ClearIObjects()
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- SALOME_Selection* aSel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- ProcessVoidEvent( new TVoidMemFunEvent<SALOME_Selection>
- ( aSel, &SALOME_Selection::ClearIObjects ) );
- }
-}
-
-/*!
- Display
-*/
-void SALOMEGUI_Swig::Display( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- if ( IsInCurrentView( theEntry ) ) {
- Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject( myActiveStudy, theEntry );
- if ( anIO.IsNull() ) return;
- QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame( myActiveStudy );
- ProcessVoidEvent( new TVoidMemFun2ArgEvent<QAD_ViewFrame,
- const Handle(SALOME_InteractiveObject)&, bool,
- Handle(SALOME_InteractiveObject)>
- ( aViewFrame, &QAD_ViewFrame::Display, anIO, true ) );
- }
- }
-}
-
-/*!
- Display only
-*/
-void SALOMEGUI_Swig::DisplayOnly( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- if ( IsInCurrentView( theEntry ) ) {
- Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject( myActiveStudy, theEntry );
- if ( anIO.IsNull() ) return;
- QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame( myActiveStudy );
- ProcessVoidEvent( new TVoidMemFun1ArgEvent<QAD_ViewFrame,
- const Handle(SALOME_InteractiveObject)&,
- Handle(SALOME_InteractiveObject)>
- ( aViewFrame, &QAD_ViewFrame::DisplayOnly, anIO ) );
- }
- }
-}
-
-/*!
- Erase
-*/
-void SALOMEGUI_Swig::Erase( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- if ( IsInCurrentView( theEntry ) ) {
- Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject( myActiveStudy, theEntry );
- if ( anIO.IsNull() ) return;
- QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame( myActiveStudy );
- ProcessVoidEvent( new TVoidMemFun2ArgEvent<QAD_ViewFrame,
- const Handle(SALOME_InteractiveObject)&, bool,
- Handle(SALOME_InteractiveObject)>
- ( aViewFrame, &QAD_ViewFrame::Erase, anIO, true ) );
- }
- }
-}
-
-/*!
- Display all
-*/
-void SALOMEGUI_Swig::DisplayAll()
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame( myActiveStudy );
- ProcessVoidEvent( new TVoidMemFunEvent<QAD_ViewFrame>
- ( aViewFrame, &QAD_ViewFrame::DisplayAll ) );
- }
-}
-
-/*!
- Erase only
-*/
-void SALOMEGUI_Swig::EraseAll()
-{
- ClearIObjects();
- if ( QAD_Study* myActiveStudy = getActiveStudy() ) {
- QAD_ViewFrame* aViewFrame = SALOME::GetViewFrame( myActiveStudy );
- ProcessVoidEvent ( new TVoidMemFunEvent<QAD_ViewFrame>
- ( aViewFrame, &QAD_ViewFrame::EraseAll ) );
- }
-}
-
-/*!
- Checks if object is displayed in current viewer
-*/
-bool SALOMEGUI_Swig::IsInCurrentView( const char *theEntry )
-{
- if ( QAD_Study* myActiveStudy = getActiveStudy() )
- return myActiveStudy->isInViewer( theEntry, myActiveStudy->getActiveStudyFrame()->entry() );
- return false;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Swig.hxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEGUI_SWIG_HXX_
-#define _SALOMEGUI_SWIG_HXX_
-
-//QT Include
-#include <qstring.h>
-
-#include <Standard.hxx>
-
-#include "SALOME_InteractiveObject.hxx"
-
-class QAD_Study;
-class QAD_ViewFrame;
-
-namespace SALOME{
- QAD_ViewFrame* GetViewFrame(QAD_Study* theStudy);
- Handle(SALOME_InteractiveObject) FindIObject(QAD_Study* theStudy, const char *theEntry);
-}
-
-
-class SALOMEGUI_Swig
-{
-public:
- SALOMEGUI_Swig();
- ~SALOMEGUI_Swig();
-
- bool hasDesktop();
-
- void updateObjBrowser( bool updateSelection );
- QAD_Study* getActiveStudy();
- int getActiveStudyId();
- const char* getActiveStudyName();
-
-/* selection */
- int SelectedCount();
- const char* getSelected(int i);
-
- void AddIObject(const char *Entry);
- void RemoveIObject(const char *Entry);
- void ClearIObjects();
-
-/* display */
- void Display(const char *Entry);
- void DisplayOnly(const char *Entry);
- void Erase(const char *Entry);
- void DisplayAll();
- void EraseAll();
-
-/* check */
- bool IsInCurrentView(const char *Entry);
-
-/* component name */
- const char* getComponentName( const char* ComponentUserName );
- const char* getComponentUserName( const char* ComponentName );
-
-protected:
- int _studyId;
- QString _name;
-};
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_Swig.i
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-%{
-#include "SALOMEGUI_Swig.hxx"
-%}
-
-%include "pointer.i"
-
-/* %typemap(python,out) const char** */
-/* { */
-/* int len,i; */
-/* if ($source) */
-/* { */
-/* len=atoi($source[0]); */
-/* $target = PyList_New(len); */
-/* for (i=0; i<len; i++) */
-/* { */
-/* PyList_SetItem($target,i,PyString_FromString($source[i+1])); */
-/* } */
-/* } */
-/* else */
-/* { */
-/* $target = PyList_New(1); */
-/* PyList_SetItem($target,0,PyString_FromString("")); */
-/* } */
-/* } */
-
-class SALOMEGUI_Swig
-{
- public:
- SALOMEGUI_Swig();
- ~SALOMEGUI_Swig();
-
- bool hasDesktop();
-
- void updateObjBrowser(bool);
- int getActiveStudyId();
- const char *getActiveStudyName();
-
-/* selection */
- int SelectedCount();
- const char *getSelected(int i);
-
- void AddIObject(const char *Entry);
- void RemoveIObject(const char *Entry);
- void ClearIObjects();
-
-/* display */
- void Display(const char *Entry);
- void DisplayOnly(const char *Entry);
- void Erase(const char *Entry);
- void DisplayAll();
- void EraseAll();
-
-/* check */
- bool IsInCurrentView(const char *Entry);
-
-/* component name */
- const char* getComponentName( const char* ComponentUserName );
- const char* getComponentUserName( const char* ComponentName );
-};
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_TableDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_TableDlg.h"
-#include "QAD_Tools.h"
-#include "QAD_MessageBox.h"
-#include <qlayout.h>
-#include <qvalidator.h>
-#include <qtable.h>
-#include <qtabwidget.h>
-#include <qvaluelist.h>
-#include <qmemarray.h>
-#include <qinputdialog.h>
-#include <qlabel.h>
-#include "utilities.h"
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define SPACER_SIZE 5
-#define MIN_TABLE_WIDTH 200
-#define MIN_TABLE_HEIGHT 200
-
-
-class SALOMEGUI_Table : public QTable {
-public:
- SALOMEGUI_Table( Orientation orient, QWidget* parent = 0, const char* name = 0 )
- : QTable( parent, name ), myValidator( 0 ), myOrientation( orient ) {}
- SALOMEGUI_Table( Orientation orient, int numRows, int numCols, QWidget* parent = 0, const char* name = 0 )
- : QTable( numRows, numCols, parent, name ), myValidator( 0 ), myOrientation( orient ) {}
-
- void setValidator( QValidator* v = 0 ) { myValidator = v; }
- bool isEditing() const { return QTable::isEditing(); }
-
-protected:
- QWidget* createEditor ( int row, int col, bool initFromCell ) const
- {
- bool testUnits = ( myOrientation == Horizontal && col == 0 ) || ( myOrientation == Vertical && row == 0 );
- QWidget* wg = QTable::createEditor( row, col, initFromCell );
- if ( wg && wg->inherits("QLineEdit") && myValidator && !testUnits )
- (( QLineEdit*)wg)->setValidator( myValidator );
- return wg;
- }
-
-protected:
- QValidator* myValidator;
- Orientation myOrientation;
-};
-
-/*!
- Constructor
-*/
-SALOMEGUI_TableDlg::SALOMEGUI_TableDlg( QWidget* parent,
- SALOMEDS::SObject_var obj,
- bool edit,
- int which,
- Orientation orient,
- bool showColumnTitles )
- : QDialog( parent, "", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myIntTable( 0 ), myRealTable( 0 )
-{
- setCaption( edit ? tr( "EDIT_TABLE_TLT" ) : tr( "VIEW_TABLE_TLT" ) );
- setSizeGripEnabled( true );
-
- myObject = SALOMEDS::SObject::_duplicate( obj );
- bool bHasIntTable = false;
- bool bHasRealTable = false;
- if ( !myObject->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- bHasIntTable = myObject->FindAttribute( anAttr, "AttributeTableOfInteger");
- bHasRealTable = myObject->FindAttribute( anAttr, "AttributeTableOfReal");
- }
-
- QVBoxLayout* mainLayout = new QVBoxLayout( this );
- mainLayout->setMargin( MARGIN_SIZE );
- mainLayout->setSpacing( SPACING_SIZE );
-
- bool bDoInt = which == ttInt || which == ttBoth || which == ttAuto && bHasIntTable;
- bool bDoReal = which == ttReal || which == ttBoth || which == ttAuto && bHasRealTable;
-
- QWidget* top;
- QVBoxLayout* tl;
- if ( bDoInt && bDoReal ) {
- top = new QTabWidget( this, "TabWidget" );
- ( ( QTabWidget* ) top) ->setMargin( MARGIN_SIZE );
- }
- else {
- top = new QWidget( this, "DumbWidget" );
- tl = new QVBoxLayout( top ); tl->setMargin( 0 ); tl->setSpacing( SPACING_SIZE );
- }
-
- if ( bDoInt ) {
- myIntTable = new SALOMEGUI_TableWidget( top, "myIntTable", edit, orient, showColumnTitles );
- myIntTable->getTable()->setValidator( new QIntValidator( this ) );
- if ( bDoInt && bDoReal )
- ( ( QTabWidget* )top )->addTab( myIntTable, tr( "TABLE_OF_INTEGER_TLT" ) );
- else
- tl->addWidget( myIntTable );
- }
- if ( bDoReal ) {
- myRealTable = new SALOMEGUI_TableWidget( top, "myRealTable", edit, orient, showColumnTitles );
- myRealTable->getTable()->setValidator( new QDoubleValidator( this ) );
- if ( bDoInt && bDoReal )
- ( ( QTabWidget* )top )->addTab( myRealTable, tr( "TABLE_OF_REAL_TLT" ) );
- else
- tl->addWidget( myRealTable );
- }
- if ( !bDoInt && !bDoReal ) {
- QLabel *dumbLabel = new QLabel( tr( "ERR_TABLE_NOT_AVAILABLE" ), top, "DumbLabel" );
- dumbLabel->setAlignment( AlignCenter );
- tl->addWidget( dumbLabel );
- }
-
- QHBoxLayout* btnLayout = new QHBoxLayout;
- btnLayout->setMargin( 0 ); btnLayout->setSpacing( SPACING_SIZE );
-
- myOKBtn = new QPushButton( tr( "BUT_OK" ), this );
- if ( edit ) {
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
- btnLayout->addWidget( myOKBtn );
- btnLayout->addItem( new QSpacerItem( SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- btnLayout->addWidget( myCancelBtn );
- connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( onOK() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- }
- else {
- btnLayout->addItem( new QSpacerItem( SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- btnLayout->addWidget( myOKBtn );
- btnLayout->addItem( new QSpacerItem( SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- }
-
- mainLayout->addWidget( top );
- mainLayout->addLayout( btnLayout );
-
- initDlg();
- resize( 500, 400 );
- QAD_Tools::centerWidget( this, parent );
-}
-
-/*!
- Destructor
-*/
-SALOMEGUI_TableDlg::~SALOMEGUI_TableDlg()
-{
-}
-
-/*!
- <OK> button slot, saves table(s)
- Called only in create/edit mode ( <edit> parameter for constructor is true )
-*/
-void SALOMEGUI_TableDlg::onOK()
-{
- myOKBtn->setFocus(); // accept possible changes
- bool done = true;
-
- if ( !myObject->_is_nil() ) {
- SALOMEDS::Study_var study = myObject->GetStudy();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeTableOfInteger_var tblIntAttr;
- SALOMEDS::AttributeTableOfReal_var tblRealAttr;
-
- if ( !study->_is_nil() ) {
- SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
- builder->NewCommand(); // start transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- try {
- if ( myIntTable ) {
- builder->RemoveAttribute( myObject, "AttributeTableOfInteger" );
- tblIntAttr = SALOMEDS::AttributeTableOfInteger::_narrow(
- builder->FindOrCreateAttribute( myObject, "AttributeTableOfInteger" ) );
-
- int i;
- int nbRows = myIntTable->getNumRows();
- int nbCols = myIntTable->getNumCols();
- QString tlt = myIntTable->getTableTitle();
- QStringList rowTitles, colTitles, units;
- myIntTable->getRowTitles( rowTitles );
- myIntTable->getColTitles( colTitles );
- myIntTable->getUnits( units );
-
- if ( nbRows > 0) {
- // data
- int nRow = 0;
- tblIntAttr->SetNbColumns( nbCols );
- for ( i = 0; i < nbRows; i++ ) {
- QStringList data;
- myIntTable->getRowData( i, data );
- bool bEmptyRow = true;
- for ( int j = 0; j < data.count(); j++ ) {
- if ( !data[ j ].isNull() ) {
- tblIntAttr->PutValue( data[ j ].toInt(), nRow+1, j+1 );
- bEmptyRow = false;
- }
- }
- if ( !bEmptyRow ) { // Skip rows with no data !!!
- // set row title
- tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) );
- // set row unit
- tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? QString( "" ) : QString( units[ i ] ) );
- nRow++;
- }
- }
- if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!!
- // column titles
- for ( i = 0; i < colTitles.count(); i++ )
- tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
- }
- }
- // title
- tblIntAttr->SetTitle( myIntTable->getTableTitle().latin1() );
- }
- if ( myRealTable ) {
- builder->RemoveAttribute( myObject, "AttributeTableOfReal" );
- tblRealAttr = SALOMEDS::AttributeTableOfReal::_narrow(
- builder->FindOrCreateAttribute( myObject, "AttributeTableOfReal" ) );
-
- int i;
- int nbRows = myRealTable->getNumRows();
- int nbCols = myRealTable->getNumCols();
- QString tlt = myRealTable->getTableTitle();
- QStringList rowTitles, colTitles, units;
- myRealTable->getRowTitles( rowTitles );
- myRealTable->getColTitles( colTitles );
- myRealTable->getUnits( units );
-
- if ( nbRows > 0) {
- // data
- int nRow = 0;
- tblRealAttr->SetNbColumns( nbCols );
- for ( i = 0; i < nbRows; i++ ) {
- QStringList data;
- myRealTable->getRowData( i, data );
- bool bEmptyRow = true;
- for ( int j = 0; j < data.count(); j++ ) {
- if ( !data[ j ].isNull() ) {
- tblRealAttr->PutValue( data[ j ].toDouble(), nRow+1, j+1 );
- bEmptyRow = false;
- }
- }
- if ( !bEmptyRow ) { // Skip rows with no data !!!
- // set row title
- tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? QString( "" ) : QString( rowTitles[ i ] ) );
- // set row unit
- tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? QString( "" ) : QString( units[ i ] ) );
- nRow++;
- }
- }
- if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!!
- // column titles
- for ( i = 0; i < colTitles.count(); i++ )
- tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? QString( "" ) : QString( colTitles[ i ] ) );
- }
- }
- // title
- tblRealAttr->SetTitle( myRealTable->getTableTitle().latin1() );
- }
- if ( myIntTable || myRealTable)
- builder->CommitCommand(); // commit transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!
- else
- builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- catch( ... ) {
- MESSAGE("SALOMEGUI_TableDlg::onOK : Exception has been caught !!!");
- builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!
- done = false;
- QAD_MessageBox::error1 ( this, tr("ERR_ERROR"), tr("ERR_APP_EXCEPTION"), tr ("BUT_OK") );
- }
- }
- }
- if ( done )
- accept();
-}
-
-/*!
- Populates table with data
-*/
-void SALOMEGUI_TableDlg::initDlg()
-{
- int i, j;
- if ( !myObject->_is_nil() ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeTableOfInteger_var tblIntAttr;
- SALOMEDS::AttributeTableOfReal_var tblRealAttr;
- if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger") ) {
- tblIntAttr = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- }
- if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal") ) {
- tblRealAttr = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- }
- // Table of integer
- if ( !tblIntAttr->_is_nil() && myIntTable ) {
- try {
- SALOMEGUI_Table* tbl = myIntTable->getTable();
- // title
- myIntTable->setTableTitle( CORBA::string_dup( tblIntAttr->GetTitle() ) );
- // nb of rows & cols
- int nbRows = tblIntAttr->GetNbRows() ;
- int nbCols = tblIntAttr->GetNbColumns();
- myIntTable->setNumRows( nbRows );
- myIntTable->setNumCols( nbCols );
- // rows titles
- QStringList strlist;
- SALOMEDS::StringSeq_var rowTitles = tblIntAttr->GetRowTitles();
- for ( i = 0; i < nbRows; i++ ) {
- if ( rowTitles->length() > 0 )
- strlist.append( CORBA::string_dup( rowTitles[i] ) );
- else
- strlist.append( "" );
- }
- myIntTable->setRowTitles( strlist );
- // columns titles
- strlist.clear();
- SALOMEDS::StringSeq_var colTitles = tblIntAttr->GetColumnTitles();
- for ( i = 0; i < nbCols; i++ ) {
- if ( colTitles->length() > 0 )
- strlist.append( CORBA::string_dup( colTitles[i] ) );
- else
- strlist.append( "" );
- }
- myIntTable->setColTitles( strlist );
- // units
- strlist.clear();
- SALOMEDS::StringSeq_var rowUnits = tblIntAttr->GetRowUnits();
- if ( rowUnits->length() > 0 ) {
- for ( i = 0; i < nbRows; i++ )
- strlist.append( CORBA::string_dup( rowUnits[i] ) );
- myIntTable->setUnits( strlist );
- }
- // data
- for ( i = 1; i <= nbRows; i++ ) {
- strlist.clear();
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblIntAttr->HasValue( i, j ) )
- strlist.append( QString::number( tblIntAttr->GetValue( i, j ) ) );
- else
- strlist.append( QString::null );
- }
- myIntTable->setRowData( i-1, strlist );
- }
- myIntTable->adjustTable();
- }
- catch( ... ) {
- MESSAGE("SALOMEGUI_TableDlg::initDlg : Exception has been caught !!!");
- }
- }
- // Table of real
- if ( !tblRealAttr->_is_nil() && myRealTable ) {
- try {
- SALOMEGUI_Table* tbl = myRealTable->getTable();
- // title
- myRealTable->setTableTitle( CORBA::string_dup( tblRealAttr->GetTitle() ) );
- // nb of rows & cols
- int nbRows = tblRealAttr->GetNbRows() ;
- int nbCols = tblRealAttr->GetNbColumns();
- myRealTable->setNumRows( nbRows );
- myRealTable->setNumCols( nbCols );
- // rows titles
- QStringList strlist;
- SALOMEDS::StringSeq_var rowTitles = tblRealAttr->GetRowTitles();
- for ( i = 0; i < nbRows; i++ ) {
- if ( rowTitles->length() > 0 )
- strlist.append( CORBA::string_dup( rowTitles[i] ) );
- else
- strlist.append( "" );
- }
- myRealTable->setRowTitles( strlist );
- // columns titles
- strlist.clear();
- SALOMEDS::StringSeq_var colTitles = tblRealAttr->GetColumnTitles();
- for ( i = 0; i < nbCols; i++ ) {
- if ( colTitles->length() > 0 )
- strlist.append( CORBA::string_dup( colTitles[i] ) );
- else
- strlist.append( "" );
- }
- myRealTable->setColTitles( strlist );
- // units
- strlist.clear();
- SALOMEDS::StringSeq_var rowUnits = tblRealAttr->GetRowUnits();
- if ( rowUnits->length() > 0 ) {
- for ( i = 0; i < nbRows; i++ )
- strlist.append( CORBA::string_dup( rowUnits[i] ) );
- myRealTable->setUnits( strlist );
- }
- // data
- for ( i = 1; i <= nbRows; i++ ) {
- strlist.clear();
- for ( j = 1; j <= nbCols; j++ ) {
- if ( tblRealAttr->HasValue( i, j ) )
- strlist.append( QString::number( tblRealAttr->GetValue( i, j ) ) );
- else
- strlist.append( QString::null );
- }
- myRealTable->setRowData( i-1, strlist );
- }
- myRealTable->adjustTable();
- }
- catch( ... ) {
- MESSAGE("SALOMEGUI_TableDlg::initDlg : Exception has been caught !!!");
- }
- }
- }
-}
-
-/*!
- Constructor
-*/
-SALOMEGUI_TableWidget::SALOMEGUI_TableWidget( QWidget* parent,
- const char* name,
- bool edit,
- Orientation orient,
- bool showColumnTitles )
- : QWidget( parent, name ), myOrientation( orient )
-{
- QGridLayout* mainLayout = new QGridLayout( this );
- mainLayout->setMargin( 0 );
- mainLayout->setSpacing( SPACING_SIZE );
-
- myTitleEdit = new QLineEdit( this, "TitleEdit" );
- myTitleEdit->setAlignment( AlignCenter );
- myTitleEdit->setReadOnly( !edit );
- QFont fnt = myTitleEdit->font();
- fnt.setBold( true );
- myTitleEdit->setFont( fnt );
-
- myTable = new SALOMEGUI_Table( orient, this, "Table" );
- myTable->setNumRows( 5 );
- myTable->setNumCols( 5 );
- myTable->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myTable->setMinimumSize( MIN_TABLE_WIDTH, MIN_TABLE_HEIGHT );
- myTable->setSelectionMode( QTable::Single );
- myTable->setShowGrid( true );
- myTable->setColumnMovingEnabled( false );
- myTable->setRowMovingEnabled( false );
- myTable->setReadOnly( !edit );
- myTable->setDragEnabled( false );
- setUnitsTitle( tr( "UNITS_TLT" ) );
-
- if ( !showColumnTitles ) {
- if ( myOrientation == Horizontal ) {
- myTable->horizontalHeader()->hide();
- myTable->setTopMargin( 0 );
- }
- else {
- myTable->verticalHeader()->hide();
- myTable->setLeftMargin( 0 );
- }
- }
-
- mainLayout->addWidget( myTitleEdit, 0, 0 );
- mainLayout->addWidget( myTable, 1, 0 );
-
- if ( edit ) {
- myAddRowBtn = new QPushButton( tr( "ADD_ROW_BTN" ), this, "AddRowBtn" );
- myDelRowBtn = new QPushButton( tr( "REMOVE_ROW_BTN" ), this, "DelRowBtn" );
- myAddColBtn = new QPushButton( tr( "ADD_COLUMN_BTN" ), this, "AddColBtn" );
- myDelColBtn = new QPushButton( tr( "REMOVE_COLUMN_BTN" ), this, "DelColBtn" );
- myAdjustBtn = new QPushButton( tr( "ADJUST_CELLS_BTN" ), this, "AdjustBtn" );
- mySelectAllBtn = new QPushButton( tr( "SELECT_ALL_BTN" ), this, "SelectAllBtn" );
- myClearBtn = new QPushButton( tr( "CLEAR_BTN"), this, "ClearBtn" );
- QVBoxLayout* btnLayout = new QVBoxLayout; btnLayout->setMargin( 0 ); btnLayout->setSpacing( SPACING_SIZE );
- btnLayout->addWidget( myAddRowBtn );
- btnLayout->addWidget( myDelRowBtn );
- btnLayout->addWidget( myAddColBtn );
- btnLayout->addWidget( myDelColBtn );
- btnLayout->addStretch();
- btnLayout->addWidget( myAdjustBtn );
- btnLayout->addStretch();
- btnLayout->addWidget( mySelectAllBtn );
- btnLayout->addWidget( myClearBtn );
- mainLayout->addLayout( btnLayout, 1, 1 );
- connect( myTable, SIGNAL( selectionChanged() ), this, SLOT( updateButtonsState() ) );
- connect( myTable, SIGNAL( currentChanged( int, int) ), this, SLOT( updateButtonsState() ) );
- connect( myAddRowBtn, SIGNAL( clicked() ), this, SLOT( addRow() ) );
- connect( myAddColBtn, SIGNAL( clicked() ), this, SLOT( addCol() ) );
- connect( myDelRowBtn, SIGNAL( clicked() ), this, SLOT( delRow() ) );
- connect( myDelColBtn, SIGNAL( clicked() ), this, SLOT( delCol() ) );
- connect( myAdjustBtn, SIGNAL( clicked() ), this, SLOT( adjustTable() ) );
- connect( mySelectAllBtn, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
- connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( clearTable() ) );
- myTable->horizontalHeader()->installEventFilter( this );
- myTable->verticalHeader()->installEventFilter( this );
- myTable->installEventFilter( this );
- }
- updateButtonsState();
-}
-/*!
- Destructor
-*/
-SALOMEGUI_TableWidget::~SALOMEGUI_TableWidget()
-{
-}
-/*!
- Sets table title
-*/
-void SALOMEGUI_TableWidget::setTableTitle( const QString& title )
-{
- myTitleEdit->setText( title );
-}
-/*!
- Gets table title
-*/
-QString SALOMEGUI_TableWidget::getTableTitle()
-{
- return myTitleEdit->text();
-}
-/*!
- Sets total number of rows
-*/
-void SALOMEGUI_TableWidget::setNumRows( const int num )
-{
- myOrientation == Horizontal ? myTable->setNumRows( num ) : myTable->setNumCols( num );
-}
-/*!
- Gets total number of rows
-*/
-int SALOMEGUI_TableWidget::getNumRows()
-{
- return myOrientation == Horizontal ? myTable->numRows() : myTable->numCols();
-}
-/*!
- Sets total number of columns
-*/
-void SALOMEGUI_TableWidget::setNumCols( const int num )
-{
- // !!! first column contains units !!!
- myOrientation == Horizontal ? myTable->setNumCols( num+1 ) : myTable->setNumRows( num+1 );
-// myOrientation == Horizontal ? myTable->setColumnReadOnly( 0, true ) : myTable->setRowReadOnly( 0, true );
-}
-/*!
- Gets total number of columns
-*/
-int SALOMEGUI_TableWidget::getNumCols()
-{
- // !!! first column contains units !!!
- return myOrientation == Horizontal ? myTable->numCols()-1 : myTable->numRows()-1;
-}
-/*!
- Sets rows titles
-*/
-void SALOMEGUI_TableWidget::setRowTitles( QStringList& tlts )
-{
- for ( int i = 0; i < tlts.count(); i++ ) {
- myOrientation == Horizontal ?
- myTable->verticalHeader()->setLabel( i, tlts[i] ) :
- myTable->horizontalHeader()->setLabel( i, tlts[i] );
- }
-}
-/*!
- Gets rows titles
-*/
-void SALOMEGUI_TableWidget::getRowTitles( QStringList& tlts )
-{
- tlts.clear();
- if ( myOrientation == Horizontal ) {
- for ( int i = 0; i < myTable->numRows(); i++ ) {
- tlts.append( myTable->verticalHeader()->label( i ) );
- }
- }
- else {
- for ( int i = 0; i < myTable->numCols(); i++ ) {
- tlts.append( myTable->horizontalHeader()->label( i ) );
- }
- }
-}
-/*!
- Sets columns titles
-*/
-void SALOMEGUI_TableWidget::setColTitles( QStringList& tlts )
-{
- // !!! first column contains units !!!
- for ( int i = 0; i < tlts.count(); i++ ) {
- myOrientation == Horizontal ?
- myTable->horizontalHeader()->setLabel( i+1, tlts[i].isNull() ? "" : tlts[i] ) :
- myTable->verticalHeader()->setLabel( i+1, tlts[i].isNull() ? "" : tlts[i] );
- }
- setUnitsTitle( tr( "UNITS_TLT" ) );
-}
-/*!
- Sets columns titles
-*/
-void SALOMEGUI_TableWidget::getColTitles( QStringList& tlts )
-{
- // !!! first column contains units !!!
- tlts.clear();
- if ( myOrientation == Horizontal ) {
- for ( int i = 1; i < myTable->numCols(); i++ ) {
- tlts.append( myTable->horizontalHeader()->label( i ) );
- }
- }
- else {
- for ( int i = 1; i < myTable->numRows(); i++ ) {
- tlts.append( myTable->verticalHeader()->label( i ) );
- }
- }
-}
-/*!
- Sets units title
-*/
-void SALOMEGUI_TableWidget::setUnitsTitle( const QString& tlt ) {
- // !!! first column contains units !!!
- myOrientation == Horizontal ? myTable->horizontalHeader()->setLabel( 0, tlt.isNull() ? "" : tlt ) : myTable->verticalHeader()->setLabel( 0, tlt.isNull() ? "" : tlt );
-}
-/*!
- Sets units
-*/
-void SALOMEGUI_TableWidget::setUnits( QStringList& units )
-{
- for ( int i = 0; i < units.count(); i++ ) {
- myOrientation == Horizontal ? myTable->setText( i, 0, units[i].isNull() ? "" : units[i] ) : myTable->setText( 0, i, units[i].isNull() ? "" : units[i] );
- }
-}
-/*!
- Gets units
-*/
-void SALOMEGUI_TableWidget::getUnits( QStringList& units )
-{
- units.clear();
- if ( myOrientation == Horizontal ) {
- for ( int i = 0; i < myTable->numRows(); i++ )
- units.append( myTable->text( i, 0 ).isNull() ? QString("") : myTable->text( i, 0 ) );
- }
- else {
- for ( int i = 0; i < myTable->numCols(); i++ )
- units.append( myTable->text( 0, i ).isNull() ? QString("") : myTable->text( 0, i ) );
- }
-}
-/*!
- Sets row data
-*/
-void SALOMEGUI_TableWidget::setRowData( int row, QStringList& data )
-{
- if ( row >= 0 && row < getNumRows() ) {
- for ( int i = 0; i < data.count(); i++ ) {
- if ( data[i].isNull() ) {
- myOrientation == Horizontal ? myTable->clearCell( row, i+1 ) :
- myTable->clearCell( i+1, row );
- }
- else {
- myOrientation == Horizontal ? myTable->setText( row, i+1, data[i] ) :
- myTable->setText( i+1, row, data[i] );
- }
- }
- }
-}
-/*!
- Gets row data
-*/
-void SALOMEGUI_TableWidget::getRowData( int row, QStringList& data )
-{
- data.clear();
- if ( row >= 0 && row < getNumRows() ) {
- if ( myOrientation == Horizontal ) {
- for ( int i = 1; i < myTable->numCols(); i++ )
- data.append( myTable->text( row, i ) );
- }
- else {
- for ( int i = 1; i < myTable->numRows(); i++ )
- data.append( myTable->text( i, row ) );
- }
- }
-}
-/*!
- Adjusts table cell to see contents, <Adjust Cells> button slot
-*/
-void SALOMEGUI_TableWidget::adjustTable()
-{
- int i;
- for ( i = 0; i < myTable->numRows(); i++ )
- myTable->adjustRow( i );
- for ( i = 0; i < myTable->numCols(); i++ )
- myTable->adjustColumn( i );
-}
-/*!
- Called when selection changed in table
-*/
-void SALOMEGUI_TableWidget::updateButtonsState()
-{
- if ( myTable->isReadOnly() )
- return;
- bool bDR = false; // <Delete Row(s)>
- bool bDC = false; // <Delete Column(s)>
- bool bSA = false; // <Select All>
- bool bCT = false; // <Clear>
- int i;
- int c = myOrientation == Horizontal ? 0 : 1;
- for ( i = c; i < myTable->numRows(); i++ ) {
- if ( myTable->isRowSelected( i, true ) )
- bDR = true;
- else
- bSA = true;
- }
- c = myOrientation == Horizontal ? 1 : 0;
- for ( i = c; i < myTable->numCols(); i++ ) {
- if ( myTable->isColumnSelected( i, true ) )
- bDC = true;
- else
- bSA = true;
- }
- int nbSel = myTable->numSelections();
- for ( i = 0; i < nbSel; i++ ) {
- QTableSelection ts = myTable->selection( i );
- for ( int j = ts.topRow(); j < ts.bottomRow()+1; j++) {
- for ( int k = ts.leftCol(); k < ts.rightCol()+1; k++) {
- if ( myTable->item( j, k ) )
- bCT = true;
- }
- }
- }
- if ( myTable->item( myTable->currentRow(), myTable->currentColumn() ) )
- bCT = true;
- myDelRowBtn->setEnabled( bDR );
- myDelColBtn->setEnabled( bDC );
- mySelectAllBtn->setEnabled( bSA );
- myClearBtn->setEnabled( bCT );
-}
-/*!
- <Add row> button slot
-*/
-void SALOMEGUI_TableWidget::addRow()
-{
- myTable->insertRows( myTable->numRows(), 1 );
- updateButtonsState();
-}
-/*!
- <Add column> button slot
-*/
-void SALOMEGUI_TableWidget::addCol()
-{
- myTable->insertColumns( myTable->numCols(), 1 );
- updateButtonsState();
-}
-/*!
- <Delete row(s)> button slot
-*/
-void SALOMEGUI_TableWidget::delRow()
-{
- int c = myOrientation == Horizontal ? 0 : 1;
- QValueList<int> il;
- int i;
- for ( i = c; i < myTable->numRows(); i++ )
- if ( myTable->isRowSelected( i, true ) )
- il.append( i );
- if ( il.count() > 0 ) {
- QMemArray<int> ildel( il.count() );
- for ( i = 0; i < il.count(); i++ )
- ildel[ i ] = il[ i ];
- myTable->removeRows( ildel );
- }
- updateButtonsState();
-}
-/*!
- <Delete column(s)> button slot
-*/
-void SALOMEGUI_TableWidget::delCol()
-{
- int c = myOrientation == Horizontal ? 1 : 0;
- QValueList<int> il;
- int i;
- for ( i = c; i < myTable->numCols(); i++ )
- if ( myTable->isColumnSelected( i, true ) )
- il.append( i );
- if ( il.count() > 0 ) {
- QMemArray<int> ildel( il.count() );
- for ( i = 0; i < il.count(); i++ )
- ildel[ i ] = il[ i ];
- myTable->removeColumns( ildel );
- }
- updateButtonsState();
-}
-/*!
- <Select All> button slot
-*/
-void SALOMEGUI_TableWidget::selectAll()
-{
- myTable->clearSelection();
- QTableSelection ts;
- ts.init( 0, 0 ); ts.expandTo( myTable->numRows()-1, myTable->numCols()-1 );
- myTable->addSelection( ts );
- updateButtonsState();
-}
-/*!
- <Clear> button slot
-*/
-void SALOMEGUI_TableWidget::clearTable()
-{
- int nbSel = myTable->numSelections();
- for ( int i = 0; i < nbSel; i++ ) {
- QTableSelection ts = myTable->selection( i );
- for ( int j = ts.topRow(); j < ts.bottomRow()+1; j++) {
- if ( myOrientation == Vertical && j == 0 ) {
-// continue; // UNITS
- }
- for ( int k = ts.leftCol(); k < ts.rightCol()+1; k++) {
- if ( myOrientation == Horizontal && k == 0 ) {
-// continue; // UNITS
- }
- myTable->clearCell( j, k );
- }
- }
- }
- if ( nbSel == 0 )
- myTable->clearCell( myTable->currentRow(), myTable->currentColumn() );
- myTable->clearSelection();
- updateButtonsState();
-}
-/*!
- Event filter - handles titles editing
-*/
-bool SALOMEGUI_TableWidget::eventFilter( QObject* o, QEvent* e )
-{
- if ( e->type() == QEvent::MouseButtonDblClick) {
- QMouseEvent* me = ( QMouseEvent* )e;
- if ( me->button() == LeftButton && !myTable->isReadOnly() ) {
- if ( o == myTable->horizontalHeader() ) {
- for ( int i = 0; i < myTable->horizontalHeader()->count(); i++ ) {
- QRect rect = myTable->horizontalHeader()->sectionRect( i );
- rect.addCoords( 1, 1, -1, -1 );
- if ( rect.contains( myTable->horizontalHeader()->mapFromGlobal( me->globalPos() ) ) ) {
- if ( myOrientation == Vertical || i != 0 ) {
- bool bOk;
- QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ),
- tr( "TITLE_LBL" ),
- QLineEdit::Normal,
- myTable->horizontalHeader()->label( i ),
- &bOk,
- this );
- if ( bOk && !tlt.isNull() )
- myTable->horizontalHeader()->setLabel( i, tlt );
- break;
- }
- }
- }
- }
- if ( o == myTable->verticalHeader() ) {
- for ( int i = 0; i < myTable->verticalHeader()->count(); i++ ) {
- QRect rect = myTable->verticalHeader()->sectionRect( i );
- rect.addCoords( 1, 1, -1, -1 );
- if ( rect.contains( myTable->verticalHeader()->mapFromGlobal( me->globalPos() ) ) ) {
- if ( myOrientation == Horizontal || i != 0 ) {
- bool bOk;
- QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ),
- tr( "TITLE_LBL" ),
- QLineEdit::Normal,
- myTable->verticalHeader()->label( i ),
- &bOk,
- this );
- if ( bOk && !tlt.isNull() )
- myTable->verticalHeader()->setLabel( i, tlt );
- break;
- }
- }
- }
- }
- }
- }
- else if ( e->type() == QEvent::KeyRelease && o == myTable ) {
- QKeyEvent* ke = (QKeyEvent*)e;
- if ( ke->key() == Key_Delete && !myTable->isEditing() ) {
- clearTable();
- }
- else if ( ke->key() == Key_Backspace && !myTable->isEditing() ) {
- clearTable();
- int i = myTable->currentRow();
- int j = myTable->currentColumn() - 1;
- if ( j < 0 ) { j = myTable->numCols()-1; i--; }
- if ( i >= 0 && j >= 0 )
- myTable->setCurrentCell( i, j );
- }
- }
- return QWidget::eventFilter( o, e );
-}
-
-
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SALOMEGUI_TableDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_TABLE_DLG_H
-#define SALOMEGUI_TABLE_DLG_H
-
-#include <qdialog.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-
-class SALOMEGUI_Table;
-class SALOMEGUI_TableWidget;
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-class SALOMEGUI_TableDlg : public QDialog
-{
- Q_OBJECT
-
-public:
-
- enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
-
- SALOMEGUI_TableDlg( QWidget* parent,
- SALOMEDS::SObject_var obj,
- bool edit = false,
- int which = ttAuto,
- Orientation orient = Horizontal,
- bool showColumnTitles = true );
- ~SALOMEGUI_TableDlg();
-
-public slots:
- void onOK();
-
-private:
- void initDlg();
-
-private:
- SALOMEGUI_TableWidget* myIntTable;
- SALOMEGUI_TableWidget* myRealTable;
- QPushButton* myOKBtn;
- QPushButton* myCancelBtn;
-
- SALOMEDS::SObject_var myObject;
-};
-
-class SALOMEGUI_TableWidget : public QWidget
-{
- Q_OBJECT
-public:
- SALOMEGUI_TableWidget( QWidget* parent = 0,
- const char* name = 0,
- bool edit = false,
- Orientation orient = Horizontal,
- bool showColumnTitles = true );
- ~SALOMEGUI_TableWidget();
-
- void setTableTitle( const QString& title );
- QString getTableTitle();
- void setNumRows( const int num );
- int getNumRows();
- void setNumCols( const int num );
- int getNumCols();
- void setRowTitles( QStringList& tlts );
- void getRowTitles( QStringList& tlts );
- void setColTitles( QStringList& tlts );
- void getColTitles( QStringList& tlts );
- void setUnitsTitle( const QString& tlt );
- void setUnits( QStringList& units );
- void getUnits( QStringList& units );
- void setRowData( int row, QStringList& data );
- void getRowData( int row, QStringList& data );
-
- SALOMEGUI_Table* getTable() { return myTable; }
- QLineEdit* getTitleEdit() { return myTitleEdit; }
-
- bool eventFilter( QObject* o, QEvent* e);
-
-public slots:
- void updateButtonsState();
- void addRow();
- void addCol();
- void delRow();
- void delCol();
- void adjustTable();
- void selectAll();
- void clearTable();
-
-private:
- QLineEdit* myTitleEdit;
- SALOMEGUI_Table* myTable;
- QPushButton* myAddRowBtn;
- QPushButton* myAddColBtn;
- QPushButton* myDelRowBtn;
- QPushButton* myDelColBtn;
- QPushButton* myAdjustBtn;
- QPushButton* mySelectAllBtn;
- QPushButton* myClearBtn;
- Orientation myOrientation;
-};
-
-#endif // SALOMEGUI_TABLE_DLG_H
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_TrihedronSizeDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_TrihedronSizeDlg.h"
-
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qspinbox.h>
-#include <qlayout.h>
-using namespace std;
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_SPIN_WIDTH 100
-
-/*
- * Constructs a modal SALOMEGUI_TrihedronSizeDlg which is a child of 'parent'
- *
- */
-SALOMEGUI_TrihedronSizeDlg::SALOMEGUI_TrihedronSizeDlg( QWidget* parent )
- : QDialog( parent, "SALOMEGUI_TrihedronSizeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr( "MEN_TRIHEDRON" ) );
- setSizeGripEnabled( true );
-
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- QGroupBox* trihedronGrp = new QGroupBox( this, "trihedronGrp" );
- trihedronGrp->setColumnLayout( 0, Qt::Vertical );
- trihedronGrp->layout()->setSpacing( 0 );
- trihedronGrp->layout()->setMargin( 0 );
- QGridLayout* trihedronGrpLayout = new QGridLayout( trihedronGrp->layout() );
- trihedronGrpLayout->setAlignment( Qt::AlignTop );
- trihedronGrpLayout->setSpacing( SPACING_SIZE );
- trihedronGrpLayout->setMargin( MARGIN_SIZE );
-
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- QPushButton* buttonOk = new QPushButton( this, "buttonOk" );
- buttonOk->setText( tr( "BUT_OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
-
- QPushButton* buttonCancel = new QPushButton( this, "buttonCancel" );
- buttonCancel->setText( tr( "BUT_CANCEL" ) );
- buttonCancel->setAutoDefault( TRUE );
-
- QLabel* TextLabel = new QLabel( trihedronGrp, "TextLabel" );
- TextLabel->setText( tr( "MEN_TRIHEDRON_SIZE" ) );
-
- SpinBox = new QSpinBox( 1, 999999999, 1, trihedronGrp, "SpinBox" );
- SpinBox->setValue( 100 );
- SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- SpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
-
- trihedronGrpLayout->addWidget(TextLabel, 0, 0);
- trihedronGrpLayout->addWidget(SpinBox, 0, 1);
-
- aBtnLayout->addWidget( buttonOk );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( buttonCancel );
-
- topLayout->addWidget( trihedronGrp, 0, 0 );
- topLayout->addLayout( aBtnLayout, 1, 0 );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_TrihedronSizeDlg::~SALOMEGUI_TrihedronSizeDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- Sets start trihedron size
-*/
-void SALOMEGUI_TrihedronSizeDlg::setTrihedronSize(const int size)
-{
- SpinBox->setValue(size);
-}
-
-/*
- Gets trihedron size
-*/
-int SALOMEGUI_TrihedronSizeDlg::getTrihedronSize()
-{
- return SpinBox->value();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_TrihedronSizeDlg.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_TRIHEDRON_SIZE_DLG_H
-#define SALOMEGUI_TRIHEDRON_SIZE_DLG_H
-
-#include <qdialog.h>
-
-class QSpinBox;
-
-class SALOMEGUI_TrihedronSizeDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_TrihedronSizeDlg( QWidget* parent = 0 );
- ~SALOMEGUI_TrihedronSizeDlg();
-
- void setTrihedronSize(const int size);
- int getTrihedronSize();
-
-protected:
- QSpinBox* SpinBox;
-};
-
-#endif // SALOMEGUI_TRIHEDRON_SIZE_DLG_H
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_ViewChoiceDlg.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOMEGUI_ViewChoiceDlg.h"
-#include "QAD_Config.h"
-#include "QAD_StudyFrame.h"
-
-#include <qcombobox.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-using namespace std;
-
-/*
- * Constructs a SALOMEGUI_ViewChoiceDlg which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
- *
- * The dialog will by default be modeless, unless you set 'modal' to
- * TRUE to construct a modal dialog.
- */
-SALOMEGUI_ViewChoiceDlg::SALOMEGUI_ViewChoiceDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "SALOMEGUI_ViewChoiceDlg" );
- setCaption( tr( "MEN_CHOICE" ) );
- setSizeGripEnabled( true );
-
- QGridLayout* theBaseLayout = new QGridLayout( this, 2, 1, 11, 6);
-
- GroupBox1 = new QGroupBox(0, Qt::Vertical, tr("MEN_VIEW"), this);
- theBaseLayout->addWidget(GroupBox1, 0, 0);
-
- QHBoxLayout* aBoxLayout = new QHBoxLayout(GroupBox1->layout());
-
- QHBoxLayout* aInternalLayout = new QHBoxLayout(6);
-
- TextLabel1 = new QLabel(tr("MEN_VIEWER_TYPE"), GroupBox1);
- aInternalLayout->addWidget(TextLabel1);
-
- ComboBox1 = new QComboBox( false, GroupBox1);
- ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- ComboBox1->setMinimumWidth( 200 );
- // OCC Viewer
- ComboBox1->insertItem(tr("MEN_VIEWER_OCC"));
- myViewers.append(VIEW_OCC);
- if ( QAD_CONFIG->getSetting( "Viewer:DefaultViewer").toInt() == VIEW_OCC )
- ComboBox1->setCurrentItem( ComboBox1->count()-1 );
- // VTK Viewer
- ComboBox1->insertItem(tr("MEN_VIEWER_VTK"));
- myViewers.append(VIEW_VTK);
- if ( QAD_CONFIG->getSetting( "Viewer:DefaultViewer").toInt() == VIEW_VTK )
- ComboBox1->setCurrentItem( ComboBox1->count()-1 );
- // SUPERVISOR Viewer
-// ComboBox1->insertItem(tr("MEN_VIEWER_GRAPH"));
-// myViewers.append(VIEW_GRAPHSUPERV);
-// if ( QAD_CONFIG->getSetting( "Viewer:DefaultViewer").toInt() == VIEW_GRAPHSUPERV )
-// ComboBox1->setCurrentItem( ComboBox1->count()-1 );
- // Plot2d Viewer
- ComboBox1->insertItem(tr("MEN_VIEWER_PLOT2D"));
- myViewers.append(VIEW_PLOT2D);
- if ( QAD_CONFIG->getSetting( "Viewer:DefaultViewer").toInt() == VIEW_PLOT2D )
- ComboBox1->setCurrentItem( ComboBox1->count()-1 );
- TextLabel1->setBuddy(ComboBox1);
- aInternalLayout->addWidget(ComboBox1);
-
- aBoxLayout->addLayout(aInternalLayout);
-
- QFrame* aButtonFrame = new QFrame( this );
- theBaseLayout->addWidget(aButtonFrame, 1, 0);
-
- QHBoxLayout* aButtLayout = new QHBoxLayout(aButtonFrame);
-
- buttonOk = new QPushButton(tr("BUT_OK"), aButtonFrame);
- buttonOk->setAutoDefault(true);
- buttonOk->setDefault(true);
- aButtLayout->addWidget(buttonOk);
-
- QSpacerItem* aSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding);
- aButtLayout->addItem(aSpacer);
-
- buttonCancel = new QPushButton(tr( "BUT_CANCEL" ), aButtonFrame);
- buttonCancel->setAutoDefault(true);
- aButtLayout->addWidget(buttonCancel);
-
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*
- * Destroys the object and frees any allocated resources
- */
-SALOMEGUI_ViewChoiceDlg::~SALOMEGUI_ViewChoiceDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-/*!
- Gets user's choice
-*/
-int SALOMEGUI_ViewChoiceDlg::getSelectedViewer()
-{
- return myViewers[ ComboBox1->currentItem() ];
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOMEGUI_ViewChoiceDlg.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOMEGUI_VIEWCHOICEDLG_H
-#define SALOMEGUI_VIEWCHOICEDLG_H
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvaluelist.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QComboBox;
-class QGroupBox;
-class QLabel;
-class QPushButton;
-
-class SALOMEGUI_ViewChoiceDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SALOMEGUI_ViewChoiceDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~SALOMEGUI_ViewChoiceDlg();
-
- int getSelectedViewer();
-
- QGroupBox* GroupBox1;
- QLabel* TextLabel1;
- QComboBox* ComboBox1;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
- QValueList<int> myViewers;
-};
-
-#endif // SALOMEGUI_VIEWCHOICEDLG_H
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : SALOMEGUI_icons.po
-# Module : SALOME
-
-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 "SALOMEGUI_Application::ICON_APP_VIEW_BACK"
-msgstr "view_back.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_BOTTOM"
-msgstr "view_bottom.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_FITALL"
-msgstr "view_fitall.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_FITAREA"
-msgstr "view_fitarea.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_FRONT"
-msgstr "view_front.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_GLOBALPAN"
-msgstr "view_glpan.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_LEFT"
-msgstr "view_left.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_PAN"
-msgstr "view_pan.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_RESET"
-msgstr "view_reset.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_RIGHT"
-msgstr "view_right.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_ROTATE"
-msgstr "view_rotate.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_TOP"
-msgstr "view_top.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_ZOOM"
-msgstr "view_zoom.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_TRIHEDRON"
-msgstr "view_triedre.png"
-
-msgid "SALOMEGUI_Application::ICON_APP_VIEW_DUMP"
-msgstr "view_camera_dump.png"
-
-msgid "ICON_PLOT2D_FIT_ALL"
-msgstr "plot2d_fitall.png"
-
-msgid "ICON_PLOT2D_FIT_AREA"
-msgstr "plot2d_fitarea.png"
-
-msgid "ICON_PLOT2D_ZOOM"
-msgstr "plot2d_zoom.png"
-
-msgid "ICON_PLOT2D_PAN"
-msgstr "plot2d_pan.png"
-
-msgid "ICON_PLOT2D_DUMP"
-msgstr "plot2d_dump.png"
-
-msgid "ICON_PLOT2D_MODE_LINEAR_HOR"
-msgstr "plot2d_linear.png"
-
-msgid "ICON_PLOT2D_MODE_LOGARITHMIC_HOR"
-msgstr "plot2d_log.png"
-
-msgid "ICON_PLOT2D_MODE_LINEAR_VER"
-msgstr "plot2d_linear_y.png"
-
-msgid "ICON_PLOT2D_MODE_LOGARITHMIC_VER"
-msgstr "plot2d_log_y.png"
-
-msgid "ICON_PLOT2D_SHOW_LEGEND"
-msgstr "plot2d_legend.png"
-
-msgid "ICON_PLOT2D_CURVES_POINTS"
-msgstr "plot2d_points.png"
-
-msgid "ICON_PLOT2D_CURVES_LINES"
-msgstr "plot2d_lines.png"
-
-msgid "ICON_PLOT2D_CURVES_SPLINES"
-msgstr "plot2d_splines.png"
-
-msgid "ICON_PLOT2D_SETTINGS"
-msgstr "plot2d_settings.png"
-
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : SALOMEGUI_msg_en.po
-# Module : SALOME
-
-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"
-
-#---------------
-# BUTTONS
-#---------------
-
-msgid "BUT_OK"
-msgstr "Ok"
-
-msgid "BUT_HELP"
-msgstr "Help"
-
-msgid "BUT_CANCEL"
-msgstr "Cancel"
-
-#---------------
-# ERROR
-#---------------
-
-#: SALOMEGUI.cxx:45
-msgid "QObject::ERR_APP_INITFAILED"
-msgstr "Initialization failed"
-
-#: SALOMEGUI.cxx:44
-msgid "ERR_ERROR"
-msgstr "Error"
-
-#: SALOMEGUI_Application.cxx:672
-msgid "ERR_APP_WRONG_VIEW_TYPE"
-msgstr "Appropriate view must be created to display selected object(s)"
-
-#---------------
-# MENUS
-#---------------
-
-#: SALOMEGUI_TrihedronSizeDlg.cxx:77
-msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE"
-msgstr "Size (% of bounding box) :"
-
-#: SALOMEGUI_TrihedronSizeDlg.cxx:36
-msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON"
-msgstr "Trihedron"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:26
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER"
-msgstr "Choose external browser"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:42
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_APP"
-msgstr "Application:"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:50
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_PARAMS"
-msgstr "Parameters:"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:58
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_BROWSE"
-msgstr "&Browse"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:95
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_CHOOSEAPP"
-msgstr "Choose application"
-
-#: SALOMEGUI_ExternalBrowserDlg.cxx:126
-msgid "SALOMEGUI_ExternalBrowserDlg::MEN_EXTERNAL_BROWSER_NOTEXECUTABLE"
-msgstr "The file is not executable!"
-
-
-
-#: SALOMEGUI_OpenWith.cxx:37
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE1"
-msgstr "Always use this component to open this type of object"
-
-#: SALOMEGUI_OpenWith.cxx:65
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE2"
-msgstr "Choose the component you want to use :"
-
-#: SALOMEGUI_OpenWith.cxx:33
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE3"
-msgstr "Choose the component you want to use to open objects :"
-
-#: SALOMEGUI_LoadStudiesDlg.cxx:27
-msgid "SALOMEGUI_LoadStudiesDlg::MEN_STUDIES_CHOICE"
-msgstr "Choose existing study."
-
-#: SALOMEGUI_Application.cxx:87
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_MU4"
-msgstr "Split View"
-
-#: SALOMEGUI_Application.cxx:135
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_PAN"
-msgstr "&Pan View\tCtrl+MB2"
-
-#: SALOMEGUI_Application.cxx:243
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_RESET"
-msgstr "R&eset View"
-
-#: SALOMEGUI_Application.cxx:231
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_RIGHT"
-msgstr "&Right View"
-
-#: SALOMEGUI_Application.cxx:147
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_ROTATE"
-msgstr "R&otate View\tCtrl+MB3"
-
-#: SALOMEGUI_Application.cxx:195
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_TOP"
-msgstr "&Top View"
-
-#: SALOMEGUI_Application.cxx:75
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_TRIHEDRON"
-msgstr "Shows - Hides Trihedron"
-
-#: SALOMEGUI_Application.cxx:123
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_ZOOM"
-msgstr "&Zoom View\tCtrl+MB1"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FITALL"
-msgstr "&Fit All"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FITAREA"
-msgstr "Fit &Area"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FRONT"
-msgstr "&Front View"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_GLOBALPAN"
-msgstr "&Global Pan View"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_BACK"
-msgstr "Bac&k View"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_BOTTOM"
-msgstr "&Bottom View"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_LEFT"
-msgstr "&Left View"
-
-#---------------
-# PRP
-#---------------
-
-#: SALOMEGUI_Application.cxx:185
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_TRIHEDRON"
-msgstr "Shows \ hides trihedron"
-
-#: SALOMEGUI_Application.cxx:185
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_BACK"
-msgstr "Shows back view of objects"
-
-#: SALOMEGUI_Application.cxx:209
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_BOTTOM"
-msgstr "Shows bottom view of objects"
-
-#: SALOMEGUI_Application.cxx:101
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FITALL"
-msgstr "Fits all the objects in the view"
-
-#: SALOMEGUI_Application.cxx:113
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FITAREA"
-msgstr "Fits the view within an area"
-
-#: SALOMEGUI_Application.cxx:173
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FRONT"
-msgstr "Shows front view of objects"
-
-#: SALOMEGUI_Application.cxx:161
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_GLOBALPAN"
-msgstr "Defines a new center of the view"
-
-#: SALOMEGUI_Application.cxx:221
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_LEFT"
-msgstr "Shows left view of objects"
-
-#: SALOMEGUI_Application.cxx:89
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_MU4"
-msgstr "Splits View"
-
-#: SALOMEGUI_Application.cxx:137
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_PAN"
-msgstr "Moves objects in the view"
-
-#: SALOMEGUI_Application.cxx:245
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_RESET"
-msgstr "Resets the view"
-
-#: SALOMEGUI_Application.cxx:233
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_RIGHT"
-msgstr "Shows right view of objects"
-
-#: SALOMEGUI_Application.cxx:149
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_ROTATE"
-msgstr "Rotates objects in the view"
-
-#: SALOMEGUI_Application.cxx:197
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_TOP"
-msgstr "Shows top view of objects"
-
-#: SALOMEGUI_Application.cxx:125
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_ZOOM"
-msgstr "Zooms the active view"
-
-#: SALOMEGUI_Application.cxx:125
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_DUMP"
-msgstr "Saves the active view in the image file"
-
-#---------------
-# TOOL TIP
-#---------------
-
-#: SALOMEGUI_Application.cxx:181
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_BACK"
-msgstr "Back view"
-
-#: SALOMEGUI_Application.cxx:205
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_BOTTOM"
-msgstr "Bottom view"
-
-#: SALOMEGUI_Application.cxx:97
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FITALL"
-msgstr "Fit all"
-
-#: SALOMEGUI_Application.cxx:109
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FITAREA"
-msgstr "Fit within rectangle"
-
-#: SALOMEGUI_Application.cxx:169
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FRONT"
-msgstr "Front view"
-
-#: SALOMEGUI_Application.cxx:157
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_GLOBALPAN"
-msgstr "Global panning"
-
-#: SALOMEGUI_Application.cxx:217
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_LEFT"
-msgstr "Left view"
-
-#: SALOMEGUI_Application.cxx:85
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_MU4"
-msgstr "Splits View"
-
-#: SALOMEGUI_Application.cxx:85
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_TRIHEDRON"
-msgstr "Shows \ hides trihedron"
-
-#: SALOMEGUI_Application.cxx:133
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_PAN"
-msgstr "Panning"
-
-#: SALOMEGUI_Application.cxx:241
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_RESET"
-msgstr "Reset"
-
-#: SALOMEGUI_Application.cxx:229
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_RIGHT"
-msgstr "Right view"
-
-#: SALOMEGUI_Application.cxx:145
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_ROTATE"
-msgstr "Rotate view"
-
-#: SALOMEGUI_Application.cxx:193
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_TOP"
-msgstr "Top view"
-
-#: SALOMEGUI_Application.cxx:121
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_ZOOM"
-msgstr "Zoom"
-
-#: SALOMEGUI_Application.cxx:121
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_DUMP"
-msgstr "Camera Dump"
-
----------------
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:28
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_CHOICE"
-msgstr "Choice"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:38
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEW"
-msgstr "View"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:59
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_GRAPH"
-msgstr "Graph Supervisor"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:57
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_OCC"
-msgstr "Open CASCADE Viewer"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:53
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_TYPE"
-msgstr "Type :"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:58
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_VTK"
-msgstr "VTK Viewer"
-
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_PLOT2D"
-msgstr "Plot2d Viewer"
-
-msgid "SALOMEGUI_OpenWith::OPEN_WITH_TLT"
-msgstr "Open With"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::PRP_AUTHOR"
-msgstr "Author"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::PRP_DATE"
-msgstr "Created"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::PRP_MODE"
-msgstr "Creation mode"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::PRP_MODIFIED"
-msgstr "Modified"
-
-msgid "SALOMEGUI_StudyPropertiesDlg::PRP_LOCKED"
-msgstr "Locked"
-
-msgid "SALOMEGUI_TableDlg::VIEW_TABLE_TLT"
-msgstr "View Table"
-
-msgid "SALOMEGUI_TableDlg::EDIT_TABLE_TLT"
-msgstr "Edit Table"
-
-msgid "SALOMEGUI_TableDlg::TABLE_OF_INTEGER_TLT"
-msgstr "Table of integer"
-
-msgid "SALOMEGUI_TableDlg::TABLE_OF_REAL_TLT"
-msgstr "Table of real"
-
-msgid "SALOMEGUI_TableDlg::ERR_TABLE_NOT_AVAILABLE"
-msgstr "Table is not available"
-
-msgid "SALOMEGUI_TableWidget::UNITS_TLT"
-msgstr "Units"
-
-msgid "SALOMEGUI_TableWidget::ADD_ROW_BTN"
-msgstr "Add Row"
-
-msgid "SALOMEGUI_TableWidget::REMOVE_ROW_BTN"
-msgstr "Remove Row(s)"
-
-msgid "SALOMEGUI_TableWidget::ADD_COLUMN_BTN"
-msgstr "Add Column"
-
-msgid "SALOMEGUI_TableWidget::REMOVE_COLUMN_BTN"
-msgstr "Remove Column(s)"
-
-msgid "SALOMEGUI_TableWidget::ADJUST_CELLS_BTN"
-msgstr "Adjust Cells"
-
-msgid "SALOMEGUI_TableWidget::SELECT_ALL_BTN"
-msgstr "Select All"
-
-msgid "SALOMEGUI_TableWidget::CLEAR_BTN"
-msgstr "Clear"
-
-msgid "SALOMEGUI_TableWidget::SET_TITLE_TLT"
-msgstr "Set title"
-
-msgid "SALOMEGUI_TableWidget::TITLE_LBL"
-msgstr "Title:"
-
-msgid "SALOMEGUI_NameDlg::TLT_RENAME"
-msgstr "Rename"
-
-msgid "SALOMEGUI_NameDlg::NAME_LBL"
-msgstr "Name:"
-
-msgid "TLT_SETVALUE"
-msgstr "Set Value"
-
-msgid "VALUE_LBL"
-msgstr "Value:"
-
-msgid "TLT_SETUP_PLOT2D"
-msgstr "Setup Plot 2d"
-
-msgid "AUTO_CHECK_LBL"
-msgstr "Auto assign"
-
-msgid "NONE_LINE_LBL"
-msgstr "None"
-
-msgid "SOLID_LINE_LBL"
-msgstr "Solid"
-
-msgid "DASH_LINE_LBL"
-msgstr "Dash"
-
-msgid "DOT_LINE_LBL"
-msgstr "Dot"
-
-msgid "DASHDOT_LINE_LBL"
-msgstr "DashDot"
-
-msgid "DAHSDOTDOT_LINE_LBL"
-msgstr "DashDotDot"
-
-msgid "NONE_MARKER_LBL"
-msgstr "None"
-
-msgid "CIRCLE_MARKER_LBL"
-msgstr "Circle"
-
-msgid "RECTANGLE_MARKER_LBL"
-msgstr "Rectangle"
-
-msgid "DIAMOND_MARKER_LBL"
-msgstr "Diamond"
-
-msgid "DTRIANGLE_MARKER_LBL"
-msgstr "Downward triangle"
-
-msgid "UTRIANGLE_MARKER_LBL"
-msgstr "Upward triangle"
-
-msgid "LTRIANGLE_MARKER_LBL"
-msgstr "Leftward triangle"
-
-msgid "RTRIANGLE_MARKER_LBL"
-msgstr "Rightward triangle"
-
-msgid "CROSS_MARKER_LBL"
-msgstr "Cross"
-
-msgid "XCROSS_MARKER_LBL"
-msgstr "Diagonal cross"
-
-msgid "AXIS_LBL"
-msgstr "Axis"
-
-msgid "DATA_LBL"
-msgstr "Data"
-
-msgid "UNITS_LBL"
-msgstr "Units"
-
-msgid "ATTRIBUTES_LBL"
-msgstr "Attributes"
-
-msgid "QUE_WANT_SAME_UNITS"
-msgstr "Do you want to choose all items with the same units for vertical axis?"
-
-msgid "PLOT_2D_TLT"
-msgstr "Plot 2D"
-
-msgid "TLT_SETUP_PLOT2D_VIEW"
-msgstr "Plot 2d View Settings"
-
-msgid "PLOT2D_ENABLE_MAIN_TITLE"
-msgstr "Main title"
-
-msgid "PLOT2D_ENABLE_HOR_TITLE"
-msgstr "Horizontal axis title"
-
-msgid "PLOT2D_ENABLE_VER_TITLE"
-msgstr "Vertical axis title"
-
-msgid "PLOT2D_CURVE_TYPE_LBL"
-msgstr "Curve type:"
-
-msgid "PLOT2D_CURVE_TYPE_POINTS"
-msgstr "Points"
-
-msgid "PLOT2D_CURVE_TYPE_LINES"
-msgstr "Lines"
-
-msgid "PLOT2D_CURVE_TYPE_SPLINE"
-msgstr "Spline"
-
-msgid "PLOT2D_ENABLE_LEGEND"
-msgstr "Show legend"
-
-msgid "PLOT2D_LEGEND_POSITION_LEFT"
-msgstr "Left"
-
-msgid "PLOT2D_LEGEND_POSITION_RIGHT"
-msgstr "Right"
-
-msgid "PLOT2D_LEGEND_POSITION_TOP"
-msgstr "Top"
-
-msgid "PLOT2D_LEGEND_POSITION_BOTTOM"
-msgstr "Bottom"
-
-msgid "PLOT2D_MARKER_SIZE_LBL"
-msgstr "Marker size:"
-
-msgid "PLOT2D_BACKGROUND_COLOR_LBL"
-msgstr "Background color:"
-
-msgid "PLOT2D_SCALE_TLT"
-msgstr "Scale mode"
-
-msgid "PLOT2D_SCALE_MODE_HOR"
-msgstr "Horizontal axis:"
-
-msgid "PLOT2D_SCALE_MODE_VER"
-msgstr "Vertical axis:"
-
-msgid "PLOT2D_SCALE_MODE_LINEAR"
-msgstr "Linear"
-
-msgid "PLOT2D_SCALE_MODE_LOGARITHMIC"
-msgstr "Logarithmic"
-
-msgid "PLOT2D_GRID_TLT"
-msgstr "Grid / Axes marks"
-
-msgid "PLOT2D_GRID_ENABLE_HOR_MAJOR"
-msgstr "Horizontal major"
-
-msgid "PLOT2D_GRID_ENABLE_VER_MAJOR"
-msgstr "Vertical major"
-
-msgid "PLOT2D_GRID_ENABLE_HOR_MINOR"
-msgstr "Horizontal minor"
-
-msgid "PLOT2D_GRID_ENABLE_VER_MINOR"
-msgstr "Vertical minor"
-
-msgid "PLOT2D_SET_AS_DEFAULT_CHECK"
-msgstr "Save settings as default"
-
-msgid "TOT_PLOT2D_FIT_ALL"
-msgstr "Fit All"
-msgid "MEN_PLOT2D_FIT_ALL"
-msgstr "&Fit All"
-msgid "PRP_PLOT2D_FIT_ALL"
-msgstr "Fits view to show all curves"
-msgid "TOT_PLOT2D_FIT_AREA"
-msgstr "Fit Area"
-msgid "MEN_PLOT2D_FIT_AREA"
-msgstr "Fit &Area"
-msgid "PRP_PLOT2D_FIT_AREA"
-msgstr "Fits the view within an area"
-msgid "TOT_PLOT2D_ZOOM"
-msgstr "Zoom"
-msgid "MEN_PLOT2D_ZOOM"
-msgstr "&Zoom view"
-msgid "PRP_PLOT2D_ZOOM"
-msgstr "Zooms the view"
-msgid "TOT_PLOT2D_PAN"
-msgstr "Panning"
-msgid "MEN_PLOT2D_PAN"
-msgstr "&Pan view"
-msgid "PRP_PLOT2D_PAN"
-msgstr "Moves curves in the view"
-msgid "TOT_PLOT2D_DUMP"
-msgstr "Camera Dump"
-msgid "MEN_PLOT2D_DUMP"
-msgstr "Camera &Dump"
-msgid "PRP_PLOT2D_DUMP"
-msgstr "Saves view contents in the image file"
-msgid "SCALING_POPUP"
-msgstr "Scaling"
-msgid "TOT_PLOT2D_MODE_LINEAR_HOR"
-msgstr "Horizontal axis: linear"
-msgid "MEN_PLOT2D_MODE_LINEAR_HOR"
-msgstr "Horizontal axis: linear"
-msgid "PRP_PLOT2D_MODE_LINEAR_HOR"
-msgstr "Switches view to linear scaling mode along horizontal axis"
-msgid "TOT_PLOT2D_MODE_LOGARITHMIC_HOR"
-msgstr "Horizontal axis: logarithmic"
-msgid "MEN_PLOT2D_MODE_LOGARITHMIC_HOR"
-msgstr "Horizontal axis: logarithmic"
-msgid "PRP_PLOT2D_MODE_LOGARITHMIC_HOR"
-msgstr "Switches view to logarithmic scaling mode along horizontal axis"
-msgid "TOT_PLOT2D_MODE_LINEAR_VER"
-msgstr "Vertical axis: linear"
-msgid "MEN_PLOT2D_MODE_LINEAR_VER"
-msgstr "Vertical axis: linear"
-msgid "PRP_PLOT2D_MODE_LINEAR_VER"
-msgstr "Switches view to linear scaling mode along vertical axis"
-msgid "TOT_PLOT2D_MODE_LOGARITHMIC_VER"
-msgstr "Vertical axis: logarithmic"
-msgid "MEN_PLOT2D_MODE_LOGARITHMIC_VER"
-msgstr "Vertical axis: logarithmic"
-msgid "PRP_PLOT2D_MODE_LOGARITHMIC_VER"
-msgstr "Switches view to logarithmic scaling mode along vertical axis"
-msgid "TOT_PLOT2D_SHOW_LEGEND"
-msgstr "Show Legend"
-msgid "MEN_PLOT2D_SHOW_LEGEND"
-msgstr "Show &Legend"
-msgid "PRP_PLOT2D_SHOW_LEGEND"
-msgstr "Enables/disables legend"
-msgid "CURVE_TYPE_POPUP"
-msgstr "Curve type"
-msgid "TOT_PLOT2D_CURVES_POINTS"
-msgstr "Draw points"
-msgid "MEN_PLOT2D_CURVES_POINTS"
-msgstr "Draw points"
-msgid "PRP_PLOT2D_CURVES_POINTS"
-msgstr "Switches view to points mode"
-msgid "TOT_PLOT2D_CURVES_LINES"
-msgstr "Draw lines"
-msgid "MEN_PLOT2D_CURVES_LINES"
-msgstr "Draw lines"
-msgid "PRP_PLOT2D_CURVES_LINES"
-msgstr "Switches view to lines mode"
-msgid "TOT_PLOT2D_CURVES_SPLINES"
-msgstr "Draw splines"
-msgid "MEN_PLOT2D_CURVES_SPLINES"
-msgstr "Draw splines"
-msgid "PRP_PLOT2D_CURVES_SPLINES"
-msgstr "Switches view to splines mode"
-msgid "TOT_PLOT2D_SETTINGS"
-msgstr "Settings"
-msgid "MEN_PLOT2D_SETTINGS"
-msgstr "&Settings"
-msgid "PRP_PLOT2D_SETTINGS"
-msgstr "Setups view properties"
-msgid "TOT_PLOT2D_CHANGE_BACKGROUND"
-msgstr "Change background"
-msgid "MEN_PLOT2D_CHANGE_BACKGROUND"
-msgstr "Change background..."
-msgid "PRP_PLOT2D_CHANGE_BACKGROUND"
-msgstr "Change background color"
-
-msgid "INF_COORDINATES"
-msgstr "Coordinates: X : %1, Y : %2"
-
-msgid "SALOMEGUI_SetupCurveDlg::TLT_SETUP_CURVE"
-msgstr "Setup Curve"
-msgid "SALOMEGUI_SetupCurveDlg::CURVE_LINE_TYPE_LAB"
-msgstr "Line type:"
-msgid "SALOMEGUI_SetupCurveDlg::CURVE_LINE_WIDTH_LAB"
-msgstr "Line width:"
-msgid "SALOMEGUI_SetupCurveDlg::CURVE_MARKER_TYPE_LAB"
-msgstr "Marker type:"
-msgid "SALOMEGUI_SetupCurveDlg::CURVE_COLOR_LAB"
-msgstr "Color:"
-msgid "SALOMEGUI_CloseDlg::CAPTION"
-msgstr "Close active study"
-
-msgid "SALOMEGUI_CloseDlg::SAVE_CLOSE"
-msgstr "&Save&&Close"
-
-msgid "SALOMEGUI_CloseDlg::CLOSE"
-msgstr "C&lose w/o saving"
-
-msgid "SALOMEGUI_CloseDlg::UNLOAD"
-msgstr "&Unload"
-
-msgid "SALOMEGUI_CloseDlg::CANCEL"
-msgstr "&Cancel"
-
-msgid "SALOMEGUI_CloseDlg::CLOSE_DESCRIPTION"
-msgstr "Do you want to close or only unload the study ?"
-
-msgid "SALOMEGUI_ActivateComponentDlg::CAPTION"
-msgstr "Activate module"
-
-msgid "SALOMEGUI_ActivateComponentDlg::NEW"
-msgstr "&New"
-
-msgid "SALOMEGUI_ActivateComponentDlg::OPEN"
-msgstr "&Open"
-
-msgid "SALOMEGUI_ActivateComponentDlg::LOAD"
-msgstr "&Load"
-
-msgid "SALOMEGUI_ActivateComponentDlg::CANCEL"
-msgstr "&Cancel"
-
-msgid "SALOMEGUI_ActivateComponentDlg::ActivateComponent_DESCRIPTION"
-msgstr "Create, open or load study."
-
-msgid "SALOMEGUI_HELP_TITLE"
-msgstr "SALOME Help"
-
-msgid "TOT_PLOT2D_FITDATA"
-msgstr "Fit range"
-msgid "MEN_PLOT2D_FITDATA"
-msgstr "Fit &Range"
-msgid "PRP_PLOT2D_FITDATA"
-msgstr "Fits view to the given data range"
-
-msgid "FIT_DATA_TLT"
-msgstr "Fit Data Range"
-
-msgid "Plot2d_FitDataDlg::FIT_ALL"
-msgstr "Fit both"
-
-msgid "Plot2d_FitDataDlg::FIT_HORIZONTAL"
-msgstr "Fit horizontally"
-
-msgid "Plot2d_FitDataDlg::FIT_VERTICAL"
-msgstr "Fit vertically"
-
-msgid "Plot2d_FitDataDlg::HORIZONTAL_AXIS"
-msgstr "Horizontal axis"
-
-msgid "Plot2d_FitDataDlg::VERTICAL_AXIS"
-msgstr "Vertical axis"
-
-msgid "Plot2d_FitDataDlg::MIN_VALUE_LAB"
-msgstr "Min:"
-
-msgid "Plot2d_FitDataDlg::MAX_VALUE_LAB"
-msgstr "Max:"
+++ /dev/null
-# SALOME SALOMEGUI : implementation of desktop and GUI kernel
-#
-# 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 : SALOMEGUI_msg_fr.po
-# Module : SALOME
-
-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"
-
-#---------------
-# BUTTONS
-#---------------
-
-msgid "BUT_OK"
-msgstr "Ok"
-
-msgid "BUT_HELP"
-msgstr "Aide"
-
-msgid "BUT_CANCEL"
-msgstr "Annule"
-
-#---------------
-# ERROR
-#---------------
-
-#: SALOMEGUI.cxx:45
-msgid "QObject::ERR_APP_INITFAILED"
-msgstr "Echec d'Initialisation"
-
-#: SALOMEGUI.cxx:44
-msgid "ERR_ERROR"
-msgstr "Erreur"
-
-#: SALOMEGUI_Application.cxx:672
-msgid "ERR_APP_WRONG_VIEW_TYPE"
-msgstr "La vue appropriée doit étre créée pour afficher l'objet choisi"
-
-#---------------
-# INFORMATIONS
-#---------------
-
-msgid "INF_VERSION"
-msgstr ""
-
-msgid "INF_COPYRIGHT"
-msgstr ""
-
-msgid "INF_LICENSE"
-msgstr ""
-
-
-#---------------
-# MENUS
-#---------------
-
-#: SALOMEGUI_TrihedronSizeDlg.cxx:77
-msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE"
-msgstr "Size (% of bounding box) :"
-
-#: SALOMEGUI_TrihedronSizeDlg.cxx:36
-msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON"
-msgstr "Trihedron"
-
-#: SALOMEGUI_OpenWith.cxx:37
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE1"
-msgstr "Always use this component to open this type of object"
-
-#: SALOMEGUI_OpenWith.cxx:65
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE2"
-msgstr "Choose the component you want to use :"
-
-#: SALOMEGUI_OpenWith.cxx:33
-msgid "SALOMEGUI_OpenWith::MEN_COMPONENT_CHOICE3"
-msgstr "Choose the component you want to use to open objects :"
-
-#: SALOMEGUI_LoadStudiesDlg.cxx:27
-msgid "SALOMEGUI_LoadStudiesDlg::MEN_STUDIES_CHOICE"
-msgstr "Choose existing study."
-
-#: SALOMEGUI_Application.cxx:87
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_MU4"
-msgstr "Multiple Vue"
-
-#: SALOMEGUI_Application.cxx:135
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_PAN"
-msgstr "&Pan Vue\tCtrl+MB2"
-
-#: SALOMEGUI_Application.cxx:243
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_RESET"
-msgstr "R&estaure la Vue"
-
-#: SALOMEGUI_Application.cxx:231
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_RIGHT"
-msgstr "Vue D&roite"
-
-#: SALOMEGUI_Application.cxx:147
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_ROTATE"
-msgstr "R&otation Vue\tCtrl+MB3"
-
-#: SALOMEGUI_Application.cxx:195
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_TOP"
-msgstr "&Top Vue"
-
-#: SALOMEGUI_Application.cxx:75
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_TRIHEDRON"
-msgstr "Afficher - Masquer OXYZ"
-
-#: SALOMEGUI_Application.cxx:123
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_ZOOM"
-msgstr "&Zoom \tCtrl+MB1"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FITALL"
-msgstr "&Fit All"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FITAREA"
-msgstr "Fit &Area"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_FRONT"
-msgstr "&Premier Plan"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_GLOBALPAN"
-msgstr "&Global Pan Vue"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_BACK"
-msgstr "Arrière plan"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_BOTTOM"
-msgstr "&Vue du dessous"
-
-msgid "SALOMEGUI_Application::MEN_APP_VIEW_LEFT"
-msgstr "&Vue gauche"
-
-#---------------
-# PRP
-#---------------
-
-#: SALOMEGUI_Application.cxx:185
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_TRIHEDRON"
-msgstr "Afficher \ masquer OXYZ"
-
-#: SALOMEGUI_Application.cxx:185
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_BACK"
-msgstr "Affiche la vue arrière des objets"
-
-#: SALOMEGUI_Application.cxx:209
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_BOTTOM"
-msgstr "Affiche la vue du dessous des objets"
-
-#: SALOMEGUI_Application.cxx:101
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FITALL"
-msgstr "Fits all the objects in the view"
-
-#: SALOMEGUI_Application.cxx:113
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FITAREA"
-msgstr "Fits the view within an area"
-
-#: SALOMEGUI_Application.cxx:173
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_FRONT"
-msgstr "Affiche la vue de face des objets"
-
-#: SALOMEGUI_Application.cxx:161
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_GLOBALPAN"
-msgstr "Définir le centre de la vue"
-
-#: SALOMEGUI_Application.cxx:221
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_LEFT"
-msgstr "Affiche la vue gauche des objets"
-
-#: SALOMEGUI_Application.cxx:89
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_MU4"
-msgstr "Fractionner la vue"
-
-#: SALOMEGUI_Application.cxx:137
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_PAN"
-msgstr "Déplacer les objets"
-
-#: SALOMEGUI_Application.cxx:245
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_RESET"
-msgstr "Restaure la vue"
-
-#: SALOMEGUI_Application.cxx:233
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_RIGHT"
-msgstr "Affiche la vue droite des objets"
-
-#: SALOMEGUI_Application.cxx:149
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_ROTATE"
-msgstr "Rotation des objets"
-
-#: SALOMEGUI_Application.cxx:197
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_TOP"
-msgstr "Affiche la vue supérieure des objets"
-
-#: SALOMEGUI_Application.cxx:125
-msgid "SALOMEGUI_Application::PRP_APP_VIEW_ZOOM"
-msgstr "Zoom la vue active"
-
-#---------------
-# TOOL TIP
-#---------------
-
-#: SALOMEGUI_Application.cxx:181
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_BACK"
-msgstr "Arrière plan"
-
-#: SALOMEGUI_Application.cxx:205
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_BOTTOM"
-msgstr "Vue du dessous"
-
-#: SALOMEGUI_Application.cxx:97
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FITALL"
-msgstr "Fit all"
-
-#: SALOMEGUI_Application.cxx:109
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FITAREA"
-msgstr "Fit within rectangle"
-
-#: SALOMEGUI_Application.cxx:169
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_FRONT"
-msgstr "Premier plan"
-
-#: SALOMEGUI_Application.cxx:157
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_GLOBALPAN"
-msgstr "Global panning"
-
-#: SALOMEGUI_Application.cxx:217
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_LEFT"
-msgstr "Vue gauche"
-
-#: SALOMEGUI_Application.cxx:85
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_MU4"
-msgstr "Fractionner la vue"
-
-#: SALOMEGUI_Application.cxx:85
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_TRIHEDRON"
-msgstr "Afficher \ masquer trihedron"
-
-#: SALOMEGUI_Application.cxx:133
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_PAN"
-msgstr "Panning"
-
-#: SALOMEGUI_Application.cxx:241
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_RESET"
-msgstr "Restaure"
-
-#: SALOMEGUI_Application.cxx:229
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_RIGHT"
-msgstr "Vue droite"
-
-#: SALOMEGUI_Application.cxx:145
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_ROTATE"
-msgstr "Vue de la rotation"
-
-#: SALOMEGUI_Application.cxx:193
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_TOP"
-msgstr "Top view"
-
-#: SALOMEGUI_Application.cxx:121
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_ZOOM"
-msgstr "Zoom"
-
-#: SALOMEGUI_Application.cxx:121
-msgid "SALOMEGUI_Application::TOT_APP_VIEW_DUMP"
-msgstr "Capture du Viewer"
-
----------------
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:28
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_CHOICE"
-msgstr "Choix"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:38
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEW"
-msgstr "Vue"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:59
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_GRAPH"
-msgstr "Graphe Supervision"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:57
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_OCC"
-msgstr "Open CASCADE Viewer"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:53
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_TYPE"
-msgstr "Type :"
-
-#: SALOMEGUI_ViewChoiceDlg.cxx:58
-msgid "SALOMEGUI_ViewChoiceDlg::MEN_VIEWER_VTK"
-msgstr "VTK Viewer"
-
-#: SALOMEGUI_AboutDlg.cxx:42
-msgid "ABOUT_SALOME_TLT"
-msgstr "About SALOME Professional"
-
-msgid "SALOMEGUI_OpenWith::OPEN_WITH_TLT"
-msgstr "Open With"
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx
-// Module : SALOME
-
-#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
-#define _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
-
-#ifndef _TCollection_BasicMapIterator_HeaderFile
-#include <TCollection_BasicMapIterator.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
-#endif
-class Standard_NoSuchObject;
-class SALOME_InteractiveObject;
-class TColStd_IndexedMapOfInteger;
-class TColStd_MapTransientHasher;
-class SALOME_DataMapOfIOMapOfInteger;
-class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger : public TCollection_BasicMapIterator {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger();
-Standard_EXPORT SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& aMap);
-Standard_EXPORT void Initialize(const SALOME_DataMapOfIOMapOfInteger& aMap) ;
-Standard_EXPORT const Handle_SALOME_InteractiveObject& Key() const;
-Standard_EXPORT const TColStd_IndexedMapOfInteger& Value() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx
-// Module : SALOME
-
-#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
-#include <TColStd_IndexedMapOfInteger.hxx>
-#endif
-#ifndef _TColStd_MapTransientHasher_HeaderFile
-#include <TColStd_MapTransientHasher.hxx>
-#endif
-#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapOfIOMapOfInteger.hxx"
-#endif
-#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#endif
-using namespace std;
-
-
-#define TheKey Handle_SALOME_InteractiveObject
-#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_IndexedMapOfInteger
-#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
-#define Hasher TColStd_MapTransientHasher
-#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
-#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
-#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
-#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
-#include <TCollection_DataMapIterator.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
-// Module : SALOME
-
-#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#define _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
-#endif
-
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
-#include <TColStd_IndexedMapOfInteger.hxx>
-#endif
-#ifndef _TCollection_MapNode_HeaderFile
-#include <TCollection_MapNode.hxx>
-#endif
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#include <TCollection_MapNodePtr.hxx>
-#endif
-class SALOME_InteractiveObject;
-class TColStd_IndexedMapOfInteger;
-class TColStd_MapTransientHasher;
-class SALOME_DataMapOfIOMapOfInteger;
-class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
-
-
-class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger : public TCollection_MapNode {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT inline SALOME_DataMapNodeOfDataMapOfIOMapOfInteger(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I,const TCollection_MapNodePtr& n);
-Standard_EXPORT inline Handle_SALOME_InteractiveObject& Key() const;
-Standard_EXPORT inline TColStd_IndexedMapOfInteger& Value() const;
-Standard_EXPORT ~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_SALOME_InteractiveObject myKey;
-TColStd_IndexedMapOfInteger myValue;
-
-
-};
-
-#define TheKey Handle_SALOME_InteractiveObject
-#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_IndexedMapOfInteger
-#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
-#define Hasher TColStd_MapTransientHasher
-#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
-#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
-#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
-#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
-
-#include <TCollection_DataMapNode.lxx>
-
-#undef TheKey
-#undef TheKey_hxx
-#undef TheItem
-#undef TheItem_hxx
-#undef Hasher
-#undef Hasher_hxx
-#undef TCollection_DataMapNode
-#undef TCollection_DataMapNode_hxx
-#undef TCollection_DataMapIterator
-#undef TCollection_DataMapIterator_hxx
-#undef Handle_TCollection_DataMapNode
-#undef TCollection_DataMapNode_Type_
-#undef TCollection_DataMap
-#undef TCollection_DataMap_hxx
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx
-// Module : SALOME
-
-#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
-#include <TColStd_IndexedMapOfInteger.hxx>
-#endif
-#ifndef _TColStd_MapTransientHasher_HeaderFile
-#include <TColStd_MapTransientHasher.hxx>
-#endif
-#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapOfIOMapOfInteger.hxx"
-#endif
-#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#endif
-using namespace std;
-SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_DataMapNodeOfDataMapOfIOMapOfInteger",
- sizeof(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger))) {
- _anOtherObject = Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)((Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) ;
-}
-Standard_Boolean SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) == AType || TCollection_MapNode::IsKind(AType));
-}
-Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
-#define TheKey Handle_SALOME_InteractiveObject
-#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_IndexedMapOfInteger
-#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
-#define Hasher TColStd_MapTransientHasher
-#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
-#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
-#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
-#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
-#include <TCollection_DataMapNode.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapOfIOMapOfInteger.hxx
-// Module : SALOME
-
-#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
-#define _SALOME_DataMapOfIOMapOfInteger_HeaderFile
-
-#ifndef _TCollection_BasicMap_HeaderFile
-#include <TCollection_BasicMap.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_DomainError;
-class Standard_NoSuchObject;
-class SALOME_InteractiveObject;
-class TColStd_IndexedMapOfInteger;
-class TColStd_MapTransientHasher;
-class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
-class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_DataMapOfIOMapOfInteger : public TCollection_BasicMap {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_DataMapOfIOMapOfInteger(const Standard_Integer NbBuckets = 1);
-Standard_EXPORT SALOME_DataMapOfIOMapOfInteger& Assign(const SALOME_DataMapOfIOMapOfInteger& Other) ;
- SALOME_DataMapOfIOMapOfInteger& operator =(const SALOME_DataMapOfIOMapOfInteger& Other)
-{
- return Assign(Other);
-}
-
-Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ;
-Standard_EXPORT void Clear() ;
-~SALOME_DataMapOfIOMapOfInteger()
-{
- Clear();
-}
-
-Standard_EXPORT Standard_Boolean Bind(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I) ;
-Standard_EXPORT Standard_Boolean IsBound(const Handle(SALOME_InteractiveObject)& K) const;
-Standard_EXPORT Standard_Boolean UnBind(const Handle(SALOME_InteractiveObject)& K) ;
-Standard_EXPORT const TColStd_IndexedMapOfInteger& Find(const Handle(SALOME_InteractiveObject)& K) const;
- const TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) const
-{
- return Find(K);
-}
-
-Standard_EXPORT TColStd_IndexedMapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
- TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K)
-{
- return ChangeFind(K);
-}
-
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT SALOME_DataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& Other);
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_DataMapOfIOMapOfInteger_0.cxx
-// Module : SALOME
-
-#include "SALOME_DataMapOfIOMapOfInteger.hxx"
-
-#ifndef _Standard_DomainError_HeaderFile
-#include <Standard_DomainError.hxx>
-#endif
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
-#include <TColStd_IndexedMapOfInteger.hxx>
-#endif
-#ifndef _TColStd_MapTransientHasher_HeaderFile
-#include <TColStd_MapTransientHasher.hxx>
-#endif
-#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#endif
-#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
-#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#endif
-using namespace std;
-
-
-#define TheKey Handle_SALOME_InteractiveObject
-#define TheKey_hxx "SALOME_InteractiveObject.hxx"
-#define TheItem TColStd_IndexedMapOfInteger
-#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
-#define Hasher TColStd_MapTransientHasher
-#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
-#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
-#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
-#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
-#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
-#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
-#include <TCollection_DataMap.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Filter.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOME_Filter.ixx"
-using namespace std;
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Filter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_Filter_HeaderFile
-#define _SALOME_Filter_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-
-class SALOME_Filter : public MMgt_TShared {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anObj) const = 0;
-Standard_EXPORT ~SALOME_Filter();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_Filter_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Filter.ixx
-// Module : SALOME
-
-#include "SALOME_Filter.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_Filter::~SALOME_Filter() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_Filter_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_Filter",
- sizeof(SALOME_Filter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_Filter) Handle(SALOME_Filter)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_Filter) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_Filter))) {
- _anOtherObject = Handle(SALOME_Filter)((Handle(SALOME_Filter)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_Filter::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_Filter) ;
-}
-Standard_Boolean SALOME_Filter::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_Filter) == AType || MMgt_TShared::IsKind(AType));
-}
-Handle_SALOME_Filter::~Handle_SALOME_Filter() {}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Filter.jxx
-// Module : SALOME
-
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIO.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListIO_HeaderFile
-#define _SALOME_ListIO_HeaderFile
-
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
-#include <Handle_SALOME_ListNodeOfListIO.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_NoSuchObject;
-class SALOME_ListIteratorOfListIO;
-class SALOME_InteractiveObject;
-class SALOME_ListNodeOfListIO;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_ListIO {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_ListIO();
-Standard_EXPORT void Assign(const SALOME_ListIO& Other) ;
- void operator=(const SALOME_ListIO& Other)
-{
- Assign(Other);
-}
-
-Standard_EXPORT Standard_Integer Extent() const;
-Standard_EXPORT void Clear() ;
-~SALOME_ListIO()
-{
- Clear();
-}
-
-Standard_EXPORT Standard_Boolean IsEmpty() const;
-Standard_EXPORT void Prepend(const Handle(SALOME_InteractiveObject)& I) ;
-Standard_EXPORT void Prepend(SALOME_ListIO& Other) ;
-Standard_EXPORT void Prepend(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT void Append(const Handle(SALOME_InteractiveObject)& I) ;
-Standard_EXPORT void Append(SALOME_ListIO& Other) ;
-Standard_EXPORT void Append(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT Handle_SALOME_InteractiveObject& First() const;
-Standard_EXPORT Handle_SALOME_InteractiveObject& Last() const;
-Standard_EXPORT void RemoveFirst() ;
-Standard_EXPORT void Remove(SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT void InsertBefore(const Handle(SALOME_InteractiveObject)& I,SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT void InsertBefore(SALOME_ListIO& Other,SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT void InsertAfter(const Handle(SALOME_InteractiveObject)& I,SALOME_ListIteratorOfListIO& It) ;
-Standard_EXPORT void InsertAfter(SALOME_ListIO& Other,SALOME_ListIteratorOfListIO& It) ;
-
-
-friend class SALOME_ListIteratorOfListIO;
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT SALOME_ListIO(const SALOME_ListIO& Other);
-
-
- // Fields PRIVATE
- //
-Standard_Address myFirst;
-Standard_Address myLast;
-
-
-};
-
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-
-#include <TCollection_List.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIO_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListIO.hxx"
-
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
-#include "SALOME_ListIteratorOfListIO.hxx"
-#endif
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _SALOME_ListNodeOfListIO_HeaderFile
-#include "SALOME_ListNodeOfListIO.hxx"
-#endif
-using namespace std;
-
-
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-#include <TCollection_List.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIteratorOfListIO.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
-#define _SALOME_ListIteratorOfListIO_HeaderFile
-
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
-#include <Handle_SALOME_ListNodeOfListIO.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_NoMoreObject;
-class Standard_NoSuchObject;
-class SALOME_ListIO;
-class SALOME_InteractiveObject;
-class SALOME_ListNodeOfListIO;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_ListIteratorOfListIO {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_ListIteratorOfListIO();
-Standard_EXPORT SALOME_ListIteratorOfListIO(const SALOME_ListIO& L);
-Standard_EXPORT void Initialize(const SALOME_ListIO& L) ;
-Standard_EXPORT Standard_Boolean More() const;
-Standard_EXPORT void Next() ;
-Standard_EXPORT Handle_SALOME_InteractiveObject& Value() const;
-
-
-friend class SALOME_ListIO;
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Address current;
-Standard_Address previous;
-
-
-};
-
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-
-#include <TCollection_ListIterator.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIteratorOfListIO_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#ifndef _Standard_NoMoreObject_HeaderFile
-#include <Standard_NoMoreObject.hxx>
-#endif
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_ListIO_HeaderFile
-#include "SALOME_ListIO.hxx"
-#endif
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _SALOME_ListNodeOfListIO_HeaderFile
-#include "SALOME_ListNodeOfListIO.hxx"
-#endif
-using namespace std;
-
-
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-#include <TCollection_ListIterator.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIteratorOfListOfFilter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListIteratorOfListOfFilter_HeaderFile
-#define _SALOME_ListIteratorOfListOfFilter_HeaderFile
-
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListOfFilter_HeaderFile
-#include <Handle_SALOME_ListNodeOfListOfFilter.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_NoMoreObject;
-class Standard_NoSuchObject;
-class SALOME_ListOfFilter;
-class SALOME_Filter;
-class SALOME_ListNodeOfListOfFilter;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_ListIteratorOfListOfFilter {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_ListIteratorOfListOfFilter();
-Standard_EXPORT SALOME_ListIteratorOfListOfFilter(const SALOME_ListOfFilter& L);
-Standard_EXPORT void Initialize(const SALOME_ListOfFilter& L) ;
-Standard_EXPORT inline Standard_Boolean More() const;
-Standard_EXPORT void Next() ;
-Standard_EXPORT Handle_SALOME_Filter& Value() const;
-
-
-friend class SALOME_ListOfFilter;
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Address current;
-Standard_Address previous;
-
-
-};
-
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-
-#include <TCollection_ListIterator.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListIteratorOfListOfFilter_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListIteratorOfListOfFilter.hxx"
-
-#ifndef _Standard_NoMoreObject_HeaderFile
-#include <Standard_NoMoreObject.hxx>
-#endif
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_ListOfFilter_HeaderFile
-#include "SALOME_ListOfFilter.hxx"
-#endif
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
-#ifndef _SALOME_ListNodeOfListOfFilter_HeaderFile
-#include "SALOME_ListNodeOfListOfFilter.hxx"
-#endif
-using namespace std;
-
-
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-#include <TCollection_ListIterator.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListNodeOfListIO.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListNodeOfListIO_HeaderFile
-#define _SALOME_ListNodeOfListIO_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
-#include <Handle_SALOME_ListNodeOfListIO.hxx>
-#endif
-
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-#ifndef _TCollection_MapNode_HeaderFile
-#include <TCollection_MapNode.hxx>
-#endif
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#include <TCollection_MapNodePtr.hxx>
-#endif
-class SALOME_InteractiveObject;
-class SALOME_ListIO;
-class SALOME_ListIteratorOfListIO;
-
-
-class SALOME_ListNodeOfListIO : public TCollection_MapNode {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-SALOME_ListNodeOfListIO(const Handle(SALOME_InteractiveObject)& I,const TCollection_MapNodePtr& n);
- Handle_SALOME_InteractiveObject& Value() const;
-Standard_EXPORT ~SALOME_ListNodeOfListIO();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_SALOME_InteractiveObject myValue;
-
-
-};
-
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-
-#include <TCollection_ListNode.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListNodeOfListIO_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListNodeOfListIO.hxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _SALOME_InteractiveObject_HeaderFile
-#include "SALOME_InteractiveObject.hxx"
-#endif
-#ifndef _SALOME_ListIO_HeaderFile
-#include "SALOME_ListIO.hxx"
-#endif
-#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
-#include "SALOME_ListIteratorOfListIO.hxx"
-#endif
-using namespace std;
-SALOME_ListNodeOfListIO::~SALOME_ListNodeOfListIO() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_ListNodeOfListIO",
- sizeof(SALOME_ListNodeOfListIO),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_ListNodeOfListIO) Handle(SALOME_ListNodeOfListIO)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_ListNodeOfListIO) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_ListNodeOfListIO))) {
- _anOtherObject = Handle(SALOME_ListNodeOfListIO)((Handle(SALOME_ListNodeOfListIO)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_ListNodeOfListIO::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_ListNodeOfListIO) ;
-}
-Standard_Boolean SALOME_ListNodeOfListIO::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_ListNodeOfListIO) == AType || TCollection_MapNode::IsKind(AType));
-}
-Handle_SALOME_ListNodeOfListIO::~Handle_SALOME_ListNodeOfListIO() {}
-#define Item Handle_SALOME_InteractiveObject
-#define Item_hxx "SALOME_InteractiveObject.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListIO
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListIO
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
-#define TCollection_List SALOME_ListIO
-#define TCollection_List_hxx "SALOME_ListIO.hxx"
-#include <TCollection_ListNode.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListNodeOfListOfFilter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListNodeOfListOfFilter_HeaderFile
-#define _SALOME_ListNodeOfListOfFilter_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListOfFilter_HeaderFile
-#include <Handle_SALOME_ListNodeOfListOfFilter.hxx>
-#endif
-
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-#ifndef _TCollection_MapNode_HeaderFile
-#include <TCollection_MapNode.hxx>
-#endif
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#include <TCollection_MapNodePtr.hxx>
-#endif
-class SALOME_Filter;
-class SALOME_ListOfFilter;
-class SALOME_ListIteratorOfListOfFilter;
-
-
-class SALOME_ListNodeOfListOfFilter : public TCollection_MapNode {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT inline SALOME_ListNodeOfListOfFilter(const Handle(SALOME_Filter)& I,const TCollection_MapNodePtr& n);
-Standard_EXPORT inline Handle_SALOME_Filter& Value() const;
-Standard_EXPORT ~SALOME_ListNodeOfListOfFilter();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_ListNodeOfListOfFilter_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_SALOME_Filter myValue;
-
-
-};
-
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-
-#include <TCollection_ListNode.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListNodeOfListOfFilter_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListNodeOfListOfFilter.hxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
-#ifndef _SALOME_ListOfFilter_HeaderFile
-#include "SALOME_ListOfFilter.hxx"
-#endif
-#ifndef _SALOME_ListIteratorOfListOfFilter_HeaderFile
-#include "SALOME_ListIteratorOfListOfFilter.hxx"
-#endif
-using namespace std;
-SALOME_ListNodeOfListOfFilter::~SALOME_ListNodeOfListOfFilter() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_ListNodeOfListOfFilter_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_ListNodeOfListOfFilter",
- sizeof(SALOME_ListNodeOfListOfFilter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_ListNodeOfListOfFilter) Handle(SALOME_ListNodeOfListOfFilter)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_ListNodeOfListOfFilter) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_ListNodeOfListOfFilter))) {
- _anOtherObject = Handle(SALOME_ListNodeOfListOfFilter)((Handle(SALOME_ListNodeOfListOfFilter)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_ListNodeOfListOfFilter::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_ListNodeOfListOfFilter) ;
-}
-Standard_Boolean SALOME_ListNodeOfListOfFilter::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_ListNodeOfListOfFilter) == AType || TCollection_MapNode::IsKind(AType));
-}
-Handle_SALOME_ListNodeOfListOfFilter::~Handle_SALOME_ListNodeOfListOfFilter() {}
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-#include <TCollection_ListNode.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListOfFilter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_ListOfFilter_HeaderFile
-#define _SALOME_ListOfFilter_HeaderFile
-
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
-#ifndef _Handle_SALOME_Filter_HeaderFile
-#include <Handle_SALOME_Filter.hxx>
-#endif
-#ifndef _Handle_SALOME_ListNodeOfListOfFilter_HeaderFile
-#include <Handle_SALOME_ListNodeOfListOfFilter.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_NoSuchObject;
-class SALOME_ListIteratorOfListOfFilter;
-class SALOME_Filter;
-class SALOME_ListNodeOfListOfFilter;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOME_ListOfFilter {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_ListOfFilter();
-Standard_EXPORT void Assign(const SALOME_ListOfFilter& Other) ;
- void operator=(const SALOME_ListOfFilter& Other)
-{
- Assign(Other);
-}
-
-Standard_EXPORT Standard_Integer Extent() const;
-Standard_EXPORT void Clear() ;
-~SALOME_ListOfFilter()
-{
- Clear();
-}
-
-Standard_EXPORT inline Standard_Boolean IsEmpty() const;
-Standard_EXPORT void Prepend(const Handle(SALOME_Filter)& I) ;
-Standard_EXPORT void Prepend(SALOME_ListOfFilter& Other) ;
-Standard_EXPORT void Prepend(const Handle(SALOME_Filter)& I, SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT void Append(const Handle(SALOME_Filter)& I) ;
-Standard_EXPORT void Append(SALOME_ListOfFilter& Other) ;
-Standard_EXPORT void Append(const Handle(SALOME_Filter)& I, SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT Handle_SALOME_Filter& First() const;
-Standard_EXPORT Handle_SALOME_Filter& Last() const;
-Standard_EXPORT void RemoveFirst() ;
-Standard_EXPORT void Remove(SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT void InsertBefore(const Handle(SALOME_Filter)& I,SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT void InsertBefore(SALOME_ListOfFilter& Other,SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT void InsertAfter(const Handle(SALOME_Filter)& I,SALOME_ListIteratorOfListOfFilter& It) ;
-Standard_EXPORT void InsertAfter(SALOME_ListOfFilter& Other,SALOME_ListIteratorOfListOfFilter& It) ;
-
-
-friend class SALOME_ListIteratorOfListOfFilter;
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT SALOME_ListOfFilter(const SALOME_ListOfFilter& Other);
-
-
- // Fields PRIVATE
- //
-Standard_Address myFirst;
-Standard_Address myLast;
-
-
-};
-
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-
-#include <TCollection_List.lxx>
-
-#undef Item
-#undef Item_hxx
-#undef TCollection_ListNode
-#undef TCollection_ListNode_hxx
-#undef TCollection_ListIterator
-#undef TCollection_ListIterator_hxx
-#undef Handle_TCollection_ListNode
-#undef TCollection_ListNode_Type_
-#undef TCollection_List
-#undef TCollection_List_hxx
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_ListOfFilter_0.cxx
-// Module : SALOME
-
-#include "SALOME_ListOfFilter.hxx"
-
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _SALOME_ListIteratorOfListOfFilter_HeaderFile
-#include "SALOME_ListIteratorOfListOfFilter.hxx"
-#endif
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
-#ifndef _SALOME_ListNodeOfListOfFilter_HeaderFile
-#include "SALOME_ListNodeOfListOfFilter.hxx"
-#endif
-using namespace std;
-
-
-#define Item Handle_SALOME_Filter
-#define Item_hxx "SALOME_Filter.hxx"
-#define TCollection_ListNode SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_hxx "SALOME_ListNodeOfListOfFilter.hxx"
-#define TCollection_ListIterator SALOME_ListIteratorOfListOfFilter
-#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListOfFilter.hxx"
-#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListOfFilter
-#define TCollection_ListNode_Type_() SALOME_ListNodeOfListOfFilter_Type_()
-#define TCollection_List SALOME_ListOfFilter
-#define TCollection_List_hxx "SALOME_ListOfFilter.hxx"
-#include <TCollection_List.gxx>
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_NumberFilter.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOME_NumberFilter.ixx"
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-using namespace std;
-
-SALOME_NumberFilter::SALOME_NumberFilter(NumberFilter TheKind, Standard_Integer aValue):
-myKind(TheKind),
-myValue(aValue){}
-
-Standard_Boolean SALOME_NumberFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
-{
- bool result = false;
- QAD_Study* myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
- int nbSel = Sel->IObjectCount();
-
- switch ( myKind )
- {
- case 0 : // INFERIOR
- {
- if ( (nbSel + 1 ) < myValue )
- result = true;
- else
- result = false;
- break;
- }
- case 1 : // INFERIOR_OR_EQUAL
- {
- if ( (nbSel + 1 ) <= myValue )
- result = true;
- else
- result = false;
- break;
- }
- case 2 : // SUPERIOR
- {
- result = true;
- break;
- }
- case 3 : // SUPERIOR_OR_EQUAL
- {
- result = true;
- break;
- }
- case 4 : // EQUAL
- {
- if ( (nbSel + 1 ) == myValue )
- result = true;
- else
- result = false;
- break;
- }
- }
-
- return result;
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_NumberFilter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_NumberFilter_HeaderFile
-#define _SALOME_NumberFilter_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_NumberFilter_HeaderFile
-#include <Handle_SALOME_NumberFilter.hxx>
-#endif
-
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-
-class SALOME_NumberFilter : public SALOME_Filter {
-
-public:
-
- enum NumberFilter { INFERIOR, INFERIOR_OR_EQUAL, SUPERIOR, SUPERIOR_OR_EQUAL, EQUAL };
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_NumberFilter(NumberFilter aGivenKind, Standard_Integer aValue);
-Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const;
-Standard_EXPORT ~SALOME_NumberFilter();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_NumberFilter_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-NumberFilter myKind;
-Standard_Integer myValue;
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_NumberFilter.ixx
-// Module : SALOME
-
-#include "SALOME_NumberFilter.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_NumberFilter::~SALOME_NumberFilter() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_NumberFilter_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_NumberFilter",
- sizeof(SALOME_NumberFilter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_NumberFilter) Handle(SALOME_NumberFilter)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_NumberFilter) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_NumberFilter))) {
- _anOtherObject = Handle(SALOME_NumberFilter)((Handle(SALOME_NumberFilter)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_NumberFilter::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_NumberFilter) ;
-}
-Standard_Boolean SALOME_NumberFilter::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_NumberFilter) == AType || SALOME_Filter::IsKind(AType));
-}
-Handle_SALOME_NumberFilter::~Handle_SALOME_NumberFilter() {}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_NumberFilter.jxx
-// Module : SALOME
-
-#ifndef _SALOME_NumberFilter_HeaderFile
-#include "SALOME_NumberFilter.hxx"
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Selection.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-/*!
- \class SALOME_Selection SALOME_Selection.h
- \brief Selection Mechanism of Interactive Object.
-*/
-
-#include "SALOME_Selection.h"
-#include "SALOME_Filter.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_ListIteratorOfListOfFilter.hxx"
-
-#include "QAD_Desktop.h"
-#include "utilities.h"
-
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-using namespace std;
-
-static QList<SALOME_Selection>& SALOME_Sel_GetSelections()
-{
- static QList<SALOME_Selection> Selections;
- return Selections;
-}
-
-//=======================================================================
-// SELECTIONS MANAGEMENT
-//=======================================================================
-
-/*!
- Constructor
-*/
-SALOME_Selection::SALOME_Selection(const QString& aName) :
- myName(aName)
-{
- myFilters.Clear();
- myIObjects.Clear();
- mySelectionMode = ActorSelection; /*4*/
- mySelActiveCompOnly = false;
-
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- if (aDesktop) {
- QAD_Application *anActiveApplication = aDesktop->getActiveApp();
- if (anActiveApplication) QAD_ASSERT(connect(this, SIGNAL(currentSelectionChanged()),anActiveApplication, SLOT(updateActions())));
- }
-}
-
-/*!
- Destructor
-*/
-SALOME_Selection::~SALOME_Selection()
-{
-}
-
-/*!
- Create a Selection with name \a aName
- \return TRUE if the Selection is created. Returns FALSE otherwise.
-*/
-bool SALOME_Selection::CreateSelection(const QString& aName)
-{
- SALOME_Selection* S = NULL;
- if ( SALOME_Selection::FindSelection( aName ) )
- S = SALOME_Selection::Selection( aName );
- else {
- S = new SALOME_Selection(aName);
- SALOME_Sel_GetSelections().prepend(S);
- }
- return true;
-}
-
-
-/*!
- Sets the current Selection with \a aName
-*/
-SALOME_Selection* SALOME_Selection::Selection(const QString& aName)
-{
- SALOME_Selection* Sel = NULL;
- if(SALOME_Sel_GetSelections().isEmpty()) return Sel;
-
- for( Sel=SALOME_Sel_GetSelections().first(); Sel!=0; Sel=SALOME_Sel_GetSelections().next() ){
- if( Sel->myName.compare(aName) == 0 )
- return Sel;
- }
-
- return Sel;
-}
-
-/*!
- Finds Selection with \a aName
- \return TRUE if the Selection is found. Returns FALSE otherwise.
-*/
-bool SALOME_Selection::FindSelection(const QString& aName)
-{
- SALOME_Selection* Sel;
- for( Sel=SALOME_Sel_GetSelections().first(); Sel!=0; Sel=SALOME_Sel_GetSelections().next() ){
- if( Sel->myName.compare(aName) == 0 )
- return true;
- }
-
- return false;
-}
-
-/*!
- Removes Selection with \a aName
- \return TRUE if the Selection is removed. Returns FALSE otherwise.
-*/
-bool SALOME_Selection::RemoveSelection(const QString& aName)
-{
- SALOME_Selection* Sel;
- for( Sel=SALOME_Sel_GetSelections().first(); Sel!=0; Sel=SALOME_Sel_GetSelections().next() ){
- if( Sel->myName.compare(aName) == 0 )
- return SALOME_Sel_GetSelections().remove(Sel);
- }
- return false;
-}
-
-
-
-//=======================================================================
-// FILTERS MANAGEMENT
-//=======================================================================
-
-/*!
- Adds Filter
-*/
-void SALOME_Selection::AddFilter(const Handle(SALOME_Filter)& aFilter,
- bool updateSelection)
-{
- if ( !FindFilter(aFilter) ) {
- myFilters.Append( aFilter );
-
- SALOME_ListIO removedIObjects;
-
- if ( updateSelection ) {
- SALOME_ListIteratorOfListIO It(myIObjects);
- for(;It.More();It.Next()){
- Handle(SALOME_InteractiveObject) Object = It.Value();
- if( !IsOk(Object) ) {
- removedIObjects.Append( Object );
- // RemoveIObject( Object );
- }
- }
-
- SALOME_ListIteratorOfListIO It1(removedIObjects);
- for(;It1.More();It1.Next()){
- Handle(SALOME_InteractiveObject) Object = It1.Value();
- RemoveIObject( Object );
- }
- }
- }
-}
-
-/*!
- Removes Filter
-*/
-bool SALOME_Selection::RemoveFilter(const Handle(SALOME_Filter)& aFilter)
-{
- SALOME_ListIteratorOfListOfFilter It(myFilters);
- for(;It.More();It.Next()){
- if (aFilter==It.Value()){
- myFilters.Remove(It);
- return true;
- }
- }
- return false;
-}
-
-//! Clears All Filters
-void SALOME_Selection::ClearFilters()
-{
- myFilters.Clear();
-}
-
-//! Finds aFilter
-bool SALOME_Selection::FindFilter(const Handle(SALOME_Filter)& aFilter)
-{
- SALOME_ListIteratorOfListOfFilter It(myFilters);
- for(;It.More();It.Next())
- if (aFilter==It.Value())
- return true;
- return false;
-}
-
-//! Returns the list of stored Filters
-const SALOME_ListOfFilter& SALOME_Selection::StoredFilters()
-{
- return myFilters;
-}
-
-
-
-//=======================================================================
-// INTERACTIVE OBJECTS MANAGEMENT
-//=======================================================================
-
-void SALOME_Selection::Clear()
-{
- myIObjects.Clear();
-}
-
-//! Clears all Interactive Objects
-void SALOME_Selection::ClearIObjects()
-{
- myIObjects.Clear();
-
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
- myActiveStudy->unHighlightAll();
-
- myMapIOSubIndex.Clear();
-
- emit currentSelectionChanged();
-}
-
-//! Add an InteractiveObject
-int SALOME_Selection::AddIObject(const Handle(SALOME_InteractiveObject)& anObject, bool update)
-{
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
-
- if ( !IsOk(anObject) ) {
- if(MYDEBUG) INFOS ( "The Object not authorized by Filters" )
- myActiveStudy->highlight(anObject,false, update);
- return -1;
- }
-
- bool Found = false;
- SALOME_ListIteratorOfListIO It(myIObjects);
- for(;It.More();It.Next()) {
- if (anObject->isSame(It.Value())) {
- Found = true;
- break;
- }
- }
-
- // Il n'est pas dedans, on le rajoute....
- if(Found==false) {
- myIObjects.Append( anObject );
- myActiveStudy->highlight(anObject, true, update);
- emit currentSelectionChanged();
- return 1;
- }
- return 0;
-}
-
-//! Removes an InteractiveObject
-int SALOME_Selection::RemoveIObject(const Handle(SALOME_InteractiveObject)& anObject, bool update)
-{
- SALOME_ListIteratorOfListIO It(myIObjects);
- for(;It.More();It.Next()) {
- if (anObject->isSame(It.Value())) {
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
- myActiveStudy->highlight(anObject, false, update);
-
- if ( myMapIOSubIndex.IsBound( anObject ) ) {
- myMapIOSubIndex.UnBind( anObject );
- }
-
- myIObjects.Remove(It);
-
- emit currentSelectionChanged();
- return 1;
- }
- }
- return 0;
-}
-
-//! Returns the list of InteractiveObjects
-const SALOME_ListIO& SALOME_Selection::StoredIObjects()
-{
- return myIObjects;
-}
-
-//! Returns the number of InteractiveObjects in the selection.
-int SALOME_Selection::IObjectCount()
-{
- return myIObjects.Extent();
-}
-
-//! Returns the first InteractiveObject in the selection.
-Handle(SALOME_InteractiveObject) SALOME_Selection::firstIObject()
-{
- return myIObjects.Extent() > 0 ? myIObjects.First() : Handle(SALOME_InteractiveObject)();
-}
-
-//! Returns the last InteractiveObject in the selection.
-Handle(SALOME_InteractiveObject) SALOME_Selection::lastIObject()
-{
- return myIObjects.Extent() > 0 ? myIObjects.Last() : Handle(SALOME_InteractiveObject)();
-}
-
-/*!
- Returns TRUE if the InteractiveObject is authorized by Filters. Returns FALSE otherwise.
-*/
-bool SALOME_Selection::IsOk(const Handle(SALOME_InteractiveObject)& anObj)
-{
- SALOME_ListIteratorOfListOfFilter It(myFilters);
- for(;It.More();It.Next()){
- Handle(SALOME_Filter) theFilter = It.Value();
- if ( !theFilter->IsOk(anObj) )
- return false;
- }
- return true;
-}
-
-void SALOME_Selection::SetSelectionMode(Selection_Mode mode, bool activeCompOnly)
-{
- mySelectionMode = mode;
- mySelActiveCompOnly = activeCompOnly;
-}
-
-Selection_Mode SALOME_Selection::SelectionMode()
-{
- return mySelectionMode;
-}
-
-bool SALOME_Selection::IsSelectActiveCompOnly() const
-{
- return mySelActiveCompOnly;
-}
-
-bool SALOME_Selection::HasIndex( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return myMapIOSubIndex.IsBound(IObject);
-}
-
-void SALOME_Selection::GetIndex( const Handle(SALOME_InteractiveObject)& IObject, TColStd_IndexedMapOfInteger& theIndex )
-{
- if ( myMapIOSubIndex.IsBound(IObject) ) {
- theIndex = myMapIOSubIndex.Find(IObject);
- }
- else {
- theIndex.Clear();
- }
-}
-
-
-
-bool SALOME_Selection::IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index)
-{
- if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- return false;
- }
- TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- return MapIndex.Contains( index );
-}
-
-static bool removeIndex( TColStd_IndexedMapOfInteger& MapIndex,
- const int Index)
-{
- int i = MapIndex.FindIndex( Index ); // i==0 if Index is not in the MapIndex
- if ( i ) {
- // only the last key can be removed
- int indexLast = MapIndex.FindKey( MapIndex.Extent() );
- if ( indexLast == Index )
- MapIndex.RemoveLast();
- else {
- TColStd_IndexedMapOfInteger aNewMap;
- aNewMap.ReSize( MapIndex.Extent() - 1 );
- for ( int j = 1; j <= MapIndex.Extent(); j++ ) {
- int ind = MapIndex( j );
- if ( ind != Index )
- aNewMap.Add( ind );
- }
- MapIndex = aNewMap;
- }
- }
- return i;
-}
-
-
-bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
- int index,
- bool modeShift,
- bool update)
-{
- if(MYDEBUG) INFOS( " SALOME_Selection::AddOrRemoveIndex " << index << " - " << modeShift );
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
-
- if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_IndexedMapOfInteger Empty;
- myMapIOSubIndex.Bind( IObject, Empty );
- }
- TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
-
- bool anIsConatains = MapIndex.Contains( index );
-
- if (anIsConatains)
- removeIndex( MapIndex, index );
-
- if (!modeShift)
- MapIndex.Clear();
-
- if(!anIsConatains)
- MapIndex.Add( index );
-
- if ( MapIndex.IsEmpty() ) {
- myMapIOSubIndex.UnBind( IObject );
- RemoveIObject( IObject, update );
- }
-
- myActiveStudy->highlight( IObject, true, update );
-
- emit currentSelectionChanged();
- return false;
-}
-
-bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& theIndices,
- bool modeShift,
- bool update)
-{
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
-
- if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_IndexedMapOfInteger Empty;
- myMapIOSubIndex.Bind( IObject, Empty );
- }
- TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- TColStd_MapIteratorOfMapOfInteger It;
- It.Initialize(theIndices);
-
- if (!modeShift)
- MapIndex.Clear();
-
- for(;It.More();It.Next())
- MapIndex.Add(It.Key());
-
- if ( MapIndex.IsEmpty() ) {
- myMapIOSubIndex.UnBind( IObject );
- RemoveIObject( IObject, update );
- }
-
- myActiveStudy->highlight( IObject, true, update );
-
- emit currentSelectionChanged();
-
- return !MapIndex.IsEmpty();
-}
-
-bool SALOME_Selection::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
- const TContainerOfId& theIndices,
- bool modeShift,
- bool update)
-{
- QAD_Desktop* myDesktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = myDesktop->getActiveStudy();
-
- if ( !myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_IndexedMapOfInteger Empty;
- myMapIOSubIndex.Bind( IObject, Empty );
- }
- TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
-
- if (!modeShift)
- MapIndex.Clear();
-
- TContainerOfId::const_iterator anIter = theIndices.begin();
- TContainerOfId::const_iterator anIterEnd = theIndices.end();
- for(; anIter != anIterEnd; anIter++)
- MapIndex.Add(*anIter);
-
- if ( MapIndex.IsEmpty() ) {
- myMapIOSubIndex.UnBind( IObject );
- RemoveIObject( IObject, update );
- }
-
- myActiveStudy->highlight( IObject, true, update );
-
- emit currentSelectionChanged();
-
- return !MapIndex.IsEmpty();
-}
-
-void SALOME_Selection::RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index )
-{
- if ( myMapIOSubIndex.IsBound( IObject ) ) {
- TColStd_IndexedMapOfInteger& MapIndex = myMapIOSubIndex.ChangeFind( IObject );
- removeIndex( MapIndex, index );
- }
-}
-
-void SALOME_Selection::ClearIndex()
-{
- myMapIOSubIndex.Clear();
-}
-
-
-//================================================================
-// Function : GEOMBase_Helper
-// Purpose : Block signal currentSelectionChanged. Use this method to
-// deactivate signal before big modification of selection.
-// After this modification this signal must be activated and
-// method SelectionChanged must be called to notify other oblects
-// ( dialogs for example )
-//================================================================
-void SALOME_Selection::BlockSignals( const bool theState )
-{
- blockSignals( theState );
-}
-
-//================================================================
-// Function : SelectionChanged
-// Purpose : Enit signal currentSelectionChanged()
-//================================================================
-void SALOME_Selection::SelectionChanged()
-{
- emit currentSelectionChanged();
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_Selection.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SALOME_SELECTION_H
-#define SALOME_SELECTION_H
-
-#include "SALOME_Filter.hxx"
-#include "SALOME_ListIO.hxx"
-#include "SALOME_ListOfFilter.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_DataMapOfIOMapOfInteger.hxx"
-
-// Qt Includes
-#include <qlist.h>
-#include <qstring.h>
-#include <qobject.h>
-
-// Open CASCADE Include
-#include <TColStd_MapOfInteger.hxx>
-
-#include <set>
-
-enum Selection_Mode {
- NodeSelection,
- CellSelection,
- EdgeOfCellSelection,
- EdgeSelection,
- FaceSelection,
- VolumeSelection,
- ActorSelection };
-
-class SALOME_Selection : public QObject
-{
- Q_OBJECT
-
-public:
-
- SALOME_Selection(const QString& aName);
- ~SALOME_Selection();
-
- static bool CreateSelection(const QString& aName) ;
- static SALOME_Selection* Selection (const QString& aName) ;
- static bool RemoveSelection(const QString& aName) ;
- static bool FindSelection (const QString& aName) ;
-
- void Clear () ;
-
- void ClearIObjects () ;
- int AddIObject ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
- int RemoveIObject ( const Handle(SALOME_InteractiveObject)& anObject, bool update = true) ;
-
- const SALOME_ListIO& StoredIObjects() ;
- int IObjectCount() ;
-
- Handle(SALOME_InteractiveObject) firstIObject() ;
- Handle(SALOME_InteractiveObject) lastIObject() ;
-
- void AddFilter(const Handle(SALOME_Filter)& aFilter,
- bool updateSelection = true ) ;
- bool RemoveFilter(const Handle(SALOME_Filter)& aFilter) ;
- void ClearFilters();
- const SALOME_ListOfFilter& StoredFilters();
- bool FindFilter(const Handle(SALOME_Filter)& aFilter);
-
- bool IsOk( const Handle(SALOME_InteractiveObject)& IObject ) ;
-
-
- void SetSelectionMode(Selection_Mode mode, bool activeCompOnly = false);
- Selection_Mode SelectionMode();
- bool IsSelectActiveCompOnly() const;
-
- bool HasIndex( const Handle(SALOME_InteractiveObject)& IObject );
- void GetIndex( const Handle(SALOME_InteractiveObject)& IObject,
- TColStd_IndexedMapOfInteger& theIndex );
-
- typedef std::set<int> TContainerOfId;
-
- bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index, bool modeShift, bool update=true );
- bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TColStd_MapOfInteger& theIndices, bool modeShift, bool update=true );
- bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, const TContainerOfId& theIndices, bool modeShift, bool update=true );
- void RemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, int index );
- bool IsIndexSelected(const Handle(SALOME_InteractiveObject)& IObject, int index);
- void ClearIndex();
-
- void BlockSignals( const bool );
- void SelectionChanged();
-
-signals:
- void currentSelectionChanged();
-
-private:
- QString myName;
- SALOME_ListOfFilter myFilters;
- SALOME_ListIO myIObjects;
-
- SALOME_DataMapOfIOMapOfInteger myMapIOSubIndex;
-
- Selection_Mode mySelectionMode;
- bool mySelActiveCompOnly;
-};
-
-#endif
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_TypeFilter.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SALOME_TypeFilter.ixx"
-#include "SALOME_InteractiveObject.hxx"
-using namespace std;
-
-SALOME_TypeFilter::SALOME_TypeFilter(const Standard_CString TheKind):
-myKind(TheKind){}
-
-Standard_Boolean SALOME_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
-{
- return anObj->isComponentType( myKind );
-}
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_TypeFilter.hxx
-// Module : SALOME
-
-#ifndef _SALOME_TypeFilter_HeaderFile
-#define _SALOME_TypeFilter_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOME_TypeFilter_HeaderFile
-#include <Handle_SALOME_TypeFilter.hxx>
-#endif
-
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _SALOME_Filter_HeaderFile
-#include "SALOME_Filter.hxx"
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
-#include <Handle_SALOME_InteractiveObject.hxx>
-#endif
-
-class SALOME_TypeFilter : public SALOME_Filter {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOME_TypeFilter(const Standard_CString aGivenKind);
-Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const;
-Standard_EXPORT ~SALOME_TypeFilter();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOME_TypeFilter_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-Standard_CString myKind;
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_TypeFilter.ixx
-// Module : SALOME
-
-#include "SALOME_TypeFilter.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOME_TypeFilter::~SALOME_TypeFilter() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOME_TypeFilter_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOME_TypeFilter",
- sizeof(SALOME_TypeFilter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOME_TypeFilter) Handle(SALOME_TypeFilter)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOME_TypeFilter) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOME_TypeFilter))) {
- _anOtherObject = Handle(SALOME_TypeFilter)((Handle(SALOME_TypeFilter)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOME_TypeFilter::DynamicType() const
-{
- return STANDARD_TYPE(SALOME_TypeFilter) ;
-}
-Standard_Boolean SALOME_TypeFilter::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOME_TypeFilter) == AType || SALOME_Filter::IsKind(AType));
-}
-Handle_SALOME_TypeFilter::~Handle_SALOME_TypeFilter() {}
-
+++ /dev/null
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
-//
-// 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 : SALOME_TypeFilter.jxx
-// Module : SALOME
-
-#ifndef _SALOME_TypeFilter_HeaderFile
-#include "SALOME_TypeFilter.hxx"
-#endif
+++ /dev/null
-# 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 : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Libraries targets
-
-LIB = libSalomePy.la
-LIB_SRC = SalomePy.cxx
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOMEDS_Attributes.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) -DHAVE_CONFIG_H
-LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeGUI -lvtkCommonPython -lvtkGraphicsPython -lvtkImagingPython -lVTKViewer
-
-
-@CONCLUDE@
+++ /dev/null
-// 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 <Python.h>
-#include <vtkPythonUtil.h>
-
-#include <vtkVersion.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_RightFrame.h"
-
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_RenderWindowInteractor.h"
-
-#include "utilities.h"
-
-using namespace std;
-
-
-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<char*>(theClassName);
- PyObject* aPyClass = PyDict_GetItemString(aVTKDict,aClassName);
- //Py_DECREF(aVTKModule);
- return aPyClass;
-}
-
-
-VTKViewer_ViewFrame* GetVTKViewFrame(){
- QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
- QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame();
- QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame();
- return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
-}
-
-
-extern "C" PyObject *libSalomePy_getRenderer(PyObject *self, PyObject *args)
-{
- if(VTKViewer_ViewFrame* aVTKViewFrame = GetVTKViewFrame()){
- PyObject* aPyClass = GetPyClass("vtkRenderer");
- vtkRenderer* aVTKObject = aVTKViewFrame->getRenderer();
- return PyVTKObject_New(aPyClass,aVTKObject);
- }
- return NULL;
-}
-
-
-extern "C" PyObject *libSalomePy_getRenderWindow(PyObject *self, PyObject *args)
-{
- if(VTKViewer_ViewFrame* aVTKViewFrame = GetVTKViewFrame()){
- PyObject* aPyClass = GetPyClass("vtkRenderWindow");
- vtkRenderWindow* aVTKObject = aVTKViewFrame->getRW()->getRenderWindow();
- return PyVTKObject_New(aPyClass,aVTKObject);
- }
- return NULL;
-}
-
-
-extern "C" PyObject *libSalomePy_getRenderWindowInteractor(PyObject *self, PyObject *args)
-{
- if(VTKViewer_ViewFrame* aVTKViewFrame = GetVTKViewFrame()){
- PyObject* aPyClass = GetPyClass("vtkRenderWindowInteractor");
- vtkRenderWindowInteractor* aVTKObject = aVTKViewFrame->getRWInteractor();
- return PyVTKObject_New(aPyClass,aVTKObject);
- }
- return NULL;
-}
-
-
-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);
- PyObject* aDict = PyModule_GetDict(aModule);
- if(PyErr_Occurred()){
- PyErr_Print();
- return;
- }
- PyObject* anObj = libSalomePy_getRenderer(NULL,NULL);
- PyDict_SetItemString(aDict,"renderer",anObj);
- Py_DECREF(anObj);
-}
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : Makefile.in
-# Author : Nicolas REJNERI
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# PyQt
-# PYQT_SIPS defined in make_commence.in
-
-# SIP C++ Python
-# SIP defined in make_commence.in
-SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
-
-
-# SIP input file(s)
-
-SIP_FILES = SalomePyQt.sip
-
-# SIP-generated C++ source files (corresponding line should be added for each wrapped class
-# contained by SalomePyQt module)
-
-SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \
- $(CURDIR)/sipSalomePyQtSalomePyQt.cc \
- $(CURDIR)/sipSalomePyQtSALOME_Selection.cc
-
-ifeq ($(SIP_VERS),new2)
-MOC_SRC = SalomePyQtcmodule_moc.cxx
-MOC_H = SalomePyQtcmodule.h
-else
-MOC_SRC = sipSalomePyQtProxySalomePyQt_moc.cxx
-MOC_H = sipSalomePyQtProxySalomePyQt.h
-endif
-
-# Libraries targets
-
-LIB = libSalomePyQtcmodule.la
-
-LIB_SRC += SalomePyQt.cxx SALOME_PYQT_GUI.cxx $(SIP_SRC) $(MOC_SRC)
-LIB_MOC = SALOME_PYQT_GUI.h
-
-#LIB_MOC += sipSalomePyQtProxySalomePyQt.h
-
-EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py
-
-LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_ContainerManager.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
-LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
-LDFLAGS+= -lSalomeGUI -lqtcmodule
-
-
-# Custom build step: generate C++ wrapping according to $(SIP_FILES)
-
-$(SIP_SRC): $(SIP_FILES)
- $(SIP) $(SIP_FLAGS) $<
-
-$(MOC_SRC): $(MOC_H)
- $(MOC) $< -o $@
-
-@CONCLUDE@
+++ /dev/null
-//=============================================================================
-// File : SALOME_PYQT_GUI.cxx
-// Created : mer jun 4 17:17:20 UTC 2003
-// Author : Paul RASCLE, EDF
-// Project : SALOME
-// Copyright : EDF 2003
-// $Header$
-//=============================================================================
-
-#include "SALOME_PYQT_GUI.h"
-
-#include "QAD_Desktop.h"
-
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
-
-#include <sipSalomePyQtDeclSalomePyQt.h>
-#include <sipqtQWorkspace.h>
-#include <sipqtQPopupMenu.h>
-
-#include <map>
-#include <string>
-
-using namespace std;
-
-static PyInterp_PyQt *interp = NULL;
-static map<int,PyInterp_PyQt*> mapInterp;
-
-//=============================================================================
-/*!
- * Calls module.setWorkSpace with PyQt QWorkspace object to use with
- * interpreter.
- */
-//=============================================================================
-
-void SALOME_PYQT_GUI::setWorkSpace()
-{
- MESSAGE("setWorkSpace");
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- // Try to import qt module. If it's not possible don't go on
- PyObjWrapper qtmodule(PyImport_ImportModule("qt"));
- if(!qtmodule){
- PyErr_Print();
- return ;
- }
-
- PyObjWrapper pyws(sipMapCppToSelf( QAD_Application::getDesktop()->getMainFrame(),
- sipClass_QWorkspace));
- PyObjWrapper res(PyObject_CallMethod(_module,"setWorkSpace","O",pyws.get()));
- SCRUTE(pyws->ob_refcnt);
- if(!res){
- PyErr_Print();
- return ;
- }
-}
-
-//=============================================================================
-/*!
- * Import Python module (from _moduleName)
- */
-//=============================================================================
-void SALOME_PYQT_GUI::importModule()
-{
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- PyObjWrapper amod = PyImport_ImportModule("salome");
- if(!amod){
- MESSAGE ( " Problem import salome... " );
- PyErr_Print();
- return;
- }
-
- PyObjWrapper res(PyObject_CallMethod(amod,"salome_init",""));
- if(!res){
- MESSAGE ( " Problem... " );
- PyErr_Print();
- return;
- }
-
- _module=PyImport_ImportModule((char*)_moduleName.c_str());
- if(!_module){
- MESSAGE ( " Problem... " );
- PyErr_Print();
- return;
- }
-}
-
-//=============================================================================
-/*!
- * Initialises python interpreter (only one per study), imports python module
- * from given module name, sets static reference to module,
- * sets module workspace.
- */
-//=============================================================================
-
-void SALOME_PYQT_GUI::initInterp(int StudyID)
-{
- MESSAGE("SALOME_PYQT_GUI::initInterp");
- if(mapInterp.find(StudyID) != mapInterp.end()){
- MESSAGE ( "SALOME_PYQT_GUI::initInterp StudyID is found " << StudyID );
- interp = mapInterp[StudyID];
- return;
- }else{
- MESSAGE ( "SALOME_PYQT_GUI::initInterp StudyID is not found " << StudyID );
- /*
- * The creation of Python interpretor must be protected par a C++ Lock because of C threads
- */
- ThreadLock aPyLock = GetPyThreadLock("SALOME_PYQT_GUI::initInterp");
- interp = new PyInterp_PyQt();
- interp->initialize();
- mapInterp[StudyID] = interp;
- }
- // imports Python GUI module and puts it in _module attribute
- importModule();
- // calls _module.setWorkspace and passes the SIP object main workspace
- setWorkSpace();
-
-}
-
-//=============================================================================
-/*!
- * constructor : only calls SALOMEGUI constructor
- */
-//=============================================================================
-SALOME_PYQT_GUI::SALOME_PYQT_GUI( const QString& theName, QObject* theParent ) :
- SALOMEGUI( theName, theParent ),_module(0)
-{
- MESSAGE("SALOME_PYQT_GUI::SALOME_PYQT_GUI");
-}
-
-//=============================================================================
-/*!
- * destructor : do nothing
- */
-//=============================================================================
-SALOME_PYQT_GUI::~SALOME_PYQT_GUI()
-{
-}
-
-//=============================================================================
-/*!
- * Calls python module.OnGUIEvent(theCommandID)
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::OnGUIEvent (int theCommandID,
- QAD_Desktop* parent)
-{
- MESSAGE("SALOME_PYQT_GUI::OnGUIEvent");
- ThreadLock aPyLock = GetPyThreadLock("SALOME_PYQT_GUI::OnGUIEvent");
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- PyObjWrapper res(PyObject_CallMethod(_module,"OnGUIEvent","i",theCommandID));
- if(!res){
- PyErr_Print();
- return false;
- }
- return true;
-}
-
-//=============================================================================
-/*!
- * no call to python module.OnKeyPress()
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::OnKeyPress (QKeyEvent* pe,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame)
-{
- MESSAGE("SALOME_PYQT_GUI::OnKeyPress");
- return true;
-}
-
-//=============================================================================
-/*!
- * no call to python module.OnMousePress()
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::OnMousePress (QMouseEvent* pe ,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame)
-{
- MESSAGE("SALOME_PYQT_GUI::OnMousePress");
- return false;
-}
-
-//=============================================================================
-/*!
- * no call to python module.OnMouseMove()
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::OnMouseMove (QMouseEvent* pe ,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame)
-{
- // Commented out to avoid multiple traces ...
- // MESSAGE("SALOME_PYQT_GUI::OnMouseMove");
- return true;
-}
-
-//=============================================================================
-/*!
- * Calls initInterp to initialise python interpreter (only one per study) and
- * to import python module. Calls module.setSettings()
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::SetSettings (QAD_Desktop* parent, char* moduleName)
-{
- MESSAGE("SALOME_PYQT_GUI::SetSettings");
- int StudyID = QAD_Application::getDesktop()->getActiveStudy()->getStudyId();
- SCRUTE ( StudyID );
- _moduleName = moduleName + string("GUI");
- SCRUTE(_moduleName);
-
- // initializes one Python interpreter by study and puts it in interp global variable
- // imports Python GUI module and puts it in _module attribute
- // calls _module.setWorkspace and passes the SIP object main workspace
- initInterp(StudyID);
-
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- _module = PyImport_ImportModule((char*)_moduleName.c_str());
- if(!_module){
- PyErr_Print();
- return false;
- }
-
- PyObjWrapper res(PyObject_CallMethod(_module,"setSettings",""));
- if(!res){
- PyErr_Print();
- return false;
- }
- return true;
-}
-
-//=============================================================================
-/*!
- * Calls module.customPopup with popup menu to custom, and string values of
- * context, parent and selected object (strings defined by DefinePopup, which
- * is called before).
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::CustomPopup ( QAD_Desktop* parent,
- QPopupMenu* popup,
- const QString & theContext,
- const QString & theParent,
- const QString & theObject )
-{
- MESSAGE("SALOME_PYQT_GUI::CustomPopup");
-
- MESSAGE ( " theContext : " << theContext.latin1() );
- MESSAGE ( " theParent : " << theParent.latin1() );
- MESSAGE ( " theObject : " << theObject.latin1() );
-
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- PyObjWrapper pypop(sipMapCppToSelf( popup, sipClass_QPopupMenu));
-
- PyObjWrapper res(PyObject_CallMethod(_module,"customPopup",
- "Osss",pypop.get(),
- theContext.latin1(),
- theObject.latin1(),
- theParent.latin1()));
- if(!res){
- PyErr_Print();
- return false;
- }
- return true;
-}
-
-
-//=============================================================================
-/*!
- * Calls module.definePopup to modify the strings that define context parent
- * and selected object. Called before CustomPopup.
- */
-//=============================================================================
-
-void SALOME_PYQT_GUI::DefinePopup( QString & theContext,
- QString & theParent,
- QString & theObject )
-{
- MESSAGE("SALOME_PYQT_GUI::DefinePopup");
- theContext = "";
- theObject = "";
- theParent = "";
-
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- PyObjWrapper res(PyObject_CallMethod(_module,"definePopup","sss",
- theContext.latin1(),
- theObject.latin1(),
- theParent.latin1()));
- if(!res){
- PyErr_Print();
- return;
- }
- char *co, *ob, *pa;
- if(!PyArg_ParseTuple(res, "sss", &co, &ob, &pa))
- {
- // It's not a valid tuple. Do nothing.
- return;
- }
-
- MESSAGE ("parseOk ");
- MESSAGE (" --- " << co << " " << ob << " " << pa);
-
- theContext = co;
- theObject = ob;
- theParent = pa;
-
- MESSAGE ( " theContext : " << theContext.latin1() );
- MESSAGE ( " theParent : " << theParent.latin1() );
- MESSAGE ( " theObject : " << theObject.latin1() );
-}
-
-//=============================================================================
-/*!
- * Initialize new interpreter (if not exists) with new study ID.
- * Calls module.activeStudyChanged with new study ID. Called twice.
- */
-//=============================================================================
-
-bool SALOME_PYQT_GUI::ActiveStudyChanged( QAD_Desktop* parent )
-{
-
- int StudyID = parent->getActiveApp()->getActiveStudy()->getStudyId();
- MESSAGE("SALOME_PYQT_GUI::ActiveStudyChanged"<<StudyID<<" - " <<this);
- initInterp(StudyID);
-
- PyLockWrapper aLock = interp->GetLockWrapper();
-
- PyObjWrapper res(PyObject_CallMethod(_module,"activeStudyChanged","i", StudyID ));
- if(!res){
- PyErr_Print();
- return false;
- }
- return true;
-}
-
-//=============================================================================
-/*!
- * no call to python module.BuildPresentation() (not yet ???)
- */
-//=============================================================================
-void SALOME_PYQT_GUI::BuildPresentation( const Handle(SALOME_InteractiveObject)&,
- QAD_ViewFrame* )
-{
-}
-
-//=============================================================================
-/*!
- * no call to python module.SupportedViewType() (not yet ???)
- */
-//=============================================================================
-void SALOME_PYQT_GUI::SupportedViewType(int* /*buffer*/, int /*bufferSize*/ )
-{
-}
-
-//=============================================================================
-/*!
- * no call to python module.Deactivate() (not yet ???)
- */
-//=============================================================================
-void SALOME_PYQT_GUI::Deactivate()
-{
-}
-
-
-
-
-//=============================================================================
-/*!
- * Component GUI Factory : returns a new GUI obj at each call
- */
-//=============================================================================
-
-extern "C"
-{
- Standard_EXPORT SALOMEGUI* GetComponentGUI() {
- MESSAGE("SALOME_PYQT_GUI::GetComponentGUI");
- SALOMEGUI* aGUI = new SALOME_PYQT_GUI("");
- return aGUI;
- }
-}
+++ /dev/null
-//=============================================================================
-// File : SALOME_PYQT_GUI.hxx
-// Created : mer jun 4 17:17:20 UTC 2003
-// Author : Paul RASCLE, EDF
-// Project : SALOME
-// Copyright : EDF 2003
-// $Header$
-//=============================================================================
-
-#ifndef _SALOME_PYQT_GUI_HXX_
-#define _SALOME_PYQT_GUI_HXX_
-
-#include "QAD_Desktop.h"
-#include "PyInterp_PyQt.h"
-#include "SALOMEGUI.h"
-
-class SALOME_PYQT_GUI: public SALOMEGUI
-{
- Q_OBJECT;
-
-private:
- // save the current Python module in the attribute _module
- PyObjWrapper _module;
- // save the current Python module name in the attribute _moduleName
- string _moduleName;
-
-public:
-
- SALOME_PYQT_GUI( const QString& name = "", QObject* parent = 0 );
- virtual ~SALOME_PYQT_GUI();
-
- virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent);
- virtual bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
- virtual bool SetSettings ( QAD_Desktop* parent, char* moduleName );
- virtual bool CustomPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject );
- virtual void DefinePopup ( QString & theContext, QString & theParent, QString & theObject );
- virtual bool ActiveStudyChanged( QAD_Desktop* parent);
- virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO,
- QAD_ViewFrame* = 0 );
- virtual void SupportedViewType (int* buffer, int bufferSize);
- virtual void Deactivate ();
- void initInterp(int studyId);
- void importModule();
- void setWorkSpace();
-
-protected:
-
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SalomePyQt.cxx
-// Module : SALOME
-
-#include "SalomePyQt.hxx"
-
-#include <qapplication.h>
-#include <qmenubar.h>
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_FileDlg.h"
-#include "QAD_ViewFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_Tools.h"
-
-#include "QAD_Config.h"
-#include "QAD_Settings.h"
-
-using namespace std;
-
-QWidget* SalomePyQt::getDesktop()
-{
- return (QWidget*)(QAD_Application::getDesktop());
-}
-
-QWorkspace* SalomePyQt::getMainFrame()
-{
- return (QWorkspace*)(QAD_Application::getDesktop()->getMainFrame());
-}
-
-QMenuBar* SalomePyQt::getMainMenuBar()
-{
- return (QMenuBar*)(QAD_Application::getDesktop()->getMainMenuBar());
-}
-
-int SalomePyQt::getStudyId()
-{
- return QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getStudyId();
-}
-
-SALOME_Selection* SalomePyQt::getSelection()
-{
- return SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getSelection());
-}
-
-void SalomePyQt::putInfo( const QString& msg )
-{
- QAD_Application::getDesktop()->putInfo(msg);
-}
-
-void SalomePyQt::putInfo( const QString& msg, int ms )
-{
- QAD_Application::getDesktop()->putInfo(msg, ms);
-}
-
-void SalomePyQt::updateObjBrowser( int studyId, bool updateSelection)
-{
- QList<QAD_Study>& studies = QAD_Application::getDesktop()->getActiveApp()->getStudies();
- for ( QAD_Study* study = studies.first(); study; study = studies.next() ) {
- if ( study->getStudyId() == studyId ) {
- study->updateObjBrowser( updateSelection );
- break;
- }
- }
-}
-
-const QString& SalomePyQt::getActiveComponent()
-{
- return QAD_Application::getDesktop()->getActiveComponent();
-}
-
-void SalomePyQt::addStringSetting(QString _name, QString _value, bool _autoValue)
-{
- QAD_CONFIG->addSetting(_name, _value, _autoValue);
-}
-
-void SalomePyQt::addIntSetting(QString _name, int _value, bool _autoValue)
-{
- QAD_CONFIG->addSetting(_name, _value, _autoValue);
-}
-
-void SalomePyQt::addDoubleSetting(QString _name, double _value, bool _autoValue)
-{
- QAD_CONFIG->addSetting(_name, _value, _autoValue);
-}
-
-bool SalomePyQt::removeSettings(QString name)
-{
- return QAD_CONFIG->removeSettings( name );
-}
-
-QString SalomePyQt::getSetting(QString name)
-{
- return QAD_CONFIG->getSetting(name);
-}
-
-QString SalomePyQt::getFileName(QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open)
-{
- return QAD_FileDlg::getFileName(parent, initial, filters, caption, open);
-}
-
-QStringList SalomePyQt::getOpenFileNames(QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption)
-{
- return QAD_FileDlg::getOpenFileNames(parent, initial, filters, caption);
-}
-
-QString SalomePyQt::getExistingDirectory(QWidget* parent,
- const QString& initial,
- const QString& caption)
-{
- return QAD_FileDlg::getExistingDirectory(parent, initial, caption);
-}
-
-void SalomePyQt::helpContext(const QString& source, const QString& context) {
- //QAD_Application::getDesktop()->helpContext(source, context);
-}
-
-bool SalomePyQt::dumpView(const QString& filename)
-{
- QAD_Study* activeStudy = QAD_Application::getDesktop()->getActiveApp()->getActiveStudy();
- if ( !activeStudy )
- return false;
- QAD_ViewFrame* activeViewFrame = activeStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( !activeViewFrame )
- return false;
- if ( !activeViewFrame->getViewWidget() )
- return false;
-
- qApp->processEvents();
- QPixmap px = QPixmap::grabWindow( activeViewFrame->getViewWidget()->winId() );
- if ( !filename.isNull() ) {
- QString fmt = QAD_Tools::getFileExtensionFromPath( filename ).upper();
- if ( fmt.isEmpty() )
- fmt = QString( "PNG" ); // default format
- if ( fmt == "JPG" )
- fmt = "JPEG";
- bool bOk = px.save( filename, fmt.latin1() );
- return bOk;
- }
- return false;
-}
-
-QPopupMenu* SalomePyQt::getPopupMenu( const MenuName menu )
-{
- QMenuBar* mainMenu = QAD_Application::getDesktop()->getMainMenuBar();
- if ( mainMenu->findItem( menu ) ) {
- return mainMenu->findItem( menu )->popup();
- }
- return 0;
-}
+++ /dev/null
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : SalomePyQt.hxx
-// Module : SALOME
-
-#ifndef _SALOME_PYQT_H
-#define _SALOME_PYQT_H
-
-#include <SALOME_Selection.h>
-
-#include <qwidget.h>
-#include <qworkspace.h>
-#include <qstring.h>
-#include <qmenubar.h>
-
-enum MenuName {
- File = 1,
- View = 2,
- Edit = 3,
- Preferences = 4,
- Tools = 5,
- Window = 6,
- Help = 7
-};
-
-class SalomePyQt
-{
-public:
- static QWidget* getDesktop();
- static QWorkspace* getMainFrame();
- static QMenuBar* getMainMenuBar();
- static QPopupMenu* getPopupMenu( const MenuName menu );
- static SALOME_Selection* getSelection();
- static int getStudyId();
- static void putInfo( const QString& );
- static void putInfo( const QString&, int );
-
- static const QString& getActiveComponent();
-
- static void updateObjBrowser( int studyId, bool updateSelection);
-
- static void addStringSetting(QString _name, QString _value, bool _autoValue);
- static void addIntSetting(QString _name, int _value, bool _autoValue);
- static void addDoubleSetting(QString _name, double _value, bool _autoValue);
- static bool removeSettings(QString name);
- static QString getSetting(QString name);
-
- static QString getFileName(QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open);
- static QStringList getOpenFileNames(QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption);
- static QString getExistingDirectory(QWidget* parent,
- const QString& initial,
- const QString& caption);
- static void helpContext(const QString& source, const QString& context);
- static bool dumpView(const QString& filename);
-};
-
-#endif
+++ /dev/null
-%Module SalomePyQt
-
-%Import qtmod.sip
-
-class SALOME_Selection : QObject
-{
-%HeaderCode
-#include <SALOME_Selection.h>
-%End
-
-public:
- SALOME_Selection(const QString &);
- void Clear();
- void ClearIObjects();
-
-signals:
- void currentSelectionChanged();
-};
-
-enum MenuName {
- File = 1,
- View = 2,
- Edit = 3,
- Preferences = 4,
- Tools = 5,
- Window = 6,
- Help = 7
-};
-
-class SalomePyQt
-{
-%HeaderCode
-#include <SalomePyQt.hxx>
-%End
-
-public:
- static QWidget* getDesktop();
- static QWorkspace* getMainFrame();
- static QMenuBar* getMainMenuBar();
- static QPopupMenu* getPopupMenu( const MenuName );
- static SALOME_Selection* getSelection();
- static int getStudyId();
- static void putInfo( const QString& );
- static void putInfo( const QString&, int );
-
- static const QString& getActiveComponent();
-
- static void updateObjBrowser( int, bool );
-
-
- static bool removeSettings(QString);
- static QString getSetting(QString);
- static void addStringSetting(QString, QString, bool);
- static void addIntSetting(QString, int, bool);
- static void addDoubleSetting(QString, double, bool);
-
- static QString getFileName(QWidget*, const QString&, const QStringList&, const QString&, bool);
- static QStringList getOpenFileNames(QWidget*, const QString&, const QStringList&, const QString&);
- static QString getExistingDirectory(QWidget*, const QString&, const QString&);
- static void helpContext(const QString&, const QString&);
- static bool dumpView(const QString&);
-};
+++ /dev/null
-# 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 : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Libraries targets
-
-LIB = libSALOME_Swigcmodule.la
-LIB_SRC =
-
-SWIG_DEF = libSALOME_Swig.i
-#EXPORT_PYSCRIPTS = libSALOME_Swig.py Help.py PyInterp.py salome.py examplevtk1.py supervisionexample.py supervisiongeomexample.py salome_shared_modules.py batchmode_salome.py test_table.py test_big_table.py test_many_objects.py import_hook.py salome_test.py test_remove_ref.py
-
-EXPORT_PYSCRIPTS = libSALOME_Swig.py batchmode_salome.py
-
-#EXPORT_SHAREDPYSCRIPTS=kernel_shared_modules.py
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H
-LIBS+= $(PYTHON_LIBS)
-LDFLAGS+= -lSalomeGUI
-
-@CONCLUDE@
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : batchmode_salome.py
-# Module : SALOME
-
-import salome_shared_modules
-
-from omniORB import CORBA
-from LifeCycleCORBA import *
-import SALOMEDS
-from SALOME_NamingServicePy import *
-
-#--------------------------------------------------------------------------
-
-def ImportComponentGUI(ComponentName):
- libName = "lib" + ComponentName + "_Swig"
- command = "from " + libName + " import *"
- exec ( command )
- constructor = ComponentName + "GUI_Swig()"
- command = "gui = " + constructor
- exec ( command )
- return gui
-
- #--------------------------------------------------------------------------
-
-def SalomeGUIgetAllSelected(self):
- selNumber = self.SelectedCount()
- listSelected = []
- for i in range(selNumber):
- listSelected.append(self.getSelected(i))
- return listSelected
- #--------------------------------------------------------------------------
-
-def generateName(prefix = None):
- import whrandom;
- int = whrandom.randint(1,1000);
- if prefix is None:
- return "Study" + str(int)
- else :
- return prefix + str(int)
-
-from libSALOME_Swig import *
-###from SalomePyQt import *
-class SalomeGUI(SALOMEGUI_Swig):
- getAllSelected = SalomeGUIgetAllSelected
-
- def getDesktop(self) :
-# return SalomePyQt.getDesktop()
- return None
-
- def getSelection(self) :
-# return SalomePyQt.getSelection()
- return None
-
- #--------------------------------------------------------------------------
-
-def IDToObject(id):
- myObj = None
- mySO = myStudy.FindObjectID(id);
- if mySO is not None:
- ok, anAttr = mySO.FindAttribute("AttributeIOR")
- if ok:
- AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
- if AtIOR.Value() != "":
- myObj = orb.string_to_object(AtIOR.Value())
- return myObj
-
-def ObjectToSObject(obj):
- mySO = None
- if obj is not None:
- ior = orb.object_to_string(obj)
- if ior != "":
- mySO = myStudy.FindObjectIOR(ior)
- return mySO
-
-def ObjectToID(obj):
- mySO = ObjectToSObject(obj)
- if mySO:
- return mySO.GetID()
- return ""
-
-def IDToSObject(id):
- mySO = myStudy.FindObjectID(id);
- return mySO
-
- #--------------------------------------------------------------------------
-
-def PersistentPresentation(theStudy, theSO, theWithID):
- # put the sobject's content (with subchildren) to the string
- aResult = ""
- attrs = theSO.GetAllAttributes()
- aLen = len(attrs)
- anUncopied = 0
- for a in range(0,aLen):
- attr = attrs[a]
- if isinstance(attr,SALOMEDS._objref_AttributeTreeNode):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeTarget):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeName) or \
- isinstance(attr,SALOMEDS._objref_AttributeComment) or \
- isinstance(attr,SALOMEDS._objref_AttributePersistentRef) or \
- isinstance(attr,SALOMEDS._objref_AttributeLocalID) or \
- isinstance(attr,SALOMEDS._objref_AttributeUserID):
- aResult += " attribute value: " + str(attr.Value())
- elif isinstance(attr,SALOMEDS._objref_AttributeIOR):
- aResult += " attribute: IOR"
- elif isinstance(attr,SALOMEDS._objref_AttributeSequenceOfReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeSequenceOfInteger):
- aResult += " Sequence: " + str(attr.CorbaSequence())
- elif isinstance(attr,SALOMEDS._objref_AttributeDrawable):
- aResult += " Drawable: " + str(attr.IsDrawable())
- elif isinstance(attr,SALOMEDS._objref_AttributeSelectable):
- aResult += " Selectable: " + str(attr.IsSelectable())
- elif isinstance(attr,SALOMEDS._objref_AttributeExpandable):
- aResult += " Expandable: " + str(attr.IsExpandable())
- elif isinstance(attr,SALOMEDS._objref_AttributeOpened):
- aResult += " Opened: " + str(attr.IsOpened())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextColor):
- aResult += " TextColor: " + str(attr.TextColor())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextHighlightColor):
- aResult += " TextHighlightColor: " + str(attr.TextHighlightColor())
- elif isinstance(attr,SALOMEDS._objref_AttributePixMap):
- aResult += " PixMap: " + str(attr.GetPixMap())
- elif isinstance(attr,SALOMEDS._objref_AttributeTableOfInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeTableOfReal):
- aResult += " Table with title: " + attr.GetTitle()
- elif isinstance(attr,SALOMEDS._objref_AttributePythonObject):
- aResult += " PythonObject: " + attr.GetObject()
-
- if theWithID:
- aResult = "sobject: " + theSO.GetID() + " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- else:
- aResult = " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- anIter = theStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += PersistentPresentation(theStudy, anIter.Value(), theWithID)
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def GetTree(theSO):
- # returns the document list tree (as list)
- aResult = [theSO.GetID()]
- anIter = myStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += GetTree(anIter.Value())
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
- aRoot = theSO
- while aRoot.GetID() != "0:":
- aRoot = aRoot.GetFather()
- aTree = GetTree(aRoot)
- aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
-
- if not myStudyManager.CanCopy(theSO):
- raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
-
- if not myStudyManager.Copy(theSO):
- raise RuntimeError, "<Copy> for "+theInfo+" returns false"
-
-
- if not myStudyManager.CanPaste(theSO):
- raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
-
- # check: before paste study is not changed check
- if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
- raise RuntimeError, "Study is changed before Paste calling for "+theInfo
-
- aSObj = theSO
- if theComponentPaste:
- aSObj = theSO.GetFatherComponent()
- theInfo = theInfo + "(paste for component)"
- if myStudyManager.Paste(aSObj) == None:
- raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
- aNewTree = GetTree(aRoot)
- aLen = len(aTree)
- for a in range(0,aLen):
- if aTree[a] != aNewTree[a]:
- return myStudy.FindObjectID(aNewTree[a])
-
- if aLen < len(aNewTree):
- return myStudy.FindObjectID(aNewTree[aLen])
-
- raise RuntimeError, "After Copy calling the tree is not changed"
-
- #--------------------------------------------------------------------------
-def FindFileInDataDir(filename):
- import os
- datadir = os.getenv("DATA_DIR")
- if datadir is not None:
- import string
- dirs = string.split(datadir, ":")
- for dir in dirs:
- file = dir + "/" + filename
- if os.path.exists(file):
- return file;
- datadir = os.getenv("KERNEL_ROOT_DIR") + "/examples/"
- file = datadir + filename
- if os.path.exists(file):
- return file;
-
- return None
-
-#--------------------------------------------------------------------------
-# initialise the ORB
-orb = None
-
-step = 0
-while step < 100 and orb is None:
- orb = CORBA.ORB_init([''], CORBA.ORB_ID)
- step = step + 1
- time.sleep(4)
-
-if orb is None:
- print "Warning: ORB has not been initialized !!!"
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
-
-step = 0
-while step < 100 and lcc._catalog is None:
- lcc = LifeCycleCORBA(orb)
- step = step + 1
- time.sleep(4)
-
-if lcc._catalog is None:
- print "Warning: LifeCycleCORBA object is incomplete !!!"
-
-#create a naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
-
-# get Study Manager reference
-obj = None
-
-step = 0
-while step < 100 and obj == None:
- obj = naming_service.Resolve('myStudyManager')
- step = step + 1
- time.sleep(4)
-
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-if myStudyManager is None:
- print "Warning: SALOMEDS.StudyManager has not been created !!!"
-
-# create new study
-aListOfOpenStudies = myStudyManager.GetOpenStudies();
-myStudy = None;
-if len(aListOfOpenStudies) == 0 :
- myStudy = myStudyManager.NewStudy("Study1")
-else:
- myStudyName = aListOfOpenStudies[0]
- myStudy = myStudyManager.GetStudyByName(myStudyName)
-
-myStudyName = myStudy._get_Name()
-
-myStudyId = myStudy._get_StudyId()
-print myStudyId
-
-
+++ /dev/null
-// 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 : libSALOME_Swig.i
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-%module libSALOME_Swig
-
-//%include "SALOME_NamingService.i"
-%include "SALOMEGUI_Swig.i"
-
+++ /dev/null
-#==============================================================================
-# File : supervisionexample.py
-# Created : 23 nov 2001
-# Author : Jean Rahuel
-# Project : SALOME
-# Copyright : CEA
-#==============================================================================
-
-from SuperV import *
-
-
-
-# load this object with Nodes, Links and Datas stored in GraphEssai.xml
-# (GraphEssai.xml was created with python in SuperVisionTest and GraphEssai.py)
-myGraph = Graph("@ROOT_BUILDDIR@/share/salome/resources/GraphEssai.xml")
-
-#myGraph = Graph("/home/data/jr_HEAD/build/share/salome/resources/GraphEssai.xml")
-# This DataFlow is "valid" : no loop, correct links between Nodes etc...
-
-print myGraph.IsValid()
-
-# Get Nodes
-myGraph.PrintNodes()
-Add,Sub,Mul,Div = myGraph.Nodes()
-
-# Load Datas
-Addx = Add.Input("x",3.)
-Addy = Add.Input("y",4.5)
-Subx = Sub.Input("x",1.5)
-
-# Get Output Port
-Addz = Add.Port('z')
-Subz = Sub.Port('z')
-Mulz = Mul.Port('z')
-Divz = Div.Port('z')
-
-# This DataFlow is "executable" : all pending Ports are defined with Datas
-print myGraph.IsExecutable()
-
-# Starts only execution of that DataFlow and gets control immediatly
-print myGraph.Run()
-
-# That DataFlow is running ==> 0 (false)
-print myGraph.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = myGraph.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = myGraph.Event()
-print myGraph.IsDone()
-
-# Wait for Completion (but it is already done after event loop ...)
-print "Done : ",myGraph.DoneW()
-
-# Get result
-print "Result : ",Divz.ToString()
-
-# Intermediate results :
-print "Intermediate Result Add\z : ",Addz.ToString()
-print "Intermediate Result Sub\z : ",Subz.ToString()
-print "Intermediate Result Mul\z : ",Mulz.ToString()
-
-print " "
-print "Type : print myGraph.IsDone()"
-print " If execution is finished ==> 1 (true)"
-print " "
-print "Type : print Divz.ToString()"
-print " You will get the result"
-print " "
-print "Type : myGraph.PrintPorts()"
-print " to see input and output values of the graph"
-print " "
-print "Type : Add.PrintPorts()"
-print "Type : Sub.PrintPorts()"
-print "Type : Mul.PrintPorts()"
-print "Type : Div.PrintPorts()"
-print " to see input and output values of nodes"
-
-# Export will create newsupervisionexample.xml and the corresponding .py file
-print myGraph.Export("@ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml")
-
-print " "
-print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml"
-print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.py"
+++ /dev/null
-
-# Generated python file of Graph GraphGeom2Essai
-
-from SuperV import *
-
-import salome
-
-import geompy
-
-
-geom = lcc.FindOrLoadComponent("FactoryServer", "Geometry")
-geom.GetCurrentStudy(salome.myStudyId)
-
-myBuilder = salome.myStudy.NewBuilder()
-
-# Graph creation
-GraphGeom2Essai = Graph( 'GraphGeom2Essai' )
-print GraphGeom2Essai.SetAuthor( '' )
-print GraphGeom2Essai.SetComment( '' )
-GraphGeom2Essai.Coords( 0 , 0 )
-
-# Creation of Nodes
-MakeSphere = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeSphere' )
-print MakeSphere.SetAuthor( '' )
-print MakeSphere.SetContainer( 'FactoryServer' )
-print MakeSphere.SetComment( '' )
-MakeSphere.Coords( 26 , 13 )
-MakeCopy = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeCopy' )
-print MakeCopy.SetAuthor( '' )
-print MakeCopy.SetContainer( 'FactoryServer' )
-print MakeCopy.SetComment( '' )
-MakeCopy.Coords( 219 , 12 )
-MakeTranslation = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeTranslation' )
-print MakeTranslation.SetAuthor( '' )
-print MakeTranslation.SetContainer( 'FactoryServer' )
-print MakeTranslation.SetComment( '' )
-MakeTranslation.Coords( 219 , 159 )
-MakeFuse = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeFuse' )
-print MakeFuse.SetAuthor( '' )
-print MakeFuse.SetContainer( 'FactoryServer' )
-print MakeFuse.SetComment( '' )
-MakeFuse.Coords( 465 , 106 )
-
-# Creation of intermediate Output variables and of links
-MakeSphereshape = MakeSphere.Port( 'shape' )
-MakeCopyshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeCopy.Port( 'shape1' ) )
-MakeTranslationshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeTranslation.Port( 'shape1' ) )
-MakeCopyshape = MakeCopy.Port( 'shape' )
-MakeFuseshape1 = GraphGeom2Essai.Link( MakeCopyshape , MakeFuse.Port( 'shape1' ) )
-MakeTranslationshape = MakeTranslation.Port( 'shape' )
-MakeFuseshape2 = GraphGeom2Essai.Link( MakeTranslationshape , MakeFuse.Port( 'shape2' ) )
-
-# Creation of Input datas
-MakeSpherex1 = MakeSphere.Input( 'x1' , 0)
-MakeSpherey1 = MakeSphere.Input( 'y1' , 0)
-MakeSpherez1 = MakeSphere.Input( 'z1' , 0)
-MakeSphereradius = MakeSphere.Input( 'radius' , 50)
-MakeTranslationx1 = MakeTranslation.Input( 'x1' , 80)
-MakeTranslationy1 = MakeTranslation.Input( 'y1' , 0)
-MakeTranslationz1 = MakeTranslation.Input( 'z1' , 0)
-
-# Missing Input datas : None
-
-# Creation of Output variables
-MakeFuseshape = MakeFuse.Port( 'shape' )
-
-# State of Ports of the Graph
-GraphGeom2Essai.PrintPorts()
-
-# Start asynchronous run
-print GraphGeom2Essai.Run()
-
-# Done ?
-print GraphGeom2Essai.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
-print GraphGeom2Essai.IsDone()
-
-# Waiting end of execution :
-print GraphGeom2Essai.DoneW()
-
-print " "
-print "Type print GraphGeom2Essai.IsDone()"
-print "1 <==> It's done"
-print " "
-print "Type print GraphGeom2Essai.DoneW()"
-print "Wait until end of execution : 1(success)"
-print " "
-print "Type GraphGeom2Essai.PrintPorts()"
-print " to see input and output values of the graph"
-print " "
-print "Type MakeSphere.PrintPorts()"
-print "Type MakeCopy.PrintPorts()"
-print "Type MakeTranslation.PrintPorts()"
-print "Type MakeFuse.PrintPorts()"
-print " to see input and output values of nodes"
-print " "
-print "Type print GraphGeom2Essai.Export('File-Name')"
-print "You will get a .py and a .xml file of this graph"
+++ /dev/null
-# 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 : Help.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-class SalomeDoc:
- def __init__(self, aDoc):
- self.doc = aDoc
- def __repr__(self):
- print self.doc
- return "---"
- def salome(self):
- doc_salome = '''
-MODULE : salome
----------------
-module salome gives access to Salome ressources:
-variables:
-
- salome:orb : CORBA
- salome.naming_service : instance of naming Service class
- methods:
- Resolve(name) : find a CORBA object (ior) by its pathname
- Register(name) : register a CORBA object under a pathname
- salome.lcc : instance of lifeCycleCORBA class
- methods:
- FindOrLoadComponent(server,name) :
- obtain an Engine (CORBA object)
- or launch the Engine if not found,
- with a Server name and an Engine name
- salome.sg
- methods:
- updateObjBrowser(bool):
- getActiveStudyId():
- getActiveStudyName():
-
- SelectedCount(): returns number of selected objects
- getSelected(i): returns entry of selected object number i
- getAllSelected(): returns list of entry of selected objects
- AddIObject(Entry): select an existing Interactive object
- RemoveIObject(Entry): remove object from selection
- ClearIObjects(): clear selection
-
- Display(*Entry):
- DisplayOnly(Entry):
- Erase(Entry):
- DisplayAll():
- EraseAll():
-
- IDToObject(Entry): returns CORBA reference from entry
-
- salome.myStudyName : active Study Name
- salome.myStudyId : active Study Id
- salome.myStudy : the active Study itself (CORBA ior)
- methods : defined in SALOMEDS.idl
-
-methods:
- salome.DumpStudy(study) : Dump a study, given the ior
----
-'''
- print doc_salome
-
- def geompy(self):
- doc_geompy = '''
-MODULE : geompy
----------------
-module geompy provides an encapsulation of GEOM Engine methods
-variables:
- geompy.geom : a Geometry Engine, found or loaded
- at first import of module geompy.
- methods : defined in GEOM_Gen.idl
- geompy.myBuilder : a study builder
- geompy.father : GEOM root in current study (salome.myStudy)
-
-methods:
- addToStudy(aShape, aName) : add the shape into the current study
- --- all methods of GEOM_Gen.idl that returns a shape are encapsulated,
- with the same interface : shapes are named with their ior
-'''
- print doc_geompy
-
- def supervision(self):
- doc_supervision = '''
-MODULES : SALOME_SuperVisionEditor and SALOME_SuperVisionExecutor
------------------------------------------------------------------
-this modules provide access to Editor and Executor Engine methods
-
-See SUPERV.idl
-
-In order to run the example (supervisionexample.py)
-
- Type : from supervisionexample import *
- supervisionexample.py contains comments
-
-A new python example avoids references to LifeCycleCORBA
- avoids references to NamingService
- avoids references to ModuleCatalog
- avoids SuperVisionComponent creation
- allows G.Input(...) instead of AddInput(G,...)
- replaces Editor/Executor with Graph
- allows Nodes, Ports and Links CORBA objects
- shortens methods names
- ...
-
- See /SuperVisionTest/resources/GraphExample.py
- and GraphExample.xml
----
-'''
- print doc_supervision
-
-
-
-help = SalomeDoc('''
-Availables modules:
- salome : gives access to Salome ressources
- geompy : encapsulation of GEOM Engine methods
- supervision : gives access to SuperVision Engine
-To obtain specific help on a module "truc", type: help.truc()
-To run an example, type: import example3
-''')
-
+++ /dev/null
-# 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 : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# Libraries targets
-
-#LIB = libSALOME_Swigcmodule.la
-LIB_SRC =
-
-#SWIG_DEF = libSALOME_Swig.i
-EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py examplevtk1.py supervisionexample.py supervisiongeomexample.py salome_shared_modules.py batchmode_salome.py test_table.py test_big_table.py test_many_objects.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py salome_ComponentGUI.py
-
-EXPORT_SHAREDPYSCRIPTS=kernel_shared_modules.py
-
-#LIB_CLIENT_IDL = SALOMEDS.idl \
- #SALOME_Exception.idl
-
-#CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H
-#LIBS+= $(PYTHON_LIBS)
-#LDFLAGS+= -lSalomeGUI
-
-@CONCLUDE@
+++ /dev/null
-# 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 : PyInterp.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-import sys
-from omniORB import CORBA
-from LifeCycleCORBA import *
-from libSALOME_Swig import *
-import SALOMEDS
-from SALOME_NamingServicePy import *
-
- #--------------------------------------------------------------------------
-
-def DumpComponent(Study, SO, offset):
- it = Study.NewChildIterator(SO)
- Builder = Study.NewBuilder()
- while it.More():
- CSO = it.Value()
- it.Next()
- anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
- AtName = anAttr._narrow(SALOMEDS.AttributeName)
- t_name = AtName.Value()
- if t_name[0] == 1:
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + "--"
- ofs = ofs +1
- print a + ">" + CSO.GetID() + " " + t_name[1]
- t_RefSO = CSO.ReferencedObject()
- if t_RefSO[0] == 1:
- RefSO = t_RefSO[1]
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + " "
- ofs = ofs +1
- print a + ">" + RefSO.GetID()
- DumpComponent(Study, CSO, offset+2)
-
- #--------------------------------------------------------------------------
-
-def DumpStudy(Study):
- itcomp = Study.NewComponentIterator()
- while itcomp.More():
- SC = itcomp.Value()
- itcomp.Next()
- name = SC.ComponentDataType()
- print "-> ComponentDataType is " + name
- DumpComponent(Study, SC, 1)
-
-
- #--------------------------------------------------------------------------
-
-# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
-
-# create an SALOMEGUI_Swig instance
-sg = SALOMEGUI_Swig()
-
-#create an naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
-
-# get active study name and id
-myStudyName = sg.getActiveStudyName()
-print myStudyName
-
-myStudyId = sg.getActiveStudyId()
-print myStudyId
-
-# get Study Manager reference
-obj = naming_service.Resolve('myStudyManager')
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-# get active study
-myStudy = myStudyManager.GetStudyByName(myStudyName)
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : batchmode_salome.py
-# Module : SALOME
-
-import salome_shared_modules
-
-from omniORB import CORBA
-from LifeCycleCORBA import *
-import SALOMEDS
-from SALOME_NamingServicePy import *
-
-#--------------------------------------------------------------------------
-
-def ImportComponentGUI(ComponentName):
- libName = "lib" + ComponentName + "_Swig"
- command = "from " + libName + " import *"
- exec ( command )
- constructor = ComponentName + "GUI_Swig()"
- command = "gui = " + constructor
- exec ( command )
- return gui
-
- #--------------------------------------------------------------------------
-
-def SalomeGUIgetAllSelected(self):
- selNumber = self.SelectedCount()
- listSelected = []
- for i in range(selNumber):
- listSelected.append(self.getSelected(i))
- return listSelected
- #--------------------------------------------------------------------------
-
-def generateName(prefix = None):
- import whrandom;
- int = whrandom.randint(1,1000);
- if prefix is None:
- return "Study" + str(int)
- else :
- return prefix + str(int)
-
-#WITHOUTIHMfrom libSALOME_Swig import *
-###from SalomePyQt import *
-#WITHOUTIHMclass SalomeGUI(SALOMEGUI_Swig):
- #WITHOUTIHMgetAllSelected = SalomeGUIgetAllSelected
-
- #WITHOUTIHMdef getDesktop(self) :
-# return SalomePyQt.getDesktop()
- #WITHOUTIHMreturn None
-
- #WITHOUTIHMdef getSelection(self) :
-# return SalomePyQt.getSelection()
- #WITHOUTIHMreturn None
-
- #--------------------------------------------------------------------------
-
-def IDToObject(id):
- myObj = None
- mySO = myStudy.FindObjectID(id);
- if mySO is not None:
- ok, anAttr = mySO.FindAttribute("AttributeIOR")
- if ok:
- AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
- if AtIOR.Value() != "":
- myObj = orb.string_to_object(AtIOR.Value())
- return myObj
-
-def ObjectToSObject(obj):
- mySO = None
- if obj is not None:
- ior = orb.object_to_string(obj)
- if ior != "":
- mySO = myStudy.FindObjectIOR(ior)
- return mySO
-
-def ObjectToID(obj):
- mySO = ObjectToSObject(obj)
- if mySO:
- return mySO.GetID()
- return ""
-
-def IDToSObject(id):
- mySO = myStudy.FindObjectID(id);
- return mySO
-
- #--------------------------------------------------------------------------
-
-def PersistentPresentation(theStudy, theSO, theWithID):
- # put the sobject's content (with subchildren) to the string
- aResult = ""
- attrs = theSO.GetAllAttributes()
- aLen = len(attrs)
- anUncopied = 0
- for a in range(0,aLen):
- attr = attrs[a]
- if isinstance(attr,SALOMEDS._objref_AttributeTreeNode):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeTarget):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeName) or \
- isinstance(attr,SALOMEDS._objref_AttributeComment) or \
- isinstance(attr,SALOMEDS._objref_AttributePersistentRef) or \
- isinstance(attr,SALOMEDS._objref_AttributeLocalID) or \
- isinstance(attr,SALOMEDS._objref_AttributeUserID):
- aResult += " attribute value: " + str(attr.Value())
- elif isinstance(attr,SALOMEDS._objref_AttributeIOR):
- aResult += " attribute: IOR"
- elif isinstance(attr,SALOMEDS._objref_AttributeSequenceOfReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeSequenceOfInteger):
- aResult += " Sequence: " + str(attr.CorbaSequence())
- elif isinstance(attr,SALOMEDS._objref_AttributeDrawable):
- aResult += " Drawable: " + str(attr.IsDrawable())
- elif isinstance(attr,SALOMEDS._objref_AttributeSelectable):
- aResult += " Selectable: " + str(attr.IsSelectable())
- elif isinstance(attr,SALOMEDS._objref_AttributeExpandable):
- aResult += " Expandable: " + str(attr.IsExpandable())
- elif isinstance(attr,SALOMEDS._objref_AttributeOpened):
- aResult += " Opened: " + str(attr.IsOpened())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextColor):
- aResult += " TextColor: " + str(attr.TextColor())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextHighlightColor):
- aResult += " TextHighlightColor: " + str(attr.TextHighlightColor())
- elif isinstance(attr,SALOMEDS._objref_AttributePixMap):
- aResult += " PixMap: " + str(attr.GetPixMap())
- elif isinstance(attr,SALOMEDS._objref_AttributeTableOfInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeTableOfReal):
- aResult += " Table with title: " + attr.GetTitle()
- elif isinstance(attr,SALOMEDS._objref_AttributePythonObject):
- aResult += " PythonObject: " + attr.GetObject()
-
- if theWithID:
- aResult = "sobject: " + theSO.GetID() + " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- else:
- aResult = " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- anIter = theStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += PersistentPresentation(theStudy, anIter.Value(), theWithID)
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def GetTree(theSO):
- # returns the document list tree (as list)
- aResult = [theSO.GetID()]
- anIter = myStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += GetTree(anIter.Value())
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
- aRoot = theSO
- while aRoot.GetID() != "0:":
- aRoot = aRoot.GetFather()
- aTree = GetTree(aRoot)
- aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
-
- if not myStudyManager.CanCopy(theSO):
- raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
-
- if not myStudyManager.Copy(theSO):
- raise RuntimeError, "<Copy> for "+theInfo+" returns false"
-
-
- if not myStudyManager.CanPaste(theSO):
- raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
-
- # check: before paste study is not changed check
- if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
- raise RuntimeError, "Study is changed before Paste calling for "+theInfo
-
- aSObj = theSO
- if theComponentPaste:
- aSObj = theSO.GetFatherComponent()
- theInfo = theInfo + "(paste for component)"
- if myStudyManager.Paste(aSObj) == None:
- raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
- aNewTree = GetTree(aRoot)
- aLen = len(aTree)
- for a in range(0,aLen):
- if aTree[a] != aNewTree[a]:
- return myStudy.FindObjectID(aNewTree[a])
-
- if aLen < len(aNewTree):
- return myStudy.FindObjectID(aNewTree[aLen])
-
- raise RuntimeError, "After Copy calling the tree is not changed"
-
- #--------------------------------------------------------------------------
-def FindFileInDataDir(filename):
- import os
- datadir = os.getenv("DATA_DIR")
- if datadir is not None:
- import string
- dirs = string.split(datadir, ":")
- for dir in dirs:
- file = dir + "/" + filename
- if os.path.exists(file):
- return file;
- datadir = os.getenv("KERNEL_ROOT_DIR") + "/examples/"
- file = datadir + filename
- if os.path.exists(file):
- return file;
-
- return None
-
-#--------------------------------------------------------------------------
-# initialise the ORB
-orb = None
-
-step = 0
-while step < 100 and orb is None:
- orb = CORBA.ORB_init([''], CORBA.ORB_ID)
- step = step + 1
- time.sleep(4)
-
-if orb is None:
- print "Warning: ORB has not been initialized !!!"
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
-
-step = 0
-while step < 100 and lcc._catalog is None:
- lcc = LifeCycleCORBA(orb)
- step = step + 1
- time.sleep(4)
-
-if lcc._catalog is None:
- print "Warning: LifeCycleCORBA object is incomplete !!!"
-
-#create a naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
-
-# get Study Manager reference
-obj = None
-
-step = 0
-while step < 100 and obj == None:
- obj = naming_service.Resolve('myStudyManager')
- step = step + 1
- time.sleep(4)
-
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-
-if myStudyManager is None:
- print "Warning: SALOMEDS.StudyManager has not been created !!!"
-
-# create new study
-aListOfOpenStudies = myStudyManager.GetOpenStudies();
-myStudy = None;
-if len(aListOfOpenStudies) == 0 :
- myStudy = myStudyManager.NewStudy("Study1")
-else:
- myStudyName = aListOfOpenStudies[0]
- myStudy = myStudyManager.GetStudyByName(myStudyName)
-
-myStudyName = myStudy._get_Name()
-
-myStudyId = myStudy._get_StudyId()
-print myStudyId
-
+++ /dev/null
-# 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 : examplevtk1.py
-# Module : SALOME
-
-import libSalomePy
-ren=libSalomePy.renderer
-#iren=libSalomePy.interactor
-
-from libVTKCommonPython import *
-from libVTKGraphicsPython import *
-cone = vtkConeSource()
-cone.SetResolution(8)
-coneMapper = vtkPolyDataMapper()
-coneMapper.SetInput(cone.GetOutput())
-coneActor = vtkActor()
-coneActor.SetMapper(coneMapper)
-
-ren.AddActor(coneActor)
-iren = vtkRenderWindowInteractor()
-
+++ /dev/null
-"""
-This module replaces the standard import mechanism with one
-that filters some imports that can't be done more than once.
-
-This is related to the multi study feature that is implemented
-by using the Python multi interpreter feature.
-Some modules register objects or classes by calling modules
-implemented in C. These operations can't be done multiple times.
-So it's very important to control these imports.
-
-Examples:
- - PyQt : import qt calls a C module to register classes
- - OmniORB : import *_idl calls a C module to register CORBA interfaces
-
-Usage:
- - First import the module : import import_hook. This module will
- replace the original importer mechanism
-
- - Next register the module names or pattern names to filter out::
- import_hook.register_name("a")
- import_hook.register_pattern(pattern)
-
- where pattern is a function with one parameter, the module name
- to be imported, that returns true or false depending if this module is
- to be filtered or not.
-
- - Then it's done
-
-IMPORTANT : Every subinterpretor has its own import_hook module. import_hook is not shared among subinterpretors.
-The mechanism only works if shared_imported and pattern are shared between all subinterpretors.
-This is done by calling init_shared_modules().
-
-"""
-import sys, imp, __builtin__
-
-# Keep in shared_imported a copy of dictionnary modules
-# that need to be imported only once in multi-study context
-shared_imported={}
-
-# patterns contains functions that returns 1 or 0 depending if
-# the module name (argument) must be filtered out or not
-# These functions are added by calling register_pattern
-patterns=[]
-
-original_import=__builtin__.__import__
-
-def register_name(name):
- if shared_imported.has_key(name):return
- shared_imported[name]=None
-
-def register_pattern(pattern):
- patterns.append(pattern)
-
-def is_shared(name):
- if shared_imported.has_key(name):return 1
- for pattern in patterns:
- if pattern(name) : return 1
- return 0
-
-def get_shared_imported(name):
- return shared_imported.get(name)
-def set_shared_imported(name,module):
- shared_imported[name]=module
- #print "Module %s shared registered" % name
-
-def get_shared_imported_with_copy(name):
- module_dict= shared_imported.get(name)
- m=imp.new_module(name)
- m.__dict__.update(module_dict)
- return m
-def set_shared_imported_with_copy(name,module):
- shared_imported[name]=module.__dict__.copy()
- #print "Module %s shared registered" % name
-
-def import_hook(name, globals=None, locals=None, fromlist=None):
- module=get_shared_imported(name)
- if module:
- sys.modules[name]=module
- return module
-
- module= original_import(name, globals, locals, fromlist)
-
- if is_shared(name):
- set_shared_imported(name,module)
- return module
-
-original_reload=__builtin__.reload
-
-def reload_hook(module):
- if is_shared(module.__name__):
- return module
- return original_reload(module)
-
-__builtin__.__import__=import_hook
-# Reload is not replaced
-#__builtin__.reload=reload_hook
-
-def init_shared_modules(shared_module):
- global shared_imported, patterns
- shared_imported=shared_module.shared_imported
- patterns= shared_module.patterns
- shared_imported["salome_shared_modules"]=shared_module
- import salome_shared_modules
- for m in salome_shared_modules.list_modules:
- m.init_shared_modules()
+++ /dev/null
-"""
-
-"""
-import glob,os,sys
-
-import import_hook
-from import_hook import register_name
-from import_hook import register_pattern
-
-register_name("qt")
-register_pattern(lambda(x):x.endswith("_idl"))
-
-register_name("omniORB")
-register_name("CosNaming")
-
-register_name("Engines")
-register_name("SALOME")
-register_name("SALOMEDS")
-register_name("SALOME_ModuleCatalog")
-
-# BE CAREFUL
-# Engines, SALOME, SALOMEDS must be imported in that order because :
-# Engines imports SALOME_Component_idl
-# SALOME imports SALOME_Session_idl and SALOME_Exception_idl which imports SALOME_Component_idl
-# and SALOMEDS imports SALOMEDS_idl and SALOMEDS_Attributes_idl which imports SALOME_Exception_idl
-# If SALOME is imported before Engines, that module would not be completely imported
-import Engines
-import SALOME
-import SALOMEDS
-
-import SALOME_ModuleCatalog
-from SALOME_utilities import MESSAGE
-#
-# We search all Python CORBA (omniorb) modules.
-# A Python CORBA module has 2 associated Python packages
-# These packages are named : <module_name> and <module_name>__POA
-#
-# Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set.
-salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR"))
-
-# Register all CORBA modules in the path and python modules in shared_modules
-path=salome_path.split(":")
-#
-for rep in path:
- rep_salome=os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome")
- # Find all the *__POA packages in the path
- for elem in glob.glob(os.path.join(rep_salome,"*__POA")):
- if os.path.isdir(elem):
- # Found a directory (Python package) named *__POA
- module__POA=os.path.basename(elem)
- module=module__POA[:-5]
- MESSAGE( "Register CORBA module: " + module + ". Directory: " + os.path.abspath(elem)[:-5] )
- register_name(module)
-
- # Now we import modules found in shared_modules directory
- for elem in glob.glob(os.path.join(rep_salome,"shared_modules","*.py")):
- module=os.path.basename(elem)[:-3]
- MESSAGE( "Register Python module: " + module + ". Location: " + os.path.abspath(elem) )
- register_name(module)
-
-def init_shared_modules():
- """
- This function initializes shared modules that need to be
- """
- # EDF-CCAR:
- # Problem with omniORB : omniORB creates a C Python module named _omnipy
- # this module has sub-modules : omni_func, ...
- # _omnipy is quite a package but import with Python sub-interpreters does not seem to work
- # To make it work we need to add those sub-modules in sys.modules
- import sys
- import _omnipy
- sys.modules["_omnipy.omni_func"]=_omnipy.omni_func
- sys.modules["_omnipy.poa_func"]=_omnipy.poa_func
- sys.modules["_omnipy.poamanager_func"]=_omnipy.poamanager_func
- sys.modules["_omnipy.orb_func"]=_omnipy.orb_func
+++ /dev/null
-# 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 : salome.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-from salome_kernel import *
-from salome_study import *
-from salome_iapp import *
-
-salome_initial=1
-def salome_init(theStudyId=0):
- """
- Performs only once SALOME general purpose intialisation for scripts.
- optional argument : theStudyId
- When in embedded interpreter inside IAPP, theStudyId is not used
- When used without GUI (external interpreter)
- 0 : create a new study (default).
- n (>0) : try connection to study with Id = n, or create a new one
- if study not found.
- If study creation, its Id may be different from theStudyId !
- Provides:
- orb reference to CORBA
- lcc a LifeCycleCorba instance
- naming_service a naming service instance
- cm reference to the container manager
- sg access to SALOME GUI (when linked with IAPP GUI)
- myStudyManager the study manager
- myStudyId active study identifier
- myStudy active study itself (CORBA reference)
- myStudyName active study name
- """
- global salome_initial
- global orb, lcc, naming_service, cm
- global sg
- global myStudyManager, myStudyId, myStudy, myStudyName
-
- if salome_initial:
- salome_initial=0
- sg = salome_iapp_init()
- orb, lcc, naming_service, cm = salome_kernel_init()
- myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
-
+++ /dev/null
-# 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 : salome.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-
-# to replace some function from <MODULE>_SWIG, outside GUI
-
-# --- From GeometryGUI_SWIG
-
- #--------------------------------------------------------------------------
-
-def getIndexTopology(aSubId, aMainId):
- return 0
-
- #--------------------------------------------------------------------------
-
-def getShapeTypeString(aSubId):
- return "SubShape"
-
- #--------------------------------------------------------------------------
-
-# --- From SMESHGUI_SWIG
-
- #--------------------------------------------------------------------------
-
-def Init(studyId):
- return
-
- #--------------------------------------------------------------------------
-
-def SetName(objId, name):
- return
-
- #--------------------------------------------------------------------------
+++ /dev/null
-# 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 : salome_iapp.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-from libSALOME_Swig import *
-import salome_ComponentGUI
-
- #--------------------------------------------------------------------------
-
-IN_SALOME_GUI=0
-
-def ImportComponentGUI(ComponentName):
- if IN_SALOME_GUI:
- libName = "lib" + ComponentName + "_Swig"
- command = "from " + libName + " import *"
- exec ( command )
- constructor = ComponentName + "_Swig()"
- command = "gui = " + constructor
- exec ( command )
- return gui
- else:
- print "Warning: ImportComponentGUI(",ComponentName,") outside GUI !"
- print "calls to GUI methods may crash..."
- return salome_ComponentGUI
-
- #--------------------------------------------------------------------------
-
-def SalomeGUIgetAllSelected(self):
- selNumber = self.SelectedCount()
- listSelected = []
- for i in range(selNumber):
- listSelected.append(self.getSelected(i))
- return listSelected
-
-class SalomeGUI(SALOMEGUI_Swig):
- getAllSelected = SalomeGUIgetAllSelected
-
- #--------------------------------------------------------------------------
-
-salome_iapp_initial = 1
-
-def salome_iapp_init():
- global salome_iapp_initial
- global sg,IN_SALOME_GUI
-
- if salome_iapp_initial:
- salome_iapp_initial=0
-
- # create a SALOMEGUI_Swig instance
- sg = SalomeGUI()
- IN_SALOME_GUI=sg.hasDesktop()
- return sg
+++ /dev/null
-# 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 : salome_kernel.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-from omniORB import CORBA
-from LifeCycleCORBA import *
-from SALOME_NamingServicePy import *
-from SALOME_utilities import *
-import Engines
-
-salome_kernel_initial=1
-
-def salome_kernel_init():
- global salome_kernel_initial
- global orb, lcc, naming_service, cm
-
- if salome_kernel_initial:
- salome_kernel_initial = 0
-
- # initialise the ORB
- orb = CORBA.ORB_init([''], CORBA.ORB_ID)
-
- # create a LifeCycleCORBA instance
- lcc = LifeCycleCORBA(orb)
-
- #create a naming service instance
- naming_service = SALOME_NamingServicePy_i(orb)
-
- # get Container Manager
- obj = naming_service.Resolve('/ContainerManager')
- cm = obj._narrow(Engines.ContainerManager)
-
- return orb, lcc, naming_service, cm
+++ /dev/null
-# 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 : salome_shared_modules.py
-# Module : SALOME
-
-from SALOME_utilities import *
-
-"""
-This module with help of import_hook and *_shared_modules
-filters imports when using the embedded Python interpretor.
-
-Some imports can't be done more than once.
-This is related to the multi study feature that is implemented
-by using the Python multi interpreter feature.
-Some modules register objects or classes by calling modules
-implemented in C. These operations can't be done multiple times.
-So it's very important to control these imports.
-
-Examples:
- - PyQt : import qt calls a C module to register classes
- - OmniORB : import *_idl calls a C module to register CORBA interfaces
-
-Usage:
- - First : the module salome_shared_modules is imported by main Python interpretor.
- It will keep a dictionnary and a list that are shared among all
- the subinterpretors and imports import_hook module that replaces
- the standard import mechanism par one that prevents more than one import
- for some modules identified by name (call register_name) or by a
- validator (call register_pattern).
-
- Calls to register_name and register_pattern are done in modules named *_shared_modules
- that could be found in the path SALOMEPATH
-
-"""
-import glob,os,sys
-
-import import_hook
-# shared_imported, patterns, register_name, register_pattern
-# will be shared by all Python sub interpretors
-from import_hook import shared_imported
-from import_hook import patterns
-from import_hook import register_name
-from import_hook import register_pattern
-
-register_name("salome_shared_modules")
-
-# Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set.
-salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR"))
-
-list_modules=[]
-
-# Import all *_shared_modules in the path and store them in list_modules
-path=salome_path.split(":")
-for rep in path:
- # Import all *_shared_modules in rep
- for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")):
- try:
- m=__import__(os.path.splitext(os.path.basename(f))[0])
- list_modules.append(m)
- except:
- pass
-
-#
-# If shared modules have been imported before installing import mechanism
-# we add them to shared_imported
-#
-for name,module in sys.modules.items():
- if import_hook.is_shared(name) and shared_imported.get(name) is None:
- #print "Module shared added to shared_imported: ",name
- shared_imported[name]=module
+++ /dev/null
-# 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 : salome_study.py
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-import salome_kernel
-import SALOMEDS
-import salome_iapp
-
-#--------------------------------------------------------------------------
-
-def DumpComponent(Study, SO, offset):
- it = Study.NewChildIterator(SO)
- Builder = Study.NewBuilder()
- while it.More():
- CSO = it.Value()
- it.Next()
- anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
- AtName = anAttr._narrow(SALOMEDS.AttributeName)
- t_name = AtName.Value()
- if t_name[0] == 1:
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + "--"
- ofs = ofs +1
- MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) )
- t_RefSO = CSO.ReferencedObject()
- if t_RefSO[0] == 1:
- RefSO = t_RefSO[1]
- ofs = 1
- a = ""
- while ofs <= offset:
- a = a + " "
- ofs = ofs +1
- MESSAGE( a + ">" + str(RefSO.GetID()) )
- DumpComponent(Study, CSO, offset+2)
-
- #--------------------------------------------------------------------------
-
-def DumpStudy(Study):
- itcomp = Study.NewComponentIterator()
- while itcomp.More():
- SC = itcomp.Value()
- itcomp.Next()
- name = SC.ComponentDataType()
- MESSAGE( "-> ComponentDataType is " + name )
- DumpComponent(Study, SC, 1)
-
-
- #--------------------------------------------------------------------------
-
-def IDToObject(id):
- myObj = None
- mySO = myStudy.FindObjectID(id);
- if mySO is not None:
- ok, anAttr = mySO.FindAttribute("AttributeIOR")
- if ok:
- AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR)
- if AtIOR.Value() != "":
- myObj = orb.string_to_object(AtIOR.Value())
- return myObj
-
-def ObjectToSObject(obj):
- mySO = None
- if obj is not None:
- ior = orb.object_to_string(obj)
- if ior != "":
- mySO = myStudy.FindObjectIOR(ior)
- return mySO
-
-def ObjectToID(obj):
- mySO = ObjectToSObject(obj)
- if mySO:
- return mySO.GetID()
- return ""
-
-def IDToSObject(id):
- mySO = myStudy.FindObjectID(id);
- return mySO
-
- #--------------------------------------------------------------------------
-
-def generateName(prefix = None):
- import whrandom;
- int = whrandom.randint(1,1000);
- if prefix is None:
- return "Study" + str(int)
- else :
- return prefix + str(int)
-
- #--------------------------------------------------------------------------
-
-def PersistentPresentation(theStudy, theSO, theWithID):
- # put the sobject's content (with subchildren) to the string
- aResult = ""
- attrs = theSO.GetAllAttributes()
- aLen = len(attrs)
- anUncopied = 0
- for a in range(0,aLen):
- attr = attrs[a]
- if isinstance(attr,SALOMEDS._objref_AttributeTreeNode):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeTarget):
- anUncopied += 1
- elif isinstance(attr,SALOMEDS._objref_AttributeReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeName) or \
- isinstance(attr,SALOMEDS._objref_AttributeComment) or \
- isinstance(attr,SALOMEDS._objref_AttributePersistentRef) or \
- isinstance(attr,SALOMEDS._objref_AttributeLocalID) or \
- isinstance(attr,SALOMEDS._objref_AttributeUserID):
- aResult += " attribute value: " + str(attr.Value())
- elif isinstance(attr,SALOMEDS._objref_AttributeIOR):
- aResult += " attribute: IOR"
- elif isinstance(attr,SALOMEDS._objref_AttributeSequenceOfReal) or \
- isinstance(attr,SALOMEDS._objref_AttributeSequenceOfInteger):
- aResult += " Sequence: " + str(attr.CorbaSequence())
- elif isinstance(attr,SALOMEDS._objref_AttributeDrawable):
- aResult += " Drawable: " + str(attr.IsDrawable())
- elif isinstance(attr,SALOMEDS._objref_AttributeSelectable):
- aResult += " Selectable: " + str(attr.IsSelectable())
- elif isinstance(attr,SALOMEDS._objref_AttributeExpandable):
- aResult += " Expandable: " + str(attr.IsExpandable())
- elif isinstance(attr,SALOMEDS._objref_AttributeOpened):
- aResult += " Opened: " + str(attr.IsOpened())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextColor):
- aResult += " TextColor: " + str(attr.TextColor())
- elif isinstance(attr,SALOMEDS._objref_AttributeTextHighlightColor):
- aResult += " TextHighlightColor: " + str(attr.TextHighlightColor())
- elif isinstance(attr,SALOMEDS._objref_AttributePixMap):
- aResult += " PixMap: " + str(attr.GetPixMap())
- elif isinstance(attr,SALOMEDS._objref_AttributeTableOfInteger) or \
- isinstance(attr,SALOMEDS._objref_AttributeTableOfReal):
- aResult += " Table with title: " + attr.GetTitle()
- elif isinstance(attr,SALOMEDS._objref_AttributePythonObject):
- aResult += " PythonObject: " + attr.GetObject()
-
- if theWithID:
- aResult = "sobject: " + theSO.GetID() + " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- else:
- aResult = " nbattrs: " + str(aLen - anUncopied) + aResult + '\n'
- anIter = theStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += PersistentPresentation(theStudy, anIter.Value(), theWithID)
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def GetTree(theSO):
- # returns the document list tree (as list)
- aResult = [theSO.GetID()]
- anIter = myStudy.NewChildIterator(theSO)
- while anIter.More():
- aResult += GetTree(anIter.Value())
- anIter.Next()
- return aResult
-
- #--------------------------------------------------------------------------
-
-def CheckCopyPaste(theSO, theInfo ,theComponentPaste):
- aRoot = theSO
- while aRoot.GetID() != "0:":
- aRoot = aRoot.GetFather()
- aTree = GetTree(aRoot)
- aStudyPersist = PersistentPresentation(myStudy, aRoot, 1)
-
- if not myStudyManager.CanCopy(theSO):
- raise RuntimeError, "<CanCopy> for "+theInfo+" returns false"
-
- if not myStudyManager.Copy(theSO):
- raise RuntimeError, "<Copy> for "+theInfo+" returns false"
-
-
- if not myStudyManager.CanPaste(theSO):
- raise RuntimeError, "<CanPaste> for "+theInfo+" returns false"
-
- # check: before paste study is not changed check
- if aStudyPersist != PersistentPresentation(myStudy, aRoot, 1):
- raise RuntimeError, "Study is changed before Paste calling for "+theInfo
-
- aSObj = theSO
- if theComponentPaste:
- aSObj = theSO.GetFatherComponent()
- theInfo = theInfo + "(paste for component)"
- if myStudyManager.Paste(aSObj) == None:
- raise RuntimeError, "<Paste> for "+theInfo+" returns None object"
- aNewTree = GetTree(aRoot)
- aLen = len(aTree)
- for a in range(0,aLen):
- if aTree[a] != aNewTree[a]:
- return myStudy.FindObjectID(aNewTree[a])
-
- if aLen < len(aNewTree):
- return myStudy.FindObjectID(aNewTree[aLen])
-
- raise RuntimeError, "After Copy calling the tree is not changed"
-
- #--------------------------------------------------------------------------
-
-def FindFileInDataDir(filename):
- import os
- datadir = os.getenv("DATA_DIR")
- if datadir is not None:
- import string
- dirs = string.split(datadir, ":")
- for dir in dirs:
- file = dir + "/" + filename
- if os.path.exists(file):
- return file;
- datadir = os.getenv("KERNEL_ROOT_DIR") + "/examples/"
- file = datadir + filename
- if os.path.exists(file):
- return file;
-
- return None
-
- #--------------------------------------------------------------------------
-
-salome_study_ID = -1
-
-def getActiveStudy(theStudyId=0):
- global salome_study_ID
-
- print "getActiveStudy"
- sg = salome_iapp.salome_iapp_init()
- if salome_study_ID == -1:
- if sg.hasDesktop():
- print "---in gui"
- salome_study_ID = sg.getActiveStudyId()
- else:
- print "---outside gui"
- if theStudyId:
- aStudy=myStudyManager.GetStudyByID(theStudyId)
- if aStudy:
- print "connection to existing study ", theStudyId
- salome_study_ID = theStudyId
- if salome_study_ID == -1:
- salome_study_ID = createNewStudy()
- print"--- Study Id ", salome_study_ID
- return salome_study_ID
-
- #--------------------------------------------------------------------------
-
-def createNewStudy():
- print "createNewStudy"
- i=1
- aStudyName = "noName"
- nameAlreadyInUse = 1
- listOfOpenStudies = myStudyManager.GetOpenStudies()
- print listOfOpenStudies
- while nameAlreadyInUse:
- aStudyName = "extStudy_%d"%i
- if aStudyName not in listOfOpenStudies:
- nameAlreadyInUse=0
- else:
- i = i+1
-
- theStudy = myStudyManager.NewStudy(aStudyName)
- theStudyId = theStudy._get_StudyId()
- print aStudyName, theStudyId
- return theStudyId
-
- #--------------------------------------------------------------------------
-
-salome_study_initial = 1
-
-def salome_study_init(theStudyId=0):
- """
- Performs only once study creation or connection.
- optional argument : theStudyId
- When in embedded interpreter inside IAPP, theStudyId is not used
- When used without GUI (external interpreter)
- 0 : create a new study (default).
- n (>0) : try connection to study with Id = n, or create a new one
- if study not found.
- """
-
- global salome_study_initial
- global myStudyManager, myStudyId, myStudy, myStudyName
- global orb, lcc, naming_service, cm
-
- if salome_study_initial:
- salome_study_initial = 0
-
- orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
-
- # get Study Manager reference
- print "looking for studyManager ..."
- obj = naming_service.Resolve('myStudyManager')
- myStudyManager = obj._narrow(SALOMEDS.StudyManager)
- print "studyManager found"
-
- # get active study Id, ref and name
- myStudyId = getActiveStudy(theStudyId)
- print "myStudyId",myStudyId
- myStudy = myStudyManager.GetStudyByID(myStudyId)
- myStudyName = myStudy._get_Name()
-
- return myStudyManager, myStudyId, myStudy, myStudyName
-
+++ /dev/null
-# SALOME SALOME_SWIG : binding of C++ implementation and Python
-#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : salome_test.py
-# Module : SALOME
-
-print "Test the application loading GEOM, SMESH, VISU, MED, components and doing some"
-print "operation within the components."
-
-import salome
-from salome import sg
-import SALOMEDS
-import os
-
-import SALOME_ModuleCatalog
-
-print "======================================================================"
-print " Get Catalog "
-print "======================================================================"
-obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
-catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
-
-print "======================================================================"
-print " Create Study "
-print "======================================================================"
-
-comp = catalog.GetComponent("GEOM")
-if comp is None:
- raise RuntimeError,"Component GEOM not found in Module Catalog."
-
-import geompy
-
-print "================================="
-print " create AttributeReal "
-print "================================="
-A = geompy.myBuilder.FindOrCreateAttribute(geompy.father, "AttributeReal")
-if A == None :
- raise RuntimeError, "Can't create AttributeReal attribute"
-A = A._narrow(SALOMEDS.AttributeReal)
-A.SetValue(0.0001)
-if A.Value() != 0.0001:
- raise RuntimeError, "Error : wrong value of AttributeReal"
-
-print
-print " =========== Test Geometry =========================="
-print
-
-print "==================================="
-print " define a box"
-print "==================================="
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
-
-print
-print "============= Test SMESH ============================="
-print
-
-import StdMeshers
-
-comp = catalog.GetComponent("SMESH")
-if comp is None:
- raise RuntimeError,"Component SMESH not found in Module Catalog."
-
-comp = catalog.GetComponent("MED")
-if comp is None:
- raise RuntimeError,"Component MED not found in Module Catalog."
-
-import SMESH
-
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
-
-smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId);
-
-ShapeTypeCompSolid = 1
-ShapeTypeSolid = 2
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeWire = 5
-ShapeTypeEdge = 6
-ShapeTypeVertex = 7
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box,"box")
-
-# ---- add first face of box in study
-
-subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
-face=subShapeList[0]
-name = geompy.SubShapeName(face, box)
-print name
-idface=geompy.addToStudyInFather(box,face,name)
-
-# ---- add shell from box in study
-
-subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-print name
-idshell=geompy.addToStudyInFather(box,shell,name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
-edge=edgeList[0];
-name = geompy.SubShapeName(edge, face)
-print name
-idedge=geompy.addToStudyInFather(face,edge,name)
-
-
-# ---- SMESH
-
-# ---- create Hypothesis
-
-print "-------------------------- create Hypothesis"
-print "-------------------------- LocalLength"
-hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" )
-hypLen1.SetLength(100)
-print hypLen1.GetName()
-print hypLen1.GetId()
-print hypLen1.GetLength()
-
-smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100")
-
-print "-------------------------- NumberOfSegments"
-hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" )
-hypNbSeg1.SetNumberOfSegments(7)
-print hypNbSeg1.GetName()
-print hypNbSeg1.GetId()
-print hypNbSeg1.GetNumberOfSegments()
-
-smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7")
-
-print "-------------------------- MaxElementArea"
-hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hypArea1.SetMaxElementArea(2500)
-print hypArea1.GetName()
-print hypArea1.GetId()
-print hypArea1.GetMaxElementArea()
-
-smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500")
-
-print "-------------------------- MaxElementArea"
-hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" )
-hypArea2.SetMaxElementArea(500)
-print hypArea2.GetName()
-print hypArea2.GetId()
-print hypArea2.GetMaxElementArea()
-
-smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500")
-
-print "-------------------------- Regular_1D"
-algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" )
-listHyp=algoReg.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-print algoReg.GetName()
-print algoReg.GetId()
-
-smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" )
-
-print "-------------------------- MEFISTO_2D"
-algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" )
-listHyp=algoMef.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-print algoMef.GetName()
-print algoMef.GetId()
-
-smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D" )
-
-# ---- add hypothesis to box
-
-print "-------------------------- add hypothesis to box"
-box=salome.IDToObject(idbox)
-mesh = smesh.CreateMesh(box)
-
-smeshgui.SetName( salome.ObjectToID(mesh), "MeshBox" );
-
-ret=mesh.AddHypothesis(box,algoReg)
-print ret
-ret=mesh.AddHypothesis(box,algoMef)
-print ret
-
-
-ret=mesh.AddHypothesis(box,hypNbSeg1)
-print ret
-ret=mesh.AddHypothesis(box,hypArea1)
-print ret
-
-
-# ---- add hypothesis to edge
-
-print "-------------------------- add hypothesis to edge"
-edge=salome.IDToObject(idedge)
-submesh=mesh.GetSubMesh(edge, "SubMeshEdge")
-
-ret=mesh.AddHypothesis(edge,algoReg)
-print ret
-ret=mesh.AddHypothesis(edge,hypLen1)
-print ret
-
-print "-------------------------- add hypothesis to face"
-face=salome.IDToObject(idface)
-submesh = mesh.GetSubMesh(face, "SubMeshFace")
-
-ret=mesh.AddHypothesis(face,hypArea2)
-print ret
-
-smesh.Compute(mesh, box)
-sg.updateObjBrowser(1);
-
-print
-print "============= Test Supervisor ============================="
-print
-
-comp = catalog.GetComponent("SUPERV")
-if comp is None:
- raise RuntimeError,"Component SUPERV not found in Module Catalog."
-
-from SuperV import *
-import SALOMEDS
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV")
-father = myStudy.FindComponent("SUPERV")
-if father is None:
- father = myBuilder.NewComponent("SUPERV")
- A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
- FName = A1._narrow(SALOMEDS.AttributeName)
- FName.SetValue( salome.sg.getComponentUserName("SUPERV") )
- A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap");
- aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
- aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" );
- myBuilder.DefineComponentInstance(father,SuperVision)
-
-def addStudy(ior):
- dataflow = SuperVision.getStreamGraph(ior)
- name=dataflow.Name()
- itr = myStudy.NewChildIterator(father)
- while itr.More():
- item=itr.Value()
- res,A=item.FindAttribute("AttributeName")
- if res:
- aName = A._narrow(SALOMEDS.AttributeName)
- if aName.Value() == name :
- print myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- print "A = ", A
- if A is not None :
- #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR")
- anIOR = A._narrow(SALOMEDS.AttributeIOR);
- print "anIOR.SetValue(dataflow.getIOR())"
- anIOR.SetValue(dataflow.getIOR())
- return
- itr.Next()
- obj = myBuilder.NewObject(father)
- A=myBuilder.FindOrCreateAttribute(obj, "AttributeName")
- aName=A._narrow(SALOMEDS.AttributeName)
- aName.SetValue(name)
- A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR")
- anIOR = A._narrow(SALOMEDS.AttributeIOR)
- anIOR.SetValue(dataflow.getIOR())
-
-import os
-dir= os.getenv("SUPERV_ROOT_DIR")
-if dir == None:
- raise RuntimeError, "SUPERV_ROOT_DIR is not defined"
-xmlfile = dir +"/examples/GraphGeomEssai.xml"
-print "Load dataflow from the file : "
-print xmlfile
-print
-
-myGraph = StreamGraph ( xmlfile )
-
-# This DataFlow is "valid" : no loop, correct links between Nodes etc...
-print "myGraph.IsValid() = ", myGraph.IsValid()
-
-# Get Nodes
-myGraph.PrintNodes()
-
-# This DataFlow is "executable" : all pending Ports are defined with Datas
-print myGraph.IsExecutable()
-
-# Starts only execution of that DataFlow and gets control immediatly
-print myGraph.Run()
-
-# That DataFlow is running ==> 0 (false)
-print myGraph.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = myGraph.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = myGraph.Event()
-print "myGraph.IsDone() = ",myGraph.IsDone()
-
-# Wait for Completion (but it is already done after event loop ...)
-print "Done : ",myGraph.DoneW()
-
-print " "
-#print "Type : print myGraph.IsDone()"
-#print " If execution is finished ==> 1 (true)"
-res=myGraph.IsDone()
-if res != 1:
- raise RuntimeError, "myGraph.Run() is not done"
-
-print " "
-print "Type : myGraph.PrintPorts()"
-print " to see input and output values of the graph"
-myGraph.PrintPorts()
-
-# Export will create newsupervisionexample.xml and the corresponding .py file
-tmpdir=os.getenv("TmpDir")
-if tmpdir is None:
- tmpdir="/tmp"
-file = tmpdir + "/newsupervisionexample"
-print "--------------\n"+file+"\n--------------\n"
-myGraph.Export(file)
-
-ior = salome.orb.object_to_string(myGraph.G)
-addStudy(ior)
-
-GraphName = myGraph.Name()
-print "Befor save ",
-#nodes = myGraph.Nodes()
-nodes = myGraph.G.Nodes().FNodes
-length_bs = len(nodes)
-print "ListOfNodes length = ", length_bs
-names=[]
-for node in nodes:
- names.append(node.Name())
-print names
-
-# Graph creation
-GraphInLines = StreamGraph( 'GraphInLines' )
-GraphInLines.SetName( 'GraphInLines' )
-GraphInLines.SetAuthor( '' )
-GraphInLines.SetComment( '' )
-GraphInLines.Coords( 0 , 0 )
-
-# Creation of InLine Nodes
-PyAdd = []
-PyAdd.append( 'def Add(a,b) : ' )
-PyAdd.append( ' return a+b ' )
-PyAdd.append( '' )
-Add = GraphInLines.INode( 'Add' , PyAdd )
-Add.InPort( 'a' , 'long' )
-Add.InPort( 'b' , 'long' )
-Add.OutPort( 'f' , 'long' )
-Add.SetName( 'Add' )
-Add.SetAuthor( '' )
-Add.SetComment( 'Python function' )
-Add.Coords( 351 , 77 )
-PySub = []
-PySub.append( 'def Sub(a,b) : ' )
-PySub.append( ' return a-b ' )
-PySub.append( '' )
-Sub = GraphInLines.INode( 'Sub' , PySub )
-Sub.InPort( 'a' , 'long' )
-Sub.InPort( 'b' , 'long' )
-Sub.OutPort( 'f' , 'long' )
-Sub.SetName( 'Sub' )
-Sub.SetAuthor( '' )
-Sub.SetComment( 'Python function' )
-Sub.Coords( 86 , 333 )
-PyMul = []
-PyMul.append( 'def Mul(a,b) : ' )
-PyMul.append( ' return a*b ' )
-Mul = GraphInLines.INode( 'Mul' , PyMul )
-Mul.InPort( 'a' , 'long' )
-Mul.InPort( 'b' , 'long' )
-Mul.OutPort( 'Result' , 'long' )
-Mul.SetName( 'Mul' )
-Mul.SetAuthor( '' )
-Mul.SetComment( 'Python function' )
-Mul.Coords( 616 , 247 )
-
-# Creation of intermediate Output variables and of Control Links
-Addf = Add.Port( 'f' )
-Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
-Mula.AddCoord( 1 , 570 , 356 )
-Mula.AddCoord( 2 , 570 , 186 )
-Subf = Sub.Port( 'f' )
-Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
-Mulb.AddCoord( 1 , 282 , 376 )
-Mulb.AddCoord( 2 , 282 , 442 )
-Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
-Addb.AddCoord( 1 , 283 , 209 )
-Addb.AddCoord( 2 , 283 , 374 )
-Addb.AddCoord( 3 , 283 , 442 )
-
-# Creation of Input datas
-Adda = Add.Input( 'a' , 1)
-Suba = Sub.Input( 'a' , 3)
-Subb = Sub.Input( 'b' , 4)
-
-# Creation of Output variables
-MulResult = Mul.Port( 'Result' )
-
-GraphInLines.Run()
-
-GraphInLines.DoneW()
-
-GraphInLines.PrintPorts()
-
-sg.updateObjBrowser(1);
-
-print
-print "============= Test VISU and MED ============================="
-print
-
-comp = catalog.GetComponent("VISU")
-if comp is None:
- raise RuntimeError,"Component VISU not found in Module Catalog."
-
-import sys
-import SALOMEDS
-import SALOME
-import SALOME_MED
-import VISU
-
-import visu_gui
-
-medFileName = "pointe.med"
-medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFileName
-print "Load ", medFile
-
-studyCurrent = salome.myStudyName
-
-med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
-
-try:
- if os.access(medFile, os.R_OK) :
- if not os.access(medFile, os.W_OK) :
- import random
- medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName
- print " -- Copy " + medFile + " to " + medFileNew
- os.system("cp "+ medFile + " " + medFileNew)
- medFile = medFileNew
- os.system("chmod 755 " + medFile)
-
- if os.access(medFile, os.W_OK) :
- med_comp.readStructFileWithFieldType(medFile,studyCurrent)
- med_obj = visu_gui.visu.getMedObjectFromStudy()
- print "med_obj - ", med_obj
-
- myField1 = visu_gui.visu.getFieldObjectFromStudy(2,1)
- aMeshName = "maa1"
- anEntity = VISU.NODE
- aTimeStampId = -1
-
- myResult1 = myVisu.ImportMedField(myField1)
- aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
-
- aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField1.getName(), aTimeStampId)
-
- myResult2 = myVisu.ImportFile(medFile);
- aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity);
-
- aTimeStampId = 3
- aScalarMap2= myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField1.getName(), aTimeStampId)
-
- sg.updateObjBrowser(0)
- else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
- else : print "We have no permission to read medFile, it will not be opened";
-
-except:
- if sys.exc_type == SALOME.SALOME_Exception :
- print "There is no permission to read " + medFile
- else :
- print sys.exc_type
- print sys.exc_value
- print sys.exc_traceback
-
-sg.updateObjBrowser(1);
+++ /dev/null
-#==============================================================================
-# File : supervisionexample.py
-# Created : 23 nov 2001
-# Author : Jean Rahuel
-# Project : SALOME
-# Copyright : CEA
-#==============================================================================
-
-from SuperV import *
-
-
-
-# load this object with Nodes, Links and Datas stored in GraphEssai.xml
-# (GraphEssai.xml was created with python in SuperVisionTest and GraphEssai.py)
-myGraph = Graph("@ROOT_BUILDDIR@/share/salome/resources/GraphEssai.xml")
-
-#myGraph = Graph("/home/data/jr_HEAD/build/share/salome/resources/GraphEssai.xml")
-# This DataFlow is "valid" : no loop, correct links between Nodes etc...
-
-print myGraph.IsValid()
-
-# Get Nodes
-myGraph.PrintNodes()
-Add,Sub,Mul,Div = myGraph.Nodes()
-
-# Load Datas
-Addx = Add.Input("x",3.)
-Addy = Add.Input("y",4.5)
-Subx = Sub.Input("x",1.5)
-
-# Get Output Port
-Addz = Add.Port('z')
-Subz = Sub.Port('z')
-Mulz = Mul.Port('z')
-Divz = Div.Port('z')
-
-# This DataFlow is "executable" : all pending Ports are defined with Datas
-print myGraph.IsExecutable()
-
-# Starts only execution of that DataFlow and gets control immediatly
-print myGraph.Run()
-
-# That DataFlow is running ==> 0 (false)
-print myGraph.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = myGraph.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = myGraph.Event()
-print myGraph.IsDone()
-
-# Wait for Completion (but it is already done after event loop ...)
-print "Done : ",myGraph.DoneW()
-
-# Get result
-print "Result : ",Divz.ToString()
-
-# Intermediate results :
-print "Intermediate Result Add\z : ",Addz.ToString()
-print "Intermediate Result Sub\z : ",Subz.ToString()
-print "Intermediate Result Mul\z : ",Mulz.ToString()
-
-print " "
-print "Type : print myGraph.IsDone()"
-print " If execution is finished ==> 1 (true)"
-print " "
-print "Type : print Divz.ToString()"
-print " You will get the result"
-print " "
-print "Type : myGraph.PrintPorts()"
-print " to see input and output values of the graph"
-print " "
-print "Type : Add.PrintPorts()"
-print "Type : Sub.PrintPorts()"
-print "Type : Mul.PrintPorts()"
-print "Type : Div.PrintPorts()"
-print " to see input and output values of nodes"
-
-# Export will create newsupervisionexample.xml and the corresponding .py file
-print myGraph.Export("@ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml")
-
-print " "
-print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml"
-print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.py"
-
+++ /dev/null
-# Generated python file of Graph GraphGeom2Essai
-
-from SuperV import *
-
-import salome
-
-import geompy
-
-
-geom = lcc.FindOrLoadComponent("FactoryServer", "Geometry")
-geom.GetCurrentStudy(salome.myStudyId)
-
-myBuilder = salome.myStudy.NewBuilder()
-
-# Graph creation
-GraphGeom2Essai = Graph( 'GraphGeom2Essai' )
-print GraphGeom2Essai.SetAuthor( '' )
-print GraphGeom2Essai.SetComment( '' )
-GraphGeom2Essai.Coords( 0 , 0 )
-
-# Creation of Nodes
-MakeSphere = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeSphere' )
-print MakeSphere.SetAuthor( '' )
-print MakeSphere.SetContainer( 'FactoryServer' )
-print MakeSphere.SetComment( '' )
-MakeSphere.Coords( 26 , 13 )
-MakeCopy = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeCopy' )
-print MakeCopy.SetAuthor( '' )
-print MakeCopy.SetContainer( 'FactoryServer' )
-print MakeCopy.SetComment( '' )
-MakeCopy.Coords( 219 , 12 )
-MakeTranslation = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeTranslation' )
-print MakeTranslation.SetAuthor( '' )
-print MakeTranslation.SetContainer( 'FactoryServer' )
-print MakeTranslation.SetComment( '' )
-MakeTranslation.Coords( 219 , 159 )
-MakeFuse = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeFuse' )
-print MakeFuse.SetAuthor( '' )
-print MakeFuse.SetContainer( 'FactoryServer' )
-print MakeFuse.SetComment( '' )
-MakeFuse.Coords( 465 , 106 )
-
-# Creation of intermediate Output variables and of links
-MakeSphereshape = MakeSphere.Port( 'shape' )
-MakeCopyshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeCopy.Port( 'shape1' ) )
-MakeTranslationshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeTranslation.Port( 'shape1' ) )
-MakeCopyshape = MakeCopy.Port( 'shape' )
-MakeFuseshape1 = GraphGeom2Essai.Link( MakeCopyshape , MakeFuse.Port( 'shape1' ) )
-MakeTranslationshape = MakeTranslation.Port( 'shape' )
-MakeFuseshape2 = GraphGeom2Essai.Link( MakeTranslationshape , MakeFuse.Port( 'shape2' ) )
-
-# Creation of Input datas
-MakeSpherex1 = MakeSphere.Input( 'x1' , 0)
-MakeSpherey1 = MakeSphere.Input( 'y1' , 0)
-MakeSpherez1 = MakeSphere.Input( 'z1' , 0)
-MakeSphereradius = MakeSphere.Input( 'radius' , 50)
-MakeTranslationx1 = MakeTranslation.Input( 'x1' , 80)
-MakeTranslationy1 = MakeTranslation.Input( 'y1' , 0)
-MakeTranslationz1 = MakeTranslation.Input( 'z1' , 0)
-
-# Missing Input datas : None
-
-# Creation of Output variables
-MakeFuseshape = MakeFuse.Port( 'shape' )
-
-# State of Ports of the Graph
-GraphGeom2Essai.PrintPorts()
-
-# Start asynchronous run
-print GraphGeom2Essai.Run()
-
-# Done ?
-print GraphGeom2Essai.IsDone()
-
-# Events of execution :
-aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
-while aStatus :
- print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
- aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
-print GraphGeom2Essai.IsDone()
-
-# Waiting end of execution :
-print GraphGeom2Essai.DoneW()
-
-print " "
-print "Type print GraphGeom2Essai.IsDone()"
-print "1 <==> It's done"
-print " "
-print "Type print GraphGeom2Essai.DoneW()"
-print "Wait until end of execution : 1(success)"
-print " "
-print "Type GraphGeom2Essai.PrintPorts()"
-print " to see input and output values of the graph"
-print " "
-print "Type MakeSphere.PrintPorts()"
-print "Type MakeCopy.PrintPorts()"
-print "Type MakeTranslation.PrintPorts()"
-print "Type MakeFuse.PrintPorts()"
-print " to see input and output values of nodes"
-print " "
-print "Type print GraphGeom2Essai.Export('File-Name')"
-print "You will get a .py and a .xml file of this graph"
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : test_big_table.py
-# Author : Vadim SANDLER
-# Module : SALOME
-# $Header$
-
-import salome
-import math
-import SALOMEDS
-
-# >>> Getting study builder ==================================================
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-# >>> Creating virtual component =============================================
-myComponent = myStudy.FindComponent("VirtualComponent")
-if not myComponent:
- myComponent = myBuilder.NewComponent("VirtualComponent")
- aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
- aName.SetValue("VirtualComponent")
-
-# >>> Creating object with Table of real[ 200 * 20 ] ========================
-myTRealObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
-AName.SetValue("Table Of Real")
-ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
-myHorNb = 10
-myVerNb = 200
-
-k={}
-for j in range(0,myHorNb):
- k[j] = j*10+1
-ARealTable.AddRow(k.values())
-ARealTable.SetRowTitle(1, "Frequency")
-ARealTable.SetRowUnit(1, "Hz")
-
-for i in range(1,myVerNb+1):
- for j in range(0,myHorNb):
- if j % 2 == 1:
- k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
- else:
- k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5
- ARealTable.AddRow(k.values())
- ARealTable.SetRowTitle(i+1, "Power " + str(i))
- ARealTable.SetRowUnit(i+1, "Wt")
-ARealTable.SetTitle("Very useful data")
-
-# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(1)
-
-# ============================================================================
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : visu_many_objects.py
-# Author : Vadim SANDLER
-# Module : SALOME
-# $Header$
-
-import salome
-import SALOMEDS
-
-# >>> Getting study builder ==================================================
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-# >>> Creating virtual component =============================================
-myComponent = myBuilder.NewComponent("VIRTUAL")
-AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
-AName.SetValue("Virtual")
-ACmt = myBuilder.FindOrCreateAttribute(myComponent, "AttributeComment")
-ACmt.SetValue("Virtual")
-
-# >>> Creating objects =======================================================
-# TO CHANGE TOTAL NUMBER OF OBJECTS, SET PROPER <myNb1>, <myNb2>, <myNb3>
-# IF YOU DON'T WANT TO ADD REFERENCES, SET <myAddRef> = 0
-myNb1 = 20
-myNb2 = 5
-myNb3 = 3
-myAddRef = 1
-
-if myAddRef == 1:
- myContainer = myBuilder.NewObject(myComponent)
- AName = myBuilder.FindOrCreateAttribute(myContainer, "AttributeName")
- AName.SetValue("References")
- ACmt = myBuilder.FindOrCreateAttribute(myContainer, "AttributeComment")
- ACmt.SetValue("Container for objects")
-
-for i in range(0,myNb1):
- myObject1 = myBuilder.NewObject(myComponent)
- AName = myBuilder.FindOrCreateAttribute(myObject1, "AttributeName")
- AName.SetValue("Object "+str(i))
- ACmt = myBuilder.FindOrCreateAttribute(myObject1, "AttributeComment")
- ACmt.SetValue("Virtual object "+str(i))
- if myAddRef == 1:
- myRefObject = myBuilder.NewObject(myContainer)
- myBuilder.Addreference(myRefObject,myObject1);
-
- for j in range(0,myNb2):
- myObject2 = myBuilder.NewObject(myObject1)
- AName = myBuilder.FindOrCreateAttribute(myObject2, "AttributeName")
- AName.SetValue("Object "+str(i)+"-"+str(j))
- ACmt = myBuilder.FindOrCreateAttribute(myObject2, "AttributeComment")
- ACmt.SetValue("Virtual object "+str(i)+"-"+str(j))
- if myAddRef == 1:
- myRefObject = myBuilder.NewObject(myContainer)
- myBuilder.Addreference(myRefObject,myObject2);
-
- for k in range(0,myNb3):
- myObject3 = myBuilder.NewObject(myObject2)
- AName = myBuilder.FindOrCreateAttribute(myObject3, "AttributeName")
- AName.SetValue("Object "+str(i)+"-"+str(j)+"-"+str(k))
- ACmt = myBuilder.FindOrCreateAttribute(myObject3, "AttributeComment")
- ACmt.SetValue("Virtual object "+str(i)+"-"+str(j)+"-"+str(k))
- if myAddRef == 1:
- myRefObject = myBuilder.NewObject(myContainer)
- myBuilder.Addreference(myRefObject,myObject3);
-
-# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(1)
-
-# ============================================================================
-
+++ /dev/null
-# 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 : test_remove_ref.py
-# Module : SALOMEDS
-
-from salome import *
-
-myBuilder = myStudy.NewBuilder()
-
-
-obj1 = myStudy.FindObjectID("0:1")
-if obj1 is None: print "Is null obj1 "
-else: print obj1.GetID()
-
-obj2 = myBuilder.NewObject(obj1)
-print "Obj2 ID = "+obj2.GetID()
-
-myBuilder.Addreference(obj1, obj2)
-
-(f, obj3) = obj1.ReferencedObject()
-
-print "Ref obj ID = "+obj3.GetID()
-
-
-myBuilder.RemoveReference(obj1)
-
-(f, obj4) = obj1.ReferencedObject()
-
-print "Ref is found ", f
+++ /dev/null
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : test_table.py
-# Author : Vadim SANDLER
-# Module : SALOME
-# $Header$
-
-import salome
-import math
-import SALOMEDS
-
-# >>> Getting study builder ==================================================
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-# >>> Creating virtual component =============================================
-myComponent = myStudy.FindComponent("VirtualComponent")
-if not myComponent:
- myComponent = myBuilder.NewComponent("VirtualComponent")
- aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
- aName.SetValue("VirtualComponent")
-
-# >>> Creating object with Table of integer ==================================
-myTIntObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myTIntObject, "AttributeName")
-AName.SetValue("Table Of Integer")
-AIntTable = myBuilder.FindOrCreateAttribute(myTIntObject, "AttributeTableOfInteger")
-
-a=[1,2,3,4,5,6,7,8,9,10]
-AIntTable.AddRow(a)
-a=[110,120,130,140,150,160,170,180,190,200]
-AIntTable.AddRow(a)
-a=[-1,272,0,0,-642,10000,13,578,-578,99]
-AIntTable.AddRow(a)
-AIntTable.SetTitle("TEST table of integer")
-AIntTable.SetRowTitle(1,"FR")
-AIntTable.SetRowUnit(1,"m/h")
-AIntTable.SetRowTitle(2,"SR")
-AIntTable.SetRowUnit(2,"s")
-AIntTable.SetRowTitle(3,"TR")
-AIntTable.SetRowUnit(3,"$")
-c=["C1","C2","C3","C4","C5","C6","C7","C8","C9","C10"]
-AIntTable.SetColumnTitles(c)
-
-# >>> Creating object with Table of real =====================================
-myTRealObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
-AName.SetValue("Table Of Real")
-ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
-
-k={}
-l={}
-for j in range(0,20):
- k[j] = j*10+1
- l[j] = "C"+str(j+1)
-ARealTable.AddRow(k.values())
-ARealTable.SetRowTitle(1, "Row 0")
-ARealTable.SetRowUnit(1, "Hz")
-ARealTable.SetColumnTitles(l.values())
-for i in range(1,11):
- for j in range(1,21):
- if j % 2 == 1:
- k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
- else:
- k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5
- ARealTable.AddRow(k.values())
- ARealTable.SetRowTitle(i+1, "Row " + str(i))
- ARealTable.SetRowUnit(i+1, "Wt")
-ARealTable.SetTitle("TEST table of real")
-
-# >>> Creating object with integer attribute =================================
-myIntObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myIntObject, "AttributeName")
-AName.SetValue("Integer")
-AInt = myBuilder.FindOrCreateAttribute(myIntObject, "AttributeInteger")
-AInt.SetValue(123)
-
-# >>> Creating object with real attribute ====================================
-myRealObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myRealObject, "AttributeName")
-AName.SetValue("Real")
-AReal = myBuilder.FindOrCreateAttribute(myRealObject, "AttributeReal")
-AReal.SetValue(-56.9634)
-
-# >>> Creating object with comment attribute =================================
-myCmtObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myCmtObject, "AttributeName")
-AName.SetValue("Comment")
-ACmt = myBuilder.FindOrCreateAttribute(myCmtObject, "AttributeComment")
-ACmt.SetValue("Just a comment")
-
-# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(1)
-
-# ============================================================================
-
-
+++ /dev/null
-# 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 : testattr.py
-# Module : SALOME
-
-import SALOMEDS
-#import SALOMEDS_Attributes_idl
-import geompy
-import salome
-# ===============================================================
-
-# creating new object ===========================================
-obj = geompy.myBuilder.NewObject(geompy.father)
-
-# adding Name attribute =========================================
-A1 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeName")
-name = A1._narrow(SALOMEDS.AttributeName)
-name.SetValue("First Object")
-
-# adding Comment attribute ======================================
-A2 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeComment")
-comment = A2._narrow(SALOMEDS.AttributeComment)
-comment.SetValue("This is Comment attribute")
-
-# adding IOR attribute ==========================================
-#A3 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeIOR")
-# ...
-
-# adding integer attribute ======================================
-A4 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeInteger")
-integer = A4._narrow(SALOMEDS.AttributeInteger)
-integer.SetValue(12)
-
-# adding real attribute =========================================
-A5 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeReal")
-real = A5._narrow(SALOMEDS.AttributeReal)
-real.SetValue(0.25)
-
-# adding sequence of integer attribute ==========================
-A6 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSequenceOfInteger")
-intseq = A6._narrow(SALOMEDS.AttributeSequenceOfInteger)
-intseq.Add(1)
-intseq.Add(2)
-intseq.Add(3)
-
-
-# adding sequence of real attribute =============================
-A7 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSequenceOfReal")
-realseq = A7._narrow(SALOMEDS.AttributeSequenceOfReal)
-realseq.Add(0.001)
-realseq.Add(0.002)
-realseq.Add(0.003)
-
-# adding PersistentRef attribute ================================
-#A8 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributePersistentRef")
-# ...
-
-# adding Drawable attribute =====================================
-A9 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeDrawable")
-drawable = A9._narrow(SALOMEDS.AttributeDrawable)
-drawable.SetDrawable(1)
-
-# adding Selectable attribute ===================================
-#A10 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeSelectable")
-# ...
-
-# adding Expandable attribute ===================================
-#A11 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeExpandable")
-# ...
-
-# adding Opened attribute =======================================
-#A12 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeOpened")
-# ...
-
-# adding TextColor attribute ====================================
-A13 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeTextColor")
-textcolor = A13._narrow(SALOMEDS.AttributeTextColor)
-
-# ...
-
-# adding TextHighlightColor of real attribute ===================
-#A14 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributeTextHighlightColor")
-# ...
-
-# adding PixMap of real attribute ===============================
-#A15 = geompy.myBuilder.FindOrCreateAttribute(obj,"AttributePixMap")
-# ...
-
-# opening OCAF Browser ==========================================
-# result = salome.myStudy.OCAFBrowser()
+++ /dev/null
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = \
- SUPERVGraph_ViewFrame.h
-
-# Libraries targets
-
-LIB = libSUPERVGraph.la
-LIB_SRC = SUPERVGraph.cxx \
- SUPERVGraph_ViewFrame.cxx
-
-LIB_MOC = SUPERVGraph_moc.cxx \
- SUPERVGraph_ViewFrame_moc.cxx
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Component.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-
-CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib -lSalomeGUI
-
-
-@CONCLUDE@
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SUPERVGraph.h"
-#include "SUPERVGraph_ViewFrame.h"
-using namespace std;
-
-QAD_ViewFrame* SUPERVGraph::createView(QAD_RightFrame* parent)
-{
- return new SUPERVGraph_ViewFrame( parent, "vtkView" );
-}
-
-extern "C"
-{
- QAD_ViewFrame* createView(QAD_RightFrame* parent)
- {
- return SUPERVGraph::createView(parent);
- }
-}
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SUPERVGraph_HeaderFile
-#define SUPERVGraph_HeaderFile
-
-#include "QAD_RightFrame.h"
-#include "QAD_ViewFrame.h"
-
-class SUPERVGraph : public QObject
-{
- Q_OBJECT
-
-public :
-
- Standard_EXPORT static QAD_ViewFrame* createView ( QAD_RightFrame* parent);
-
-};
-
-#endif
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph_Graph.cxx
-// Author : Francis KLOSS
-// Module : SALOME
-
-#include "SUPERVGraph_Graph.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-
-#include <qcolordialog.h>
-#include <qpopupmenu.h>
-using namespace std;
-
-
-SUPERVGraph_Graph::SUPERVGraph_Graph(QWidget* parent) :
- QScrollView(parent),
- where(QPoint(0, 0))
-{
- installEventFilter(viewport());
- // viewport()->setBackgroundColor(QColor(165, 255, 176));
-
- connect(this, SIGNAL(contentsMoving(int, int)), this, SLOT(Draw(int, int)));
-
- popup = new QPopupMenu(viewport());
- // if (main->isModify()) {
- // pan = popup->insertItem("Add Node", main, SLOT(addNode()));
- // pap = popup->insertItem("Add Point", this, SLOT(addPoint()));
- // pdl = popup->insertItem("Delete Link", this, SLOT(deleteLink()));
- // pif = popup->insertItem("Insert File", main, SLOT(insertFile()));
- // pci = popup->insertItem("Change Informations", this, SLOT(changeInformation()));
- // popup->insertSeparator();
- // };
- // popup->insertItem("Add in Study", main, SLOT(addStudy()));
- // popup->insertItem("Show Informations", this, SLOT(showInformation()));
- // popup->insertSeparator();
- // popup->insertItem("Copy (Read Only)", main, SLOT(copyReading()));
- // popup->insertItem("Copy (Modifiying)", main, SLOT(copyModifying()));
-}
-
-void SUPERVGraph_Graph::sync() {
- // bool editing = main->getDataflow()->IsEditing();
- // if (main->isModify()) {
- // popup->setItemEnabled(pci, editing);
- // popup->setItemEnabled(pan, editing);
- // popup->setItemEnabled(pap, editing);
- // popup->setItemEnabled(pdl, editing);
- // popup->setItemEnabled(pif, editing);
- // };
-
- // SUPERVGraph_Node* ihmNode;
- // QObjectList* ihmList = queryList("SUPERVGraph_Node");
- // SUPERV_Nodes nodes = main->getDataflow()->Nodes();
- // int n = nodes->length();
-
- // for (int i=0; i<n; i++) {
- // ihmNode = (SUPERVGraph_Node *)child(nodes[i]->Name(), "SUPERVGraph_Node");
- // if (ihmNode == NULL) {
- // ihmNode = new SUPERVGraph_Node(viewport(), main, nodes[i]);
- // addChild(ihmNode, nodes[i]->X(), nodes[i]->Y());
- // } else {
- // moveChild(ihmNode, nodes[i]->X(), nodes[i]->Y());
- // ihmList->removeRef(ihmNode);
- // };
- // ihmNode->sync();
- // };
-
- // QObjectListIt i(*ihmList);
- // while ((ihmNode=(SUPERVGraph_Node*)i.current()) != 0) {
- // ++i;
- // ihmNode->close();
- // };
- // delete ihmList;
-
- // SUPERVGraph_PortIn* pi;
- // ihmList = queryList("SUPERVGraph_PortIn");
- // i = *ihmList;
- // while ((pi=(SUPERVGraph_PortIn*)i.current()) != 0) {
- // ++i;
- // pi->sync(true);
- // };
- // delete ihmList;
-
- // SUPERVGraph_PortOut* po;
- // ihmList = queryList("SUPERVGraph_PortOut");
- // i = *ihmList;
- // while ((po=(SUPERVGraph_PortOut*)i.current()) != 0) {
- // ++i;
- // po->sync();
- // };
- // delete ihmList;
-
- // Draw(0, 0);
-}
-
-SUPERVGraph_Graph::~SUPERVGraph_Graph() {
-}
-
-bool SUPERVGraph_Graph::eventFilter(QObject* object, QEvent* event) {
- if ((event->type() == QEvent::Move ) ||
- (event->type() == QEvent::Paint) ||
- (event->type() == QEvent::Resize) ) {
- Draw(0, 0);
- };
- return(QScrollView::eventFilter(object, event));
-}
-
-void SUPERVGraph_Graph::Draw(int x, int y) {
- QPainter p(viewport());
- p.eraseRect(viewport()->rect());
- p.setPen(QPen(Qt::black, 2));
-
- // SUPERVGraph_Point* c;
- // SUPERVGraph_Point* n;
- // QObjectList* points = queryList("SUPERVGraph_Point");
- // QObjectListIt i(*points);
- // while ((c=(SUPERVGraph_Point*)i.current()) != 0) {
- // ++i;
- // n=c->getNext();
- // if (n!=c) {
- // p.drawLine(contentsToViewport(QPoint(c->getX()+POINT_SIZE_HALF, c->getY()+POINT_SIZE_HALF)),
- // contentsToViewport(QPoint(n->getX()+POINT_SIZE_HALF, n->getY()+POINT_SIZE_HALF)) );
- // };
- // };
- // delete points;
-}
-
-void SUPERVGraph_Graph::contentsMousePressEvent(QMouseEvent* e) {
- where = viewportToContents(viewport()->mapFromGlobal(e->globalPos()));
- // main->showPopup(popup, e);
-}
-
-void SUPERVGraph_Graph::contentsMouseReleaseEvent(QMouseEvent* e) {
- // main->sketchPoint(NULL);
-
- if ( e->button() == Qt::RightButton ) {
- QPopupMenu* popup = createPopup();
- if ( popup ) {
- popup->exec( QCursor::pos() );
- destroyPopup();
- }
- return;
- }
-
-}
-
-void SUPERVGraph_Graph::contentsMouseMoveEvent(QMouseEvent* e) {
- // main->sketchMove();
-}
-
-float SUPERVGraph_Graph::distance(int xp, int yp, int xl, int yl, int xn, int yn) {
- float r, s;
- float a, b, c, d;
-
- float px = (float)(xp);
- float py = (float)(yp);
- float lx = (float)(xl);
- float ly = (float)(yl);
- float nx = (float)(xn);
- float ny = (float)(yn);
-
- r = px - lx;
- r = r * r;
- s = py - ly;
- s = s * s;
- a = r + s;
-
- r = px - nx;
- r = r * r;
- s = py - ny;
- s = s * s;
- b = r + s;
-
- r = nx - lx;
- r = r * r;
- s = ny - ly;
- s = s * s;
- c = r + s;
-
- if (c<0.001) {
- return(a);
- } else {
- r = a + c - b;
- r = r * r;
- d = r / ( 4 * c);
- return(a - d);
- };
-}
-
-QPoint SUPERVGraph_Graph::getPoint() {
- return(where);
-}
-
-// SUPERVGraph_Point* SUPERVGraph_Graph::findPoint(int x, int y) {
-// float m;
-// float d = SCROLL_MAX;
-// SUPERVGraph_Point* t = NULL;
-// SUPERVGraph_Point* c;
-// SUPERVGraph_Point* n;
-// QObjectList* points = queryList("SUPERVGraph_Point");
-// QObjectListIt i(*points);
-
-// while ((c=(SUPERVGraph_Point*)i.current()) != 0) {
-// ++i;
-// n=c->getNext();
-// if (n != c) {
-// m = distance(x, y, c->getX(), c->getY(), n->getX(), n->getY());
-// if (m < d) {
-// d = m;
-// t = c;
-// };
-// };
-// };
-// delete points;
-// return(t);
-// }
-
-void SUPERVGraph_Graph::addPoint() {
- // int x = where.x();
- // int y = where.y();
- // SUPERVGraph_Point* p = findPoint(x, y);
- // if (p == NULL) {
- // QMessageBox::warning(0, "Supervision Error", "No Link to Add a Point");
- // } else {
- // p->addPoint(x, y, true);
- // };
-}
-
-void SUPERVGraph_Graph::deleteLink() {
- // SUPERVGraph_Point* p = findPoint(where.x(), where.y());
- // if (p == NULL) {
- // QMessageBox::warning(0, "Supervision Error", "No Link to Delete");
- // } else {
- // SUPERV_Link l = p->getLink();
- // if (l == NULL) {
- // QMessageBox::warning(0, "Supervision Error", "No Link to Delete");
- // } else {
- // l->Destroy();
- // main->sync();
- // };
- // };
-}
-
-void SUPERVGraph_Graph::showInformation() {
- // if (Supervision.information(Engines::Node::_narrow(main->getDataflow()), false)) {
- // main->sync();
- // };
-}
-
-void SUPERVGraph_Graph::changeInformation() {
- // if (Supervision.information(Engines::Node::_narrow(main->getDataflow()), true)) {
- // main->sync();
- // };
-}
-
-/*!
- Creates the popup
-*/
-void SUPERVGraph_Graph::onCreatePopup()
-{
- if ( myPopup ) {
-// if (myPopup->count()<1) {
- if ( myPopup->count() > 0 )
- myIDs.append ( myPopup->insertSeparator() );
- int id;
- myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
- QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
-// }
- }
-}
-
-void SUPERVGraph_Graph::onChangeBackgroundColor()
-{
- QColor previousColor = viewport()->backgroundColor();
- QColor selColor = QColorDialog::getColor ( previousColor, NULL );
- if ( selColor.isValid() )
- viewport()->setBackgroundColor( selColor );
-
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorRed", selColor.red() );
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorGreen", selColor.green() );
- QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorBlue", selColor.blue() );
-}
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph_Graph.h
-// Author : Francis KLOSS
-// Module : SALOME
-
-#ifndef SUPERVGraph_Graph_HXX
-#define SUPERVGraph_Graph_HXX
-
-#include "QAD.h"
-#include "QAD_Popup.h"
-
-#include <qscrollview.h>
-#include <qpopupmenu.h>
-
-class QAD_EXPORT SUPERVGraph_Graph: public QScrollView, public QAD_PopupClientServer
-{
- Q_OBJECT
-
-public:
- SUPERVGraph_Graph(QWidget* parent);
- ~SUPERVGraph_Graph();
-
- /* popup management */
- void onCreatePopup();
-
- void sync();
- void contentsMousePressEvent(QMouseEvent* e);
- void contentsMouseReleaseEvent(QMouseEvent* e);
- void contentsMouseMoveEvent(QMouseEvent* e);
-
- QPoint getPoint();
-
-public slots:
- void Draw(int x, int y);
-
-private slots:
- void addPoint();
- void deleteLink();
- void showInformation();
- void changeInformation();
-
-protected slots:
- void onChangeBackgroundColor();
-
-protected:
- bool eventFilter(QObject* object, QEvent* event);
-
-private:
-// SUPERVGraph_Point* findPoint(int x, int y);
- float distance(int xp, int yp, int xl, int yl, int xn, int yn);
-
-// SUPERVGraph_Main* main;
- QPoint where;
- QPopupMenu* popup;
- int pci;
- int pan;
- int pap;
- int pdl;
- int pif;
-};
-
-#endif
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph_ViewFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "SUPERVGraph_ViewFrame.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "SALOME_Selection.h"
-
-#include "utilities.h"
-
-//QT Include
-#include <qlayout.h>
-#include <qcolordialog.h>
-using namespace std;
-
-SUPERVGraph_View::SUPERVGraph_View(QWidget* theParent): QWidget(theParent){
- init(theParent);
-}
-SUPERVGraph_View::SUPERVGraph_View(SUPERVGraph_View* theParent): QWidget(theParent){
- setPopupServer(theParent->getPopupServer());
- init(theParent);
-}
-void SUPERVGraph_View::init(QWidget* theParent){
- if ( theParent->inherits( "QMainWindow" ) ) {
- ( ( QMainWindow* )theParent )->setCentralWidget( this );
- }
- else {
- QBoxLayout* layout = new QVBoxLayout( theParent );
- layout->addWidget( this );
- }
-
-}
-void SUPERVGraph_View::onCreatePopup(){
- /*
- if ( myPopup ) {
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* ActiveStudy = Desktop->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
-
- QString theContext;
- QString theParent("Viewer");
- QString theObject;
-
- Desktop->definePopup( theContext, theParent, theObject );
- Desktop->createPopup( myPopup, theContext, theParent, theObject);
- Desktop->customPopup( myPopup, theContext, theParent, theObject );
- if (Sel->IObjectCount() == 0 && myPopup->count()<1) {
- int id;
- myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
- QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
- }
- }
- */
- }
-/*!
- Constructor
-*/
-SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame(QWidget* parent, const char* name)
- : QAD_ViewFrame(parent, name)
-{
- myView = 0;
- //myView = new SUPERVGraph_View(this);
- // Set BackgroundColor
- /*
- int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
- int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
- int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
- setBackgroundColor(QColor(R,G,B));*/
-}
-SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame(){}
-
-/*!
- Returns widget containing 3D-Viewer
-*/
-SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget(){
- return myView;
-}
-
-
-void SUPERVGraph_ViewFrame::setViewWidget(SUPERVGraph_View* theView) {
- myView = theView;
- if (myApp) {
- myView->setPopupServer(myApp);
- }
-}
-
-
-/*!
- Display/hide Trihedron
-*/
-void SUPERVGraph_ViewFrame::onViewTrihedron()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
-}
-
-/*!
- Provides top projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewTop()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
-}
-
-/*!
- Provides bottom projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewBottom()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
-}
-
-/*!
- Provides left projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewLeft()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
-}
-
-/*!
- Provides right projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewRight()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
-}
-
-/*!
- Provides back projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewBack()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
-}
-
-/*!
- Provides front projection of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewFront()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
-}
-
-/*!
- Reset the active view
-*/
-void SUPERVGraph_ViewFrame::onViewReset()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
- if (myView)
- myView->ResetView();
-}
-
-/*!
- Rotates the active view
-*/
-void SUPERVGraph_ViewFrame::onViewRotate()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
-}
-
-/*!
- Sets a new center of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewGlobalPan()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
-}
-
-/*!
- Zooms the active view
-*/
-void SUPERVGraph_ViewFrame::onViewZoom()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
-}
-
-/*!
- Moves the active view
-*/
-void SUPERVGraph_ViewFrame::onViewPan()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
- if (myView != NULL)
- myView->ActivatePanning();
-}
-
-/*!
- Fits all obejcts within a rectangular area of the active view
-*/
-void SUPERVGraph_ViewFrame::onViewFitArea()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
-}
-
-/*!
- Fits all objects in the active view
-*/
-void SUPERVGraph_ViewFrame::onViewFitAll()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
-}
-
-/*!
- Set background of the viewport
-*/
-void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color)
-{
- if (myView)
- myView->setPaletteBackgroundColor(color);
-}
-
-/*!
- Returns background of the viewport
-*/
-QColor SUPERVGraph_ViewFrame::backgroundColor() const
-{
- if (myView)
- return myView->paletteBackgroundColor();
- return QMainWindow::backgroundColor();
-}
-
-
-void SUPERVGraph_ViewFrame::SetSelectionMode( Selection_Mode mode )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" )
-}
-
-void SUPERVGraph_ViewFrame::onAdjustTrihedron( )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
-}
-
-void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
-}
-
-void SUPERVGraph_ViewFrame::unHighlightAll()
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
-}
-
-void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
-}
-
-bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
- return false;
-}
-
-bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
- return false;
-}
-
-void SUPERVGraph_ViewFrame::setPopupServer( QAD_Application* App )
-{
- myApp = App;
- if (myView) {
- myView->setPopupServer(myApp);
- }
-}
-
-void SUPERVGraph_ViewFrame::undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
-}
-
-void SUPERVGraph_ViewFrame::redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry)
-{
- MESSAGE ( "SUPERVGraph_ViewFrame::redo" )
-}
-
+++ /dev/null
-// SALOME SUPERVGraph : build Supervisor viewer into desktop
-//
-// 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 : SUPERVGraph_ViewFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SUPERVGraph_ViewFrame_H
-#define SUPERVGraph_ViewFrame_H
-
-#include "QAD.h"
-#include "QAD_ViewFrame.h"
-#include "QAD_Application.h"
-
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Selection.h"
-
-class QAD_EXPORT SUPERVGraph_View: public QWidget, public QAD_PopupClientServer{
- Q_OBJECT;
- public:
- SUPERVGraph_View(QWidget* theParent);
- SUPERVGraph_View(SUPERVGraph_View* theParent);
-
- virtual void ActivatePanning() = 0;
- virtual void ResetView() = 0;
- protected:
- void init(QWidget* theParent);
- void onCreatePopup();
-};
-
-class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame {
- Q_OBJECT
-
- public:
- SUPERVGraph_ViewFrame(QWidget* parent, const char* name=0 );
- ~SUPERVGraph_ViewFrame();
-
- ViewType getTypeView() const{ return VIEW_GRAPHSUPERV;};
- SUPERVGraph_View* getViewWidget();
- void setViewWidget(SUPERVGraph_View* theView);
-
- void setBackgroundColor( const QColor& );
- QColor backgroundColor() const;
-
- void SetSelectionMode( Selection_Mode mode );
-
- void onAdjustTrihedron( );
-
- /* popup management */
- void setPopupServer( QAD_Application* );
-
- /* interactive object management */
- void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly = true );
- void unHighlightAll();
- void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
- bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
-
- /* undo/redo management */
- void undo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
- void redo(SALOMEDS::Study_var aStudy,
- const char* StudyFrameEntry);
-
-
- /* selection */
- Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
-
- /* display */
- void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
- void DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
- void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
- void DisplayAll(){};
- void EraseAll(){};
- void Repaint() {};
-
- public slots:
- void onViewPan();
- void onViewZoom();
- void onViewFitAll();
- void onViewFitArea();
- void onViewGlobalPan();
- void onViewRotate();
- void onViewReset();
- void onViewFront();
- void onViewBack();
- void onViewRight();
- void onViewLeft();
- void onViewBottom();
- void onViewTop();
- void onViewTrihedron();
-
- private:
- SUPERVGraph_View* myView;
- QAD_Application* myApp;
-};
-#endif
+++ /dev/null
-# SALOME Session : implementation of Session.idl
-#
-# 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 : Makefile.in
-# Author : Paul RASCLE, EDF
-# Module : SALOME
-# $Header$
-
-# source path
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS= SALOME_Session_i.hxx
-
-# Libraries targets
-LIB = libSalomeSession.la
-LIB_SRC=\
- SALOME_Session_i.cxx \
- Session_ServerThread.cxx \
- Session_ServerLauncher.cxx \
- SALOME_Session_SignalsHandler.cxx
-
-# Executables targets
-BIN = SALOME_Session_Server
-BIN_SRC =
-BIN_SERVER_IDL = SALOME_Session.idl
-BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES)
-CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) $(HDF5_LIBS) -lSalomeHDFPersist -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace -lSalomeContainer -lRegistry -lSalomeNotification -lSalomeDS -lTOOLSDS -lSalomeGenericObj -lSalomeCatalog -lEvent -lSalomePrs $(CAS_LDPATH) -lTKBO -lCASCatch -lSalomeResourcesManager
-LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
-
-@CONCLUDE@
-
+++ /dev/null
-// SALOME Session : implementation of Session.idl
-//
-// 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 : SALOME_Session_QThread.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include <qapplication.h>
-#include <qlabel.h>
-
-#include "utilities.h"
-#include "SALOME_Session_QThread.hxx"
-#include "SALOME_NamingService.hxx"
-#include "SALOMEGUI_Application.h"
-#include "QAD.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Tools.h"
-// only to use findFile method : perhaps put it in QAD_Tools ???
-#include "QAD_ResourceMgr.h"
-#include <qlabel.h>
-
-#include "Utils_CatchSignals.h"
-#include "Utils_CorbaException.hxx"
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-using namespace std;
-
-//=============================================================================
-/*! SALOME_Session_QThread
- * constructor
- */
-//=============================================================================
-
-SALOME_Session_QThread::SALOME_Session_QThread(int argc, char ** argv) : QThread()
-{
- _qappl = 0 ;
- _mw = 0 ;
- _argc = argc ;
- _argv = argv ;
- _NS = 0 ;
-}
-
-
-//=============================================================================
-/*! run
- * Creates one QApplication for the all the session life.
- * Executes the Qt main window of the GUI on a separate thread
- */
-//=============================================================================
-void SALOME_Session_QThread::run()
-{
- if (_qappl == 0)
- {
- _qappl = new QApplication(_argc, _argv );
- MESSAGE("creation QApplication");
- }
-
- QAD_ASSERT ( QObject::connect(_qappl, SIGNAL(lastWindowClosed()), _qappl, SLOT(quit()) ) );
- _mw = new SALOMEGUI_Application ( "MDTV-Standard", "HDF", "hdf" );
- MESSAGE("creation SALOMEGUI_Application");
-
- if ( !SALOMEGUI_Application::addToDesktop ( _mw, _NS ) )
- {
- QAD_MessageBox::error1 ( 0,
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_INITFAILED"),
- QObject::tr("BUT_OK") );
- }
- else
- {
-
- QFileInfo prgInfo(_argv[0]);
- QDir prgDir(prgInfo.dirPath(true));
- QAD_CONFIG->setPrgDir(prgDir); // CWD is program directory
- QAD_CONFIG->createConfigFile(false); // Create config file ~/.tr(MEN_APPNAME)/tr(MEN_APPNAME).conf if there's none
- QAD_CONFIG->readConfigFile(); // Read config file
-
- _qappl->setPalette( QAD_Application::getPalette() );
-
- Utils_CatchSignals aCatch;
- aCatch.Activate();
-
- /* Run 'SALOMEGUI' application */
- QAD_Application::run();
-
- // T2.12 - catch exceptions thrown on attempts to modified a locked study
- while (1) {
- try {
- MESSAGE("run(): starting the main event loop");
- _ret = _qappl->exec();
- break;
- }
- catch (SALOME::SALOME_Exception& e) {
- INFOS("run(): SALOME::SALOME_Exception is caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")+ QObject::tr(" SALOME::SALOME_Exception is caught") ,
- QObject::tr("BUT_OK") );
-
- }
- catch(SALOMEDS::StudyBuilder::LockProtection&) {
- INFOS("run(): An attempt to modify a locked study has not been handled by QAD_Operation");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- }
- catch (const CORBA::Exception& e) {
- CORBA::Any tmp;
- tmp<<= e;
- CORBA::TypeCode_var tc = tmp.type();
- const char *p = tc->name();
- INFOS ("run(): CORBA exception of the kind : "<<p<< " is caught");
-
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")+ QObject::tr(" CORBA exception ") + QObject::tr(p),
- QObject::tr("BUT_OK") );
- }
- catch(std::exception& e) {
- INFOS("run(): An exception has been caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")+ " " +QObject::tr(e.what()),
- QObject::tr("BUT_OK") );
- }
- catch(...) {
- INFOS("run(): An exception has been caught")
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION"),
- QObject::tr("BUT_OK") );
- }
- }
-
- aCatch.Deactivate();
- QString confMsg = "Settings create "
- + QAD_CONFIG->getConfigDir().absPath() + "/" + QObject::tr("MEN_APPNAME") + ".conf";
- MESSAGE (confMsg);
- QAD_CONFIG->createConfigFile(true);
- }
-}
-
-//=============================================================================
-/*! setNamingService
- * gives the naming service interface
- */
-//=============================================================================
-void SALOME_Session_QThread::setNamingService(SALOME_NamingService *ns)
-{
- _NS = ns;
-}
+++ /dev/null
-// SALOME Session : implementation of Session.idl
-//
-// 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 : SALOME_Session_QThread.hxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOME_SESSION_QTHREAD_HXX_
-#define _SALOME_SESSION_QTHREAD_HXX_
-
-#include <qthread.h>
-class QApplication;
-
-class SALOMEGUI_Application;
-class SALOME_NamingService;
-
-
-//! Qt thread class for the GUI
-class SALOME_Session_QThread: public QThread
-{
-
-public:
- SALOME_Session_QThread(int argc, char ** argv) ;
-
- //! launch the Qt main window of the GUI on a separate thread
- virtual void run() ;
-
- //! set the naming service
- void setNamingService(SALOME_NamingService *ns);
-
-protected:
- int _argc ;
- char ** _argv;
- int _ret ;
- SALOME_NamingService *_NS;
- QApplication *_qappl ;
-
- SALOMEGUI_Application* _mw ;
-} ;
-
-#endif
+++ /dev/null
-// SALOME Session : implementation of Session.idl
-//
-// 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 : SALOME_Session_Server.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "SALOME_NamingService.hxx"
-#include <iostream>
-#include <unistd.h>
-
-#include <qthread.h>
-#include <qapplication.h>
-#include <qlabel.h>
-#include <qwaitcondition.h>
-
-#include "SALOMEGUI_Application.h"
-#include "QAD.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Tools.h"
-#include "QAD_ResourceMgr.h"
-#include "Utils_SALOME_Exception.hxx"
-#include "Utils_CorbaException.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "SALOME_Event.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_Session)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-#include "utilities.h"
-#include "SALOMETraceCollector.hxx"
-
-#include "SALOME_Session_i.hxx"
-
-#include "Session_ServerLauncher.hxx"
-using namespace std;
-
-extern "C" int HandleSignals(QApplication *theQApplication);
-
-/*! - read arguments, define list of server to launch with their arguments.
- * - wait for naming service
- * - create and run a thread for launch of all servers
- *
- */
-
-//! CORBA server for SALOME Session
-/*!
- * SALOME_Session Server launches a SALOME session servant.
- * The servant registers to the Naming Service.
- * See SALOME_Session.idl for interface specification.
- *
- * Main services offered by the servant are:
- * - launch GUI
- * - stop Session (must be idle)
- * - get session state
- */
-
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-void MessageOutput( QtMsgType type, const char *msg )
-{
- switch ( type ) {
- case QtDebugMsg:
- MESSAGE( "Debug: " << msg );
- break;
- case QtWarningMsg:
- MESSAGE( "Warning: " << msg );
- break;
- case QtFatalMsg:
- MESSAGE( "Fatal: " << msg );
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- SALOME_Event::GetSessionThread();
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- int orbArgc = 1;
- CORBA::ORB_var &orb = init( orbArgc , argv ) ;
- SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- qInstallMsgHandler( MessageOutput );
- try
- {
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
-
- PortableServer::POAManager_var pman = poa->the_POAManager() ;
- pman->activate() ;
- INFOS("pman->activate()");
-
- SALOME_NamingService *_NS = new SALOME_NamingService(orb);
-
- // CORBA Servant Launcher
- QMutex _GUIMutex ;
- QWaitCondition _ServerLaunch;
- _GUIMutex.lock(); // to block Launch server thread until wait(mutex)
-
- Session_ServerLauncher* myServerLauncher
- = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch);
- myServerLauncher->start();
-
- QApplication *_qappl = 0;
-
- // Allow multiple activation/deactivation of GUI
- while ( 1 ) {
- MESSAGE("waiting wakeAll()");
- _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready:
- // atomic operation lock - unlock on mutex
- // unlock mutex: serverThread runs, calls _ServerLaunch->wakeAll()
- // this thread wakes up, and lock mutex
-
- INFOS("Session activated, Launch IAPP...");
-
- int qappArgc = 1;
- if ( !_qappl )
- _qappl = new QApplication(qappArgc, argv );
-
- INFOS("creation QApplication");
- _GUIMutex.unlock();
-
- QAD_ASSERT ( QObject::connect(_qappl, SIGNAL(lastWindowClosed()), _qappl, SLOT(quit()) ) );
- SALOMEGUI_Application* _mw = new SALOMEGUI_Application ( "MDTV-Standard", "HDF", "hdf" );
- INFOS("creation SALOMEGUI_Application");
-
- SCRUTE(_NS);
- if ( !SALOMEGUI_Application::addToDesktop ( _mw, _NS ) ) {
- QAD_MessageBox::error1 ( 0,
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_INITFAILED"),
- QObject::tr("BUT_OK") );
- }
- else {
- QFileInfo prgInfo(argv[0]);
- QDir prgDir(prgInfo.dirPath(true));
- QAD_CONFIG->setPrgDir(prgDir); // CWD is program directory
- QAD_CONFIG->createConfigFile(false); // Create config file
- // ~/.tr(MEN_APPNAME)/tr(MEN_APPNAME).conf if there's none
- QAD_CONFIG->readConfigFile(); // Read config file
-
- _qappl->setPalette( QAD_Application::getPalette() );
-
- /* Run 'SALOMEGUI' application */
- QAD_Application::run();
-
- // T2.12 - catch exceptions thrown on attempts to modified a locked study
- while (1) {
- try
- {
- MESSAGE("run(): starting the main event loop");
- int _ret = HandleSignals(_qappl);
- break;
- }
- catch (SALOME::SALOME_Exception& e)
- {
- QtCatchCorbaException(e);
- }
- catch(SALOMEDS::StudyBuilder::LockProtection&)
- {
- INFOS("run(): An attempt to modify a locked study has not been handled by QAD_Operation");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- }
- catch (const CORBA::Exception& e)
- {
- CORBA::Any tmp;
- tmp<<= e;
- CORBA::TypeCode_var tc = tmp.type();
- const char *p = tc->name();
- INFOS ("run(): CORBA exception of the kind : "<<p<< " is caught");
-
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")
- + QObject::tr(" CORBA exception ") + QObject::tr(p),
- QObject::tr("BUT_OK") );
- }
- catch(std::exception& e)
- {
- INFOS("run(): An exception has been caught " <<e.what() );
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION")+ "\n" +QObject::tr(e.what()),
- QObject::tr("BUT_OK") );
- }
- catch(...)
- {
- INFOS("run(): An exception has been caught");
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::error1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("ERR_ERROR"),
- QObject::tr("ERR_APP_EXCEPTION"),
- QObject::tr("BUT_OK") );
- }
- }
- QString confMsg = "Settings create "
- + QAD_CONFIG->getConfigDir().absPath() + "/" + QObject::tr("MEN_APPNAME") + ".conf";
- MESSAGE (confMsg);
- QAD_CONFIG->createConfigFile(true);
- }
-
- // Prepare _GUIMutex for a new GUI activation
- _GUIMutex.lock();
- }
-
- //orb->shutdown(0);
- myServerLauncher->KillAll();
- }
- catch (SALOME_Exception& e)
- {
- INFOS("run(): SALOME::SALOME_Exception is caught: "<<e.what());
- }
- catch (CORBA::SystemException& e)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch (CORBA::Exception& e)
- {
- INFOS("Caught CORBA::Exception.");
- CORBA::Any tmp;
- tmp<<= e;
- CORBA::TypeCode_var tc = tmp.type();
- const char *p = tc->name();
- INFOS ("run(): CORBA exception of the kind : "<<p<< " is caught");
- }
- catch(std::exception& e)
- {
- INFOS("run(): An exception has been caught: " <<e.what());
- }
- catch (...)
- {
- INFOS("Caught unknown exception.");
- }
- MESSAGE("End of SALOME_Session_Server");
- delete myThreadTrace;
- return 0 ;
-}
+++ /dev/null
-// 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
-
-
-#include <stdexcept>
-#include <qapplication.h>
-
-#include "CASCatch_SignalsHandler.h" // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-using namespace std;
-
-
-extern "C" int HandleSignals(QApplication *theQApplication)
-{
- CASCatch_SignalsHandler aSignalsHandler;
- int aRet = -1;
- try {
- aRet = theQApplication->exec();
- }catch(Standard_Failure){
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- throw std::runtime_error(aFail->GetMessageString());
- }
- return aRet;
-}
+++ /dev/null
-// SALOME Session : implementation of Session.idl
-//
-// 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 : SALOME_Session_i.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include "utilities.h"
-
-#include "SALOME_Session_i.hxx"
-#include "SALOME_NamingService.hxx"
-#include "SALOME_Event.hxx"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include <qapplication.h>
-
-// Open CASCADE Includes
-#include <OSD_SharedLibrary.hxx>
-#include <OSD_LoadMode.hxx>
-#include <OSD_Function.hxx>
-using namespace std;
-
-//=============================================================================
-/*! SALOME_Session_i
- * constructor
- */
-//=============================================================================
-
-SALOME_Session_i::SALOME_Session_i(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher)
-{
- _argc = argc ;
- _argv = argv ;
- _isGUI = FALSE ;
- _runningStudies= 0 ;
- _orb = CORBA::ORB::_duplicate(orb) ;
- _poa = PortableServer::POA::_duplicate(poa) ;
- _GUIMutex = GUIMutex;
- _GUILauncher = GUILauncher;
- //MESSAGE("constructor end");
-}
-
-//=============================================================================
-/*! GetVisuComponent
- * returns Visu component
- */
-//=============================================================================
-
-Engines::Component_ptr SALOME_Session_i::GetVisuComponent()
-{
- //MESSAGE("SALOME_Session_i::GetVisuGen");
- typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
- PortableServer::POA_ptr,
- SALOME_NamingService*,QMutex*);
- OSD_SharedLibrary aSharedLibrary("libVISUEngineImpl.so");
- if(aSharedLibrary.DlOpen(OSD_RTLD_LAZY))
- if(OSD_Function anOSDFun = aSharedLibrary.DlSymb("GetImpl"))
- return ((TGetImpl (*)) anOSDFun)(_orb,_poa,_NS,_GUIMutex);
- return Engines::Component::_nil();
-}
-
-//=============================================================================
-/*! ~SALOME_Session_i
- * destructor
- */
-//=============================================================================
-
-SALOME_Session_i::~SALOME_Session_i()
-{
- //MESSAGE("destructor end");
-}
-
-//=============================================================================
-/*! NSregister
- * tries to find the Corba Naming Service and to register the session,
- * gives naming service interface to _IAPPThread
- */
-//=============================================================================
-
-void SALOME_Session_i::NSregister()
-{
- SALOME::Session_ptr pSession = SALOME::Session::_narrow(_this());
- try
- {
- _NS = new SALOME_NamingService(_orb);
- _NS->Register(pSession, "/Kernel/Session");
- }
- catch (ServiceUnreachable&)
- {
- INFOS("Caught exception: Naming Service Unreachable");
- exit(1) ;
- }
- catch (...)
- {
- INFOS("Caught unknown exception from Naming Service");
- }
- //MESSAGE("Session registered in Naming Service");
-}
-
-//=============================================================================
-/*! GetInterface
- * Launches the GUI if there is none.
- * The Corba method is oneway (corba client does'nt wait for GUI completion)
- */
-//=============================================================================
-
-void SALOME_Session_i::GetInterface()
-{
- if( !QAD_Application::getDesktop() ) {
- _GUILauncher->wakeAll();
- MESSAGE("SALOME_Session_i::GetInterface() called, starting GUI...")
- }
-}
-
-//=============================================================================
-/*! StopSession
- * Kills the session if there are no active studies nore GUI
- */
-//=============================================================================
-class CloseEvent : public SALOME_Event
-{
-public:
- virtual void Execute() {
- if ( QAD_Application::getDesktop() )
- QAD_Application::getDesktop()->closeDesktop( true );
- }
-};
-
-void SALOME_Session_i::StopSession()
-{
- ProcessVoidEvent( new CloseEvent() );
-}
-
-//=============================================================================
-/*! StatSession
- * Send a SALOME::StatSession structure (see idl) to the client
- * (number of running studies and presence of GUI)
- */
-//=============================================================================
-
-class QtLock
-{
-public:
- QtLock() { if ( qApp ) qApp->lock(); }
- ~QtLock() { if ( qApp ) qApp->unlock(); }
-};
-
-
-SALOME::StatSession SALOME_Session_i::GetStatSession()
-{
- // update Session state
- _GUIMutex->lock();
-
- _runningStudies = 0;
- {
- QtLock lock;
- _isGUI = QAD_Application::getDesktop();
- if ( _isGUI && QAD_Application::getDesktop()->getActiveApp() )
- _runningStudies = QAD_Application::getDesktop()->getActiveApp()->getStudies().count();
- }
-
- _GUIMutex->unlock();
-
- // getting stat info
- SALOME::StatSession_var myStats = new SALOME::StatSession ;
- if (_runningStudies)
- myStats->state = SALOME::running ;
- else
- myStats->state = SALOME::asleep ;
- myStats->runningStudies = _runningStudies ;
- myStats->activeGUI = _isGUI ;
- return myStats._retn() ;
-}
-
-CORBA::Long SALOME_Session_i::GetActiveStudyId()
-{
- long aStudyId=-1;
- if( QAD_Application::getDesktop() && QAD_Application::getDesktop()->getActiveStudy()) {
- aStudyId = QAD_Application::getDesktop()->getActiveStudy()->getStudyId();
- }
- return aStudyId;
-}
+++ /dev/null
-// SALOME Session : implementation of Session.idl
-//
-// 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 : SALOME_Session_i.hxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOME_SESSION_I_HXX_
-#define _SALOME_SESSION_I_HXX_
-
-#include <qthread.h>
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_Component)
-#include CORBA_SERVER_HEADER(SALOME_Session)
-class SALOME_NamingService;
-class SALOME_Session_QThread;
-
-class SALOME_Session_i: public virtual POA_SALOME::Session,
- public virtual PortableServer::RefCountServantBase
-{
-public:
- SALOME_Session_i(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher);
- ~SALOME_Session_i();
-
- //! Launch Graphical User Interface
- void GetInterface();
-
- //! Return VISU component
- Engines::Component_ptr GetVisuComponent();
-
- //! Stop the Session (must be idle): kill servant & server
- void StopSession();
-
- //! Get session state
- SALOME::StatSession GetStatSession();
-
- //! Register the servant to Naming Service
- void NSregister();
-
- CORBA::Long GetActiveStudyId();
-
- void ping(){};
-
-protected:
-
- //! Naming service interface
- SALOME_NamingService *_NS;
-
- int _argc ;
- char **_argv;
- CORBA::Boolean _isGUI ;
- QMutex* _GUIMutex ;
- QWaitCondition* _GUILauncher;
- int _runningStudies ;
- CORBA::ORB_var _orb;
- PortableServer::POA_var _poa;
-};
-
-#endif
-
+++ /dev/null
-// SALOME Session : implementation of Session_ServerLauncher.cxx
-//
-// 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 : Session_ServerLauncher.xx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#include "Session_ServerLauncher.hxx"
-
-#include "Utils_SALOME_Exception.hxx"
-#include "utilities.h"
-using namespace std;
-
-//=============================================================================
-/*!
- * default constructor not for use
- */
-//=============================================================================
-
-Session_ServerLauncher::Session_ServerLauncher()
-{
- ASSERT(0); // must not be called
-}
-
-//=============================================================================
-/*!
- * constructor
- */
-//=============================================================================
-
-Session_ServerLauncher::Session_ServerLauncher(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex,
- QWaitCondition *ServerLaunch)
-{
- _argc = argc;
- _argv = argv;
- _orb = CORBA::ORB::_duplicate(orb);
- _root_poa = PortableServer::POA::_duplicate(poa);
- _GUIMutex = GUIMutex;
- _ServerLaunch = ServerLaunch;
-}
-
-//=============================================================================
-/*!
- * destructor
- */
-//=============================================================================
-
-Session_ServerLauncher::~Session_ServerLauncher()
-{
-}
-
-//=============================================================================
-/*!
- * Check args and activate servers
- */
-//=============================================================================
-
-void Session_ServerLauncher::run()
-{
- //MESSAGE("Session_ServerLauncher::run");
- _GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex)
- //MESSAGE("Server Launcher thread free to go...");
- _GUIMutex->unlock();
-
- CheckArgs();
- ActivateAll();
-
- _orb->run(); // this thread wait, during omniORB process events
-}
-
-//=============================================================================
-/*!
- * controls and dispatchs arguments given with command
- */
-//=============================================================================
-
-void Session_ServerLauncher::CheckArgs()
-{
- int argState = 0;
- ServArg aServArg(0,0,0);
- _argCopy.reserve(_argc);
- for (int iarg=0; iarg <_argc; iarg++)
- {
- SCRUTE(iarg);
- SCRUTE(_argv[iarg]);
- _argCopy.push_back(_argv[iarg]);
- switch (argState)
- {
- case 0: // looking for "--with"
- {
- if (strcmp(_argv[iarg],"--with")==0)
- argState = 1;
- break;
- }
- case 1: // looking for server type
- {
- for (int i=0; i<Session_ServerThread::NB_SRV_TYP; i++)
- if (strcmp(_argv[iarg],Session_ServerThread::_serverTypes[i])==0)
- {
- aServArg._servType = i;
- argState = 2;
- break;
- }
- break;
- }
- case 2: // looking for "("
- {
- if (strcmp(_argv[iarg],"(")!=0)
- {
- INFOS("parenthesis '(' is required here...");
- for (int i=0; i<iarg; i++)
- cerr << _argv[i] << " ";
- cerr << endl;
- throw SALOME_Exception(LOCALIZED("Error in command arguments, missing prenthesis"));
- }
- else
- {
- aServArg._firstArg=iarg+1; // arg after '('
- argState = 3;
- }
- break;
- }
- case 3: // looking for arguments
- {
- if (strcmp(_argv[iarg],")")==0) // end of arguments = ')'
- {
- aServArg._lastArg=iarg-1; // arg before ')'
- MESSAGE("server : "<< Session_ServerThread::_serverTypes[aServArg._servType]);
- for (int i=aServArg._firstArg; i<=aServArg._lastArg; i++)
- MESSAGE(" arg : " << _argCopy[i]);
- _argServToLaunch.push_back(aServArg);
- argState = 0;
- }
- break;
- }
- default:
- {
- ASSERT(0);
- break;
- }
- }
- }
- if (argState == 1)
- throw SALOME_Exception(LOCALIZED("Error in command arguments, missing server type"));
- if (argState == 2)
- throw SALOME_Exception(LOCALIZED("Error in command arguments, missing parenthesis '('"));
- if (argState == 3)
- throw SALOME_Exception(LOCALIZED("Error in command arguments, missing parenthesis ')'"));
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerLauncher::ActivateAll()
-{
-
- // Always launch ContainerManager
-
- char** argv = new char* [1];
- argv[0] = "ContainerManager";
- Session_SessionThread* aServerThread2
- = new Session_SessionThread(1, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
- _serverThreads.push_front(aServerThread2);
-
- aServerThread2->Init();
-
- list<ServArg>::iterator itServ;
- for (itServ = _argServToLaunch.begin(); itServ !=_argServToLaunch.end(); itServ++)
- {
- int argc = 2 + (*itServ)._lastArg - (*itServ)._firstArg;
- char** argv = new char*[argc+1];
- argv[argc]=0; // for Engines_Container_i constructor...
- int servType = (*itServ)._servType;
- argv[0]=strdup(Session_ServerThread::_serverTypes[servType]);
- if (argc>1)
- {
- for (int i=0; i<argc-1; i++)
- //argv[i+1] = _argCopy[(*itServ)._firstArg + i].c_str();
- argv[i+1] = _argv[(*itServ)._firstArg + i];
- }
- Session_ServerThread* aServerThread
- = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
- _serverThreads.push_front(aServerThread);
-
- aServerThread->Init();
- }
-
- // Always launch Session Server
-
- int argc=1;
- argv = new char*[argc];
- argv[0] = "Session";
- Session_SessionThread* aServerThread
- = new Session_SessionThread(argc, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
- _serverThreads.push_front(aServerThread);
-
- aServerThread->Init();
-}
-
-//=============================================================================
-/*!
- * Destruction des classes serveur dans l'ordre inverse de creation
- */
-//=============================================================================
-
-void Session_ServerLauncher::KillAll()
-{
- MESSAGE("Session_ServerLauncher::KillAll()");
- list<Session_ServerThread*>::reverse_iterator itServ;
- for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++)
- {
- delete (*itServ);
- }
-}
+++ /dev/null
-// SALOME Session : implementation of Session_ServerLauncher.hxx
-//
-// 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 : Session_ServerLauncher.hxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _SESSION_SERVERLAUNCHER_HXX_
-#define _SESSION_SERVERLAUNCHER_HXX_
-
-#include "Session_ServerThread.hxx"
-
-#include <CORBA.h>
-#include <list>
-#include <vector>
-#include <string>
-#include <qthread.h>
-#include <qwaitcondition.h>
-
-
-class ServArg
- {
- public:
- int _servType;
- int _firstArg;
- int _lastArg;
- inline ServArg(int servType=0, int firstArg=0, int lastArg=0);
-};
-
-inline ServArg::ServArg(int servType, int firstArg, int lastArg):
- _servType(servType),_firstArg(firstArg),_lastArg(lastArg)
-{}
-
-class Session_ServerLauncher: public QThread
-{
-public:
- Session_ServerLauncher();
- Session_ServerLauncher(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex,
- QWaitCondition *ServerLaunch);
- virtual ~Session_ServerLauncher();
- void run();
- void KillAll();
-
-protected:
- void CheckArgs();
- void ActivateAll();
-
-private:
- int _argc;
- char ** _argv;
- CORBA::ORB_var _orb;
- PortableServer::POA_var _root_poa;
- QMutex* _GUIMutex;
- QWaitCondition *_ServerLaunch;
- std::list<ServArg> _argServToLaunch;
- std::vector<std::string> _argCopy;
- std::list<Session_ServerThread*> _serverThreads;
-};
-
-#endif
-
+++ /dev/null
-// SALOME Session : implementation of Session_ServerThread.cxx
-//
-// 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 : Session_ServerThread.cxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-// #include <SALOMEconfig.h>
-// #include CORBA_SERVER_HEADER(SALOME_Session)
-// #include CORBA_SERVER_HEADER(SALOMEDS)
-
-#include "Session_ServerThread.hxx"
-
-#include "SALOME_Container_i.hxx"
-#include "SALOME_ContainerManager.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
-#include "SALOME_ModuleCatalog_impl.hxx"
-#include "RegistryService.hxx"
-#include "SALOME_Session_i.hxx"
-
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_SALOME_Exception.hxx"
-#include "OpUtil.hxx"
-#include "NamingService_WaitForServerReadiness.hxx"
-#include "utilities.h"
-
-#include <cstdlib>
-#include <ctime>
-
-using namespace std;
-
-const int Session_ServerThread::NB_SRV_TYP = 6;
-const char* Session_ServerThread::_serverTypes[NB_SRV_TYP] = {"Container",
- "ModuleCatalog",
- "Registry",
- "SALOMEDS",
- "Session",
- "ContainerManager"};
-
-//=============================================================================
-/*!
- * default constructor not for use
- */
-//=============================================================================
-
-Session_ServerThread::Session_ServerThread()
-{
- ASSERT(0); // must not be called
-}
-
-//=============================================================================
-/*!
- * constructor
- */
-//=============================================================================
-
-Session_ServerThread::Session_ServerThread(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex)
-{
- //MESSAGE("Session_ServerThread Constructor " << argv[0]);
- _argc = argc;
- _argv = argv;
- _orb = CORBA::ORB::_duplicate(orb);
- _root_poa = PortableServer::POA::_duplicate(poa);
- _GUIMutex = GUIMutex;
- _servType =-1;
- _NS = new SALOME_NamingService(_orb); // one instance per server to limit
- // multi thread coherence problems
-}
-
-//=============================================================================
-/*!
- * destructor
- */
-//=============================================================================
-
-Session_ServerThread::~Session_ServerThread()
-{
- //MESSAGE("~Session_ServerThread "<< _argv[0]);
-}
-
-//=============================================================================
-/*!
- * run the thread : activate one servant, the servant type is given by
- * argument _argv[0]
- */
-//=============================================================================
-
-void Session_ServerThread::Init()
-{
- MESSAGE("Session_ServerThread::Init "<< _argv[0]);
-
- for (int i=0; i<_argc; i++) SCRUTE(_argv[i]);
- for (int i=0; i<NB_SRV_TYP; i++)
- if (strcmp(_argv[0],_serverTypes[i])==0)
- {
- _servType = i;
- MESSAGE("Server Thread type : "<<_serverTypes[i]);
- switch (_servType)
- {
- case 0: // Container
- {
- NamingService_WaitForServerReadiness(_NS,"/Registry");
- NamingService_WaitForServerReadiness(_NS,"/ContainerManager");
- ActivateContainer(_argc, _argv);
- break;
- }
- case 1: // ModuleCatalog
- {
- NamingService_WaitForServerReadiness(_NS,"/Registry");
- ActivateModuleCatalog(_argc, _argv);
- break;
- }
- case 2: // Registry
- {
- NamingService_WaitForServerReadiness(_NS,"");
- ActivateRegistry(_argc, _argv);
- break;
- }
- case 3: // SALOMEDS
- {
- NamingService_WaitForServerReadiness(_NS,"/Kernel/ModulCatalog");
- ActivateSALOMEDS(_argc, _argv);
- break;
- }
- case 4: // Session
- {
- NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
- string containerName = "/Containers/";
- containerName = containerName + GetHostname();
- containerName = containerName + "/FactoryServer";
- NamingService_WaitForServerReadiness(_NS,containerName);
- ActivateSession(_argc, _argv);
- break;
- }
- case 5: // Container Manager
- {
- NamingService_WaitForServerReadiness(_NS,"");
- ActivateContainerManager(_argc, _argv);
- break;
- }
- default:
- {
- ASSERT(0);
- break;
- }
- }
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateModuleCatalog(int argc,
- char ** argv)
-{
- try
- {
- INFOS("ModuleCatalog thread started");
- // allocation on heap to allow destruction by POA
-
- SALOME_ModuleCatalogImpl* Catalogue_i
- = new SALOME_ModuleCatalogImpl(argc, argv);
-
- // Tell the POA that the objects are ready to accept requests.
-
- _root_poa->activate_object (Catalogue_i);
-
- CORBA::Object_ptr myCata = Catalogue_i->_this();
- _NS->Register(myCata ,"/Kernel/ModulCatalog");
- }
- catch(CORBA::SystemException&)
- {
- INFOS( "Caught CORBA::SystemException." );
- }
- catch(CORBA::Exception&)
- {
- INFOS( "Caught CORBA::Exception." );
- }
- catch(omniORB::fatalException& fe)
- {
- INFOS( "Caught omniORB::fatalException:" );
- INFOS( " file: " << fe.file() );
- INFOS( " line: " << fe.line() );
- INFOS( " mesg: " << fe.errmsg() );
- }
- catch(...)
- {
- INFOS( "Caught unknown exception." );
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateSALOMEDS(int argc,
- char ** argv)
-{
- try
- {
- INFOS("SALOMEDS thread started");
- // We allocate the objects on the heap. Since these are reference
- // counted objects, they will be deleted by the POA when they are no
- // longer needed.
-
- SALOMEDS_StudyManager_i * myStudyManager_i
- = new SALOMEDS_StudyManager_i(_orb,_root_poa);
-
- // Activate the objects. This tells the POA that the objects are
- // ready to accept requests.
-
- PortableServer::ObjectId_var myStudyManager_iid
- = _root_poa->activate_object(myStudyManager_i);
- myStudyManager_i->register_name("/myStudyManager");
- }
- catch(CORBA::SystemException&)
- {
- INFOS( "Caught CORBA::SystemException." );
- }
- catch(CORBA::Exception&)
- {
- INFOS( "Caught CORBA::Exception." );
- }
- catch(omniORB::fatalException& fe)
- {
- INFOS( "Caught omniORB::fatalException:" );
- INFOS( " file: " << fe.file() );
- INFOS( " line: " << fe.line() );
- INFOS( " mesg: " << fe.errmsg() );
- }
- catch(...)
- {
- INFOS( "Caught unknown exception." );
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateRegistry(int argc,
- char ** argv)
-{
- INFOS("Registry thread started");
- SCRUTE(argc);
- if( argc<3 )
- {
- INFOS("you must provide the Salome session name when you call SALOME_Registry_Server");
- throw CommException("you must provide the Salome session name when you call SALOME_Registry_Server");
- }
- const char *ptrSessionName=0;
-
- int k=0 ;
- for ( k=1 ; k<argc ; k++ )
- {
- if( strcmp(argv[k],"--salome_session")==0 )
- {
- ptrSessionName=argv[k+1];
- break;
- }
- }
- ASSERT(ptrSessionName) ;
- ASSERT(strlen( ptrSessionName )>0);
- const char *registryName = "Registry";
- Registry::Components_var varComponents;
- try
- {
- RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance();
- ptrRegistry->SessionName( ptrSessionName );
- varComponents = ptrRegistry->_this();
- // The RegistryService must not already exist.
-
- try
- {
- CORBA::Object_var pipo = _NS->Resolve( registryName );
- if (CORBA::is_nil(pipo) ) throw ServiceUnreachable();
- INFOS("RegistryService servant already existing" );
- ASSERT(0);
- }
- catch( const ServiceUnreachable &ex )
- {
- }
- catch( const CORBA::Exception &exx )
- {
- }
- string absoluteName = string("/") + registryName;
- _NS->Register( varComponents , absoluteName.c_str() );
- MESSAGE("On attend les requetes des clients");
- }
- catch( const SALOME_Exception &ex )
- {
- INFOS( "Communication Error : " << ex.what() );
- ASSERT(0);
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateContainerManager(int argc,
- char ** argv)
-{
- try
- {
- PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
- cout << "ActivateContainerManager ......!!!! " << endl;
- SALOME_ContainerManager * myContainer
- = new SALOME_ContainerManager(_orb);
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch(PortableServer::POA::WrongPolicy&)
- {
- INFOS("Caught CORBA::WrongPolicyException.");
- }
- catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException");
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateContainer(int argc,
- char ** argv)
-{
- try
- {
- INFOS("Container thread started");
-
- // get or create the child POA
-
- PortableServer::POA_var factory_poa;
- try
- {
- factory_poa = _root_poa->find_POA("factory_poa",0);
- // 0 = no activation (already done if exists)
- }
- catch (PortableServer::POA::AdapterNonExistent&)
- {
- INFOS("factory_poa does not exists, create...");
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- _root_poa->create_implicit_activation_policy(
- PortableServer::NO_IMPLICIT_ACTIVATION);
- // default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- _root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
- // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-
- // create policy list
- CORBA::PolicyList policyList;
- policyList.length(2);
- policyList[0] = PortableServer::ImplicitActivationPolicy::
- _duplicate(implicitActivation);
- policyList[1] = PortableServer::ThreadPolicy::
- _duplicate(threadPolicy);
-
- PortableServer::POAManager_var nil_mgr
- = PortableServer::POAManager::_nil();
- factory_poa = _root_poa->create_POA("factory_poa",
- nil_mgr,
- policyList);
- //with nil_mgr instead of pman,
- //a new POA manager is created with the new POA
-
- // destroy policy objects
- implicitActivation->destroy();
- threadPolicy->destroy();
-
- // obtain the factory poa manager
- PortableServer::POAManager_var pmanfac = factory_poa->the_POAManager();
- pmanfac->activate();
- MESSAGE("pmanfac->activate()");
- }
-
- char *containerName = "";
- if (argc >1)
- {
- containerName = argv[1];
- }
-
- Engines_Container_i * myContainer
- = new Engines_Container_i(_orb, factory_poa, containerName , argc , argv , true , false);
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch(PortableServer::POA::WrongPolicy&)
- {
- INFOS("Caught CORBA::WrongPolicyException.");
- }
- catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException");
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-void Session_ServerThread::ActivateSession(int argc,
- char ** argv)
-{
- MESSAGE("Session_ServerThread::ActivateSession() not implemented!");
-}
-
-Session_SessionThread::Session_SessionThread(int argc,
- char** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher)
-: Session_ServerThread(argc, argv, orb, poa, GUIMutex),
- _GUILauncher( GUILauncher )
-{
-}
-
-Session_SessionThread::~Session_SessionThread()
-{
-}
-
-void Session_SessionThread::ActivateSession(int argc,
- char ** argv)
-{
- try
- {
- INFOS("Session thread started");
- SALOME_Session_i * mySALOME_Session
- = new SALOME_Session_i(argc, argv, _orb, _root_poa, _GUIMutex, _GUILauncher) ;
- PortableServer::ObjectId_var mySALOME_Sessionid
- = _root_poa->activate_object(mySALOME_Session);
- INFOS("poa->activate_object(mySALOME_Session)");
-
- CORBA::Object_var obj = mySALOME_Session->_this();
- CORBA::String_var sior(_orb->object_to_string(obj));
-
- mySALOME_Session->NSregister();
- }
- catch (CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch (CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch (...)
- {
- INFOS("Caught unknown exception.");
- }
-}
+++ /dev/null
-// SALOME Session : implementation of Session_ServerThread.hxx
-//
-// 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 : Session_ServerThread.hxx
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-
-#ifndef _SESSION_SERVERTHREAD_HXX_
-#define _SESSION_SERVERTHREAD_HXX_
-
-#include <CORBA.h>
-
-#include "SALOME_NamingService.hxx"
-#include <qthread.h>
-
-
-class Session_ServerThread
-{
-public:
- static const int NB_SRV_TYP;
- static const char* _serverTypes[];
-
- Session_ServerThread();
- Session_ServerThread(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex);
- virtual ~Session_ServerThread();
- void Init();
-protected:
- void ActivateModuleCatalog(int argc,
- char ** argv);
- void ActivateSALOMEDS(int argc,
- char ** argv);
- void ActivateRegistry(int argc,
- char ** argv);
- void ActivateContainer(int argc,
- char ** argv);
- void ActivateContainerManager(int argc,
- char ** argv);
- virtual void ActivateSession(int argc,
- char ** argv);
-
-protected:
- int _argc;
- char ** _argv;
- int _servType;
- CORBA::ORB_var _orb;
- PortableServer::POA_var _root_poa;
- QMutex* _GUIMutex;
- SALOME_NamingService *_NS;
-};
-
-class Session_SessionThread : public Session_ServerThread
-{
-public:
- Session_SessionThread() {}
- Session_SessionThread(int argc,
- char** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher);
- virtual ~Session_SessionThread();
-
-protected:
- virtual void ActivateSession(int argc,
- char ** argv);
-private:
- QWaitCondition* _GUILauncher;
-};
-
-#endif
-
+++ /dev/null
-export SALOME_HOME_DIR=`pwd`
-export ORB_HOME_DIR=${HOME}/public/omni
-
-# OCAF
-export CSF_PluginDefaults=${SALOME_HOME_DIR}/../resources
-export CSF_ResourcesDefaults=${SALOME_HOME_DIR}/../resources
-
-export CSF_SALOMEGUIResources=${SALOME_HOME_DIR}/../SALOME/resources
-export CSF_SALOMEGUILanguage=en
-export CSF_QADResources=${SALOME_HOME_DIR}/../SALOME/resources
-export CSF_QADLanguage=en
-
-export CSF_CatalogueResources=${SALOME_HOME_DIR}/../resources
-
-export CSF_GeometryResources=${SALOME_HOME_DIR}/../GEOM/resources
-
-export CSF_MeshResources=${SALOME_HOME_DIR}/../MESH/resources
-
-export CSF_PATHComponents=${SALOME_HOME_DIR}/../lib
-
-export LD_LIBRARY_PATH=${SALOME_HOME_DIR}/../lib/:${LD_LIBRARY_PATH}
-
-runNS.sh
-geom&
-mesh&
-SALOME_Session_Server
-
+++ /dev/null
-# SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-#
-# 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 : Makefile.in
-# Author : Marc Tajchman (CEA)
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS = ToolsGUI.h
-
-# .po files to transform in .qm
-PO_FILES = \
- ToolsGUI_icons.po \
- ToolsGUI_msg_en.po
-
-# Libraries targets
-LIB = libToolsGUI.la
-
-LIB_SRC = ToolsGUI.cxx \
- ToolsGUI_CatalogGeneratorDlg.cxx
-
-LIB_MOC = ToolsGUI_CatalogGeneratorDlg_moc.cxx
-
-LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl \
- SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Exception.idl
-
-# additionnal information to compil and link file
-
-CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES)
-CXXFLAGS += $(OCC_CXXFLAGS)
-
-LDFLAGS += -lSalomeGUI
-
-
-@CONCLUDE@
-
+++ /dev/null
-// SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-//
-// 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 : ToolsGUI.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "ToolsGUI.h"
-#include "ToolsGUI_CatalogGeneratorDlg.h"
-
-#include "utilities.h"
-
-#include <stdlib.h>
-
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-using namespace std;
-
-//============================================================================
-// function : runCommand
-// purpose : Run command
-//============================================================================
-int ToolsGUI::runCommand(string & arg)
-{
- int res;
- res = system( arg.c_str() );
-
- if ( res == -1 )
- MESSAGE( "fork failed (system command result = 0x" << hex << res << ")" << dec )
- else
- if ( res == 217 )
- MESSAGE( "shell exec failed (system command result = 0x" << hex << res << ")" << dec )
- return res;
-}
-
-//============================================================================
-// function : OnGUIEvent
-// purpose : Process events
-//============================================================================
-bool ToolsGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
-{
- switch ( theCommandID )
- {
- case 5102 :
- {
- ToolsGUI_CatalogGeneratorDlg* aDlg = new ToolsGUI_CatalogGeneratorDlg( parent );
- aDlg->exec();
- delete aDlg;
- break;
- }
-
- default:
- MESSAGE ( " No command associated with this id = " << theCommandID )
- break;
- }
- return true;
-}
-
-extern "C"
-{
- bool OnGUIEvent( int theCommandID, QAD_Desktop* parent )
- {
- return ToolsGUI::OnGUIEvent(theCommandID, parent);
- }
-}
-
-//=======================================================================
-// name : GetVisibility
-// Purpose : Verify whether object is visible or not
-//=======================================================================
-bool ToolsGUI::GetVisibility( SALOMEDS::Study_var theStudy,
- SALOMEDS::SObject_var theObj,
- void* theId )
-{
- SALOMEDS::GenericAttribute_var anAttr;
- if ( !theObj->_is_nil() && theObj->FindAttribute( anAttr, "AttributeGraphic" ) )
- {
- SALOMEDS::AttributeGraphic_var aGraphic =
- SALOMEDS::AttributeGraphic::_narrow( anAttr );
- return aGraphic->GetVisibility( (unsigned long)theId );
- }
-
- return false;
-}
-
-//=======================================================================
-// name : SetVisibility
-// Purpose : Set flag visibility of object
-//=======================================================================
-bool ToolsGUI::SetVisibility( SALOMEDS::Study_var theStudy,
- const char* theEntry,
- const bool theValue,
- void* theId )
-{
- SALOMEDS::SObject_var anObj = theStudy->FindObjectID( theEntry );
-
- if ( !anObj->_is_nil() )
- {
- SALOMEDS::GenericAttribute_var aGAttr;
- if ( anObj->FindAttribute( aGAttr, "AttributeGraphic" ) )
- {
- SALOMEDS::AttributeGraphic_var anAttr = SALOMEDS::AttributeGraphic::_narrow( aGAttr );
- anAttr->SetVisibility( (unsigned long)theId, theValue );
- }
- else if ( theValue )
- {
- SALOMEDS::StudyBuilder_var aBuilder = theStudy->NewBuilder();
- SALOMEDS::AttributeGraphic_var anAttr = SALOMEDS::AttributeGraphic::_narrow(
- aBuilder->FindOrCreateAttribute( anObj, "AttributeGraphic" ) );
- anAttr->SetVisibility( (unsigned long)theId, theValue );
- }
- return true;
- }
-
- return false;
-}
-
-
-
-
-
-
+++ /dev/null
-// SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-//
-// 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 : ToolsGUI.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef ToolsGUI_HeaderFile
-#define ToolsGUI_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#include "QAD_Desktop.h"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-class Standard_EXPORT ToolsGUI
-{
-
-public :
-
- static int runCommand( string& );
- static bool OnGUIEvent( int theCommandID, QAD_Desktop* parent );
-
- static bool GetVisibility( SALOMEDS::Study_var theStudy,
- SALOMEDS::SObject_var theObj,
- void* theId );
- static bool SetVisibility( SALOMEDS::Study_var theStudy,
- const char* theEntry,
- const bool theValue,
- void* theId );
-};
-
-#endif
+++ /dev/null
-// SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-//
-// 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 : ToolsGUI_CatalogGeneratorDlg.cxx
-// Author : Nicolas REJNERI
-// Modified : Marc TAJCHMAN
-// Module : SALOME
-// $Header$
-
-#include "ToolsGUI_CatalogGeneratorDlg.h"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Tools.h"
-#include <stdlib.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qstringlist.h>
-#include <qregexp.h>
-#include <qvalidator.h>
-
-#include <OSD_Process.hxx>
-#include <OSD_Path.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_CString.hxx>
-
-#include "utilities.h"
-
-using namespace std;
-
-#define SPACING_SIZE 6
-#define MARGIN_SIZE 11
-#define MIN_EDIT_SIZE 250
-
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg()
-// purpose : Constructor
-//=================================================================================
-ToolsGUI_CatalogGeneratorDlg::ToolsGUI_CatalogGeneratorDlg( QWidget* parent, const char* name )
- : QDialog( parent, name, TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "ToolsGUI_CatalogGeneratorDlg" );
- resize( 322, 120 );
- setCaption( tr( "TOOLS_CATALOG_GENERATOR" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* aTopLayout = new QGridLayout(this);
- aTopLayout->setMargin(MARGIN_SIZE);
- aTopLayout->setSpacing(SPACING_SIZE);
-
- QGroupBox* filesGrp = new QGroupBox( tr( "TOOLS_FILES") , this, "filesGrp" );
- filesGrp->setColumnLayout( 0, Qt::Vertical );
- filesGrp->layout()->setSpacing( 0 );
- filesGrp->layout()->setMargin( 0 );
- QGridLayout* filesGrpLayout = new QGridLayout( filesGrp->layout() );
- filesGrpLayout->setAlignment( Qt::AlignTop );
- filesGrpLayout->setSpacing( SPACING_SIZE );
- filesGrpLayout->setMargin( MARGIN_SIZE );
-
- myIdlEdit = new QLineEdit( filesGrp, "myIdlEdit" );
- myIdlEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myIdlEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
- myXmlEdit = new QLineEdit( filesGrp, "myXmlEdit" );
- myXmlEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myXmlEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
-
- myBrowseIdlBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), filesGrp, "myBrowseIdlBtn" );
- myBrowseXmlBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), filesGrp, "myBrowseXmlBtn" );
-// QFontMetrics fm(myBrowseIdlBtn->font());
-// myBrowseIdlBtn->setFixedWidth(fm.width(myBrowseIdlBtn->text()) + 10);
-// myBrowseXmlBtn->setFixedWidth(fm.width(myBrowseXmlBtn->text()) + 10);
-
- filesGrpLayout->addWidget( new QLabel( tr( "TOOLS_IDL_FILE" ), filesGrp ), 0, 0);
- filesGrpLayout->addWidget( myIdlEdit, 0, 1 );
- filesGrpLayout->addWidget( myBrowseIdlBtn, 0, 2 );
- filesGrpLayout->addWidget( new QLabel( tr( "TOOLS_XML_FILE" ), filesGrp ), 1, 0);
- filesGrpLayout->addWidget( myXmlEdit, 1, 1 );
- filesGrpLayout->addWidget( myBrowseXmlBtn, 1, 2 );
-
- QGroupBox* supplGrp = new QGroupBox(tr( "TOOLS_SUPPLEMENT" ) , this, "SupplGrp" );
- supplGrp->setColumnLayout( 0, Qt::Vertical );
- supplGrp->layout()->setSpacing( 0 );
- supplGrp->layout()->setMargin( 0 );
- QGridLayout* supplGrpLayout = new QGridLayout( supplGrp->layout() );
- supplGrpLayout->setAlignment( Qt::AlignTop );
- supplGrpLayout->setSpacing( SPACING_SIZE );
- supplGrpLayout->setMargin( MARGIN_SIZE );
-
- QSize myMinimumSize(int(MIN_EDIT_SIZE*0.3), 0);
-
- myAuthorEdit = new QLineEdit( supplGrp , "myAuthorEdit" );
- myAuthorEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myAuthorEdit->setMinimumSize( myMinimumSize );
-
- OSD_Process aProcess;
- myAuthorEdit->setText(aProcess.UserName().ToCString());
-
- myVersionEdit = new QLineEdit(supplGrp , "myVersion" );
- myVersionEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myVersionEdit->setMinimumSize( myMinimumSize );
- QStringList aList = QStringList::split(QRegExp("\\s+"),tr( "INF_VERSION" ));
- myVersionEdit->setText(aList.last());
-
- myPngEdit = new QLineEdit(supplGrp , "myCompIcon" );
- myPngEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myPngEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
-
- myBrowsePngBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), supplGrp, "myBrowsePngBtn" );
-
- myCompName = new QLineEdit(supplGrp , "myCompName");
- myCompName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompName->setMinimumSize( myMinimumSize );
-
- myCompUserName = new QLineEdit(supplGrp , "myCompUserName");
- myCompUserName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompUserName->setMinimumSize( MIN_EDIT_SIZE*0.3, 0 );
-
- myCompType = new QLineEdit(supplGrp , "myCompType");
- myCompType->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompType->setMinimumSize( myMinimumSize );
- myCompType->setText("OTHER");
-
- myCompMultiStd = new QLineEdit(supplGrp , "myCompMultiStd");
- myCompMultiStd->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myCompMultiStd->setMinimumSize( myMinimumSize );
- myCompMultiStd->setText("1");
- QIntValidator *ivalidator = new QIntValidator(myVersionEdit);
- myCompMultiStd->setValidator(ivalidator);
-
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_AUTHOR" ), supplGrp ), 0, 0);
- supplGrpLayout->addWidget( myAuthorEdit, 0, 1 );
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_NAME" ), supplGrp ), 0, 2);
- supplGrpLayout->addWidget(myCompName,0,3);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_USERNAME" ), supplGrp ), 0, 4);
- supplGrpLayout->addWidget(myCompUserName,0,5);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_VERSION" ), supplGrp ), 1, 0);
- supplGrpLayout->addWidget( myVersionEdit, 1, 1);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_MULTISTD" ), supplGrp ), 1, 2);
- supplGrpLayout->addWidget(myCompMultiStd,1,3);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_TYPE" ), supplGrp ), 1, 4);
- supplGrpLayout->addWidget(myCompType,1,5);
- supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_PNG_FILE" ), supplGrp ), 2, 0);
- supplGrpLayout->addMultiCellWidget( myPngEdit, 2,2,1,4 );
- supplGrpLayout->addWidget( myBrowsePngBtn, 2, 5 );
-
-
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- myApplyBtn = new QPushButton( tr( "TOOLS_BUT_APPLY" ), this, "myApplyBtn" );
- myApplyBtn->setAutoDefault( true );
- myApplyBtn->setDefault( true );
- myCloseBtn = new QPushButton( tr( "TOOLS_BUT_CLOSE" ), this, "myCloseBtn" );
- myCloseBtn->setAutoDefault( true );
-
- aBtnLayout->addWidget( myApplyBtn );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( myCloseBtn );
-
- aTopLayout->addWidget( filesGrp, 0, 0 );
- aTopLayout->addWidget( supplGrp, 1, 0 );
- aTopLayout->addLayout( aBtnLayout, 2, 0 );
-
- /* signals and slots connections */
- connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) );
- connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( myBrowseIdlBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) );
- connect( myBrowseXmlBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) );
- connect( myBrowsePngBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) );
- connect( myIdlEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateButtonState() ) );
- connect( myXmlEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateButtonState() ) );
-
- updateButtonState();
-}
-
-//=================================================================================
-// function : ~ToolsGUI_CatalogGeneratorDlg()
-// purpose : destructor
-//=================================================================================
-ToolsGUI_CatalogGeneratorDlg::~ToolsGUI_CatalogGeneratorDlg()
-{
-}
-
-//=================================================================================
-// function : getIdlFile()
-// purpose : gets IDL file name entered
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getIdlFile()
-{
- return myIdlEdit->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getXmlFile()
-// purpose : gets XML file name entered
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getXmlFile()
-{
- return myXmlEdit->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getPngFile()
-// purpose : gets PNG file name entered
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getPngFile()
-{
- return myPngEdit->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getAuthor()
-// purpose : gets author
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getAuthor()
-{
- return myAuthorEdit->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getVersion()
-// purpose : gets version number
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getVersion()
-{
- return myVersionEdit->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getCompName()
-// purpose : gets name of the component
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getCompName()
-{
- return myCompName->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getCompUserName()
-// purpose : gets username of the component
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getCompUserName()
-{
- return myCompUserName->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getCompType()
-// purpose : gets type of the component
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getCompMultiStd()
-{
- return myCompMultiStd->text().stripWhiteSpace();
-}
-//=================================================================================
-// function : getComptype()
-// purpose : gets type of the component
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getCompType()
-{
- return myCompType->text().stripWhiteSpace();
-}
-
-//=================================================================================
-// function : getIdlPath()
-// purpose : gets IDL path of modules
-//=================================================================================
-QString ToolsGUI_CatalogGeneratorDlg::getIdlPath()
-{
- SALOME_ModuleCatalog::ModuleCatalog_var aCatalog =
- SALOME_ModuleCatalog::ModuleCatalog::_narrow( QAD_Application::getDesktop()->getCatalogue());
-
- SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants =
- aCatalog->GetComponentIconeList();
-
- QString IDLpath = "";
-
- for (unsigned int ind = 0; ind < list_composants->length();ind++) {
- QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
-
- QCString dir;
- if (dir = getenv( modulename + "_ROOT_DIR")) {
- IDLpath = IDLpath + "-I" + QAD_Tools::addSlash( QAD_Tools::addSlash(dir) +
- QAD_Tools::addSlash("idl") +
- QAD_Tools::addSlash("salome")) + " ";
- }
- }
-
- // MESSAGE ( " IDLpath = " << IDLpath);
-
- return IDLpath;
-}
-
-//=================================================================================
-// function : onBrowseBtnClicked()
-// purpose : <...> (Browse) buttons slot
-//=================================================================================
-void ToolsGUI_CatalogGeneratorDlg::onBrowseBtnClicked()
-{
- QPushButton* send = (QPushButton*)sender();
-
- if ( send == myBrowseIdlBtn ) {
- QString file = myIdlEdit->text().stripWhiteSpace();
- file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- file,
- tr("TOOLS_MEN_IMPORT_IDL"),
- tr("TOOLS_MEN_IMPORT"),
- true);
- if ( !file.isEmpty() ) {
- myIdlEdit->setText(file);
- }
- }
- else if ( send == myBrowseXmlBtn ) {
- QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- myXmlEdit->text().stripWhiteSpace(),
- tr("TOOLS_MEN_EXPORT_XML"),
- tr("TOOLS_MEN_EXPORT"),
- false);
- if ( !file.isEmpty() ) {
- myXmlEdit->setText(file);
- }
- } else if ( send == myBrowsePngBtn ) {
- QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- myXmlEdit->text().stripWhiteSpace(),
- tr("TOOLS_MEN_IMPORT_PNG"),
- tr("TOOLS_MEN_IMPORT"),
- true);
- if ( !file.isEmpty() ) {
- myPngEdit->setText(file);
-
- }
- }
- updateButtonState();
-}
-
-//=================================================================================
-// function : updateButtonState()
-// purpose : Updates <OK> button's state
-//=================================================================================
-void ToolsGUI_CatalogGeneratorDlg::updateButtonState()
-{
- myApplyBtn->setEnabled( !myIdlEdit->text().stripWhiteSpace().isEmpty() &&
- !myXmlEdit->text().stripWhiteSpace().isEmpty() );
-}
-
-//=================================================================================
-// function : onApply()
-// purpose : <Apply> button slot, performs IDL->XML conversion
-//=================================================================================
-void ToolsGUI_CatalogGeneratorDlg::onApply()
-{
- QString IDLpath = getIdlPath();
- QString XmlFile = getXmlFile();
- QString IdlFile = getIdlFile();
- QString Author = getAuthor();
- QString Version = getVersion();
- QString PngFile = getPngFile();
- QString CompName = getCompName(); //gets component name
- QString CompUserName = getCompUserName(); //gets component username
- QString CompType = getCompType(); //gets component type
- QString CompMultiStd = getCompMultiStd();
-
- if ( !XmlFile.isEmpty() && !IdlFile.isEmpty() ) {
- if ( !QFile::exists( IdlFile ) ) {
- QAD_MessageBox::error1( this,
- tr("TOOLS_ERR_ERROR"),
- tr("TOOLS_ERR_FILE_NOT_EXIST").arg(IdlFile),
- tr ("TOOLS_BUT_OK") );
- }
- else {
- QString command = "";
- if ( getenv("KERNEL_ROOT_DIR") )
- command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile;
- else {
- QAD_MessageBox::error1( this,
- tr("TOOLS_ERR_ERROR"),
- tr("KERNEL_ROOT_DIR variable is not defined"),
- tr("TOOLS_BUT_OK") );
- }
-
- if (!Author.isEmpty()) command += ",author=" + Author;
- if (!Version.isEmpty()) command += ",version=" + Version;
- if (!PngFile.isEmpty()) {
- OSD_Path aPath((Standard_CString)PngFile.latin1());
- TCollection_AsciiString aFile = aPath.Name() + aPath.Extension();
- command += QString(",icon=") + QString(aFile.ToCString());
- }
- if (!CompName.isEmpty()) command += ",name=" + CompName;
- if (!CompUserName.isEmpty()) command += ",username=" + CompUserName;
- if (!CompType.isEmpty()) command += ",type=" + CompType;
- if (!CompMultiStd.isEmpty()) command += ",multistudy=" + CompMultiStd;
- command += " " + IdlFile;
- MESSAGE( "shell command is : " << command );
- int res;
- res = system( ( char* )( command.latin1() ) );
- if ( res == -1 ) {
- MESSAGE( "work failed (system command result = " << res );
- } else if (res == 217) {
- MESSAGE( "shell exec failed (system command result = " << res );
- }
- }
- }
-}
+++ /dev/null
-// SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-//
-// 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 : ToolsGUI_CatalogGeneratorDlg.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
-#define DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
-
-#include <qdialog.h>
-
-class QLineEdit;
-class QPushButton;
-
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg
-// purpose :
-//=================================================================================
-class ToolsGUI_CatalogGeneratorDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- ToolsGUI_CatalogGeneratorDlg( QWidget* parent = 0, const char* name = 0 );
- ~ToolsGUI_CatalogGeneratorDlg();
-
- QString getIdlPath();
- QString getIdlFile();
- QString getXmlFile();
- QString getPngFile();
- QString getAuthor();
- QString getVersion();
- QString getCompName();
- QString getCompUserName();
- QString getCompType();
- QString getCompMultiStd();
-
-protected slots:
- void onBrowseBtnClicked();
- void updateButtonState();
- void onApply();
-
-private:
- QLineEdit* myIdlEdit;
- QLineEdit* myXmlEdit;
- QLineEdit* myPngEdit;
- QLineEdit* myVersionEdit;
- QLineEdit* myAuthorEdit;
- QLineEdit* myCompName;
- QLineEdit* myCompUserName;
- QLineEdit* myCompType;
- QLineEdit* myCompMultiStd;
- QPushButton* myBrowseIdlBtn;
- QPushButton* myBrowseXmlBtn;
- QPushButton* myBrowsePngBtn;
-
- QPushButton* myApplyBtn;
- QPushButton* myCloseBtn;
-};
-
-#endif // DIALOGBOX_TOOLSGUI_CATALOGGENERATORDLG_H
+++ /dev/null
-# SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-#
-# 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 : ToolsGUI_icons.po
-# Module : SALOME
-
-msgid ""
-msgstr ""
-"Project-Id-Version: SALOME VERSION 0.4\n"
-"POT-Creation-Date: 2002-04-25 10:04:12 PM CEST\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
-"Last-Translator: Nicolas REJNERI\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#
-#==============================================================================
-#
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:50
-msgid "ToolsGUI_CatalogGeneratorDlg::ICON_SELECT"
-msgstr "select1.png"
+++ /dev/null
-# SALOME TOOLSGUI : implementation of desktop "Tools" optioins
-#
-# 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 : ToolsGUI_msg_en.po
-# Module : SALOME
-
-msgid ""
-msgstr ""
-"Project-Id-Version: SALOME VERSION 0.4\n"
-"POT-Creation-Date: 2002-04-25 10:04:12 PM CEST\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
-"Last-Translator: Nicolas REJNERI\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#
-#==============================================================================
-#
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:58
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_FILES"
-msgstr "Files"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:58
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_SUPPLEMENT"
-msgstr "Component supplementary data"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:150
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_EXPORT"
-msgstr "Export"
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT"
-msgstr "Import"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:47
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_CATALOG_GENERATOR"
-msgstr "Catalog generator"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:82
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_IDL_FILE"
-msgstr "IDL : "
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:88
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_XML_FILE"
-msgstr "XML : "
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:88
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_PNG_FILE"
-msgstr "Icon : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_AUTHOR"
-msgstr "Author : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_VERSION"
-msgstr "Version : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_NAME"
-msgstr "Name : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_USERNAME"
-msgstr "UserName : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_TYPE"
-msgstr "Type : "
-
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_MULTISTD"
-msgstr "Multistudy : "
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:153
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_EXPORT_XML"
-msgstr "XML Files ( *.xml )"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:154
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT_IDL"
-msgstr "IDL Files ( *.idl )"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:154
-msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT_PNG"
-msgstr "PNG Files ( *.png )"
-
-#
-#==============================================================================
-#
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:107
-msgid "TOOLS_BUT_CLOSE"
-msgstr "&Close"
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:113
-msgid "TOOLS_BUT_OK"
-msgstr "&Ok"
-
-msgid "TOOLS_BUT_BROWSE"
-msgstr "Browse..."
-
-msgid "TOOLS_BUT_APPLY"
-msgstr "&Apply"
-
-#
-#==============================================================================
-#
-
-#: ToolsGUI_CatalogGeneratorDlg.cxx:53
-msgid "TOOLS_WRN_WARNING"
-msgstr "Warning"
-
-msgid "TOOLS_ERR_ERROR"
-msgstr "Error"
-
-msgid "TOOLS_ERR_FILE_NOT_EXIST"
-msgstr "%1\nFile doesn't exist"
+++ /dev/null
-# VISU OBJECT : interactive object for VISU entities implementation
-#
-# 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 : Makefile.in
-# Module : VISU
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
-
-
-@COMMENCE@
-
-EXPORT_HEADERS = SALOME_Transform.h \
- SALOME_TransformFilter.h \
- SALOME_PassThroughFilter.h \
- SALOME_ShrinkFilter.h \
- SALOME_GeometryFilter.h \
- SALOME_ExtractUnstructuredGrid.h
-
-# Libraries targets
-
-LIB = libSalomeVTKFilter.la
-LIB_SRC = SALOME_Transform.cxx \
- SALOME_TransformFilter.cxx \
- SALOME_PassThroughFilter.cxx \
- SALOME_ShrinkFilter.cxx \
- SALOME_GeometryFilter.cxx \
- SALOME_ExtractUnstructuredGrid.cxx
-
-# Executables targets
-
-BIN =
-BIN_SRC =
-
-CPPFLAGS+= $(VTK_INCLUDES)
-LDFLAGS+= $(VTK_LIBS) -lOpUtil
-
-@CONCLUDE@
+++ /dev/null
-// VISU CONVERTOR :
-//
-// 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: VISU_ExtractUnstructuredGrid.cxx
-// Author: Alexey PETROV
-// Module : VISU
-
-
-#include "SALOME_ExtractUnstructuredGrid.h"
-#include "utilities.h"
-
-#include <vtkUnsignedCharArray.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkObjectFactory.h>
-#include <vtkCellArray.h>
-#include <vtkIntArray.h>
-#include <vtkIdList.h>
-#include <vtkCell.h>
-
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-#if defined __GNUC__
- #if __GNUC__ == 2
- #define __GNUC_2__
- #endif
-#endif
-
-vtkStandardNewMacro(SALOME_ExtractUnstructuredGrid);
-
-
-SALOME_ExtractUnstructuredGrid::SALOME_ExtractUnstructuredGrid():
- myExtractionMode(eCells), myChangeMode(ePassAll)
-{}
-
-
-SALOME_ExtractUnstructuredGrid::~SALOME_ExtractUnstructuredGrid(){}
-
-
-void
-SALOME_ExtractUnstructuredGrid::
-SetModeOfChanging(SALOME_ExtractUnstructuredGrid::EChanging theChangeMode)
-{
- if(theChangeMode != myChangeMode){
- myChangeMode = theChangeMode;
- Modified();
- }
-}
-
-
-void
-SALOME_ExtractUnstructuredGrid::
-SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::EExtraction theExtractionMode)
-{
- if(theExtractionMode != myExtractionMode){
- myExtractionMode = theExtractionMode;
- Modified();
- }
-}
-
-
-void
-SALOME_ExtractUnstructuredGrid::
-ClearRegisteredCellsWithType()
-{
- if(IsCellsWithTypeRegistered()){
- myCellTypes.clear();
- Modified();
- }
-}
-
-
-void SALOME_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId){
- if(0 && MYDEBUG) MESSAGE("RegisterCell - theCellId = "<<theCellId);
- myCellIds.insert(theCellId);
- Modified();
-}
-
-
-void SALOME_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType){
- if(0 && MYDEBUG) MESSAGE("RegisterCellsWithType - theCellType = "<<theCellType);
- myCellTypes.insert(theCellType);
- Modified();
-}
-
-
-void SALOME_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping){
- myStoreMapping = theStoreMapping;
- this->Modified();
-}
-
-vtkIdType SALOME_ExtractUnstructuredGrid::GetInputId(int theOutId) const{
- if(myCellIds.empty() && myCellTypes.empty()) return theOutId;
- if(myOut2InId.empty() || theOutId > myOut2InId.size()) return -1;
-#if defined __GNUC_2__
- return myOut2InId[theOutId];
-#else
- return myOut2InId.at(theOutId);
-#endif
-}
-
-vtkIdType SALOME_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
- if(myCellIds.empty() && myCellTypes.empty()) return theInId;
- TMapId::const_iterator anIter = myIn2OutId.find(theInId);
- if(anIter == myIn2OutId.end()) return -1;
- return anIter->second;
-}
-
-
-inline void InsertCell(vtkUnstructuredGrid *theInput,
- vtkCellArray *theConnectivity,
- vtkUnsignedCharArray* theCellTypesArray,
- vtkIdType theCellId,
- vtkIdList *theIdList,
- bool theStoreMapping,
- vtkIdType theOutId,
- SALOME_ExtractUnstructuredGrid::TVectorId& theOut2InId,
- SALOME_ExtractUnstructuredGrid::TMapId& theIn2OutId)
-{
- vtkCell *aCell = theInput->GetCell(theCellId);
- vtkIdList *aPntIds = aCell->GetPointIds();
- vtkIdType aNbIds = aPntIds->GetNumberOfIds();
- theIdList->SetNumberOfIds(aNbIds);
- for(vtkIdType i = 0; i < aNbIds; i++){
- theIdList->SetId(i,aPntIds->GetId(i));
- }
- theConnectivity->InsertNextCell(theIdList);
-
- vtkIdType aCellType = aCell->GetCellType();
- theCellTypesArray->InsertNextValue(aCellType);
- if(theStoreMapping){
- theOut2InId.push_back(theCellId);
- theIn2OutId[theCellId] = theOutId;
- }
-}
-
-inline void InsertPointCell(vtkCellArray *theConnectivity,
- vtkUnsignedCharArray* theCellTypesArray,
- vtkIdType theCellId,
- vtkIdList *theIdList,
- bool theStoreMapping,
- vtkIdType theOutId,
- SALOME_ExtractUnstructuredGrid::TVectorId& theOut2InId,
- SALOME_ExtractUnstructuredGrid::TMapId& theIn2OutId)
-{
- theIdList->SetId(0,theCellId);
- theConnectivity->InsertNextCell(theIdList);
- theCellTypesArray->InsertNextValue(VTK_VERTEX);
- if(theStoreMapping){
- theOut2InId.push_back(theCellId);
- theIn2OutId[theCellId] = theOutId;
- }
-}
-
-void SALOME_ExtractUnstructuredGrid::Execute(){
- vtkUnstructuredGrid *anInput = this->GetInput();
- vtkUnstructuredGrid *anOutput = this->GetOutput();
- myOut2InId.clear(); myIn2OutId.clear();
-
- if(MYDEBUG){
- MESSAGE("Execute - anInput->GetNumberOfCells() = "<<anInput->GetNumberOfCells());
- MESSAGE("Execute - myCellTypes.size() = "<<myCellTypes.size());
- MESSAGE("Execute - myCellIds.size() = "<<myCellIds.size());
- MESSAGE("Execute - myExtractionMode = "<<myExtractionMode);
- MESSAGE("Execute - myChangeMode = "<<myChangeMode);
- }
- if(myExtractionMode == eCells){
- if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving){
- if(vtkIdType aNbElems = anInput->GetNumberOfCells()){
- if(myStoreMapping) myOut2InId.reserve(aNbElems);
- anOutput->ShallowCopy(anInput);
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- if(myStoreMapping){
- myOut2InId.push_back(aCellId);
- myIn2OutId[aCellId] = anOutId;
- }
- }
- }
- }else{
- vtkIdList *anIdList = vtkIdList::New();
- vtkCellArray *aConnectivity = vtkCellArray::New();
- vtkIdType aNbElems = anInput->GetNumberOfCells();
- aConnectivity->Allocate(2*aNbElems,0);
- vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
- aCellTypesArray->SetNumberOfComponents(1);
- aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
- if(!myCellIds.empty() && myCellTypes.empty()){
- if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else if(myCellIds.empty() && !myCellTypes.empty()){
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) != myCellTypes.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) == myCellTypes.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else if(!myCellIds.empty() && !myCellTypes.empty()){
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) != myCellTypes.end()){
- if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) == myCellTypes.end()){
- if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }
- }
- if((aNbElems = aConnectivity->GetNumberOfCells())){
- vtkIntArray* aCellLocationsArray = vtkIntArray::New();
- aCellLocationsArray->SetNumberOfComponents(1);
- aCellLocationsArray->SetNumberOfTuples(aNbElems);
- aConnectivity->InitTraversal();
- for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
- aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
- }
- anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
- anOutput->SetPoints(anInput->GetPoints());
- aCellLocationsArray->Delete();
- }
- aCellTypesArray->Delete();
- aConnectivity->Delete();
- anIdList->Delete();
- }
- }else{
- vtkIdList *anIdList = vtkIdList::New();
- anIdList->SetNumberOfIds(1);
- vtkCellArray *aConnectivity = vtkCellArray::New();
- vtkIdType aNbElems = anInput->GetNumberOfPoints();
- aConnectivity->Allocate(2*aNbElems,0);
- vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
- aCellTypesArray->SetNumberOfComponents(1);
- aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
- if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving){
- if(myStoreMapping) myOut2InId.reserve(aNbElems);
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }else if(!myCellIds.empty() && myCellTypes.empty()){
- if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else if(myCellIds.empty() && !myCellTypes.empty()){
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) != myCellTypes.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) == myCellTypes.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else if(!myCellIds.empty() && !myCellTypes.empty()){
- if(myChangeMode == eAdding){
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) != myCellTypes.end()){
- if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }else{
- for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
- vtkIdType aType = anInput->GetCellType(aCellId);
- if(myCellTypes.find(aType) == myCellTypes.end()){
- if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
- myStoreMapping,anOutId,myOut2InId,myIn2OutId);
- }
- }
- }
- }
- }
- if((aNbElems = aConnectivity->GetNumberOfCells())){
- vtkIntArray* aCellLocationsArray = vtkIntArray::New();
- aCellLocationsArray->SetNumberOfComponents(1);
- aCellLocationsArray->SetNumberOfTuples(aNbElems);
- aConnectivity->InitTraversal();
- for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
- aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
- }
- anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
- anOutput->SetPoints(anInput->GetPoints());
- aCellLocationsArray->Delete();
- }
- aCellTypesArray->Delete();
- aConnectivity->Delete();
- anIdList->Delete();
- }
- if(MYDEBUG){
- MESSAGE("Execute - anOutput->GetNumberOfCells() = "<<anOutput->GetNumberOfCells());
- if(myStoreMapping){
- MESSAGE("Execute - myOut2InId.size() = "<<myOut2InId.size());
- MESSAGE("Execute - myIn2OutId.size() = "<<myIn2OutId.size());
- }
- }
-}
+++ /dev/null
-// VISU CONVERTOR :
-//
-// 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 : SALOME_ExtractUnstructuredGrid.hxx
-// Author : Alexey PETROV
-// Module : VISU
-
-#ifndef SALOME_ExtractUnstructuredGrid_HeaderFile
-#define SALOME_ExtractUnstructuredGrid_HeaderFile
-
-#include <vtkUnstructuredGridToUnstructuredGridFilter.h>
-
-#include <set>
-#include <map>
-#include <vector>
-
-class SALOME_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter{
-public:
- vtkTypeMacro(SALOME_ExtractUnstructuredGrid,vtkUnstructuredGridToUnstructuredGridFilter);
-
- // Description:
- // Construct with all types of clipping turned off.
- static SALOME_ExtractUnstructuredGrid *New();
-
- enum EExtraction{ eCells, ePoints};
- void SetModeOfExtraction(EExtraction theExtractionMode);
- EExtraction GetModeOfExtraction(){ return myExtractionMode;}
-
- enum EChanging{ ePassAll, eAdding, eRemoving};
- void SetModeOfChanging(EChanging theChangeMode);
- EChanging GetModeOfChanging(){ return myChangeMode;}
-
- // Remove the cell from the output
- void RegisterCell(vtkIdType theCellId);
- int IsCellsRegistered() { return !myCellIds.empty();}
- void ClearRegisteredCells() {
- myCellIds.clear();
- Modified();
- }
-
- // Remove every cells with the type from the output
- void RegisterCellsWithType(vtkIdType theCellType);
- int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
- void ClearRegisteredCellsWithType();
-
- // Do the filter do some real work
- int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();}
-
- // Do it keep the mapping between input's and output's UnstructuredGrid
- void SetStoreMapping(int theStoreMapping);
- int GetStoreMapping(){ return myStoreMapping;}
-
- vtkIdType GetInputId(int theOutId) const;
- vtkIdType GetOutputId(int theInId) const;
-
- typedef std::vector<vtkIdType> TVectorId;
- typedef std::map<vtkIdType,vtkIdType> TMapId;
-
-protected:
- SALOME_ExtractUnstructuredGrid();
- ~SALOME_ExtractUnstructuredGrid();
-
- void Execute();
-
- EExtraction myExtractionMode;
-
- EChanging myChangeMode;
- typedef std::set<vtkIdType> TSetId;
- TSetId myCellIds;
- TSetId myCellTypes;
-
- bool myStoreMapping;
- TVectorId myOut2InId;
- TMapId myIn2OutId;
-
-private:
- SALOME_ExtractUnstructuredGrid(const SALOME_ExtractUnstructuredGrid&); // Not implemented.
- void operator=(const SALOME_ExtractUnstructuredGrid&); // Not implemented.
-};
-
-
-#endif
-
-
+++ /dev/null
-// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.cxx
-// Author : Michael ZORIN
-// Module : SALOME
-// $Header$
-
-#include "SALOME_GeometryFilter.h"
-
-#include <vtkCellArray.h>
-#include <vtkCellData.h>
-#include <vtkGenericCell.h>
-#include <vtkHexahedron.h>
-#include <vtkMergePoints.h>
-#include <vtkObjectFactory.h>
-#include <vtkPointData.h>
-#include <vtkPolyData.h>
-#include <vtkPyramid.h>
-#include <vtkStructuredGrid.h>
-#include <vtkTetra.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkVoxel.h>
-#include <vtkWedge.h>
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#else
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#endif
-
-#if defined __GNUC__
- #if __GNUC__ == 2
- #define __GNUC_2__
- #endif
-#endif
-
-vtkCxxRevisionMacro(SALOME_GeometryFilter, "$Revision$");
-vtkStandardNewMacro(SALOME_GeometryFilter);
-
-
-SALOME_GeometryFilter::SALOME_GeometryFilter():
- myShowInside(0),
- myStoreMapping(0)
-{}
-
-
-SALOME_GeometryFilter::~SALOME_GeometryFilter()
-{}
-
-
-void SALOME_GeometryFilter::Execute()
-{
- vtkDataSet *input= this->GetInput();
- vtkIdType numCells=input->GetNumberOfCells();
-
- if (numCells == 0)
- {
- return;
- }
-
- if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
- this->UnstructuredGridExecute();
- return;
- }else
- vtkGeometryFilter::Execute();
-}
-
-
-void SALOME_GeometryFilter::SetStoreMapping(int theStoreMapping){
- myStoreMapping = theStoreMapping;
- this->Modified();
-}
-
-
-vtkIdType SALOME_GeometryFilter::GetElemObjId(int theVtkID){
- if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
-#if defined __GNUC_2__
- return myVTK2ObjIds[theVtkID];
-#else
- return myVTK2ObjIds.at(theVtkID);
-#endif
-}
-
-
-void SALOME_GeometryFilter::UnstructuredGridExecute()
-{
- vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput();
- vtkCellArray *Connectivity = input->GetCells();
- if (Connectivity == NULL) {return;}
- vtkIdType cellId;
- int i;
- int allVisible;
- vtkIdType npts = 0;
- vtkIdType *pts = 0;
- vtkPoints *p = input->GetPoints();
- vtkIdType numCells=input->GetNumberOfCells();
- vtkPointData *pd = input->GetPointData();
- vtkCellData *cd = input->GetCellData();
- vtkPolyData *output = this->GetOutput();
- vtkPointData *outputPD = output->GetPointData();
-
- vtkCellData *outputCD = output->GetCellData();
- vtkCellArray *Verts, *Lines, *Polys, *Strips;
- vtkIdList *cellIds, *faceIds;
- char *cellVis;
- vtkIdType newCellId;
- int faceId, *faceVerts, numFacePts;
- float *x;
- int PixelConvert[4], aNewPts[VTK_CELL_SIZE];
- // ghost cell stuff
- unsigned char updateLevel = (unsigned char)(output->GetUpdateGhostLevel());
- unsigned char *cellGhostLevels = 0;
-
- PixelConvert[0] = 0;
- PixelConvert[1] = 1;
- PixelConvert[2] = 3;
- PixelConvert[3] = 2;
-
- vtkDebugMacro(<<"Executing geometry filter for unstructured grid input");
-
- vtkDataArray* temp = 0;
- if (cd)
- {
- temp = cd->GetArray("vtkGhostLevels");
- }
- if ( (!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR)
- || (temp->GetNumberOfComponents() != 1))
- {
- vtkDebugMacro("No appropriate ghost levels field available.");
- }
- else
- {
- cellGhostLevels = ((vtkUnsignedCharArray*)temp)->GetPointer(0);
- }
-
- // Check input
- if ( Connectivity == NULL )
- {
- vtkDebugMacro(<<"Nothing to extract");
- return;
- }
-
- // Determine nature of what we have to do
- cellIds = vtkIdList::New();
- faceIds = vtkIdList::New();
- if ( (!this->CellClipping) && (!this->PointClipping) &&
- (!this->ExtentClipping) )
- {
- allVisible = 1;
- cellVis = NULL;
- }
- else
- {
- allVisible = 0;
- cellVis = new char[numCells];
- }
-
- // Just pass points through, never merge
- output->SetPoints(input->GetPoints());
- outputPD->PassData(pd);
-
- outputCD->CopyAllocate(cd,numCells,numCells/2);
-
- output->Allocate(numCells/4+1,numCells);
- //Verts = vtkCellArray::New();
- //Verts->Allocate(numCells/4+1,numCells);
- //Lines = vtkCellArray::New();
- //Lines->Allocate(numCells/4+1,numCells);
- //Polys = vtkCellArray::New();
- //Polys->Allocate(numCells/4+1,numCells);
- //Strips = vtkCellArray::New();
- //Strips->Allocate(numCells/4+1,numCells);
-
- // Loop over the cells determining what's visible
- if (!allVisible)
- {
- for (cellId=0, Connectivity->InitTraversal();
- Connectivity->GetNextCell(npts,pts);
- cellId++)
- {
- cellVis[cellId] = 1;
- if ( this->CellClipping && cellId < this->CellMinimum ||
- cellId > this->CellMaximum )
- {
- cellVis[cellId] = 0;
- }
- else
- {
- for (i=0; i < npts; i++)
- {
- x = p->GetPoint(pts[i]);
- if ( (this->PointClipping && (pts[i] < this->PointMinimum ||
- pts[i] > this->PointMaximum) ) ||
- (this->ExtentClipping &&
- (x[0] < this->Extent[0] || x[0] > this->Extent[1] ||
- x[1] < this->Extent[2] || x[1] > this->Extent[3] ||
- x[2] < this->Extent[4] || x[2] > this->Extent[5] )) )
- {
- cellVis[cellId] = 0;
- break;
- }//point/extent clipping
- }//for each point
- }//if point clipping needs checking
- }//for all cells
- }//if not all visible
-
- // Loop over all cells now that visibility is known
- // (Have to compute visibility first for 3D cell boundarys)
- int progressInterval = numCells/20 + 1;
- if(myStoreMapping){
- myVTK2ObjIds.clear();
- myVTK2ObjIds.reserve(numCells);
- }
- for (cellId=0, Connectivity->InitTraversal();
- Connectivity->GetNextCell(npts,pts);
- cellId++)
- {
- //Progress and abort method support
- if ( !(cellId % progressInterval) )
- {
- vtkDebugMacro(<<"Process cell #" << cellId);
- this->UpdateProgress ((float)cellId/numCells);
- }
-
- // Handle ghost cells here. Another option was used cellVis array.
- if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
- { // Do not create surfaces in outer ghost cells.
- continue;
- }
-
- if (allVisible || cellVis[cellId]) //now if visible extract geometry
- {
- //special code for nonlinear cells - rarely occurs, so right now it
- //is slow.
- vtkIdType aCellType = input->GetCellType(cellId);
- switch (aCellType)
- {
- case VTK_EMPTY_CELL:
- break;
-
- case VTK_VERTEX:
- case VTK_POLY_VERTEX:
- newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- break;
-
- case VTK_LINE:
- case VTK_POLY_LINE:
- newCellId = output->InsertNextCell(VTK_LINE,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- break;
-
- case VTK_TRIANGLE:
- case VTK_QUAD:
- case VTK_POLYGON:
- newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- break;
-
- case VTK_TRIANGLE_STRIP:
- newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- break;
-
- case VTK_PIXEL:
- newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- break;
-
- case VTK_TETRA: {
- for (faceId = 0; faceId < 4; faceId++)
- {
- faceIds->Reset();
- faceVerts = vtkTetra::GetFaceArray(faceId);
- faceIds->InsertNextId(pts[faceVerts[0]]);
- faceIds->InsertNextId(pts[faceVerts[1]]);
- faceIds->InsertNextId(pts[faceVerts[2]]);
- numFacePts = 3;
- aCellType = VTK_TRIANGLE;
- input->GetCellNeighbors(cellId, faceIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
- (!allVisible && !cellVis[cellIds->GetId(0)]) )
- {
- for ( i=0; i < numFacePts; i++)
- {
- aNewPts[i] = pts[faceVerts[i]];
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- break;
- }
- case VTK_VOXEL: {
- for (faceId = 0; faceId < 6; faceId++)
- {
- faceIds->Reset();
- faceVerts = vtkVoxel::GetFaceArray(faceId);
- faceIds->InsertNextId(pts[faceVerts[0]]);
- faceIds->InsertNextId(pts[faceVerts[1]]);
- faceIds->InsertNextId(pts[faceVerts[2]]);
- faceIds->InsertNextId(pts[faceVerts[3]]);
- numFacePts = 4;
- aCellType = VTK_QUAD;
- input->GetCellNeighbors(cellId, faceIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
- (!allVisible && !cellVis[cellIds->GetId(0)]) )
- {
- for ( i=0; i < numFacePts; i++)
- {
- aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- break;
- }
- case VTK_HEXAHEDRON: {
- for (faceId = 0; faceId < 6; faceId++)
- {
- faceIds->Reset();
- faceVerts = vtkHexahedron::GetFaceArray(faceId);
- faceIds->InsertNextId(pts[faceVerts[0]]);
- faceIds->InsertNextId(pts[faceVerts[1]]);
- faceIds->InsertNextId(pts[faceVerts[2]]);
- faceIds->InsertNextId(pts[faceVerts[3]]);
- numFacePts = 4;
- aCellType = VTK_QUAD;
- input->GetCellNeighbors(cellId, faceIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
- (!allVisible && !cellVis[cellIds->GetId(0)]) )
- {
- for ( i=0; i < numFacePts; i++)
- {
- aNewPts[i] = pts[faceVerts[i]];
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- break;
- }
- case VTK_WEDGE: {
- for (faceId = 0; faceId < 5; faceId++)
- {
- faceIds->Reset();
- faceVerts = vtkWedge::GetFaceArray(faceId);
- faceIds->InsertNextId(pts[faceVerts[0]]);
- faceIds->InsertNextId(pts[faceVerts[1]]);
- faceIds->InsertNextId(pts[faceVerts[2]]);
- numFacePts = 3;
- aCellType = VTK_TRIANGLE;
- if (faceVerts[3] >= 0)
- {
- faceIds->InsertNextId(pts[faceVerts[3]]);
- numFacePts = 4;
- aCellType = VTK_QUAD;
- }
- input->GetCellNeighbors(cellId, faceIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
- (!allVisible && !cellVis[cellIds->GetId(0)]) )
- {
- for ( i=0; i < numFacePts; i++)
- {
- aNewPts[i] = pts[faceVerts[i]];
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- break;
- }
- case VTK_PYRAMID: {
- for (faceId = 0; faceId < 5; faceId++)
- {
- faceIds->Reset();
- faceVerts = vtkPyramid::GetFaceArray(faceId);
- faceIds->InsertNextId(pts[faceVerts[0]]);
- faceIds->InsertNextId(pts[faceVerts[1]]);
- faceIds->InsertNextId(pts[faceVerts[2]]);
- numFacePts = 3;
- aCellType = VTK_TRIANGLE;
- if (faceVerts[3] >= 0)
- {
- faceIds->InsertNextId(pts[faceVerts[3]]);
- numFacePts = 4;
- aCellType = VTK_QUAD;
- }
- input->GetCellNeighbors(cellId, faceIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside == 1 ||
- (!allVisible && !cellVis[cellIds->GetId(0)]) )
- {
- for ( i=0; i < numFacePts; i++)
- {
- aNewPts[i] = pts[faceVerts[i]];
- }
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
- outputCD->CopyData(cd,cellId,newCellId);
- }
- }
- break;
- }
- //Quadratic cells
- case VTK_QUADRATIC_EDGE:
- case VTK_QUADRATIC_TRIANGLE:
- case VTK_QUADRATIC_QUAD:
- case VTK_QUADRATIC_TETRA:
- case VTK_QUADRATIC_HEXAHEDRON:
-
- break; //done with quadratic cells
-
- } //switch
- } //if visible
- } //for all cells
-
- if(MYDEBUG && myStoreMapping){
- for(int i = 0, iEnd = myVTK2ObjIds.size(); i < iEnd; i++){
- cout<<myVTK2ObjIds[i]<<", ";
- }
- cout<<"\n";
- }
-
- // Update ourselves and release memory
- //
- //output->SetVerts(Verts);
- //Verts->Delete();
- //output->SetLines(Lines);
- //Lines->Delete();
- //output->SetPolys(Polys);
- //Polys->Delete();
- //output->SetStrips(Strips);
- //Strips->Delete();
-
- output->Squeeze();
-
- vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
- << output->GetNumberOfCells() << " cells.");
-
- cellIds->Delete();
- faceIds->Delete();
- if ( cellVis )
- {
- delete [] cellVis;
- }
-}
-
-
-void SALOME_GeometryFilter::SetInside(int theShowInside){
- if(myShowInside == theShowInside) return;
- myShowInside = theShowInside;
- this->Modified();
-}
-int SALOME_GeometryFilter::GetInside(){
- return myShowInside;
-}
+++ /dev/null
-// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.h
-// Author : Michael ZORIN
-// Module : SALOME
-// $Header$
-
-
-#ifndef __SALOME_GeometryFilter_h
-#define __SALOME_GeometryFilter_h
-
-#include <vtkGeometryFilter.h>
-#include <vector>
-
-class SALOME_GeometryFilter : public vtkGeometryFilter
-{
-public:
- static SALOME_GeometryFilter *New();
- vtkTypeRevisionMacro(SALOME_GeometryFilter, vtkGeometryFilter);
- void SetInside(int theShowInside);
- int GetInside();
-
- void SetStoreMapping(int theStoreMapping);
- int GetStoreMapping(){ return myStoreMapping;}
-
- virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;}
- virtual vtkIdType GetElemObjId(int theVtkID);
-
-protected:
- SALOME_GeometryFilter();
- ~SALOME_GeometryFilter();
-
- void Execute();
- void UnstructuredGridExecute();
-
-private:
- int myShowInside;
-
- int myStoreMapping;
- typedef std::vector<vtkIdType> TVectorId;
- TVectorId myVTK2ObjIds;
-};
-
-#endif
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_PassThroughFilter.cxx
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#include "SALOME_PassThroughFilter.h"
-
-#include <vtkCellData.h>
-#include <vtkDataSet.h>
-#include <vtkObjectFactory.h>
-#include <vtkPointData.h>
-using namespace std;
-
-vtkCxxRevisionMacro(SALOME_PassThroughFilter, "$Revision$");
-vtkStandardNewMacro(SALOME_PassThroughFilter);
-
-void SALOME_PassThroughFilter::Execute()
-{
- vtkDataSet *input = static_cast<vtkDataSet*>(this->GetInput());
- vtkDataSet *output = static_cast<vtkDataSet*>(this->GetOutput());
-
- // This has to be here because it initialized all field datas.
- output->CopyStructure( input );
-
- // Pass all. (data object's field data is passed by the
- // superclass after this method)
- output->GetPointData()->PassData( input->GetPointData() );
- output->GetCellData()->PassData( input->GetCellData() );
-
-}
-
-void SALOME_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os,indent);
-}
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_PassThroughFilter.h
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#ifndef SALOME_PassThroughFilter_HeaderFile
-#define SALOME_PassThroughFilter_HeaderFile
-
-#include <vtkDataSetToDataSetFilter.h>
-
-class SALOME_PassThroughFilter : public vtkDataSetToDataSetFilter
-{
-public:
- vtkTypeRevisionMacro(SALOME_PassThroughFilter,vtkDataSetToDataSetFilter);
- void PrintSelf(ostream& os, vtkIndent indent);
-
- // Description:
- // Create a new SALOME_PassThroughFilter.
- static SALOME_PassThroughFilter *New();
-
-
-protected:
-
- SALOME_PassThroughFilter() {};
- virtual ~SALOME_PassThroughFilter() {};
-
- void Execute();
-
-private:
- SALOME_PassThroughFilter(const SALOME_PassThroughFilter&); // Not implemented.
- void operator=(const SALOME_PassThroughFilter&); // Not implemented.
-};
-
-#endif
+++ /dev/null
-// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.cxx
-// Author : Michael ZORIN
-// Module : SALOME
-// $Header$
-
-#include "SALOME_ShrinkFilter.h"
-
-#include <vtkCell.h>
-#include <vtkCellData.h>
-#include <vtkIdList.h>
-#include <vtkObjectFactory.h>
-#include <vtkPointData.h>
-#include <vtkUnstructuredGrid.h>
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#else
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#endif
-
-vtkCxxRevisionMacro(SALOME_ShrinkFilter, "$Revision$");
-vtkStandardNewMacro(SALOME_ShrinkFilter);
-
-
-SALOME_ShrinkFilter::SALOME_ShrinkFilter():
- myStoreMapping(0)
-{}
-
-
-SALOME_ShrinkFilter::~SALOME_ShrinkFilter()
-{}
-
-
-void SALOME_ShrinkFilter::Execute()
-{
- vtkPoints *newPts;
- int i, j, numIds, abort=0;
- vtkIdType cellId, numCells, numPts;
- vtkIdType oldId, newId;
- float center[3], *p, pt[3];
- vtkPointData *pd, *outPD;;
- vtkIdList *ptIds, *newPtIds;
- vtkDataSet *input= this->GetInput();
- vtkUnstructuredGrid *output = this->GetOutput();
- vtkIdType tenth;
- float decimal;
-
- vtkDebugMacro(<<"Shrinking cells");
-
- numCells=input->GetNumberOfCells();
- numPts = input->GetNumberOfPoints();
- if (numCells < 1 || numPts < 1)
- {
- vtkErrorMacro(<<"No data to shrink!");
- return;
- }
-
- ptIds = vtkIdList::New();
- ptIds->Allocate(VTK_CELL_SIZE);
- newPtIds = vtkIdList::New();
- newPtIds->Allocate(VTK_CELL_SIZE);
-
- output->Allocate(numCells);
- newPts = vtkPoints::New();
- newPts->Allocate(numPts*8,numPts);
- pd = input->GetPointData();
- outPD = output->GetPointData();
- outPD->CopyAllocate(pd,numPts*8,numPts);
-
- // Traverse all cells, obtaining node coordinates. Compute "center" of cell,
- // then create new vertices shrunk towards center.
- //
- tenth = numCells/10 + 1;
- decimal = 0.0;
- if(myStoreMapping){
- myVTK2ObjIds.clear();
- myVTK2ObjIds.reserve(numCells);
- }
-
- for (cellId=0; cellId < numCells && !abort; cellId++)
- {
- input->GetCellPoints(cellId, ptIds);
- numIds = ptIds->GetNumberOfIds();
-
- //abort/progress methods
- if (cellId % tenth == 0)
- {
- decimal += 0.1;
- this->UpdateProgress (decimal);
- abort = this->GetAbortExecute();
- }
-
- // get the center of the cell
- center[0] = center[1] = center[2] = 0.0;
- for (i=0; i < numIds; i++)
- {
- p = input->GetPoint(ptIds->GetId(i));
- for (j=0; j < 3; j++)
- {
- center[j] += p[j];
- }
- }
- for (j=0; j<3; j++)
- {
- center[j] /= numIds;
- }
-
- // Create new points and cells
- newPtIds->Reset();
- for (i=0; i < numIds; i++)
- {
- p = input->GetPoint(ptIds->GetId(i));
- for (j=0; j < 3; j++)
- {
- pt[j] = center[j] + this->ShrinkFactor*(p[j] - center[j]);
- }
-
- oldId = ptIds->GetId(i);
- newId = newPts->InsertNextPoint(pt);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(oldId);
- newPtIds->InsertId(i,newId);
-
- outPD->CopyData(pd, oldId, newId);
- }
- output->InsertNextCell(input->GetCellType(cellId), newPtIds);
- }//for all cells
-
- // Update ourselves and release memory
- //
- output->GetCellData()->PassData(input->GetCellData());
-
- output->SetPoints(newPts);
- output->Squeeze();
-
- ptIds->Delete();
- newPtIds->Delete();
- newPts->Delete();
-}
-
-
-void SALOME_ShrinkFilter::SetStoreMapping(int theStoreMapping){
- myStoreMapping = theStoreMapping;
- this->Modified();
-}
-
-
-vtkIdType SALOME_ShrinkFilter::GetNodeObjId(int theVtkID){
- if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
- return myVTK2ObjIds[theVtkID];
-}
+++ /dev/null
-// SALOME OBJECT : kernel of SALOME 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 : SALOME_GeometryFilter.h
-// Author : Michael ZORIN
-// Module : SALOME
-// $Header$
-
-
-#ifndef __SALOME_ShrinkFilter_h
-#define __SALOME_ShrinkFilter_h
-
-#include <vtkShrinkFilter.h>
-#include <vector>
-
-class SALOME_ShrinkFilter : public vtkShrinkFilter
-{
-public:
- static SALOME_ShrinkFilter *New();
- vtkTypeRevisionMacro(SALOME_ShrinkFilter, vtkShrinkFilter);
-
- void SetStoreMapping(int theStoreMapping);
- int GetStoreMapping(){ return myStoreMapping;}
-
- virtual vtkIdType GetNodeObjId(int theVtkID);
- virtual vtkIdType GetElemObjId(int theVtkID) { return theVtkID;}
-
-protected:
- SALOME_ShrinkFilter();
- ~SALOME_ShrinkFilter();
-
- void Execute();
- void UnstructuredGridExecute();
-
-private:
- int myStoreMapping;
- typedef std::vector<vtkIdType> TVectorId;
- TVectorId myVTK2ObjIds;
-};
-
-#endif
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_Transform.cxx
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#include "SALOME_Transform.h"
-
-#include <vtkObjectFactory.h>
-#include <vtkMatrix4x4.h>
-
-using namespace std;
-
-vtkStandardNewMacro(SALOME_Transform);
-
-void SALOME_Transform::SetScale(float theScaleX, float theScaleY, float theScaleZ){
- double aMatrix[16] = {theScaleX,0,0,0,
- 0,theScaleY,0,0,
- 0,0,theScaleZ,0,
- 0,0,0,1.0000000};
- vtkTransform::SetMatrix(aMatrix);
-}
-
-int SALOME_Transform::IsIdentity(){
- float* aScale = GetScale();
- return (aScale[0] == 1.0 && aScale[1] == 1.0 && aScale[2] == 1.0);
-}
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_Transform.h
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#ifndef SALOME_Transform_HeaderFile
-#define SALOME_Transform_HeaderFile
-
-#include <vtkTransform.h>
-
-class VTK_EXPORT SALOME_Transform : public vtkTransform{
- public:
- static SALOME_Transform *New();
- vtkTypeMacro(SALOME_Transform,vtkTransform);
-
- void SetScale(float theScaleX, float theScaleY, float theScaleZ);
- int IsIdentity();
-
-protected:
- SALOME_Transform() {}
- ~SALOME_Transform() {}
- SALOME_Transform(const SALOME_Transform&) {}
- void operator=(const SALOME_Transform&) {}
-};
-
-#endif
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_TransformFilter.h
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#include "SALOME_TransformFilter.h"
-#include "SALOME_Transform.h"
-
-#include <vtkObjectFactory.h>
-#include <vtkPointSet.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkPoints.h>
-
-using namespace std;
-
-vtkStandardNewMacro(SALOME_TransformFilter);
-
-void SALOME_TransformFilter::Execute(){
- vtkPoints *inPts;
- vtkPoints *newPts;
- int numPts, numCells;
- vtkPointSet *input = this->GetInput();
- vtkPointSet *output = this->GetOutput();
- vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData();
- vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData();
- output->CopyStructure( input );
- if(Transform){
- bool anIsIdentity = true;
- if(SALOME_Transform* aTransform = dynamic_cast<SALOME_Transform*>(Transform))
- anIsIdentity = aTransform->IsIdentity();
- inPts = input->GetPoints();
- if(!anIsIdentity && inPts){
- numPts = inPts->GetNumberOfPoints();
- numCells = input->GetNumberOfCells();
- newPts = vtkPoints::New();
- newPts->Allocate(numPts);
- this->UpdateProgress(.2);
- this->Transform->TransformPoints(inPts,newPts);
- this->UpdateProgress(.8);
- output->SetPoints(newPts);
- newPts->Delete();
- }
- }
- outPD->PassData(pd);
- outCD->PassData(cd);
-}
+++ /dev/null
-// SALOME FILTER : interactive object for VISU entities implementation
-//
-// 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 : SALOME_TransformFilter.h
-// Author : Laurent CORNABE with help of Nicolas REJNERI
-// Module : SALOME
-
-
-#ifndef SALOME_TransformFilter_HeaderFile
-#define SALOME_TransformFilter_HeaderFile
-
-#include <vtkTransformFilter.h>
-
-class VTK_EXPORT SALOME_TransformFilter : public vtkTransformFilter{
- public:
- static SALOME_TransformFilter *New();
- vtkTypeMacro(SALOME_TransformFilter,vtkTransformFilter);
-
-protected:
- SALOME_TransformFilter() {}
- ~SALOME_TransformFilter() {}
- SALOME_TransformFilter(const SALOME_TransformFilter&) {}
- void operator=(const SALOME_TransformFilter&) {}
- void Execute();
-};
-
-#endif
+++ /dev/null
-# SALOME VTKViewer : build VTK viewer into Salome desktop
-#
-# 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 : Makefile.in
-# Author : Marc Tajchman (CEA)
-# Module : SALOME
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:$(top_builddir)/inc:$(top_builddir)/idl
-
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS= VTKViewer_RenderWindow.h \
- VTKViewer_ViewFrame.h \
- VTKViewer_RenderWindowInteractor.h \
- VTKViewer_InteractorStyleSALOME.h \
- VTKViewer_Filter.h \
- VTKViewer_Prs.h \
- VTKViewer_Trihedron.h \
- VTKViewer_VectorText.h
-
-# Libraries targets
-LIB = libVTKViewer.la
-LIB_SRC= VTKViewer.cxx \
- VTKViewer_ViewFrame.cxx \
- VTKViewer_RenderWindow.cxx \
- VTKViewer_RenderWindowInteractor.cxx \
- VTKViewer_InteractorStyleSALOME.cxx \
- VTKViewer_Trihedron.cxx \
- VTKViewer_VectorText.cxx \
- VTKViewer_RectPicker.cxx \
- VTKViewer_CellRectPicker.cxx \
- VTKViewer_Utilities.cxx \
- VTKViewer_Filter.cxx \
- VTKViewer_Actor.cxx \
- VTKViewer_Prs.cxx
-
-LIB_MOC = \
- VTKViewer.h \
- VTKViewer_ViewFrame.h \
- VTKViewer_RenderWindowInteractor.h \
- VTKViewer_RenderWindow.h
-
-LIB_CLIENT_IDL = SALOMEDS.idl \
- SALOME_ModuleCatalog.idl \
- SALOME_Component.idl \
- SALOME_ContainerManager.idl \
- SALOME_Exception.idl
-
-CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES)
-
-LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomePrs -lSalomeGUI -lToolsGUI
-
-@CONCLUDE@
-
-
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer.h"
-#include "VTKViewer_ViewFrame.h"
-using namespace std;
-
-QAD_ViewFrame* VTKViewer::createView(QAD_RightFrame* parent)
-{
- return new VTKViewer_ViewFrame( parent, "vtkView" );
-}
-
-extern "C"
-{
- QAD_ViewFrame* createView(QAD_RightFrame* parent)
- {
- return VTKViewer::createView(parent);
- }
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_HeaderFile
-#define VTKViewer_HeaderFile
-
-#include "QAD_RightFrame.h"
-#include "QAD_ViewFrame.h"
-
-class VTKViewer : public QObject
-{
- Q_OBJECT
-
-public :
-
- Standard_EXPORT static QAD_ViewFrame* createView ( QAD_RightFrame* parent);
-
-};
-
-#endif
+++ /dev/null
-// 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
-
-#include "VTKViewer_Actor.h"
-
-#include "SALOME_PassThroughFilter.h"
-
-// VTK Includes
-#include <vtkObjectFactory.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDataSetMapper.h>
-#include <vtkRenderer.h>
-
-#include <vtkCell.h>
-#include <vtkPolyData.h>
-#include <vtkShrinkFilter.h>
-
-#include "utilities.h"
-
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-static void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet){
- vtkPoints *aPoints = vtkPoints::New();
- vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints();
- aPoints->SetNumberOfPoints(iEnd);
- for(vtkIdType i = 0; i < iEnd; i++){
- aPoints->SetPoint(i,theSourceDataSet->GetPoint(i));
- }
- theGrid->SetPoints(aPoints);
- aPoints->Delete();
-}
-
-
-//=======================================================================
-
-vtkStandardNewMacro(VTKViewer_Actor);
-
-VTKViewer_Actor::VTKViewer_Actor()
-{
- myRenderer = NULL;
- myIsInfinite = true;
-
- Visibility = Pickable = false;
-
- myUnstructuredGrid = vtkUnstructuredGrid::New();
- myUnstructuredGrid->Allocate();
-
- myIsShrunk = false;
- myIsShrinkable = true;
- myShrinkFilter = vtkShrinkFilter::New();
-
- myMapper = vtkDataSetMapper::New();
-
- myMapper->SetInput(myUnstructuredGrid);
- Superclass::InitPipeLine(myMapper);
-
- SetResolveCoincidentTopology(false);
-}
-
-
-void VTKViewer_Actor::SetShrinkFactor(float theValue){
- myShrinkFilter->SetShrinkFactor(theValue);
- Modified();
-}
-
-
-void VTKViewer_Actor::SetShrink()
-{
- if ( !myIsShrinkable ) return;
- if ( vtkDataSet* aDataSet = myPassFilter[0]->GetOutput() )
- {
- myShrinkFilter->SetInput( aDataSet );
- myPassFilter[1]->SetInput( myShrinkFilter->GetOutput() );
- myIsShrunk = true;
- }
-}
-
-void VTKViewer_Actor::UnShrink()
-{
- if ( !myIsShrunk ) return;
- if ( vtkDataSet* aDataSet = myPassFilter[0]->GetOutput() )
- {
- myPassFilter[1]->SetInput( aDataSet );
- myPassFilter[1]->Modified();
- myIsShrunk = false;
- Modified();
- }
-}
-
-
-//----------------------------------------------------------------------------
-VTKViewer_Actor::~VTKViewer_Actor()
-{
- if(MYDEBUG) INFOS("VTKViewer_Actor::~VTKViewer_Actor()");
-
- myMapper->RemoveAllInputs();
- myMapper->Delete();
-
- myShrinkFilter->UnRegisterAllOutputs();
- myShrinkFilter->Delete();
-
- myUnstructuredGrid->Delete();
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_Actor::MapCells(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
-{
- myUnstructuredGrid->Reset();
-
- vtkDataSet *aSourceDataSet = theMapActor->GetInput();
- CopyPoints(myUnstructuredGrid,aSourceDataSet);
-
- int aNbOfParts = theMapIndex.Extent();
- for(int ind = 1; ind <= aNbOfParts; ind++){
- int aPartId = theMapIndex( ind );
- vtkCell* aCell = theMapActor->GetElemCell(aPartId);
- myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- //for (int i = 0, iEnd = aCell->GetNumberOfEdges(); i < iEnd; i++){
- // vtkCell* anEdgeCell = aCell->GetEdge(i);
- // myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
- //}
- }
-
- UnShrink();
- if(theMapActor->IsShrunk()){
- SetShrinkFactor(theMapActor->GetShrinkFactor());
- SetShrink();
- }
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_Actor::MapPoints(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
-{
- myUnstructuredGrid->Reset();
- if(int aNbOfParts = theMapIndex.Extent()){
- vtkPoints *aPoints = vtkPoints::New();
- aPoints->SetNumberOfPoints(aNbOfParts);
- for(int i = 0; i < aNbOfParts; i++){
- int aPartId = theMapIndex( i+1 );
- float* aCoord = theMapActor->GetNodeCoord(aPartId);
- aPoints->SetPoint(i,aCoord);
- myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i);
- }
- myUnstructuredGrid->SetPoints(aPoints);
- aPoints->Delete();
- }
-
- UnShrink();
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_Actor::MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
-{
- myUnstructuredGrid->Reset();
-
- vtkDataSet *aSourceDataSet = theMapActor->GetInput();
- CopyPoints(myUnstructuredGrid,aSourceDataSet);
-
- int iEnd = theMapIndex.Extent();
- int aCellId = -1, aCellCounter = 0;
- for(int i = 1; i <= iEnd; i++){
- int anId = theMapIndex( i );
- if(anId > 0) {
- aCellCounter++;
- aCellId = anId;
- }
- }
-
- if(aCellCounter == 1){
- vtkCell* aCell = theMapActor->GetElemCell(aCellId);
- if(aCell->GetCellType() <= VTK_LINE){
- myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- }else{
- int aNbOfParts = aCell->GetNumberOfEdges();
- for(int i = 1; i <= iEnd; i++){
- int aPartId = theMapIndex(i);
- if( aPartId < 0){
- aPartId = -aPartId-1;
- if(0 > aPartId || aPartId >= aNbOfParts) break;
- vtkCell* anEdgeCell = aCell->GetEdge(aPartId);
- myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
- }
- }
- }
- }else{
- int aNbOfParts = aSourceDataSet->GetNumberOfCells();
- for(int i = 1; i <= iEnd; i++){
- int aPartId = theMapIndex( i );
- if(aPartId > 0){
- if(aPartId >= aNbOfParts) break;
- vtkCell* aCell = aSourceDataSet->GetCell(aPartId);
- myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- }
- }
- }
-
- UnShrink();
- if(theMapActor->IsShrunk()){
- SetShrinkFactor(theMapActor->GetShrinkFactor());
- SetShrink();
- }
-}
-
-//----------------------------------------------------------------------------
+++ /dev/null
-// 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
-
-#ifndef VTKVIEWER_ACTOR_H
-#define VTKVIEWER_ACTOR_H
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-class vtkRenderer;
-class vtkShrinkFilter;
-class vtkDataSetMapper;
-class vtkUnstructuredGrid;
-
-#include "SALOME_Actor.h"
-
-class VTKViewer_Actor : public SALOME_Actor {
- public:
- vtkTypeMacro(VTKViewer_Actor,SALOME_Actor);
- static VTKViewer_Actor* New();
- virtual ~VTKViewer_Actor();
-
- void SetShrinkFactor(float value);
- virtual void SetShrink();
- virtual void UnShrink();
-
- void MapCells(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
-
- void MapPoints(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
-
- void MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
-
- protected:
- vtkUnstructuredGrid* myUnstructuredGrid;
- vtkDataSetMapper* myMapper;
-
- vtkRenderer* myRenderer;
-
- vtkShrinkFilter* myShrinkFilter;
- bool myIsShrinkable;
- bool myIsShrunk;
-
- VTKViewer_Actor();
-};
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_ViewFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_Algorithm_H
-#define VTKViewer_Algorithm_H
-
-class vtkActor;
-class vtkActorCollection;
-
-namespace SALOME{
- namespace VTK{
-
- template<typename TActor, typename TFunction>
- TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun)
- {
- if(theCollection){
- theCollection->InitTraversal();
- while(vtkActor *anAct = theCollection->GetNextActor())
- if(TActor *anActor = dynamic_cast<TActor*>(anAct))
- theFun(anActor);
- }
- return theFun;
- }
-
-
- template<typename TActor, typename TPredicate, typename TFunction>
- TFunction ForEachIf(vtkActorCollection *theCollection,
- TPredicate thePredicate,
- TFunction theFun)
- {
- if(theCollection){
- theCollection->InitTraversal();
- while(vtkActor *anAct = theCollection->GetNextActor())
- if(TActor *anActor = dynamic_cast<TActor*>(anAct))
- if(thePredicate(anActor))
- theFun(anActor);
- }
- return theFun;
- }
-
-
- template<typename TActor, typename TPredicate>
- TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate)
- {
- if(theCollection){
- theCollection->InitTraversal();
- while(vtkActor *anAct = theCollection->GetNextActor())
- if(TActor *anActor = dynamic_cast<TActor*>(anAct))
- if(thePredicate(anActor))
- return anActor;
- }
- return NULL;
- }
-
- }
-}
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_CellRectPicker.cxx
-// Author : Natalia KOPNOVA
-// Module : SALOME
-
-#include <VTKViewer_CellRectPicker.h>
-
-#include "vtkGenericCell.h"
-#include "vtkAssemblyNode.h"
-#include "vtkAssemblyPath.h"
-#include "vtkObjectFactory.h"
-#include "vtkImageData.h"
-#include "vtkMapper.h"
-#include "vtkVolumeMapper.h"
-#include "vtkMath.h"
-#include "vtkLine.h"
-#include "vtkQuad.h"
-#include "vtkPoints.h"
-#include "vtkPlane.h"
-#include "vtkActor.h"
-
-using namespace std;
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VTKViewer_CellRectPicker);
-//----------------------------------------------------------------------------
-
-VTKViewer_CellRectPicker::VTKViewer_CellRectPicker()
-{
- this->Cell = vtkGenericCell::New();
- this->Quad1 = vtkQuad::New();
- this->Quad2 = vtkQuad::New();
-}
-
-VTKViewer_CellRectPicker::~VTKViewer_CellRectPicker()
-{
- this->Cell->Delete();
- this->Quad1->Delete();
- this->Quad2->Delete();
-}
-
-void VTKViewer_CellRectPicker::Initialize()
-{
- ActorData.clear();
- this->VTKViewer_RectPicker::Initialize();
-}
-
-//----------------------------------------------------------------------------
-float VTKViewer_CellRectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
- vtkAssemblyPath *path, vtkProp3D *prop3D,
- vtkAbstractMapper3D *m)
-{
- vtkDataSet *input;
- vtkMapper *mapper;
- vtkVolumeMapper *volumeMapper;
-
- // Get the underlying dataset
- if ( (mapper=vtkMapper::SafeDownCast(m)) != NULL ) {
- input = mapper->GetInput();
- }
- else if ( (volumeMapper=vtkVolumeMapper::SafeDownCast(m)) != NULL ) {
- input = volumeMapper->GetInput();
- }
- else {
- return VTK_LARGE_FLOAT;
- }
-
- vtkIdType numCells;
- if ( (numCells = input->GetNumberOfCells()) < 1 ) {
- return 2.0;
- }
-
- int i, k, subId;
- float bounds[6], center[3], cp1[3], cp2[3];
- float pcoord[3], weight[4], dist;
- float t1[2], t2[2], x[3], t;
-
- for (k = 0; k < 4; k++) {
- this->Quad1->PointIds->SetId(k, k);
- this->Quad1->Points->SetPoint(k, p1[k]);
- this->Quad2->PointIds->SetId(k, k);
- this->Quad2->Points->SetPoint(k, p2[k]);
- }
-
- /*
- cout << "---> Selection area:" << endl;
- for (k = 0; k < 4; k++)
- cout << "\t(" << p1[k][0] << ", " << p1[k][1] << ", " << p1[k][2] << ")";
- cout << endl;
- for (k = 0; k < 4; k++)
- cout << "\t(" << p2[k][0] << ", " << p2[k][1] << ", " << p2[k][2] << ")";
- cout << endl;
- */
-
- vtkIdType cellId;
- VTKViewer_CellData cellData;
- VTKViewer_CellDataSet dataList;
-
- char inside; int n; float *point;
- float tMin = VTK_LARGE_FLOAT, xMin[3];
- for (cellId = 0; cellId < numCells; cellId++) {
- input->GetCell(cellId, this->Cell);
-
- this->Cell->GetBounds(bounds);
- for (i = 0; i < 3; i++)
- center[i] = (bounds[2*i]+bounds[2*i+1])/2;
-
- /*
- if (!VTKViewer_RectPicker::PointInside(center, p1, p2, 0.01))
- continue;
- */
-
- inside = 1;
- n = this->Cell->Points->GetNumberOfPoints();
- //cout << "---> Info cell " << cellId << " (" << n << "): " << endl;
- for (k = 0; k < n; k++) {
- point = this->Cell->Points->GetPoint(k);
- //cout << " P (" << point[0] << ", " << point[1] << ", " << point[2] << ")";
- if (!VTKViewer_RectPicker::PointInside(point, p1, p2)) {
- inside = 0; break;
- }
- }
- //cout << endl;
- if (!inside) continue;
-
- //cout << "---> Inside cell " << cellId << endl;
-
- this->Quad1->EvaluatePosition(center, 0, subId, pcoord, dist, weight);
- t1[0] = pcoord[0]; t1[1] = pcoord[1];
- this->Quad2->EvaluatePosition(center, 0, subId, pcoord, dist, weight);
- t2[0] = pcoord[0]; t2[1] = pcoord[1];
-
- pcoord[0] = (t1[0]+t2[0])/2; pcoord[1] = (t1[1]+t2[1])/2; pcoord[2] = 0;
-
- this->Quad1->EvaluateLocation(subId, pcoord, cp1, weight);
- this->Quad2->EvaluateLocation(subId, pcoord, cp2, weight);
-
- if (this->Cell->IntersectWithLine(cp1, cp2, tol, t, x, pcoord, subId)) {
- cellData.cellId = cellId;
- cellData.subId = subId;
- cellData.depth = t;
- for (i = 0; i < 3; i++) {
- cellData.p1[i] = cp1[i];
- cellData.p2[i] = cp2[i];
- }
- /*
- cout << "---> Include cell " << cellId << ", depth = " << t << endl;
- cout << " P1 = (" << cp1[0] << ", " << cp1[1] << ", " << cp1[2] << ")" << endl;
- cout << " P2 = (" << cp2[0] << ", " << cp2[1] << ", " << cp2[2] << ")" << endl;
- */
- IncludeCell(input, cellData, dataList);
- if (t < tMin) {
- tMin = t;
- for (i = 0; i < 3; i++)
- xMin[i] = x[i];
- }
- }
- }
-
- if (!dataList.empty()) {
- // compare against other actors
- IncludeActor(prop3D, input, dataList);
- if (tMin < this->GlobalTMin) {
- this->MarkPicked(path, prop3D, m, tMin, xMin);
- }
- }
-
- return tMin;
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_CellRectPicker::IncludeCell(vtkDataSet* input,
- VTKViewer_CellData cellData,
- VTKViewer_CellDataSet& dataList)
-{
- vtkGenericCell* cell1 = vtkGenericCell::New();
- vtkGenericCell* cell2 = vtkGenericCell::New();
- vtkCell* sub1 = 0;
- vtkCell* sub2 = 0;
-
- input->GetCell(cellData.cellId, cell1);
- if (cell1->GetNumberOfFaces() > 0)
- sub1 = cell1->GetFace(cellData.subId);
-
- int i, result;
- float p1[3], p2[3], dir[3];
- char add = 1;
-
- VTKViewer_CellData curData;
- VTKViewer_CellDataSet::iterator it;
- for (it = dataList.begin(); it != dataList.end();) {
- curData = *it;
- for (i = 0; i < 3; i++) {
- p1[i] = (cellData.p1[i]+curData.p1[i])/2;
- p2[i] = (cellData.p2[i]+curData.p2[i])/2;
- dir[i] = p2[i] - p1[i];
- }
-
- input->GetCell(curData.cellId, cell2);
- sub2 = 0;
- if (cell2->GetNumberOfFaces() > 0)
- sub2 = cell2->GetFace(curData.subId);
-
- if (sub1) {
- if (sub2)
- result = IntersectCells(sub1, cellData.depth,
- sub2, curData.depth, dir);
- else
- result = IntersectCells(sub1, cellData.depth,
- cell2, curData.depth, dir);
- }
- else {
- if (sub2)
- result = IntersectCells(cell1, cellData.depth,
- sub2, curData.depth, dir);
- else
- result = IntersectCells(cell1, cellData.depth,
- cell2, curData.depth, dir);
- }
- /*
- cout << " Direction = (" << dir[0] << ", " << dir[1] << ", " << dir[2] << ")";
- cout << " depth = " << cellData.depth << ", " << curData.depth << ", " << result << endl;
- */
- if (result > 0) {
- if (result == 1) {
- it = dataList.erase(it);
- continue;
- }
- else {
- add = 0;
- break;
- }
- }
- ++it;
- }
- if (add) {
- //cout << " add " << endl;
- dataList.push_back(cellData);
- }
-
- cell1->Delete();
- cell2->Delete();
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_CellRectPicker::IncludeActor(vtkProp3D* prop,
- vtkDataSet* input,
- VTKViewer_CellDataSet& dataList)
-{
- vtkGenericCell* cell1 = vtkGenericCell::New();
- vtkGenericCell* cell2 = vtkGenericCell::New();
-
- int i, result;
- float p1[3], p2[3], dir[3];
- char removed;
-
- VTKViewer_CellDataSet actorData;
- VTKViewer_CellData curData, cellData;
- VTKViewer_CellDataSet::iterator it1, it2;
- VTKViewer_ActorDataMap::iterator it;
-
- for (it1 = dataList.begin(); it1 != dataList.end();) {
- cellData = *it1;
- input->GetCell(cellData.cellId, cell1);
- removed = 0;
-
- for (it = ActorData.begin(); it != ActorData.end(); ++it) {
- vtkActor* actor = (*it).first;
- actorData = (*it).second;
-
- for (it2 = actorData.begin(); it2 != actorData.end();) {
- curData = *it2;
- for (i = 0; i < 3; i++) {
- p1[i] = (cellData.p1[i]+curData.p1[i])/2;
- p2[i] = (cellData.p2[i]+curData.p2[i])/2;
- dir[i] = p2[i] - p1[i];
- }
-
- actor->GetMapper()->GetInput()->GetCell(curData.cellId, cell2);
- result = IntersectCells(cell1, cellData.depth,
- cell2, curData.depth, dir);
- if (result > 0) {
- if (result == 1) {
- it2 = actorData.erase(it2);
- continue;
- }
- else {
- removed = 1;
- it1 = dataList.erase(it1);
- break;
- }
- break;
- }
- ++it2;
- }
- if (removed) break;
- } // by actors
- if (!removed) ++it1;
- }
-
- if (!dataList.empty()) {
- vtkActor* actor;
- if ((actor = vtkActor::SafeDownCast(prop)) != NULL)
- ActorData[actor] = dataList;
- }
-
- cell1->Delete();
- cell2->Delete();
-}
-
-int VTKViewer_CellRectPicker::IntersectCells(vtkCell* c1, float d1, vtkCell* c2, float d2, float dir[3])
-{
- int i, k;
- float *orig, cp[3], bounds[6];
- vtkCell* cell = 0;
- vtkCell* tcell = 0;
-
- // define the central point and cell for projection
- if (fabs(d1-d2) < 1.e-7) return 0;
-
- if (d1 < d2) {
- orig = c1->Points->GetPoint(0);
- cell = c1;
- tcell = c2;
- c2->GetBounds(bounds);
- for (i = 0; i < 3; i++)
- cp[i] = (bounds[2*i] + bounds[2*i+1])/2;
- }
- else if (d1 > d2) {
- orig = c2->Points->GetPoint(0);
- cell = c2;
- tcell = c1;
- c1->GetBounds(bounds);
- for (i = 0; i < 3; i++)
- cp[i] = (bounds[2*i] + bounds[2*i+1])/2;
- }
-
- float proj[3];
- vtkPlane::GeneralizedProjectPoint(cp, orig, dir, proj);
-
- float *p, pp[3];
- vtkPoints* aPoints = vtkPoints::New();
- for (k = 0; k < cell->Points->GetNumberOfPoints(); k++) {
- p = cell->Points->GetPoint(k);
- vtkPlane::GeneralizedProjectPoint(p, orig, dir, pp);
- aPoints->InsertNextPoint(pp[0], pp[1], pp[2]);
- }
-
- int result = 0;
- if (PointInside(proj, aPoints)) {
- result = (d1<d2) ? 1 : 2;
- }
-
- if (result == 0) {
- // test for boundary cells
- for (k = 0; k < tcell->Points->GetNumberOfPoints(); k++) {
- p = tcell->Points->GetPoint(k);
- vtkPlane::GeneralizedProjectPoint(p, orig, dir, pp);
- if (PointInside(pp, aPoints)) {
- result = 1; break;
- }
- }
- if (result && d2<d1) result = 2;
- }
-
- aPoints->Delete();
- return result;
-}
-
-char VTKViewer_CellRectPicker::PointInside(float point[3], vtkPoints* list)
-{
- int i, k, l, n;
- float x[3], *a1, *a2, v[3], p[3], q[3];
-
- n = list->GetNumberOfPoints();
- if (n < 3) return 0;
-
- for (k = 0; k < n; k++) {
- l = k+1; if (l == n) l = 0;
- a1 = list->GetPoint(k);
- a2 = list->GetPoint(l);
-
- // compute vectors
- for (i = 0; i < 3; i++) {
- x[i] = point[i] - a1[i];
- v[i] = a2[i]-a1[i];
- }
-
- // check if point coincides with vertex
- if (x[0]*x[0] + x[1]*x[1] + x[2]*x[2] < 1.e-7) return 0;
-
- // compute normal
- vtkMath::Cross(x, v, p);
-
- // check if point lays on edge
- if (p[0]*p[0] + p[1]*p[1] + p[2]*p[2] < 1.e-7) return 0;
-
- // check if normals are in the same direction
- if (k > 0) {
- if (vtkMath::Dot(p, q) < 0.0) return 0;
- }
-
- // remember normal direction
- for (i = 0; i < 3; i++) {
- q[i] = p[i];
- }
- }
-
- return 1;
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_CellRectPicker.h
-// Author : Natalia KOPNOVA
-// Module : SALOME
-
-#ifndef __VTKViewer_CellRectPicker_h
-#define __VTKViewer_CellRectPicker_h
-
-#include "VTKViewer_RectPicker.h"
-#include <map>
-#include <vector>
-
-typedef struct {
- vtkIdType cellId;
- int subId;
- float depth;
- float p1[3];
- float p2[3];
-} VTKViewer_CellData;
-
-typedef std::vector<VTKViewer_CellData> VTKViewer_CellDataSet;
-typedef std::map<vtkActor*, VTKViewer_CellDataSet> VTKViewer_ActorDataMap;
-
-class vtkCell;
-class vtkGenericCell;
-class vtkQuad;
-
-class VTK_EXPORT VTKViewer_CellRectPicker : public VTKViewer_RectPicker
-{
-public:
- static VTKViewer_CellRectPicker *New();
- vtkTypeMacro(VTKViewer_CellRectPicker,VTKViewer_RectPicker);
-
- // Description:
- // Get the id of the picked cells.
- // (Notes: use GetActors() to get picked actors list)
- VTKViewer_CellDataSet GetCellData(vtkActor* actor)
- { return this->ActorData[actor]; }
-
- // Description:
- // The method returns a non-zero value if the cells intersect each other
- // in the direction dir[3]. Returned value is 1 if the first cell is top of
- // the second one according to direction and 2 if the second cell is top.
- static int IntersectCells(vtkCell* c1, float d1, vtkCell* c2, float d2, float dir[3]);
-
- // Description:
- // The method returns a non-zero value if the point is inlide point data set
- static char PointInside(float point[3], vtkPoints* list);
-
-protected:
- VTKViewer_CellRectPicker();
- ~VTKViewer_CellRectPicker();
-
- VTKViewer_ActorDataMap ActorData;
-
- virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
- vtkAssemblyPath *path, vtkProp3D *p,
- vtkAbstractMapper3D *m);
- void Initialize();
-
- void IncludeCell(vtkDataSet* input, VTKViewer_CellData cellData, VTKViewer_CellDataSet& dalaList);
- void IncludeActor(vtkProp3D* prop, vtkDataSet* input, VTKViewer_CellDataSet& dataList);
-
-private:
- vtkGenericCell *Cell;
- vtkQuad* Quad1;
- vtkQuad* Quad2;
-};
-
-#endif
-
-
+++ /dev/null
-// VTKViewer_Filter : Filter for VTK viewer\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-// File : VTKViewer_Filter.cxx\r
-// Author : Sergey LITONIN\r
-// Module : SALOME\r
-\r
-#include "VTKViewer_Filter.h"\r
-using namespace std;\r
-\r
-IMPLEMENT_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared)\r
-IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, MMgt_TShared)\r
-\r
-/*\r
- Class : VTKViewer_Filter\r
- Description : Base class of filters of for VTK viewer. Method IsValid \r
- should be redefined in derived classes\r
-*/\r
-\r
-VTKViewer_Filter::VTKViewer_Filter()\r
-{\r
- myActor = 0;\r
-}\r
-\r
-VTKViewer_Filter::~VTKViewer_Filter()\r
-{\r
-}\r
-\r
-bool VTKViewer_Filter::IsValid( SALOME_Actor* theActor, const int theCellId )\r
-{\r
- SetActor( theActor );\r
- return IsValid( theCellId );\r
-}\r
-\r
-void VTKViewer_Filter::SetActor( SALOME_Actor* theActor )\r
-{\r
- myActor = theActor;\r
-}\r
+++ /dev/null
-// SMESHGUI_Filter : Filter for VTK viewer\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-// File : VTKViewer_Filter.h\r
-// Author : Sergey LITONIN\r
-// Module : SALOME\r
-\r
-#ifndef VTKViewer_Filter_HeaderFile\r
-#define VTKViewer_Filter_HeaderFile\r
-\r
-#include <MMgt_TShared.hxx>\r
-#include <Standard_DefineHandle.hxx>\r
-\r
-class SALOME_Actor;\r
-\r
-DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared)\r
-\r
-/*\r
- Class : VTKViewer_Filter\r
- Description : Base class of filters of for VTK viewer. Method IsValid \r
- should be redefined in derived classes\r
-*/\r
-\r
-class VTKViewer_Filter : public MMgt_TShared\r
-{\r
-\r
-public:\r
- VTKViewer_Filter();\r
- virtual ~VTKViewer_Filter();\r
-\r
- bool IsValid( SALOME_Actor*, const int theId );\r
- virtual bool IsValid( const int theId ) const = 0;\r
- virtual int GetId() const = 0;\r
- virtual bool IsNodeFilter() const = 0;\r
-\r
- virtual void SetActor( SALOME_Actor* );\r
- \r
-protected:\r
-\r
- SALOME_Actor* myActor;\r
-\r
-public: \r
- DEFINE_STANDARD_RTTI(VTKViewer_Filter)\r
-};\r
-\r
-#endif\r
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_ViewFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_Functor_H
-#define VTKViewer_Functor_H
-
-#include <functional>
-
-#include <string>
-#include "SALOME_InteractiveObject.hxx"
-
-namespace SALOME{
- namespace VTK{
-
-
- template<class TActor> 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<class TActor> 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<class TActor, class TArg, class TStoreArg = TArg> struct TSetFunction
- {
- typedef void (TActor::* TAction)(TArg);
- TAction myAction;
- TStoreArg myArg;
- TSetFunction(TAction theAction, TArg theArg):
- myAction(theAction), myArg(theArg)
- {}
- void operator()(TActor* theActor){
- (theActor->*myAction)(myArg);
- }
- };
-
-
- template<class TActor, class TArg = int> struct TSetVisibility: TSetFunction<TActor,TArg>
- {
- TSetVisibility(TArg theArg):
- TSetFunction<TActor,TArg>(&TActor::SetVisibility,theArg)
- {}
- };
-
-
- }
-}
-
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_InteractorStyleSALOME.cxx
-// Author : Christophe ATTANASIO
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer_InteractorStyleSALOME.h"
-
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_ViewFrame.h"
-
-#include "VTKViewer_Utilities.h"
-#include "VTKViewer_Trihedron.h"
-#include "VTKViewer_RectPicker.h"
-#include "VTKViewer_CellRectPicker.h"
-
-#include "QAD_Config.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-
-#include "SALOME_Actor.h"
-#include "VTKViewer_Actor.h"
-#include "SALOME_Selection.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include <vtkObjectFactory.h>
-#include <vtkMath.h>
-#include <vtkCommand.h>
-#include <vtkCamera.h>
-#include <vtkRenderer.h>
-#include <vtkPicker.h>
-#include <vtkPointPicker.h>
-#include <vtkCellPicker.h>
-#include <vtkLine.h>
-#include <vtkMapper.h>
-#include <vtkDataSet.h>
-#include <vtkSmartPointer.h>
-
-#include <qapplication.h>
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qpainter.h>
-#endif
-//VRV: porting on Qt 3.0.5
-#include <algorithm>
-
-#include "utilities.h"
-
-using namespace std;
-
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-static bool IsStored(Handle(SALOME_InteractiveObject)& theIO,
- const SALOME_ListIO& theListIO)
-{
- if (!theListIO.IsEmpty()){
- SALOME_ListIteratorOfListIO anIter(theListIO);
- for(; anIter.More(); anIter.Next()) {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(theIO->isSame(anIO)) {
- theIO = anIO; //Added by SRN, fix SAL1307
- return true;
- }
- }
- }
- return false;
-}
-
-
-static bool IsSelected(Handle(SALOME_InteractiveObject)& theIO,
- SALOME_Selection* theSel)
-{
- return IsStored(theIO,theSel->StoredIObjects());
-}
-
-
-static int GetEdgeId(vtkPicker *thePicker, SALOME_Actor *theActor, int theObjId){
- int anEdgeId = -1;
- if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
- float aPickPosition[3];
- thePicker->GetPickPosition(aPickPosition);
- float aMinDist = 1000000.0, aDist = 0;
- for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
- if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
- int subId; float pcoords[3], closestPoint[3], weights[3];
- aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
- if (aDist < aMinDist) {
- aMinDist = aDist;
- anEdgeId = i;
- }
- }
- }
- }
- return anEdgeId;
-}
-
-
-static bool CheckDimensionId(Selection_Mode theMode, SALOME_Actor *theActor, vtkIdType theObjId){
- switch(theMode){
- case CellSelection:
- return true;
- case EdgeSelection:
- return ( theActor->GetObjDimension( theObjId ) == 1 );
- case FaceSelection:
- return ( theActor->GetObjDimension( theObjId ) == 2 );
- case VolumeSelection:
- return ( theActor->GetObjDimension( theObjId ) == 3 );
- };
- return false;
-}
-
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VTKViewer_InteractorStyleSALOME);
-//----------------------------------------------------------------------------
-
-VTKViewer_InteractorStyleSALOME::VTKViewer_InteractorStyleSALOME()
-{
- m_Trihedron = 0;
- this->MotionFactor = 10.0;
- this->State = VTK_INTERACTOR_STYLE_CAMERA_NONE;
- this->RadianToDegree = 180.0 / vtkMath::Pi();
- this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
- loadCursors();
-
- myPreSelectionActor = VTKViewer_Actor::New();
- myPreSelectionActor->GetProperty()->SetColor(0,1,1);
- myPreSelectionActor->GetProperty()->SetLineWidth(5);
- myPreSelectionActor->GetProperty()->SetPointSize(5);
-
- OnSelectionModeChanged();
-}
-
-//----------------------------------------------------------------------------
-VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()
-{
- if(MYDEBUG) INFOS("VTKViewer_InteractorStyleSALOME::~VTKViewer_InteractorStyleSALOME()");
- m_ViewFrame->RemoveActor(myPreSelectionActor);
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setPreselectionProp(const double& theRed, const double& theGreen,
- const double& theBlue, const int& theWidth)
-{
- if ( myPreSelectionActor->GetProperty() == 0 )
- return;
- myPreSelectionActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- myPreSelectionActor->GetProperty()->SetLineWidth(theWidth);
- myPreSelectionActor->GetProperty()->SetPointSize(theWidth);
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::SetInteractor(vtkRenderWindowInteractor *theInteractor){
- m_Interactor = dynamic_cast<VTKViewer_RenderWindowInteractor*>(theInteractor);
- Superclass::SetInteractor(theInteractor);
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setViewFrame(VTKViewer_ViewFrame* theViewFrame){
- m_ViewFrame = theViewFrame;
- m_ViewFrame->AddActor(myPreSelectionActor);
- myPreSelectionActor->Delete();
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setGUIWindow(QWidget* theWindow){
- myGUIWindow = theWindow;
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::setTriedron(VTKViewer_Trihedron* theTrihedron){
- m_Trihedron = theTrihedron;
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::RotateXY(int dx, int dy)
-{
- double rxf;
- double ryf;
- vtkCamera *cam;
-
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
-
- int *size = this->CurrentRenderer->GetRenderWindow()->GetSize();
- this->DeltaElevation = -20.0 / size[1];
- this->DeltaAzimuth = -20.0 / size[0];
-
- rxf = (double)dx * this->DeltaAzimuth * this->MotionFactor;
- ryf = (double)dy * this->DeltaElevation * this->MotionFactor;
-
- cam = this->CurrentRenderer->GetActiveCamera();
- cam->Azimuth(rxf);
- cam->Elevation(ryf);
- cam->OrthogonalizeViewUp();
- ::ResetCameraClippingRange(this->CurrentRenderer);
- //this->Interactor->Render();
- myGUIWindow->update();
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::PanXY(int x, int y, int oldX, int oldY)
-{
- TranslateView(x, y, oldX, oldY);
- //this->Interactor->Render();
- myGUIWindow->update();
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::DollyXY(int dx, int dy)
-{
- if (this->CurrentRenderer == NULL) return;
-
- double dxf = this->MotionFactor * (double)(dx) / (double)(this->CurrentRenderer->GetCenter()[1]);
- double dyf = this->MotionFactor * (double)(dy) / (double)(this->CurrentRenderer->GetCenter()[1]);
-
- double zoomFactor = pow((double)1.1, dxf + dyf);
-
- vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
- if (aCam->GetParallelProjection())
- aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
- else{
- aCam->Dolly(zoomFactor);
- ::ResetCameraClippingRange(this->CurrentRenderer);
- }
-
- //this->Interactor->Render();
- myGUIWindow->update();
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::SpinXY(int x, int y, int oldX, int oldY)
-{
- vtkCamera *cam;
-
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
-
- double newAngle = atan2((double)(y - this->CurrentRenderer->GetCenter()[1]),
- (double)(x - this->CurrentRenderer->GetCenter()[0]));
- double oldAngle = atan2((double)(oldY -this->CurrentRenderer->GetCenter()[1]),
- (double)(oldX - this->CurrentRenderer->GetCenter()[0]));
-
- newAngle *= this->RadianToDegree;
- oldAngle *= this->RadianToDegree;
-
- cam = this->CurrentRenderer->GetActiveCamera();
- cam->Roll(newAngle - oldAngle);
- cam->OrthogonalizeViewUp();
-
- //this->Interactor->Render();
- myGUIWindow->update();
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnMouseMove(int vtkNotUsed(ctrl),
- int shift,
- int x, int y)
-{
- myShiftState = shift;
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- onOperation(QPoint(x, y));
- else if (ForcedState == VTK_INTERACTOR_STYLE_CAMERA_NONE)
- onCursorMove(QPoint(x, y));
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnLeftButtonDown(int ctrl, int shift,
- int x, int y)
-{
- if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) {
- this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
- return;
- }
- this->FindPokedRenderer(x, y);
- if (this->CurrentRenderer == NULL) {
- return;
- }
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- myOtherPoint = myPoint = QPoint(x, y);
- if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- startOperation(ForcedState);
- } else {
- if (ctrl)
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
- else
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
- }
- return;
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnLeftButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
-{
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnMiddleButtonDown(int ctrl,
- int shift,
- int x, int y)
-{
- if (this->HasObserver(vtkCommand::MiddleButtonPressEvent))
- {
- this->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL);
- return;
- }
- this->FindPokedRenderer(x, y);
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- myOtherPoint = myPoint = QPoint(x, y);
- if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- startOperation(ForcedState);
- }
- else {
- if (ctrl)
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
- }
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnMiddleButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
-{
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnRightButtonDown(int ctrl,
- int shift,
- int x, int y)
-{
- if (this->HasObserver(vtkCommand::RightButtonPressEvent))
- {
- this->InvokeEvent(vtkCommand::RightButtonPressEvent,NULL);
- return;
- }
- this->FindPokedRenderer(x, y);
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- myOtherPoint = myPoint = QPoint(x, y);
- if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- startOperation(ForcedState);
- }
- else {
- if (ctrl)
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
- }
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::OnRightButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
-{
- myShiftState = shift;
- // finishing current viewer operation
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
-}
-
-//----------------------------------------------------------------------------
-/* XPM */
-const char* imageZoomCursor[] = {
-"32 32 3 1",
-". c None",
-"a c #000000",
-"# c #ffffff",
-"................................",
-"................................",
-".#######........................",
-"..aaaaaaa.......................",
-"................................",
-".............#####..............",
-"...........##.aaaa##............",
-"..........#.aa.....a#...........",
-".........#.a.........#..........",
-".........#a..........#a.........",
-"........#.a...........#.........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-"........#a............#a........",
-".........#...........#.a........",
-".........#a..........#a.........",
-".........##.........#.a.........",
-"........#####.....##.a..........",
-".......###aaa#####.aa...........",
-"......###aa...aaaaa.......#.....",
-".....###aa................#a....",
-"....###aa.................#a....",
-"...###aa...............#######..",
-"....#aa.................aa#aaaa.",
-".....a....................#a....",
-"..........................#a....",
-"...........................a....",
-"................................",
-"................................",
-"................................",
-"................................"};
-
-const char* imageRotateCursor[] = {
-"32 32 3 1",
-". c None",
-"a c #000000",
-"# c #ffffff",
-"................................",
-"................................",
-"................................",
-"................................",
-"........#.......................",
-".......#.a......................",
-"......#######...................",
-".......#aaaaa#####..............",
-"........#..##.a#aa##........##..",
-".........a#.aa..#..a#.....##.aa.",
-".........#.a.....#...#..##.aa...",
-".........#a.......#..###.aa.....",
-"........#.a.......#a..#aa.......",
-"........#a.........#..#a........",
-"........#a.........#a.#a........",
-"........#a.........#a.#a........",
-"........#a.........#a.#a........",
-".........#.........#a#.a........",
-"........##a........#a#a.........",
-"......##.a#.......#.#.a.........",
-"....##.aa..##.....##.a..........",
-"..##.aa.....a#####.aa...........",
-"...aa.........aaa#a.............",
-"................#.a.............",
-"...............#.a..............",
-"..............#.a...............",
-"...............a................",
-"................................",
-"................................",
-"................................",
-"................................",
-"................................"};
-
-
-//----------------------------------------------------------------------------
-// loads cursors for viewer operations - zoom, pan, etc...
-void VTKViewer_InteractorStyleSALOME::loadCursors()
-{
- myDefCursor = QCursor(ArrowCursor);
- myHandCursor = QCursor(PointingHandCursor);
- myPanCursor = QCursor(SizeAllCursor);
- myZoomCursor = QCursor(QPixmap(imageZoomCursor));
- myRotateCursor = QCursor(QPixmap(imageRotateCursor));
- mySpinCursor = QCursor(QPixmap(imageRotateCursor)); // temporarly !!!!!!
- myGlobalPanCursor = QCursor(CrossCursor);
- myCursorState = false;
-}
-
-
-//----------------------------------------------------------------------------
-// event filter - controls mouse and keyboard events during viewer operations
-bool VTKViewer_InteractorStyleSALOME::eventFilter(QObject* object, QEvent* event)
-{
- if (!myGUIWindow) return false;
- if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myGUIWindow)
- {
- qApp->removeEventFilter(this);
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- return QObject::eventFilter(object, event);
-}
-
-
-//----------------------------------------------------------------------------
-// starts Zoom operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startZoom()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ZOOM;
- qApp->installEventFilter(this);
-}
-
-
-//----------------------------------------------------------------------------
-// starts Pan operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startPan()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_PAN);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN;
- qApp->installEventFilter(this);
-}
-
-//----------------------------------------------------------------------------
-// starts Rotate operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startRotate()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ROTATE;
- qApp->installEventFilter(this);
-}
-
-
-//----------------------------------------------------------------------------
-// starts Spin operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startSpin()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_SPIN);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_SPIN;
- qApp->installEventFilter(this);
-}
-
-
-
-//----------------------------------------------------------------------------
-// starts Fit Area operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startFitArea()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_FIT);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_FIT;
- qApp->installEventFilter(this);
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_InteractorStyleSALOME::ViewFitAll() {
- int aTriedronWasVisible = false;
- if(m_Trihedron){
- aTriedronWasVisible = m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
- if(aTriedronWasVisible) m_Trihedron->VisibilityOff();
- }
-
- if(m_Trihedron->GetVisibleActorCount(CurrentRenderer)){
- m_Trihedron->VisibilityOff();
- ::ResetCamera(CurrentRenderer);
- }else{
- m_Trihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
- ::ResetCamera(CurrentRenderer,true);
- }
- if(aTriedronWasVisible) m_Trihedron->VisibilityOn();
- else m_Trihedron->VisibilityOff();
- ::ResetCameraClippingRange(CurrentRenderer);
-}
-
-
-//----------------------------------------------------------------------------
-// starts Global Panning operation (e.g. through menu command)
-void VTKViewer_InteractorStyleSALOME::startGlobalPan()
-{
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- {
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN);
- ForcedState = VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN;
-
- // store current zoom scale
- vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- myScale = cam->GetParallelScale();
-
- ViewFitAll();
-
- if (myGUIWindow) myGUIWindow->update();
-
- qApp->installEventFilter(this);
-}
-
-
-//----------------------------------------------------------------------------
-// returns TRUE if needs redrawing
-bool VTKViewer_InteractorStyleSALOME::needsRedrawing()
-{
- return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM ||
- State == VTK_INTERACTOR_STYLE_CAMERA_PAN ||
- State == VTK_INTERACTOR_STYLE_CAMERA_ROTATE ||
- State == VTK_INTERACTOR_STYLE_CAMERA_SPIN ||
- State == VTK_INTERACTOR_STYLE_CAMERA_NONE;
-}
-
-
-//----------------------------------------------------------------------------
-// fits viewer contents to rect
-void VTKViewer_InteractorStyleSALOME::fitRect(const int left,
- const int top,
- const int right,
- const int bottom)
-{
- if (this->CurrentRenderer == NULL) return;
-
- // move camera
- int x = (left + right)/2;
- int y = (top + bottom)/2;
- int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize();
- int oldX = aSize[0]/2;
- int oldY = aSize[1]/2;
- TranslateView(oldX, oldY, x, y);
-
- // zoom camera
- double dxf = (double)(aSize[0]) / (double)(abs(right - left));
- double dyf = (double)(aSize[1]) / (double)(abs(bottom - top));
- double zoomFactor = (dxf + dyf)/2 ;
-
- vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
- if(aCam->GetParallelProjection())
- aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
- else{
- aCam->Dolly(zoomFactor);
- ::ResetCameraClippingRange(this->CurrentRenderer);
- }
-
- myGUIWindow->update();
-}
-
-
-//----------------------------------------------------------------------------
-// starts viewer operation (!internal usage!)
-void VTKViewer_InteractorStyleSALOME::startOperation(int operation)
-{
- switch(operation)
- {
- case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- case VTK_INTERACTOR_STYLE_CAMERA_FIT:
- case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- State = operation;
- if (State != VTK_INTERACTOR_STYLE_CAMERA_SELECT)
- setCursor(operation);
- onStartOperation();
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_NONE:
- default:
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- State = ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
- break;
- }
-}
-
-
-//----------------------------------------------------------------------------
-// sets proper cursor for window when viewer operation is activated
-void VTKViewer_InteractorStyleSALOME::setCursor(const int operation)
-{
- if (!myGUIWindow) return;
- switch (operation)
- {
- case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- myGUIWindow->setCursor(myZoomCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- myGUIWindow->setCursor(myPanCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- myGUIWindow->setCursor(myRotateCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- myGUIWindow->setCursor(mySpinCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- myGUIWindow->setCursor(myGlobalPanCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_FIT:
- case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- myGUIWindow->setCursor(myHandCursor);
- myCursorState = true;
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_NONE:
- default:
- myGUIWindow->setCursor(myDefCursor);
- myCursorState = false;
- break;
- }
-}
-
-
-//----------------------------------------------------------------------------
-// called when viewer operation started (!put necessary initialization here!)
-void VTKViewer_InteractorStyleSALOME::onStartOperation()
-{
- if (!myGUIWindow) return;
- // VSV: LOD actor activisation
- // this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
- switch (State) {
- case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- case VTK_INTERACTOR_STYLE_CAMERA_FIT:
- {
- QPainter p(myGUIWindow);
- p.setPen(Qt::lightGray);
- p.setRasterOp(Qt::XorROP);
- p.drawRect(QRect(myPoint, myOtherPoint));
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- break;
- }
-}
-
-
-//----------------------------------------------------------------------------
-// called when viewer operation finished (!put necessary post-processing here!)
-void VTKViewer_InteractorStyleSALOME::onFinishOperation()
-{
- if (!myGUIWindow) return;
-
-
- QAD_Study* aActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() );
-
- // VSV: LOD actor activisation
- // rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
-
- Selection_Mode aSelectionMode = aSel->SelectionMode();
- bool aSelActiveCompOnly = aSel->IsSelectActiveCompOnly();
-
- switch (State) {
- case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- case VTK_INTERACTOR_STYLE_CAMERA_FIT:
- {
- QPainter p(myGUIWindow);
- p.setPen(Qt::lightGray);
- p.setRasterOp(Qt::XorROP);
- QRect rect(myPoint, myOtherPoint);
- p.drawRect(rect);
- rect = rect.normalize();
- if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
- // making fit rect opeation
- int w, h;
- m_Interactor->GetSize(w, h);
- int x1, y1, x2, y2;
- x1 = rect.left();
- y1 = h - rect.top() - 1;
- x2 = rect.right();
- y2 = h - rect.bottom() - 1;
- fitRect(x1, y1, x2, y2);
- }
- else {
- if (myPoint == myOtherPoint) {
- // process point selection
- int w, h, x, y;
- m_Interactor->GetSize(w, h);
- x = myPoint.x();
- y = h - myPoint.y() - 1;
-
- this->FindPokedRenderer(x, y);
- m_Interactor->StartPickCallback();
-
- vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
- aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
-
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
-
- if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
- int aVtkId = picker->GetCellId();
- if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
- int anObjId = SActor->GetElemObjId(aVtkId);
- if(anObjId >= 0){
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(aSelectionMode != EdgeOfCellSelection) {
- if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
- if(MYDEBUG) INFOS(" CellId : "<<anObjId);
- if (IsSelected(IO,aSel)) {
- // This IO is already in the selection
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- } else {
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }else{
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- int anEdgeId = GetEdgeId(picker,SActor,anObjId);
- if (anEdgeId >= 0) {
- if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
- aSel->AddOrRemoveIndex( IO, anObjId, true, false);
- aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
- aSel->AddIObject( IO, false );
- }
- }
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- } else if ( vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker) ) {
- int aVtkId = picker->GetPointId();
- if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
- if ( SActor && SActor->hasIO() ) {
- int anObjId = SActor->GetNodeObjId(aVtkId);
- if(anObjId >= 0){
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(IsSelected(IO,aSel)) {
- // This IO is already in the selection
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- } else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- if(MYDEBUG) INFOS(" PointId : "<<anObjId);
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- } else {
- if ( SActor && SActor->hasIO() ) {
- this->PropPicked++;
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(IsSelected(IO,aSel)) {
- // This IO is already in the selection
- if(myShiftState) {
- aSel->RemoveIObject(IO);
- }
- }
- else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddIObject( IO, false );
- }
- }else{
- // No selection clear all
- this->PropPicked = 0;
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- }
- m_Interactor->EndPickCallback();
- } else {
- //processing rectangle selection
- QString aComponentDataType = QAD_Application::getDesktop()->getComponentDataType();
- if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
- m_Interactor->StartPickCallback();
-
- if (!myShiftState) {
- this->PropPicked = 0;
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
-
- // Compute bounds
- // vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- QRect rect(myPoint, myOtherPoint);
- rect = rect.normalize();
- int w, h;
- m_Interactor->GetSize(w, h);
- int x1, y1, x2, y2;
- x1 = rect.left();
- y1 = h - rect.top() - 1;
- x2 = rect.right();
- y2 = h - rect.bottom() - 1;
-
- switch (aSelectionMode) {
- case NodeSelection: {
- if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
- vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
- aListActors->InitTraversal();
- while (vtkActor* aActor = aListActors->GetNextActor()) {
- if (!aActor->GetVisibility())
- continue;
- if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (SActor->hasIO()) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if (IO.IsNull())
- continue;
- if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType())
- continue;
- if (vtkDataSet* aDataSet = SActor->GetInput()) {
- SALOME_Selection::TContainerOfId anIndices;
- for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) {
- float aPoint[3];
- aDataSet->GetPoint(i,aPoint);
- if (IsInRect(aPoint,x1,y1,x2,y2)){
- float aDisp[3];
- ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp);
- if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){
- if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){
- if(anActorCollection->IsItemPresent(SActor)){
- float aPickedPoint[3];
- aPointPicker->GetMapperPosition(aPickedPoint);
- vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint);
- if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){
- int anObjId = SActor->GetNodeObjId(aVtkId);
- anIndices.insert(anObjId);
- }
- }
- }
- }
- }
- }
- if (!anIndices.empty()) {
- aSel->AddOrRemoveIndex(IO, anIndices, true, false);
- aSel->AddIObject(IO, false);
- anIndices.clear();
- }else{
- aSel->RemoveIObject(IO, false);
- }
- }
- }
- }
- }
- }
- break;
- }
- case CellSelection:
- case EdgeOfCellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- {
- vtkSmartPointer<VTKViewer_CellRectPicker> picker = VTKViewer_CellRectPicker::New();
- picker->SetTolerance(0.001);
- picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
-
- vtkActorCollection* aListActors = picker->GetActors();
- aListActors->InitTraversal();
- while(vtkActor* aActor = aListActors->GetNextActor()) {
- if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (aSActor->hasIO()) {
- Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
- continue;
- VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
- if ( !cellList.empty() ) {
- if(MYDEBUG) INFOS ( " NAME Actor : " << aSActor->getName() );
- SALOME_Selection::TContainerOfId anIndexes;
- VTKViewer_CellDataSet::iterator it;
- for ( it = cellList.begin(); it != cellList.end(); ++it ) {
- int aCellId = (*it).cellId;
-
- if ( !IsValid( aSActor, aCellId ) )
- continue;
-
- int anObjId = aSActor->GetElemObjId(aCellId);
- if (anObjId != -1){
- if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) {
- anIndexes.insert(anObjId);
- }
- }
- }
- aSel->AddOrRemoveIndex(aIO, anIndexes, true, false);
- aSel->AddIObject(aIO, false);
- }
- }
- }
- }
- }
- break;
- case ActorSelection: // objects selection
- {
- vtkSmartPointer<VTKViewer_RectPicker> picker = VTKViewer_RectPicker::New();
- picker->SetTolerance(0.001);
- picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
-
- vtkActorCollection* aListActors = picker->GetActors();
- SALOME_ListIO aListIO;
- aListActors->InitTraversal();
- while(vtkActor* aActor = aListActors->GetNextActor()) {
- if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (aSActor->hasIO()) {
- Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- if (!IsStored(aIO,aListIO))
- aListIO.Append(aIO);
- }
- }
- }
- if (!aListIO.IsEmpty()) {
- SALOME_ListIteratorOfListIO It(aListIO);
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- this->PropPicked++;
- aSel->AddIObject( IOS, false );
- }
- }
- } // end case 4
- } //end switch
- m_Interactor->EndPickCallback();
- }
- aActiveStudy->update3dViewers();
- }
- }
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- break;
- case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- {
- int w, h, x, y;
- m_Interactor->GetSize(w, h);
- x = myPoint.x();
- y = h - myPoint.y() - 1;
- Place(x, y);
- }
- break;
- }
- if (myGUIWindow) myGUIWindow->update();
-
-}
-
-// called during viewer operation when user moves mouse (!put necessary processing here!)
-void VTKViewer_InteractorStyleSALOME::onOperation(QPoint mousePos)
-{
- if (!myGUIWindow) return;
- int w, h;
- GetInteractor()->GetSize(w, h);
- switch (State) {
- case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- {
- // processing panning
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
- this->PanXY(mousePos.x(), myPoint.y(), myPoint.x(), mousePos.y());
- myPoint = mousePos;
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- {
- // processing zooming
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
- this->DollyXY(mousePos.x() - myPoint.x(), mousePos.y() - myPoint.y());
- myPoint = mousePos;
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- {
- // processing rotation
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
- this->RotateXY(mousePos.x() - myPoint.x(), myPoint.y() - mousePos.y());
- myPoint = mousePos;
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- {
- // processing spinning
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
- this->SpinXY(mousePos.x(), mousePos.y(), myPoint.x(), myPoint.y());
- myPoint = mousePos;
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- {
- break;
- }
- case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- {
- if (!myCursorState)
- setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
- }
- case VTK_INTERACTOR_STYLE_CAMERA_FIT:
- {
- QPainter p(myGUIWindow);
- p.setPen(Qt::lightGray);
- p.setRasterOp(Qt::XorROP);
- p.drawRect(QRect(myPoint, myOtherPoint));
- myOtherPoint = mousePos;
- p.drawRect(QRect(myPoint, myOtherPoint));
- break;
- }
- }
- this->LastPos[0] = mousePos.x();
- this->LastPos[1] = h - mousePos.y() - 1;
-}
-
-// called when selection mode changed (!put necessary initialization here!)
-void VTKViewer_InteractorStyleSALOME::OnSelectionModeChanged()
-{
-
- myPreSelectionActor->SetVisibility(false);
- myElemId = myEdgeId = myNodeId = -1;
- mySelectedActor = NULL;
-}
-
-// called when user moves mouse inside viewer window and there is no active viewer operation
-// (!put necessary processing here!)
-void VTKViewer_InteractorStyleSALOME::onCursorMove(QPoint mousePos) {
- // processing highlighting
- QAD_Study* anActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() );
- Selection_Mode aSelectionMode = Sel->SelectionMode();
-
- int w, h, x, y;
- m_Interactor->GetSize(w, h);
- x = mousePos.x(); y = h - mousePos.y() - 1;
-
- this->FindPokedRenderer(x,y);
- m_Interactor->StartPickCallback();
- myPreSelectionActor->SetVisibility(false);
-
- vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
- aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
-
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
-
- if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
- int aVtkId = picker->GetCellId();
- if ( aVtkId >= 0 ) {
- int anObjId = SActor->GetElemObjId(aVtkId);
- if ( SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
- bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId);
- bool aResult = anIsSameObjId;
- if(!anIsSameObjId) {
- if(aSelectionMode != EdgeOfCellSelection) {
- aResult = CheckDimensionId(aSelectionMode,SActor,anObjId);
- if(aResult){
- mySelectedActor = SActor;
- myElemId = anObjId;
- if(MYDEBUG) INFOS(" CellId : "<<anObjId);
- m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
- }
- }
- }
- if(aSelectionMode == EdgeOfCellSelection){
- int anEdgeId = GetEdgeId(picker,SActor,anObjId);
- bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId;
- aResult = anIsSameEdgeId;
- if(!anIsSameEdgeId) {
- aResult = (anEdgeId >= 0);
- if (aResult) {
- mySelectedActor = SActor;
- myEdgeId = anEdgeId;
- myElemId = anObjId;
- if(MYDEBUG) INFOS(" CellId : "<<anObjId<<"; EdgeId : "<<anEdgeId);
- m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
- }
- }
- }
- if(aResult) {
- myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
- myPreSelectionActor->SetVisibility(true);
- }
- }
- }
- }
- else if (vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker)) {
- int aVtkId = picker->GetPointId();
- if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
- if ( SActor && SActor->hasIO() ) {
- int anObjId = SActor->GetNodeObjId(aVtkId);
- bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId);
- if(!anIsSameObjId) {
- mySelectedActor = SActor;
- myNodeId = anObjId;
- if(MYDEBUG) INFOS(" PointId : "<<anObjId);
- m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
- }
- myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
- myPreSelectionActor->SetVisibility(true);
- }
- }
- }
- else if ( vtkPicker::SafeDownCast(aPicker) ) {
- if ( SActor ) {
- if ( myPreViewActor != SActor ) {
- if ( myPreViewActor != NULL ) {
- myPreViewActor->SetPreSelected( false );
- }
- myPreViewActor = SActor;
-
- if ( SActor->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = SActor->getIO();
- if ( !IsSelected(IO,Sel) ) {
- // Find All actors with same IO
- vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
- theActors->InitTraversal();
- while( vtkActor *ac = theActors->GetNextActor() ) {
- if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
- if(IO->isSame(IOS)) {
- anActor->SetPreSelected( true );
- }
- }
- }
- }
- //if(MYDEBUG) INFOS ( " NAME PREVIEW " << SActor->getName() );
- }
- }
- }
- } else {
- myPreViewActor = NULL;
- vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
- theActors->InitTraversal();
- while( vtkActor *ac = theActors->GetNextActor() ) {
- if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
- anActor->SetPreSelected( false );
- }
- }
- }
- }
- m_Interactor->EndPickCallback();
- //m_Interactor->Render();
- myGUIWindow->update();
-
- this->LastPos[0] = x;
- this->LastPos[1] = y;
-}
-
-// called on finsh GlobalPan operation
-void VTKViewer_InteractorStyleSALOME::Place(const int theX, const int theY)
-{
- if (this->CurrentRenderer == NULL) {
- return;
- }
-
- //translate view
- int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize();
- int centerX = aSize[0]/2;
- int centerY = aSize[1]/2;
-
- TranslateView(centerX, centerY, theX, theY);
-
- // restore zoom scale
- vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- cam->SetParallelScale(myScale);
- ::ResetCameraClippingRange(this->CurrentRenderer);
-
- if (myGUIWindow) myGUIWindow->update();
-
-}
-
-
-
-// Translates view from Point to Point
-void VTKViewer_InteractorStyleSALOME::TranslateView(int toX, int toY, int fromX, int fromY)
-{
- vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- double viewFocus[4], focalDepth, viewPoint[3];
- float newPickPoint[4], oldPickPoint[4], motionVector[3];
- cam->GetFocalPoint(viewFocus);
-
- this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
- viewFocus[2], viewFocus);
- focalDepth = viewFocus[2];
-
- this->ComputeDisplayToWorld(double(toX), double(toY),
- focalDepth, newPickPoint);
- this->ComputeDisplayToWorld(double(fromX),double(fromY),
- focalDepth, oldPickPoint);
-
- // camera motion is reversed
- motionVector[0] = oldPickPoint[0] - newPickPoint[0];
- motionVector[1] = oldPickPoint[1] - newPickPoint[1];
- motionVector[2] = oldPickPoint[2] - newPickPoint[2];
-
- cam->GetFocalPoint(viewFocus);
- cam->GetPosition(viewPoint);
- cam->SetFocalPoint(motionVector[0] + viewFocus[0],
- motionVector[1] + viewFocus[1],
- motionVector[2] + viewFocus[2]);
- cam->SetPosition(motionVector[0] + viewPoint[0],
- motionVector[1] + viewPoint[1],
- motionVector[2] + viewPoint[2]);
-}
-
-
-/// Checks: is the given Actor within display coordinates?
-bool VTKViewer_InteractorStyleSALOME::IsInRect(vtkActor* theActor,
- const int left, const int top,
- const int right, const int bottom)
-{
- float* aBounds = theActor->GetBounds();
- float aMin[3], aMax[3];
- ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
- ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
- if (aMin[0] > aMax[0]) {
- float aBuf = aMin[0];
- aMin[0] = aMax[0];
- aMax[0] = aBuf;
- }
- if (aMin[1] > aMax[1]) {
- float aBuf = aMin[1];
- aMin[1] = aMax[1];
- aMax[1] = aBuf;
- }
-
- return ((aMin[0]>left) && (aMax[0]<right) && (aMin[1]>bottom) && (aMax[1]<top));
-}
-
-
-/// Checks: is the given Cell within display coordinates?
-bool VTKViewer_InteractorStyleSALOME::IsInRect(vtkCell* theCell,
- const int left, const int top,
- const int right, const int bottom)
-{
- float* aBounds = theCell->GetBounds();
- float aMin[3], aMax[3];
- ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
- ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
- if (aMin[0] > aMax[0]) {
- float aBuf = aMin[0];
- aMin[0] = aMax[0];
- aMax[0] = aBuf;
- }
- if (aMin[1] > aMax[1]) {
- float aBuf = aMin[1];
- aMin[1] = aMax[1];
- aMax[1] = aBuf;
- }
-
- return ((aMin[0]>left) && (aMax[0]<right) && (aMin[1]>bottom) && (aMax[1]<top));
-}
-
-
-bool VTKViewer_InteractorStyleSALOME::IsInRect(float* thePoint,
- const int left, const int top,
- const int right, const int bottom)
-{
- float aPnt[3];
- ComputeWorldToDisplay(thePoint[0], thePoint[1], thePoint[2], aPnt);
-
- return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
-}
-
-void VTKViewer_InteractorStyleSALOME::SetFilter( const Handle(VTKViewer_Filter)& theFilter )
-{
- myFilters[ theFilter->GetId() ] = theFilter;
-}
-
-bool VTKViewer_InteractorStyleSALOME::IsFilterPresent( const int theId )
-{
- return myFilters.find( theId ) != myFilters.end();
-}
-
-void VTKViewer_InteractorStyleSALOME::RemoveFilter( const int theId )
-{
- if ( IsFilterPresent( theId ) )
- myFilters.erase( theId );
-}
-
-
-bool VTKViewer_InteractorStyleSALOME::IsValid( SALOME_Actor* theActor,
- const int theId,
- const bool theIsNode )
-{
- std::map<int, Handle(VTKViewer_Filter)>::const_iterator anIter;
- for ( anIter = myFilters.begin(); anIter != myFilters.end(); ++anIter )
- {
- const Handle(VTKViewer_Filter)& aFilter = anIter->second;
- if ( theIsNode == aFilter->IsNodeFilter() &&
- !aFilter->IsValid( theActor, theId ) )
- return false;
- }
- return true;
-}
-
-Handle(VTKViewer_Filter) VTKViewer_InteractorStyleSALOME::GetFilter( const int theId )
-{
- return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)();
-}
-
-void VTKViewer_InteractorStyleSALOME::IncrementalPan( const int incrX, const int incrY )
-{
- this->PanXY( incrX, incrY, 0, 0 );
-}
-
-void VTKViewer_InteractorStyleSALOME::IncrementalZoom( const int incr )
-{
- this->DollyXY( incr, incr );
-}
-
-void VTKViewer_InteractorStyleSALOME::IncrementalRotate( const int incrX, const int incrY )
-{
- this->RotateXY( incrX, -incrY );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_InteractorStyleSALOME.h
-// Author : Christophe ATTANASIO
-// Module : SALOME
-// $Header$
-
-#ifndef __VTKViewer_InteractorStyleSALOME_h
-#define __VTKViewer_InteractorStyleSALOME_h
-
-#include <vtkInteractorStyle.h>
-
-class vtkCell;
-class vtkRenderWindowInteractor;
-
-#include <qobject.h>
-#include <qcursor.h>
-
-#include "VTKViewer_Filter.h"
-
-class SALOME_Actor;
-class VTKViewer_Actor;
-class VTKViewer_Trihedron;
-class VTKViewer_ViewFrame;
-class VTKViewer_RenderWindowInteractor;
-
-#define VTK_INTERACTOR_STYLE_CAMERA_NONE 0
-#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1
-#define VTK_INTERACTOR_STYLE_CAMERA_PAN 2
-#define VTK_INTERACTOR_STYLE_CAMERA_ZOOM 3
-#define VTK_INTERACTOR_STYLE_CAMERA_SPIN 4
-#define VTK_INTERACTOR_STYLE_CAMERA_FIT 5
-#define VTK_INTERACTOR_STYLE_CAMERA_SELECT 6
-#define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
-
-class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyle
-{
- public:
- // Description:
- // This class must be supplied with a vtkRenderWindowInteractor wrapper or
- // parent. This class should not normally be instantiated by application
- // programmers.
- static VTKViewer_InteractorStyleSALOME *New();
- vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkInteractorStyle);
-
- virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor);
- void setViewFrame(VTKViewer_ViewFrame* theViewFrame);
- void setGUIWindow(QWidget* theWindow);
-
- void setTriedron(VTKViewer_Trihedron* theTrihedron);
- void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
- const double& theBlue = 1, const int& theWidth = 5);
-
- // Generic event bindings must be overridden in subclasses
- void OnMouseMove (int ctrl, int shift, int x, int y);
- void OnLeftButtonDown(int ctrl, int shift, int x, int y);
- void OnLeftButtonUp (int ctrl, int shift, int x, int y);
- void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
- void OnMiddleButtonUp (int ctrl, int shift, int x, int y);
- void OnRightButtonDown(int ctrl, int shift, int x, int y);
- void OnRightButtonUp (int ctrl, int shift, int x, int y);
-
- void OnSelectionModeChanged();
-
- void ViewFitAll();
-
- void SetFilter( const Handle(VTKViewer_Filter)& );
- Handle(VTKViewer_Filter) GetFilter( const int );
- bool IsFilterPresent( const int );
- void RemoveFilter( const int );
- bool IsValid( SALOME_Actor* theActor,
- const int theId,
- const bool theIsNode = false );
-
- void IncrementalPan ( const int incrX, const int incrY );
- void IncrementalZoom ( const int incr );
- void IncrementalRotate( const int incrX, const int incrY );
-
- protected:
- VTKViewer_InteractorStyleSALOME();
- ~VTKViewer_InteractorStyleSALOME();
- VTKViewer_InteractorStyleSALOME(const VTKViewer_InteractorStyleSALOME&) {};
- void operator=(const VTKViewer_InteractorStyleSALOME&) {};
-
- void RotateXY(int dx, int dy);
- void PanXY(int x, int y, int oldX, int oldY);
- void DollyXY(int dx, int dy);
- void SpinXY(int dx, int dy, int oldX, int oldY);
- void fitRect(const int left, const int top, const int right, const int bottom);
- void Place(const int theX, const int theY);
- void TranslateView(int toX, int toY, int fromX, int fromY);
- bool IsInRect(vtkActor* theActor,
- const int left, const int top,
- const int right, const int bottom);
- bool IsInRect(vtkCell* theCell,
- const int left, const int top,
- const int right, const int bottom);
- bool IsInRect(float* thePoint,
- const int left, const int top,
- const int right, const int bottom);
-
- int State;
- float MotionFactor;
- float RadianToDegree; // constant: for conv from deg to rad
- double myScale;
-
- SALOME_Actor* myPreViewActor;
-
- VTKViewer_Actor* myPreSelectionActor;
- SALOME_Actor* mySelectedActor;
- int myElemId;
- int myEdgeId;
- int myNodeId;
-
- public:
- bool eventFilter(QObject* object, QEvent* event);
- void startZoom();
- void startPan();
- void startGlobalPan();
- void startRotate();
- void startFitArea();
- void startSpin();
- bool needsRedrawing();
-
- protected:
- void loadCursors();
- void startOperation(int operation);
- void onStartOperation();
- void onFinishOperation();
- void onOperation(QPoint mousePos);
- void onCursorMove(QPoint mousePos);
- void setCursor(const int operation);
-
-
- protected:
- QCursor myDefCursor;
- QCursor myPanCursor;
- QCursor myZoomCursor;
- QCursor myRotateCursor;
- QCursor mySpinCursor;
- QCursor myHandCursor;
- QCursor myGlobalPanCursor;
- QPoint myPoint;
- QPoint myOtherPoint;
- bool myCursorState;
- bool myShiftState;
- int ForcedState;
-
- VTKViewer_RenderWindowInteractor* m_Interactor;
- VTKViewer_ViewFrame* m_ViewFrame;
- VTKViewer_Trihedron* m_Trihedron;
- QWidget* myGUIWindow;
-
- std::map<int, Handle(VTKViewer_Filter)> myFilters;
-
- // members from old version
- double DeltaElevation;
- double DeltaAzimuth;
- int LastPos[2];
-};
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VTKViewer_Prs.cxx
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer_Prs.h"
-using namespace std;
-
-//==========================================================
-/*!
- * VTKViewer_Prs::VTKViewer_Prs
- * Default constructor
- */
-//==========================================================
-VTKViewer_Prs::VTKViewer_Prs() : myObjects( 0 )
-{
-}
-
-//==========================================================
-/*!
- * VTKViewer_Prs::VTKViewer_Prs
- * tandard constructora
- */
-//==========================================================
-VTKViewer_Prs::VTKViewer_Prs( const vtkActor* obj )
-{
- AddObject( obj );
-}
-
-//==========================================================
-/*!
- * VTKViewer_Prs::~VTKViewer_Prs
- * Destructor
- */
-//==========================================================
-VTKViewer_Prs:: ~VTKViewer_Prs()
-{
- if ( myObjects ) myObjects->Delete();
-}
-
-//==========================================================
-/*!
- * VTKViewer_Prs::GetObjects
- * Get actors list
- */
-//==========================================================
-vtkActorCollection* VTKViewer_Prs::GetObjects() const
-{
- return myObjects;
-}
-
-//==========================================================
-/*!
- * VTKViewer_Prs::AddObject
- * Add actor
- */
-//==========================================================
-void VTKViewer_Prs::AddObject( const vtkActor* obj )
-{
- if ( !myObjects)
- myObjects = vtkActorCollection::New();
- myObjects->AddItem( (vtkActor*)obj );
-}
-
-//==========================================================
-/*!
- * VTKViewer_Prs::IsNull
- * Return 0 if list of the actors is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
-bool VTKViewer_Prs::IsNull() const
-{
- return !myObjects || myObjects->GetNumberOfItems() <= 0;
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// Copyright (C) 2004 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.salome-platform.org or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VTKViewer_Prs.h
-// Author : Sergey ANIKIN
-// Module : SALOME
-// $Header$
-
-#ifndef VTKVIEWER_PRS_H
-#define VTKVIEWER_PRS_H
-
-#include "SALOME_Prs.h"
-
-#include <vtkActorCollection.h>
-
-class VTKViewer_Prs : public SALOME_VTKPrs
-{
-public:
- VTKViewer_Prs();
- // Default constructor
- VTKViewer_Prs( const vtkActor* obj );
- // Standard constructor
- ~VTKViewer_Prs();
- // Destructor
-
- vtkActorCollection* GetObjects() const;
- // Get actors list
- void AddObject( const vtkActor* obj );
- // Add actor
-
- bool IsNull() const;
- // Reimplemented from SALOME_Prs
-
-private:
- vtkActorCollection* myObjects; // list of actors
-};
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RectPicker.cxx
-// Author : Natalia KOPNOVA
-// Module : SALOME
-
-#include <VTKViewer_RectPicker.h>
-
-#include "vtkActor.h"
-#include "vtkAssemblyNode.h"
-#include "vtkAssemblyPath.h"
-#include "vtkCamera.h"
-#include "vtkCommand.h"
-#include "vtkImageData.h"
-#include "vtkLODProp3D.h"
-#include "vtkMapper.h"
-#include "vtkMath.h"
-#include "vtkObjectFactory.h"
-#include "vtkPoints.h"
-#include "vtkProp3DCollection.h"
-#include "vtkProperty.h"
-#include "vtkRenderWindow.h"
-#include "vtkRenderer.h"
-#include "vtkTransform.h"
-#include "vtkVertex.h"
-#include "vtkVolume.h"
-#include "vtkVolumeMapper.h"
-
-using namespace std;
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VTKViewer_RectPicker);
-//----------------------------------------------------------------------------
-
-VTKViewer_RectPicker::VTKViewer_RectPicker()
-{
-}
-
-//----------------------------------------------------------------------------
-int VTKViewer_RectPicker::Pick(float selectionX1, float selectionY1, float selectionZ1,
- float selectionX2, float selectionY2, float selectionZ2,
- vtkRenderer *renderer)
-{
- int k, i;
- vtkProp *prop;
- vtkCamera *camera;
- vtkAbstractMapper3D *mapper = NULL;
- float p1World[4][4], p2World[4][4], p1Mapper[4][4], p2Mapper[4][4];
- float c1[3], c2[3];
- int picked=0;
- int *winSize;
- float x, y, t, p;
- float *viewport;
- float cameraPos[4], cameraFP[4];
- float *displayCoords, *worldCoords;
- float pickPosition[4][3];
- double *clipRange;
- float ray[4][3], rayLength[4];
- int pickable;
- int LODId;
- float windowLowerLeft[4], windowUpperRight[4];
- float bounds[6], tol;
- float tF, tB;
- float hitPosition[3];
- float cameraDOP[3];
-
- // Initialize picking process
- this->Initialize();
- this->Renderer = renderer;
-
- /* Selection point is not defined for the rectangle
- this->SelectionPoint[0] =
- this->SelectionPoint[1] =
- this->SelectionPoint[2] =
- */
-
- // Invoke start pick method if defined
- this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
-
- if ( renderer == NULL )
- {
- vtkErrorMacro(<<"Must specify renderer!");
- return 0;
- }
-
- // Get camera focal point and position. Convert to display (screen)
- // coordinates. We need a depth value for z-buffer.
- //
- camera = renderer->GetActiveCamera();
- camera->GetPosition((float *)cameraPos); cameraPos[3] = 1.0;
- camera->GetFocalPoint((float *)cameraFP); cameraFP[3] = 1.0;
-
- renderer->SetWorldPoint(cameraFP);
- renderer->WorldToDisplay();
- displayCoords = renderer->GetDisplayPoint();
- selectionZ1 = selectionZ2 = displayCoords[2];
-
- // Convert the selection rectangle into world coordinates.
- //
- renderer->SetDisplayPoint(selectionX1, selectionY1, selectionZ1);
- renderer->DisplayToWorld();
- worldCoords = renderer->GetWorldPoint();
- if ( worldCoords[3] == 0.0 )
- {
- vtkErrorMacro(<<"Bad homogeneous coordinates");
- return 0;
- }
- for (i=0; i < 3; i++)
- {
- pickPosition[0][i] = worldCoords[i] / worldCoords[3];
- }
-
- renderer->SetDisplayPoint(selectionX1, selectionY2, (selectionZ1+selectionZ2)/2);
- renderer->DisplayToWorld();
- worldCoords = renderer->GetWorldPoint();
- if ( worldCoords[3] == 0.0 )
- {
- vtkErrorMacro(<<"Bad homogeneous coordinates");
- return 0;
- }
- for (i=0; i < 3; i++)
- {
- pickPosition[1][i] = worldCoords[i] / worldCoords[3];
- }
-
- renderer->SetDisplayPoint(selectionX2, selectionY2, selectionZ2);
- renderer->DisplayToWorld();
- worldCoords = renderer->GetWorldPoint();
- if ( worldCoords[3] == 0.0 )
- {
- vtkErrorMacro(<<"Bad homogeneous coordinates");
- return 0;
- }
- for (i=0; i < 3; i++)
- {
- pickPosition[2][i] = worldCoords[i] / worldCoords[3];
- }
-
- renderer->SetDisplayPoint(selectionX2, selectionY1, (selectionZ1+selectionZ2)/2);
- renderer->DisplayToWorld();
- worldCoords = renderer->GetWorldPoint();
- if ( worldCoords[3] == 0.0 )
- {
- vtkErrorMacro(<<"Bad homogeneous coordinates");
- return 0;
- }
- for (i=0; i < 3; i++)
- {
- pickPosition[3][i] = worldCoords[i] / worldCoords[3];
- }
-
- // Compute the ray endpoints. The ray is along the line running from
- // the camera position to the selection point, starting where this line
- // intersects the front clipping plane, and terminating where this
- // line intersects the back clipping plane.
- for (k=0; k < 4; k++) {
- for (i=0; i<3; i++)
- {
- ray[k][i] = pickPosition[k][i] - cameraPos[i];
- }
- }
- for (i=0; i<3; i++)
- {
- cameraDOP[i] = cameraFP[i] - cameraPos[i];
- }
-
- vtkMath::Normalize(cameraDOP);
-
- for (k=0; k < 4; k++) {
- if (( rayLength[k] = vtkMath::Dot(cameraDOP,ray[k])) == 0.0 )
- {
- vtkWarningMacro("Cannot process points");
- return 0;
- }
- }
-
- clipRange = camera->GetClippingRange();
-
- if ( camera->GetParallelProjection() )
- {
- for (k=0; k < 4; k++) {
- tF = clipRange[0] - rayLength[k];
- tB = clipRange[1] - rayLength[k];
- for (i=0; i<3; i++)
- {
- p1World[k][i] = pickPosition[k][i] + tF*cameraDOP[i];
- p2World[k][i] = pickPosition[k][i] + tB*cameraDOP[i];
- }
- p1World[k][3] = p2World[k][3] = 1.0;
- }
- }
- else
- {
- for (k=0; k < 4; k++) {
- tF = clipRange[0] / rayLength[k];
- tB = clipRange[1] / rayLength[k];
- for (i=0; i<3; i++)
- {
- p1World[k][i] = cameraPos[i] + tF*ray[k][i];
- p2World[k][i] = cameraPos[i] + tB*ray[k][i];
- }
- p1World[k][3] = p2World[k][3] = 1.0;
- }
- }
-
- // Compute the center points of ray rectangle
- for (i=0; i<3; i++) {
- c1[i] = c2[i] = 0;
- for (k=0; k<4; k++) {
- c1[i] += p1World[k][i];
- c2[i] += p2World[k][i];
- }
- c1[i] = c1[i]/4;
- c2[i] = c2[i]/4;
- }
-
- // Compute the tolerance in world coordinates. Do this by
- // determining the world coordinates of the diagonal points of the
- // window, computing the width of the window in world coordinates, and
- // multiplying by the tolerance.
- //
- viewport = renderer->GetViewport();
- winSize = renderer->GetRenderWindow()->GetSize();
- x = winSize[0] * viewport[0];
- y = winSize[1] * viewport[1];
- renderer->SetDisplayPoint(x, y, selectionZ1);
- renderer->DisplayToWorld();
- renderer->GetWorldPoint(windowLowerLeft);
-
- x = winSize[0] * viewport[2];
- y = winSize[1] * viewport[3];
- renderer->SetDisplayPoint(x, y, selectionZ2);
- renderer->DisplayToWorld();
- renderer->GetWorldPoint(windowUpperRight);
-
- for (tol=0.0,i=0; i<3; i++)
- {
- tol += (windowUpperRight[i] - windowLowerLeft[i]) *
- (windowUpperRight[i] - windowLowerLeft[i]);
- }
-
- tol = sqrt (tol) * this->Tolerance;
-
- // Loop over all props. Transform ray (defined from position of
- // camera to selection point) into coordinates of mapper (not
- // transformed to actors coordinates! Reduces overall computation!!!).
- // Note that only vtkProp3D's can be picked by vtkPicker.
- //
- vtkPropCollection *props;
- vtkProp *propCandidate;
- if ( this->PickFromList )
- {
- props = this->GetPickList();
- }
- else
- {
- props = renderer->GetProps();
- }
-
- vtkActor *actor;
- vtkLODProp3D *prop3D;
- vtkVolume *volume;
- vtkAssemblyPath *path;
- vtkProperty *tempProperty;
- this->Transform->PostMultiply();
- for ( props->InitTraversal(); (prop=props->GetNextProp()); )
- {
- for ( prop->InitPathTraversal(); (path=prop->GetNextPath()); )
- {
- pickable = 0;
- actor = NULL;
- propCandidate = path->GetLastNode()->GetProp();
- if ( propCandidate->GetPickable() && propCandidate->GetVisibility() )
- {
- pickable = 1;
- if ( (actor=vtkActor::SafeDownCast(propCandidate)) != NULL )
- {
- mapper = actor->GetMapper();
- if ( actor->GetProperty()->GetOpacity() <= 0.0 )
- {
- pickable = 0;
- }
- }
- else if ( (prop3D=vtkLODProp3D::SafeDownCast(propCandidate)) != NULL )
- {
- LODId = prop3D->GetPickLODID();
- mapper = prop3D->GetLODMapper(LODId);
-
- // if the mapper is a vtkMapper (as opposed to a vtkVolumeMapper),
- // then check the transparency to see if the object is pickable
- if ( vtkMapper::SafeDownCast(mapper) != NULL)
- {
- prop3D->GetLODProperty(LODId, &tempProperty);
- if ( tempProperty->GetOpacity() <= 0.0 )
- {
- pickable = 0;
- }
- }
- }
- else if ( (volume=vtkVolume::SafeDownCast(propCandidate)) != NULL )
- {
- mapper = volume->GetMapper();
- }
- else
- {
- pickable = 0; //only vtkProp3D's (actors and volumes) can be picked
- }
- }
- // If actor can be picked, get its composite matrix, invert it, and
- // use the inverted matrix to transform the ray points into mapper
- // coordinates.
- if ( pickable && mapper != NULL )
- {
- vtkMatrix4x4 *LastMatrix = path->GetLastNode()->GetMatrix();
- if (LastMatrix == NULL)
- {
- vtkErrorMacro (<< "Pick: Null matrix.");
- return 0;
- }
- this->Transform->SetMatrix(LastMatrix);
- this->Transform->Push();
- this->Transform->Inverse();
-
- for (k=0; k < 4; k++) {
- this->Transform->TransformPoint(p1World[k],p1Mapper[k]);
- this->Transform->TransformPoint(p2World[k],p2Mapper[k]);
-
- for (i=0; i<3; i++)
- {
- ray[k][i] = p2Mapper[k][i] - p1Mapper[k][i];
- }
- }
-
- this->Transform->Pop();
-
- // Have the ray endpoints in mapper space, now need to compare this
- // with the mapper bounds to see whether intersection is possible.
- //
- // Get the bounding box of the modeller. Note that the tolerance is
- // added to the bounding box to make sure things on the edge of the
- // bounding box are picked correctly.
- mapper->GetBounds(bounds);
- bounds[0] -= tol; bounds[1] += tol;
- bounds[2] -= tol; bounds[3] += tol;
- bounds[4] -= tol; bounds[5] += tol;
- if ( HitBBox(bounds, p1Mapper, ray) ) {
- t = this->IntersectWithHex(p1Mapper, p2Mapper, tol, path,
- (vtkProp3D *)propCandidate, mapper);
- if ( t >= 0.0 && t <= 1.0 /*t < VTK_LARGE_FLOAT*/ ) {
- picked = 1;
- this->Prop3Ds->AddItem((vtkProp3D *)prop);
- this->PickedPositions->InsertNextPoint
- ((1.0 - t)*c1[0] + t*c2[0],
- (1.0 - t)*c1[1] + t*c2[1],
- (1.0 - t)*c1[2] + t*c2[2]);
-
- // backwards compatibility: also add to this->Actors
- if (actor) {
- this->Actors->AddItem(actor);
- }
- }
- }
-
- }//if visible and pickable not transparent and has mapper
- }//for all parts
- }//for all actors
-
- // Invoke end pick method if defined
- this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
-
- return picked;
-}
-
-#define SIDE_LEFT 0
-#define SIDE_RIGHT 1
-#define SIDE_MIDDLE 2
-
-float GetParameterValue(float start, float end, float point)
-{
- if (start == end) return -VTK_LARGE_FLOAT;
- return (point-start)/(end-start);
-}
-
-void GetPointCoord(const float start[3], const float end[3], float t, float point[3])
-{
- int i;
- for (i = 0; i < 3; i++) {
- point[i] = start[i] + t*(end[i]-start[i]);
- }
-}
-
-char GetIntersectionPoint(const float start[3], const float end[3],
- const int& index, const float p, float point[3])
-{
- float t = GetParameterValue(start[index], end[index], p);
- char result = 0;
- if (t >= 0.0 && t <= 1.0) {
- result = 1;
- GetPointCoord(start, end, t, point);
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-char VTKViewer_RectPicker::HitBBox (float bounds[6], float origin[4][4], float dir[4][3])
-{
- int i, j, k, n;
- float endray[4][3];
-
- for (k = 0; k < 4; k++) {
- for (i = 0; i < 3; i++) {
- endray[k][i] = origin[k][i] + dir[k][i];
- }
- }
-
- // Compute hex bounding box, center point and center direction
- float hbounds[6], center[3], ray[3];
- for (i = 0; i < 3; i++) {
- hbounds[2*i] = hbounds[2*i+1] = origin[0][i];
- center[i] = ray[i] = 0;
- for (k = 0; k < 4; k++) {
- center[i] += origin[k][i];
- ray[i] += endray[k][i];
- if (origin[k][i] < hbounds[2*i]) {
- hbounds[2*i] = origin[k][i];
- }
- else if (origin[k][i] > hbounds[2*i+1])
- hbounds[2*i+1] = origin[k][i];
- if (endray[k][i] < hbounds[2*i])
- hbounds[2*i] = endray[k][i];
- else if (endray[k][i] > hbounds[2*i+1])
- hbounds[2*i+1] = endray[k][i];
- }
- center[i] = center[i]/4;
- ray[i] = ray[i]/4;
- ray[i] = ray[i] - center[i];
- }
-
- // Check for intersection between bouning boxes
- for (i = 0; i < 3; i++) {
- if (bounds[2*i+1] < hbounds[2*i] || bounds[2*i] > hbounds[2*i+1])
- return 0;
- }
-
- // Check if one of the origin point lays inside bbox
- char inside;
- for (k = 0; k < 4; k++) {
- inside = 1;
- for (i = 0; i < 3; i++) {
- if (origin[k][i] < bounds[2*i] || origin[k][i] > bounds[2*i+1]) {
- inside = 0;
- break;
- }
- }
- if (inside) return 1;
- }
-
- // Find the closest coord plane for the center point
- char side[3];
- float coordPlane[3];
- inside = 1;
- for (i = 0; i < 3; i++) {
- if (center[i] < bounds[2*i]) {
- inside = 0;
- coordPlane[i] = bounds[2*i];
- side[i] = SIDE_LEFT;
- }
- else if (center[i] > bounds[2*i+1]) {
- inside = 0;
- coordPlane[i] = bounds[2*i+1];
- side[i] = SIDE_RIGHT;
- }
- else {
- coordPlane[i] = (ray[i]<0.0) ? bounds[2*i] : bounds[2*i+1];
- side[i] = SIDE_MIDDLE;
- }
- }
- if (inside) return 1;
-
- // Calculate parametric distances to the planes and find the max
- float maxT[3];
- int whichPlane = 0;
- char defined = 0;
- for (i = 0; i < 3; i++) {
- if (side[i] != SIDE_MIDDLE && ray[i] != 0.0) {
- maxT[i] = (coordPlane[i]-center[i])/ray[i];
- defined = 1;
- }
- else
- maxT[i] = -1.0;
- }
- for (i = 0; i < 3; i++) {
- if (maxT[whichPlane] < maxT[i])
- whichPlane = i;
- }
-
- // Check for intersection along the center ray
- float coord;
- if (maxT[whichPlane] <= 1.0 && maxT[whichPlane] >= 0.0) {
- inside = 1;
- for (i = 0; i < 3; i++) {
- if (i != whichPlane) {
- coord = center[i] + maxT[whichPlane]*ray[i];
- if (coord < bounds[2*i] || coord > bounds[2*i+1])
- inside = 0;
- }
- }
- if (inside) return 1;
- }
-
- // Define the intersection plane
- if (!defined) {
- for (i = 0; i < 3; i++) {
- if (ray[i] != 0.0) {
- maxT[i] = (coordPlane[i]-center[i])/ray[i];
- }
- else
- maxT[i] = VTK_LARGE_FLOAT;
- }
- for (i = 0; i < 3; i++) {
- if (maxT[whichPlane] > maxT[i])
- whichPlane = i;
- }
- }
-
- // Compute the intersection between hex and coord plane
- float t[4];
- for (k = 0; k < 4; k++) {
- if (dir[k][whichPlane] != 0.0) {
- t[k] = (coordPlane[whichPlane]-origin[k][whichPlane])/dir[k][whichPlane];
- }
- else {
- t[k] = VTK_LARGE_FLOAT;
- }
- }
-
- vtkPoints* aPoints = vtkPoints::New();
- float p[3], q[3], t1;
- for (k = 0; k < 4; k++) {
- n = (k+1)%4; // next point
- if (t[k] > 1.0) {
- if (t[n] < 1.0) {
- // find intersection point
- t1 = GetParameterValue(endray[k][whichPlane], endray[n][whichPlane], coordPlane[whichPlane]);
- if (t1 > 0.0 && t1 < 1.0) {
- GetPointCoord(endray[k], endray[n], t1, p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
- }
- }
- if (t[n] < 0.0) {
- // find second intersection point
- t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]);
- if (t1 > 0.0 && t1 < 1.0) {
- GetPointCoord(origin[k], origin[n], t1, p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
- }
- }
- }
- else if (t[k] < 0.0) {
- if (t[n] > 0.0) {
- // find intersection point
- t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]);
- if (t1 > 0.0 && t1 < 1.0) {
- GetPointCoord(origin[k], origin[n], t1, p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
- }
- }
- }
- else {
- // find intersection point
- GetPointCoord(origin[k], endray[k], t[k], p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
-
- if (t[n] < 0.0) {
- // find second intersection point
- t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]);
- if (t1 > 0.0 && t1 < 1.0) {
- GetPointCoord(origin[k], origin[n], t1, p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
- }
- }
- else if (t[n] > 1.0) {
- // find second intersection point
- t1 = GetParameterValue(endray[k][whichPlane], endray[n][whichPlane], coordPlane[whichPlane]);
- if (t1 > 0.0 && t1 < 1.0) {
- GetPointCoord(endray[k], endray[n], t1, p);
- aPoints->InsertNextPoint(p[0], p[1], p[2]);
- }
- }
- }
- }
- n = aPoints->GetNumberOfPoints();
- if (n == 0) {
- aPoints->Delete();
- return 0;
- }
-
- if (n == 1) {
- aPoints->GetPoint(0, p);
- inside = 1;
- for (i = 0; i < 3; i++) {
- if (i != whichPlane) {
- if (p[i] < bounds[2*i] || p[i] > bounds[2*i+1]) {
- inside = 0; break;
- }
- }
- }
- aPoints->Delete();
- return inside;
- }
-
- // Analize intersection
- int nearPlane, boundPlane = -1;
- float boundCoord, boundMin, boundMax;
- char intersect = 0;
- for (k = 0; k < n; k++) {
- aPoints->GetPoint(k, p);
- j = k+1; if (j == n) j = 0;
- aPoints->GetPoint(j, q);
- inside = 1;
- nearPlane = 0;
- // if the point is inside bbox
- for (i = 0; i < 3; i++) {
- if (i != whichPlane) {
- if (p[i] < bounds[2*i]) {
- side[i] = SIDE_LEFT;
- maxT[i] = GetParameterValue(p[i], q[i], bounds[2*i]);
- inside = 0;
- }
- else if (p[i] > bounds[2*i+1]) {
- side[i] = SIDE_RIGHT;
- maxT[i] = GetParameterValue(p[i], q[i], bounds[2*i+1]);
- inside = 0;
- }
- else {
- side[i] = SIDE_MIDDLE;
- maxT[i] = -1.0;
- }
- }
- else maxT[i] = -1.0;
- if (maxT[i] > maxT[nearPlane]) nearPlane = i;
- }
- if (inside) break;
- // if segment intersects bbox
- if (maxT[nearPlane] >= 0.0 && maxT[nearPlane] <= 1.0) {
- for (i = 0; i < 3; i++) {
- if (i != whichPlane && i != nearPlane) {
- coord = p[i] + maxT[nearPlane]*(q[i]-p[i]);
- if (coord >= bounds[2*i] && coord <= bounds[2*i+1]) {
- intersect = 1; break;
- }
- }
- }
- // intersect with boundPlane
- if (boundPlane == -1) {
- boundCoord = p[nearPlane] + maxT[nearPlane]*(q[nearPlane]-p[nearPlane]);
- boundPlane = nearPlane;
- for (i = 0; i < 3; i++) {
- if (i != whichPlane && i != boundPlane) {
- coord = p[i] + maxT[nearPlane]*(q[i]-p[i]);
- boundMin = boundMax = coord;
- }
- }
- }
- else {
- t1 = GetParameterValue(p[boundPlane], q[boundPlane], boundCoord);
- if (t1 >= 0.0 && t1 <= 1.0) {
- for (i = 0; i < 3; i++) {
- if (i != whichPlane && i != boundPlane) {
- coord = p[i] + t1*(q[i]-p[i]);
- if (coord < boundMin) boundMin = coord;
- if (coord > boundMax) boundMax = coord;
- }
- }
- }
- }
- }
- if (intersect) break;
- }
- aPoints->Delete();
- if (inside || intersect) {
- return 1;
- }
-
- inside = 1;
- for (i = 0; i < 3; i++) {
- if (i != whichPlane && i != boundPlane) {
- if (boundMin > bounds[2*i+1] || boundMax < bounds[2*i])
- inside = 0;
- }
- }
-
- return inside;
-}
-
-//----------------------------------------------------------------------------
-char VTKViewer_RectPicker::PointInside (float p[3], float p1[4][4], float p2[4][4], float tol)
-{
- int i, j, k;
- float t, coord[3];
-
- // Fix one coordinate (x, for example) and
- // compute intersection with coordinate plane
- vtkPoints* aPoints = vtkPoints::New();
- int mode = 0;
- for (k = 0; k < 4; k++) {
- j = k+1; if (j == 4) j = 0;
- switch (mode) {
- case 0:
- if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 0;
- }
- if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 1;
- }
- if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 2;
- }
- /*
- if ((p1[k][0]-p[0])*(p2[k][0]-p[0]) <= 0) {
- t = GetParameterValue(p1[k][0], p2[k][0], p[0]);
- if (t >= 0.0 && t <= 1.0) {
- GetPointCoord(p1[k], p2[k], t, coord);
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- }
- }
- */
- break;
- case 1:
- if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 1;
- }
- if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 2;
- }
- if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 0;
- }
- /*
- if ((p1[k][0]-p[0])*(p1[j][0]-p[0]) <= 0) {
- t = GetParameterValue(p1[k][0], p1[j][0], p[0]);
- if (t > 0.0 && t < 1.0) {
- GetPointCoord(p1[k], p1[j], t, coord);
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- }
- }
- */
- break;
- case 2:
- if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 2;
- }
- if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 1;
- }
- if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) {
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- mode = 0;
- }
- /*
- if ((p2[k][0]-p[0])*(p2[j][0]-p[0]) <= 0) {
- t = GetParameterValue(p2[k][0], p2[j][0], p[0]);
- if (t > 0.0 && t < 1.0) {
- GetPointCoord(p2[k], p2[j], t, coord);
- aPoints->InsertNextPoint(coord[0], coord[1], coord[2]);
- }
- }
- */
- break;
- }
- }
- int n = aPoints->GetNumberOfPoints();
- //cout << "---> Points in X projection " << n << endl;
- if (n == 0) {
- aPoints->Delete();
- return 0;
- }
-
- // Fix the second coord and define bounds
- float zMin = VTK_LARGE_FLOAT, zMax = -VTK_LARGE_FLOAT, z, ncoord[3];
- char inside = 0;
- for (k = 0; k < n; k++) {
- aPoints->GetPoint(k, coord);
- //cout << " P" << k << " (" << coord[0] << ", " << coord[1] << ", " << coord[2] << ")";
- j = k+1; if (j == n) j = 0;
- if (j == k) {
- if (p[1] == coord[1] && p[2] == coord[2]) {
- inside = 1;
- }
- break;
- }
- aPoints->GetPoint(j, ncoord);
- t = GetParameterValue(coord[1], ncoord[1], p[1]);
- if (t >= 0.0 && t <= 1) {
- z = coord[2] + t*(ncoord[2]-coord[2]);
- if (z < zMin) zMin = z;
- if (z > zMax) zMax = z;
- }
- }
- //cout << endl << " Zmin = " << zMin << ", Zmax = " << zMax << endl;
- if (!inside) {
- if (p[2] <= (zMax+tol) && p[2] >= (zMin-tol))
- inside = 1;
- }
-
- aPoints->Delete();
- return inside;
-}
-
-//----------------------------------------------------------------------------
-float VTKViewer_RectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
- vtkAssemblyPath *path, vtkProp3D *prop3D,
- vtkAbstractMapper3D *mapper)
-{
- int i, k;
- float *center, p0[3], ray[3], rayFactor, t;
-
- // Get the data from the modeler
- //
- center = mapper->GetCenter();
-
- if (!PointInside(center, p1, p2)) {
- return 2.0;
- }
-
- // Determine appropriate info
- //
- for (i = 0; i < 3; i++) {
- p0[i] = ray[i] = 0;
- for (k = 0; k < 4; k++) {
- p0[i] += p1[k][i];
- ray[i] += p2[k][i];
- }
- p0[i] = p0[i]/4;
- ray[i] = ray[i]/4;
- ray[i] = ray[i] - p0[i];
- }
- if (( rayFactor = vtkMath::Dot(ray,ray)) == 0.0 ) {
- vtkErrorMacro("Cannot process points");
- return 2.0;
- }
-
- // Project the center point onto the ray and determine its parametric value
- //
- t = (ray[0]*(center[0]-p0[0]) + ray[1]*(center[1]-p0[1])
- + ray[2]*(center[2]-p0[2])) / rayFactor;
-
- if ( t >= 0.0 && t <= 1.0 && t < this->GlobalTMin ) {
- this->MarkPicked(path, prop3D, mapper, t, center);
- }
- return t;
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RectPicker.h
-// Author : Natalia KOPNOVA
-// Module : SALOME
-
-#ifndef __VTKViewer_RectPicker_h
-#define __VTKViewer_RectPicker_h
-
-#include <vtkPicker.h>
-
-class VTK_EXPORT VTKViewer_RectPicker : public vtkPicker
-{
-public:
- static VTKViewer_RectPicker *New();
- vtkTypeMacro(VTKViewer_RectPicker,vtkPicker);
-
- // Description:
- // Perform pick operation with selection rectangle provided. Normally the
- // first two values for the selection top-left and right-bottom points are
- // x-y pixel coordinate, and the third value is =0.
- // Return non-zero if something was successfully picked.
- virtual int Pick(float selectionX1, float selectionY1, float selectionZ1,
- float selectionX2, float selectionY2, float selectionZ2,
- vtkRenderer *renderer);
-
- // Description:
- // Perform pick operation with selection rectangle provided. Normally the first
- // two values for the selection top-left and right-bottom points are x-y pixel
- // coordinate, and the third value is =0.
- // Return non-zero if something was successfully picked.
- int Pick(float selectionPt1[3], float selectionPt2[3], vtkRenderer *ren)
- {return this->Pick(selectionPt1[0], selectionPt1[1], selectionPt1[2],
- selectionPt2[0], selectionPt2[1], selectionPt2[2],
- ren);};
-
- // Description:
- // Bounding box intersection with hexahedron. The method returns a non-zero value
- // if the bounding box is hit. Origin[4][4] starts the ray from corner points,
- // dir[4][3] is the vector components of the ray in the x-y-z directions.
- // (Notes: the intersection ray dir[4][3] is NOT normalized.)
- static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]);
-
- // Description:
- // Position of point relative to hexahedron. The method returns a non-zero value
- // if the point is inside. p1[4][4] is the corner points of top face,
- // p2[4][4] is the corner points of bottom face.
- static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0);
-
-protected:
- VTKViewer_RectPicker();
- ~VTKViewer_RectPicker() {};
-
- virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
- vtkAssemblyPath *path, vtkProp3D *p,
- vtkAbstractMapper3D *m);
-
-private:
-};
-
-#endif
-
-
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RenderWindow.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer_RenderWindow.h"
-#include "utilities.h"
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-#include "QAD_Tools.h"
-#include "SALOME_Selection.h"
-
-#include <qcolordialog.h>
-
-#include <stdlib.h>
-#include <math.h>
-#include <iostream.h>
-
-#include <vtkRenderWindowInteractor.h>
-#include <vtkRendererCollection.h>
-#include <vtkXOpenGLRenderWindow.h>
-#include <vtkCamera.h>
-
-//#include <GL/gl.h>
-//#include <GL/glu.h>
-//#include <qgl.h>
-
-#if QT_VERSION > 300
-#include <qcursor.h>
-#endif
-using namespace std;
-
-VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget *parent, const char *name) :
- QWidget(parent, name,
- Qt::WStyle_NoBorder | Qt::WDestructiveClose |
- Qt::WResizeNoErase | Qt::WRepaintNoErase)
-{
- myRW = vtkRenderWindow::New();
- MESSAGE(QString("RenderWindow is ") + QString(myRW->GetClassName()));
- myRW->SetDisplayId((void*)x11Display());
- myRW->SetWindowId((void*)winId());
- myRW->DoubleBufferOn();
- setMouseTracking(true);
-}
-
-VTKViewer_RenderWindow::~VTKViewer_RenderWindow() {
- myRW->Delete(); //BUG SAL2954, Commented by SRN, to avoid problems when using rlogin
- // Uncommented because of bug SAL3913
-}
-
-void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent) {
- myRW->Render();
-}
-
-void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* theEvent) {
- int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1];
- if(vtkRenderWindowInteractor* aRWI = myRW->GetInteractor())
- aRWI->UpdateSize(width(), height());
- if(aWidth != width() || aHeight != height()){
- vtkRendererCollection * aRenderers = myRW->GetRenderers();
- aRenderers->InitTraversal();
- double aCoeff = 1.0;
- if(vtkRenderer *aRenderer = aRenderers->GetNextItem()){
- vtkCamera *aCamera = aRenderer->GetActiveCamera();
- double aScale = aCamera->GetParallelScale();
- if((aWidth - width())*(aHeight - height()) > 0)
- aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
- else
- aCoeff = double(aWidth)/double(width());
- aCamera->SetParallelScale(aScale*aCoeff);
- }
- }
-}
-
-
-void VTKViewer_RenderWindow::mouseMoveEvent( QMouseEvent *event ) {
- emit MouseMove(event) ;
-}
-
-void VTKViewer_RenderWindow::mousePressEvent( QMouseEvent *event ) {
- emit ButtonPressed(event) ;
- switch(event->button()) {
- case LeftButton:
- emit LeftButtonPressed(event) ;
- break ;
- case MidButton:
- emit MiddleButtonPressed(event) ;
- break ;
- case RightButton:
- if ( event->state() == Qt::ControlButton ) {
- emit RightButtonPressed(event) ;
- } else {
- QPopupMenu* popup = createPopup();
- if ( popup ) {
- QAD_Tools::checkPopup( popup );
- if ( popup->count()>0 ) {
- popup->exec( QCursor::pos() );
- }
- destroyPopup();
- }
- }
- break;
- default:
- break ;
- }
-}
-
-
-void VTKViewer_RenderWindow::mouseReleaseEvent( QMouseEvent *event ) {
- emit ButtonReleased(event) ;
- switch(event->button()) {
- case LeftButton:
- emit LeftButtonReleased(event) ;
- break ;
- case MidButton:
- emit MiddleButtonReleased(event) ;
- break ;
- case RightButton:
- emit RightButtonReleased(event) ;
- break;
- default:
- break ;
- }
-}
-
-void VTKViewer_RenderWindow::keyPressEvent (QKeyEvent * event) {
- emit KeyPressed(event) ;
-}
-
-/*!
- Creates the popup
-*/
-void VTKViewer_RenderWindow::onCreatePopup()
-{
- if ( myPopup ) {
- QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
- QAD_Study* myActiveStudy = Desktop->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
-
- QString theContext;
- QString theParent("Viewer");
- QString theObject;
-
- Desktop->definePopup( theContext, theParent, theObject );
- Desktop->createPopup( myPopup, theContext, theParent, theObject);
- Desktop->customPopup( myPopup, theContext, theParent, theObject );
-
-// if (Sel->IObjectCount() == 0 && myPopup->count()<1) {
- if ( myPopup->count() > 0 )
- myIDs.append ( myPopup->insertSeparator() );
- int id;
- myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
- QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
-// }
- }
-}
-
-
-void VTKViewer_RenderWindow::onChangeBackgroundColor()
-{
- float red, green, blue;
- float backint[3];
-
- vtkRendererCollection * theRenderers = myRW->GetRenderers();
- theRenderers->InitTraversal();
- vtkRenderer * theRenderer = theRenderers->GetNextItem();
- theRenderer->GetBackground(backint);
-
- QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );
- if ( selColor.isValid() ) {
- theRenderer->SetBackground( selColor.red()/255., selColor.green()/255., selColor.blue()/255. );
- /* VSR : PAL5420 ---------------------------------------------------
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorRed", selColor.red() );
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", selColor.green() );
- QAD_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue", selColor.blue() );
- VSR : PAL5420 --------------------------------------------------- */
- }
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RenderWindow.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_RenderWindow_h
-#define VTKViewer_RenderWindow_h
-
-#include <stdlib.h>
-#include <vtkRenderWindow.h>
-//#include <qgl.h>
-#include <vtkRenderWindow.h>
-
-#include "QAD_Popup.h"
-
-class VTK_EXPORT VTKViewer_RenderWindow :
-public QWidget, /*virtual public vtkRenderWindow, */
- public QAD_PopupClientServer
-{
- Q_OBJECT
- public:
- /* popup management */
- void onCreatePopup();
-
- const char *GetClassName() {return "VTKViewer_RenderWindow";};
-
- protected slots:
- void onChangeBackgroundColor();
-
- public:
- VTKViewer_RenderWindow(QWidget *parent, const char *name);
- ~VTKViewer_RenderWindow() ;
-
- virtual void mouseMoveEvent( QMouseEvent * ) ;
- virtual void mousePressEvent( QMouseEvent * ) ;
- virtual void mouseReleaseEvent( QMouseEvent * ) ;
- virtual void keyPressEvent( QKeyEvent * ) ;
-
- vtkRenderWindow* getRenderWindow() { return myRW; }
-
- protected:
- virtual void paintEvent (QPaintEvent* theEvent);
- virtual void resizeEvent (QResizeEvent* theEvent);
-
-
- signals:
- void MouseMove(const QMouseEvent *event) ;
- void LeftButtonPressed(const QMouseEvent *event) ;
- void LeftButtonReleased(const QMouseEvent *event) ;
- void MiddleButtonPressed(const QMouseEvent *event) ;
- void MiddleButtonReleased(const QMouseEvent *event) ;
- void RightButtonPressed(const QMouseEvent *event) ;
- void RightButtonReleased(const QMouseEvent *event) ;
- void ButtonPressed(const QMouseEvent *event) ;
- void ButtonReleased(const QMouseEvent *event) ;
- void KeyPressed(QKeyEvent *event) ;
-
- protected:
- vtkRenderWindow* myRW;
-};
-
-#endif
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RenderWindowInteractor.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer_RenderWindowInteractor.h"
-
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_ViewFrame.h"
-
-#include "VTKViewer_Algorithm.h"
-#include "VTKViewer_Functor.h"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-
-#include "VTKViewer_Actor.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-// VTK Includes
-#include <vtkObjectFactory.h>
-#include <vtkPicker.h>
-#include <vtkCellPicker.h>
-#include <vtkPointPicker.h>
-#include <vtkRendererCollection.h>
-
-// QT Includes
-#include <qkeycode.h>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-#include "utilities.h"
-
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() {
- vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
- if( ret ) {
- return dynamic_cast<VTKViewer_RenderWindowInteractor *>(ret) ;
- }
- return new VTKViewer_RenderWindowInteractor;
-}
-
-VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor() {
- this->Enabled = 0 ;
- this->mTimer = new QTimer( this ) ;
- myDisplayMode = 0;
- myGUIWindow = 0;
-
- myBasicPicker = vtkPicker::New();
- myCellPicker = vtkCellPicker::New();
- myPointPicker = vtkPointPicker::New();
-
- myCellActor = VTKViewer_Actor::New();
- myCellActor->PickableOff();
- myCellActor->GetProperty()->SetColor(1,1,0);
- myCellActor->GetProperty()->SetLineWidth(5);
- myCellActor->GetProperty()->SetRepresentationToSurface();
-
- myEdgeActor = VTKViewer_Actor::New();
- myEdgeActor->PickableOff();
- myEdgeActor->GetProperty()->SetColor(1,0,0);
- myEdgeActor->GetProperty()->SetLineWidth(5);
- myEdgeActor->GetProperty()->SetRepresentationToWireframe();
-
- myPointActor = VTKViewer_Actor::New();
- myPointActor->PickableOff();
- myPointActor->GetProperty()->SetColor(1,1,0);
- myPointActor->GetProperty()->SetPointSize(5);
- myPointActor->GetProperty()->SetRepresentationToPoints();
-
- connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ;
-}
-
-
-VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor() {
- if(MYDEBUG) INFOS("VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor()");
-
- delete mTimer ;
-
- myViewFrame->RemoveActor(myCellActor);
- myViewFrame->RemoveActor(myEdgeActor);
- myViewFrame->RemoveActor(myPointActor);
-
- myCellActor->Delete();
- myEdgeActor->Delete();
- myPointActor->Delete();
-
- myBasicPicker->Delete();
- myCellPicker->Delete();
- myPointPicker->Delete();
-}
-
-void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent) {
- vtkRenderWindowInteractor::PrintSelf(os, indent) ;
- //
- // :NOTE: Fri Apr 21 21:51:05 2000 Pagey
- // QGL specific stuff goes here. One should add output
- // lines here if any protected members are added to
- // the class.
- //
-}
-
-//
-// We never allow the VTKViewer_RenderWindowInteractor to control
-// the event loop. The application always has the control.
-//
-void VTKViewer_RenderWindowInteractor::Initialize() {
- //
- // We cannot do much unless there is a render window
- // associated with this interactor.
- //
- if( ! RenderWindow ) {
- vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize(): No render window attached!") ;
- return ;
- }
-
- //
- // We cannot hand a render window which is not a VTKViewer_RenderWindow.
- // One way to force this is to use dynamic_cast and hope that
- // it works. If the dynamic_cast does not work, we flag an error
- // and get the hell out.
- //
- vtkRenderWindow *my_render_win = dynamic_cast<vtkRenderWindow *>(RenderWindow) ;
- if( !my_render_win ) {
- vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize() can only handle VTKViewer_RenderWindow.") ;
- return ;
- }
-
- //
- // If the render window has zero size, then set it to a default
- // value of 300x300.
- //
- int* aSize = my_render_win->GetSize();
- this->Size[0] = ((aSize[0] > 0) ? aSize[0] : 300);
- this->Size[1] = ((aSize[1] > 0) ? aSize[1] : 300);
-
- this->SetPicker(myBasicPicker);
-
- SetSelectionTolerance();
-
- //
- // Enable the interactor.
- //
- this->Enable() ;
-
- //
- // Start the rendering of the window.
- //
- my_render_win->Start() ;
-
- //
- // The interactor has been initialized.
- //
- this->Initialized = 1 ;
-
- return ;
-}
-
-
-//----------------------------------------------------------------------------
-void VTKViewer_RenderWindowInteractor::setGUIWindow(QWidget* theWindow){
- myGUIWindow = theWindow;
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_RenderWindowInteractor::setViewFrame(VTKViewer_ViewFrame* theViewFrame){
- myViewFrame = theViewFrame;
-
- myViewFrame->InsertActor(myCellActor);
- myViewFrame->InsertActor(myEdgeActor);
- myViewFrame->InsertActor(myPointActor);
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_RenderWindowInteractor::MoveInternalActors()
-{
- myViewFrame->MoveActor(myCellActor);
- myViewFrame->MoveActor(myEdgeActor);
- myViewFrame->MoveActor(myPointActor);
-}
-
-//----------------------------------------------------------------------------
-void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
- myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyleSALOME*>(theInteractor);
- vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
-}
-
-
-void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
-{
- myCellActor->SetVisibility(false);
- myEdgeActor->SetVisibility(false);
- myPointActor->SetVisibility(false);
-
- switch(theMode){
- case ActorSelection:
- this->SetPicker(myBasicPicker);
- break;
- case NodeSelection:
- this->SetPicker(myPointPicker);
- break;
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- case EdgeOfCellSelection:
- this->SetPicker(myCellPicker);
- break;
- }
-
- myInteractorStyle->OnSelectionModeChanged();
-}
-
-void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen,
- const double& theBlue, const int& theWidth)
-{
- myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- myCellActor->GetProperty()->SetLineWidth(theWidth);
-
- myPointActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
- myPointActor->GetProperty()->SetPointSize(theWidth);
-}
-
-void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems)
-{
- myTolNodes = theTolNodes;
- myTolItems = theTolItems;
-
- myBasicPicker->SetTolerance(myTolItems);
- myCellPicker->SetTolerance(myTolItems);
- myPointPicker->SetTolerance(myTolNodes);
-
-}
-
-void VTKViewer_RenderWindowInteractor::Enable() {
- //
- // Do not need to do anything if already enabled.
- //
- if( this->Enabled ) {
- return ;
- }
-
- //
- // Attach slots to every useful signal of the render window.
- //
- this->ConnectSlots() ;
-
- this->Enabled = 1 ;
- this->Modified() ;
-}
-
-void VTKViewer_RenderWindowInteractor::Disable() {
- if( ! this->Enabled ) {
- return ;
- }
-
- this->DisconnectSlots() ;
- this->Enabled = 0 ;
- this->Modified() ;
-}
-
-// ==================================
-void VTKViewer_RenderWindowInteractor::Start() {
- //
- // We do not allow this interactor to control the
- // event loop. Only the QtApplication objects are
- // allowed to do that.
- //
- vtkErrorMacro(<<"VTKViewer_RenderWindowInteractor::Start() not allowed to start event loop.") ;
- return ;
-}
-
-void VTKViewer_RenderWindowInteractor::UpdateSize(int w, int h) {
- // if the size changed send this on to the RenderWindow
- if ((w != this->Size[0])||(h != this->Size[1])) {
- this->Size[0] = w;
- this->Size[1] = h;
- this->RenderWindow->SetSize(w,h);
- }
-}
-
-int VTKViewer_RenderWindowInteractor::CreateTimer(int vtkNotUsed(timertype)) {
- //
- // Start a one-shot timer for 10ms.
- //
- mTimer->start(10, TRUE) ;
- return 1 ;
-}
-
-int VTKViewer_RenderWindowInteractor::DestroyTimer(void) {
- //
- // :TRICKY: Tue May 2 00:17:32 2000 Pagey
- //
- // QTimer will automatically expire after 10ms. So
- // we do not need to do anything here. In fact, we
- // should not even Stop() the QTimer here because doing
- // this will skip some of the processing that the TimerFunc()
- // does and will result in undesirable effects. For
- // example, this will result in vtkLODActor to leave
- // the models in low-res mode after the mouse stops
- // moving.
- //
- return 1 ;
-}
-
-void VTKViewer_RenderWindowInteractor::TimerFunc() {
- if( ! this->Enabled ) {
- return ;
- }
-
- ((vtkInteractorStyle*)this->InteractorStyle)->OnTimer() ;
- emit RenderWindowModified() ;
-}
-
-void VTKViewer_RenderWindowInteractor::ConnectSlots() {
- ProcessSlotConnections(true) ;
-}
-
-void VTKViewer_RenderWindowInteractor::DisconnectSlots() {
- ProcessSlotConnections(false) ;
-}
-
-void VTKViewer_RenderWindowInteractor::ProcessSlotConnections(bool conn) {
- //
- // We cannot do much unless there is a render window
- // associated with this interactor.
- //
- if( ! myGUIWindow ) {
- vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize(): No render window attached!") ;
- return ;
- }
-
-
- bool (*slot_func) ( const QObject * sender,
- const char * signal,
- const QObject * receiver,
- const char * member ) ;
- if( conn ) {
- slot_func = &QObject::connect ;
- } else {
- slot_func = &QObject::disconnect ;
- }
- //
- // We cannot hand a render window which is not a VTKViewer_RenderWindow.
- // One way to force this is to use dynamic_cast and hope that
- // it works. If the dynamic_cast does not work, we flag an error
- // and get the hell out.
- //
- if( ! myGUIWindow ) {
- vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize() can only handle VTKViewer_RenderWindow.") ;
- return ;
- }
-
- slot_func ( myGUIWindow, SIGNAL(ButtonPressed(const QMouseEvent *)),
- this, SLOT(ButtonPressed(const QMouseEvent *)) ) ;
- slot_func( myGUIWindow, SIGNAL(ButtonReleased(const QMouseEvent *)),
- this, SLOT(ButtonReleased(const QMouseEvent *)) ) ;
-
-
- slot_func( myGUIWindow, SIGNAL(LeftButtonPressed(const QMouseEvent *)),
- this, SLOT(LeftButtonPressed(const QMouseEvent *)) ) ;
- slot_func( myGUIWindow, SIGNAL(LeftButtonReleased(const QMouseEvent *)),
- this, SLOT(LeftButtonReleased(const QMouseEvent *)) ) ;
-
- slot_func( myGUIWindow, SIGNAL(MiddleButtonPressed(const QMouseEvent *)),
- this, SLOT(MiddleButtonPressed(const QMouseEvent *)) ) ;
- slot_func( myGUIWindow, SIGNAL(MiddleButtonReleased(const QMouseEvent *)),
- this, SLOT(MiddleButtonReleased(const QMouseEvent *)) ) ;
-
- slot_func( myGUIWindow, SIGNAL(RightButtonPressed(const QMouseEvent *)),
- this, SLOT(RightButtonPressed(const QMouseEvent *)) ) ;
- slot_func( myGUIWindow, SIGNAL(RightButtonReleased(const QMouseEvent *)),
- this, SLOT(RightButtonReleased(const QMouseEvent *)) ) ;
-
- slot_func( myGUIWindow, SIGNAL(MouseMove(const QMouseEvent *)),
- this, SLOT(MouseMove(const QMouseEvent *)) ) ;
-
- slot_func( myGUIWindow, SIGNAL(KeyPressed(QKeyEvent *)),
- this, SLOT(KeyPressed(QKeyEvent *)) ) ;
-
- slot_func( this, SIGNAL(RenderWindowModified()),
- myGUIWindow, SLOT(update()) ) ;
-
-}
-
-void VTKViewer_RenderWindowInteractor::MouseMove(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
- if (myInteractorStyle->needsRedrawing() )
- emit RenderWindowModified() ;
-}
-
-void VTKViewer_RenderWindowInteractor::LeftButtonPressed(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y());
-}
-
-void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
-}
-
-void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
-}
-
-void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
-}
-
-void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
-}
-
-void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
- if( ! this->Enabled ) {
- return ;
- }
- myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
- event->x(), event->y() ) ;
-}
-
-void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) {
- return ;
-}
-
-void VTKViewer_RenderWindowInteractor::ButtonReleased(const QMouseEvent *event) {
- return ;
-}
-
-
-int VTKViewer_RenderWindowInteractor::GetDisplayMode() {
- return myDisplayMode;
-}
-
-void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) {
- if(theMode == 0)
- ChangeRepresentationToWireframe();
- else
- ChangeRepresentationToSurface();
- myDisplayMode = theMode;
-}
-
-
-void VTKViewer_RenderWindowInteractor::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject, int theMode){
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,int>
- (&SALOME_Actor::setDisplayMode,theMode));
-}
-
-
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe()
-{
- ChangeRepresentationToWireframe(GetRenderer()->GetActors());
-}
-
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
-{
- ChangeRepresentationToSurface(GetRenderer()->GetActors());
-}
-
-
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
-{
- using namespace SALOME::VTK;
- ForEach<SALOME_Actor>(theCollection,
- TSetFunction<SALOME_Actor,int>
- (&SALOME_Actor::setDisplayMode,0));
- emit RenderWindowModified();
-}
-
-void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
-{
- using namespace SALOME::VTK;
- ForEach<SALOME_Actor>(theCollection,
- TSetFunction<SALOME_Actor,int>
- (&SALOME_Actor::setDisplayMode,1));
- emit RenderWindowModified();
-}
-
-
-vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer()
-{
- vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers();
- theRenderers->InitTraversal();
- return theRenderers->GetNextItem();
-}
-
-
-struct TErase{
- SALOME::VTK::TSetFunction<vtkActor,int> mySetFunction;
- TErase():
- mySetFunction(&vtkActor::SetVisibility,false)
- {}
- void operator()(SALOME_Actor* theActor){
- theActor->SetVisibility(false);
- // Erase dependent actors
- vtkActorCollection* aCollection = vtkActorCollection::New();
- theActor->GetChildActors(aCollection);
- SALOME::VTK::ForEach<vtkActor>(aCollection,mySetFunction);
- aCollection->Delete();
- }
-};
-
-void VTKViewer_RenderWindowInteractor::EraseAll()
-{
- using namespace SALOME::VTK;
- ForEach<SALOME_Actor>(GetRenderer()->GetActors(),
- TErase());
-
- emit RenderWindowModified() ;
-}
-
-void VTKViewer_RenderWindowInteractor::DisplayAll()
-{
- vtkActorCollection* aCollection = GetRenderer()->GetActors();
- using namespace SALOME::VTK;
- ForEach<SALOME_Actor>(aCollection,TSetVisibility<SALOME_Actor>(true));
-
- emit RenderWindowModified() ;
-}
-
-
-void VTKViewer_RenderWindowInteractor::Erase(SALOME_Actor* theActor, bool update)
-{
- TErase()(theActor);
-
- if(update)
- emit RenderWindowModified();
-}
-
-
-void VTKViewer_RenderWindowInteractor::Erase(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
-{
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TErase());
-
- if(update)
- emit RenderWindowModified();
-}
-
-
-struct TRemoveAction{
- vtkRenderer* myRen;
- TRemoveAction(vtkRenderer* theRen): myRen(theRen){}
- void operator()(SALOME_Actor* theActor){
- myRen->RemoveActor(theActor);
- }
-};
-
-void VTKViewer_RenderWindowInteractor::Remove(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
-{
- vtkRenderer* aRen = GetRenderer();
-
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(aRen->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TRemoveAction(aRen));
-
-
-}
-
-void VTKViewer_RenderWindowInteractor::Remove( SALOME_Actor* SActor, bool updateViewer )
-{
- if ( SActor != 0 )
- {
- GetRenderer()->RemoveProp( SActor );
- if ( updateViewer )
- emit RenderWindowModified();
- }
-}
-
-void VTKViewer_RenderWindowInteractor::RemoveAll( const bool updateViewer )
-{
- vtkRenderer* aRenderer = GetRenderer();
- vtkActorCollection* anActors = aRenderer->GetActors();
- if ( anActors )
- {
- anActors->InitTraversal();
- while ( vtkActor *anAct = anActors->GetNextActor() )
- {
- if ( anAct->IsA( "SALOME_Actor" ) )
- {
- SALOME_Actor* aSAct = (SALOME_Actor*)anAct;
- if ( aSAct->hasIO() && aSAct->getIO()->hasEntry() )
- aRenderer->RemoveActor( anAct );
- }
- }
-
- if ( updateViewer )
- emit RenderWindowModified();
- }
-}
-
-
-float VTKViewer_RenderWindowInteractor::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject)
-{
- using namespace SALOME::VTK;
- SALOME_Actor* anActor =
- Find<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject));
- if(anActor)
- return 1.0 - anActor->GetOpacity();
- return -1.0;
-}
-
-
-void VTKViewer_RenderWindowInteractor::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, float theTrans)
-{
- float anOpacity = 1.0 - theTrans;
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,float>
- (&SALOME_Actor::SetOpacity,anOpacity));
-}
-
-
-void VTKViewer_RenderWindowInteractor::Display(SALOME_Actor* theActor, bool update)
-{
- GetRenderer()->AddActor(theActor);
- theActor->SetVisibility(true);
-
- if(update)
- emit RenderWindowModified();
-}
-
-
-void VTKViewer_RenderWindowInteractor::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
-{
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TSetVisibility<SALOME_Actor>(true));
-
- if(update)
- emit RenderWindowModified() ;
-}
-
-
-void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event){}
-
-
-struct THighlightAction{
- bool myIsHighlight;
- VTKViewer_InteractorStyleSALOME* myInteractorStyle;
- THighlightAction(VTKViewer_InteractorStyleSALOME* theInteractorStyle,
- bool theIsHighlight):
- myInteractorStyle(theInteractorStyle),
- myIsHighlight(theIsHighlight)
- {}
- void operator()(SALOME_Actor* theActor){
- if(theActor->GetMapper()){
- if(theActor->hasHighlight())
- theActor->highlight(myIsHighlight);
- else{
- if(theActor->GetVisibility() && myIsHighlight)
- myInteractorStyle->HighlightProp(theActor);
- else if(!myIsHighlight)
- myInteractorStyle->HighlightProp(NULL);
- }
- }
- }
-};
-
-bool VTKViewer_RenderWindowInteractor::highlight( const Handle(SALOME_InteractiveObject)& theIObject,
- bool hilight,
- bool update)
-{
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- THighlightAction(myInteractorStyle,hilight));
-
- if(update)
- emit RenderWindowModified();
-
- return false;
-}
-
-
-struct TUpdateAction{
- void operator()(vtkActor* theActor){
- theActor->ApplyProperties();
- }
-};
-
-void VTKViewer_RenderWindowInteractor::Update() {
- vtkRenderer* aRen = GetRenderer();
-
- using namespace SALOME::VTK;
- ForEach<vtkActor>(aRen->GetActors(),TUpdateAction());
-
- aRen->ResetCamera();
-
- emit RenderWindowModified();
-}
-
-
-void VTKViewer_RenderWindowInteractor::unHighlightSubSelection(){
- myPointActor->SetVisibility(false);
- myEdgeActor->SetVisibility(false);
- myCellActor->SetVisibility(false);
-}
-
-
-struct TUnHighlightAllAction{
- void operator()(SALOME_Actor* theActor){
- if(theActor->hasIO()){
- if(theActor->hasHighlight())
- theActor->highlight(false);
- }
- }
-};
-
-bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
- unHighlightSubSelection();
-
- using namespace SALOME::VTK;
- ForEach<SALOME_Actor>(GetRenderer()->GetActors(),
- TUnHighlightAllAction());
-
- emit RenderWindowModified() ;
- return false;
-}
-
-//-----------------
-// Color methods
-//-----------------
-
-void VTKViewer_RenderWindowInteractor::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,QColor theColor)
-{
- float aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,const float*>
- (&SALOME_Actor::SetColor,aColor));
-}
-
-
-QColor VTKViewer_RenderWindowInteractor::GetColor(const Handle(SALOME_InteractiveObject)& theIObject)
-{
- using namespace SALOME::VTK;
- SALOME_Actor* anActor =
- Find<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject));
- if(anActor){
- float r,g,b;
- anActor->GetColor(r,g,b);
- return QColor(int(r*255),int(g*255),int(b*255));
- }
- return QColor(0,0,0);
-}
-
-
-bool VTKViewer_RenderWindowInteractor::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
-{
- using namespace SALOME::VTK;
- SALOME_Actor* anActor =
- Find<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject));
- return anActor != NULL;
-}
-
-
-bool VTKViewer_RenderWindowInteractor::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
-{
- using namespace SALOME::VTK;
- SALOME_Actor* anActor =
- Find<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject));
- return anActor != NULL && anActor->GetVisibility();
-}
-
-
-void VTKViewer_RenderWindowInteractor::rename(const Handle(SALOME_InteractiveObject)& theIObject, QString theName)
-{
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(GetRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TSetFunction<SALOME_Actor,const char*,QString>
- (&SALOME_Actor::setName,theName.latin1()));
-}
-
-
-//----------------------------------------------------------------------------
-bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor, VTKViewer_Actor* theActor,
- TUpdateActor theFun, bool hilight, bool update)
-{
- if(theMapIndex.Extent() == 0) return false;
-
- if (hilight) {
- setActorData(theMapIndex,theMapActor,theActor,theFun);
- theActor->SetVisibility(true);
- }
- else {
- theActor->SetVisibility(false);
- }
-
- if(update){
- this->RenderWindow->Render();
- emit RenderWindowModified() ;
- }
-
- return false;
-}
-
-void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor *theActor,
- TUpdateActor theFun)
-{
- (*theFun)(theMapIndex,theMapActor,theActor);
-}
-
-
-//----------------------------------------------------------------------------
-static void CellsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor)
-{
- theActor->MapCells(theMapActor,theMapIndex);
-}
-
-bool VTKViewer_RenderWindowInteractor::highlightCell(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update)
-{
- return highlight(theMapIndex,theMapActor,myCellActor,&CellsUpdateActor,hilight,update);
-}
-
-void VTKViewer_RenderWindowInteractor::setCellData(const int& theIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor)
-{
- TColStd_IndexedMapOfInteger MapIndex;
- MapIndex.Add(theIndex);
- theActor->MapCells(theMapActor,MapIndex);
-}
-
-
-//----------------------------------------------------------------------------
-static void PointsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor)
-{
- theActor->MapPoints(theMapActor,theMapIndex);
-}
-
-bool VTKViewer_RenderWindowInteractor::highlightPoint(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update)
-{
- return highlight(theMapIndex,theMapActor,myPointActor,&PointsUpdateActor,hilight,update);
-}
-
-void VTKViewer_RenderWindowInteractor::setPointData(const int& theIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor)
-{
- TColStd_IndexedMapOfInteger MapIndex;
- MapIndex.Add(theIndex);
- theActor->MapPoints(theMapActor,MapIndex);
-}
-
-
-//----------------------------------------------------------------------------
-static void EdgesUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor)
-{
- theActor->MapEdge(theMapActor,theMapIndex);
-}
-
-bool VTKViewer_RenderWindowInteractor::highlightEdge(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update)
-{
- return highlight(theMapIndex,theMapActor,myEdgeActor,&EdgesUpdateActor,hilight,update);
-}
-
-void VTKViewer_RenderWindowInteractor::setEdgeData(const int& theCellIndex,
- SALOME_Actor* theMapActor,
- const int& theEdgeIndex,
- VTKViewer_Actor* theActor )
-{
- TColStd_IndexedMapOfInteger MapIndex;
- MapIndex.Add(theCellIndex);
- MapIndex.Add(theEdgeIndex);
- theActor->MapEdge(theMapActor,MapIndex);
-}
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_RenderWindowInteractor.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_RenderWindowInteractor_h
-#define VTKViewer_RenderWindowInteractor_h
-
-//===========================================================
-// now we define the C++ class
-
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_Selection.h"
-
-// QT Includes
-#include <qobject.h>
-#include <qtimer.h>
-
-// VTK Includes
-#include <vtkVersion.h>
-#include <vtkRenderWindowInteractor.h>
-
-// Open CASCADE Includes
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-
-class vtkPicker;
-class vtkCellPicker;
-class vtkPointPicker;
-class vtkActorCollection;
-
-class SALOME_Actor;
-class VTKViewer_Actor;
-class VTKViewer_ViewFrame;
-class VTKViewer_RenderWindow;
-class VTKViewer_InteractorStyleSALOME;
-
-// ------------------------------------------------------------
-// :TRICKY: Fri Apr 21 22:19:27 2000 Pagey
-// The Signal/Slot mechanism used by Qt requires that QObject
-// appear as the first class when using multiple inheritance.
-// Hence the order of the two classes QObject and vtkRenderWindowInteractor
-// matters here. Be careful not to change it by accident.
-// ------------------------------------------------------------
-class VTK_EXPORT VTKViewer_RenderWindowInteractor :
- public QObject, public vtkRenderWindowInteractor
-{
- Q_OBJECT ;
- friend class VTKViewer_ViewFrame;
-public:
-
- static VTKViewer_RenderWindowInteractor *New() ;
-
- vtkTypeMacro(VTKViewer_RenderWindowInteractor,vtkRenderWindowInteractor);
-
- void PrintSelf(ostream& os, vtkIndent indent);
-
- // Description:
- // Initializes the event handlers without an XtAppContext. This is
- // good for when you don`t have a user interface, but you still
- // want to have mouse interaction.
- virtual void Initialize();
-
- virtual void SetInteractorStyle(vtkInteractorObserver *);
- VTKViewer_InteractorStyleSALOME* GetInteractorStyleSALOME(){
- return myInteractorStyle;
- }
-
- // Description:
- // This will start up the X event loop and never return. If you
- // call this method it will loop processing X events until the
- // application is exited.
- virtual void Start();
-
- // Description:
- // Enable/Disable interactions. By default interactors are enabled when
- // initialized. Initialize() must be called prior to enabling/disabling
- // interaction. These methods are used when a window/widget is being
- // shared by multiple renderers and interactors. This allows a "modal"
- // display where one interactor is active when its data is to be displayed
- // and all other interactors associated with the widget are disabled
- // when their data is not displayed.
- virtual void Enable();
- virtual void Disable();
-
- // Description:
- // Event loop notification member for Window size change
- virtual void UpdateSize(int x,int y);
-
- // Description:
- // Timer methods must be overridden by platform dependent subclasses.
- // flag is passed to indicate if this is first timer set or an update
- // as Win32 uses repeating timers, whereas X uses One shot more timer
- // if flag==VTKXI_TIMER_FIRST Win32 and X should createtimer
- // otherwise Win32 should exit and X should perform AddTimeOut()
- virtual int CreateTimer(int ) ;
- virtual int DestroyTimer() ;
-
- // Description:
- // This function is called on 'q','e' keypress if exitmethod is not
- // specified and should be overidden by platform dependent subclasses
- // to provide a termination procedure if one is required.
- virtual void TerminateApp(void) { /* empty */ }
-
- // Description:
- // These methods correspond to the the Exit, User and Pick
- // callbacks. They allow for the Style to invoke them.
- //virtual void ExitCallback();
- //virtual void UserCallback();
- //virtual void StartPickCallback();
- //virtual void EndPickCallback();
-
- /* Selection Management */
- bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update = true );
- bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update = true );
- bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex,
- SALOME_Actor* theMapActor,
- bool hilight,
- bool update = true );
-
- bool highlight(const Handle(SALOME_InteractiveObject)& IObject, bool hiligth, bool immediatly = true );
- void unHighlightSubSelection();
- bool unHighlightAll();
-
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject);
- bool isVisible( const Handle(SALOME_InteractiveObject)& IObject);
- void rename(const Handle(SALOME_InteractiveObject)& IObject, QString newName);
-
- void SetSelectionMode(Selection_Mode mode);
- void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1,
- const double& theBlue = 0, const int& theWidth = 5);
- void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
-
- // Displaymode management
- int GetDisplayMode();
- void SetDisplayMode(int);
-
- // Switch representation wireframe/shading
- void SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, int theMode);
-
- // Change all actors to wireframe or surface
- void ChangeRepresentationToWireframe();
- void ChangeRepresentationToSurface();
-
- // Change to wireframe or surface a list of vtkactor
- void ChangeRepresentationToWireframe(vtkActorCollection* ListofActors);
- void ChangeRepresentationToSurface(vtkActorCollection* ListofActors);
-
- // Erase Display functions
- void EraseAll();
- void DisplayAll();
- void RemoveAll( const bool immediatly );
- void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly=true);
- void Remove(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly=true);
- void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly=true);
-
- void Display( SALOME_Actor* SActor, bool immediatly = true );
- void Erase( SALOME_Actor* SActor, bool immediatly = true );
- void Remove( SALOME_Actor* SActor, bool updateViewer = true );
-
- // Transparency
- void SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,float trans);
- float GetTransparency(const Handle(SALOME_InteractiveObject)& IObject);
-
- // Color
- void SetColor(const Handle(SALOME_InteractiveObject)& IObject,QColor thecolor);
- QColor GetColor(const Handle(SALOME_InteractiveObject)& IObject);
-
- void Update();
-
- vtkRenderer* GetRenderer();
-
- void setGUIWindow(QWidget* theWindow);
-
- void setViewFrame(VTKViewer_ViewFrame* ViewFrame);
-
- void setCellData(const int& theIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor);
- void setEdgeData(const int& theCellIndex,
- SALOME_Actor* theMapActor,
- const int& theEdgeIndex,
- VTKViewer_Actor* theActor ); //NB
- void setPointData(const int& theIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor);
-
- typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor* theActor);
- protected:
-
- VTKViewer_RenderWindowInteractor();
- ~VTKViewer_RenderWindowInteractor();
-
- VTKViewer_InteractorStyleSALOME* myInteractorStyle;
-
- bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor, VTKViewer_Actor* theActor,
- TUpdateActor theFun, bool hilight, bool update);
- void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
- SALOME_Actor* theMapActor,
- VTKViewer_Actor *theActor,
- TUpdateActor theFun);
-
- // Timer used during various mouse events to figure
- // out mouse movements.
- QTimer *mTimer ;
-
- int myDisplayMode;
-
- //NRI: Selection mode
- VTKViewer_Actor* myPointActor;
- VTKViewer_Actor* myEdgeActor;
- VTKViewer_Actor* myCellActor;
- void MoveInternalActors();
-
- vtkPicker* myBasicPicker;
- vtkCellPicker* myCellPicker;
- vtkPointPicker* myPointPicker;
-
- // User for switching to stereo mode.
- int PositionBeforeStereo[2];
-
- // Connect/disconnect all slots which allow events on the
- // render window to be passed to the interactor.
- void ConnectSlots() ;
- void DisconnectSlots() ;
- void ProcessSlotConnections(bool conn) ;
-
- public slots:
- void MouseMove(const QMouseEvent *event) ;
- void LeftButtonPressed(const QMouseEvent *event) ;
- void LeftButtonReleased(const QMouseEvent *event) ;
- void MiddleButtonPressed(const QMouseEvent *event) ;
- void MiddleButtonReleased(const QMouseEvent *event) ;
- void RightButtonPressed(const QMouseEvent *event) ;
- void RightButtonReleased(const QMouseEvent *event) ;
- void ButtonPressed(const QMouseEvent *event) ;
- void ButtonReleased(const QMouseEvent *event) ;
- void KeyPressed(QKeyEvent *event) ;
-
- private slots:
- // Not all of these slots are needed in VTK_MAJOR_VERSION=3,
- // but moc does not understand "#if VTK_MAJOR_VERSION". Hence,
- // we have to include all of these for the time being. Once,
- // this bug in MOC is fixed, we can separate these.
- void TimerFunc() ;
-
- signals:
- void RenderWindowModified() ;
-
- private:
- VTKViewer_ViewFrame* myViewFrame;
- QWidget* myGUIWindow;
- double myTolNodes;
- double myTolItems;
-};
-
-#endif
-
-
+++ /dev/null
-// SALOME VTKViewer :
-//
-// 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 : VTKViewer_Trihedron.cxx
-// Author : Alexey PETROV
-// Module : SALOME
-// $Header:
-
-#include "VTKViewer_Trihedron.h"
-#include "utilities.h"
-#include "SALOME_Actor.h"
-
-// VTK Includes
-#include <vtkMath.h>
-#include <vtkMapper.h>
-#include <vtkDataSet.h>
-#include <vtkRenderer.h>
-#include <vtkFollower.h>
-#include <vtkRenderWindow.h>
-#include <vtkObjectFactory.h>
-
-#include <vtkActor.h>
-#include <vtkProperty.h>
-#include <vtkLineSource.h>
-#include <vtkConeSource.h>
-#include <vtkPolyDataMapper.h>
-
-#include "VTKViewer_VectorText.h"
-
-using namespace std;
-
-//==============================================================================
-
-vtkStandardNewMacro(VTKViewer_UnScaledActor);
-
-VTKViewer_UnScaledActor::VTKViewer_UnScaledActor(){}
-
-void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer){
- if(theRenderer){
- float P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
- theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
- theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
- float aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
- (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
- (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
- int* aSize = theRenderer->GetRenderWindow()->GetSize();
- float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
- vtkDataSet* aDataSet = GetMapper()->GetInput();
- float aLength = aDataSet->GetLength();
- float aPrecision = 1.0E-3;
- float anOldScale = GetScale()[0];
- float aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1]));
- if(fabs(aScale - anOldScale)/aScale > aPrecision){
- SetScale(aScale);
- }
- }
- vtkFollower::Render(theRenderer);
-}
-
-void VTKViewer_UnScaledActor::SetSize(int theSize){
- mySize = theSize;
-}
-
-//==============================================================================
-
-vtkStandardNewMacro(VTKViewer_LineActor);
-
-vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
-vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,VTKViewer_UnScaledActor);
-
-void VTKViewer_LineActor::Render(vtkRenderer *theRenderer){
- if(LabelActor && LabelActor->GetVisibility()){
- LabelActor->Modified();
- LabelActor->Render(theRenderer);
- }
- if(ArrowActor && ArrowActor->GetVisibility()){
- ArrowActor->Modified();
- ArrowActor->Render(theRenderer);
- }
- vtkFollower::Render(theRenderer);
-}
-
-//==============================================================================
-// The base class for concreate Axis
-// Its only duty is to give correct initialization and destruction
-// of its pipe-lines
-
-VTKViewer_Axis::VTKViewer_Axis(){
-
- // Initialize the Line pipe-line representation
- myLineSource = vtkLineSource::New();
- myLineSource->SetPoint1( 0, 0, 0 );
-
- myMapper[0] = vtkPolyDataMapper::New();
- myMapper[0]->SetInput(myLineSource->GetOutput());
-
- myLineActor = VTKViewer_LineActor::New();
- myLineActor->SetMapper(myMapper[0]);
- myLineActor->PickableOff();
-
- // Initialize the Arrow pipe-line representation
- myConeSource = vtkConeSource::New();
- myConeSource->SetResolution(2);
- myConeSource->SetAngle(10);
-
- myMapper[1] = vtkPolyDataMapper::New();
- myMapper[1]->SetInput(myConeSource->GetOutput());
-
- myArrowActor = VTKViewer_UnScaledActor::New();
- myArrowActor->SetMapper(myMapper[1]);
- static int aArrowActorSize = 24;
- myArrowActor->SetSize(aArrowActorSize);
- myArrowActor->PickableOff();
-
- myLineActor->SetArrowActor(myArrowActor);
-
- // Initialize the Label pipe-line representation
- myVectorText = VTKViewer_VectorText::New();
-
- myMapper[2] = vtkPolyDataMapper::New();
- myMapper[2]->SetInput(myVectorText->GetOutput());
-
- myLabelActor = VTKViewer_UnScaledActor::New();
- myLabelActor->SetMapper(myMapper[2]);
- static int aLabelActorSize = 12;
- myLabelActor->SetSize(aLabelActorSize);
- myLabelActor->PickableOff();
- //myLabelActor->DebugOn();
-
- myLineActor->SetLabelActor(myLabelActor);
-
- // Initialise visibility param.
- myVisibility = VTKViewer_Trihedron::eOn;
-}
-
-VTKViewer_Axis::~VTKViewer_Axis(){
- // Destroy of the Label pipe-line representation
- myLabelActor->Delete();
-
- myMapper[2]->RemoveAllInputs();
- myMapper[2]->Delete();
-
- myVectorText->Delete();
-
- // Destroy of the Arrow pipe-line representation
- myArrowActor->Delete();
-
- myMapper[1]->RemoveAllInputs();
- myMapper[1]->Delete();
-
- myConeSource->Delete();
-
- // Destroy of the Arrow pipe-line representation
- myLineActor->Delete();
-
- myMapper[0]->RemoveAllInputs();
- myMapper[0]->Delete();
-
- myLineSource->Delete();
-}
-
-void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis){
- switch(theVis){
- case VTKViewer_Trihedron::eOff:
- case VTKViewer_Trihedron::eOn:
- myLabelActor->SetVisibility(theVis);
- myArrowActor->SetVisibility(theVis);
- myLineActor->SetVisibility(theVis);
- break;
- case VTKViewer_Trihedron::eOnlyLineOn:
- myLabelActor->VisibilityOff();
- myArrowActor->VisibilityOff();
- myLineActor->VisibilityOn();
- break;
- default:
- return;
- }
- myVisibility = theVis;
-}
-
-void VTKViewer_Axis::SetSize(float theSize){
- float aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
- myLineSource->SetPoint2(aPosition);
-
- myArrowActor->SetPosition(0.0,0.0,0.0);
- myArrowActor->AddPosition(aPosition);
- myArrowActor->SetOrientation(myRot);
-
- myLabelActor->SetPosition(0.0,0.0,0.0);
- myLabelActor->AddPosition(aPosition);
-}
-
-void VTKViewer_Axis::AddToRender( vtkRenderer* theRenderer )
-{
- //Order of the calls are important
- theRenderer->AddActor( myLineActor );
- theRenderer->AddActor( myLabelActor );
- theRenderer->AddActor( myArrowActor );
-}
-
-void VTKViewer_Axis::SetCamera( vtkCamera* theCamera )
-{
- myLabelActor->SetCamera(theCamera);
-}
-
-void VTKViewer_Axis::SetProperty( vtkProperty* theProperty )
-{
- myLabelActor->SetProperty(theProperty);
- myArrowActor->SetProperty(theProperty);
- myLineActor->SetProperty(theProperty);
- }
-
-//==============================================================================
-class VTKViewer_XAxis : public VTKViewer_Axis{
-protected:
- VTKViewer_XAxis();
- VTKViewer_XAxis(const VTKViewer_XAxis&);
-public:
- vtkTypeMacro(VTKViewer_XAxis,VTKViewer_Axis);
- static VTKViewer_XAxis *New();
-};
-
-vtkStandardNewMacro(VTKViewer_XAxis);
-
-VTKViewer_XAxis::VTKViewer_XAxis(){
- myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0;
- myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0;
- myVectorText->SetText("X");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(1.0,0.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
-}
-
-//==============================================================================
-class VTKViewer_YAxis : public VTKViewer_Axis{
-protected:
- VTKViewer_YAxis();
- VTKViewer_YAxis(const VTKViewer_YAxis&);
-public:
- vtkTypeMacro(VTKViewer_YAxis,VTKViewer_Axis);
- static VTKViewer_YAxis *New();
-};
-
-vtkStandardNewMacro(VTKViewer_YAxis);
-
-VTKViewer_YAxis::VTKViewer_YAxis(){
- myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0;
- myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.;
- myVectorText->SetText("Y");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,1.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
-}
-
-//==============================================================================
-class VTKViewer_ZAxis : public VTKViewer_Axis{
-protected:
- VTKViewer_ZAxis();
- VTKViewer_ZAxis(const VTKViewer_ZAxis&);
-public:
- vtkTypeMacro(VTKViewer_ZAxis,VTKViewer_Axis);
- static VTKViewer_ZAxis *New();
-};
-
-vtkStandardNewMacro(VTKViewer_ZAxis);
-
-VTKViewer_ZAxis::VTKViewer_ZAxis(){
- myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0;
- myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0;
- myVectorText->SetText("Z");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,0.0,1.0);
- SetProperty(aProperty);
- aProperty->Delete();
-}
-
-//==============================================================================
-
-vtkStandardNewMacro(VTKViewer_Trihedron);
-
-VTKViewer_Trihedron::VTKViewer_Trihedron(){
- myPresent = vtkActorCollection::New();
- myAxis[0] = VTKViewer_XAxis::New();
- myAxis[1] = VTKViewer_YAxis::New();
- myAxis[2] = VTKViewer_ZAxis::New();
- static float aSize = 100;
- SetSize(aSize);
-}
-
-VTKViewer_Trihedron::~VTKViewer_Trihedron(){
- myPresent->RemoveAllItems();
- myPresent->Delete();
- for(int i = 0; i < 3; i++)
- myAxis[i]->Delete();
-}
-
-void VTKViewer_Trihedron::SetSize(float theSize){
- mySize = theSize;
- for(int i = 0; i < 3; i++)
- myAxis[i]->SetSize(theSize);
-}
-
-void VTKViewer_Trihedron::SetVisibility(TVisibility theVis){
- for(int i = 0; i < 3; i++)
- myAxis[i]->SetVisibility(theVis);
-}
-
-VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility(){
- return myAxis[0]->GetVisibility();
-}
-
-void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer){
- vtkCamera* aCamera = theRenderer->GetActiveCamera();
- for(int i = 0; i < 3; i++){
- myAxis[i]->AddToRender(theRenderer);
- myAxis[i]->SetCamera(aCamera);
- }
-}
-
-void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer){
- myPresent->InitTraversal();
- while(vtkActor* anActor = myPresent->GetNextActor())
- theRenderer->RemoveActor(anActor);
-}
-
-int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer){
- //TVisibility aVis = GetVisibility();
- //SetVisibility(eOff);
- vtkActorCollection* aCollection = theRenderer->GetActors();
- aCollection->InitTraversal();
- int aCount = 0;
- while(vtkActor* prop = aCollection->GetNextActor())
- if( prop->GetVisibility())
- if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(prop))
- if(!anActor->IsInfinitive())
- aCount++;
- //int aCount = theRenderer->VisibleActorCount();
- //SetVisibility(aVis);
- return aCount;
-}
+++ /dev/null
-// SALOME VTKViewer :
-//
-// 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 : VTKViewer_Trihedron.h
-// Author : Alexey PETROV
-// Module : SALOME
-// $Header:
-
-#ifndef VTKViewer_Trihedron_H
-#define VTKViewer_Trihedron_H
-
-#include <vtkObject.h>
-#include <vtkFollower.h>
-
-class vtkActorCollection;
-class VTKViewer_Axis;
-class vtkRenderer;
-class vtkPolyDataMapper;
-class vtkLineSource;
-class vtkConeSource;
-class VTKViewer_VectorText;
-class vtkCamera;
-class vtkProperty;
-
-//==============================================================================
-
-class VTKViewer_UnScaledActor: public vtkFollower{
- VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
-
-public:
- vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
- static VTKViewer_UnScaledActor *New();
-
- virtual void SetSize(int theSize);
- virtual void Render(vtkRenderer *theRenderer);
-
-protected:
- VTKViewer_UnScaledActor();
- ~VTKViewer_UnScaledActor(){}
- int mySize;
-};
-
-//==============================================================================
-
-class VTKViewer_LineActor: public vtkFollower{
- VTKViewer_LineActor(const VTKViewer_LineActor&);
-
-public:
- vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
- static VTKViewer_LineActor *New();
-
- void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
- void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
- virtual void Render(vtkRenderer *theRenderer);
-
-protected:
- VTKViewer_LineActor(){
- LabelActor = NULL;
- ArrowActor = NULL;
- }
- ~VTKViewer_LineActor(){
- SetLabelActor(NULL);
- SetArrowActor(NULL);
- }
-
- VTKViewer_UnScaledActor* LabelActor;
- VTKViewer_UnScaledActor* ArrowActor;
-};
-
-//================================================
-
-class VTKViewer_Trihedron : public vtkObject{
- protected:
- VTKViewer_Trihedron();
- VTKViewer_Trihedron(const VTKViewer_Trihedron&);
- virtual ~VTKViewer_Trihedron();
- public:
- vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
- static VTKViewer_Trihedron *New();
-
- virtual void SetSize(float theSize);
- virtual float GetSize() { return mySize;}
-
- enum TVisibility{eOff, eOn, eOnlyLineOn};
- virtual void SetVisibility(TVisibility theVis);
- virtual void VisibilityOff() { SetVisibility(eOff);}
- virtual void VisibilityOn() { SetVisibility(eOn);}
- virtual TVisibility GetVisibility();
-
- virtual void AddToRender(vtkRenderer* theRenderer);
- virtual void RemoveFromRender(vtkRenderer* theRenderer);
-
- virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
-
-protected:
- vtkActorCollection* myPresent;
- VTKViewer_Axis* myAxis[3];
- float mySize;
-};
-
-//==============================================================================
-// The base class for concreate Axis
-// Its only duty is to give correct initialization and destruction
-// of its pipe-lines
-class VTKViewer_Axis : public vtkObject{
-protected:
- VTKViewer_Axis();
- VTKViewer_Axis(const VTKViewer_Axis&);
- virtual ~VTKViewer_Axis();
- public:
- vtkTypeMacro(VTKViewer_Axis,vtkObject);
-
- virtual void AddToRender(vtkRenderer* theRenderer);
-
- virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
- virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
-
- virtual void SetCamera(vtkCamera* theCamera);
- virtual void SetProperty(vtkProperty* theProperty);
- virtual void SetSize(float theSize);
-
- virtual VTKViewer_UnScaledActor* GetLabel(){ return myLabelActor; }
- virtual VTKViewer_UnScaledActor* GetArrow(){ return myArrowActor; }
-
-protected:
- VTKViewer_Trihedron::TVisibility myVisibility;
- float myDir[3], myRot[3];
-
- VTKViewer_LineActor *myLineActor;
- //vtkActor *myLineActor;
- VTKViewer_UnScaledActor *myArrowActor;
- VTKViewer_UnScaledActor *myLabelActor;
-
- vtkPolyDataMapper *myMapper[3];
- vtkLineSource *myLineSource;
- vtkConeSource *myConeSource;
- VTKViewer_VectorText* myVectorText;
-};
-
-#endif
+++ /dev/null
-// SALOME VTKViewer :
-//
-// 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 : VTKViewer_Utilities.cxx
-// Author : Alexey PETROV
-// Module : SALOME
-// $Header:
-
-#include "VTKViewer_Utilities.h"
-#include "utilities.h"
-#include "SALOME_Actor.h"
-
-// VTK Includes
-#include <vtkMath.h>
-#include <vtkCamera.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-
-using namespace std;
-
-//see vtkRenderer::ResetCamera(float bounds[6]) method
-void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint){
- if(!theRenderer) return;
- float bounds[6];
- int aCount = ComputeVisiblePropBounds(theRenderer,bounds);
- if(theUsingZeroFocalPoint || aCount){
- float aLength = bounds[1]-bounds[0];
- aLength = max((bounds[3]-bounds[2]),aLength);
- aLength = max((bounds[5]-bounds[4]),aLength);
-
- double vn[3];
- if ( theRenderer->GetActiveCamera() != NULL )
- theRenderer->GetActiveCamera()->GetViewPlaneNormal(vn);
- else{
- MESSAGE("Trying to reset non-existant camera");
- return;
- }
-
- float center[3] = {0.0, 0.0, 0.0};
- if(!theUsingZeroFocalPoint){
- center[0] = (bounds[0] + bounds[1])/2.0;
- center[1] = (bounds[2] + bounds[3])/2.0;
- center[2] = (bounds[4] + bounds[5])/2.0;
- }
- theRenderer->GetActiveCamera()->SetFocalPoint(center[0],center[1],center[2]);
-
- float width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
- (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
- (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
-
- double ang = theRenderer->GetActiveCamera()->GetViewAngle();
- float distance = 2.0*width/tan(ang*vtkMath::Pi()/360.0);
-
- // check view-up vector against view plane normal
- double *vup = theRenderer->GetActiveCamera()->GetViewUp();
- if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 ){
- MESSAGE("Resetting view-up since view plane normal is parallel");
- theRenderer->GetActiveCamera()->SetViewUp(-vup[2], vup[0], vup[1]);
- }
-
- // update the camera
- theRenderer->GetActiveCamera()->SetPosition(center[0]+distance*vn[0],
- center[1]+distance*vn[1],
- center[2]+distance*vn[2]);
- // find size of the window
- int* winsize = theRenderer->GetSize();
- if(winsize[0] < winsize[1]) width *= float(winsize[1])/float(winsize[0]);
-
- if(theUsingZeroFocalPoint) width *= sqrt(2.0);
-
- theRenderer->GetActiveCamera()->SetParallelScale(width/2.0);
- }
- //workaround on VTK
- //theRenderer->ResetCameraClippingRange(bounds);
- ResetCameraClippingRange(theRenderer);
-}
-
-
-// Compute the bounds of the visible props
-int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]){
- vtkProp *prop;
- float *bounds;
- int aCount=0;
-
- theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT;
- theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT;
-
- // loop through all props
- vtkActorCollection* aCollection = theRenderer->GetActors();
- aCollection->InitTraversal();
- while (vtkActor* prop = aCollection->GetNextActor()) {
- // if it's invisible, or has no geometry, we can skip the rest
- if ( prop->GetVisibility() )
- {
- if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(prop))
- if(anActor->IsInfinitive()) continue;
- bounds = prop->GetBounds();
- // make sure we haven't got bogus bounds
- if ( bounds != NULL &&
- bounds[0] > -VTK_LARGE_FLOAT && bounds[1] < VTK_LARGE_FLOAT &&
- bounds[2] > -VTK_LARGE_FLOAT && bounds[3] < VTK_LARGE_FLOAT &&
- bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT )
- {
- aCount++;
-
- if (bounds[0] < theBounds[0])
- {
- theBounds[0] = bounds[0];
- }
- if (bounds[1] > theBounds[1])
- {
- theBounds[1] = bounds[1];
- }
- if (bounds[2] < theBounds[2])
- {
- theBounds[2] = bounds[2];
- }
- if (bounds[3] > theBounds[3])
- {
- theBounds[3] = bounds[3];
- }
- if (bounds[4] < theBounds[4])
- {
- theBounds[4] = bounds[4];
- }
- if (bounds[5] > theBounds[5])
- {
- theBounds[5] = bounds[5];
- }
- }//not bogus
- }
- }
- return aCount;
-}
-
-
-//see vtkRenderer::ResetCameraClippingRange(float bounds[6]) method
-void ResetCameraClippingRange(vtkRenderer* theRenderer){
- if(!theRenderer || !theRenderer->VisibleActorCount()) return;
-
- vtkCamera* anActiveCamera = theRenderer->GetActiveCamera();
- if( anActiveCamera == NULL ){
- MESSAGE("Trying to reset clipping range of non-existant camera");
- return;
- }
-
- // Find the plane equation for the camera view plane
- double vn[3];
- anActiveCamera->GetViewPlaneNormal(vn);
- double position[3];
- anActiveCamera->GetPosition(position);
-
- float bounds[6];
- theRenderer->ComputeVisiblePropBounds(bounds);
-
- double center[3];
- center[0] = (bounds[0] + bounds[1])/2.0;
- center[1] = (bounds[2] + bounds[3])/2.0;
- center[2] = (bounds[4] + bounds[5])/2.0;
-
- double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
- (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
- (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
-
- double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
- (position[1]-center[1])*(position[1]-center[1]) +
- (position[2]-center[2])*(position[2]-center[2]));
-
- float range[2] = {distance - width/2.0, distance + width/2.0};
-
- // Do not let the range behind the camera throw off the calculation.
- if (range[0] < 0.0) range[0] = 0.0;
-
- anActiveCamera->SetClippingRange( range );
-}
+++ /dev/null
-// SALOME VTKViewer :
-//
-// 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 : VTKViewer_Utilities.h
-// Author : Alexey PETROV
-// Module : SALOME
-// $Header:
-
-#ifndef VTKViewer_Utilities_H
-#define VTKViewer_Utilities_H
-
-class vtkRenderer;
-
-extern void ResetCamera(vtkRenderer* theRenderer, int theUsingZeroFocalPoint = false);
-extern int ComputeVisiblePropBounds(vtkRenderer* theRenderer, float theBounds[6]);
-extern void ResetCameraClippingRange(vtkRenderer* theRenderer);
-extern float EPS_BNDBOX;
-
-#endif
+++ /dev/null
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-// VTKViewer_VectorText.cxx is a copy of vtkVectorText.cxx file.
-// Purpose of copying: to remove linking to libHybrid.so VTK library
-
-#include "VTKViewer_VectorText.h"
-
-#include "vtkCellArray.h"
-#include "vtkObjectFactory.h"
-#include "vtkPoints.h"
-#include "vtkPolyData.h"
-using namespace std;
-
-vtkCxxRevisionMacro(VTKViewer_VectorText, "$Revision$");
-vtkStandardNewMacro(VTKViewer_VectorText);
-
-char *VTK_VECTOR_TEXT_33 = (char *) "11 0.438482 "
-"0.28000 -0.07186 0.43164 -0.07143 0.27689 0.07714 0.43472 0.07714 0.32000 0.20134 "
-"0.40000 0.20243 0.31429 0.20550 0.27277 0.76857 0.43848 0.76857 0.27693 1.02571 "
-"0.43429 1.02615 7 2 1 3 2 0 1 7 6 5 6 4 5 8 "
-"7 5 7 8 9 10 9 8 "
-;
-
-char *VTK_VECTOR_TEXT_34 = (char *) "21 0.615625 "
-"0.25714 0.63563 0.32571 0.63563 0.50286 0.63642 0.25143 0.63946 0.33143 0.63840 "
-"0.33462 0.64286 0.49673 0.64286 0.57714 0.63757 0.58093 0.64286 0.21335 0.84286 "
-"0.36680 0.84286 0.46177 0.84286 0.61522 0.84286 0.21295 1.02000 0.46134 1.02000 "
-"0.61563 1.02000 0.36571 1.02307 0.46550 1.02571 0.21714 1.02615 0.36000 1.02723 "
-"0.61143 1.02615 17 3 5 9 7 6 2 4 5 1 6 8 12 0 1 5 6 "
-"12 11 3 0 5 7 8 6 11 12 14 13 9 10 10 9 5 15 14 12 19 "
-"18 10 18 13 10 17 14 20 14 15 20 16 19 10 "
-;
-
-char *VTK_VECTOR_TEXT_35 = (char *) "43 0.974539 "
-"0.22286 -0.09100 0.32571 -0.09236 0.56832 -0.08857 0.67429 -0.09201 0.28193 0.22000 "
-"0.39470 0.22000 0.63009 0.22000 0.15385 0.23143 0.27429 0.22723 0.40571 0.22723 "
-"0.62286 0.22723 0.74857 0.22680 0.97454 0.23143 0.15385 0.33429 0.97454 0.33429 "
-"0.30344 0.34000 0.65201 0.34000 0.77084 0.34000 0.42286 0.34010 0.42034 0.34571 "
-"0.36041 0.60286 0.70748 0.60286 0.82034 0.60286 0.47429 0.60626 0.15385 0.61429 "
-"0.35429 0.61009 0.70286 0.60951 0.82857 0.61009 0.97454 0.61429 0.15385 0.71714 "
-"0.37714 0.72134 0.50286 0.72191 0.72571 0.72134 0.85143 0.72156 0.97143 0.72025 "
-"0.38605 0.72857 0.49823 0.72857 0.73335 0.72857 0.84613 0.72857 0.45143 1.04160 "
-"0.55735 1.04286 0.80000 1.04243 0.90521 1.04286 43 6 2 3 5 0 1 0 5 4 18 "
-"9 10 11 6 3 4 9 8 13 8 15 17 6 11 9 4 5 13 7 8 17 "
-"12 14 8 9 15 15 19 20 16 6 17 12 17 11 18 10 16 10 6 16 21 "
-"16 17 18 19 9 15 9 19 20 30 25 23 20 19 34 33 28 29 24 25 29 "
-"25 30 27 21 22 33 21 27 20 23 30 22 21 17 33 27 28 31 26 32 35 "
-"30 23 32 38 37 31 35 23 21 32 26 26 31 23 32 21 38 41 37 38 36 "
-"35 31 38 21 33 40 39 36 42 41 38 39 35 36 "
-;
-
-char *VTK_VECTOR_TEXT_36 = (char *) "73 0.921518 "
-"0.52571 -0.22882 0.59429 -0.22991 0.52000 -0.09942 0.60571 -0.09385 0.40571 -0.07057 "
-"0.72730 -0.06571 0.33143 -0.03465 0.80571 -0.01813 0.51429 0.01891 0.52152 0.02571 "
-"0.60571 0.02014 0.84571 0.02168 0.25669 0.04286 0.66857 0.03800 0.44571 0.04535 "
-"0.70984 0.06571 0.74535 0.10571 0.74857 0.11079 0.74902 0.11143 0.37057 0.12857 "
-"0.90538 0.12857 0.20823 0.15143 0.35748 0.16286 0.77395 0.16857 0.35429 0.17310 "
-"0.35177 0.18000 0.78134 0.21429 0.92152 0.21429 0.19580 0.22571 0.33480 0.25429 "
-"0.77395 0.29429 0.91177 0.32286 0.76000 0.32921 0.72571 0.36972 0.89355 0.37429 "
-"0.64690 0.40857 0.65143 0.40706 0.64000 0.41109 0.60571 0.41986 0.52109 0.43714 "
-"0.85714 0.43270 0.38857 0.49216 0.79429 0.48902 0.72571 0.52437 0.30454 0.54571 "
-"0.60260 0.56286 0.52043 0.58571 0.26286 0.59570 0.46857 0.59800 0.39429 0.65095 "
-"0.22857 0.67295 0.36823 0.70000 0.75429 0.77624 0.21907 0.78571 0.35891 0.78571 "
-"0.89184 0.79714 0.37714 0.85001 0.72571 0.86144 0.87470 0.86571 0.24571 0.89016 "
-"0.68571 0.90956 0.44000 0.92036 0.60571 0.94469 0.83179 0.94571 0.28000 0.94629 "
-"0.51429 0.94891 0.34286 1.00607 0.75429 1.01579 0.38286 1.02784 0.52043 1.06571 "
-"0.60260 1.06571 0.52260 1.12286 0.60043 1.12286 75 3 8 2 2 8 4 19 12 6 13 11 15 9 8 10 3 2 1 8 "
-"3 10 5 13 10 15 11 16 7 13 5 4 14 6 2 0 1 5 10 3 12 "
-"22 21 14 4 8 13 7 11 11 18 16 20 23 18 18 17 16 20 18 11 19 "
-"6 14 28 21 29 26 23 20 12 19 22 25 22 24 21 22 25 21 25 29 26 "
-"27 30 27 26 20 31 32 30 31 30 27 40 33 32 37 43 38 34 32 31 38 "
-"39 9 40 32 34 38 9 10 43 33 42 37 36 43 39 38 43 42 33 40 35 "
-"36 37 33 43 36 39 45 46 48 41 39 45 39 43 41 48 44 47 51 50 46 "
-"62 65 48 39 46 44 49 47 49 44 48 54 53 50 51 47 49 53 56 59 53 "
-"54 56 66 64 56 55 58 52 58 57 52 54 50 51 59 56 64 67 60 63 60 "
-"57 63 66 61 68 61 66 56 68 65 69 65 62 69 62 46 45 63 57 58 62 "
-"60 67 68 61 65 71 70 72 70 62 67 62 70 69 71 69 70 "
-;
-
-char *VTK_VECTOR_TEXT_37 = (char *) "81 1.409911 "
-"0.46713 -0.11143 0.57143 -0.11215 1.19429 -0.11252 1.10286 -0.10252 1.26444 -0.09429 "
-"1.05143 -0.07759 1.31429 -0.06384 1.14857 -0.01538 1.18857 -0.01807 0.98857 -0.01364 "
-"1.22286 -0.00771 1.36784 -0.00286 1.11302 0.00286 1.26436 0.03143 1.07787 0.04857 "
-"0.95748 0.05429 1.39681 0.06571 1.28680 0.09429 1.05866 0.14000 1.40991 0.14571 "
-"0.94134 0.15143 0.94134 0.21429 1.29295 0.21429 1.06134 0.23714 1.40723 0.23714 "
-"0.95748 0.30000 1.39387 0.30000 1.07787 0.30571 1.27429 0.30371 1.09561 0.33429 "
-"1.23429 0.35465 1.36616 0.36286 1.13143 0.36327 1.16571 0.37277 1.20571 0.36899 "
-"1.00045 0.38571 1.32000 0.41543 1.06857 0.44498 1.24571 0.45681 0.48000 0.46420 "
-"1.15429 0.46723 0.38857 0.47462 0.55016 0.48286 0.60000 0.51330 0.30286 0.52704 "
-"0.43429 0.56177 0.47429 0.55907 0.26857 0.57284 0.50857 0.56943 0.65355 0.57429 "
-"0.39873 0.58000 0.55007 0.60857 0.24530 0.62571 0.36359 0.62571 0.68252 0.64286 "
-"0.56680 0.64857 0.23050 0.69429 0.34437 0.71714 0.57866 0.72286 0.69563 0.72286 "
-"0.22705 0.79143 0.34705 0.81429 0.69295 0.81429 0.56891 0.85429 0.67959 0.87714 "
-"0.24530 0.88286 0.36359 0.88286 0.38132 0.91143 0.54286 0.90975 0.52000 0.93179 "
-"0.65465 0.93429 0.41714 0.94041 0.47429 0.94950 0.29143 0.96914 0.60571 0.99258 "
-"0.32000 0.99868 0.38286 1.03395 0.53714 1.03184 1.06857 1.04249 1.17287 1.04286 "
-"0.48000 1.04395 79 0 1 78 10 4 6 2 8 3 9 14 15 4 "
-"10 8 3 7 5 7 3 8 10 6 13 12 5 7 5 12 9 4 8 2 13 "
-"16 17 17 19 22 14 9 12 15 18 20 11 13 6 13 11 16 17 16 19 18 "
-"15 14 21 20 18 21 23 25 22 26 28 23 21 18 24 22 19 25 27 35 35 "
-"29 37 22 24 26 28 31 30 27 25 23 31 28 26 27 29 35 36 30 31 38 "
-"34 30 38 33 34 37 32 40 32 33 40 38 30 36 32 37 29 40 33 38 42 "
-"46 39 47 53 52 48 43 51 39 46 41 41 50 44 56 57 60 45 41 46 42 "
-"48 46 48 42 43 50 41 45 53 47 44 51 49 55 54 55 49 53 44 50 49 "
-"51 43 55 54 58 59 58 54 57 56 52 57 52 53 60 61 65 58 62 63 57 "
-"61 60 62 64 63 65 66 73 66 65 61 73 66 75 58 59 62 63 64 68 70 "
-"69 68 67 75 66 70 68 64 76 71 72 75 67 76 74 69 70 71 76 67 69 "
-"77 72 72 77 80 77 69 74 76 72 80 79 78 1 "
-;
-
-char *VTK_VECTOR_TEXT_38 = (char *) "76 1.126291 "
-"0.58857 -0.08966 1.03429 -0.09235 0.48000 -0.08395 0.66286 -0.07673 0.40000 -0.05914 "
-"0.72000 -0.05641 0.98286 -0.05473 0.35429 -0.03393 0.78857 -0.01678 1.12629 0.00857 "
-"0.29143 0.02168 0.52571 0.02991 0.57714 0.02764 0.62286 0.03756 0.46857 0.04645 "
-"0.87429 0.05495 0.69714 0.07393 0.42132 0.08286 1.04571 0.07868 0.24486 0.08857 "
-"0.75011 0.11714 0.22327 0.14000 0.37927 0.14571 0.78349 0.16286 0.96893 0.16286 "
-"0.96571 0.16717 0.96457 0.16857 0.95937 0.18000 0.35580 0.22571 0.20991 0.25429 "
-"0.36319 0.28857 0.86286 0.29600 1.02437 0.31143 0.22645 0.32857 0.40418 0.36286 "
-"0.40571 0.36454 0.41330 0.37429 1.05421 0.40857 0.28418 0.42571 0.92000 0.44119 "
-"0.53714 0.46770 0.37143 0.50250 0.66758 0.54000 0.46406 0.55714 0.78704 0.62571 "
-"0.59429 0.63146 0.37714 0.68444 0.69296 0.70000 0.85355 0.71714 0.35681 0.73429 "
-"0.50200 0.75143 0.49756 0.76286 0.49502 0.76857 0.72891 0.76857 0.86966 0.76857 "
-"0.34748 0.82000 0.73295 0.82000 0.48764 0.82571 0.87236 0.83143 0.49714 0.86089 "
-"0.35849 0.87143 0.71429 0.87650 0.52000 0.89555 0.69714 0.89846 0.37964 0.91714 "
-"0.84657 0.91714 0.55429 0.92073 0.65714 0.92498 0.60000 0.93277 0.81868 0.95714 "
-"0.42857 0.97582 0.76571 1.00436 0.51429 1.02723 0.72000 1.02723 0.59429 1.04437 "
-"0.64571 1.04395 78 7 17 10 3 13 0 "
-"2 14 4 6 18 15 17 7 4 9 18 "
-"6 9 6 1 8 16 5 0 12 2 "
-"17 4 14 2 11 14 12 0 13 13 5 "
-"16 15 24 20 16 8 20 13 3 5 "
-"2 12 11 10 17 19 21 28 29 15 20 "
-"8 20 24 23 40 23 31 24 25 26 "
-"19 22 21 31 23 27 22 19 17 18 24 "
-"15 28 21 22 29 30 33 31 32 39 "
-"23 24 26 30 29 28 23 26 27 33 30 "
-"38 32 31 27 38 36 41 38 34 36 "
-"34 38 30 36 34 35 39 32 37 42 40 "
-"31 40 41 36 42 44 47 45 43 40 "
-"40 43 41 50 46 43 50 49 46 45 40 "
-"42 48 53 47 45 42 47 49 52 55 "
-"53 48 56 50 43 45 57 60 55 52 50 "
-"51 49 50 52 48 47 44 54 56 48 "
-"56 65 61 60 59 64 59 60 57 65 56 "
-"58 52 57 55 64 59 70 58 56 54 "
-"59 62 70 68 74 72 65 69 61 70 66 "
-"72 63 71 67 63 61 69 70 62 66 "
-"67 73 68 71 63 69 73 67 71 68 72 "
-"66 74 68 75 75 68 73 "
-;
-
-char *VTK_VECTOR_TEXT_39 = (char *) "10 0.364197 "
-"0.25143 0.63563 0.24571 0.63946 0.32571 0.63757 0.32950 0.64286 0.21034 0.83714 "
-"0.36379 0.83714 0.20991 1.02000 0.36420 1.02000 0.21408 1.02571 0.36000 1.02615 8 1 0 3 "
-"2 3 0 1 3 4 7 6 4 5 4 "
-"3 7 4 5 8 6 9 6 7 9 "
-;
-
-char *VTK_VECTOR_TEXT_40 = (char *) "19 0.595731 "
-"0.50857 -0.39522 0.59429 -0.39447 0.44000 -0.30784 0.51787 -0.24857 0.32530 -0.09429 "
-"0.43748 -0.05429 0.26899 0.06571 0.38134 0.20286 0.23580 0.27714 0.37605 0.38000 "
-"0.23848 0.41429 0.39320 0.53429 0.27177 0.59714 0.43748 0.71143 0.47216 0.80286 "
-"0.36086 0.82000 0.45714 0.97936 0.59573 1.04286 0.50857 1.04395 17 2 3 4 0 3 2 3 "
-"0 1 6 4 5 3 5 4 6 7 8 7 6 5 9 10 8 9 8 7 10 "
-"11 12 10 9 11 12 13 15 12 11 13 14 15 13 16 15 14 17 18 16 17 "
-"16 14 "
-;
-
-char *VTK_VECTOR_TEXT_41 = (char *) "19 0.598482 "
-"0.24000 -0.39447 0.33143 -0.39258 0.40616 -0.28857 0.31641 -0.24857 0.48784 -0.14000 "
-"0.39681 -0.05429 0.55538 0.03143 0.45295 0.20286 0.59580 0.23714 0.59848 0.37429 "
-"0.45823 0.38000 0.44723 0.49429 0.56252 0.59714 0.41714 0.64134 0.47343 0.82000 "
-"0.34857 0.83301 0.37714 0.97936 0.23855 1.04286 0.32571 1.04395 17 0 1 3 2 3 1 3 "
-"4 5 3 2 4 5 6 7 6 5 4 7 8 10 8 9 10 11 10 9 8 "
-"7 6 11 12 13 13 14 15 12 11 9 14 13 12 15 16 17 16 15 14 16 "
-"18 17 "
-;
-
-char *VTK_VECTOR_TEXT_42 = (char *) "34 0.685300 "
-"0.33143 0.58250 0.33714 0.58223 0.53714 0.58250 0.54286 0.58194 0.36213 0.61429 "
-"0.25587 0.63714 0.25266 0.64286 0.62655 0.64286 0.25393 0.64857 0.43429 0.73293 "
-"0.44000 0.73049 0.36715 0.78000 0.50714 0.78000 0.35429 0.78613 0.63429 0.80816 "
-"0.19309 0.82571 0.68389 0.82571 0.19177 0.83143 0.68530 0.83143 0.38857 0.86213 "
-"0.39523 0.86571 0.48000 0.86242 0.47660 0.86571 0.34657 0.88286 0.58857 0.90823 "
-"0.22286 0.92522 0.22857 0.92848 0.64571 0.92816 0.65143 0.92675 0.49295 1.02000 "
-"0.38134 1.03714 0.38550 1.04286 0.49143 1.04021 0.48571 1.04437 32 2 12 10 8 4 11 "
-"8 5 4 8 6 5 4 0 1 2 3 "
-"12 0 4 5 12 9 10 9 11 4 "
-"19 11 21 14 24 12 26 25 17 16 18 "
-"14 13 23 15 19 21 20 11 19 13 "
-"33 31 30 24 21 12 12 21 9 21 11 "
-"9 26 17 23 12 3 7 27 24 18 "
-"13 19 23 23 17 15 20 21 22 18 24 "
-"14 28 27 18 33 30 20 29 20 22 "
-"29 33 20 32 33 29 "
-;
-
-char *VTK_VECTOR_TEXT_43 = (char *) "20 0.952768 "
-"0.52836 0.10571 0.64878 0.10571 0.52420 0.11143 0.65295 0.11143 0.52420 0.39714 "
-"0.65295 0.39714 0.22857 0.40546 0.52000 0.40329 0.66286 0.40437 0.95168 0.40857 "
-"0.22437 0.52286 0.95277 0.52286 0.22857 0.52900 0.52311 0.53429 0.65403 0.53429 "
-"0.94857 0.52900 0.52528 0.82571 0.65186 0.82571 0.53143 0.82991 0.64571 0.82991 18 1 2 0 1 3 2 "
-"4 2 3 5 4 3 12 6 7 14 4 "
-"8 9 15 8 8 4 5 9 11 15 "
-"12 7 13 6 12 10 7 4 13 14 8 "
-"15 17 19 18 14 13 4 17 18 16 "
-"17 16 13 17 13 14 "
-;
-
-char *VTK_VECTOR_TEXT_44 = (char *) "23 0.432768 "
-"0.30286 -0.28607 0.30857 -0.28726 0.33714 -0.27355 0.36571 -0.25275 0.27329 -0.23714 "
-"0.38670 -0.23143 0.30286 -0.21582 0.39914 -0.21429 0.32115 -0.19714 0.41355 -0.18571 "
-"0.33800 -0.16857 0.42327 -0.15714 0.34605 -0.14571 0.43277 -0.10000 0.35580 -0.08286 "
-"0.35472 -0.07714 0.28571 -0.07295 0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 "
-"0.43168 0.07714 0.28571 0.08134 0.42857 0.08025 21 0 6 4 0 "
-"1 2 0 2 6 3 6 2 8 5 10 5 7 10 6 5 8 5 6 3 10 "
-"7 12 9 12 7 12 13 14 11 12 9 12 11 13 18 17 19 17 21 19 15 "
-"14 13 15 13 17 21 17 22 17 20 22 18 16 17 20 17 13 "
-;
-
-char *VTK_VECTOR_TEXT_45 = (char *) "8 0.606146 "
-"0.19118 0.26000 0.19429 0.25689 0.60000 0.25580 0.60615 0.26000 0.19118 0.38571 "
-"0.60615 0.38571 0.19429 0.38882 0.60000 0.38991 6 6 1 2 6 0 "
-"1 6 2 7 6 4 0 7 2 3 "
-"5 7 3 "
-;
-
-char *VTK_VECTOR_TEXT_46 = (char *) "13 0.432768 "
-"0.28571 -0.07295 0.42286 -0.07295 0.42857 -0.07186 0.27848 -0.06571 0.28000 -0.06878 "
-"0.43277 -0.06571 0.27848 0.07143 0.43277 0.07143 0.27957 0.07714 0.43168 0.07714 "
-"0.28571 0.08134 0.42286 0.08134 0.42857 0.08025 11 0 "
-"3 4 3 0 1 8 6 10 5 1 2 3 1 5 6 3 5 6 7 11 6 "
-"5 7 10 6 11 9 12 11 9 11 7 "
-;
-
-char *VTK_VECTOR_TEXT_47 = (char *) "5 0.562348 "
-"0.14389 -0.08857 0.14857 -0.09256 0.25004 -0.08857 0.56235 1.04286 0.46286 1.04358 3 2 0 1 4 0 2 3 "
-"4 2 "
-;
-
-char *VTK_VECTOR_TEXT_48 = (char *) "53 0.926804 "
-"0.53714 -0.09009 0.59429 -0.09009 0.66857 -0.07673 0.43429 -0.06723 0.73143 -0.05070 "
-"0.34286 -0.00972 0.80571 0.01025 0.54857 0.02152 0.61714 0.02891 0.30241 0.03714 "
-"0.65714 0.04645 0.46857 0.05007 0.42473 0.08857 0.70286 0.08454 0.26645 0.10000 "
-"0.86943 0.11143 0.39955 0.12286 0.73800 0.13429 0.23748 0.18000 0.37034 0.19714 "
-"0.76252 0.20286 0.91236 0.26000 0.21866 0.26571 0.35621 0.26571 0.77823 0.28857 "
-"0.34437 0.40286 0.92680 0.40286 0.20420 0.40857 0.78705 0.54000 0.20723 0.58000 "
-"0.92420 0.58571 0.35277 0.64286 0.22177 0.69429 0.76571 0.72437 0.89966 0.74000 "
-"0.37756 0.76286 0.74498 0.79143 0.26073 0.82571 0.85927 0.84857 0.42473 0.85429 "
-"0.70439 0.85429 0.46286 0.88902 0.66286 0.89007 0.30241 0.90000 0.51009 0.91143 "
-"0.58286 0.91823 0.80725 0.92857 0.77714 0.95829 0.38350 0.98000 0.71429 0.99927 "
-"0.46286 1.01681 0.65714 1.01959 0.53714 1.02991 53 2 8 1 0 7 3 5 16 9 2 10 8 0 "
-"1 8 7 0 8 12 16 5 11 3 7 3 12 5 15 20 17 11 12 3 13 "
-"6 17 6 13 4 9 16 14 10 4 13 14 19 18 4 10 2 15 17 6 19 "
-"14 16 21 24 20 23 18 19 22 25 27 24 26 28 23 22 18 21 20 15 26 "
-"24 21 22 23 25 29 27 25 29 31 32 28 30 33 31 29 25 30 28 26 32 "
-"35 37 46 40 36 30 34 33 32 31 35 43 39 48 43 37 35 38 36 33 38 "
-"33 34 42 40 49 48 41 50 39 43 35 47 40 46 46 36 38 41 44 50 45 "
-"52 44 42 51 45 41 48 39 49 40 47 50 44 52 52 45 51 42 49 51 "
-;
-
-char *VTK_VECTOR_TEXT_49 = (char *) "11 0.708571 "
-"0.58286 -0.07186 0.70857 -0.07186 0.30857 0.62908 0.31429 0.62657 0.38286 0.65641 "
-"0.30785 0.75143 0.57714 0.77731 0.47429 0.85616 0.56384 0.94000 0.62857 1.02915 "
-"0.70857 1.02882 9 6 0 1 2 4 5 7 5 4 2 3 4 6 "
-"8 7 6 7 4 10 8 6 10 6 1 10 9 8 "
-;
-
-char *VTK_VECTOR_TEXT_50 = (char *) "43 0.914286 "
-"0.18857 -0.06878 0.91429 -0.06878 0.18748 -0.04286 0.19849 0.00857 0.91429 0.05164 "
-"0.38142 0.06000 0.22943 0.07714 0.46286 0.15868 0.30286 0.17832 0.38286 0.25813 "
-"0.58413 0.43143 0.78286 0.44454 0.67543 0.52286 0.85355 0.53429 0.72045 0.58000 "
-"0.89756 0.62571 0.75470 0.64286 0.35168 0.70000 0.91236 0.70000 0.77295 0.71143 "
-"0.21403 0.71714 0.77295 0.74571 0.22605 0.79143 0.37143 0.79804 0.90244 0.80857 "
-"0.75429 0.81228 0.38902 0.83143 0.24359 0.84286 0.73143 0.84689 0.42454 0.87143 "
-"0.86607 0.88857 0.68000 0.89070 0.28000 0.90629 0.49143 0.90823 0.58857 0.91866 "
-"0.82857 0.93555 0.31597 0.94571 0.37714 0.98784 0.76000 0.98657 0.44571 1.01470 "
-"0.69143 1.01470 0.53714 1.02991 0.62857 1.02723 41 3 2 0 3 5 6 1 5 0 5 "
-"3 0 1 4 5 6 5 8 7 8 5 9 8 7 9 7 10 11 10 7 10 "
-"11 12 12 11 14 16 15 18 16 18 19 13 14 11 14 13 16 21 24 25 15 "
-"16 13 21 19 18 23 27 22 17 23 22 24 21 18 27 23 32 17 22 20 31 "
-"42 34 30 28 25 26 32 23 40 31 38 35 28 30 36 32 26 29 36 26 34 "
-"41 33 33 37 29 36 29 37 33 39 37 30 25 24 28 38 31 38 28 35 39 "
-"33 41 31 40 42 41 34 42 "
-;
-
-char *VTK_VECTOR_TEXT_51 = (char *) "68 0.927232 "
-"0.52571 -0.09009 0.63429 -0.08395 0.45143 -0.07756 0.37143 -0.04498 0.74286 -0.04771 "
-"0.30857 0.00132 0.81714 0.00439 0.54286 0.02152 0.60000 0.02420 0.64661 0.03714 "
-"0.27429 0.03952 0.46857 0.04073 0.42857 0.06759 0.70857 0.07561 0.88213 0.08286 "
-"0.23429 0.10772 0.38812 0.11714 0.74535 0.11714 0.91109 0.14571 0.77823 0.19143 "
-"0.20764 0.20857 0.92723 0.22571 0.34286 0.23215 0.78437 0.27143 0.92723 0.27714 "
-"0.75429 0.36430 0.89927 0.38571 0.72571 0.40132 0.86857 0.43270 0.67429 0.43927 "
-"0.48000 0.45284 0.48571 0.44966 0.54857 0.46152 0.60000 0.46109 0.83429 0.46686 "
-"0.72693 0.52286 0.49034 0.55714 0.49714 0.56395 0.78857 0.56473 0.58286 0.57109 "
-"0.82857 0.60921 0.67429 0.61616 0.70400 0.64857 0.85294 0.65429 0.72680 0.70571 "
-"0.87009 0.72286 0.35429 0.72298 0.22175 0.74571 0.72991 0.76286 0.72151 0.80286 "
-"0.86244 0.80857 0.38857 0.82064 0.69143 0.85832 0.84571 0.85587 0.26241 0.87143 "
-"0.43429 0.87829 0.64571 0.89641 0.48571 0.90723 0.29330 0.91714 0.60571 0.91252 "
-"0.53143 0.91823 0.80384 0.92286 0.36000 0.97750 0.73143 0.98213 0.44571 1.01681 "
-"0.65714 1.01470 0.52000 1.02991 0.60000 1.02723 66 3 11 "
-"5 9 8 1 1 8 0 4 9 1 "
-"9 4 13 7 0 8 6 13 4 17 13 "
-"6 2 11 3 2 0 7 5 16 10 "
-"12 5 11 10 16 15 11 2 7 16 5 "
-"12 17 14 19 14 17 6 20 15 22 "
-"19 18 23 22 15 16 14 18 19 21 23 "
-"18 23 26 25 23 21 24 26 28 25 "
-"30 32 36 25 34 27 35 32 33 35 29 "
-"27 25 28 34 29 35 33 26 23 24 "
-"37 36 32 39 32 35 35 27 34 37 32 "
-"39 30 31 32 39 35 41 38 41 35 "
-"38 42 41 40 42 38 42 40 44 40 43 "
-"44 44 43 48 45 48 43 47 46 54 "
-"49 48 50 50 48 45 49 53 52 63 52 "
-"61 53 49 50 46 51 54 58 54 51 "
-"58 55 62 62 55 64 66 57 60 61 52 "
-"53 55 58 51 59 67 60 52 63 56 "
-"56 65 59 55 57 64 64 57 66 65 56 "
-"63 67 66 60 67 59 65 "
-;
-
-char *VTK_VECTOR_TEXT_52 = (char *) "18 0.920000 "
-"0.64571 -0.07295 0.64000 -0.06878 0.77143 -0.06878 0.77403 0.18571 0.16265 0.19143 "
-"0.63429 0.18882 0.92000 0.19408 0.15891 0.31143 0.91735 0.31143 0.29653 0.31714 "
-"0.63740 0.31714 0.77714 0.31403 0.16571 0.32228 0.16616 0.32286 0.63429 0.79380 "
-"0.77186 1.02000 0.66857 1.02282 0.76571 1.02420 18 2 1 0 1 3 5 1 2 "
-"3 3 10 5 9 4 5 4 9 7 "
-"6 11 3 8 11 6 7 9 13 15 16 "
-"14 9 5 10 7 13 12 13 14 16 "
-"11 10 3 14 13 9 14 10 11 15 17 "
-"16 15 14 11 "
-;
-
-char *VTK_VECTOR_TEXT_53 = (char *) "54 0.932946 "
-"0.52571 -0.09009 0.61714 -0.08665 0.44571 -0.07673 0.73143 -0.05179 0.35429 -0.03759 "
-"0.78914 -0.01429 0.30286 0.00241 0.53714 0.02152 0.62857 0.03184 0.84115 0.03714 "
-"0.46857 0.03927 0.66286 0.04645 0.26286 0.04921 0.42286 0.06759 0.71429 0.08439 "
-"0.88045 0.09429 0.23343 0.10000 0.38812 0.10571 0.74535 0.12286 0.35748 0.16857 "
-"0.77294 0.18000 0.91681 0.18000 0.20420 0.20857 0.34286 0.22376 0.78705 0.23714 "
-"0.93295 0.27143 0.79009 0.31714 0.93252 0.33429 0.77714 0.38420 0.91681 0.42000 "
-"0.34857 0.43034 0.75641 0.43143 0.23088 0.44857 0.72000 0.47868 0.40000 0.48400 "
-"0.68000 0.50784 0.86902 0.51714 0.46857 0.52437 0.53143 0.53848 0.57714 0.53848 "
-"0.58857 0.53621 0.60000 0.53580 0.82286 0.56972 0.38494 0.59714 0.77714 0.60535 "
-"0.48571 0.64244 0.69714 0.64327 0.56571 0.65848 0.61714 0.65848 0.43891 0.87714 "
-"0.44571 0.88395 0.88043 0.88857 0.88043 1.00857 0.33714 1.01182 52 7 1 "
-"8 7 0 1 7 2 0 2 10 4 "
-"6 13 12 3 8 1 3 11 8 10 2 "
-"7 4 13 6 11 3 14 19 16 12 "
-"3 5 14 9 14 5 10 13 4 22 19 "
-"23 18 15 20 17 12 13 15 14 9 "
-"14 15 18 19 12 17 25 26 24 20 21 "
-"24 21 20 15 22 16 19 25 24 21 "
-"26 25 27 29 28 26 29 26 27 43 37 "
-"45 36 31 29 34 32 30 31 36 33 "
-"31 28 29 32 34 43 48 47 41 45 38 "
-"47 42 33 36 41 39 40 38 39 47 "
-"37 38 45 47 39 41 44 33 42 43 34 "
-"37 46 33 44 35 46 41 33 46 35 "
-"46 48 41 32 43 53 43 49 53 49 50 "
-"53 53 50 52 50 51 52 "
-;
-
-char *VTK_VECTOR_TEXT_54 = (char *) "70 0.927232 "
-"0.55429 -0.09009 0.66857 -0.08034 0.43429 -0.06213 0.75429 -0.04607 0.34857 -0.00972 "
-"0.81143 -0.00439 0.59429 0.02152 0.51339 0.03143 0.85188 0.04286 0.67429 0.04645 "
-"0.46286 0.05579 0.27384 0.07714 0.41714 0.09597 0.73143 0.09597 0.89355 0.11714 "
-"0.38771 0.14000 0.91177 0.16857 0.77294 0.17429 0.22816 0.18571 0.36530 0.19714 "
-"0.78705 0.24857 0.92680 0.25429 0.35320 0.26000 0.78665 0.30571 0.20420 0.31143 "
-"0.35320 0.31143 0.92723 0.31714 0.36657 0.37429 0.77395 0.37429 0.75429 0.41841 "
-"0.39179 0.42571 0.89756 0.44286 0.72000 0.46418 0.43429 0.47258 0.19891 0.50571 "
-"0.33714 0.50495 0.48000 0.50213 0.66857 0.50086 0.86241 0.50571 0.55429 0.52134 "
-"0.61143 0.51866 0.80403 0.56857 0.42286 0.58821 0.74286 0.60943 0.34134 0.63143 "
-"0.50857 0.62823 0.68000 0.63252 0.57714 0.64134 0.21563 0.66000 0.77714 0.74697 "
-"0.37502 0.75714 0.90966 0.76286 0.25673 0.80286 0.41901 0.83143 0.73143 0.85191 "
-"0.45143 0.86686 0.87343 0.87714 0.30036 0.88286 0.68000 0.89514 0.50286 0.90086 "
-"0.51429 0.90530 0.52000 0.90784 0.60571 0.91866 0.83846 0.92857 0.35429 0.94384 "
-"0.40571 0.98150 0.76000 0.99229 0.49143 1.01748 0.68571 1.02041 0.56571 1.02991 70 "
-"2 10 4 6 1 9 3 5 13 0 7 "
-"2 3 9 1 1 6 0 9 3 13 "
-"7 0 6 10 2 7 20 26 23 4 12 "
-"11 13 8 17 4 10 12 11 19 18 "
-"17 21 20 15 11 12 11 15 19 16 17 "
-"14 18 22 24 8 14 17 8 13 5 "
-"24 35 34 22 18 19 20 21 26 28 23 "
-"26 21 17 16 24 27 35 24 22 25 "
-"28 31 29 31 28 26 24 25 27 32 41 "
-"37 30 35 27 34 44 48 35 33 42 "
-"43 37 41 46 39 40 32 29 38 38 29 "
-"31 33 35 30 33 36 42 42 36 45 "
-"45 39 47 36 39 45 37 46 40 41 32 "
-"38 46 37 43 47 39 46 44 34 35 "
-"48 50 52 48 44 50 49 56 54 57 53 "
-"64 57 52 50 54 66 58 51 56 49 "
-"62 69 61 53 57 50 61 59 60 59 65 "
-"55 65 64 55 58 68 62 55 64 53 "
-"66 54 63 63 54 56 65 59 67 69 62 "
-"68 67 59 61 69 67 61 68 58 66 "
-;
-
-char *VTK_VECTOR_TEXT_55 = (char *) "17 0.923788 "
-"0.37143 -0.07186 0.50286 -0.07186 0.36723 -0.06571 0.37335 0.02000 0.52991 0.11143 "
-"0.40379 0.18571 0.59787 0.35143 0.47387 0.41429 0.66857 0.51873 0.53355 0.55143 "
-"0.63384 0.72857 0.80893 0.76286 0.74359 0.88286 0.21714 0.88546 0.92379 0.91143 "
-"0.21403 1.00857 0.92311 1.00857 15 3 0 1 2 0 3 3 4 5 4 3 1 6 7 5 6 5 4 9 "
-"7 6 10 9 8 8 9 6 10 11 12 11 10 8 15 13 12 12 14 16 15 "
-"12 16 11 14 12 "
-;
-
-char *VTK_VECTOR_TEXT_56 = (char *) "83 0.926804 "
-"0.53143 -0.08966 0.62857 -0.08665 0.45143 -0.07605 0.73714 -0.05641 0.38857 -0.05343 "
-"0.34286 -0.02616 0.79429 -0.02250 0.28571 0.02445 0.58857 0.02152 0.50857 0.02823 "
-"0.85258 0.03143 0.66937 0.04286 0.45143 0.05070 0.71429 0.07296 0.41143 0.07868 "
-"0.24000 0.09016 0.89927 0.10571 0.37669 0.12286 0.76613 0.14000 0.21462 0.15714 "
-"0.35849 0.16286 0.92109 0.17429 0.78705 0.22000 0.34437 0.22571 0.20420 0.27143 "
-"0.92680 0.27143 0.78437 0.28286 0.34748 0.28857 0.77143 0.32947 0.91470 0.33429 "
-"0.21714 0.34118 0.37502 0.36286 0.73296 0.39143 0.89057 0.39143 0.24359 0.40286 "
-"0.41883 0.41429 0.69143 0.42722 0.27275 0.44286 0.85714 0.43841 0.46286 0.44371 "
-"0.50286 0.45748 0.63429 0.45470 0.58286 0.46420 0.80507 0.48286 0.33143 0.49007 "
-"0.40456 0.52286 0.72693 0.52286 0.32000 0.57616 0.54857 0.57580 0.62286 0.58319 "
-"0.82082 0.58571 0.49714 0.58657 0.66286 0.60073 0.28527 0.61429 0.44571 0.61582 "
-"0.70439 0.63714 0.85759 0.63714 0.25756 0.67143 0.72657 0.67143 0.39849 0.68286 "
-"0.87470 0.68286 0.74134 0.72857 0.38705 0.73429 0.88109 0.76857 0.24764 0.77429 "
-"0.73395 0.79714 0.39470 0.80286 0.87177 0.82000 0.71641 0.83714 0.27216 0.86571 "
-"0.44000 0.87296 0.84486 0.88286 0.66286 0.89179 0.48000 0.90086 0.61714 0.91184 "
-"0.54286 0.91823 0.31846 0.93429 0.80571 0.93555 0.38286 0.98616 0.72000 0.99800 "
-"0.43429 1.01008 0.53143 1.02991 0.61714 1.02723 85 0 "
-"9 2 12 4 2 1 8 0 6 11 3 5 14 7 9 0 8 8 1 11 4 "
-"12 5 13 11 6 1 3 11 12 2 9 5 12 14 13 10 18 7 17 15 10 "
-"13 6 15 20 19 7 14 17 18 16 22 16 18 10 20 15 17 19 23 24 16 "
-"21 22 22 25 26 23 19 20 24 27 30 25 22 21 27 24 23 31 34 30 31 "
-"37 34 29 28 26 31 30 27 29 26 25 33 28 29 28 33 32 36 32 43 37 "
-"31 44 40 45 39 44 39 45 43 32 38 35 44 31 42 48 40 44 35 39 41 "
-"46 42 36 46 41 32 33 38 48 42 49 46 36 43 48 45 40 42 46 49 51 "
-"45 48 49 46 52 47 54 53 52 46 55 53 59 57 45 54 47 45 51 54 50 "
-"55 46 59 53 54 50 58 55 58 50 61 57 62 64 61 63 65 56 61 50 57 "
-"59 62 60 61 56 64 66 69 63 67 65 64 62 66 63 61 60 71 68 65 76 "
-"69 66 72 68 77 71 65 67 76 70 78 70 76 66 74 82 75 80 78 70 79 "
-"72 77 74 72 79 80 73 75 80 75 81 68 71 77 73 80 70 82 81 75 82 "
-"74 79 "
-;
-
-char *VTK_VECTOR_TEXT_57 = (char *) "72 0.927232 "
-"0.50286 -0.09009 0.56000 -0.09009 0.42857 -0.07673 0.64571 -0.07395 0.36000 -0.04771 "
-"0.74286 -0.02616 0.28759 0.01429 0.51429 0.02152 0.57143 0.02420 0.80115 0.02571 "
-"0.47429 0.02891 0.42857 0.05007 0.64000 0.04943 0.24930 0.07714 0.39314 0.08286 "
-"0.85229 0.10000 0.70902 0.11143 0.37057 0.12286 0.22177 0.17429 0.34857 0.18947 "
-"0.75109 0.19714 0.89395 0.20286 0.75429 0.20739 0.75681 0.21429 0.90966 0.27143 "
-"0.50286 0.30152 0.42857 0.31605 0.61714 0.31462 0.37714 0.33787 0.70286 0.35759 "
-"0.78705 0.37429 0.32000 0.37846 0.58286 0.42152 0.50286 0.42891 0.63429 0.43184 "
-"0.78286 0.43630 0.92723 0.43714 0.26286 0.44350 0.45143 0.45107 0.68571 0.45750 "
-"0.41587 0.47714 0.23787 0.48857 0.74498 0.52286 0.36359 0.55143 0.21522 0.55714 "
-"0.92680 0.56286 0.76571 0.57009 0.34437 0.63143 0.77823 0.63714 0.20462 0.69429 "
-"0.77866 0.69429 0.91236 0.70000 0.35429 0.74118 0.76571 0.76404 0.21756 0.77429 "
-"0.38286 0.80921 0.87343 0.82571 0.40759 0.84286 0.72571 0.84118 0.24527 0.84857 "
-"0.69143 0.87527 0.84000 0.88221 0.47429 0.89641 0.28571 0.90975 0.63429 0.90784 "
-"0.54857 0.91866 0.33143 0.95527 0.76000 0.96331 0.39629 0.99714 0.68571 1.00437 "
-"0.49714 1.02723 0.57714 1.02991 72 3 8 1 2 11 4 0 7 2 "
-"8 3 12 4 14 6 0 1 8 6 17 "
-"13 10 2 7 7 0 8 5 12 3 "
-"12 5 16 2 10 11 4 11 14 5 9 "
-"16 18 13 19 16 15 20 15 23 20 "
-"6 14 17 13 17 19 21 23 15 22 20 "
-"23 23 24 30 16 9 15 23 21 24 "
-"25 32 26 27 32 25 38 28 26 43 41 "
-"37 34 29 39 33 26 32 29 34 27 "
-"30 36 35 34 32 27 36 30 24 28 38 "
-"31 31 38 37 35 39 29 38 26 33 "
-"39 35 42 42 35 36 40 37 38 44 41 "
-"43 42 36 46 44 47 49 43 37 40 "
-"48 46 45 36 45 46 51 50 48 52 54 "
-"49 47 44 43 50 51 53 51 48 45 "
-"59 54 52 59 55 63 52 49 47 53 61 "
-"58 56 53 51 55 59 52 53 56 61 "
-"66 63 57 55 57 63 62 68 57 58 67 "
-"60 67 58 61 68 66 57 60 69 64 "
-"68 62 70 60 67 69 64 71 65 65 70 "
-"62 70 65 71 64 69 71 "
-;
-
-char *VTK_VECTOR_TEXT_58 = (char *) "14 0.432768 "
-"0.28571 -0.07295 0.42857 -0.07186 0.28000 -0.06878 0.43277 -0.06571 0.27957 0.07714 "
-"0.28571 0.08134 0.42857 0.08025 0.27957 0.57429 0.28571 0.57009 0.43168 0.57429 "
-"0.27848 0.71714 0.43277 0.71714 0.28265 0.72286 0.42857 0.72329 10 "
-"2 5 4 2 0 5 0 3 5 6 5 "
-"3 0 1 3 7 8 10 10 11 13 "
-"9 10 8 12 10 13 11 10 9 "
-;
-
-char *VTK_VECTOR_TEXT_59 = (char *) "18 0.432768 "
-"0.30857 -0.28726 0.36571 -0.25275 0.27323 -0.23714 0.39543 -0.22000 0.32384 -0.19143 "
-"0.33756 -0.16857 0.42327 -0.15714 0.43277 -0.10000 0.35472 -0.07714 0.28571 -0.07295 "
-"0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 0.43168 0.07714 0.27957 0.57429 "
-"0.43168 0.57429 0.28265 0.72286 0.42857 0.72329 14 2 1 4 5 4 3 0 1 "
-"2 5 6 8 3 4 1 6 5 3 "
-"6 7 8 11 10 12 12 10 13 8 7 "
-"10 11 9 10 13 10 7 17 16 15 "
-"15 16 14 "
-;
-
-char *VTK_VECTOR_TEXT_60 = (char *) "11 0.952690 "
-"0.94857 0.09939 0.95269 0.10571 0.95236 0.22571 0.22894 0.40857 0.38919 0.46571 "
-"0.38919 0.47143 0.22748 0.52857 0.23192 0.53429 0.95098 0.70571 0.95216 0.83143 "
-"0.94857 0.83523 9 4 0 2 5 7 6 4 3 0 0 1 2 7 "
-"8 10 4 5 3 5 6 3 8 9 10 7 5 8 "
-;
-
-char *VTK_VECTOR_TEXT_61 = (char *) "12 0.952768 "
-"0.22857 0.23975 0.94857 0.23975 0.22437 0.35714 0.95277 0.35714 0.22857 0.36329 "
-"0.94857 0.36329 0.22857 0.57385 0.94857 0.57385 0.22437 0.58000 0.95277 0.58000 "
-"0.22857 0.69740 0.94857 0.69740 8 0 4 "
-"2 0 1 5 4 0 5 3 5 1 "
-"11 7 9 10 6 7 10 7 11 8 6 "
-"10 "
-;
-
-char *VTK_VECTOR_TEXT_62 = (char *) "11 0.952360 "
-"0.23429 0.09914 0.22857 0.10169 0.22748 0.22571 0.23192 0.23143 0.95116 0.40857 "
-"0.79073 0.46571 0.79073 0.47143 0.95236 0.52857 0.22897 0.70571 0.22857 0.83287 "
-"0.23429 0.83563 9 1 0 2 3 2 0 3 0 5 4 7 5 4 "
-"5 0 6 5 7 6 10 8 8 10 9 10 6 7 "
-;
-
-char *VTK_VECTOR_TEXT_63 = (char *) "45 0.918074 "
-"0.47429 -0.07186 0.62021 -0.07143 0.47118 0.07714 0.62329 0.07714 0.49979 0.19714 "
-"0.62021 0.19714 0.49563 0.20286 0.49563 0.27714 0.63681 0.31714 0.50816 0.34571 "
-"0.65714 0.36350 0.53669 0.41429 0.70857 0.42384 0.57868 0.47143 0.82857 0.53597 "
-"0.86902 0.58571 0.73258 0.62000 0.90437 0.65429 0.76086 0.66000 0.77522 0.70000 "
-"0.91580 0.70000 0.34857 0.71338 0.21034 0.73429 0.77866 0.75143 0.91807 0.76857 "
-"0.22605 0.80857 0.76571 0.80375 0.38286 0.82144 0.73714 0.85191 0.25098 0.87143 "
-"0.89143 0.86730 0.43597 0.88857 0.86812 0.90571 0.67429 0.90616 0.48571 0.91800 "
-"0.62857 0.92538 0.29296 0.93429 0.54857 0.93277 0.81143 0.96670 0.35429 0.98821 "
-"0.76571 0.99800 0.44571 1.02891 0.69714 1.02680 0.53143 1.04395 0.60000 1.04437 41 2 1 3 2 0 1 7 6 4 7 4 5 8 9 7 11 10 13 8 "
-"7 5 8 10 11 9 8 11 13 12 16 12 13 10 14 16 12 14 15 16 16 "
-"15 18 17 18 15 17 23 19 17 19 18 20 23 17 29 27 36 26 32 28 21 "
-"25 22 26 23 24 27 29 25 24 23 20 36 31 39 28 40 33 30 26 24 35 "
-"44 37 31 36 27 27 25 21 31 34 41 42 33 40 28 38 40 39 31 41 38 "
-"28 32 26 30 32 42 35 33 41 34 43 43 37 44 34 37 43 44 35 42 "
-;
-
-char *VTK_VECTOR_TEXT_64 = (char *) "114 1.632597 "
-"0.92571 -0.39563 1.16571 -0.38109 0.74857 -0.37236 0.65143 -0.34613 1.33143 -0.33070 "
-"0.54286 -0.29914 0.86286 -0.27866 1.06286 -0.28134 1.45650 -0.26000 0.73714 -0.25387 "
-"1.21143 -0.25387 0.43429 -0.22384 0.62286 -0.21216 1.32144 -0.20857 1.55582 -0.17429 "
-"0.53714 -0.16099 0.52571 -0.15258 0.53143 -0.15669 0.33714 -0.11650 1.45143 -0.11561 "
-"0.46286 -0.09260 0.80000 -0.07295 1.20571 -0.07252 1.09714 -0.06891 0.71429 -0.06252 "
-"1.49714 -0.06187 1.63260 -0.06000 0.29629 -0.04857 1.29714 -0.04498 0.90857 -0.03629 "
-"1.03384 -0.02571 0.62857 -0.01582 0.40486 -0.00857 0.59429 0.01873 1.41143 0.03296 "
-"0.82857 0.03907 0.77714 0.04327 1.01143 0.04414 1.20000 0.05050 1.16989 0.06571 "
-"1.25143 0.06086 0.90857 0.06821 0.72000 0.07561 0.54771 0.09429 1.15580 0.09429 "
-"0.24420 0.10000 0.35748 0.11143 0.96000 0.10725 0.68527 0.11714 1.33841 0.11714 "
-"1.51579 0.15714 0.66177 0.17429 1.41355 0.20286 1.03514 0.20857 0.65295 0.23143 "
-"0.22437 0.23714 0.51277 0.23714 0.33563 0.24857 1.45355 0.27714 1.07177 0.31143 "
-"1.58478 0.31143 0.65966 0.32857 1.48319 0.36857 0.53184 0.39714 0.23277 0.40286 "
-"0.34478 0.40857 1.60420 0.42571 1.08420 0.44286 0.71514 0.48857 0.25184 0.49429 "
-"1.49295 0.49429 0.57229 0.50000 1.60109 0.52857 1.05714 0.54144 0.75846 0.55143 "
-"0.38645 0.55714 1.47681 0.58571 1.01143 0.59527 0.81714 0.60331 1.58605 0.60857 "
-"1.12878 0.61429 0.65714 0.62418 0.86286 0.62319 0.96571 0.62151 0.92571 0.62991 "
-"0.42857 0.64350 1.44571 0.66730 0.32359 0.67714 1.06048 0.68286 0.74857 0.69641 "
-"1.15429 0.71588 1.28235 0.71714 1.00571 0.71800 0.82857 0.73109 0.92000 0.74152 "
-"1.52657 0.75143 0.51275 0.75714 0.37669 0.76286 1.38286 0.76132 0.59493 0.82571 "
-"1.30857 0.82821 1.45561 0.84857 0.47429 0.87296 0.73143 0.89681 1.18286 0.89580 "
-"1.08571 0.92395 1.37143 0.92400 0.92000 0.93580 0.58286 0.95188 1.30857 0.96371 "
-"0.71429 1.00899 1.18286 1.01470 0.92000 1.04437 1.01143 1.04395 114 0 6 2 1 7 0 6 0 7 "
-"7 1 10 2 9 3 3 12 5 9 2 "
-"6 10 4 13 4 10 1 15 5 12 "
-"5 15 11 13 8 19 12 3 9 8 13 "
-"4 11 20 18 11 15 16 17 16 15 "
-"14 19 8 26 25 14 20 11 16 22 38 "
-"23 25 19 14 23 39 30 30 39 37 "
-"27 46 45 18 32 27 32 18 20 21 36 "
-"24 35 29 41 24 42 31 29 35 21 "
-"22 28 40 38 22 40 34 49 40 33 31 "
-"48 36 21 35 37 47 41 33 48 43 "
-"43 51 56 44 37 39 34 40 28 47 37 "
-"53 50 52 34 38 39 23 52 49 34 "
-"37 44 53 27 32 46 42 24 36 48 31 "
-"42 37 41 29 45 57 55 53 44 59 "
-"51 54 56 52 50 58 58 60 62 43 48 "
-"51 45 46 57 56 61 63 64 55 57 "
-"91 80 44 60 58 50 62 66 70 56 54 "
-"61 44 80 67 59 44 67 71 63 61 "
-"64 65 69 67 80 73 65 64 57 66 62 "
-"60 68 71 61 71 68 81 69 75 87 "
-"72 70 66 74 81 68 77 73 80 70 79 "
-"76 75 69 65 83 77 88 87 85 97 "
-"81 74 89 89 78 93 86 76 79 70 72 "
-"79 74 78 89 88 77 80 75 85 87 "
-"82 84 94 91 90 80 86 95 98 78 82 "
-"93 92 83 88 93 82 94 84 83 92 "
-"94 84 92 97 96 102 95 86 79 102 99 "
-"108 95 101 98 96 97 85 96 99 102 "
-"98 101 100 103 108 99 100 109 104 106 100 "
-"101 108 103 110 105 113 107 100 106 109 "
-"104 111 105 107 112 110 111 104 109 113 105 "
-"111 112 107 113 107 110 103 "
-;
-
-char *VTK_VECTOR_TEXT_65 = (char *) "13 1.155731 "
-"0.14455 -0.07143 1.00000 -0.07252 1.15573 -0.07143 0.29143 -0.07103 0.40981 0.25429 "
-"0.86857 0.25754 0.45714 0.37713 0.82478 0.38000 0.45462 0.38571 0.58538 0.73429 "
-"0.63429 0.90068 0.56000 1.02454 0.71429 1.02644 13 5 "
-"1 2 0 8 11 6 4 5 12 10 7 0 3 4 0 4 8 6 5 7 6 "
-"8 4 7 5 2 8 9 11 9 10 11 12 7 2 11 10 12 "
-;
-
-char *VTK_VECTOR_TEXT_66 = (char *) "48 1.081090 "
-"0.25714 -0.07186 0.78286 -0.06723 0.86857 -0.04899 0.93714 -0.02045 1.00725 0.03714 "
-"0.39957 0.06000 0.73143 0.05621 0.80571 0.06891 1.04213 0.08857 0.87555 0.10571 "
-"1.06437 0.14000 0.91070 0.15143 1.08109 0.22000 0.93295 0.22571 0.93252 0.26571 "
-"1.07177 0.32286 0.90857 0.34064 1.04616 0.38571 0.86857 0.38686 0.79429 0.42252 "
-"0.39957 0.43143 1.01296 0.43143 0.69714 0.43563 0.97143 0.46686 0.88197 0.51143 "
-"0.40571 0.56437 0.72000 0.56705 0.39848 0.57429 0.96956 0.58571 0.80571 0.58930 "
-"0.84686 0.62000 0.99641 0.62571 0.86943 0.65429 1.02437 0.70571 0.88420 0.71143 "
-"1.02665 0.76857 0.87429 0.79232 1.01673 0.82000 0.84000 0.84984 0.77714 0.88538 "
-"0.98607 0.88857 0.39957 0.89429 0.71429 0.89580 0.93143 0.95296 0.85714 0.99756 "
-"0.80000 1.01470 0.25714 1.02615 0.70857 1.02680 50 1 6 0 2 7 1 "
-"0 20 46 7 2 9 1 7 6 20 27 "
-"46 9 4 11 4 9 3 2 3 9 "
-"11 10 13 8 11 4 10 11 8 12 13 "
-"10 14 17 16 14 15 17 16 21 18 "
-"14 13 12 15 14 12 23 18 21 5 0 "
-"6 19 26 22 18 24 19 16 17 21 "
-"24 18 23 26 19 29 19 24 29 25 22 "
-"26 22 25 20 30 29 24 32 28 31 "
-"28 32 30 32 31 34 0 5 20 34 35 "
-"36 33 34 31 28 30 24 36 40 38 "
-"38 44 39 35 37 36 34 33 35 25 27 "
-"20 27 41 46 40 36 37 43 38 40 "
-"39 45 42 42 47 41 38 43 44 45 39 "
-"44 47 46 41 47 42 45 "
-;
-
-char *VTK_VECTOR_TEXT_67 = (char *) "56 1.186046 "
-"0.69143 -0.08966 0.80000 -0.08705 0.60000 -0.07823 0.50857 -0.05070 0.93143 -0.05216 "
-"0.45714 -0.02486 1.00000 -0.01473 0.39597 0.02000 0.69714 0.03563 0.74857 0.03563 "
-"0.62286 0.04899 0.82286 0.04899 1.08000 0.05597 0.57143 0.06784 0.88000 0.07229 "
-"0.32571 0.10064 0.93143 0.10759 0.49143 0.11901 1.13800 0.14000 0.45600 0.15714 "
-"0.28930 0.16286 0.99641 0.18571 0.41502 0.22571 1.18605 0.27714 0.24319 0.28857 "
-"1.04571 0.31105 0.38244 0.32857 0.22748 0.36286 0.36723 0.44286 0.21866 0.52857 "
-"0.36991 0.55714 0.22705 0.60857 1.02857 0.69469 0.40657 0.71143 1.16694 0.72857 "
-"0.26286 0.74089 0.44187 0.78000 1.13927 0.80857 0.97143 0.80914 0.48000 0.82725 "
-"0.31750 0.84286 0.93714 0.85011 0.53143 0.86784 0.89143 0.88331 1.07582 0.90571 "
-"0.64000 0.91252 0.64571 0.91335 0.65714 0.91563 0.38286 0.91868 0.78857 0.91823 "
-"1.00571 0.96902 0.50286 0.99756 0.93143 1.01070 0.58286 1.02680 0.70286 1.04705 "
-"0.80000 1.04437 54 "
-"1 9 0 0 8 2 14 6 16 4 14 "
-"11 24 20 22 7 17 15 2 10 3 "
-"8 10 2 9 1 11 0 9 8 4 11 "
-"1 3 13 5 12 16 6 10 13 3 "
-"5 13 7 7 13 17 22 20 15 16 12 "
-"21 14 4 6 19 15 17 23 25 18 "
-"22 15 19 25 21 18 18 21 12 27 28 "
-"29 27 24 26 26 24 22 28 27 26 "
-"29 30 31 30 29 28 33 35 31 35 33 "
-"40 33 31 30 34 37 32 48 42 51 "
-"36 40 33 40 36 48 38 44 41 44 38 "
-"37 32 37 38 48 39 42 36 39 48 "
-"54 53 47 45 51 42 49 43 52 50 41 "
-"44 47 45 46 41 50 43 45 53 51 "
-"49 54 47 53 45 47 49 55 54 55 49 "
-"52 52 43 50 "
-;
-
-char *VTK_VECTOR_TEXT_68 = (char *) "34 1.167232 "
-"0.26286 -0.07186 0.70286 -0.07252 0.80000 -0.06109 0.89714 -0.03355 0.99555 0.02571 "
-"0.40528 0.06000 0.72571 0.05891 1.03582 0.06571 0.79547 0.07143 0.88000 0.10893 "
-"1.08150 0.12857 0.92115 0.14571 0.96657 0.21429 1.13966 0.26571 0.99470 0.28857 "
-"1.16420 0.39714 1.01823 0.43714 1.16723 0.52857 1.01823 0.53429 1.15277 0.64286 "
-"1.00000 0.65848 0.97714 0.72375 1.11216 0.77429 0.94286 0.78057 0.87429 0.84902 "
-"1.06607 0.85429 0.81714 0.87865 0.40528 0.89429 0.69143 0.89807 0.97714 0.94616 "
-"0.90857 0.98657 0.81143 1.01580 0.26286 1.02615 0.70286 1.02680 34 2 6 1 5 0 1 "
-"8 3 9 3 8 2 0 27 32 6 2 "
-"8 5 1 6 4 7 11 4 9 3 "
-"9 4 11 11 10 12 11 7 10 13 14 "
-"12 14 15 16 13 12 10 16 17 18 "
-"14 13 15 18 19 20 17 16 15 18 17 "
-"19 22 21 20 21 22 23 29 24 23 "
-"22 20 19 26 24 30 0 5 27 25 23 "
-"22 29 23 25 30 24 29 26 31 28 "
-"31 26 30 33 32 27 28 33 27 33 28 "
-"31 "
-;
-
-char *VTK_VECTOR_TEXT_69 = (char *) "15 1.080000 "
-"0.26857 -0.07186 1.08000 -0.06878 1.08000 0.05164 0.41100 0.06000 0.41100 0.42571 "
-"1.01143 0.43100 1.01563 0.55143 0.41714 0.55866 1.01143 0.55757 0.40991 0.56857 "
-"0.41100 0.89429 1.05143 0.89957 1.05563 1.02000 0.26857 1.02615 1.05143 1.02615 13 0 4 13 1 3 0 1 2 3 0 "
-"3 4 7 5 8 5 7 4 6 8 5 4 9 13 7 9 4 9 10 13 11 "
-"14 10 14 13 10 12 14 11 "
-;
-
-char *VTK_VECTOR_TEXT_70 = (char *) "12 1.005714 "
-"0.26857 -0.07186 0.40571 -0.07186 0.40991 0.42000 0.41714 0.42723 0.92615 0.43143 "
-"0.92615 0.55143 0.41714 0.55563 0.40991 0.56286 0.41100 0.89429 1.00571 0.90265 "
-"1.00571 1.02307 0.26857 1.02615 10 0 2 "
-"11 2 7 11 2 0 1 6 4 5 "
-"4 6 3 3 6 2 7 2 6 7 8 "
-"11 11 8 10 8 9 10 "
-;
-
-char *VTK_VECTOR_TEXT_71 = (char *) "60 1.234286 "
-"0.82286 -0.08966 0.65714 -0.07866 0.93143 -0.07335 0.56571 -0.05387 1.05143 -0.03355 "
-"0.48000 -0.01514 1.12000 0.00073 0.74286 0.03866 0.83429 0.04177 0.38857 0.05044 "
-"0.65143 0.05470 0.92571 0.06319 1.23260 0.07714 0.34857 0.09302 0.54286 0.10150 "
-"1.03429 0.11229 0.50286 0.13044 1.09252 0.15714 0.44421 0.19714 0.27429 0.21629 "
-"0.24252 0.31143 0.39320 0.31143 0.77714 0.36243 1.09143 0.35773 0.22748 0.39714 "
-"0.37605 0.40286 0.77295 0.48286 0.77714 0.48900 1.23429 0.48900 0.22437 0.51143 "
-"0.37295 0.51714 0.23320 0.59143 0.39748 0.65429 1.09143 0.68617 1.08571 0.69099 "
-"0.42073 0.71714 1.21977 0.72286 0.27387 0.73429 1.06286 0.75301 0.30645 0.80286 "
-"0.47616 0.80286 1.02286 0.82127 1.18498 0.82571 0.54286 0.86150 0.34857 0.86629 "
-"0.94286 0.88371 1.14857 0.88793 0.61143 0.89580 0.86286 0.91184 0.40168 0.92286 "
-"0.70857 0.91866 0.80000 0.92134 1.09714 0.94384 0.45714 0.96436 0.53714 1.00498 "
-"1.00000 1.00371 0.93714 1.02613 0.62857 1.03252 0.73714 1.04705 0.84571 1.04395 58 0 7 1 14 5 3 5 14 "
-"9 2 8 0 1 10 3 0 8 7 "
-"8 2 11 18 13 9 17 6 12 10 1 "
-"7 4 11 2 13 18 19 23 17 12 "
-"15 6 17 4 6 15 16 9 14 11 4 "
-"15 14 3 10 19 21 20 18 9 16 "
-"30 31 29 23 27 22 25 24 20 22 27 "
-"26 21 19 18 25 20 21 23 28 27 "
-"28 23 12 29 24 25 30 29 25 31 32 "
-"37 38 33 36 37 32 39 32 31 30 "
-"35 39 32 34 33 38 39 40 44 38 46 "
-"41 38 42 46 40 39 35 44 40 49 "
-"53 43 54 43 49 40 42 38 36 43 47 "
-"54 52 41 46 41 52 45 43 53 49 "
-"54 47 57 50 57 47 45 56 48 55 45 "
-"52 48 59 51 57 50 58 50 51 58 "
-"56 45 55 58 51 59 59 48 56 "
-;
-
-char *VTK_VECTOR_TEXT_72 = (char *) "16 1.125714 "
-"0.26857 -0.07186 0.40571 -0.07186 0.98857 -0.07295 0.98286 -0.06878 1.12571 -0.06878 "
-"0.40991 0.43714 0.41714 0.44437 0.97714 0.44329 0.41714 0.57277 0.97714 0.57385 "
-"0.40991 0.58000 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 0.40571 1.02615 "
-"1.12000 1.02723 14 4 9 7 0 5 13 5 10 13 "
-"5 0 1 8 7 9 9 4 11 10 5 "
-"8 6 8 5 4 3 2 7 8 6 "
-"14 13 10 12 15 11 3 4 7 4 12 "
-"11 "
-;
-
-char *VTK_VECTOR_TEXT_73 = (char *) "4 0.428571 "
-"0.42592 -0.07143 0.28571 -0.06878 0.28836 1.02571 0.42857 1.02307 2 1 3 2 3 1 0 "
-;
-
-char *VTK_VECTOR_TEXT_74 = (char *) "27 0.790089 "
-"0.45143 -0.09009 0.50857 -0.09009 0.37714 -0.07756 0.58404 -0.07714 0.33143 -0.06086 "
-"0.64000 -0.05641 0.26489 -0.01429 0.71429 -0.00117 0.46286 0.03866 0.53714 0.04706 "
-"0.74902 0.04857 0.41714 0.04899 0.57772 0.06571 0.21143 0.06772 0.37016 0.07714 "
-"0.34498 0.11143 0.77252 0.11143 0.62371 0.11714 0.18705 0.16286 0.32462 0.17429 "
-"0.64420 0.22571 0.79009 0.23143 0.18546 0.23714 0.31472 0.25429 0.64836 1.02571 "
-"0.78857 1.02307 0.78286 1.02723 25 10 "
-"12 7 4 2 11 0 1 8 3 8 1 11 2 8 0 8 2 8 3 9 9 "
-"3 12 4 14 6 7 12 5 3 5 12 6 15 13 12 10 17 14 4 11 13 "
-"19 18 6 14 15 22 19 23 17 16 20 13 15 19 16 17 10 22 18 19 21 "
-"20 16 20 21 24 25 26 24 21 25 24 "
-;
-
-char *VTK_VECTOR_TEXT_75 = (char *) "17 1.155019 "
-"0.25714 -0.07186 0.39429 -0.07186 1.15502 -0.07143 0.97143 -0.07140 0.89527 0.28857 "
-"0.89143 0.29371 0.89098 0.29429 0.39848 0.30000 0.57714 0.47913 0.40000 0.49126 "
-"0.68956 0.56857 0.68571 0.57371 0.68527 0.57429 1.13216 1.02571 0.25714 1.02615 "
-"0.39429 1.02615 0.94857 1.02680 15 0 9 14 0 7 9 3 10 8 3 6 10 9 8 16 4 5 6 7 "
-"0 1 3 4 6 16 8 12 10 11 12 4 3 2 8 10 12 9 7 8 13 "
-"16 12 15 14 9 "
-;
-
-char *VTK_VECTOR_TEXT_76 = (char *) "7 0.941339 "
-"0.25714 -0.07186 0.93714 -0.07186 0.94134 0.04857 0.39957 0.06000 0.93714 0.05472 "
-"0.25714 1.02615 0.39429 1.02615 5 3 0 1 0 3 5 2 4 1 3 1 4 6 5 3 "
-;
-
-char *VTK_VECTOR_TEXT_77 = (char *) "19 1.302857 "
-"0.39164 -0.07143 0.71429 -0.07186 1.17143 -0.07295 0.25714 -0.06878 0.84000 -0.06947 "
-"1.16571 -0.06878 1.30286 -0.06878 0.78286 0.09751 0.78857 0.09751 1.16000 0.83018 "
-"0.40000 0.84467 0.52151 0.88286 0.52000 0.88739 0.51748 0.89429 0.47580 1.02000 "
-"0.25979 1.02571 1.11429 1.02285 1.30286 1.02307 0.46857 1.02680 17 3 10 15 5 6 9 6 "
-"5 2 1 11 10 4 8 1 1 7 11 9 16 8 1 8 7 9 8 4 10 "
-"18 15 13 11 12 10 3 0 10 13 18 16 9 17 10 11 13 13 14 18 6 "
-"17 9 "
-;
-
-char *VTK_VECTOR_TEXT_78 = (char *) "14 1.125714 "
-"0.26286 -0.07186 0.39429 -0.07186 0.98286 -0.07295 1.12571 -0.06878 0.98286 0.17231 "
-"0.72045 0.31143 0.71678 0.31714 0.72000 0.31207 0.40000 0.78092 0.99122 1.02571 "
-"1.12571 1.02307 0.26286 1.02615 0.40571 1.02644 1.12000 1.02723 12 "
-"0 8 11 8 0 1 4 3 9 3 4 "
-"2 4 5 2 6 7 5 12 6 4 "
-"4 6 5 6 12 8 10 13 9 8 12 "
-"11 3 10 9 "
-;
-
-char *VTK_VECTOR_TEXT_79 = (char *) "63 1.267054 "
-"0.70286 -0.08966 0.77714 -0.08966 0.61143 -0.07605 0.89714 -0.06823 0.97143 -0.04073 "
-"0.49143 -0.03229 1.05650 0.00857 0.42286 0.01107 0.70857 0.03605 0.77143 0.03605 "
-"0.63429 0.04899 0.84571 0.04899 1.12725 0.07143 0.35044 0.07714 0.92716 0.08286 "
-"0.54857 0.08535 0.49143 0.12704 1.17465 0.13429 1.01296 0.15143 0.28571 0.17016 "
-"0.43955 0.18571 1.21184 0.20286 0.40784 0.23714 1.08086 0.26000 1.24613 0.30000 "
-"0.23109 0.31143 1.10665 0.34571 0.36764 0.36857 0.21295 0.43143 1.11848 0.43714 "
-"1.26705 0.43714 0.36193 0.51143 1.11848 0.51714 0.21563 0.54571 0.36991 0.59143 "
-"1.25522 0.61429 1.09966 0.63714 0.23236 0.64857 1.23681 0.68857 1.07070 0.71714 "
-"0.41143 0.73016 0.26645 0.75143 1.20486 0.76857 0.45561 0.79714 1.02286 0.79270 "
-"0.98857 0.82956 0.31429 0.83650 1.16045 0.84286 0.53143 0.86150 0.92000 0.87800 "
-"0.35582 0.88857 0.63429 0.90764 0.85143 0.90613 1.10286 0.90956 0.71429 0.92134 "
-"0.79429 0.91866 0.43493 0.95714 1.04000 0.95964 0.52000 1.00498 0.96000 1.00327 "
-"0.89714 1.02613 0.63429 1.03866 0.77714 1.04705 63 0 8 2 1 9 0 8 10 2 2 10 5 9 1 11 5 "
-"16 7 11 3 14 3 11 1 3 4 14 6 14 4 7 16 13 10 15 5 0 "
-"9 8 16 5 15 14 6 18 13 20 19 12 18 6 18 17 23 17 21 23 20 "
-"22 19 18 12 17 23 21 26 25 19 22 13 16 20 25 27 28 27 25 22 21 "
-"24 26 30 29 26 32 35 36 30 26 24 33 34 37 32 29 30 28 31 33 31 "
-"28 27 34 33 31 36 38 39 35 32 30 41 37 34 38 42 39 41 40 46 35 "
-"38 36 39 47 44 40 43 46 53 45 44 46 43 50 45 57 49 40 41 34 56 "
-"50 43 49 59 52 48 56 43 57 45 53 53 44 47 56 48 58 39 42 47 58 "
-"51 61 59 49 57 51 58 48 55 52 60 62 54 55 59 60 52 61 54 62 54 "
-"61 51 62 55 60 "
-;
-
-char *VTK_VECTOR_TEXT_80 = (char *) "31 1.098661 "
-"0.26286 -0.07186 0.40000 -0.07186 0.40420 0.36857 0.41143 0.37580 0.73714 0.37621 "
-"0.88571 0.40034 0.98343 0.44857 0.41143 0.50420 0.72571 0.50420 0.40420 0.51143 "
-"1.04045 0.51143 0.82947 0.52286 0.88571 0.55296 0.91678 0.58571 1.08252 0.59714 "
-"0.93966 0.63143 1.09866 0.68286 0.94966 0.72857 0.93355 0.79143 1.08530 0.80857 "
-"0.90857 0.83270 0.86857 0.86893 1.05927 0.87143 0.40528 0.89429 0.82286 0.88899 "
-"0.74857 0.89807 1.02439 0.92286 0.96000 0.97641 0.89143 1.00538 0.26286 1.02615 "
-"0.74286 1.02680 31 0 9 29 0 2 9 2 7 9 7 3 8 12 11 5 5 11 4 4 "
-"8 3 3 7 2 2 0 1 11 8 4 13 12 6 10 13 6 6 12 5 14 "
-"15 10 15 14 17 13 10 15 16 17 14 17 19 18 19 17 16 18 19 20 20 "
-"27 21 22 20 19 9 23 29 30 25 24 25 30 23 27 20 26 20 22 26 28 "
-"24 21 28 21 27 30 29 23 30 24 28 "
-;
-
-char *VTK_VECTOR_TEXT_81 = (char *) "66 1.276398 "
-"1.23429 -0.15444 1.13714 -0.11188 0.76571 -0.09009 0.64571 -0.08437 0.84000 -0.08034 "
-"0.58286 -0.07034 1.27640 -0.06000 0.93143 -0.05470 0.46857 -0.02322 1.00000 -0.02293 "
-"0.38857 0.03330 0.76000 0.03563 0.68000 0.03866 0.83547 0.04857 1.09814 0.04857 "
-"0.61714 0.05177 0.87591 0.06571 0.55429 0.07800 0.80000 0.10784 0.49143 0.12132 "
-"0.30857 0.12350 0.74115 0.12857 0.98286 0.13189 1.17355 0.14571 0.42857 0.19207 "
-"0.86857 0.19927 0.26286 0.20486 1.05355 0.22000 0.77714 0.23134 0.39277 0.26000 "
-"1.23177 0.27714 0.23387 0.28286 1.08823 0.30571 0.36420 0.36286 0.20991 0.40286 "
-"0.35580 0.43714 1.25866 0.43714 1.11009 0.44286 0.20723 0.51714 1.25252 0.58000 "
-"0.36420 0.59714 1.09823 0.60857 0.23470 0.67714 0.38857 0.68947 1.21184 0.73429 "
-"1.05143 0.73841 0.42902 0.76857 0.28821 0.80286 1.00571 0.80413 1.17188 0.81429 "
-"0.96000 0.84670 0.51429 0.85473 0.34473 0.88286 1.12000 0.88413 0.57714 0.89070 "
-"0.88571 0.89070 0.64571 0.91252 0.76571 0.92093 0.42857 0.95759 1.03429 0.95864 "
-"0.50286 0.99927 0.96571 0.99800 0.60000 1.03252 0.86857 1.03184 0.69714 1.04705 "
-"0.77143 1.04665 66 0 6 1 "
-"13 7 16 14 9 1 9 16 7 3 15 "
-"5 16 9 14 11 4 13 11 2 4 "
-"7 13 4 12 3 11 2 11 3 15 3 "
-"12 5 17 8 8 19 10 10 19 20 "
-"14 1 6 5 15 17 20 29 26 19 8 "
-"17 21 18 28 22 16 14 16 25 18 "
-"22 14 27 24 20 19 16 22 25 26 29 "
-"31 18 25 28 14 23 27 27 30 32 "
-"30 27 23 31 33 34 20 24 29 37 32 "
-"30 33 31 29 34 33 38 36 37 30 "
-"35 38 33 37 39 41 38 40 42 37 36 "
-"39 41 44 45 40 38 35 42 43 47 "
-"44 41 39 46 47 43 43 42 40 47 46 "
-"52 45 49 48 59 50 48 52 51 58 "
-"53 48 49 61 50 59 50 61 55 58 51 "
-"60 51 52 46 49 45 44 59 48 53 "
-"57 64 56 60 54 62 55 63 57 51 54 "
-"60 54 56 62 62 56 64 63 55 61 "
-"63 65 57 57 65 64 "
-;
-
-char *VTK_VECTOR_TEXT_82 = (char *) "46 1.225355 "
-"0.26857 -0.07186 0.40571 -0.07186 1.05143 -0.07215 1.22359 -0.07143 1.22535 -0.06571 "
-"1.17465 0.01429 1.17143 0.01936 1.17098 0.02000 0.84571 0.24343 1.00571 0.27650 "
-"0.76571 0.34698 0.91832 0.37429 0.73143 0.37678 0.40991 0.40857 0.68000 0.40437 "
-"0.41714 0.41580 0.62286 0.41538 0.84226 0.42571 0.92571 0.44706 0.99429 0.47502 "
-"1.07582 0.54000 0.41714 0.54420 0.40991 0.55143 0.80000 0.54764 0.88000 0.56538 "
-"1.11641 0.60286 0.94286 0.60439 0.96784 0.63714 1.13823 0.67714 0.98966 0.69429 "
-"0.99277 0.74571 1.14134 0.75143 0.97143 0.81493 1.12823 0.82000 0.93143 0.86115 "
-"1.10498 0.87714 0.89143 0.88498 0.40991 0.90000 0.41714 0.90723 0.78857 0.90723 "
-"1.07011 0.92857 1.01714 0.97579 0.97143 0.99865 0.87429 1.02109 0.26857 1.02615 "
-"0.80571 1.02723 46 2 9 8 3 5 2 0 37 "
-"44 5 7 2 5 6 7 3 4 5 "
-"2 7 9 18 23 17 11 8 9 8 11 "
-"10 0 22 37 11 17 10 21 16 23 "
-"21 15 16 23 10 17 19 24 18 23 18 "
-"24 23 12 10 15 21 13 0 21 22 "
-"16 14 23 23 14 12 20 26 19 26 20 "
-"27 24 19 26 27 25 29 28 30 29 "
-"31 30 28 25 27 20 30 33 32 28 29 "
-"25 33 30 31 32 40 34 35 32 33 "
-"0 1 13 0 13 21 41 34 40 43 36 "
-"42 38 39 45 32 35 40 42 34 41 "
-"34 42 36 36 43 39 44 38 45 43 45 "
-"39 37 38 44 "
-;
-
-char *VTK_VECTOR_TEXT_83 = (char *) "69 1.081090 "
-"0.71429 -0.08966 0.53714 -0.07866 0.82286 -0.07101 0.46286 -0.05959 0.38857 -0.02616 "
-"0.94286 -0.01678 0.33714 0.01044 0.64000 0.03866 0.73143 0.04177 1.00571 0.03883 "
-"0.56000 0.05177 0.28527 0.06571 0.50857 0.06930 0.83587 0.07143 1.04086 0.08857 "
-"0.88127 0.10000 0.43429 0.11330 0.24486 0.13429 0.92613 0.15714 1.07177 0.16286 "
-"0.38771 0.16857 0.94134 0.21429 0.36319 0.22571 0.21563 0.23714 1.08109 0.26571 "
-"0.21403 0.27714 0.93294 0.27714 0.34857 0.28916 0.91011 0.31714 1.06816 0.32857 "
-"0.84000 0.36943 1.04486 0.38000 0.76571 0.39673 0.98286 0.45241 0.53143 0.45748 "
-"0.42857 0.49343 0.92571 0.49070 0.37143 0.52535 0.82857 0.53109 0.31044 0.58000 "
-"0.53143 0.60899 0.43429 0.65616 0.26244 0.67143 0.39891 0.71143 0.90857 0.71084 "
-"0.25295 0.72286 1.04615 0.72286 0.39320 0.76857 0.40359 0.80857 1.03109 0.81429 "
-"0.26327 0.82000 0.87429 0.81493 0.45143 0.86956 0.82286 0.87258 0.28930 0.88286 "
-"0.98812 0.90000 0.50857 0.90041 0.76571 0.90151 0.57714 0.91563 0.67429 0.91866 "
-"0.95443 0.94000 0.35429 0.96099 0.89143 0.98784 0.40000 0.99188 0.83429 1.01470 "
-"0.50286 1.03184 0.74857 1.03823 0.57143 1.04437 0.67429 1.04705 67 2 "
-"8 0 0 7 1 6 4 16 6 16 11 0 8 7 7 10 1 8 2 13 5 "
-"15 13 1 10 3 10 12 3 9 15 5 4 3 12 15 14 18 5 13 2 14 "
-"15 9 16 4 12 21 24 26 18 19 21 11 20 17 20 11 16 17 22 23 19 "
-"18 14 22 17 20 25 23 27 23 22 27 24 21 19 26 31 28 28 33 30 24 "
-"29 26 30 38 32 26 29 31 34 32 38 33 28 31 34 40 35 33 36 30 39 "
-"43 42 38 30 36 41 37 35 40 34 38 37 41 39 41 35 40 50 48 54 39 "
-"41 43 44 46 49 45 42 43 45 47 50 48 50 47 60 51 55 47 45 43 51 "
-"60 53 54 48 61 44 49 51 55 51 49 48 52 61 56 63 52 57 66 59 61 "
-"52 63 63 56 65 62 53 60 53 64 57 53 62 64 59 66 58 65 58 67 58 "
-"65 56 66 57 64 67 58 68 68 58 66 "
-;
-
-char *VTK_VECTOR_TEXT_84 = (char *) "8 1.045714 "
-"0.54286 -0.07186 0.68000 -0.07186 0.53757 0.89429 0.68528 0.89429 0.17714 0.90265 "
-"1.04571 0.90265 0.17979 1.02571 1.04571 1.02307 6 0 3 2 3 0 "
-"1 6 4 2 6 3 7 6 2 3 "
-"3 5 7 "
-;
-
-char *VTK_VECTOR_TEXT_85 = (char *) "32 1.126804 "
-"0.65714 -0.09009 0.77143 -0.08705 0.53143 -0.07034 0.85714 -0.07101 0.47429 -0.05070 "
-"0.94286 -0.03629 0.38286 0.00704 1.02286 0.02445 0.65714 0.04437 0.78857 0.05320 "
-"0.33669 0.06000 0.58286 0.05748 0.84000 0.06823 0.52000 0.08535 1.07070 0.08857 "
-"0.89714 0.10154 0.46857 0.13025 1.09966 0.15714 0.29143 0.15866 0.94899 0.17429 "
-"0.43177 0.19714 0.27320 0.24286 0.97252 0.26000 1.12680 0.33429 0.26437 0.34000 "
-"0.40991 0.34000 0.98134 0.34571 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 "
-"0.40571 1.02615 1.12000 1.02723 30 3 9 1 10 20 18 8 0 "
-"1 0 11 2 7 15 5 0 8 11 "
-"8 1 9 9 3 12 13 4 2 5 12 "
-"3 15 7 19 16 10 6 12 5 15 "
-"4 13 6 13 2 11 21 18 20 13 16 "
-"6 19 17 22 17 19 14 7 14 19 "
-"10 16 20 25 24 21 23 26 22 23 22 "
-"17 25 21 20 24 25 29 30 29 25 "
-"28 31 27 26 23 27 23 28 27 "
-;
-
-char *VTK_VECTOR_TEXT_86 = (char *) "8 1.148571 "
-"0.57714 -0.07025 0.72571 -0.06947 0.64571 0.06079 0.65143 0.06062 0.15429 1.02560 "
-"0.30286 1.02531 1.00571 1.02531 1.14857 1.02560 6 0 2 4 3 2 "
-"0 3 7 6 1 3 0 3 1 7 "
-"2 5 4 "
-;
-
-char *VTK_VECTOR_TEXT_87 = (char *) "14 1.568063 "
-"0.45143 -0.07186 0.60000 -0.07017 1.13143 -0.06912 1.27429 -0.06912 0.52571 0.09707 "
-"1.20000 0.09787 1.13673 0.38000 0.86857 0.88103 0.16571 1.02562 0.78286 1.02446 "
-"1.42857 1.02446 1.56806 1.02571 0.30857 1.02615 0.95429 1.02615 12 "
-"2 6 7 6 2 5 1 4 0 7 9 "
-"4 11 10 5 3 5 2 8 0 4 "
-"13 7 6 9 7 13 7 4 1 11 5 "
-"3 12 8 4 "
-;
-
-char *VTK_VECTOR_TEXT_88 = (char *) "14 1.141168 "
-"0.15194 -0.07143 1.14117 -0.07143 0.32000 -0.07106 0.97143 -0.07140 0.65143 0.37795 "
-"0.74607 0.49429 0.56517 0.50000 0.74286 0.49909 0.74219 0.50000 0.65714 0.61727 "
-"0.20016 1.02571 0.96000 1.02568 1.11260 1.02571 0.36571 1.02644 12 "
-"0 2 6 3 5 4 5 6 4 5 8 "
-"6 5 3 1 5 7 8 4 6 2 "
-"9 6 8 12 11 8 6 13 10 13 6 "
-"9 11 9 8 "
-;
-
-char *VTK_VECTOR_TEXT_89 = (char *) "12 1.145205 "
-"0.71164 -0.07143 0.57143 -0.06878 0.56891 0.39143 0.71787 0.39714 0.65143 0.51441 "
-"0.43179 0.85429 0.42857 0.85936 0.42812 0.86000 0.15284 1.02571 0.32000 1.02535 "
-"0.98286 1.02464 1.14521 1.02571 10 3 2 "
-"1 3 1 0 4 2 3 2 9 8 "
-"11 10 4 5 2 4 5 6 7 2 7 "
-"9 2 5 7 11 4 3 "
-;
-
-char *VTK_VECTOR_TEXT_90 = (char *) "11 1.040000 "
-"0.17714 -0.07186 1.04000 -0.06878 1.04000 0.05164 0.17395 0.06000 0.34602 0.06000 "
-"0.84777 0.89429 0.24000 0.89957 1.02395 0.90000 0.23580 1.02000 1.02286 1.02307 "
-"0.24000 1.02615 9 0 4 3 1 4 0 1 2 4 3 4 5 5 "
-"7 9 4 7 5 5 10 6 10 5 9 6 10 8 "
-;
-
-char *VTK_VECTOR_TEXT_91 = (char *) "8 0.541339 "
-"0.24528 -0.37429 0.54025 -0.37429 0.54025 -0.27143 0.38227 -0.26571 0.38286 0.91454 "
-"0.54134 0.92286 0.24836 1.02571 0.53714 1.02615 6 0 4 6 3 1 "
-"2 1 3 0 0 3 4 5 7 4 "
-"6 4 7 "
-;
-
-char *VTK_VECTOR_TEXT_92 = (char *) "5 0.564685 "
-"0.46286 -0.09182 0.56000 -0.09256 0.56469 -0.08857 0.14713 1.04286 0.24571 1.04358 3 0 4 3 0 2 4 0 "
-"1 2 "
-;
-
-char *VTK_VECTOR_TEXT_93 = (char *) "9 0.465968 "
-"0.17100 -0.37429 0.46597 -0.37429 0.17100 -0.27143 0.32571 -0.26723 0.33295 -0.26000 "
-"0.33143 0.91201 0.17143 0.91979 0.16991 1.02000 0.46286 1.02615 7 2 0 3 1 "
-"3 0 1 4 3 5 4 1 7 6 8 5 8 6 8 5 1 "
-;
-
-char *VTK_VECTOR_TEXT_94 = (char *) "11 0.817005 "
-"0.18389 0.44857 0.18857 0.44458 0.32000 0.44686 0.68571 0.44746 0.81143 0.44445 "
-"0.81700 0.44857 0.49714 0.88224 0.50286 0.88224 0.44571 1.04090 0.55429 1.04168 "
-"0.45143 1.04437 9 0 2 6 0 6 8 7 3 5 4 5 3 2 "
-"0 1 10 7 9 10 8 6 10 6 7 9 7 5 "
-;
-
-char *VTK_VECTOR_TEXT_95 = (char *) "4 1.011860 "
-"0.11957 -0.37429 1.01186 -0.37429 0.11957 -0.28857 1.01186 -0.28857 2 2 1 3 2 0 1 "
-;
-
-char *VTK_VECTOR_TEXT_96 = (char *) "11 0.486571 "
-"0.38857 0.82420 0.48000 0.82420 0.48403 0.82571 0.37714 0.82989 0.38286 0.82575 "
-"0.48657 0.83143 0.21296 1.02571 0.38771 1.02571 0.21412 1.03143 0.38286 1.03106 "
-"0.37714 1.03295 9 5 1 2 0 3 4 3 10 6 0 1 5 7 "
-"3 0 8 6 10 7 0 5 3 7 10 10 7 9 "
-;
-
-char *VTK_VECTOR_TEXT_97 = (char *) "70 0.929303 "
-"0.44000 -0.09009 0.50286 -0.08966 0.36571 -0.07756 0.57143 -0.07907 0.92716 -0.07143 "
-"0.79429 -0.07106 0.92930 -0.06571 0.62857 -0.06151 0.30857 -0.05514 0.27429 -0.03258 "
-"0.68000 -0.03629 0.90748 -0.00857 0.48000 0.01580 0.53143 0.01621 0.42768 0.02571 "
-"0.76571 0.02129 0.22073 0.03143 0.61804 0.03714 0.89866 0.03714 0.37130 0.06000 "
-"0.20613 0.06571 0.68000 0.07330 0.34538 0.10000 0.71429 0.10809 0.19580 0.11714 "
-"0.89295 0.13429 0.33907 0.15714 0.74538 0.16857 0.20319 0.19714 0.36000 0.20914 "
-"0.75580 0.22000 0.40000 0.24371 0.22812 0.25429 0.44571 0.26041 0.66286 0.29891 "
-"0.28000 0.31258 0.75848 0.31714 0.75429 0.32399 0.33714 0.34657 0.38857 0.36538 "
-"0.68571 0.41320 0.75772 0.43714 0.35289 0.48286 0.22093 0.50000 0.22857 0.49470 "
-"0.89252 0.50571 0.75580 0.51143 0.22857 0.53547 0.37800 0.54571 0.74286 0.55301 "
-"0.88680 0.56286 0.71429 0.58893 0.41714 0.59330 0.42228 0.59714 0.25800 0.60286 "
-"0.42286 0.59759 0.65143 0.61959 0.48000 0.62193 0.86498 0.62571 0.53143 0.62950 "
-"0.59429 0.62950 0.28187 0.63714 0.84571 0.65486 0.33714 0.68436 0.80571 0.69007 "
-"0.37915 0.70571 0.72571 0.72538 0.45714 0.72966 0.54286 0.74152 0.62286 0.74152 70 "
-"3 13 1 5 4 15 4 11 15 19 8 "
-"2 13 3 7 13 0 1 14 0 12 "
-"20 22 24 0 14 2 12 0 13 13 7 "
-"17 11 4 6 19 2 14 17 10 21 "
-"7 10 17 11 18 15 16 22 20 8 19 "
-"9 15 23 21 15 21 10 23 25 27 "
-"9 19 16 19 22 16 23 15 25 24 26 "
-"28 27 25 30 25 15 18 30 25 36 "
-"32 28 26 26 24 22 29 32 26 39 38 "
-"31 38 35 29 32 29 35 31 38 29 "
-"39 34 40 33 39 31 39 33 34 36 41 "
-"37 40 37 41 37 40 34 41 36 25 "
-"41 45 46 43 44 47 47 48 54 48 47 "
-"44 50 49 46 41 25 45 50 46 45 "
-"42 48 44 49 64 51 52 53 55 52 65 "
-"63 65 52 55 52 61 48 52 63 61 "
-"58 49 50 49 58 62 69 60 56 49 62 "
-"64 54 48 61 57 67 65 57 65 55 "
-"51 66 56 69 59 60 66 51 64 68 67 "
-"57 59 69 57 69 68 57 69 56 66 "
-;
-
-char *VTK_VECTOR_TEXT_98 = (char *) "49 0.932518 "
-"0.61143 -0.09009 0.50286 -0.07823 0.36000 -0.07186 0.24000 -0.06878 0.72000 -0.06213 "
-"0.45714 -0.05914 0.77143 -0.03188 0.36571 0.01806 0.59429 0.02193 0.83543 0.02571 "
-"0.52000 0.02823 0.66857 0.04645 0.46857 0.05179 0.42704 0.08857 0.72956 0.10000 "
-"0.88784 0.10571 0.39216 0.14000 0.75641 0.14000 0.91470 0.18000 0.37462 0.19143 "
-"0.78665 0.23714 0.36152 0.28857 0.93252 0.29429 0.79236 0.36857 0.93252 0.37429 "
-"0.36420 0.38000 0.77294 0.47714 0.39216 0.50000 0.90899 0.50000 0.42473 0.55143 "
-"0.73143 0.55546 0.88657 0.55714 0.45883 0.58571 0.67429 0.60498 0.50857 0.61641 "
-"0.63429 0.62252 0.56571 0.62991 0.37714 0.64118 0.83429 0.63841 0.37315 0.64857 "
-"0.80571 0.66686 0.74286 0.70784 0.46857 0.71355 0.68571 0.72899 0.56571 0.74109 "
-"0.61714 0.74152 0.24265 1.02571 0.37143 1.02307 0.36571 1.02723 49 3 25 46 5 1 10 5 12 7 8 0 4 11 6 14 11 "
-"4 6 0 8 1 2 7 3 8 4 11 10 1 8 21 3 19 12 13 7 12 "
-"5 10 14 9 17 9 14 6 17 15 20 16 7 13 15 18 20 15 17 9 3 "
-"7 19 22 20 18 20 22 23 28 26 23 22 24 23 25 3 21 30 43 33 39 "
-"46 25 28 23 24 27 39 25 26 31 30 7 16 19 31 26 28 37 32 42 39 "
-"27 37 40 30 38 29 37 27 38 30 31 35 33 43 32 34 42 35 45 36 37 "
-"29 32 42 34 36 45 35 43 43 30 41 41 30 40 36 45 44 42 36 44 47 "
-"48 46 39 47 46 "
-;
-
-char *VTK_VECTOR_TEXT_99 = (char *) "58 0.894057 "
-"0.53143 -0.08966 0.59429 -0.08966 0.45714 -0.07673 0.68000 -0.07294 0.72571 -0.05343 "
-"0.37714 -0.04331 0.33714 -0.01543 0.78857 -0.01011 0.58286 0.02152 0.29143 0.03016 "
-"0.49625 0.03143 0.62857 0.03034 0.83107 0.03714 0.45714 0.04943 0.69270 0.06571 "
-"0.26241 0.07143 0.85714 0.07873 0.40457 0.09429 0.72722 0.10571 0.37629 0.14000 "
-"0.74437 0.14000 0.22899 0.14571 0.37184 0.15143 0.36930 0.15714 0.88571 0.15295 "
-"0.89406 0.19714 0.76571 0.21540 0.21034 0.22571 0.34705 0.25429 0.20420 0.36286 "
-"0.34478 0.36857 0.21673 0.45429 0.36252 0.47143 0.75429 0.47269 0.88058 0.48857 "
-"0.88319 0.49429 0.38371 0.52286 0.23849 0.52857 0.72000 0.55200 0.86437 0.55714 "
-"0.43025 0.58000 0.69714 0.58127 0.28527 0.61429 0.47429 0.60943 0.48571 0.61387 "
-"0.83473 0.61429 0.49143 0.61641 0.63429 0.62041 0.54857 0.62950 0.58857 0.62991 "
-"0.81296 0.64286 0.32168 0.65429 0.35429 0.67964 0.76571 0.68535 0.44571 0.72327 "
-"0.67429 0.72816 0.53714 0.74109 0.60000 0.74109 56 2 13 5 0 8 2 11 4 14 "
-"1 8 0 3 11 1 15 23 21 2 10 "
-"13 11 8 1 11 3 4 7 14 4 "
-"10 2 8 14 7 18 17 6 13 6 5 "
-"13 17 15 9 18 12 20 7 12 18 "
-"17 9 6 16 20 12 24 20 16 19 15 "
-"17 15 19 23 23 19 22 27 28 29 "
-"26 20 24 26 24 25 21 28 27 28 21 "
-"23 29 30 31 28 30 29 31 32 37 "
-"39 38 33 34 39 33 32 31 30 37 32 "
-"36 55 49 47 37 36 42 51 42 36 "
-"34 35 39 45 41 38 52 40 43 46 43 "
-"44 50 41 45 56 49 57 40 51 36 "
-"51 40 52 45 38 39 52 43 54 47 41 "
-"53 54 46 48 56 48 49 53 41 50 "
-"54 48 56 54 43 46 57 49 55 55 47 "
-"53 "
-;
-
-char *VTK_VECTOR_TEXT_100 = (char *) "48 0.885714 "
-"0.51429 -0.09009 0.56571 -0.08966 0.62857 -0.07673 0.76571 -0.07186 0.88571 -0.06878 "
-"0.41143 -0.06486 0.67429 -0.05641 0.36000 -0.03669 0.30286 0.01025 0.76000 0.01806 "
-"0.53714 0.02152 0.49714 0.02891 0.60571 0.02891 0.68127 0.07143 0.41714 0.07561 "
-"0.23787 0.10571 0.71579 0.11143 0.38241 0.11714 0.74135 0.16286 0.21395 0.16857 "
-"0.74286 0.16739 0.74538 0.17429 0.34605 0.20286 0.76420 0.27714 0.19277 0.28857 "
-"0.33295 0.28857 0.19277 0.36286 0.76152 0.38571 0.33563 0.39714 0.73355 0.50000 "
-"0.22135 0.51143 0.36784 0.51714 0.69714 0.55841 0.42286 0.58686 0.26857 0.60793 "
-"0.63429 0.60943 0.48571 0.62151 0.56571 0.62950 0.74857 0.64048 0.75269 0.64857 "
-"0.30857 0.65582 0.65714 0.71355 0.40571 0.71756 0.50286 0.74109 0.55429 0.74152 "
-"0.75693 1.02571 0.88571 1.02307 0.88000 1.02723 48 0 11 5 12 6 13 "
-"1 2 12 7 14 8 10 0 1 14 7 "
-"5 10 1 12 6 12 2 0 10 11 "
-"8 17 15 9 16 13 14 5 11 4 9 "
-"3 6 9 13 9 4 18 16 9 18 "
-"15 22 19 17 8 14 22 15 17 20 18 "
-"21 21 18 4 19 25 24 21 4 23 "
-"25 19 22 26 24 25 26 28 30 39 27 "
-"4 26 25 28 39 38 29 29 38 32 "
-"27 39 29 30 31 34 32 38 35 31 30 "
-"28 40 34 31 36 42 33 23 4 27 "
-"35 41 37 33 40 31 40 33 42 41 35 "
-"38 42 36 43 37 43 36 44 37 41 "
-"37 44 43 46 47 45 39 4 45 4 46 "
-"45 "
-;
-
-char *VTK_VECTOR_TEXT_101 = (char *) "65 0.934539 "
-"0.54857 -0.09009 0.61143 -0.09009 0.45714 -0.07462 0.71429 -0.07101 0.40571 -0.05641 "
-"0.77714 -0.04331 0.33714 -0.01543 0.82857 -0.00670 0.29714 0.02154 0.56000 0.02152 "
-"0.60571 0.02193 0.49714 0.03563 0.68159 0.04286 0.88150 0.05429 0.45714 0.05514 "
-"0.26286 0.06636 0.72000 0.06759 0.40457 0.10000 0.91216 0.11143 0.77229 0.13429 "
-"0.37057 0.15143 0.22034 0.15714 0.36613 0.16286 0.92834 0.16286 0.36359 0.16857 "
-"0.91429 0.16966 0.79429 0.18111 0.35177 0.20286 0.20462 0.22571 0.33866 0.28286 "
-"0.34286 0.28900 0.93454 0.29429 0.19848 0.35714 0.93295 0.39714 0.34857 0.40134 "
-"0.78857 0.40134 0.34134 0.40857 0.79580 0.40857 0.20462 0.41429 0.35429 0.47261 "
-"0.22327 0.49429 0.91429 0.48975 0.77143 0.50661 0.38857 0.54057 0.74857 0.54629 "
-"0.40725 0.56286 0.25714 0.57001 0.71429 0.58154 0.87070 0.58571 0.45143 0.59759 "
-"0.68000 0.60498 0.29296 0.62000 0.49143 0.61681 0.63429 0.62252 0.54857 0.62950 "
-"0.59429 0.62991 0.33311 0.66000 0.81143 0.65543 0.77143 0.68607 0.41143 0.70930 "
-"0.72000 0.71355 0.45714 0.72605 0.66857 0.73050 0.54286 0.74152 0.60000 0.74152 65 0 9 11 10 "
-"1 3 10 3 12 5 12 3 17 8 6 10 0 1 0 11 2 4 14 6 0 "
-"10 9 7 16 5 5 16 12 14 2 11 16 7 19 14 4 2 15 8 17 26 "
-"18 25 17 6 14 15 27 21 7 13 19 23 25 18 20 15 17 26 19 18 18 "
-"19 13 24 20 22 15 20 24 15 24 27 21 27 28 28 29 32 33 37 35 29 "
-"28 27 32 29 38 35 34 30 40 39 46 33 35 30 31 33 30 36 38 29 36 "
-"29 34 37 41 42 40 38 36 30 34 29 39 40 36 41 37 33 46 43 51 51 "
-"49 56 42 48 44 48 42 41 44 48 47 49 51 45 43 46 39 56 49 59 50 "
-"62 53 57 47 48 64 55 53 45 51 43 55 63 54 58 47 57 62 50 60 59 "
-"52 61 59 49 52 47 60 50 61 54 63 60 47 58 61 52 54 64 53 62 55 "
-"64 63 "
-;
-
-char *VTK_VECTOR_TEXT_102 = (char *) "24 0.617143 "
-"0.28000 -0.07186 0.40571 -0.07186 0.27472 0.61429 0.41100 0.61429 0.16571 0.61957 "
-"0.56000 0.61957 0.56420 0.71714 0.16571 0.72329 0.27472 0.72857 0.41100 0.72857 "
-"0.56000 0.72329 0.41034 0.83143 0.27580 0.86000 0.43429 0.89555 0.28613 0.91714 "
-"0.46286 0.91294 0.50286 0.92134 0.60000 0.91830 0.31107 0.96857 0.34286 1.00099 "
-"0.38857 1.02784 0.61714 1.03086 0.46286 1.04395 0.52571 1.04437 22 0 3 2 "
-"3 0 1 4 8 7 9 3 5 2 3 "
-"8 5 6 10 4 2 8 9 8 3 "
-"8 11 12 11 8 9 12 11 14 9 5 "
-"10 13 19 18 13 18 14 13 14 11 "
-"23 15 16 15 23 22 21 23 17 15 20 "
-"13 19 13 20 20 15 22 23 16 17 "
-;
-
-char *VTK_VECTOR_TEXT_103 = (char *) "71 0.892518 "
-"0.46857 -0.39295 0.56571 -0.39563 0.66286 -0.37959 0.35429 -0.36200 0.74286 -0.34616 "
-"0.28571 -0.31868 0.80368 -0.30000 0.50857 -0.28437 0.62286 -0.27395 0.44571 -0.27101 "
-"0.23387 -0.24286 0.84657 -0.24286 0.69200 -0.23714 0.38171 -0.23143 0.72150 -0.20286 "
-"0.87177 -0.18000 0.34916 -0.15714 0.74899 -0.14000 0.22286 -0.13957 0.50857 -0.07295 "
-"0.56000 -0.07295 0.43429 -0.05959 0.65143 -0.05070 0.37143 -0.03355 0.69714 -0.02527 "
-"0.89252 -0.00857 0.74857 0.01873 0.75042 0.02000 0.75756 0.02000 0.75429 0.02333 "
-"0.29143 0.03381 0.53143 0.03866 0.57143 0.03907 0.47429 0.05216 0.64000 0.05787 "
-"0.41714 0.08704 0.68000 0.08439 0.23216 0.12857 0.38036 0.12857 0.72784 0.14000 "
-"0.35277 0.18571 0.20530 0.20857 0.75538 0.20857 0.19320 0.28286 0.33295 0.29429 "
-"0.76991 0.35714 0.19277 0.37429 0.33563 0.40857 0.75109 0.47143 0.35109 0.47714 "
-"0.21143 0.47832 0.72784 0.52286 0.23787 0.55143 0.39044 0.55143 0.69868 0.56286 "
-"0.66286 0.59393 0.27107 0.60857 0.45143 0.60498 0.48571 0.62041 0.56571 0.62991 "
-"0.57714 0.62764 0.58286 0.62723 0.76571 0.63477 0.32000 0.66384 0.68571 0.70213 "
-"0.39429 0.71229 0.77408 0.72286 0.88878 0.72286 0.62857 0.72816 0.46857 0.73580 "
-"0.56000 0.74152 71 1 7 0 8 4 12 2 8 1 0 "
-"9 3 7 1 8 5 13 10 9 0 7 13 5 3 8 2 4 6 14 12 6 "
-"12 4 11 15 17 11 14 6 13 3 9 14 11 17 10 16 18 16 10 13 17 "
-"25 28 23 21 33 22 32 20 32 19 20 35 23 33 19 31 21 23 35 30 31 "
-"19 32 32 22 34 26 29 36 17 15 25 33 21 31 26 36 24 24 34 22 26 "
-"27 29 36 34 24 36 29 39 30 38 37 39 28 25 39 29 28 37 40 41 38 "
-"40 37 30 35 38 39 25 42 44 46 43 44 43 41 44 41 40 42 25 45 67 "
-"51 48 46 47 50 67 48 45 47 46 44 50 49 52 49 50 47 67 62 51 62 "
-"54 51 56 52 49 54 62 55 55 64 61 60 61 59 53 56 49 56 53 63 63 "
-"57 65 65 58 69 65 57 58 70 59 61 59 69 58 64 55 62 67 45 25 67 "
-"66 62 63 53 57 68 70 61 59 70 69 64 68 61 "
-;
-
-char *VTK_VECTOR_TEXT_104 = (char *) "27 0.889502 "
-"0.24571 -0.07186 0.37143 -0.07186 0.76000 -0.07186 0.88571 -0.07186 0.37605 0.40286 "
-"0.37756 0.40857 0.75538 0.46000 0.88950 0.47714 0.38899 0.48286 0.74538 0.51714 "
-"0.88152 0.54571 0.42439 0.55143 0.72000 0.56914 0.47429 0.59355 0.68000 0.60331 "
-"0.85996 0.61429 0.53143 0.61748 0.61143 0.62379 0.37714 0.63983 0.81714 0.67296 "
-"0.45714 0.70045 0.77714 0.70213 0.50857 0.72437 0.68571 0.73538 0.58857 0.74152 "
-"0.24571 1.02615 0.37143 1.02615 25 0 "
-"4 25 4 18 25 6 2 3 9 6 7 7 6 3 18 8 11 18 11 13 9 "
-"15 12 12 19 14 10 9 7 18 13 20 8 4 5 15 9 10 4 0 1 18 "
-"4 8 17 24 16 19 21 14 14 23 17 20 16 22 16 20 13 19 12 15 17 "
-"23 24 23 14 21 24 22 16 18 26 25 "
-;
-
-char *VTK_VECTOR_TEXT_105 = (char *) "8 0.377143 "
-"0.25143 -0.07186 0.37714 -0.07186 0.25143 0.72329 0.37714 0.72329 0.25143 0.87403 "
-"0.37714 0.87403 0.25143 1.02615 0.37714 1.02615 4 3 2 0 3 0 "
-"1 4 5 6 7 6 5 "
-;
-
-char *VTK_VECTOR_TEXT_106 = (char *) "18 0.375625 "
-"0.14857 -0.39563 0.22286 -0.39252 0.07383 -0.38000 0.26857 -0.37914 0.31429 -0.34989 "
-"0.34036 -0.31714 0.18857 -0.27462 0.10286 -0.26950 0.36109 -0.26571 0.22331 -0.24857 "
-"0.37563 -0.16857 0.24152 -0.16286 0.24571 0.72329 0.37143 0.72329 0.24571 0.87403 "
-"0.37143 0.87403 0.24571 1.02615 0.37143 1.02615 14 1 6 0 3 6 1 4 6 "
-"3 9 10 11 7 0 6 7 2 0 "
-"9 5 8 5 9 4 6 4 9 9 8 "
-"10 11 10 12 13 12 10 14 15 16 "
-"17 16 15 "
-;
-
-char *VTK_VECTOR_TEXT_107 = (char *) "15 0.897876 "
-"0.37450 -0.07143 0.89788 -0.07143 0.24571 -0.06878 0.73714 -0.07035 0.38004 0.24286 "
-"0.68421 0.25429 0.68045 0.26000 0.68000 0.26064 0.46857 0.32924 0.38286 0.40888 "
-"0.57152 0.42571 0.69714 0.72283 0.86359 0.72286 0.24836 1.02571 0.37714 1.02307 13 2 9 13 4 2 0 5 8 3 5 "
-"3 1 5 6 7 9 14 13 11 9 10 5 7 8 7 10 8 8 9 4 12 "
-"11 10 9 8 10 2 4 9 "
-;
-
-char *VTK_VECTOR_TEXT_108 = (char *) "4 0.371429 "
-"0.36878 -0.07143 0.24000 -0.06878 0.24265 1.02571 0.37143 1.02307 2 1 3 2 3 1 0 "
-;
-
-char *VTK_VECTOR_TEXT_109 = (char *) "45 1.318074 "
-"0.24571 -0.07186 0.37143 -0.07186 0.72000 -0.07295 1.18857 -0.07186 1.31429 -0.07186 "
-"0.71429 -0.06878 0.84571 -0.06878 0.37866 0.37429 0.84723 0.40286 0.85335 0.46000 "
-"0.39109 0.48286 0.71277 0.48286 1.18437 0.48286 1.31807 0.52286 0.87787 0.53429 "
-"0.41143 0.53493 1.17395 0.54000 0.43582 0.56857 0.68784 0.56857 1.14857 0.58403 "
-"0.93143 0.59188 0.66286 0.59829 0.82857 0.60801 0.51009 0.61429 0.36571 0.61924 "
-"0.63429 0.61470 1.09714 0.61580 1.29355 0.62000 0.56000 0.62420 1.00571 0.62152 "
-"1.06286 0.62379 0.41311 0.67143 0.78857 0.66975 1.25561 0.67714 0.90857 0.68902 "
-"0.74286 0.70784 1.20571 0.71355 0.35735 0.72286 0.24571 0.72329 0.50286 0.72498 "
-"0.99429 0.73109 1.16000 0.73109 0.67429 0.73470 0.57714 0.74109 1.05143 0.74152 43 6 5 2 0 7 38 8 11 5 7 0 1 8 5 6 12 3 4 12 "
-"13 16 9 11 8 15 17 24 11 22 18 22 20 34 11 9 22 14 22 9 13 "
-"12 4 24 17 31 7 10 38 10 15 24 16 27 19 32 21 18 24 37 38 20 "
-"22 14 10 24 38 27 16 13 31 23 39 26 41 30 30 40 29 32 18 22 41 "
-"19 36 34 29 40 19 41 26 36 19 33 23 31 17 35 21 32 29 34 20 39 "
-"28 43 33 19 27 43 28 42 25 42 28 28 39 23 42 25 21 42 21 35 44 "
-"30 41 30 44 40 "
-;
-
-char *VTK_VECTOR_TEXT_110 = (char *) "38 0.889911 "
-"0.24571 -0.07186 0.37143 -0.07186 0.75429 -0.07186 0.88571 -0.07186 0.24152 -0.06571 "
-"0.37563 -0.06571 0.75009 -0.06571 0.88991 -0.06571 0.37605 0.40286 0.37866 0.41429 "
-"0.38134 0.44857 0.74665 0.48286 0.88950 0.48286 0.39849 0.51143 0.73229 0.54000 "
-"0.88420 0.54000 0.43011 0.56286 0.46286 0.58893 0.69714 0.58725 0.87008 0.59143 "
-"0.51580 0.61429 0.65143 0.61343 0.36571 0.62031 0.56571 0.62420 0.60571 0.62379 "
-"0.61714 0.62152 0.62286 0.62109 0.83955 0.64857 0.40725 0.66571 0.79429 0.69179 "
-"0.45714 0.70213 0.24152 0.71714 0.75429 0.71355 0.35735 0.72286 0.24571 0.72329 "
-"0.52571 0.73050 0.68571 0.73538 0.58857 0.74152 36 1 4 0 "
-"3 6 2 1 5 4 3 7 6 6 12 "
-"11 11 15 14 6 7 12 22 16 28 "
-"10 8 9 13 22 10 10 22 8 8 4 "
-"5 15 11 12 8 22 4 14 15 19 "
-"14 19 18 25 26 24 16 22 13 16 17 "
-"28 30 28 17 27 18 19 32 23 24 "
-"29 18 27 30 20 35 18 32 21 31 4 "
-"22 20 30 17 32 26 21 32 24 26 "
-"32 18 29 34 31 33 33 31 22 35 23 "
-"37 23 35 20 36 23 32 37 23 36 "
-;
-
-char *VTK_VECTOR_TEXT_111 = (char *) "65 0.938661 "
-"0.53143 -0.08966 0.59429 -0.09009 0.69143 -0.07101 0.41143 -0.06213 0.76571 -0.03759 "
-"0.34857 -0.02821 0.81714 -0.00099 0.29143 0.02154 0.54286 0.02193 0.60571 0.02420 "
-"0.50857 0.02823 0.64571 0.03563 0.86331 0.04857 0.45143 0.05216 0.25714 0.06636 "
-"0.70857 0.07330 0.89229 0.09429 0.40000 0.09597 0.22771 0.12286 0.38036 0.12286 "
-"0.37714 0.12793 0.37669 0.12857 0.75473 0.12857 0.76657 0.15143 0.77101 0.16286 "
-"0.77355 0.16857 0.92319 0.18000 0.20764 0.18571 0.34816 0.19714 0.78605 0.20857 "
-"0.33563 0.26000 0.19320 0.28286 0.93823 0.28857 0.79848 0.29429 0.33295 0.36286 "
-"0.93866 0.37429 0.19580 0.39714 0.79538 0.39714 0.35277 0.47143 0.92319 0.47143 "
-"0.21184 0.48286 0.77143 0.48947 0.23216 0.54000 0.38742 0.54000 0.89927 0.54000 "
-"0.74286 0.54057 0.71429 0.57275 0.42286 0.57813 0.87678 0.58000 0.27429 0.60984 "
-"0.48571 0.61580 0.64571 0.61580 0.54286 0.62950 0.58857 0.62950 0.60000 0.62723 "
-"0.60571 0.62680 0.83225 0.63714 0.31025 0.64857 0.34857 0.67864 0.75429 0.69641 "
-"0.40000 0.70784 0.45143 0.72605 0.68571 0.72538 0.53714 0.74152 0.60000 0.74109 65 11 4 15 8 "
-"0 1 17 7 5 11 2 4 2 9 1 8 1 9 0 8 10 0 10 3 2 "
-"11 9 3 13 5 10 13 3 6 12 22 6 15 4 15 6 22 18 28 27 17 "
-"5 13 14 19 18 16 23 22 19 7 17 7 19 14 18 19 21 24 23 25 25 "
-"23 16 19 20 21 16 22 12 26 29 25 27 30 31 26 25 16 28 18 21 29 "
-"26 33 30 27 28 31 34 36 33 32 35 26 32 33 34 31 30 33 35 37 40 "
-"36 34 37 39 41 40 38 42 39 37 35 47 57 43 38 40 34 43 49 42 46 "
-"45 56 39 44 41 41 48 45 43 57 49 41 44 48 43 42 38 57 47 58 54 "
-"55 53 56 45 48 50 60 47 64 63 53 64 55 62 53 63 52 59 62 51 61 "
-"60 50 64 53 55 51 62 55 52 61 50 59 46 56 61 52 63 46 59 51 58 "
-"47 60 "
-;
-
-char *VTK_VECTOR_TEXT_112 = (char *) "49 0.935625 "
-"0.24571 -0.37740 0.37454 -0.37429 0.56000 -0.08966 0.66857 -0.07966 0.47429 -0.06657 "
-"0.75429 -0.04331 0.37584 -0.00286 0.80571 -0.00704 0.38286 0.00159 0.59429 0.02152 "
-"0.52000 0.02891 0.63429 0.02992 0.85964 0.05429 0.45143 0.06725 0.70857 0.07330 "
-"0.39787 0.13429 0.39514 0.14000 0.39216 0.14571 0.76213 0.14571 0.90538 0.14571 "
-"0.37462 0.19714 0.78327 0.20857 0.92680 0.22571 0.36379 0.27143 0.36152 0.28286 "
-"0.79580 0.29429 0.93563 0.30000 0.36379 0.36857 0.79580 0.36857 0.92680 0.43714 "
-"0.78286 0.45547 0.38286 0.47232 0.75429 0.52921 0.41714 0.54057 0.88571 0.56444 "
-"0.44571 0.57582 0.69143 0.59964 0.51429 0.62213 0.65143 0.62213 0.36571 0.63051 "
-"0.56571 0.63563 0.82704 0.64857 0.45714 0.70784 0.74857 0.70657 0.24571 0.72329 "
-"0.36000 0.72329 0.51429 0.73177 0.69143 0.72899 0.62286 0.74152 49 0 1 6 0 24 44 3 9 2 2 10 4 3 11 9 4 "
-"13 8 10 2 9 11 5 14 11 3 5 7 14 5 4 10 13 14 12 18 14 "
-"7 12 0 20 24 15 8 13 8 15 6 19 18 12 18 19 21 21 22 25 24 "
-"27 44 17 15 16 22 21 19 28 25 26 22 26 25 6 15 17 29 30 28 23 "
-"24 20 20 6 17 29 28 26 30 34 32 27 31 44 0 6 20 31 39 44 32 "
-"41 36 41 32 34 31 33 39 42 37 46 39 35 42 34 30 29 39 33 35 38 "
-"47 40 35 37 42 47 38 43 40 46 37 43 36 41 39 45 44 46 40 48 48 "
-"40 47 38 36 43 "
-;
-
-char *VTK_VECTOR_TEXT_113 = (char *) "52 0.885714 "
-"0.76000 -0.37740 0.88571 -0.37740 0.56571 -0.09009 0.45143 -0.07673 0.65143 -0.06784 "
-"0.36000 -0.03188 0.70857 -0.03465 0.75580 -0.00286 0.74857 0.00454 0.29714 0.02418 "
-"0.54286 0.02152 0.57714 0.02193 0.58857 0.02420 0.59429 0.02462 0.47429 0.03927 "
-"0.64571 0.04371 0.43302 0.06571 0.70670 0.09429 0.23914 0.11143 0.38607 0.11714 "
-"0.38286 0.12221 0.38241 0.12286 0.75008 0.17429 0.21101 0.19143 0.34748 0.20857 "
-"0.76723 0.25429 0.19848 0.26000 0.76723 0.27143 0.33605 0.28286 0.76991 0.28857 "
-"0.19580 0.37429 0.33866 0.40286 0.75429 0.45277 0.21101 0.47143 0.35429 0.47832 "
-"0.73143 0.51301 0.39846 0.56286 0.69296 0.56857 0.25669 0.58571 0.45143 0.60902 "
-"0.61714 0.62213 0.49143 0.62723 0.76571 0.62602 0.29330 0.63714 0.56571 0.63522 "
-"0.72403 0.67143 0.36571 0.69641 0.66286 0.71355 0.77408 0.72286 0.88571 0.72329 "
-"0.44571 0.72966 0.56000 0.74152 52 29 27 25 "
-"49 42 32 22 7 25 3 13 11 2 13 "
-"3 4 13 2 6 15 4 11 13 12 "
-"3 14 5 13 4 15 10 3 11 15 6 "
-"8 14 3 10 15 8 17 24 23 18 "
-"5 16 9 17 8 22 14 16 5 9 19 "
-"18 19 20 21 18 19 21 42 35 32 "
-"7 22 8 16 19 9 49 48 42 7 0 "
-"1 24 18 21 23 24 26 26 28 30 "
-"28 26 24 30 31 33 34 33 31 31 30 "
-"28 33 34 38 49 29 25 36 43 38 "
-"49 25 7 35 42 37 37 45 40 45 37 "
-"42 29 49 32 45 47 40 39 43 36 "
-"46 39 50 40 47 44 43 39 46 36 38 "
-"34 41 44 51 41 50 39 49 7 1 "
-"50 41 51 51 44 47 "
-;
-
-char *VTK_VECTOR_TEXT_114 = (char *) "24 0.667686 "
-"0.24571 -0.07186 0.37143 -0.07186 0.24152 -0.06571 0.37563 -0.06571 0.37563 0.38000 "
-"0.39748 0.50000 0.41964 0.54571 0.44740 0.57429 0.61714 0.57787 0.62286 0.57880 "
-"0.48000 0.59294 0.57714 0.59395 0.51429 0.60134 0.36571 0.61385 0.41868 0.68857 "
-"0.66769 0.69429 0.66542 0.70000 0.24152 0.71714 0.35735 0.72286 0.24571 0.72329 "
-"0.46286 0.72436 0.60000 0.73109 0.51429 0.74109 0.55429 0.74109 22 1 2 0 "
-"1 3 2 4 2 3 5 6 13 5 13 "
-"17 21 11 15 2 4 17 4 5 17 "
-"6 7 13 18 17 13 7 10 14 13 7 "
-"14 14 12 20 11 21 12 9 15 11 "
-"12 14 10 19 17 18 20 12 22 8 9 "
-"11 21 15 16 22 12 23 23 12 21 "
-;
-
-char *VTK_VECTOR_TEXT_115 = (char *) "63 0.849502 "
-"0.56000 -0.09009 0.46286 -0.08705 0.65143 -0.07395 0.37143 -0.06723 0.70444 -0.05429 "
-"0.33143 -0.04943 0.76057 -0.02000 0.28571 -0.01813 0.79582 0.01429 0.50286 0.02152 "
-"0.55429 0.02152 0.56571 0.02379 0.57714 0.02420 0.24571 0.02636 0.64000 0.04200 "
-"0.41714 0.04371 0.22200 0.06571 0.38286 0.06725 0.68384 0.07714 0.83580 0.08286 "
-"0.69927 0.10000 0.34200 0.12286 0.84950 0.14000 0.71009 0.15714 0.19109 0.16286 "
-"0.19370 0.16857 0.32000 0.18615 0.69864 0.19143 0.84723 0.20286 0.65714 0.22784 "
-"0.83641 0.24286 0.80956 0.28857 0.34286 0.32371 0.75429 0.33641 0.30286 0.34421 "
-"0.69143 0.36327 0.25714 0.38445 0.22645 0.43714 0.41143 0.44538 0.37587 0.46571 "
-"0.35885 0.48286 0.21295 0.49429 0.69143 0.50460 0.34478 0.51714 0.81977 0.52286 "
-"0.67514 0.55143 0.35216 0.56286 0.22034 0.56857 0.64000 0.59465 0.38286 0.59829 "
-"0.79429 0.61016 0.24000 0.61573 0.42857 0.62041 0.58286 0.62252 0.48571 0.62991 "
-"0.74689 0.67143 0.28571 0.67258 0.70286 0.70045 0.33714 0.70613 0.38857 0.72538 "
-"0.61714 0.73050 0.47429 0.74109 0.54286 0.74109 61 2 12 0 10 1 12 12 2 14 14 4 6 7 17 13 0 "
-"12 1 4 14 2 11 10 12 15 3 1 3 15 5 9 1 10 14 6 18 15 "
-"1 9 17 5 15 6 8 18 5 17 7 21 16 13 16 21 24 18 8 20 23 "
-"28 27 21 13 17 19 22 23 26 25 21 21 25 24 20 19 23 19 20 8 28 "
-"23 22 27 33 29 28 30 27 31 27 30 27 31 33 29 38 32 35 29 33 29 "
-"35 38 34 38 36 32 38 34 36 40 37 39 36 38 41 43 47 43 41 37 36 "
-"39 40 50 45 42 43 37 40 47 46 51 46 47 43 53 60 54 45 57 48 52 "
-"58 49 45 55 57 51 49 56 49 51 46 50 42 44 48 57 53 56 49 58 55 "
-"45 50 52 59 58 59 52 61 52 54 61 60 53 57 61 54 62 62 54 60 "
-;
-
-char *VTK_VECTOR_TEXT_116 = (char *) "24 0.551972 "
-"0.42286 -0.08395 0.48000 -0.08437 0.55197 -0.07143 0.33714 -0.05914 0.29901 -0.02571 "
-"0.28041 0.00857 0.44571 0.04816 0.44453 0.04857 0.53714 0.04344 0.44000 0.05008 "
-"0.41057 0.07714 0.26748 0.10000 0.40152 0.11714 0.26597 0.61429 0.40260 0.61429 "
-"0.17143 0.61957 0.53450 0.62000 0.53866 0.71714 0.53450 0.72286 0.17143 0.72329 "
-"0.26597 0.72857 0.40260 0.72857 0.26748 0.91714 0.40000 0.99545 22 10 5 4 "
-"6 7 9 10 4 3 10 3 9 8 6 "
-"1 6 9 1 5 10 11 8 1 2 "
-"0 9 3 11 12 13 0 1 9 10 12 "
-"11 17 18 16 14 13 12 21 14 16 "
-"18 21 16 22 20 23 20 13 14 15 20 "
-"19 15 13 20 20 14 21 23 20 21 "
-;
-
-char *VTK_VECTOR_TEXT_117 = (char *) "38 0.884197 "
-"0.48571 -0.09009 0.53714 -0.09009 0.41714 -0.07673 0.77143 -0.07295 0.88000 -0.07186 "
-"0.63518 -0.06571 0.76571 -0.06878 0.88420 -0.06571 0.34857 -0.04771 0.70857 -0.01846 "
-"0.29901 -0.00857 0.27429 0.02730 0.52000 0.02723 0.56000 0.02764 0.47339 0.03714 "
-"0.76000 0.03684 0.61714 0.04135 0.43943 0.05429 0.65143 0.05787 0.41330 0.07714 "
-"0.25143 0.08437 0.69143 0.08704 0.39343 0.10571 0.38899 0.11714 0.71473 0.11714 "
-"0.38645 0.12286 0.73294 0.15714 0.23848 0.17429 0.37563 0.17429 0.75009 0.26000 "
-"0.23848 0.71714 0.37295 0.71714 0.75009 0.71714 0.88420 0.71714 0.24265 0.72286 "
-"0.36878 0.72286 0.75429 0.72329 0.88000 0.72329 36 6 3 15 "
-"3 7 15 3 4 7 8 17 10 2 14 "
-"17 2 17 8 5 13 1 19 11 10 "
-"9 16 5 12 1 13 0 12 2 12 0 "
-"1 9 18 16 13 5 16 14 2 12 "
-"11 22 20 21 18 9 15 21 9 21 15 "
-"24 20 28 27 11 19 22 24 7 26 "
-"19 10 17 24 15 7 25 22 23 20 22 "
-"25 20 25 28 26 7 29 31 30 27 "
-"33 29 7 34 31 35 34 30 31 31 27 "
-"28 36 33 37 32 29 33 36 32 33 "
-;
-
-char *VTK_VECTOR_TEXT_118 = (char *) "12 0.884203 "
-"0.45714 -0.06947 0.58857 -0.07103 0.52000 0.09808 0.52571 0.09808 0.47580 0.23714 "
-"0.16151 0.71714 0.88420 0.71714 0.16427 0.72286 0.30286 0.71951 0.74857 0.72090 "
-"0.88145 0.72286 0.29714 0.72395 10 4 0 "
-"2 0 4 5 3 2 0 1 3 0 "
-"3 6 9 8 11 5 9 6 10 7 5 "
-"11 8 5 4 3 1 6 "
-;
-
-char *VTK_VECTOR_TEXT_119 = (char *) "14 1.231638 "
-"0.39429 -0.07215 0.52571 -0.07215 0.97714 -0.07252 0.84571 -0.06947 0.45714 0.10650 "
-"0.46286 0.10650 0.92000 0.12073 0.69143 0.52785 0.15122 0.72286 0.28571 0.72090 "
-"0.62857 0.72243 0.76193 0.72286 1.23164 0.72286 1.10857 0.72329 12 "
-"2 6 3 0 4 8 3 6 7 5 0 "
-"1 12 13 6 5 4 0 7 10 5 "
-"11 10 7 7 5 1 11 7 6 4 9 "
-"8 12 6 2 "
-;
-
-char *VTK_VECTOR_TEXT_120 = (char *) "17 0.882498 "
-"0.15697 -0.07143 0.88073 -0.07143 0.15473 -0.06571 0.31429 -0.07035 0.72571 -0.07140 "
-"0.88250 -0.06571 0.52000 0.22529 0.52571 0.22529 0.60332 0.33429 0.43534 0.34000 "
-"0.51429 0.45005 0.17188 0.71714 0.86812 0.71714 0.17412 0.72286 0.86588 0.72286 "
-"0.32571 0.72395 0.71429 0.72395 15 1 5 4 2 6 9 8 6 7 3 2 0 4 8 7 6 2 3 4 "
-"5 8 8 10 6 10 9 6 15 11 9 16 10 8 15 9 10 12 16 8 13 "
-"11 15 16 12 14 "
-;
-
-char *VTK_VECTOR_TEXT_121 = (char *) "16 0.888063 "
-"0.34286 -0.39563 0.24000 -0.38043 0.41714 -0.37641 0.45714 -0.34956 0.50436 -0.29429 "
-"0.32000 -0.26680 0.22286 -0.25766 0.36652 -0.25429 0.54371 -0.22000 0.41293 -0.21429 "
-"0.46848 -0.07714 0.53714 0.09292 0.16998 0.72286 0.30857 0.71999 0.76000 0.72246 "
-"0.88806 0.72286 14 2 7 0 0 5 1 5 0 7 "
-"6 1 5 3 7 2 7 3 9 3 4 "
-"9 9 8 10 9 4 8 10 11 12 "
-"11 15 14 11 8 15 11 10 8 11 13 "
-"12 "
-;
-
-char *VTK_VECTOR_TEXT_122 = (char *) "17 0.872768 "
-"0.17714 -0.07295 0.86857 -0.07186 0.17143 -0.06878 0.87277 -0.06571 0.17146 0.03714 "
-"0.34212 0.03714 0.87277 0.03714 0.34132 0.04286 0.44000 0.04327 0.86857 0.04329 "
-"0.20571 0.61689 0.67062 0.62000 0.84991 0.64286 0.20152 0.71714 0.84991 0.71714 "
-"0.20571 0.72329 0.84571 0.72329 15 2 0 4 0 1 9 0 5 4 1 3 9 5 0 8 5 7 4 0 "
-"9 8 3 6 9 12 14 11 11 14 16 11 16 10 12 11 7 11 4 7 10 "
-"15 13 15 10 16 "
-;
-
-char *VTK_VECTOR_TEXT_123 = (char *) "39 0.611429 "
-"0.61143 -0.39454 0.46857 -0.38420 0.40000 -0.34154 0.61143 -0.27975 0.35748 -0.27143 "
-"0.52000 -0.26992 0.47787 -0.23143 0.46748 -0.19143 0.34134 -0.18000 0.46395 0.04286 "
-"0.33563 0.05429 0.45184 0.14571 0.32109 0.16286 0.29143 0.21832 0.42286 0.22716 "
-"0.25143 0.24943 0.18857 0.26528 0.39429 0.26698 0.31413 0.32286 0.18857 0.38615 "
-"0.25143 0.40073 0.41188 0.40286 0.29143 0.42775 0.43514 0.44286 0.32823 0.49429 "
-"0.45866 0.52286 0.34134 0.60286 0.46705 0.80857 0.34478 0.84857 0.47748 0.87143 "
-"0.35748 0.91143 0.50286 0.90821 0.50793 0.91143 0.50857 0.91188 0.61143 0.92814 "
-"0.40571 0.99511 0.46857 1.03294 0.53143 1.04437 0.61143 1.04329 37 0 3 5 6 2 5 2 6 4 0 5 1 2 "
-"1 5 4 7 8 7 4 6 8 9 10 10 11 12 9 8 7 11 10 9 12 "
-"17 13 12 14 17 14 12 11 18 15 13 16 15 20 18 13 17 16 20 19 15 "
-"18 20 21 22 18 22 21 24 22 20 18 24 25 26 23 24 21 25 24 23 26 "
-"27 28 27 26 25 28 29 30 29 28 27 30 29 35 31 32 33 36 31 33 31 "
-"36 29 36 33 37 34 38 37 35 29 36 34 37 33 "
-;
-
-char *VTK_VECTOR_TEXT_124 = (char *) "4 0.388571 "
-"0.28571 -0.39454 0.38857 -0.39563 0.28571 1.04329 0.38857 1.04437 2 3 2 0 3 0 1 "
-;
-
-char *VTK_VECTOR_TEXT_125 = (char *) "35 0.606299 "
-"0.17714 -0.39454 0.31429 -0.38613 0.39429 -0.33832 0.17714 -0.27975 0.27429 -0.26784 "
-"0.43681 -0.26000 0.31070 -0.23714 0.44950 -0.19714 0.32723 -0.15714 0.45295 0.04857 "
-"0.33295 0.11714 0.46857 0.16404 0.35387 0.19714 0.51429 0.23258 0.56000 0.25681 "
-"0.39429 0.26403 0.60630 0.26571 0.47702 0.32857 0.41714 0.36742 0.60571 0.38615 "
-"0.54857 0.39927 0.50171 0.43143 0.36086 0.43714 0.46748 0.50000 0.32991 0.56857 "
-"0.45252 0.78571 0.32723 0.80286 0.31748 0.87143 0.29143 0.90893 0.43470 0.91714 "
-"0.17714 0.92814 0.41629 0.95714 0.36571 1.01107 0.32000 1.03294 0.17714 1.04329 33 4 3 0 2 4 1 6 7 8 1 4 0 2 6 4 5 "
-"6 2 6 5 7 8 9 10 9 8 7 10 11 12 15 13 17 11 10 9 12 "
-"11 15 13 14 17 13 15 11 20 17 14 20 14 16 19 20 16 21 17 20 17 "
-"21 18 22 23 24 22 18 21 23 22 21 25 26 24 25 24 23 29 27 26 29 "
-"26 25 27 31 28 31 27 29 32 28 31 28 33 30 33 34 30 33 28 32 "
-;
-
-char *VTK_VECTOR_TEXT_126 = (char *) "25 0.971429 "
-"0.73714 0.34462 0.20759 0.35143 0.21143 0.34662 0.81143 0.34723 0.66857 0.35756 "
-"0.86857 0.36135 0.25143 0.38115 0.90857 0.38086 0.52000 0.41580 0.32571 0.42723 "
-"0.97140 0.43143 0.37143 0.43866 0.42286 0.44093 0.79429 0.49009 0.21028 0.50000 "
-"0.72571 0.49681 0.86286 0.50930 0.25714 0.54115 0.92571 0.54759 0.32571 0.57470 "
-"0.50286 0.57621 0.96571 0.58154 0.97143 0.58073 0.38857 0.58680 0.44000 0.58723 23 1 17 14 8 4 15 13 5 7 6 1 2 5 "
-"13 3 1 6 17 3 13 0 16 10 18 15 4 0 13 7 16 15 0 13 8 "
-"20 12 12 20 11 9 17 6 10 16 7 17 9 19 22 21 18 11 20 24 11 "
-"19 9 20 8 15 11 24 23 22 18 10 11 23 19 "
-;
-
-
-// Construct object with no string set and backing enabled.
-VTKViewer_VectorText::VTKViewer_VectorText()
-{
- this->Text = NULL;
-
- this->Letters[33] = VTK_VECTOR_TEXT_33;
- this->Letters[34] = VTK_VECTOR_TEXT_34;
- this->Letters[35] = VTK_VECTOR_TEXT_35;
- this->Letters[36] = VTK_VECTOR_TEXT_36;
- this->Letters[37] = VTK_VECTOR_TEXT_37;
- this->Letters[38] = VTK_VECTOR_TEXT_38;
- this->Letters[39] = VTK_VECTOR_TEXT_39;
- this->Letters[40] = VTK_VECTOR_TEXT_40;
- this->Letters[41] = VTK_VECTOR_TEXT_41;
- this->Letters[42] = VTK_VECTOR_TEXT_42;
- this->Letters[43] = VTK_VECTOR_TEXT_43;
- this->Letters[44] = VTK_VECTOR_TEXT_44;
- this->Letters[45] = VTK_VECTOR_TEXT_45;
- this->Letters[46] = VTK_VECTOR_TEXT_46;
- this->Letters[47] = VTK_VECTOR_TEXT_47;
- this->Letters[48] = VTK_VECTOR_TEXT_48;
- this->Letters[49] = VTK_VECTOR_TEXT_49;
- this->Letters[50] = VTK_VECTOR_TEXT_50;
- this->Letters[51] = VTK_VECTOR_TEXT_51;
- this->Letters[52] = VTK_VECTOR_TEXT_52;
- this->Letters[53] = VTK_VECTOR_TEXT_53;
- this->Letters[54] = VTK_VECTOR_TEXT_54;
- this->Letters[55] = VTK_VECTOR_TEXT_55;
- this->Letters[56] = VTK_VECTOR_TEXT_56;
- this->Letters[57] = VTK_VECTOR_TEXT_57;
- this->Letters[58] = VTK_VECTOR_TEXT_58;
- this->Letters[59] = VTK_VECTOR_TEXT_59;
- this->Letters[60] = VTK_VECTOR_TEXT_60;
- this->Letters[61] = VTK_VECTOR_TEXT_61;
- this->Letters[62] = VTK_VECTOR_TEXT_62;
- this->Letters[63] = VTK_VECTOR_TEXT_63;
- this->Letters[64] = VTK_VECTOR_TEXT_64;
- this->Letters[65] = VTK_VECTOR_TEXT_65;
- this->Letters[66] = VTK_VECTOR_TEXT_66;
- this->Letters[67] = VTK_VECTOR_TEXT_67;
- this->Letters[68] = VTK_VECTOR_TEXT_68;
- this->Letters[69] = VTK_VECTOR_TEXT_69;
- this->Letters[70] = VTK_VECTOR_TEXT_70;
- this->Letters[71] = VTK_VECTOR_TEXT_71;
- this->Letters[72] = VTK_VECTOR_TEXT_72;
- this->Letters[73] = VTK_VECTOR_TEXT_73;
- this->Letters[74] = VTK_VECTOR_TEXT_74;
- this->Letters[75] = VTK_VECTOR_TEXT_75;
- this->Letters[76] = VTK_VECTOR_TEXT_76;
- this->Letters[77] = VTK_VECTOR_TEXT_77;
- this->Letters[78] = VTK_VECTOR_TEXT_78;
- this->Letters[79] = VTK_VECTOR_TEXT_79;
- this->Letters[80] = VTK_VECTOR_TEXT_80;
- this->Letters[81] = VTK_VECTOR_TEXT_81;
- this->Letters[82] = VTK_VECTOR_TEXT_82;
- this->Letters[83] = VTK_VECTOR_TEXT_83;
- this->Letters[84] = VTK_VECTOR_TEXT_84;
- this->Letters[85] = VTK_VECTOR_TEXT_85;
- this->Letters[86] = VTK_VECTOR_TEXT_86;
- this->Letters[87] = VTK_VECTOR_TEXT_87;
- this->Letters[88] = VTK_VECTOR_TEXT_88;
- this->Letters[89] = VTK_VECTOR_TEXT_89;
- this->Letters[90] = VTK_VECTOR_TEXT_90;
- this->Letters[91] = VTK_VECTOR_TEXT_91;
- this->Letters[92] = VTK_VECTOR_TEXT_92;
- this->Letters[93] = VTK_VECTOR_TEXT_93;
- this->Letters[94] = VTK_VECTOR_TEXT_94;
- this->Letters[95] = VTK_VECTOR_TEXT_95;
- this->Letters[96] = VTK_VECTOR_TEXT_96;
- this->Letters[97] = VTK_VECTOR_TEXT_97;
- this->Letters[98] = VTK_VECTOR_TEXT_98;
- this->Letters[99] = VTK_VECTOR_TEXT_99;
- this->Letters[100] = VTK_VECTOR_TEXT_100;
- this->Letters[101] = VTK_VECTOR_TEXT_101;
- this->Letters[102] = VTK_VECTOR_TEXT_102;
- this->Letters[103] = VTK_VECTOR_TEXT_103;
- this->Letters[104] = VTK_VECTOR_TEXT_104;
- this->Letters[105] = VTK_VECTOR_TEXT_105;
- this->Letters[106] = VTK_VECTOR_TEXT_106;
- this->Letters[107] = VTK_VECTOR_TEXT_107;
- this->Letters[108] = VTK_VECTOR_TEXT_108;
- this->Letters[109] = VTK_VECTOR_TEXT_109;
- this->Letters[110] = VTK_VECTOR_TEXT_110;
- this->Letters[111] = VTK_VECTOR_TEXT_111;
- this->Letters[112] = VTK_VECTOR_TEXT_112;
- this->Letters[113] = VTK_VECTOR_TEXT_113;
- this->Letters[114] = VTK_VECTOR_TEXT_114;
- this->Letters[115] = VTK_VECTOR_TEXT_115;
- this->Letters[116] = VTK_VECTOR_TEXT_116;
- this->Letters[117] = VTK_VECTOR_TEXT_117;
- this->Letters[118] = VTK_VECTOR_TEXT_118;
- this->Letters[119] = VTK_VECTOR_TEXT_119;
- this->Letters[120] = VTK_VECTOR_TEXT_120;
- this->Letters[121] = VTK_VECTOR_TEXT_121;
- this->Letters[122] = VTK_VECTOR_TEXT_122;
- this->Letters[123] = VTK_VECTOR_TEXT_123;
- this->Letters[124] = VTK_VECTOR_TEXT_124;
- this->Letters[125] = VTK_VECTOR_TEXT_125;
- this->Letters[126] = VTK_VECTOR_TEXT_126;
-
-}
-
-void VTKViewer_VectorText::Execute()
-{
- vtkPolyData *output = this->GetOutput();
- vtkPoints *newPoints;
- vtkCellArray *newPolys;
- int ptOffset = 0;
- int aPoint, i;
- int pos = 0;
- float xpos = 0;
- float ypos = 0;
- int ptCount, triCount;
- char *aLetter;
- float width;
- float ftmp[3];
-
- if (this->Text == NULL)
- {
- vtkErrorMacro (<< "Text is not set!");
- return;
- }
-
- // Set things up; allocate memory
- newPoints = vtkPoints::New();
- newPolys = vtkCellArray::New();
- ftmp[2] = 0.0;
-
- // Create Text
- while (this->Text[pos])
- {
- switch (this->Text[pos])
- {
- case 32:
- xpos += 0.4;
- break;
-
- case 10:
- ypos -= 1.4;
- xpos = 0;
- break;
-
- default:
- // if we have a valid character
- if ((this->Text[pos] > 32)&&(this->Text[pos] < 127))
- {
- // add the result to our output
- aLetter = this->Letters[this->Text[pos]];
- ptCount = strtol(aLetter,&aLetter,10);
- width = strtod(aLetter,&aLetter);
- for (i = 0; i < ptCount; i++)
- {
- ftmp[0] = strtod(aLetter,&aLetter);
- ftmp[1] = strtod(aLetter,&aLetter);
- ftmp[0] += xpos;
- ftmp[1] += ypos;
- newPoints->InsertNextPoint(ftmp);
- }
- triCount = strtol(aLetter,&aLetter,10);
- for (i = 0; i < triCount; i++)
- {
- newPolys->InsertNextCell(3);
- aPoint = strtol(aLetter,&aLetter,10);
- newPolys->InsertCellPoint(aPoint + ptOffset);
- aPoint = strtol(aLetter,&aLetter,10);
- newPolys->InsertCellPoint(aPoint + ptOffset);
- aPoint = strtol(aLetter,&aLetter,10);
- newPolys->InsertCellPoint(aPoint + ptOffset);
- }
- ptOffset += ptCount;
- xpos += width;
- }
- break;
- }
- pos++;
- }
-
- //
- // Update ourselves and release memory
- //
- output->SetPoints(newPoints);
- newPoints->Delete();
-
- output->SetPolys(newPolys);
- newPolys->Delete();
-}
-
-void VTKViewer_VectorText::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os,indent);
-
- os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
-}
-
-VTKViewer_VectorText::~VTKViewer_VectorText()
-{
- if (this->Text)
- {
- delete [] this->Text;
- }
-}
+++ /dev/null
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-// .NAME vtkVectorText - create polygonal text
-// .SECTION Description
-
-// vtkVectorText generates vtkPolyData from an input text string. Besides the
-// ASCII alphanumeric characters a-z, A-Z, 0-9, vtkVectorText also supports
-// ASCII punctuation marks. (The supported ASCII character set are the codes
-// (33-126) inclusive.) The only control character supported is the line feed
-// character "\n", which advances to a new line.
-//
-// To use thie class, you normally couple it with a vtkPolyDataMapper and a
-// vtkActor. In this case you would use the vtkActor's transformation methods
-// to position, orient, and scale the text. You may also wish to use a
-// vtkFollower to orient the text so that it always faces the camera.
-
-// .SECTION See Also
-// vtkTextMapper vtkCaptionActor2D
-
-// VTKViewer_VectorText.h is a copy of vtkVectorText.h file.
-// Purpose of copying: to remove linking to libHybrid.so VTK library
-
-#ifndef __VTKViewer_VectorText_h
-#define __VTKViewer_VectorText_h
-
-#include "vtkPolyDataSource.h"
-
-class VTKViewer_VectorText : public vtkPolyDataSource
-{
-public:
- static VTKViewer_VectorText *New();
- vtkTypeRevisionMacro(VTKViewer_VectorText,vtkPolyDataSource);
- void PrintSelf(ostream& os, vtkIndent indent);
-
- // Description:
- // Set/Get the text to be drawn.
- vtkSetStringMacro(Text);
- vtkGetStringMacro(Text);
-
-protected:
- VTKViewer_VectorText();
- ~VTKViewer_VectorText();
-
- void Execute();
- char *Text;
- char *Letters[127];
-
-};
-
-#endif
-
-
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_ViewFrame.cxx
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_Utilities.h"
-#include "VTKViewer_Trihedron.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_Algorithm.h"
-#include "VTKViewer_Functor.h"
-#include "VTKViewer_Prs.h"
-
-#include "SALOME_Actor.h"
-#include "SALOME_Transform.h"
-#include "SALOME_TransformFilter.h"
-#include "SALOME_GeometryFilter.h"
-#include "SALOMEGUI.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Config.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "SALOME_Selection.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "ToolsGUI.h"
-#include "SALOMEDS_Tool.hxx"
-
-#include "utilities.h"
-
-//QT Include
-#include <qlayout.h>
-#include <qcolordialog.h>
-#include <qfiledialog.h>
-#include <qapplication.h>
-
-// VTK Includes
-#include <vtkActor.h>
-#include <vtkCamera.h>
-#include <vtkRenderer.h>
-#include <vtkTransform.h>
-#include <vtkActorCollection.h>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-using namespace std;
-
-/*!
- Constructor
-*/
-VTKViewer_ViewFrame::VTKViewer_ViewFrame(QWidget* parent, const char* name)
- : QAD_ViewFrame(parent, name)
-{
- m_ViewUp[0] = 0; m_ViewUp[1] = 0; m_ViewUp[2] = -1;
- m_ViewNormal[0] = 0; m_ViewNormal[1] = 0; m_ViewNormal[2] = 1;
- m_Triedron = VTKViewer_Trihedron::New();
- m_Transform = SALOME_Transform::New();
- //m_Renderer = VTKViewer_Renderer::New() ;
- m_Renderer = vtkRenderer::New() ;
-
- m_Triedron->AddToRender(m_Renderer);
- InitialSetup();
-}
-
-void VTKViewer_ViewFrame::InitialSetup() {
- m_RW = new VTKViewer_RenderWindow(this, "RenderWindow");
- m_RW->getRenderWindow()->AddRenderer(m_Renderer);
-
- m_Renderer->GetActiveCamera()->ParallelProjectionOn();
- m_Renderer->LightFollowCameraOn();
- m_Renderer->TwoSidedLightingOn();
-
- // Set BackgroundColor
- QString BgrColorRed = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
- QString BgrColorGreen = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorGreen");
- QString BgrColorBlue = QAD_CONFIG->getSetting("VTKViewer:BackgroundColorBlue");
-
- if( !BgrColorRed.isEmpty() && !BgrColorGreen.isEmpty() && !BgrColorBlue.isEmpty() )
- m_Renderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. );
- else
- m_Renderer->SetBackground( 0, 0, 0 );
-
- // Create an interactor.
- m_RWInteractor = VTKViewer_RenderWindowInteractor::New();
- m_RWInteractor->SetRenderWindow(m_RW->getRenderWindow());
-
- VTKViewer_InteractorStyleSALOME* RWS = VTKViewer_InteractorStyleSALOME::New();
- m_RWInteractor->SetInteractorStyle(RWS);
- RWS->Delete();
-
- m_RWInteractor->setGUIWindow(m_RW);
- RWS->setGUIWindow(m_RW);
-
- m_RWInteractor->Initialize();
- m_RWInteractor->setViewFrame(this);
- RWS->setTriedron(m_Triedron);
- RWS->setViewFrame(this);
- //SRN: additional initialization, to init CurrentRenderer of vtkInteractorStyle
- RWS->FindPokedRenderer(0, 0);
-
- setCentralWidget( m_RW );
- onViewReset();
-}
-
-VTKViewer_ViewFrame::~VTKViewer_ViewFrame() {
- // In order to ensure that the interactor unregisters
- // this RenderWindow, we assign a NULL RenderWindow to
- // it before deleting it.
- m_RWInteractor->SetRenderWindow(NULL) ;
- m_RWInteractor->Delete() ;
-
- m_Transform->Delete() ;
- //m_RW->Delete() ;
- m_Renderer->RemoveAllProps();
- // NRI : BugID 1137: m_Renderer->Delete() ;
- m_Triedron->Delete();
- INFOS("VTKViewer_ViewFrame::~VTKViewer_ViewFrame()");
-}
-
-/*!
- Returns widget containing 3D-Viewer
-*/
-QWidget* VTKViewer_ViewFrame::getViewWidget(){
- return m_RW;
-}
-
-bool VTKViewer_ViewFrame::isTrihedronDisplayed(){
- return m_Triedron->GetVisibility() == VTKViewer_Trihedron::eOn;
-}
-
-bool VTKViewer_ViewFrame::ComputeTrihedronSize( double& theNewSize, double& theSize )
-{
- // calculating diagonal of visible props of the renderer
- float bnd[ 6 ];
- m_Triedron->VisibilityOff();
- if ( ::ComputeVisiblePropBounds( m_Renderer, bnd ) == 0 )
- {
- bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100;
- bnd[ 0 ] = bnd[ 2 ] = bnd[ 100 ] = 0;
- }
- m_Triedron->VisibilityOn();
- float aLength = 0;
- static bool CalcByDiag = false;
- if ( CalcByDiag )
- {
- aLength = sqrt( ( bnd[1]-bnd[0])*(bnd[1]-bnd[0] )+
- ( bnd[3]-bnd[2])*(bnd[3]-bnd[2] )+
- ( bnd[5]-bnd[4])*(bnd[5]-bnd[4] ) );
- }
- else
- {
- aLength = bnd[ 1 ]-bnd[ 0 ];
- aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength );
- aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength );
- }
-
- static float aSizeInPercents = 105;
- QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
- if ( !aSetting.isEmpty() )
- aSizeInPercents = aSetting.toFloat();
-
- static float EPS_SIZE = 5.0E-3;
- theSize = m_Triedron->GetSize();
- theNewSize = aLength * aSizeInPercents / 100.0;
-
- // if the new trihedron size have sufficient difference, then apply the value
- return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
- fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
-}
-
-double VTKViewer_ViewFrame::GetTrihedronSize() const
-{
- return m_Triedron->GetSize();
-}
-
-void VTKViewer_ViewFrame::AdjustTrihedrons( const bool forcedUpdate )
-{
- if ( !isTrihedronDisplayed() && !forcedUpdate )
- return;
-
- int aVisibleNum = m_Triedron->GetVisibleActorCount( m_Renderer );
- if ( aVisibleNum || forcedUpdate )
- {
- // if the new trihedron size have sufficient difference, then apply the value
- double aNewSize = 100, anOldSize;
- if ( ComputeTrihedronSize( aNewSize, anOldSize ) || forcedUpdate )
- {
- m_Triedron->SetSize( aNewSize );
- // itearte throuh displayed objects and set size if necessary
-
- vtkActorCollection* anActors = getRenderer()->GetActors();
- anActors->InitTraversal();
- while( vtkActor* anActor = anActors->GetNextActor() )
- {
- if( SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast( anActor ) )
- {
- if ( aSActor->IsResizable() )
- aSActor->SetSize( 0.5 * aNewSize );
- }
- }
- }
- }
-
- ::ResetCameraClippingRange(m_Renderer);
-}
-
-void VTKViewer_ViewFrame::onAdjustTrihedron()
-{
- AdjustTrihedrons( false );
-}
-
-/*!
- Display/hide Trihedron
-*/
-void VTKViewer_ViewFrame::onViewTrihedron(){
- if(!m_Triedron) return;
- if(isTrihedronDisplayed())
- m_Triedron->VisibilityOff();
- else{
- m_Triedron->VisibilityOn();
- }
- Repaint();
-}
-
-/*!
- Provides top projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewTop(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,0,1);
- camera->SetViewUp(0,1,0);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Provides bottom projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewBottom(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,0,-1);
- camera->SetViewUp(0,1,0);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Provides left projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewLeft(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,-1,0);
- camera->SetViewUp(0,0,1);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Provides right projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewRight(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(0,1,0);
- camera->SetViewUp(0,0,1);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Provides back projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewBack(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(-1,0,0);
- camera->SetViewUp(0,0,1);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Provides front projection of the active view
-*/
-void VTKViewer_ViewFrame::onViewFront(){
- vtkCamera* camera = m_Renderer->GetActiveCamera();
- camera->SetPosition(1,0,0);
- camera->SetViewUp(0,0,1);
- camera->SetFocalPoint(0,0,0);
- onViewFitAll();
-}
-
-/*!
- Fits all objects in the active view
-*/
-void VTKViewer_ViewFrame::onViewFitAll(){
- m_RWInteractor->GetInteractorStyleSALOME()->ViewFitAll();
- Repaint();
-}
-
-/*!
- Reset the active view
-*/
-void VTKViewer_ViewFrame::onViewReset(){
- int aTriedronIsVisible = isTrihedronDisplayed();
- m_Triedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
- ::ResetCamera(m_Renderer,true);
- vtkCamera* aCamera = m_Renderer->GetActiveCamera();
- aCamera->SetPosition(1,-1,1);
- aCamera->SetViewUp(0,0,1);
- ::ResetCamera(m_Renderer,true);
- if(aTriedronIsVisible) m_Triedron->VisibilityOn();
- else m_Triedron->VisibilityOff();
- static float aCoeff = 3.0;
- aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
- Repaint();
-}
-
-/*!
- Rotates the active view
-*/
-void VTKViewer_ViewFrame::onViewRotate(){
- m_RWInteractor->GetInteractorStyleSALOME()->startRotate();
-}
-
-/*!
- Sets a new center of the active view
-*/
-void VTKViewer_ViewFrame::onViewGlobalPan(){
- if(m_Triedron->GetVisibleActorCount(m_Renderer))
- m_RWInteractor->GetInteractorStyleSALOME()->startGlobalPan();
-}
-
-/*!
- Zooms the active view
-*/
-void VTKViewer_ViewFrame::onViewZoom(){
- m_RWInteractor->GetInteractorStyleSALOME()->startZoom();
-}
-
-/*!
- Moves the active view
-*/
-void VTKViewer_ViewFrame::onViewPan(){
- m_RWInteractor->GetInteractorStyleSALOME()->startPan();
-}
-
-/*!
- Fits all obejcts within a rectangular area of the active view
-*/
-void VTKViewer_ViewFrame::onViewFitArea(){
- m_RWInteractor->GetInteractorStyleSALOME()->startFitArea();
-}
-
-/*!
- Set background of the viewport
-*/
-void VTKViewer_ViewFrame::setBackgroundColor( const QColor& color)
-{
- if ( m_Renderer )
- m_Renderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
-}
-
-/*!
- Returns background of the viewport
-*/
-QColor VTKViewer_ViewFrame::backgroundColor() const
-{
- float backint[3];
- if ( m_Renderer ) {
- m_Renderer->GetBackground(backint);
- return QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );
- }
- return QMainWindow::backgroundColor();
-}
-
-
-void VTKViewer_ViewFrame::SetSelectionMode( Selection_Mode mode )
-{
- m_RWInteractor->SetSelectionMode( mode );
-}
-
-void VTKViewer_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, QString newName )
-{
- m_RWInteractor->rename(IObject, newName);
-}
-
-void VTKViewer_ViewFrame::unHighlightAll()
-{
- m_RWInteractor->unHighlightAll();
-}
-
-void VTKViewer_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight,
- bool update )
-{
- QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
- m_RWInteractor->highlight(IObject, highlight, update);
-
- if(Sel->HasIndex(IObject) && IObject->hasEntry()){
- TColStd_IndexedMapOfInteger MapIndex;
- Sel->GetIndex(IObject,MapIndex);
- using namespace SALOME::VTK;
- const char* anEntry = IObject->getEntry();
- vtkActorCollection* aCollection = getRenderer()->GetActors();
- if(SALOME_Actor* anActor = Find<SALOME_Actor>(aCollection,TIsSameEntry<SALOME_Actor>(anEntry))){
- switch (Sel->SelectionMode()) {
- case NodeSelection:
- m_RWInteractor->highlightPoint(MapIndex,anActor,highlight,update);
- break;
- case EdgeOfCellSelection:
- m_RWInteractor->highlightEdge(MapIndex,anActor,highlight,update);
- break;
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- m_RWInteractor->highlightCell(MapIndex,anActor,highlight,update);
- break;
- }
- }
- }else{
- m_RWInteractor->unHighlightSubSelection();
- }
-}
-
-bool VTKViewer_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return m_RWInteractor->isInViewer( IObject );
-}
-
-bool VTKViewer_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
-{
- return m_RWInteractor->isVisible( IObject );
-}
-
-void VTKViewer_ViewFrame::setPopupServer( QAD_Application* App )
-{
- m_RW->setPopupServer( App );
-}
-
-/* selection */
-Handle(SALOME_InteractiveObject) VTKViewer_ViewFrame::FindIObject(const char* theEntry)
-{
- using namespace SALOME::VTK;
- SALOME_Actor* anActor =
- Find<SALOME_Actor>(getRenderer()->GetActors(),
- TIsSameEntry<SALOME_Actor>(theEntry));
- if(anActor)
- return anActor->getIO();
-
- return Handle(SALOME_InteractiveObject)();
-}
-
-/* display */
-void VTKViewer_ViewFrame::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
-{
- QAD_Study* aQADStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection( aQADStudy->getSelection() );
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
-
- m_RWInteractor->Display(theIObject,false);
- ToolsGUI::SetVisibility( aStudy, theIObject->getEntry(), true, this );
- aSel->AddIObject(theIObject,false);
-
- if(update)
- Repaint();
-}
-
-
-struct TDisplayAction{
- SALOME_Selection* mySel;
- Handle(SALOME_InteractiveObject) myIO;
- TDisplayAction(SALOME_Selection* theSel,
- Handle(SALOME_InteractiveObject) theIO):
- mySel(theSel), myIO(theIO)
- {}
- void operator()(SALOME_Actor* theActor){
- theActor->SetVisibility(true);
- mySel->AddIObject(myIO,false);
- }
-};
-
-void VTKViewer_ViewFrame::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
-{
- QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
-
- aSel->ClearIObjects();
- //m_RWInteractor->EraseAll();
- EraseAll();
-
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TDisplayAction(aSel,theIObject));
-
- ToolsGUI::SetVisibility(
- aStudy->getStudyDocument(), theIObject->getEntry(), true, this );
-
- Repaint();
-}
-
-
-struct TEraseAction: TDisplayAction{
- VTKViewer_RenderWindowInteractor* myRWInteractor;
- TEraseAction(SALOME_Selection* theSel,
- Handle(SALOME_InteractiveObject) theIO,
- VTKViewer_RenderWindowInteractor* theRWInteractor):
- TDisplayAction(theSel,theIO),
- myRWInteractor(theRWInteractor)
- {}
- void operator()(SALOME_Actor* theActor){
- myRWInteractor->Erase(myIO,false);
- mySel->RemoveIObject(myIO,false);
- }
-};
-
-void VTKViewer_ViewFrame::Erase(const Handle(SALOME_InteractiveObject)& theIObject, bool update)
-{
- QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection(aStudy->getSelection());
-
- using namespace SALOME::VTK;
- ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIObject),
- TEraseAction(aSel,theIObject,m_RWInteractor));
-
- ToolsGUI::SetVisibility(
- aStudy->getStudyDocument(), theIObject->getEntry(), false, this );
-
- if(update)
- Repaint();
-}
-
-
-void VTKViewer_ViewFrame::DisplayAll()
-{
- m_RWInteractor->DisplayAll();
-
- // update flag of visibility
- QAD_Study* aQADStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- const QString& aCompName = aDesktop->getComponentDataType();
- SALOMEDS::SObject_var aComponent =
- SALOMEDS::SObject::_narrow( aStudy->FindComponent ( aCompName.latin1() ) );
-
- std::list<SALOMEDS::SObject_var> aList;
- SALOMEDS_Tool::GetAllChildren( aStudy, aComponent, aList );
-
- std::list<SALOMEDS::SObject_var>::iterator anIter = aList.begin();
- for ( ; anIter != aList.end(); ++anIter )
- ToolsGUI::SetVisibility( aStudy, (*anIter)->GetID(), true, this );
-}
-
-
-void VTKViewer_ViewFrame::EraseAll()
-{
- m_RWInteractor->EraseAll();
-
- // update flag of visibility
- QAD_Study* aQADStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- const QString& aCompName = aDesktop->getComponentDataType();
- SALOMEDS::SObject_var aComponent =
- SALOMEDS::SObject::_narrow( aStudy->FindComponent ( aCompName.latin1() ) );
-
- std::list<SALOMEDS::SObject_var> aList;
- SALOMEDS_Tool::GetAllChildren( aStudy, aComponent, aList );
-
- std::list<SALOMEDS::SObject_var>::iterator anIter = aList.begin();
- for ( ; anIter != aList.end(); ++anIter )
- ToolsGUI::SetVisibility( aStudy, (*anIter)->GetID(), false, this );
-}
-
-
-void VTKViewer_ViewFrame::Repaint(bool theUpdateTrihedron)
-{
- if (theUpdateTrihedron) onAdjustTrihedron();
- m_RW->update();
-}
-
-void VTKViewer_ViewFrame::GetScale(double theScale[3]){
- m_Transform->GetScale(theScale);
-}
-
-void VTKViewer_ViewFrame::SetScale(double theScale[3]){
- m_Transform->SetScale(theScale[0], theScale[1], theScale[2]);
- m_RWInteractor->Render();
- Repaint();
-}
-
-void VTKViewer_ViewFrame::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors ){
- theActor->AddToRender(m_Renderer);
- theActor->SetTransform(m_Transform);
- if(theMoveInternalActors)
- m_RWInteractor->MoveInternalActors();
-}
-
-void VTKViewer_ViewFrame::AddActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ ){
- InsertActor(theActor);
- if(theUpdate)
- Repaint();
-}
-
-void VTKViewer_ViewFrame::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ ){
- theActor->RemoveFromRender(m_Renderer);
- if(theUpdate)
- Repaint();
-}
-
-void VTKViewer_ViewFrame::MoveActor(SALOME_Actor* theActor)
-{
- RemoveActor(theActor);
- InsertActor(theActor,true);
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::Display
- * Display presentation
- */
-//==========================================================
-void VTKViewer_ViewFrame::Display( const SALOME_VTKPrs* prs )
-{
- // try do downcast object
- const VTKViewer_Prs* aVTKPrs = dynamic_cast<const VTKViewer_Prs*>( prs );
- if ( !aVTKPrs || aVTKPrs->IsNull() )
- return;
-
- vtkActorCollection* actors = aVTKPrs->GetObjects();
- if ( !actors )
- return;
-
- actors->InitTraversal();
- vtkActor* actor;
- while( ( actor = actors->GetNextActor() ) )
- {
- SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor );
- if ( salomeActor )
- {
- // just display the object
- m_RWInteractor->Display( salomeActor, false );
-
- // Set visibility flag
- Handle(SALOME_InteractiveObject) anObj = salomeActor->getIO();
- if ( !anObj.IsNull() && anObj->hasEntry() )
- {
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- }
-
- if ( salomeActor->IsSetCamera() )
- salomeActor->SetCamera( getRenderer()->GetActiveCamera() );
- }
- }
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::Erase
- * Erase presentation
- */
-//==========================================================
-void VTKViewer_ViewFrame::Erase( const SALOME_VTKPrs* prs, const bool forced )
-{
- // try do downcast object
- const VTKViewer_Prs* aVTKPrs = dynamic_cast<const VTKViewer_Prs*>( prs );
- if ( !aVTKPrs || aVTKPrs->IsNull() )
- return;
-
- vtkActorCollection* actors = aVTKPrs->GetObjects();
- if ( !actors )
- return;
-
- SALOMEDS::Study_var aStudy =
- QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-
- actors->InitTraversal();
- vtkActor* actor;
- while( ( actor = actors->GetNextActor() ) ) {
- SALOME_Actor* salomeActor = SALOME_Actor::SafeDownCast( actor );
- if ( salomeActor ) {
- // just erase the object
- if ( forced )
- m_RWInteractor->Remove( salomeActor, false );
- else
- m_RWInteractor->Erase( salomeActor, forced );
-
- // Set visibility flag if necessary
- if ( !forced )
- {
- Handle(SALOME_InteractiveObject) anObj = salomeActor->getIO();
- if ( !anObj.IsNull() && anObj->hasEntry() )
- ToolsGUI::SetVisibility( aStudy, anObj->getEntry(), true, this );
- }
- }
- }
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::CreatePrs
- * Create presentation by entry
- */
-//==========================================================
-SALOME_Prs* VTKViewer_ViewFrame::CreatePrs( const char* entry )
-{
- VTKViewer_Prs* prs = new VTKViewer_Prs();
- if ( entry ) {
- vtkActorCollection* theActors = m_Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor* ac;
- while( ( ac = theActors->GetNextActor() ) ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
- prs->AddObject( ac );
- }
- }
- }
- return prs;
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::BeforeDisplay
- * Axiluary method called before displaying of objects
- */
-//==========================================================
-void VTKViewer_ViewFrame::BeforeDisplay( SALOME_Displayer* d )
-{
- d->BeforeDisplay( this, SALOME_VTKViewType() );
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::AfterDisplay
- * Axiluary method called after displaying of objects
- */
-//==========================================================
-void VTKViewer_ViewFrame::AfterDisplay( SALOME_Displayer* d )
-{
- d->AfterDisplay( this, SALOME_VTKViewType() );
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::undo
- * Redisplay all objects in viewer
- */
-//==========================================================
-void VTKViewer_ViewFrame::undo( QAD_Study* theQADStudy, const char* /*StudyFrameEntry*/ )
-{
- redisplayAll( theQADStudy, true );
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::redo
- * Redisplay all objects in viewer
- */
-//==========================================================
-void VTKViewer_ViewFrame::redo( QAD_Study* theQADStudy, const char* /*StudyFrameEntry*/ )
-{
- redisplayAll( theQADStudy, true );
-}
-
-//==========================================================
-/*!
- * VTKViewer_ViewFrame::redisplayAll
- * Redisplay all objects in viewer
- */
-//==========================================================
-void VTKViewer_ViewFrame::redisplayAll( QAD_Study* theQADStudy, const bool theToUpdate )
-{
- SALOMEDS::Study_var aStudy = theQADStudy->getStudyDocument();
- SALOME_Selection* aSel = SALOME_Selection::Selection( theQADStudy->getSelection() );
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- SALOMEGUI* aGUI = aDesktop->getActiveGUI();
- const QString& aCompName = aDesktop->getComponentDataType();
- SALOMEDS::SObject_var aComponent =
- SALOMEDS::SObject::_narrow( aStudy->FindComponent ( aCompName.latin1() ) );
-
- if ( aComponent->_is_nil() )
- return;
-
- bool isTrhDisplayed = isTrihedronDisplayed();
-
- m_RWInteractor->RemoveAll( false );
- //m_RWInteractor->EraseAll();
-
- aSel->ClearIObjects();
-
- if ( isTrhDisplayed )
- m_Triedron->AddToRender( m_Renderer );
-
- std::list<SALOMEDS::SObject_var> aList;
- SALOMEDS_Tool::GetAllChildren( aStudy, aComponent, aList );
-
- std::list<SALOMEDS::SObject_var>::iterator anIter = aList.begin();
- for ( ; anIter != aList.end(); ++anIter )
- {
- SALOMEDS::SObject_var anObj = (*anIter);
- if ( ToolsGUI::GetVisibility( aStudy, anObj, this ) )
- {
- Handle(SALOME_InteractiveObject) anIObj = new SALOME_InteractiveObject();
- anIObj->setEntry( anObj->GetID() );
- aGUI->BuildPresentation( anIObj, this );
- }
-
- }
-
- if ( theToUpdate )
- Repaint();
-}
-
-#define INCREMENT_FOR_OP 10
-
-//=======================================================================
-// name : onPanLeft
-// Purpose : Performs incremental panning to the left
-//=======================================================================
-void VTKViewer_ViewFrame::onPanLeft()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalPan( -INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onPanRight
-// Purpose : Performs incremental panning to the right
-//=======================================================================
-void VTKViewer_ViewFrame::onPanRight()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalPan( INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onPanUp
-// Purpose : Performs incremental panning to the top
-//=======================================================================
-void VTKViewer_ViewFrame::onPanUp()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalPan( 0, INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onPanDown
-// Purpose : Performs incremental panning to the bottom
-//=======================================================================
-void VTKViewer_ViewFrame::onPanDown()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalPan( 0, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onZoomIn
-// Purpose : Performs incremental zooming in
-//=======================================================================
-void VTKViewer_ViewFrame::onZoomIn()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalZoom( INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onZoomOut
-// Purpose : Performs incremental zooming out
-//=======================================================================
-void VTKViewer_ViewFrame::onZoomOut()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalZoom( -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onRotateLeft
-// Purpose : Performs incremental rotating to the left
-//=======================================================================
-void VTKViewer_ViewFrame::onRotateLeft()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalRotate( -INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onRotateRight
-// Purpose : Performs incremental rotating to the right
-//=======================================================================
-void VTKViewer_ViewFrame::onRotateRight()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalRotate( INCREMENT_FOR_OP, 0 );
-}
-
-//=======================================================================
-// name : onRotateUp
-// Purpose : Performs incremental rotating to the top
-//=======================================================================
-void VTKViewer_ViewFrame::onRotateUp()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalRotate( 0, -INCREMENT_FOR_OP );
-}
-
-//=======================================================================
-// name : onRotateDown
-// Purpose : Performs incremental rotating to the bottom
-//=======================================================================
-void VTKViewer_ViewFrame::onRotateDown()
-{
- m_RWInteractor->GetInteractorStyleSALOME()->IncrementalRotate( 0, INCREMENT_FOR_OP );
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// SALOME VTKViewer : build VTK viewer into Salome desktop
-//
-// 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 : VTKViewer_ViewFrame.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef VTKViewer_ViewFrame_H
-#define VTKViewer_ViewFrame_H
-
-#include "QAD.h"
-#include "QAD_ViewFrame.h"
-
-class vtkRenderer;
-
-class SALOME_Actor;
-class SALOME_Transform;
-
-class VTKViewer_Trihedron;
-class VTKViewer_RenderWindow;
-class VTKViewer_RenderWindowInteractor;
-
-
-class QAD_EXPORT VTKViewer_ViewFrame : public QAD_ViewFrame
-{
- Q_OBJECT;
-
-public:
- VTKViewer_ViewFrame(QWidget* parent, const char* name=0 );
- ~VTKViewer_ViewFrame();
-
- ViewType getTypeView() const{ return VIEW_VTK;};
- QWidget* getViewWidget();
- vtkRenderer* getRenderer() {return m_Renderer;}
-
- VTKViewer_RenderWindow* getRW() {return m_RW;}
- VTKViewer_RenderWindowInteractor* getRWInteractor() {return m_RWInteractor;}
-
- bool isTrihedronDisplayed();
-
- void setBackgroundColor( const QColor& );
- QColor backgroundColor() const;
-
- void SetSelectionMode( Selection_Mode mode );
-
- /* popup management */
- void setPopupServer( QAD_Application* );
-
- /* interactive object management */
- void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly = true );
- void unHighlightAll();
- void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
- bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
- bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
-
- /* selection */
- Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
-
- /* display */
- void Display( const Handle(SALOME_InteractiveObject)& IObject,
- bool immediatly = true );
- void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
- void Erase( const Handle(SALOME_InteractiveObject)& IObject,
- bool immediatly = true );
- void DisplayAll();
- void EraseAll();
- void Repaint( bool theUpdateTrihedron );
- void Repaint() { Repaint(true); }
-
- virtual void undo( QAD_Study* aStudy, const char* StudyFrameEntry );
- virtual void redo( QAD_Study* aStudy, const char* StudyFrameEntry );
-
- /* Reimplemented from SALOME_View */
- void Display( const SALOME_VTKPrs* );
- void Erase( const SALOME_VTKPrs*, const bool = false );
- SALOME_Prs* CreatePrs( const char* entry = 0 );
- virtual void BeforeDisplay( SALOME_Displayer* d );
- virtual void AfterDisplay ( SALOME_Displayer* d );
-
- //apply existing transformation on adding SALOME_Actor
- void SetScale( double theScale[3] );
- void GetScale( double theScale[3] );
- void AddActor( SALOME_Actor*, bool update = false );
- void RemoveActor(SALOME_Actor*, bool update = false);
-
- void AdjustTrihedrons( const bool forced );
- bool ComputeTrihedronSize( double& theNewSize,
- double& theOldSize );
- double GetTrihedronSize() const;
-
-public slots:
- void onViewPan();
- void onViewZoom();
- void onViewFitAll();
- void onViewFitArea();
- void onViewGlobalPan();
- void onViewRotate();
- void onViewReset();
- void onViewFront();
- void onViewBack();
- void onViewRight();
- void onViewLeft();
- void onViewBottom();
- void onViewTop();
- void onViewTrihedron();
- void onAdjustTrihedron();
-
- void onPanLeft();
- void onPanRight();
- void onPanUp();
- void onPanDown();
- void onZoomIn();
- void onZoomOut();
- void onRotateLeft();
- void onRotateRight();
- void onRotateUp();
- void onRotateDown();
-
-private:
- void InitialSetup();
- void redisplayAll( QAD_Study*, const bool = true );
- void InsertActor( SALOME_Actor* theActor,
- bool theMoveInternalActors = false );
- void MoveActor( SALOME_Actor* theActor );
-
-private:
- double m_ViewUp[ 3 ];
- double m_ViewNormal[ 3 ];
- vtkRenderer* m_Renderer;
- VTKViewer_RenderWindow* m_RW;
- VTKViewer_RenderWindowInteractor* m_RWInteractor;
- VTKViewer_Trihedron* m_Triedron;
- SALOME_Transform* m_Transform;
-
- friend class VTKViewer_RenderWindowInteractor;
-};
-#endif